Исправлена валидация формы заказа услуги - поля теперь правильно передаются и проверяются
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -420,9 +420,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
// Prepare data for QR code generation
|
||||
const serviceId = document.getElementById('serviceId').value;
|
||||
const clientData = {
|
||||
client_name: formData.get('name'),
|
||||
client_email: formData.get('email'),
|
||||
client_phone: formData.get('phone'),
|
||||
client_name: formData.get('name')
|
||||
client_phone: formData.get('phone')
|
||||
};
|
||||
|
||||
// Submit to QR code generation endpoint
|
||||
@@ -788,8 +788,8 @@ textarea {
|
||||
<input type="email" class="form-control" id="clientEmail" name="email" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="clientPhone" class="form-label">Телефон</label>
|
||||
<input type="tel" class="form-control" id="clientPhone" name="phone">
|
||||
<label for="clientPhone" class="form-label">Телефон *</label>
|
||||
<input type="tel" class="form-control" id="clientPhone" name="phone" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="clientCompany" class="form-label">Компания</label>
|
||||
|
||||
@@ -264,9 +264,9 @@ def generate_qr_code(request, service_id):
|
||||
client_phone = data.get('client_phone')
|
||||
client_name = data.get('client_name')
|
||||
|
||||
if not all([client_email, client_phone, client_name]):
|
||||
logger.error("Все поля должны быть заполнены")
|
||||
return JsonResponse({'error': 'Все поля должны быть заполнены'}, status=400)
|
||||
if not all([client_email, client_name, client_phone]):
|
||||
logger.error("Все обязательные поля должны быть заполнены")
|
||||
return JsonResponse({'error': 'Все обязательные поля должны быть заполнены'}, status=400)
|
||||
|
||||
# Используем транзакцию для предотвращения конкурентного создания дубликатов
|
||||
with transaction.atomic():
|
||||
|
||||
Reference in New Issue
Block a user