Lines 258-263
Link Here
|
258 |
<li class="attributes"> |
258 |
<li class="attributes"> |
259 |
<label style="width:auto;">Attribute: |
259 |
<label style="width:auto;">Attribute: |
260 |
<select name="patron_attributes"> |
260 |
<select name="patron_attributes"> |
|
|
261 |
<option value=""></option> |
261 |
[% FOREACH pac IN patron_attributes_codes %] |
262 |
[% FOREACH pac IN patron_attributes_codes %] |
262 |
<option value="[% pac.attribute_code %]" data-type="[% pac.type %]" data-category="[% pac.category_lib %]">[% pac.attribute_lib %]</option> |
263 |
<option value="[% pac.attribute_code %]" data-type="[% pac.type %]" data-category="[% pac.category_lib %]">[% pac.attribute_lib %]</option> |
263 |
[% END %] |
264 |
[% END %] |
Lines 365-386
Link Here
|
365 |
|
366 |
|
366 |
function updateAttrValues (select_attr) { |
367 |
function updateAttrValues (select_attr) { |
367 |
var attr_code = $(select_attr).val(); |
368 |
var attr_code = $(select_attr).val(); |
368 |
var type = $(select_attr).find("option:selected").attr('data-type'); |
369 |
var selected_option = $(select_attr).find("option:selected"); |
369 |
var category = $(select_attr).find("option:selected").attr('data-category'); |
370 |
var type = $(selected_option).attr('data-type'); |
370 |
var span = $(select_attr).parent().parent().find('span.patron_attributes_value'); |
371 |
var category = $(selected_option).attr('data-category'); |
371 |
var information_category_node = $(select_attr).parent().parent().find('span.information_category'); |
372 |
var li_node = $(select_attr).parent().parent(); |
|
|
373 |
var span = $(li_node).find('span.patron_attributes_value'); |
374 |
var information_category_node = $(li_node).find('span.information_category'); |
372 |
information_category_node.html(""); |
375 |
information_category_node.html(""); |
373 |
if ( category.length > 0 ) { |
376 |
|
|
|
377 |
if ( category && category.length > 0 ) { |
374 |
information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category)); |
378 |
information_category_node.html(_("This attribute will be only applied to the patron's category %s").format(category)); |
375 |
} |
379 |
} |
|
|
380 |
var disable_input_node = $(li_node).find("input:checkbox[name='disable_input']"); |
376 |
if ( type == 'select' ) { |
381 |
if ( type == 'select' ) { |
377 |
var options = '<option value = ""></option>'; |
382 |
var options = '<option value = ""></option>'; |
378 |
for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) { |
383 |
for ( var i = 0 ; i < patron_attributes_values[attr_code].length ; i++ ) { |
379 |
options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>'; |
384 |
options += '<option value="'+patron_attributes_values[attr_code][i]+'">'+patron_attributes_lib[attr_code][i]+'</option>'; |
380 |
} |
385 |
} |
381 |
span.html('<select name="patron_attributes_value">' + options + '</select>'); |
386 |
span.html('<select name="patron_attributes_value">' + options + '</select>'); |
|
|
387 |
$(disable_input_node).show(); |
388 |
} else if ( $(selected_option).val() != "" ) { |
389 |
span.html('<input type="text" name="patron_attributes_value"/>'); |
390 |
$(disable_input_node).show(); |
382 |
} else { |
391 |
} else { |
383 |
span.html('<input type="text" name="patron_attributes_value"/>') |
392 |
span.html(''); |
|
|
393 |
$(disable_input_node).hide(); |
384 |
} |
394 |
} |
385 |
} |
395 |
} |
386 |
|
396 |
|