fix js error

This commit is contained in:
Diatrex 2021-06-24 13:33:54 +03:00
parent a4533f8c8b
commit f9da388729

View File

@ -46,9 +46,13 @@ $('.editInformationUser').on('click', function () {
var profile = response.data; var profile = response.data;
$('input[name="first_name"]').val(profile.first_name); $('input[name="first_name"]').val(profile.first_name);
$('input[name="last_name"]').val(profile.last_name); $('input[name="last_name"]').val(profile.last_name);
intlTelInput(document.querySelector("input[name='gsm_phone']")).setNumber(profile.gsm_phone); const numbers = ['gsm_phone', 'office_phone', 'land_phone'];
intlTelInput(document.querySelector("input[name='office_phone']")).setNumber(profile.office_phone); for (let i = 0; i < numbers.length; i++) {
intlTelInput(document.querySelector("input[name='land_phone']")).setNumber(profile.land_phone); const number = numbers[i];
if (profile[number]) {
intlTelInput(document.querySelector(`input[name=${number}]`)).setNumber(profile[number]);
}
}
} }
} }
}); });