File: /var/www/vhosts/greenclinic.kz/newsite/wp-content/themes/green-clinic/page-zapis-na-priem-old.php
<?php
$list = get_field('list');
$i = 1;
?>
<?php get_header(); ?>
<?php get_template_part( 'template-parts/content_header', 'none' ); ?>
<?php get_template_part( 'blocks/blocks' ); ?>
<section id="blocks-2" class="section custom-animation custom-animation-1 section__znp section__znp_1">
<div class="container">
<div class="section__znp_wrap">
<div class="row">
<div class="znp_choise_age">
<div class="znp_label">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Кто идёт на приём?';
} elseif ($current_language == 'kz') {
echo 'Кездесуге кім барады?';
} else {
echo "Who's going to the reception?"; // Default to Russian or the original language
}
?>
</div>
<div class="znp_choise_age_items">
<div class="znp_choise_age_adult">
<input type="radio" id="znp_choise_age_adult" name="znp_choise_age" value="adult" />
<label for="znp_choise_age_adult">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Взрослый';
} elseif ($current_language == 'kz') {
echo 'Ересек';
} else {
echo "Adult"; // Default to Russian or the original language
}
?>
</label>
</div>
<div class="znp_choise_age_child">
<input type="radio" id="znp_choise_age_child" name="znp_choise_age" value="child" />
<label for="znp_choise_age_child">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Ребенок';
} elseif ($current_language == 'kz') {
echo 'Бала';
} else {
echo "Kid"; // Default to Russian or the original language
}
?>
</label>
</div>
<div class="znp_choise_age_child_age" id="znp_choise_age_child_age">
<div class="dropdown">
<div id="selectedAge" onclick="toggleDropdown()">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Выберите возраст';
} elseif ($current_language == 'kz') {
echo 'Жасын таңдаңыз';
} else {
echo "Choose your age"; // Default to Russian or the original language
}
?>
</div>
<div class="dropdown-content" id="ageDropdown">
<div class="dropdown-content-wrap">
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('до года')">до года</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('1 год')">1 год</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('2 года')">2 года</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('3 года')">3 года</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('4 года')">4 года</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('5 лет')">5 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('6 лет')">6 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('7 лет')">7 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('8 лет')">8 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('9 лет')">9 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('10 лет')">10 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('11 лет')">11 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('12 лет')">12 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('13 лет')">13 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('14 лет')">14 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('15 лет')">15 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('16 лет')">16 лет</a>
<a href="javascript:void(0);" data-ctype="age" onclick="selectAge('17 лет')">17 лет</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="znp_choise_specialist-wrap">
<div class="znp_label">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Выберите специалиста';
} elseif ($current_language == 'kz') {
echo 'Маманды таңдаңыз';
} else {
echo "Choose a specialist"; // Default to Russian or the original language
}
?>
</div>
<div class="row">
<div class="znp_choise_specialist">
<input type="radio" id="znp_choise_specialist_consultation" name="znp_choise_specialist" value="consultation" />
<label for="znp_choise_specialist_consultation">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Консультация';
} elseif ($current_language == 'kz') {
echo 'Кеңес беру';
} else {
echo "Consultation"; // Default to Russian or the original language
}
?>
</label>
</div>
<div class="znp_choise_specialist">
<input type="radio" id="znp_choise_specialist_diagnostic" name="znp_choise_specialist" value="diagnostic" />
<label for="znp_choise_specialist_diagnostic">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Диагностика';
} elseif ($current_language == 'kz') {
echo 'Диагностика';
} else {
echo "Diagnostics"; // Default to Russian or the original language
}
?>
</label>
</div>
</div>
</div>
<div class="znp_data_choice">
<div id="date-picker"></div>
</div>
<div class="znp_service_choice" id="znp_service_choice">
<div class="znp_service_choice_wrap">
<div class="znp_service_choice_info">
<div class="znp_service_choice_title" > <span id="service-name">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Прием врача первичный';
} elseif ($current_language == 'kz') {
echo 'Дәрігерді қабылдау бастапқы';
} else {
echo "Primary doctor's appointment"; // Default to Russian or the original language
}
?>
</span> </div>
<div class="znp_service_choice_adress" > <span id="service-type">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'отделение Астана, Хусейн бен Талал 25/1';
} elseif ($current_language == 'kz') {
echo 'Астана бөлімшесі, Хусейн бен Талал 25/1';
} else {
echo "Astana branch, Hussein bin Talal 25/1"; // Default to Russian or the original language
}
?>
</span> <span id="service-doc-frame"> </span></div>
<div class="znp_service_choice_adress" > <span id="service-doc-info"> </span> </div>
<!-- <div class="znp_service_choice_price" > <span id="service-price">8000 тг.</span> </div> -->
</div>
<div class="znp_service_choice_btn">
<button data-step="go-step-2" id="go-step-2"><?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Выбрать ';
} elseif ($current_language == 'kz') {
echo 'Таңдау';
} else {
echo "Choose"; // Default to Russian or the original language
}
?>
<svg width="24.000000" height="24.000000" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs/>
<path id="Vector 9" d="M16.793 11.5L13.6465 8.35352L14.3535 7.64648L18.707 12L14.3535 16.3535L13.6465 15.6465L16.793 12.5L6 12.5C5.71973 12.5 5.5 12.28 5.5 12C5.5 11.72 5.71973 11.5 6 11.5L16.793 11.5Z" fill="#262626" fill-opacity="1.000000" fill-rule="evenodd"/>
</svg>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="blocks-3" class="section custom-animation custom-animation-2 section__znp section__znp_2">
<div class="container">
<div class="row">
<div class="section__znp_form">
<?php echo do_shortcode('[contact-form-7 id="b02b7ac" title=":ruЗапись на прием:"] '); ?>
</div>
<div class="section__znp_info">
<div class="section__znp_info_wrp">
<div class="section__znp_info_title" >
<span id="section__znp_info_title"></span> <span id="section__znp_info_price"></span>
</div>
<div class="section_znp_info_date" id="section_znp_info_date"></div>
<div class="section_znp_info_adress">Астана,Хусейн бен Талал 25/1 <span id="service-doc-frame2"> </span></div>
<div class="znp_service_choice_adress" > <span id="service-doc-info2"> </span></div>
<!--<div class="section_znp_info_memo"><a href="#">Об обследовании (памятка)</a></div>-->
<div class="section_znp_info_memo"><a href="/wp-content/uploads/2024/04/podgotovka-chekap-2.pdf" download="Подготовка к приёму (памятка)" target="_blank"><?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'en') {
echo 'Preparation for admission (memo)';
} elseif ($current_language == 'kz') {
echo 'Қабылдауға дайындық (жадынама)';
} else {
echo 'Подготовка к приёму (памятка)'; // Default to Russian or the original language
}
?></a></div>
<div class="section_znp_info_documents">
<div class="section_znp_info_documents_text">
<div class="section_znp_info_documents_text_title">
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Возьмите документы ';
} elseif ($current_language == 'kz') {
echo 'Құжаттарды алыңыз';
} else {
echo "Take the documents"; // Default to Russian or the original language
}
?>
</div>
<div class="section_znp_info_documents_text_text">1) <?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Удостоверение личности/паспорт/вид на жительство';
} elseif ($current_language == 'kz') {
echo 'Жеке куәлік / паспорт/тұруға ықтиярхат';
} else {
echo "Identity card/passport/residence permit"; // Default to Russian or the original language
}
?></div>
<div class="section_znp_info_documents_text_text">2)
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Направление';
} elseif ($current_language == 'kz') {
echo 'Бағыт';
} else {
echo "Direction"; // Default to Russian or the original language
}
?>
</div>
<div class="section_znp_info_documents_text_text">3)
<?php
// Get the current language
$current_language = wpm_get_language();
// Output the appropriate translation based on the current language
if ($current_language == 'ru') {
echo 'Выписку из амбулаторной карты (при наличии)';
} elseif ($current_language == 'kz') {
echo 'Амбулаториялық картадан үзінді (бар болса)';
} else {
echo "An extract from the outpatient card (if available)"; // Default to Russian or the original language
}
?>
</div>
</div>
</div>
</div>
<div>
</div>
</div>
</section>
<script>
let value_name = '';
let value_price = '';
let value_type = '';
let price_id = '';
let click_two = '';
(function($){
$(document).ready(function () {
value_name = localStorage.getItem("value_name");
docName = localStorage.getItem("doc_name");
value_price = localStorage.getItem("value_price");
value_type = localStorage.getItem("value_type");
click_two = localStorage.getItem("value_click");
price_id = localStorage.getItem("value_price_id");
if (value_name) {
document.getElementById('service-name').textContent = value_name;
}
if (value_price) {
//document.getElementById('service-type').textContent = value_price;
}
if (value_type) {
if(price_id === '574' || price_id === '579' || price_id === '572' || price_id === '571' || price_id === '581' || price_id === '575' || price_id === '580'){
document.getElementById('service-doc-frame').textContent = 'вход 3';
document.getElementById('service-doc-frame2').textContent = 'вход 3';
}else if(price_id === '565' || price_id === '566' || price_id === '564' || price_id === '539'){
document.getElementById('service-doc-frame').textContent = 'вход 3';
document.getElementById('service-doc-frame2').textContent = 'вход 3';
}
else if(value_type == 'Поликлиника платная'){
document.getElementById('service-doc-frame').textContent = 'вход 1';
document.getElementById('service-doc-frame2').textContent = 'вход 1';
}else if(value_type == 'Поликлиника ОСМС'){
document.getElementById('service-doc-frame').textContent = 'вход 2';
document.getElementById('service-doc-frame2').textContent = 'вход 2';
}
}
if (click_two == 1) {
let serIn = $('#searchInput');
localStorage.removeItem("value_name");
localStorage.removeItem("doc_name");
localStorage.removeItem("value_price");
localStorage.removeItem("value_type");
localStorage.removeItem("value_click");
localStorage.removeItem("value_price_id");
localStorage.clear();
} else {}
const serviceDocInfo = document.getElementById('service-doc-info');
const serviceDocInfo2 = document.getElementById('service-doc-info2');
if (docName && docName.trim() !== '') {
serviceDocInfo.innerHTML = 'Врач ' + docName;
serviceDocInfo2.innerHTML = 'Врач ' + docName;
}
const znpcsv = document.querySelector('.znp_choise_specialist-wrap');
if (price_id === '565' || price_id === '566' || price_id === '564' || price_id === '539') {
znpcsv.classList.add('hide');
}
});
})(jQuery);
const specialOptions = document.querySelectorAll('input[name="znp_choise_specialist"]');
document.getElementById('selectedAge').textContent = 'до года';
let human = '';
let valSpecialist = '';
let selChildAge = ''
let formInfoText = '';
function toggleDropdown() {
var zpnChoiseAgeWrapp = document.getElementById('znp_choise_age_child_age');
var dropdownContent = document.getElementById('ageDropdown');
if (dropdownContent.style.display === 'none' || dropdownContent.style.display === '') {
dropdownContent.style.display = 'block';
zpnChoiseAgeWrapp.classList.add("age-open");
} else {
dropdownContent.style.display = 'none';
zpnChoiseAgeWrapp.classList.remove("age-open");
}
}
function selectAge(age) {
document.getElementById('selectedAge').textContent = age;
document.getElementById('ageDropdown').style.display = 'none';
}
const specialist = document.querySelectorAll('input[name="znp_choise_specialist"]');
const childAge = document.querySelectorAll('a[data-ctype="age"]');
childAge.forEach(ageElement => {
ageElement.addEventListener('click', function(){
childAge.forEach(elem => {
elem.classList.remove('sel');
});
selChildAge = ageElement.textContent.trim();
ageElement.classList.add('sel');
});
});
const radioOptions = document.querySelectorAll('input[name="znp_choise_age"]');
radioOptions.forEach(option => {
option.addEventListener('click', function() {
if (option.checked) {
human = option.value;
if (price_id === '565' || price_id === '566' || price_id === '564' || price_id === '539') {
dates.forEach(dateEle => {
dateEle.classList.remove('disabled');
dateEle.disabled = false;
});
}else{
specialist.forEach(option => {
option.parentElement.classList.remove('disabled');
option.disabled = false;
});
}
if (option.value === 'child') {
document.getElementById('znp_choise_age_child_age').classList.add('show');
selChildAge = document.getElementById('selectedAge').textContent.trim();
} else {
document.getElementById('znp_choise_age_child_age').classList.remove('show');
}
option.parentElement.classList.add('select');
radioOptions.forEach(otherOption => {
if (otherOption !== option) {
otherOption.parentElement.classList.remove('select');
}
});
}
});
});
const zpnCsp = document.querySelectorAll('input[name="znp_choise_specialist"]');
zpnCsp.forEach(option => {
option.addEventListener('click', function() {
if (option.checked) {
option.parentElement.classList.add('select');
zpnCsp.forEach(otherOption => {
if (otherOption !== option) {
otherOption.parentElement.classList.remove('select');
}
});
}
});
});
/*
function formatDate(date) {
const options = { weekday: 'short', day: 'numeric', month: 'short' };
return new Intl.DateTimeFormat('ru-RU', options).format(date);
}
let selectedDateElement = null;
function handleDateSelection(dateElement) {
if (selectedDateElement) {
selectedDateElement.classList.remove('select');
}
selectedDateElement = dateElement;
selectedDateElement.classList.add('select');
}
function generateDates() {
const datepicker = document.getElementById('date-picker');
datepicker.innerHTML = '';
const today = new Date();
for (let i = 0; i < 14; i++) {
const date = new Date(today.getTime() + i * 24 * 60 * 60 * 1000);
const formattedDate = formatDate(date);
const dateElement = document.createElement('button');
dateElement.textContent = formattedDate;
dateElement.disabled = true;
dateElement.classList.add('disabled')
dateElement.setAttribute('data-date', date.toISOString().slice(0, 10));
dateElement.addEventListener('click', function() {
handleDateSelection(dateElement);
});
datepicker.appendChild(dateElement);
}
}
generateDates();
*/
function formatDate(date) {
const options = { weekday: 'short', day: 'numeric', month: 'short' };
return new Intl.DateTimeFormat('ru-RU', options).format(date);
}
let selectedDateElement = null;
function handleDateSelection(dateElement) {
if (selectedDateElement) {
selectedDateElement.classList.remove('select');
}
selectedDateElement = dateElement;
selectedDateElement.classList.add('select');
}
function generateDates() {
const datepicker = document.getElementById('date-picker');
datepicker.innerHTML = '';
const today = new Date();
for (let i = 0; i < 14; i++) {
const date = new Date(today.getTime() + i * 24 * 60 * 60 * 1000);
if (date.getDay() === 0) {
continue; // Пропустить воскресенье
}
const formattedDate = formatDate(date);
const dateElement = document.createElement('button');
dateElement.textContent = formattedDate;
dateElement.disabled = true;
dateElement.classList.add('disabled')
dateElement.setAttribute('data-date', date.toISOString().slice(0, 10));
dateElement.addEventListener('click', function() {
handleDateSelection(dateElement);
});
datepicker.appendChild(dateElement);
}
}
generateDates();
const dates = document.querySelectorAll('#date-picker button');
specialist.forEach(option => {
option.parentElement.classList.add('disabled');
option.disabled = true;
option.addEventListener('click', function() {
if (option.checked) {
dates.forEach(dateEle => {
dateEle.classList.remove('disabled');
dateEle.disabled = false;
});
valSpecialist = option.value;
} else {
dates.forEach(dateEle => {
dateEle.classList.add('disabled');
dateEle.disabled = true;
});
}
});
});
const btnstep = document.getElementById('go-step-2');
const textarea = document.getElementById('form-info-hidden');
const textfield = document.getElementById('form-info');
btnstep.disabled = true;
btnstep.classList.add('disabled');
dates.forEach(date => {
date.addEventListener('click', function() {
const selectedDate = document.querySelector('.select');
if (selectedDate) {
btnstep.disabled = false;
btnstep.classList.remove('disabled');
} else {
btnstep.disabled = true;
btnstep.classList.add('disabled');
}
});
});
const stepOne = document.getElementById('blocks-2');
const stepTwo = document.getElementById('blocks-3');
btnstep.addEventListener('click', function() {
// console.log(`Selected human: ${human}`);
// console.log(`Selected child age: ${selChildAge}`);
// console.log(`specialist: ${valSpecialist}`);
// document.getElementById('blocks-1').style.display = 'none';
if(valSpecialist == 'consultation'){
valSpecialist = 'Консультация';
}else{
valSpecialist = 'Диагностика';
}
if (value_name) {
document.getElementById('section__znp_info_title').textContent = value_name;
}
if (value_price) {
document.getElementById('section__znp_info_price').textContent = value_price;
}
if (value_type) {
// document.getElementById('service-price').textContent = value_type;
// document.getElementById('service-price').textContent = value_type;
}
document.getElementById('section_znp_info_date').textContent = selectedDateElement.textContent;
stepOne.style.display = 'none';
stepTwo.style.display = 'block';
var formInfoText;
var formInfo = {};
if(human == 'child'){
human = 'Ребенок';
formInfoText = 'Кто идёт на приём: ' + human + '\nВозраст: ' +selChildAge+ '\nСпециалист '+valSpecialist+'\nДата ' +selectedDateElement.textContent+ '\nУслуга '+value_name+ '\nЦена '+value_price+'\nВрач: ' +docName;
formInfo = {
'age': human + ', ' + selChildAge,
'specialist': valSpecialist,
'date': selectedDateElement.getAttribute('data-date'),
};
}else{
human = 'Взрослый';
formInfoText = 'Кто идёт на приём: ' + human + '\nСпециалист '+valSpecialist+'\nДата ' +selectedDateElement.textContent+ '\nУслуга '+value_name+ '\nЦена '+value_price;
formInfo = {
'age': human,
'specialist': valSpecialist,
'date': selectedDateElement.getAttribute('data-date'),
};
}
// console.log(formInfoText);
textarea.value = formInfoText;
textfield.value = JSON.stringify(formInfo);
});
const formRadiod = document.querySelectorAll('#who-paid > span.wpcf7-list-item');
formRadiod.forEach(radio => {
radio.addEventListener('click', function() {
formRadiod.forEach(otherRadio => {
if (otherRadio !== radio) {
otherRadio.classList.remove('checked');
}
});
if (!radio.classList.contains('checked')) {
radio.classList.add('checked');
}
});
});
const formCheckbox = document.querySelector('#check-private input');
formCheckbox.addEventListener('click', function() {
const parentElement = formCheckbox.parentElement;
if (parentElement.classList.contains('checked')) {
parentElement.classList.remove('checked');
} else {
parentElement.classList.add('checked');
}
});
const textToWrap = document.querySelector('.section__znp_check span.wpcf7-list-item-label');
const link = document.createElement('a');
link.href = '/documents-licenses';
link.target = '_blank';
link.innerText = textToWrap.innerHTML.replace('Политики конфиденциальности', '');
textToWrap.innerHTML = '';
textToWrap.appendChild(link);
</script>
<?php get_footer(); ?>