diff --git a/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php b/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php index 13e44784..b55e336a 100644 --- a/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php +++ b/resources/views/form/rapport-team4/1791539482-b06c2f9a-fe45-4b16-843a-224f07ed0d7b.blade.php @@ -50,16 +50,16 @@ $submittedMonths = []; - if (!empty($submissions)) { - foreach ($submissions as $sub) { - if (isset($sub->formdata->month) && !empty($sub->formdata->month)) { - $submittedMonths[] = trim($sub->formdata->month); - } - } - } + if (!empty($submissions)) { + foreach ($submissions as $sub) { + if (isset($sub->formdata->month) && !empty($sub->formdata->month)) { + $submittedMonths[] = trim($sub->formdata->month); + } + } + } - - $isEditMode = !empty($id); + + $isEditMode = !empty($id); @endphp @@ -124,40 +124,40 @@ @break --}} @case('dropdown') - required == 'yes' ? 'required' : '' }}> + + @foreach ($question->options as $option) + @php + $isSubmitted = ($question->code == 'month' && in_array(trim($option->value), $submittedMonths)); + $isSelected = (isset($question->value) && $question->value == $option->value); + + $isDisabled = ($isSubmitted && (!$isEditMode || !$isSelected)); + @endphp - @if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor') - - @elseif($question->code == 'month') - - @else - - @endif - @endforeach - - @break + @if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor') + + @elseif($question->code == 'month') + + @else + + @endif + @endforeach + + @break @case('checkbox') @foreach($question->options as $option) @@ -383,6 +383,58 @@ } }); + + $("[id^='field-city_']").on('input keyup paste', function() { + + this.value = this.value.replace(/[^a-zA-Z\s]/g, ''); + }); + + + $("[id^='field-city_']").on('keypress', function(e) { + var regex = new RegExp("^[a-zA-Z\\s]+$"); + var str = String.fromCharCode(!e.charCode ? e.which : e.charCode); + if (!regex.test(str)) { + e.preventDefault(); + return false; + } + }); + + $("[id^='field-pin_code_']").on('input keyup paste', function() { + var val = this.value; + + + val = val.replace(/\D/g, ''); + + + val = val.replace(/^0+/, ''); + + + if (val.length > 6) { + val = val.substring(0, 6); + } + + this.value = val; + }); + + + $("[id^='field-pin_code_']").on('keypress', function(e) { + var char = String.fromCharCode(e.which || e.keyCode); + + + if (!/^\d$/.test(char)) { + e.preventDefault(); + return false; + } + + + if (this.value.length === 0 && char === '0') { + e.preventDefault(); + return false; + } + }); + + + $("#pageloader").fadeOut();