View | Details | Raw Unified | Return to bug 38373
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/js/members.js (-1 / +21 lines)
Lines 191-196 function write_age() { Link Here
191
    hint.html(age_string);
191
    hint.html(age_string);
192
}
192
}
193
193
194
function toggleRelationshipRequired() {
195
    const relationshipField = $('.relationship');
196
    const label = relationshipField.parent().find('label');
197
    const requiredIndicator = relationshipField.parent().find('span.required');
198
199
    if ($('#contactname').val().length === 0) {
200
        label.removeClass('required');
201
        requiredIndicator.hide();
202
        relationshipField.removeAttr('required');
203
    } else {
204
        label.addClass('required');
205
        requiredIndicator.show();
206
        relationshipField.attr('required', 'required');
207
    }
208
}
209
194
$(document).ready(function(){
210
$(document).ready(function(){
195
    if($("#yesdebarred").is(":checked")){
211
    if($("#yesdebarred").is(":checked")){
196
        $("#debarreduntil").show();
212
        $("#debarreduntil").show();
Lines 221-226 $(document).ready(function(){ Link Here
221
        $(this).parents('fieldset').first().remove();
237
        $(this).parents('fieldset').first().remove();
222
    });
238
    });
223
239
240
    if (mandatory_fields.includes('relationship')) {
241
        toggleRelationshipRequired();
242
        $('#contactname').on('change', toggleRelationshipRequired);
243
    }
244
    
224
    $(document.body).on('change','.select_city',function(){
245
    $(document.body).on('change','.select_city',function(){
225
        var selected_city = $(this).val();
246
        var selected_city = $(this).val();
226
        var addressfield = $(this).data("addressfield");
247
        var addressfield = $(this).data("addressfield");
227
- 

Return to bug 38373