From 45b80c229c305d8cd79e024dec8ba40bc3f39d34 Mon Sep 17 00:00:00 2001 From: Farhan Pathan Date: Thu, 18 Jun 2026 13:21:33 +0530 Subject: [PATCH] Titans - Breathfree Camp applied Validation like at least 1 brand should be non zero value --- ...642b-8b21-4db0-a5b9-979efe4483fc.blade.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/resources/views/form/rapport-titans/1781675090-edd1642b-8b21-4db0-a5b9-979efe4483fc.blade.php b/resources/views/form/rapport-titans/1781675090-edd1642b-8b21-4db0-a5b9-979efe4483fc.blade.php index 512c8320..58f250d3 100644 --- a/resources/views/form/rapport-titans/1781675090-edd1642b-8b21-4db0-a5b9-979efe4483fc.blade.php +++ b/resources/views/form/rapport-titans/1781675090-edd1642b-8b21-4db0-a5b9-979efe4483fc.blade.php @@ -404,7 +404,41 @@ $('#report-form').on('submit', function(event){ + event.preventDefault(); + + + // At least one brand should have value > 0 + let brandFields = [ + '#field-glycohale_f_capsules', + '#field-glycohale_fb', + '#field-foracort_g_400_rotacaps', + '#field-glycohale_fb_inhaler', + '#field-foracort_g_inhaler', + '#field-glycohale_fb_synchrobreathe', + '#field-foracort_g_synchrobreathe', + '#field-glycohale_f_inhaler', + '#field-glycohale_f_synchrobreathe', + '#field-foracort_g_400_ciphaler', + '#field-glycohale_fb_ciphaler' + ]; + + let hasValue = false; + + brandFields.forEach(function(field) { + if ((parseInt($(field).val()) || 0) > 0) { + hasValue = true; + } + }); + + if (!hasValue) { + Swal.fire({ + icon: 'error', + title: 'Validation Error', + text: 'From all 11 brands, at least one field should be greater than 0.' + }); + return false; + } const formData = new FormData($('#report-form')[0]); // Log form data to console for (let [key, value] of formData.entries()) {