diff --git a/resources/views/form/rapport-team4/1741155802-25a7600f-1613-4a82-af1d-f460a8f79ffa.blade.php b/resources/views/form/rapport-team4/1741155802-25a7600f-1613-4a82-af1d-f460a8f79ffa.blade.php index dbeee750..a9084445 100644 --- a/resources/views/form/rapport-team4/1741155802-25a7600f-1613-4a82-af1d-f460a8f79ffa.blade.php +++ b/resources/views/form/rapport-team4/1741155802-25a7600f-1613-4a82-af1d-f460a8f79ffa.blade.php @@ -60,7 +60,7 @@ Camp Plan Date Execution Done Doctor Name - Other Doctor Name + {{-- Other Doctor Name --}} Camp Execution Date Reporting Date @@ -110,19 +110,19 @@ $today=date('d',strtotime("-1 months")); ?> - @if($sub->workflow_status == 'approved') + @if ( $planDate && $planDate->between($startOfCurrentMonth, $fifthOfNextMonth) && $now->greaterThanOrEqualTo($planDate)) - @endif - @elseif ($sub->workflow_status == 'rejected' || + + {{-- @elseif ($sub->workflow_status == 'rejected' || (isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'no')) + --}} @endif @@ -142,17 +142,18 @@ {{ '' }} @endif - + + {{-- @if (isset($sub->formdata->contact_id_2) && $sub->formdata->contact_id_2 !== '') {{ $sub->formdata->contact_id_2 }} @elseif (isset($sub->formdata->doctor_name)) {{ $sub->formdata->doctor_name }} @else - {{-- Default value or empty string, adjust as needed --}} + {{ '' }} @endif - + --}} {{$sub->formdata->execution_date}} {{isset($sub->formdata->record_date ) ? $sub->formdata->record_date : ''}} @@ -247,16 +248,20 @@ @if ($question->code == 'contact_id') @foreach ($question->options as $option) - @if( isset($option->contact->ardc_camp_doctor_octnov) && $option->contact->ardc_camp_doctor_octnov == 'Yes' ) - - @endif + @endforeach - + --}} @elseif($question->code=='contact_id_2') @foreach ($question->options as $option) @@ -534,7 +539,7 @@ }); $('#execution-total_rxns').prop({"readonly":true}); - $('#execution-executed_as_per_plan').prop("disabled",true); + //$('#execution-executed_as_per_plan').prop("disabled",true); // $('#execution-patients_diagnosed').on('change',function(){ // let a=document.getElementById('execution-patients_diagnosed'); @@ -572,10 +577,10 @@ e.preventDefault(); }) - let contact2 = document.getElementById('execution-contact_id_2'); + /* let contact2 = document.getElementById('execution-contact_id_2'); contact2.addEventListener('mousedown', function(e) { e.preventDefault(); - }) + }) */ let camp_planned_start = document.getElementById('execution-camp_planned_start_time'); @@ -666,6 +671,8 @@ $('#execution-form').append(''); }) + + /* $('.edit-plan-btn').click(function() { $('#execution-form-wrapper').show(100, () => { $('#add-camp-btn').hide(0); @@ -772,6 +779,10 @@ } }) + */ + + + $('#report-form').on('submit', function(event) { event.preventDefault(); @@ -819,12 +830,30 @@ - $('#field-contact_id').change(function() { + /*$('#field-contact_id').change(function() { $('#field-speciality').val($('option:selected', this).attr('speciality')) }) $('#field-contact_id').change(function() { $('#field-msl_code').val($('option:selected', this).attr('legacy_code')) + })*/ + + + $('#field-contact_id').change(function() { + $('#field-speciality').val($('option:selected', this).attr('speciality')) + $('#field-msl_code').val($('option:selected', this).attr('legacy_code')) + let restricted=$(this).find(":selected").attr('ardc_css_restricted_drs'); + console.log("restricted:",restricted); + if (restricted === 'Yes') { + + alert('Planning with these Doctors not allowed'); + + // Deselect current option + $(this).val('').trigger('change'); + + // Clear msl code as well + $('#field-msl_code').val(''); + } }) @@ -974,6 +1003,95 @@ }); + + + + \ No newline at end of file diff --git a/resources/views/form/rapport-team4/1741169144-1a2dc3e9-b341-4429-81fa-f4ac41711912.blade.php b/resources/views/form/rapport-team4/1741169144-1a2dc3e9-b341-4429-81fa-f4ac41711912.blade.php index 9483a668..197200b7 100644 --- a/resources/views/form/rapport-team4/1741169144-1a2dc3e9-b341-4429-81fa-f4ac41711912.blade.php +++ b/resources/views/form/rapport-team4/1741169144-1a2dc3e9-b341-4429-81fa-f4ac41711912.blade.php @@ -71,6 +71,14 @@ if (!empty($history->data->submissions)) { } } } +/* +echo "
"; +echo "
";
+print_r($history->data->submissions);
+echo "
"; + +echo "
"; +*/ @endphp @@ -128,7 +136,7 @@ if (!empty($history->data->submissions)) { Camp Plan Date Execution Done Doctor Name - Other Doctor Name + {{-- Other Doctor Name --}} Camp Execution Date Legacy Code Speciality @@ -172,19 +180,19 @@ if (!empty($history->data->submissions)) { - @if($sub->workflow_status == 'approved') + @if ( $planDate && $planDate->between($startOfCurrentMonth, $fifthOfNextMonth) && $now->greaterThanOrEqualTo($planDate)) - @endif - @elseif ($sub->workflow_status == 'rejected' || + + {{-- @elseif ($sub->workflow_status == 'rejected' || (isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'no')) + --}} @endif {{ $sub->formdata->plan_date }} @@ -202,17 +210,17 @@ if (!empty($history->data->submissions)) { {{ '' }} @endif - + {{-- @if (isset($sub->formdata->contact_id_2) && $sub->formdata->contact_id_2 !== '') {{ $sub->formdata->contact_id_2 }} @elseif (isset($sub->formdata->doctor_name)) {{ $sub->formdata->doctor_name }} @else - {{-- Default value or empty string, adjust as needed --}} + {{ '' }} @endif - + --}} {{$sub->formdata->execution_date}} {{isset($sub->formdata->msl_code) ? $sub->formdata->msl_code : '' }} @@ -304,16 +312,21 @@ if (!empty($history->data->submissions)) { @if ($question->code == 'contact_id') @foreach ($question->options as $option) - @if( isset($option->contact->css_camp_doctor_octnov) && $option->contact->css_camp_doctor_octnov == 'Yes' ) - @endif @endforeach - + --}} @elseif($question->code=='contact_id_2') @foreach ($question->options as $option) @@ -424,9 +437,9 @@ if (!empty($history->data->submissions)) { @endif @endforeach - + --}} @@ -599,10 +612,10 @@ if (!empty($history->data->submissions)) { e.preventDefault(); }) - let contact2 = document.getElementById('execution-contact_id_2'); + /* let contact2 = document.getElementById('execution-contact_id_2'); contact2.addEventListener('mousedown', function(e) { e.preventDefault(); - }) + }) */ // let typeOfDr = document.getElementById('execution-type_of_dr'); // typeOfDr.addEventListener('mousedown', function(e) { @@ -696,6 +709,7 @@ if (!empty($history->data->submissions)) { }) + /* $('.edit-plan-btn').click(function() { $('#execution-form-wrapper').show(100, () => { $('#add-camp-btn').hide(0); @@ -801,6 +815,9 @@ if (!empty($history->data->submissions)) { $typeDr.on('change', toggleFlutter); }) + */ + + $('#report-form').on('submit', function(event) { event.preventDefault(); @@ -832,28 +849,28 @@ if (!empty($history->data->submissions)) { }); }); - // $('#execution-sitazit_d_rx').attr({ - // "min":0, - // "max":50 - // }); - // $('#execution-sitazit_dm_rx').attr({ - // "min":0, - // "max":50 - // }); - // $('#execution-ziten_m_rx').attr({ - // "min":0, - // "max":50 - // }); - + $('#field-contact_id').change(function() { - $('#field-speciality').val($('option:selected', this).attr( - 'speciality')) + }) $('#field-contact_id').change(function() { - $('#field-msl_code').val($('option:selected', this).attr('msl_code')) + $('#field-speciality').val($('option:selected', this).attr('speciality')) + $('#field-msl_code').val($('option:selected', this).attr('msl_code')) + let restricted=$(this).find(":selected").attr('ardc_css_restricted_drs'); + console.log("restricted:",restricted); + if (restricted === 'Yes') { + + alert('Planning with these Doctors not allowed'); + + // Deselect current option + $(this).val('').trigger('change'); + + // Clear msl code as well + $('#field-msl_code').val(''); + } }) @@ -883,6 +900,7 @@ if (!empty($history->data->submissions)) { $('#field-contact_id_2').change(function() { $('#field-msl_code').val($('option:selected', this).attr('msl_code')) + }) $('#execution-form').on('submit', function(event) { @@ -1246,8 +1264,92 @@ $(document).ready(function () { }); + diff --git a/resources/views/form/rapport-team4/1769684976-dc875a6c-519f-49fb-b8aa-54f4116f28d5.blade.php b/resources/views/form/rapport-team4/1769684976-dc875a6c-519f-49fb-b8aa-54f4116f28d5.blade.php index ede83ba8..e2f6f13f 100644 --- a/resources/views/form/rapport-team4/1769684976-dc875a6c-519f-49fb-b8aa-54f4116f28d5.blade.php +++ b/resources/views/form/rapport-team4/1769684976-dc875a6c-519f-49fb-b8aa-54f4116f28d5.blade.php @@ -1,13 +1,57 @@ + @include('layouts.shared/title-meta', ['title' => "Form"]) @include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? '']) + +
- processing... + processing...
+
@@ -24,7 +68,8 @@

{{$form->title}}

- @if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) ) + @if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' + ) )
@if($form->link_type == 'form') View History @@ -38,11 +83,19 @@
Submitted By: {{$form->user_info->name}}
@endif + + @php + $submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id); + $submissions = $submissions->data->submissions; + + + @endphp + @if(count($submissions)===0 || $id)
@csrf @if($id) - + @endif @if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
@@ -56,83 +109,181 @@
@endif - - @foreach($questions as $question) -
- + @if( !in_array($question->code, + ["record_date","select_rxber_type"] ) ) + @continue; + @endif +
+ @switch($question->type) + @case('hidden') + + @break + @case('text') + @case('email') + @case('tel') + @case('date') + required == 'yes'?'required':'' }} + value="{{isset($question->value)?$question->value:''}}"> + @break + @case('number') + required == 'yes'?'required':'' }} + value="{{isset($question->value)?$question->value:0}}"> + @break + @case('textarea') + + @break + @case('dropdown') + + @break + @endswitch +
+ @endforeach +
+ + @foreach($questions as $question) + @if( in_array($question->code, + ["record_date","select_rxber_type"] ) ) + @continue; + @endif +
+ + @switch($question->type) @case('hidden') - - @break + + @break @case('text') @case('email') @case('tel') @case('date') - required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}"> - @break + required == 'yes'?'required':'' }} + value="{{isset($question->value)?$question->value:''}}"> + @break @case('number') - required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}"> - @break + required == 'yes'?'required':'' }} + value="{{isset($question->value)?$question->value:0}}"> + @break @case('textarea') - - @break + + @break @case('dropdown') - required == 'yes' ? 'required' : '' }}> + + @foreach ($question->options as $option) + + + + + @endforeach + + @else + @endif - - @break + @break @case('checkbox') + @foreach($question->options as $option) +
+ value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}> + +
+ @endforeach + @break + @case('file') + @if(!isset($form->is_approval) || (isset($form->is_approval) && + $form->is_approval != 'yes' ) ) + required == 'yes'?'required':'' }}> + @elseif(isset($question->value)) + + @endif + + @break + @case('multitextbox') +
@foreach($question->options as $option) -
- value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}> - +
{{$option->display}}
+
+
@endforeach - @break - @case('file') - @if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) ) - required == 'yes'?'required':'' }}> - @elseif(isset($question->value)) - - @endif - - @break - @case('multitextbox') -
- @foreach($question->options as $option) -
{{$option->display}}
-
- -
- @endforeach -
- @break - @endswitch +
+ @break + @endswitch
- @endforeach - @if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) ) -
+ @endforeach +
+
+ +
+ @if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != + 'yes' ) ) +
+ @if(!$id) + + @endif
@endif - + @elseif(!$id) +

You have submitted 10 doctors

+ @endif
@@ -146,37 +297,415 @@
- + @include('layouts.shared/footer-script') + + + - + - \ No newline at end of file + diff --git a/resources/views/form/rapport-team4/1777991655-af4c1986-1393-408b-87ec-f0dd77dae110.blade.php b/resources/views/form/rapport-team4/1777991655-af4c1986-1393-408b-87ec-f0dd77dae110.blade.php index 3e7551f7..bd8cede1 100644 --- a/resources/views/form/rapport-team4/1777991655-af4c1986-1393-408b-87ec-f0dd77dae110.blade.php +++ b/resources/views/form/rapport-team4/1777991655-af4c1986-1393-408b-87ec-f0dd77dae110.blade.php @@ -81,16 +81,16 @@
@endif - + {{--
+ +
--}}
-
-
Doctor
- +
+ {{--
Doctor
--}} +
@foreach($doctorQuestions as $question) @@ -107,7 +107,7 @@ required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}"> @break @case('number') - required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}"> + required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}"> @break @case('textarea') @@ -166,16 +166,12 @@
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) ) - -
-
- -
-
- -
+
+ +
+
+
- @endif @@ -362,6 +358,189 @@ }); }); + + $(document).ready(function () { + + // Define doctor dropdown + let $doctorSelect = $('.js-contact-id'); + + // Store original options + let originalOptions = $doctorSelect.find('option').clone(); + + $(document).on('change', '.js-campaign-type', function () { + + /* let selectedCampaign = $(this).html(); */ + let selectedCampaign = ($(this).val() || '').trim(); + + selectedCampaign = selectedCampaign.replace(/@/g, '').replace(/\s+/g, ' ').trim(); + + + /* if (selectedCampaign === '7 PM Conversion Campaign') { + console.log("Selected 7 PM"); + $('[data-code="rxs_given_for_montair_lc_adult"]') + .attr('min', 15); + + } else if (selectedCampaign === 'MLC A Pedia Campaign') { + console.log("Selected MLC A"); + $('[data-code="rxs_given_for_montair_lc_adult"]') + .attr('min', 8); + + } */ + + + let $wrapper2 = $(this).closest('.doctor-card'); + + let $rxField = $wrapper2.find('[data-code="rxs_given_for_montair_lc_adult"]'); + + if (selectedCampaign === '7 PM Conversion Campaign') { + console.log("Selected 7 PM"); + + $rxField.attr('min', 15); + + } else if (selectedCampaign === 'MLC A Pedia Campaign') { + console.log("Selected MLC A"); + + $rxField.attr('min', 8); + } + + + + console.log("Selected Campaign:", selectedCampaign); + + let $wrapper = $(this).closest('.doctor-card'); + + // Doctor dropdown ONLY inside current wrapper + $doctorSelect = $wrapper.find('.js-contact-id'); + + // Destroy select2 temporarily + $doctorSelect.select2('destroy'); + + // Empty dropdown + $doctorSelect.empty(); + + // Array to collect pediatrician doctors + let pediatricianDoctors = []; + + // Loop through original options + originalOptions.each(function () { + + let $option = $(this).clone(); + /* console.log($option); */ + + let speciality = ($option.attr('speciality') || '').trim(); + + + /* console.log("Speciality:", speciality); */ + + // Keep default option + if ($option.val() === '') { + console.log("Doctor:",$option.val()); + $doctorSelect.append($option); + return; + } + + // Show all doctors + if (selectedCampaign === '7 PM Conversion Campaign') { + console.log("7PM"); + $doctorSelect.append($option); + }else if (selectedCampaign === 'MLC A Pedia Campaign') { + console.log("*",selectedCampaign); + + + if (speciality === 'PAEDIATRICIAN' || speciality === 'Paediatrician' ||speciality === 'paediatrician' ) { + + pediatricianDoctors.push($option) + + + } + + } + + + + }); + + // Append pediatrician doctors + if (selectedCampaign === 'MLC A Pedia Campaign') { + + pediatricianDoctors.forEach(function ($doctor) { + + $doctorSelect.append($doctor); + }); + } + + // Reinitialize select2 + $doctorSelect.select2(); + + // Reset selection + $doctorSelect.val('').trigger('change'); + }); + + + + + }); + + + $('#field-record_date').closest('.col-md-12').before(` +
+
+ +
+ Campaign Guidelines +
+ +
+
+ 7PM Conversion Campaign +
+ +

+ Target Drs : + 25 Drs Mont+Fexo & Mont+Bila Drs +

+ +

+ Conversion : + 5 Conversions for Montair LC Adult +

+ +

+ Goal : + Each conversion with 15 Rxs Montair LC Adult +

+
+ +
+ +
+
+ MLC Adult @Pedia +
+ +

+ Target Drs : + 10 Drs Mont+Fexo & Mont+Bila Drs +

+ +

+ Conversion : + 5 Conversions for Montair LC Adult +

+ +

+ Goal : + Each conversion with 8 Rxs Montair LC Adult +

+
+ +
+
+`); + + + $('#report-form').on('submit', function(event){ event.preventDefault(); $("#pageloader").fadeIn(); diff --git a/resources/views/form/rapport-team4/1778148311-e733ad7d-9c7b-4b7c-bef5-5fed13a0fc04.blade.php b/resources/views/form/rapport-team4/1778148311-e733ad7d-9c7b-4b7c-bef5-5fed13a0fc04.blade.php index a3a0af07..aef91851 100644 --- a/resources/views/form/rapport-team4/1778148311-e733ad7d-9c7b-4b7c-bef5-5fed13a0fc04.blade.php +++ b/resources/views/form/rapport-team4/1778148311-e733ad7d-9c7b-4b7c-bef5-5fed13a0fc04.blade.php @@ -328,7 +328,115 @@ }); @endif - + + + /* for (let i = 1; i <= 10; i++) { + + $(`#field-email_id_${i}`).on('input', function () { + + // Remove spaces + this.value = this.value.replace(/\s/g, ''); + }); + + $(`#field-email_id_${i}`).on('blur', function () { + + let email = $(this).val().trim(); + + let emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + + if (email !== '' && !emailPattern.test(email)) { + alert('Please enter a valid email address'); + $(this).focus(); + } + }); + + } */ + + for (let i = 1; i <= 10; i++) { + + $(`#field-email_id_${i}`).on('input', function () { + + // Remove spaces + this.value = this.value.replace(/\s/g, ''); + + }); + + $(`#field-email_id_${i}`).on('blur', function () { + + let email = $(this).val().trim(); + + let emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + + // Remove old error + $(this).next('.email-error').remove(); + + if (email !== '' && !emailPattern.test(email)) { + + $(this).addClass('is-invalid'); + + $(this).after(` + + `); + + } else { + + $(this).removeClass('is-invalid'); + + } + + }); + + } + + + for(let i=1;i<=10;i++){ + $(`#field-msl_code_${i}`).prop('readonly',true); + $(`#field-speciality_${i}`).prop('readonly',true); + + } + + for (let i = 1; i <= 10; i++) { + + $(`#field-mobile_number_${i}`).on('input', function () { + + // Allow only numbers + this.value = this.value.replace(/\D/g, ''); + + // Limit to 10 digits + if (this.value.length > 10) { + this.value = this.value.slice(0, 10); + } + + }); + + // Validation on form submit / field blur + $(`#field-mobile_number_${i}`).on('blur', function () { + + if (this.value.length !== 10) { + $(this).addClass('is-invalid'); + + // Optional message + if (!$(this).next('.error-msg').length) { + $(this).after( + ` + Mobile number must be exactly 10 digits + ` + ); + } + + } else { + $(this).removeClass('is-invalid'); + $(this).next('.error-msg').remove(); + } + + }); + } + + + + // Loop through hierarcies and fetch contacts for each hierarchy, store in contacts variable // $('#field-user_id').change(function(){ diff --git a/resources/views/form/rapport-team4/1779442011-6310b301-bb23-48fd-9f94-ad4f1959d0a6.blade.php b/resources/views/form/rapport-team4/1779442011-6310b301-bb23-48fd-9f94-ad4f1959d0a6.blade.php new file mode 100644 index 00000000..503d9c04 --- /dev/null +++ b/resources/views/form/rapport-team4/1779442011-6310b301-bb23-48fd-9f94-ad4f1959d0a6.blade.php @@ -0,0 +1,798 @@ + + + + + @include('layouts.shared/title-meta', ['title' => "Form"]) + @include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? '']) + + + + +
+ processing... +
+ + + + + + @include('layouts.shared/footer-script') + + + + + +