<script>
//tildacrm
const service1 = '8455684b3208fe22d24971be37517c10';
//telegram
const service2 = 'c54b5aba7fd9c05c5bcef90c9cc024fc';
//email: hda421
const service3 = 'd759052b16b1c04edb61ef3deca94127';
//tildacrm: MET-REZ
const service4 = '591178760a98ec7cab83fedb33b025c1';
//email: hda124
const service5 = '80a0aa43188c42933c27abfe98d4bb6f';
const services = {
"Камчатская 16" : [service1, service5],
"Кутузовский 33" : [service3, service4, service2],
"Непокорённых 21" : [service3],
};
document.addEventListener("DOMContentLoaded", function() {
(function () {
document.addEventListener('click', function(event) {
if(event.target.closest('.uc-difform .t-submit')){
const form = event.target.closest('form');
const successBox = form.querySelector('.js-successbox');
const location = form.querySelectorAll('[name="location"]');
if(location!=null){
let locationValue = '';
location.forEach(function (el, index) {
if(el.checked) locationValue = el.value;
});
if(locationValue!=''){
const locationServices = services[locationValue];
if(locationServices!=undefined){
form.querySelectorAll('.js-formaction-services').forEach(function (el, index) {
el.remove();
});
for(let i=0; i<locationServices.length;i++){
const input = document.createElement("input");
input.type = "hidden";
input.name = "formservices[]";
input.setAttribute('tabindex', '-1');
input.value = locationServices[i];
input.className = "js-formaction-services";
form.insertBefore(input, successBox);
};
};
};
};//******
};
});
})();
});
</script>