diff --git a/resources/views/form/rapport-team3/1780482240-add652c4-0e79-4524-8ec1-fc3c8bb2b9e0.blade.php b/resources/views/form/rapport-team3/1780482240-add652c4-0e79-4524-8ec1-fc3c8bb2b9e0.blade.php index 9f191be0..56b9e2e1 100644 --- a/resources/views/form/rapport-team3/1780482240-add652c4-0e79-4524-8ec1-fc3c8bb2b9e0.blade.php +++ b/resources/views/form/rapport-team3/1780482240-add652c4-0e79-4524-8ec1-fc3c8bb2b9e0.blade.php @@ -190,6 +190,15 @@ jQuery(document).ready(function($){ + // Chemist Shop Name - Alphabetic only + $('#field-chemist_name').on('input', function () { + this.value = this.value.replace(/[^A-Za-z ]/g, ''); + }); + + // Name of Staff - Alphabetic only + $('#field-name_of_staff').on('input', function () { + this.value = this.value.replace(/[^A-Za-z ]/g, ''); + }); // Phone No. of Staff - Numeric only, starts with 6-9, max 10 digits $('#field-phone_no_of_staff').on('input', function () { @@ -204,6 +213,32 @@ this.value = this.value.slice(0, 10); }); + + + + const respuleFields = [ + '#field-duolin_respule', + '#field-foracort_respule', + '#field-budecort_respule', + '#field-levolin_respule', + '#field-glycohale_respule', + '#field-hyperneb_respule', + '#field-tobamist_respule', + '#field-budesal_respule', + '#field-flohale_respule', + '#field-inhalex_respule', + '#field-mucinac_respule' + + ]; + + $(respuleFields.join(',')).on('input', function () { + this.value = this.value.replace(/[^0-9]/g, ''); + }); + $(respuleFields.join(',')).attr({ + min: 0, + step: 1, + inputmode: 'numeric' + }); $('#field-user_id').change(function(){ let hierarchy = $('option:selected', this).attr('hierarchy'); $('#field-hierarchy_id').val(hierarchy) @@ -408,11 +443,35 @@ var dd = String(today.getDate()).padStart(2, '0'); var mm = String(today.getMonth() + 1).padStart(2, '0'); var yyyy = today.getFullYear(); - today = yyyy + '-' + mm + '-' + dd; + + var currentDate = yyyy + '-' + mm + '-' + dd; var plandateField = document.getElementById('field-record_date'); - plandateField.setAttribute('max', today); + if (plandateField) { + plandateField.setAttribute('min', '2026-06-01'); + plandateField.setAttribute('max', currentDate); + } + + + + for (const field of respuleFields) { + + let value = $(field).val(); + + if (value !== '' && !/^\d+$/.test(value)) { + + event.preventDefault(); + + Swal.fire({ + icon: 'error', + title: 'Validation Error', + text: 'Respule quantities must be whole numbers only.' + }); + + return false; + } + } }); diff --git a/resources/views/form/rapport-team3/1780486861-23784b46-4c61-41e1-87a8-fc54f8bbdd4e.blade.php b/resources/views/form/rapport-team3/1780486861-23784b46-4c61-41e1-87a8-fc54f8bbdd4e.blade.php index 70680b48..7afeb4f6 100644 --- a/resources/views/form/rapport-team3/1780486861-23784b46-4c61-41e1-87a8-fc54f8bbdd4e.blade.php +++ b/resources/views/form/rapport-team3/1780486861-23784b46-4c61-41e1-87a8-fc54f8bbdd4e.blade.php @@ -189,7 +189,15 @@