Implement enable/disable quantity base on participant's value type

This commit is contained in:
Hadi Nategh 2016-04-29 08:40:55 +00:00
parent bd59406191
commit 1bf2ab4016
4 changed files with 33 additions and 8 deletions

View File

@ -249,6 +249,7 @@ var et2_textbox = (function(){ "use strict"; return et2_inputWidget.extend([et2_
*/
set_readonly: function(_readonly) {
this.input.attr("readonly", _readonly);
this.input.toggleClass('et2_textbox_ro', _readonly);
},
set_blur: function(_value) {

View File

@ -1121,15 +1121,36 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
},
/**
* Change participant add button status based on
* participants field value
* On change participant event, try to set add button status based on
* participant field value. Additionally, disable/enable quantity field
* if there's none resource value or there are more than one resource selected.
*
*/
participantOnChange: function () {
participantOnChange: function ()
{
var add = this.et2.getWidgetById('add');
var quantity = this.et2.getWidgetById('quantity');
var participant = this.et2.getWidgetById('participant');
add.set_readonly(participant.get_value().length <= 0);
// array of participants
var value = participant.get_value();
add.set_readonly(value.length <= 0);
quantity.set_readonly(false);
// number of resources
var nRes = 0;
for (var i=0;i<value.length;i++)
{
if (!value[i].match(/\D/ig) || nRes)
{
quantity.set_readonly(true);
quantity.set_value(1);
}
nRes++;
}
},
/**

View File

@ -1436,3 +1436,5 @@ input#calendar-edit_location {padding-left: 0;}
display:inline;
}
}
#calendar-edit_quantity.et2_textbox_ro {opacity:0.5;}

View File

@ -11,7 +11,7 @@
* @package calendar
* @version $Id$
*/
/* $Id: app.css 55840 2016-04-25 22:09:57Z nathangray $ */
/* $Id: app.css 55869 2016-04-26 22:58:35Z nathangray $ */
/*Media print classes*/
@media print {
#calendar-view.et2_container,
@ -1394,6 +1394,9 @@ input#calendar-edit_location {
display: inline;
}
}
#calendar-edit_quantity.et2_textbox_ro {
opacity: 0.5;
}
/*generell*/
.egw_fw_content_browser_iframe img[src$="svg"] {
background-color: #828282 !important;
@ -2624,5 +2627,3 @@ div#calendar-container div.calendar table tbody tr.rowhilite td {
#calendar_merge {
margin: 9px 0 0 0;
}
/* ########################################################################################
/* * Calendar END */