повторная отправка звонка
This commit is contained in:
Binary file not shown.
@@ -26,9 +26,11 @@ def find_patients(data):
|
|||||||
"""
|
"""
|
||||||
sheet = authorize_google().open("Пациенты клиники").sheet1
|
sheet = authorize_google().open("Пациенты клиники").sheet1
|
||||||
records = sheet.get_all_records() # Получаем все строки таблицы
|
records = sheet.get_all_records() # Получаем все строки таблицы
|
||||||
|
print(data)
|
||||||
for i, record in enumerate(records, start=2): # Нумерация строк Google Таблицы начинается с 2
|
for i, record in enumerate(records, start=2): # Нумерация строк Google Таблицы начинается с 2
|
||||||
try:
|
try:
|
||||||
|
print(str(record.get("Telegram ID", "")).strip(), str(record.get("ФИО", "")).strip().lower(), str(record.get("Дата рождения", "")).strip(), str(record.get("Номер телефона", "")).strip())
|
||||||
|
print(str(data.get("user_id", "")).strip(), str(data.get("fio", "")).strip().lower(), str(data.get("dob", "")).strip(), str(data.get("tel", "")).strip())
|
||||||
if (
|
if (
|
||||||
str(record.get("Telegram ID", "")).strip() == str(data.get("user_id", "")).strip() and
|
str(record.get("Telegram ID", "")).strip() == str(data.get("user_id", "")).strip() and
|
||||||
str(record.get("ФИО", "")).strip().lower() == str(data.get("fio", "")).strip().lower() and
|
str(record.get("ФИО", "")).strip().lower() == str(data.get("fio", "")).strip().lower() and
|
||||||
@@ -165,15 +167,28 @@ def send_registration_request():
|
|||||||
if json_data and json_data["status"] == "OK":
|
if json_data and json_data["status"] == "OK":
|
||||||
verification_code = json_data.get("code")
|
verification_code = json_data.get("code")
|
||||||
|
|
||||||
# Записываем данные и код верификации в таблицу
|
# Поиск пациента
|
||||||
sheet.append_row([
|
row_number, patient_row = find_patients(raw_data)
|
||||||
fio,
|
print(row_number, patient_row)
|
||||||
raw_phone,
|
if patient_row:
|
||||||
dob,
|
# Обновление записи в таблице
|
||||||
raw_data.get("user_id"), # Telegram ID пользователя
|
sheet = authorize_google().open("Пациенты клиники").sheet1
|
||||||
current_time, # Время отправки данных
|
|
||||||
verification_code # Код верификации
|
# Определяем динамический столбец по заголовкам
|
||||||
])
|
headers = sheet.row_values(1)
|
||||||
|
verification_col = headers.index("Верификация") + 1 # Столбцы нумеруются с 1
|
||||||
|
sheet.update_cell(row_number, verification_col, verification_code)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Записываем данные и код верификации в таблицу
|
||||||
|
sheet.append_row([
|
||||||
|
fio,
|
||||||
|
raw_phone,
|
||||||
|
dob,
|
||||||
|
raw_data.get("user_id"), # Telegram ID пользователя
|
||||||
|
current_time, # Время отправки данных
|
||||||
|
verification_code # Код верификации
|
||||||
|
])
|
||||||
print(f"Код верификации, отправленный пользователю: {verification_code}")
|
print(f"Код верификации, отправленный пользователю: {verification_code}")
|
||||||
|
|
||||||
return jsonify({'success': True})
|
return jsonify({'success': True})
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ script(type="text/javascript", src="/js/2.0.dashboard.js?q="~randomString())
|
|||||||
span="Подтвердить"
|
span="Подтвердить"
|
||||||
|
|
||||||
.my-3.mx-4.primary-field.verification(style="display: none;")
|
.my-3.mx-4.primary-field.verification(style="display: none;")
|
||||||
|
p.mx-auto.text-center#repeat_call(href="#", style="cursor: pointer; text-decoration: underline dotted;")="Заказать повторный звонок"
|
||||||
button.btn.btn-success.float-end.mb-3#code_submit
|
button.btn.btn-success.float-end.mb-3#code_submit
|
||||||
span.spinner-border.spinner-border-sm.me-1.d-none(role="status" aria-hidden="true")
|
span.spinner-border.spinner-border-sm.me-1.d-none(role="status" aria-hidden="true")
|
||||||
span="Отправить код"
|
span="Отправить код"
|
||||||
|
|
||||||
|
.my-3.mx-4.primary-field.success_window(style="display: none;")
|
||||||
|
h3="Успех"
|
||||||
|
p="Ура! Ваша регистрация прошла успешно! 🥳 Пожалуйста вернитесь обратно в телеграм"
|
||||||
@@ -99,10 +99,9 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#form_submit").click(function(){
|
function verification(){
|
||||||
|
$("#form_submit").children(".spinner-border").removeClass('d-none');
|
||||||
$(this).children(".spinner-border").removeClass('d-none');
|
$("#form_submit").attr("disabled", true);
|
||||||
$(this).attr("disabled", true);
|
|
||||||
message = {}
|
message = {}
|
||||||
|
|
||||||
|
|
||||||
@@ -110,30 +109,30 @@ $(document).ready(function(){
|
|||||||
if(!(validate_length($('#fio').val(), 3)))
|
if(!(validate_length($('#fio').val(), 3)))
|
||||||
{
|
{
|
||||||
show_error('Введите ФИО', false);
|
show_error('Введите ФИО', false);
|
||||||
$(this).children(".spinner-border").addClass('d-none');
|
$("#form_submit").children(".spinner-border").addClass('d-none');
|
||||||
$(this).removeAttr("disabled");
|
$("#form_submit").removeAttr("disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(validate_length($('#tel').val(), 16)))
|
if(!(validate_length($('#tel').val(), 16)))
|
||||||
{
|
{
|
||||||
show_error('Введите Телефон', false);
|
show_error('Введите Телефон', false);
|
||||||
$(this).children(".spinner-border").addClass('d-none');
|
$("#form_submit").children(".spinner-border").addClass('d-none');
|
||||||
$(this).removeAttr("disabled");
|
$("#form_submit").removeAttr("disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('#dob').val().length !== 10 || new Date().getFullYear() - new Date($('#dob').val()).getFullYear() > 100) {
|
if ($('#dob').val().length !== 10 || new Date().getFullYear() - new Date($('#dob').val()).getFullYear() > 100) {
|
||||||
show_error('Дата рождения должна быть корректной и возраст не более 80 лет', false);
|
show_error('Дата рождения должна быть корректной и возраст не более 80 лет', false);
|
||||||
$(this).children(".spinner-border").addClass('d-none');
|
$("#form_submit").children(".spinner-border").addClass('d-none');
|
||||||
$(this).removeAttr("disabled");
|
$("#form_submit").removeAttr("disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('#dob').val().length !== 10 || new Date().getFullYear() < new Date($('#dob').val()).getFullYear()) {
|
if ($('#dob').val().length !== 10 || new Date().getFullYear() < new Date($('#dob').val()).getFullYear()) {
|
||||||
show_error('Проверьте дату ввода, вы указали дату больше чем сегодняшняя дата', false);
|
show_error('Проверьте дату ввода, вы указали дату больше чем сегодняшняя дата', false);
|
||||||
$(this).children(".spinner-border").addClass('d-none');
|
$("#form_submit").children(".spinner-border").addClass('d-none');
|
||||||
$(this).removeAttr("disabled");
|
$("#form_submit").removeAttr("disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,16 +154,21 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
show_error(data.error);
|
show_error(data.error);
|
||||||
$(this).children(".spinner-border").addClass('d-none');
|
$("#form_submit").children(".spinner-border").addClass('d-none');
|
||||||
$(this).removeAttr("disabled");
|
$("#form_submit").removeAttr("disabled");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error:function (jqXHR, exception) {
|
error:function (jqXHR, exception) {
|
||||||
$(this).children(".spinner-border").addClass('d-none');
|
$("#form_submit").children(".spinner-border").addClass('d-none');
|
||||||
$(this).removeAttr("disabled");
|
$("#form_submit").removeAttr("disabled");
|
||||||
show_error('Что-то пошло не так', false)
|
show_error('Что-то пошло не так', false)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#form_submit").click(function(){
|
||||||
|
|
||||||
|
verification();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#code_submit").click(function(){
|
$("#code_submit").click(function(){
|
||||||
@@ -221,7 +225,8 @@ $(document).ready(function(){
|
|||||||
success: (data) => {
|
success: (data) => {
|
||||||
if(data.success==true){
|
if(data.success==true){
|
||||||
$('.primary-field').hide();
|
$('.primary-field').hide();
|
||||||
$('.verification').show();
|
$('.verification').hide();
|
||||||
|
$('.success_window').show();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
show_error(data.error);
|
show_error(data.error);
|
||||||
@@ -237,6 +242,10 @@ $(document).ready(function(){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#repeat_call").click(function(){
|
||||||
|
verification();
|
||||||
|
});
|
||||||
|
|
||||||
$('#clear_tel').click(function(){
|
$('#clear_tel').click(function(){
|
||||||
phoneStr = '';
|
phoneStr = '';
|
||||||
phoneInput.value = formatPhoneString();
|
phoneInput.value = formatPhoneString();
|
||||||
|
|||||||
Reference in New Issue
Block a user