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

(-)a/koha-tmpl/intranet-tmpl/prog/js/members.js (-4 / +29 lines)
Lines 235-242 function write_age() { Link Here
235
    hint.html(age_string);
235
    hint.html(age_string);
236
}
236
}
237
237
238
$(document).ready(function () {
238
function toggleRelationshipRequired() {
239
    if ($("#yesdebarred").is(":checked")) {
239
    const relationshipField = $('.relationship');
240
    const label = relationshipField.parent().find('label');
241
    const requiredIndicator = relationshipField.parent().find('span.required');
242
243
    if (!$('#contactname').val() && !$('#contactfirstname').val()) {
244
        label.removeClass('required');
245
        requiredIndicator.hide();
246
        relationshipField.removeAttr('required');
247
    } else {
248
        label.addClass('required');
249
        requiredIndicator.show();
250
        relationshipField.attr('required', 'required');
251
    }
252
}
253
254
$(document).ready(function(){
255
    if($("#yesdebarred").is(":checked")){
240
        $("#debarreduntil").show();
256
        $("#debarreduntil").show();
241
    } else {
257
    } else {
242
        $("#debarreduntil").hide();
258
        $("#debarreduntil").hide();
Lines 274-280 $(document).ready(function () { Link Here
274
        }
290
        }
275
    );
291
    );
276
292
277
    $(document.body).on("change", ".select_city", function () {
293
    if (mandatory_fields.includes('relationship')) {
294
        toggleRelationshipRequired();
295
        if ($('#contactname').length) {
296
            $('#contactname').on('change', toggleRelationshipRequired);
297
        }
298
        if ($('#contactfirstname').length) {
299
            $('#contactfirstname').on('change', toggleRelationshipRequired);
300
        }
301
    }
302
303
    $(document.body).on('change','.select_city',function(){
278
        var selected_city = $(this).val();
304
        var selected_city = $(this).val();
279
        var addressfield = $(this).data("addressfield");
305
        var addressfield = $(this).data("addressfield");
280
        var myRegEx = new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/);
306
        var myRegEx = new RegExp(/(.*)\|(.*)\|(.*)\|(.*)/);
281
- 

Return to bug 38373