//nov function onAgree(isCheckbox) { if (isCheckbox.checked) { document.getElementById('id-complete').classList.remove('proam-disabled'); } else { document.getElementById('id-complete').classList.add('proam-disabled'); } } function ChangeMail(InputBox) { let listmistakes = ''; let idis = InputBox.id; let isshort = ''; let symbarray = InputBox.value.toLowerCase(); let isalphabet = '@.'; let countsymb = [0,0]; let placesymb = [0,0]; let i = 0; let t = ''; while (i < symbarray.length) { t=isalphabet.indexOf(symbarray[i]); if (isalphabet.indexOf(symbarray[i]) != -1) { countsymb[t]++; placesymb[t]=i; } i = i + 1; } let numbermistake = 0; let prompt = ''; if (countsymb[0] !=1 || countsymb[1] < 1) { prompt = 'Некорректный адрес почты'; } if (countsymb[0]==1 && countsymb[1] >= 1) { /* if (placesymb[1]-1) { prompt = ((prompt !== '')? prompt+', ':'')+'мы не принимаем адреса с сервиса gmail для регистрации!'; } } if (prompt === '') { document.getElementById('id-'+idis).classList.add('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.add('hidediv'); document.getElementById('id-info').innerHTML =' '; } else { document.getElementById('id-'+idis).classList.remove('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.remove('hidediv'); document.getElementById('id-info').innerHTML = prompt; } } function InputPhone(InputBox) { let listmistakes = ''; let idis = InputBox.id; let isshort = ''; let symbarray = InputBox.value.toLowerCase(); if (symbarray.length<12) { isshort = 'номер телефона слишком короткий! '; } let isalphabet = '+0123456789'; let i = 0; while (i < symbarray.length) { if (isalphabet.indexOf(symbarray[i]) == -1) { document.getElementById('id-info').innerHTML ='j'; listmistakes = (listmistakes !=="") ? (listmistakes+', '+symbarray[i]) : symbarray[i]; } i = i + 1; } listmistakes = (listmistakes.length ===0 ) ? '' : (((listmistakes.length ==1 ) ? 'Неверный символ в номере телефона: ' :'Неверные символы в номере телефона: ')+listmistakes); listmistakes = isshort + listmistakes; if (listmistakes === "") { document.getElementById('id-'+idis).classList.add('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.add('hidediv'); document.getElementById('id-info').innerHTML =' '; } else { document.getElementById('id-'+idis).classList.remove('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.remove('hidediv'); document.getElementById('id-info').innerHTML = listmistakes; } } function CheckStyle(InputBox) { let idis = InputBox.id; if (InputBox.value !== "not") { document.getElementById('id-'+idis).classList.add('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.add('hidediv'); if (InputBox.value == "St" || InputBox.value == "La" ) { document.getElementById('placeformballroom').classList.remove('hidediv'); document.getElementById('placeformother').classList.add('hidediv'); } if (InputBox.value == "Jazz" || InputBox.value == "HipHop" || InputBox.value == "Modern" || InputBox.value == "Disko" || InputBox.value == "Folk" || InputBox.value == "Balet") { document.getElementById('placeformballroom').classList.add('hidediv'); document.getElementById('placeformother').classList.remove('hidediv'); } } else { document.getElementById('id-'+idis).classList.remove('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.remove('hidediv'); document.getElementById('placeformballroom').classList.add('hidediv'); document.getElementById('placeformother').classList.add('hidediv'); document.getElementById('formballroom').value="not"; document.getElementById('formother').value="not"; } FetchAges(); } function CheckForm(InputBox) { let idis = InputBox.id; if (InputBox.value !== "not") { document.getElementById('id-'+idis).classList.add('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.add('hidediv'); } else { document.getElementById('id-'+idis).classList.remove('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.remove('hidediv'); } FetchAges(); } function CheckSex(InputBox) { let idis = InputBox.id; if (InputBox.value !== "not") { document.getElementById('id-'+idis).classList.add('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.add('hidediv'); } else { document.getElementById('id-'+idis).classList.remove('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.remove('hidediv'); } } function CheckData(InputBox) { let idis = InputBox.id; if (InputBox.value !== "") { document.getElementById('id-'+idis).classList.add('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.add('hidediv'); } else { document.getElementById('id-'+idis).classList.remove('proamgreenfont'); document.getElementById('id-'+idis+'-empty').classList.remove('hidediv'); } } function onSave(i) { let listmistakes = ''; if (!document.getElementById('id-name').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-name').innerHTML; } if (!document.getElementById('id-dancestyle').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-dancestyle').innerHTML; } else { let valStyle= document.getElementById('id-dancestyle').value; if (valStyle == "St" || valStyle == "La" ) { if (!document.getElementById('id-formballroom').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-formballroom').innerHTML; } } if (valStyle== "Jazz" || valStyle== "HipHop" || valStyle== "Modern" || valStyle== "Disko" || valStyle== "Folk" || valStyle== "Balet") { if (!document.getElementById('id-formother').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-formother').innerHTML; } } } if (!document.getElementById('id-mail').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-mail').innerHTML; } if (!document.getElementById('id-phone').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-phone').innerHTML; } if (!document.getElementById('id-coach').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-coach').innerHTML; } if (!document.getElementById('id-club').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-club').innerHTML; } if (!document.getElementById('id-city').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-city').innerHTML; } if (!document.getElementById('id-age').classList.contains('proamgreenfont')) { listmistakes = ((listmistakes ==='') ? '' : listmistakes +', ') + document.getElementById('id-age').innerHTML; } if (listmistakes !== '') { document.getElementById("id-info").innerHTML = "Недостаточно данных: " + listmistakes; } else { let keys_data = [ "idDancer", // 0 "Name", // 1 "Dancestyle", // 2 "FormBallroom", // 3 "FormOther", // 4 "Mail", // 5 "Phone", // 6 "Coach", "Club", ]; var array_json = Array(); var list_edited = document.querySelectorAll(".loaditem"); var array_changes = {id:0}; var id_is = ''; list_edited.forEach(elem => { id_is = elem.id; array_changes[id_is]= document.getElementById(id_is).value; } ); array_changes["index"]=String(i); var participants={}; let k=0; for(i=1000001;i<1000051;i++) { if (!document.getElementById("div_"+i).classList.contains('hidenewdancer')){ k= i-1000000; participants["name_"+k]=document.getElementById("inp_"+i+"_0").value; participants["birthdate_"+k]=document.getElementById("inp_"+i+"_1").value; } } array_changes["participants"]=participants; var json_ready = JSON.stringify(array_changes); sendJSON(json_ready); } } function onUpdate() { let keys_data = [ "partnerst", // 0 "partnerla", // 1 "city", // 2 "club", // 3 "country", // 4 ]; var array_changes = {}; for(let i=0;i1) { chrs=tmp[1]+format[j]+tmp[0]; } } var str = ''; for (var i = 0; i < len; i++) { var pos = Math.floor(Math.random() * chrs.length); str += chrs.substring(pos,pos+1); } return str; } function oncreateNewDancer() { var countNew = document.getElementsByClassName("hidenewdancer"); let idd = countNew[0].id; document.getElementById(idd).classList.remove("hidenewdancer"); } function FetchAges (){ let InputBox=document.getElementById("dancestyle"); let AgeSelect=document.getElementById("age"); AgeSelect.innerHTML=''; AgeSelect.disabled=true; if (InputBox.value == "St" || InputBox.value == "La" ) { let FormIs=document.getElementById("formballroom"); let newOption = new Option("не определена", "not"); AgeSelect.append(newOption); if (FormIs.value!='not') { AgeSelect.disabled=false; if (FormIs.value=='Пары') { newOption = new Option("Ювеналы-1 9 лет и моложе Первенство РТС", "Ювеналы-1 9 лет и моложе Первенство РТС"); AgeSelect.append(newOption); newOption = new Option("Ювеналы-2 10-11 лет Первенство РТС", "Ювеналы-2 10-11 лет Первенство РТС"); AgeSelect.append(newOption); newOption = new Option("Юниоры-1 12-13 лет Первенство РТС", "Юниоры-1 12-13 лет Первенство РТС"); AgeSelect.append(newOption); newOption = new Option("Юниоры-2 14-15 лет Первенство РТС", "Юниоры-2 14-15 лет Первенство РТС"); AgeSelect.append(newOption); newOption = new Option("Молодежь 16-18 лет Первенство РТС", "Молодежь 16-18 лет Первенство РТС"); AgeSelect.append(newOption); newOption = new Option("Взрослые 19 и старше Чемпионат РТС", "Взрослые 19 и старше Чемпионат РТС"); AgeSelect.append(newOption); newOption = new Option("Сеньоры 35 и старше Первенство РТС", "Сеньоры 35 и старше Первенство РТС"); AgeSelect.append(newOption); } if (FormIs.value=='Дебют_Соло' || FormIs.value=='Дебют_Пары' || FormIs.value=='Дебют_Группы') { newOption = new Option("9 и моложе", "9 и моложе"); AgeSelect.append(newOption); newOption = new Option("10 и старше", "10 и старше"); AgeSelect.append(newOption); } if (FormIs.value=='Pro-am') { newOption = new Option("11 и моложе", "11 и моложе"); AgeSelect.append(newOption); newOption = new Option("12-18 лет", "12-18 лет"); AgeSelect.append(newOption); newOption = new Option("19-35 лет", "19-35 лет"); AgeSelect.append(newOption); newOption = new Option("36-50 лет", "36-50 лет"); AgeSelect.append(newOption); newOption = new Option("51 и старше", "51 и старше"); AgeSelect.append(newOption); } if (FormIs.value=='Малые_формы' || FormIs.value=='Ансамбли') { newOption = new Option("9 и моложе", "9 и моложе"); AgeSelect.append(newOption); newOption = new Option("10-11 лет", "10-11 лет"); AgeSelect.append(newOption); newOption = new Option("12-15 лет", "12-15 лет"); AgeSelect.append(newOption); newOption = new Option("16-34 года", "16-34 года"); AgeSelect.append(newOption); newOption = new Option("35 лет и старше", "35 лет и старше"); AgeSelect.append(newOption); newOption = new Option("Смешанная", "Смешанная"); AgeSelect.append(newOption); } if (FormIs.value=='Дуэты' || FormIs.value=='Соло') { newOption = new Option("9 и моложе", "9 и моложе"); AgeSelect.append(newOption); newOption = new Option("10-11 лет", "10-11 лет"); AgeSelect.append(newOption); newOption = new Option("12-15 лет", "12-15 лет"); AgeSelect.append(newOption); newOption = new Option("16-34 года", "16-34 года"); AgeSelect.append(newOption); } } } if (InputBox.value == "Jazz" || InputBox.value == "HipHop" || InputBox.value == "Modern" || InputBox.value == "Disko" || InputBox.value == "Folk" || InputBox.value == "Balet") { let FormIs=document.getElementById("formother"); let newOption = new Option("не определена", "not"); AgeSelect.append(newOption); if (FormIs.value!='not') { AgeSelect.disabled=false; newOption = new Option("Дебют 10 и моложе", "Дебют 10 и моложе"); AgeSelect.append(newOption); newOption = new Option("Младшая 11 и моложе", "Младшая 11 и моложе"); AgeSelect.append(newOption); newOption = new Option("Средняя 12-15 лет", "Средняя 12-15 лет"); AgeSelect.append(newOption); newOption = new Option("Старшая 16 и старше", "Старшая 16 и старше"); AgeSelect.append(newOption); } } CheckSex(AgeSelect); } function sendJSON(isData) { let xhr = new XMLHttpRequest(); let url = "https://reg.rdu.ru/proam/jsonshownew.php"; xhr.open("POST", url, true); xhr.setRequestHeader("Content-Type", "application/json"); // когда придёт ответ на наше обращение к серверу, мы его обработаем здесь xhr.onreadystatechange = function () { // если запрос принят и сервер ответил, что всё в порядке if (xhr.readyState === 4 && xhr.status === 200) { // выводим то, что ответил нам сервер — так мы убедимся, что данные он получил правильно let s=this.responseText.trim(); document.getElementById("id-info").innerHTML =s; if (s=='Регистрация завершена') { document.getElementById('id-addnew').classList.remove("hidediv"); document.getElementById('id-complete').classList.add('proam-disabled'); document.getElementById('id-agree').checked=false; } } else { document.getElementById("id-info").innerHTML = xhr.status +' '+this.responseText; } }; xhr.send(isData); document.getElementById("id-info").innerHTML = ' ожидаем подтверждение регистрации'; }