1266 lines
62 KiB
PHP
1266 lines
62 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
@include('layouts.shared/title-meta', ['title' => 'Form'])
|
|
@include('layouts.shared/head-css', ['mode' => $mode ?? '', 'demo' => $demo ?? ''])
|
|
<link href="{{ asset('assets/libs/sweetalert2/sweetalert2.min.css') }}" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<div id="pageloader">
|
|
<img src="/images/loader-large.gif" alt="processing..." />
|
|
</div>
|
|
|
|
<body class="loading">
|
|
<div class="account-pages">
|
|
<div class="container">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-8 col-lg-6 col-xl-5 p-0">
|
|
<div class="card">
|
|
<div class="card-body p-3 row">
|
|
|
|
@if (Session::has('error'))
|
|
<div class="alert alert-danger">{{ Session::get('error') }}</div>
|
|
<br>
|
|
@endif
|
|
@if (session('success'))
|
|
<div class=" alert alert-success">{{ session('success') }}
|
|
</div>
|
|
<br>
|
|
@endif
|
|
<div class="col-8">
|
|
<h4 class="page-title">ARDC Camp</h4>
|
|
</div>
|
|
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval !=
|
|
'yes'))
|
|
<div class="col-4">
|
|
@if ($form->link_type == 'form')
|
|
<!-- <a href="/form/history" class="float-end pt-1">View History</a> -->
|
|
<button type="button" class="btn btn-primary btn-xs" id="add-camp-btn">Add
|
|
Plan</button>
|
|
@else
|
|
<a href="{{ url()->previous() }}" class="float-end pt-1">Back</a>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
@php
|
|
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
|
/* echo "<pre>";
|
|
print_r($history->data->submissions[0]);
|
|
echo "</pre>"; */
|
|
@endphp
|
|
|
|
<div class="col-12" id="table-wrapper">
|
|
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-borderless table-nowrap table-hover table-centered m-0">
|
|
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Action.</th>
|
|
{{-- <th>Current Status</th> --}}
|
|
<th>Camp Plan Date</th>
|
|
<th>Execution Done</th>
|
|
<th>Doctor Name</th>
|
|
{{-- <th>Other Doctor Name</th> --}}
|
|
<th>Camp Execution Date</th>
|
|
|
|
<th>Reporting Date</th>
|
|
<th>Legacy Code</th>
|
|
<th>Speciality</th>
|
|
<th>Camp Name</th>
|
|
<th>Camp Planned Start Time</th>
|
|
<th>OPD Timing</th>
|
|
|
|
<th>Executed as per plan</th>
|
|
<th>Revised start time</th>
|
|
<th>Patient Screened</th>
|
|
<th>Patients Diagnosed</th>
|
|
<th>Rxn of Montair LC Adult</th>
|
|
<th>Rxn of Montair LC Kid Tab</th>
|
|
<th>Rxn of Montair LC Kid Syrup</th>
|
|
<th>Rxn of Furamist</th>
|
|
<th>Rxn of Furamist AZ</th>
|
|
<th>Total Rxns</th>
|
|
<th>Upload Acrylic Poster Image</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($history->data->submissions as $sub)
|
|
@php
|
|
$sub->formdata->id = $sub->id;
|
|
@endphp
|
|
|
|
@php
|
|
|
|
|
|
$sub->formdata->id = $sub->id;
|
|
|
|
// Parse plan date safely
|
|
$planDate = isset($sub->formdata->plan_date) ? \Carbon\Carbon::parse($sub->formdata->plan_date) : null;
|
|
|
|
// Define current date and allowed date range
|
|
$now = \Carbon\Carbon::now();
|
|
$startOfCurrentMonth = $now->copy()->startOfMonth();
|
|
$fifthOfNextMonth = $now->copy()->addMonth()->startOfMonth()->addDays(4); // 5th of next month
|
|
|
|
@endphp
|
|
|
|
<tr>
|
|
<td>
|
|
<?php
|
|
$today=date('d',strtotime("-1 months"));
|
|
|
|
?>
|
|
|
|
@if ( $planDate && $planDate->between($startOfCurrentMonth, $fifthOfNextMonth) && $now->greaterThanOrEqualTo($planDate))
|
|
<button type="button" class="btn btn-xs btn-info edit-btn"
|
|
plan_details="{{ json_encode($sub->formdata) }}"><i
|
|
class="mdi mdi-pencil"></i> Edit</button>
|
|
|
|
|
|
{{-- @elseif ($sub->workflow_status == 'rejected' ||
|
|
(isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'no'))
|
|
<button type="button" class="btn btn-xs btn-info edit-plan-btn"
|
|
plan_details="{{ json_encode($sub->formdata) }}">
|
|
<i class="mdi mdi-pencil"></i> Edit Plan
|
|
</button> --}}
|
|
@endif
|
|
|
|
</td>
|
|
{{-- <td>{{ $sub->workflow_status }}</td> --}}
|
|
<td>{{ $sub->formdata->plan_date }}</td>
|
|
<td>{{ isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'yes' ? 'Yes' : 'No' }}
|
|
</td>
|
|
|
|
<td>
|
|
@if (isset($sub->formdata->contact_id) && $sub->formdata->contact_id
|
|
!== '')
|
|
{{ $sub->formdata->contact_id }}
|
|
@elseif (isset($sub->formdata->doctor_name))
|
|
{{ $sub->formdata->doctor_name }}
|
|
@else
|
|
{{-- Default value or empty string, adjust as needed --}}
|
|
{{ '' }}
|
|
@endif
|
|
</td>
|
|
|
|
{{-- <td>
|
|
@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
|
|
|
|
{{ '' }}
|
|
@endif
|
|
</td> --}}
|
|
<td>{{$sub->formdata->execution_date}}</td>
|
|
<td>{{isset($sub->formdata->record_date ) ? $sub->formdata->record_date : ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->msl_code) ? $sub->formdata->msl_code : '' }}
|
|
</td>
|
|
<td>{{isset($sub->formdata->speciality) ? $sub->formdata->speciality: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->camp_name) ? $sub->formdata->camp_name: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->camp_planned_start_time) ? $sub->formdata->camp_planned_start_time: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->opd_timing) ? $sub->formdata->opd_timing: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->executed_as_per_plan) ? $sub->formdata->executed_as_per_plan: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->revised_start_time) ? $sub->formdata->revised_start_time: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->patient_screened) ? $sub->formdata->patient_screened: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->patients_diagnosed) ? $sub->formdata->patients_diagnosed: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->rxn_of_montair_lc_adult) ? $sub->formdata->rxn_of_montair_lc_adult: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->rxn_of_montair_lc_kid_tab) ? $sub->formdata->rxn_of_montair_lc_kid_tab: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->rxn_of_montair_lc_kid_syrup) ? $sub->formdata->rxn_of_montair_lc_kid_syrup: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->rxn_of_furamist) ? $sub->formdata->rxn_of_furamist: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->rxn_of_furamist_az) ? $sub->formdata->rxn_of_furamist_az: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->total_rxns) ? $sub->formdata->total_rxns: ''}}</td>
|
|
<td>{{isset($sub->formdata->file_upload) ? $sub->formdata->file_upload: ''}}</td>
|
|
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="form-wrapper">
|
|
<form method="POST" action="/form/submit" id="report-form"
|
|
enctype="multipart/form-data">
|
|
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
|
@csrf
|
|
@if ($id)
|
|
<input type="hidden" name="id" value="{{ $id }}">
|
|
@endif
|
|
@foreach ($questions as $question)
|
|
@if (in_array($question->code, ['execution_date','executed_as_per_plan' ,'revised_start_time','patient_screened','patients_diagnosed','rxn_of_montair_lc_adult','rxn_of_montair_lc_kid_tab','rxn_of_montair_lc_kid_syrup','rxn_of_furamist','rxn_of_furamist_az','total_rxns','file_upload']))
|
|
@continue
|
|
@endif
|
|
<div class="col-md-12 mb-2">
|
|
<label for="field-{{ $question->code }}"
|
|
class="form-label">{{ $question->question }} {!! $question->required ==
|
|
'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
|
</label>
|
|
@switch($question->type)
|
|
@case('hidden')
|
|
<input type="{{ $question->type }}" id="field-{{ $question->code }}"
|
|
name="{{ $question->code }}"
|
|
value="{{ isset($question->value) ? $question->value : '' }}">
|
|
@break
|
|
|
|
@case('text')
|
|
@case('email')
|
|
|
|
@case('tel')
|
|
@case('date')
|
|
<input type="{{ $question->type }}" id="field-{{ $question->code }}"
|
|
name="{{ $question->code }}" class="form-control"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}
|
|
value="{{ isset($question->value) ? $question->value : '' }}">
|
|
@break
|
|
|
|
@case('number')
|
|
<input type="{{ $question->type }}" min="0" max="9999999999" step="1"
|
|
id="field-{{ $question->code }}" name="{{ $question->code }}"
|
|
class="form-control" {{ $question->required == 'yes' ? 'required' : '' }}
|
|
value="{{ isset($question->value) ? $question->value : 0 }}">
|
|
@break
|
|
|
|
@case('textarea')
|
|
<textarea id="field-{{ $question->code }}" name="{{ $question->code }}"
|
|
class="form-control"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}>{{ isset($question->value) ? $question->value : '' }}</textarea>
|
|
@break
|
|
|
|
@case('dropdown')
|
|
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
|
<option value=""> -- Select -- </option>
|
|
@if ($question->code == 'contact_id')
|
|
@foreach ($question->options as $option)
|
|
|
|
<option value="{{ $option->value }}"
|
|
legacy_code="{{isset($option->contact->legacy_code)?$option->contact->legacy_code:''}}"
|
|
speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
|
ardc_css_restricted_drs="{{isset($option->contact->ardc_css_restricted_drs)?$option->contact->ardc_css_restricted_drs:''}}"
|
|
>
|
|
{{ $option->display }}
|
|
</option>
|
|
|
|
|
|
@endforeach
|
|
{{-- <option value="others" {{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>
|
|
others
|
|
</option> --}}
|
|
@elseif($question->code=='contact_id_2')
|
|
@foreach ($question->options as $option)
|
|
|
|
<option value="{{ $option->value }}" legacy_code="{{isset($option->contact->legacy_code)?$option->contact->legacy_code:''}}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $option->display }}
|
|
</option>
|
|
|
|
@endforeach
|
|
|
|
@else
|
|
@foreach ($question->options as $option)
|
|
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $option->display }}
|
|
</option>
|
|
@endforeach
|
|
@endif
|
|
</select>
|
|
@break
|
|
|
|
@case('checkbox')
|
|
@foreach ($question->options as $option)
|
|
<div class="form-check mb-2 form-check-primary">
|
|
<input class="form-check-input" type="checkbox"
|
|
id="field-{{ $question->code }}-{{ $option->value }}"
|
|
name="{{ $question->code }}[]" value="{{ $option->value }}"
|
|
{{ isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked' : '' }}>
|
|
<label class="form-check-label"
|
|
for="field-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
|
</div>
|
|
@endforeach
|
|
@break
|
|
|
|
@case('file')
|
|
<input type="file" id="field-{{ $question->code }}" name="{{ $question->code }}"
|
|
class="form-control" value="" accept="image/jpg, image/jpeg, image/png"
|
|
required>
|
|
@break
|
|
@endswitch
|
|
</div>
|
|
@endforeach
|
|
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval
|
|
!= 'yes'))
|
|
<div class="text-center d-grid mt-3">
|
|
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
|
</button>
|
|
</div>
|
|
@endif
|
|
</form>
|
|
</div>
|
|
|
|
<div id="execution-form-wrapper">
|
|
<form method="POST" action="/form/submit" id="execution-form"
|
|
enctype="multipart/form-data">
|
|
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
|
@csrf
|
|
<input type="hidden" name="id" value="" id="execution-id">
|
|
{{-- <input type="hidden" name="execution_done" value="yes"> --}}
|
|
@foreach ($questions as $question)
|
|
<div class="col-md-12 mb-2">
|
|
<label for="execution-{{ $question->code }}"
|
|
class="form-label">{{ $question->question }} {!! $question->required ==
|
|
'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
|
</label>
|
|
@switch($question->type)
|
|
@case('hidden')
|
|
<input type="{{ $question->type }}" id="execution-{{ $question->code }}"
|
|
name="{{ $question->code }}"
|
|
value="{{ isset($question->value) ? $question->value : '' }}">
|
|
@break
|
|
|
|
@case('text')
|
|
@case('email')
|
|
|
|
@case('tel')
|
|
@case('date')
|
|
<input type="{{ $question->type }}" id="execution-{{ $question->code }}"
|
|
name="{{ $question->code }}" class="form-control"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}
|
|
value="{{ isset($question->value) ? $question->value : '' }}">
|
|
@break
|
|
|
|
@case('number')
|
|
<input type="{{ $question->type }}" min="0" max="9999999999" step="1"
|
|
id="execution-{{ $question->code }}" name="{{ $question->code }}"
|
|
class="form-control" {{ $question->required == 'yes' ? 'required' : '' }}
|
|
value="{{ isset($question->value) ? $question->value : 0 }}">
|
|
@break
|
|
|
|
@case('textarea')
|
|
<textarea id="execution-{{ $question->code }}" name="{{ $question->code }}"
|
|
class="form-control"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}>{{ isset($question->value) ? $question->value : '' }}</textarea>
|
|
@break
|
|
|
|
@case('dropdown')
|
|
@if ($question->code == 'contact_id')
|
|
<select class="form-control" id="execution-{{ $question->code }}"
|
|
name="{{ $question->code }}"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}>
|
|
<option value=""> -- Select -- </option>
|
|
@foreach ($question->options as $option)
|
|
@if ($option->contact->type == 'doctor')
|
|
<option value="{{ $option->value }}"
|
|
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
|
legacy_code="{{ isset($option->contact->legacy_code) ? $option->contact->legacy_code : '' }}"
|
|
speciality="{{ isset($option->contact->speciality) ? $option->contact->speciality : '' }}">
|
|
{{ $option->display }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
<option value="others"{{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>
|
|
others
|
|
</option>
|
|
|
|
</select>
|
|
|
|
@elseif ($question->code == 'contact_id_2')
|
|
<select class="form-control" id="execution-{{ $question->code }}"
|
|
name="{{ $question->code }}"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}>
|
|
<option value=""> -- Select -- </option>
|
|
@foreach ($question->options as $option)
|
|
@if ($option->contact->type == 'doctor')
|
|
<option value="{{ $option->value }}"
|
|
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
|
legacy_code="{{ isset($option->contact->legacy_code) ? $option->contact->legacy_code : '' }}"
|
|
speciality="{{ isset($option->contact->speciality) ? $option->contact->speciality : '' }}">
|
|
{{ $option->display }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
<option value="others"{{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>
|
|
others
|
|
</option>
|
|
|
|
</select>
|
|
|
|
@else
|
|
<select class="form-control" id="execution-{{ $question->code }}"
|
|
name="{{ $question->code }}"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}>
|
|
<option value=""> -- Select -- </option>
|
|
@foreach ($question->options as $option)
|
|
<option value="{{ $option->value }}"
|
|
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $option->display }}</option>
|
|
@endforeach
|
|
</select>
|
|
@endif
|
|
@break
|
|
|
|
@case('checkbox')
|
|
@foreach ($question->options as $option)
|
|
<div class="form-check mb-2 form-check-primary">
|
|
<input class="form-check-input" type="checkbox"
|
|
id="execution-{{ $question->code }}-{{ $option->value }}"
|
|
name="{{ $question->code }}[]" value="{{ $option->value }}"
|
|
{{ isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked' : '' }}>
|
|
<label class="form-check-label"
|
|
for="execution-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
|
</div>
|
|
@endforeach
|
|
@break
|
|
|
|
@case('file')
|
|
<input type="file" id="execution-{{ $question->code }}"
|
|
name="{{ $question->code }}" class="form-control" value=""
|
|
accept="image/jpg, image/jpeg, image/png" {{ $question->required == 'yes' ? 'required' : '' }} >
|
|
|
|
@break
|
|
@endswitch
|
|
</div>
|
|
|
|
@endforeach
|
|
<div id="errorMessage"></div>
|
|
<div id="errorMessage2"></div>
|
|
|
|
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval
|
|
!= 'yes'))
|
|
<div class="text-center d-grid mt-3">
|
|
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
|
</button>
|
|
</div>
|
|
@endif
|
|
</form>
|
|
</div>
|
|
|
|
</div> <!-- end card-body -->
|
|
</div>
|
|
<!-- end card -->
|
|
|
|
<!-- end row -->
|
|
|
|
</div> <!-- end col -->
|
|
</div>
|
|
<!-- end row -->
|
|
</div>
|
|
<!-- end container -->
|
|
</div>
|
|
<!-- end page -->
|
|
<style type="text/css">
|
|
#pageloader {
|
|
background: rgba(255, 255, 255, 0.8);
|
|
display: none;
|
|
height: 100%;
|
|
position: fixed;
|
|
width: 100%;
|
|
z-index: 9999;
|
|
}
|
|
|
|
#pageloader img {
|
|
left: 50%;
|
|
margin-left: -32px;
|
|
margin-top: -32px;
|
|
position: absolute;
|
|
top: 50%;
|
|
}
|
|
</style>
|
|
@include('layouts.shared/footer-script')
|
|
<script src="{{ asset('assets/libs/sweetalert2/sweetalert2.min.js') }}"></script>
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function($) {
|
|
$('#form-wrapper').hide()
|
|
$('#execution-form-wrapper').hide()
|
|
|
|
// $('#add-camp-btn').click(function() {
|
|
// $('#form-wrapper').show()
|
|
// $('#table-wrapper').hide()
|
|
// })
|
|
|
|
$('#add-camp-btn').click(function() {
|
|
$('#table-wrapper').hide(0)
|
|
$('#form-wrapper').show(100, () => {
|
|
$('#add-camp-btn').hide(0);
|
|
})
|
|
|
|
|
|
})
|
|
|
|
|
|
const todayDate = new Date();
|
|
const dayOfMonth = todayDate.getDate();
|
|
|
|
// if(todayDate>5){
|
|
// $('#add-camp-btn').hide();
|
|
// }
|
|
|
|
$('#execution-revised_start_time').parent().hide();
|
|
$('#execution-revised_start_time').prop({"required":false});
|
|
|
|
|
|
|
|
// $('#execution-executed_as_per_plan').on('change',function(){
|
|
// var dropDown=$('#execution-executed_as_per_plan').val();
|
|
// console.log("DropDown is : ",dropDown);
|
|
// if(dropDown==='Yes'){
|
|
// $('#execution-revised_start_time').parent().hide();
|
|
// $('#execution-revised_start_time').prop({"required":false});
|
|
// }
|
|
// else if(dropDown==='No'){
|
|
// $('#execution-revised_start_time').parent().show();
|
|
// $('#execution-revised_start_time').prop({"required":true});
|
|
// }
|
|
// })
|
|
|
|
$('#execution-rxn_of_montair_lc_adult,#execution-rxn_of_montair_lc_kid_tab,#execution-rxn_of_montair_lc_kid_syrup,#execution-rxn_of_furamist,#execution-rxn_of_furamist_az').on('keyup',function(){
|
|
var a=parseInt($('#execution-rxn_of_montair_lc_adult').val())||0;
|
|
var b=parseInt($('#execution-rxn_of_montair_lc_kid_tab').val())||0;
|
|
var c=parseInt($('#execution-rxn_of_montair_lc_kid_syrup').val())||0;
|
|
var d=parseInt($('#execution-rxn_of_furamist').val())||0;
|
|
var e=parseInt($('#execution-rxn_of_furamist_az').val())||0;
|
|
|
|
var total =a+b+c+d+e;
|
|
$('#execution-total_rxns').val(total);
|
|
|
|
});
|
|
|
|
$('#execution-total_rxns').prop({"readonly":true});
|
|
//$('#execution-executed_as_per_plan').prop("disabled",true);
|
|
|
|
// $('#execution-patients_diagnosed').on('change',function(){
|
|
// let a=document.getElementById('execution-patients_diagnosed');
|
|
|
|
// let b=a.value;
|
|
// console.log("Value of patience diagnosed",b);
|
|
// let c=$('#execution-rxn_of_montair_lc_adult').val();
|
|
// let d=$('#execution-rxn_of_montair_lc_kid_tab').val();
|
|
// let e=$('#execution-rxn_of_montair_lc_kid_syrup').val();
|
|
// let f=$('#execution-rxn_of_furamist').val();
|
|
// let g=$('#execution-rxn_of_furamist_az').val();
|
|
// let total=c+d+e+f+g;
|
|
// if(b!==total){
|
|
// return;
|
|
// }
|
|
// });
|
|
|
|
|
|
$('.edit-btn').click(function() {
|
|
$('#execution-form-wrapper').show(100, () => {
|
|
$('#add-camp-btn').hide(0);
|
|
})
|
|
$('#table-wrapper').hide()
|
|
//$('#execution-contact_id').prop('disabled', true)
|
|
//$('#execution-contact_id').prop('readonly', true)
|
|
// $('#execution-activity_type').prop('readonly', true)
|
|
$('#execution-speciality').prop('readonly', true)
|
|
$('#execution-plan_date').prop('readonly', true)
|
|
$('#execution-msl_code').prop('readonly',true);
|
|
//$('#execution-camp_name').prop('disabled',true);
|
|
//$('#execution-time').prop('disabled', true)
|
|
|
|
let contact = document.getElementById('execution-contact_id');
|
|
contact.addEventListener('mousedown', function(e) {
|
|
e.preventDefault();
|
|
})
|
|
|
|
/* 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');
|
|
camp_planned_start.addEventListener('mousedown', function(e) {
|
|
e.preventDefault();
|
|
})
|
|
|
|
let opd_time = document.getElementById('execution-opd_timing');
|
|
opd_time.addEventListener('mousedown', function(e) {
|
|
e.preventDefault();
|
|
})
|
|
|
|
|
|
|
|
let selected = JSON.parse($(this).attr('plan_details'));
|
|
console.log("Plan Detail : ", selected);
|
|
if (selected['contact_id']) {
|
|
selected['contact_id'] = selected['contact_id'].trim();
|
|
}
|
|
console.log("Selected Doctor : ", selected['contact_id']);
|
|
if(selected['contact_id']==='others'){
|
|
$('#execution-contact_id_2').parent().show();
|
|
$('#execution-contact_id_2').prop('required',true);
|
|
|
|
$('#execution-contact_id').parent().hide();
|
|
$('#execution-contact_id').prop('required',false);
|
|
|
|
}
|
|
else{
|
|
$('#execution-contact_id_2').parent().hide();
|
|
$('#execution-contact_id_2').prop('required',false);
|
|
|
|
|
|
$('#execution-contact_id').parent().show();
|
|
$('#execution-contact_id').prop('required',true);
|
|
}
|
|
|
|
|
|
|
|
|
|
for (let k of Object.keys(selected)) {
|
|
if (selected[k] != '') {
|
|
if (k == 'contact_id') {
|
|
//$("#execution-contact_id option:contains(" + selected[k] + ")").prop('selected', true)
|
|
// console.log($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
|
|
$('#execution-contact_id').val($("#execution-contact_id option:contains(" +
|
|
selected[k] + ")").attr('value'));
|
|
}
|
|
|
|
else{
|
|
$('#execution-' + k).val(selected[k]);
|
|
}
|
|
}
|
|
// if(selected[k] != '')
|
|
// $('#execution-'+k).val(selected[k]);
|
|
}
|
|
let docid = $('#execution-contact_id option').map(function() {
|
|
if ($(this).text().trim() == selected['contact_id']) return this;
|
|
}).attr('value')
|
|
$('#execution-contact_id').val(docid)
|
|
$('#execution-id').val(selected['id'])
|
|
|
|
|
|
let docid2 = $('#execution-contact_id_2 option').map(function() {
|
|
if ($(this).text().trim() == selected['contact_id_2']) return this;
|
|
}).attr('value')
|
|
$('#execution-contact_id_2').val(docid2)
|
|
$('#execution-id').val(selected['id'])
|
|
|
|
|
|
|
|
|
|
|
|
// let executionDate=new Date();
|
|
// let dateOfMonth=executionDate.getDate();
|
|
|
|
// if(dateOfMonth>5){
|
|
// $('.edit-btn').hide();
|
|
// }
|
|
|
|
if (selected.execution_done === "yes") {
|
|
let camp_name = document.getElementById('execution-camp_name');
|
|
camp_name.addEventListener('mousedown', function(e) {
|
|
e.preventDefault();
|
|
})
|
|
}
|
|
|
|
$('#execution-form').append('<input type="hidden" name="execution_done" value="yes">');
|
|
|
|
$('#execution-file_upload').on('change', function () {
|
|
let file = this.files[0];
|
|
|
|
if (file) {
|
|
let allowedTypes = ['image/png', 'image/jpg', 'image/jpeg'];
|
|
let maxSize = 10 * 1024 * 1024; // 10 MB
|
|
|
|
// Type validation
|
|
if (!allowedTypes.includes(file.type)) {
|
|
alert('Only PNG, JPG, and JPEG files are allowed.');
|
|
$(this).val('');
|
|
return;
|
|
}
|
|
|
|
// Size validation
|
|
if (file.size > maxSize) {
|
|
alert('File size should not exceed 10 MB.');
|
|
$(this).val('');
|
|
return;
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
/*
|
|
$('.edit-plan-btn').click(function() {
|
|
$('#execution-form-wrapper').show(100, () => {
|
|
$('#add-camp-btn').hide(0);
|
|
})
|
|
$('#table-wrapper').hide()
|
|
//$('#execution-contact_id').prop('disabled', true)
|
|
//$('#execution-contact_id').prop('readonly', true)
|
|
// $('#execution-activity_type').prop('readonly', true)
|
|
$('#execution-speciality').prop('readonly', true)
|
|
//$('#execution-plan_date').prop('readonly', true)
|
|
$('#execution-msl_code').prop('readonly',true);
|
|
//$('#execution-camp_name').prop('disabled',true);
|
|
//$('#execution-time').prop('disabled', true)
|
|
|
|
|
|
|
|
|
|
|
|
let selected = JSON.parse($(this).attr('plan_details'));
|
|
console.log("Plan Detail : ", selected);
|
|
if (selected['contact_id']) {
|
|
selected['contact_id'] = selected['contact_id'].trim();
|
|
}
|
|
console.log("Selected Doctor : ", selected['contact_id']);
|
|
|
|
|
|
|
|
|
|
|
|
for (let k of Object.keys(selected)) {
|
|
if (selected[k] != '') {
|
|
if (k == 'contact_id') {
|
|
//$("#execution-contact_id option:contains(" + selected[k] + ")").prop('selected', true)
|
|
// console.log($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
|
|
$('#execution-contact_id').val($("#execution-contact_id option:contains(" +
|
|
selected[k] + ")").attr('value'));
|
|
}
|
|
|
|
else{
|
|
$('#execution-' + k).val(selected[k]);
|
|
}
|
|
}
|
|
// if(selected[k] != '')
|
|
// $('#execution-'+k).val(selected[k]);
|
|
}
|
|
let docid = $('#execution-contact_id option').map(function() {
|
|
if ($(this).text().trim() == selected['contact_id']) return this;
|
|
}).attr('value')
|
|
$('#execution-contact_id').val(docid)
|
|
$('#execution-id').val(selected['id'])
|
|
|
|
|
|
let docid2 = $('#execution-contact_id_2 option').map(function() {
|
|
if ($(this).text().trim() == selected['contact_id_2']) return this;
|
|
}).attr('value')
|
|
$('#execution-contact_id_2').val(docid2)
|
|
$('#execution-id').val(selected['id'])
|
|
|
|
$('#execution-execution_date').parent().hide();
|
|
$('#execution-execution_date').prop('required',false);
|
|
$('#execution-executed_as_per_plan').parent().hide();
|
|
$('#execution-executed_as_per_plan').prop('required',false);
|
|
$('#execution-patient_screened').parent().hide();
|
|
$('#execution-patient_screened').prop('required',false);
|
|
$('#execution-patients_diagnosed').parent().hide();
|
|
$('#execution-patients_diagnosed').prop('required',false);
|
|
$('#execution-rxn_of_montair_lc_adult').parent().hide();
|
|
$('#execution-rxn_of_montair_lc_adult').prop('required',false);
|
|
$('#execution-rxn_of_montair_lc_kid_tab').parent().hide();
|
|
$('#execution-rxn_of_montair_lc_kid_tab').prop('required',false);
|
|
$('#execution-rxn_of_montair_lc_kid_syrup').parent().hide();
|
|
$('#execution-rxn_of_montair_lc_kid_syrup').prop('required',false);
|
|
$('#execution-rxn_of_furamist').parent().hide();
|
|
$('#execution-rxn_of_furamist').prop('required',false);
|
|
$('#execution-rxn_of_furamist_az').parent().hide();
|
|
$('#execution-rxn_of_furamist_az').prop('required',false);
|
|
$('#execution-total_rxns').parent().hide();
|
|
$('#execution-total_rxns').prop('required',false);
|
|
|
|
$('#execution-contact_id').change(function() {
|
|
$('#execution-speciality').val($('option:selected', this).attr('speciality'))
|
|
})
|
|
|
|
$('#execution-contact_id').change(function() {
|
|
$('#execution-msl_code').val($('option:selected', this).attr('legacy_code'))
|
|
})
|
|
|
|
|
|
$('#execution-contact_id_2').change(function() {
|
|
$('#execution-speciality').val($('option:selected', this).attr('speciality'))
|
|
})
|
|
|
|
$('#execution-contact_id_2').change(function() {
|
|
$('#execution-msl_code').val($('option:selected', this).attr('legacy_code'))
|
|
})
|
|
|
|
|
|
|
|
if (selected.execution_done === "yes") {
|
|
let camp_name = document.getElementById('execution-camp_name');
|
|
camp_name.addEventListener('mousedown', function(e) {
|
|
e.preventDefault();
|
|
})
|
|
}
|
|
|
|
})
|
|
*/
|
|
|
|
|
|
|
|
|
|
$('#report-form').on('submit', function(event) {
|
|
event.preventDefault();
|
|
|
|
$("#pageloader").fadeIn();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/form/ajaxsubmit',
|
|
data: new FormData($('#report-form')[0]),
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(data) {
|
|
$("#pageloader").fadeOut();
|
|
if (data.status == 'success') {
|
|
Swal.fire({
|
|
title: 'Great!',
|
|
text: 'Your data is successfully submitted!',
|
|
icon: 'success'
|
|
})
|
|
window.location.reload();
|
|
//$('#report-form').trigger("reset");
|
|
} else {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Data not submitted',
|
|
text: 'Something went wrong, please try again after some time!'
|
|
})
|
|
}
|
|
},
|
|
});
|
|
});
|
|
|
|
// $('#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('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('');
|
|
}
|
|
})
|
|
|
|
|
|
$('#field-contact_id_2').change(function() {
|
|
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
|
})
|
|
|
|
$('#field-contact_id_2').change(function() {
|
|
$('#field-msl_code').val($('option:selected', this).attr('legacy_code'))
|
|
})
|
|
|
|
|
|
// $('#field-contact_id').append('<option value="others">Others</option>');
|
|
|
|
$('#field-contact_id_2').parent().hide();
|
|
$('#field-contact_id_2').prop('required',false);
|
|
|
|
$('#field-contact_id').on('change',function(){
|
|
let val=$(this).val();
|
|
console.log(val);
|
|
if(val==='others'){
|
|
$('#field-contact_id_2').parent().show();
|
|
$('#field-contact_id_2').prop('required',true);
|
|
}
|
|
else{
|
|
$('#field-contact_id_2').parent().hide();
|
|
$('#field-contact_id_2').prop('required',false);
|
|
}
|
|
})
|
|
|
|
|
|
$('#field-msl_code').prop('readonly',true);
|
|
$('#field-speciality').prop('readonly',true);
|
|
|
|
$('#execution-form').on('submit', function(event) {
|
|
event.preventDefault();
|
|
let patientsDiagnosedCount=parseFloat(document.getElementById('execution-patients_diagnosed').value);
|
|
let totalRxn=parseFloat(document.getElementById('execution-total_rxns').value);
|
|
let patientsScreened=parseFloat(document.getElementById('execution-patient_screened').value);
|
|
console.log("Patients Screened : ",patientsScreened);
|
|
console.log("Patients diagnosed :",patientsDiagnosedCount);
|
|
console.log("Total RXns: ",totalRxn);
|
|
|
|
|
|
if((patientsDiagnosedCount>patientsScreened)){
|
|
$('#errorMessage').html('<p style="text-align:center;color:red">*Kindly review ,Your Patients Diagnosed is exceeding Total Patients Screened !</p>');
|
|
return;
|
|
}
|
|
if(patientsDiagnosedCount<totalRxn){
|
|
console.log("Total Rxn is greater than Patients diagnosed !");
|
|
$('#errorMessage2').html('<p style="text-align:center;color:red">*Kindly review ,Your Total Rxn is exceeding Total Patients diagnosed !</p>');
|
|
return;
|
|
}
|
|
else{
|
|
$('#errorMessage').html('');
|
|
$('#errorMessage2').html('');
|
|
}
|
|
|
|
|
|
$("#pageloader").fadeIn();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/form/ajaxsubmit',
|
|
data: new FormData($('#execution-form')[0]),
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(data) {
|
|
$("#pageloader").fadeOut();
|
|
if (data.status == 'success') {
|
|
Swal.fire({
|
|
title: 'Great!',
|
|
text: 'Your data is successfully submitted!',
|
|
icon: 'success'
|
|
})
|
|
window.location.reload();
|
|
//$('#report-form').trigger("reset");
|
|
} else {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Data not submitted',
|
|
text: 'Something went wrong, please try again after some time!'
|
|
})
|
|
}
|
|
},
|
|
});
|
|
});
|
|
|
|
var today = new Date();
|
|
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 recordDateField = document.getElementById('field-plan_date');
|
|
|
|
recordDateField.setAttribute('min', today);
|
|
|
|
var executionDateField = document.getElementById('execution-plan_date');
|
|
//executionDateField.setAttribute('min', today);
|
|
|
|
// $('.edit-btn').click(function() {
|
|
// var executionexeField = document.getElementById('execution-record_date');
|
|
// executionexeField.setAttribute('min', executionDateField.value);
|
|
// });
|
|
|
|
$('.edit-btn').click(function() {
|
|
|
|
|
|
var executionexeField = document.getElementById('execution-execution_date');
|
|
executionexeField.setAttribute('min', executionDateField.value);
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
$('#execution-execution_date').on('change',function(){
|
|
var executionexeField = document.getElementById('execution-execution_date').value;
|
|
var recordDateField = document.getElementById('execution-plan_date').value;
|
|
if(recordDateField!=executionexeField){
|
|
$('#execution-executed_as_per_plan').val('No');
|
|
$('#execution-revised_start_time').parent().show();
|
|
}
|
|
else{
|
|
$('#execution-executed_as_per_plan').val('Yes');
|
|
$('#execution-revised_start_time').parent().hide();
|
|
$('#execution-revised_start_time').prop({"required":false});
|
|
}
|
|
})
|
|
|
|
console.log("Execution Date is : ",executionDateField.value);
|
|
|
|
console.log("Plan date is : ",recordDateField.value);
|
|
|
|
|
|
|
|
|
|
executionDateField.addEventListener('change', function() {
|
|
console.log('gg');
|
|
var executionexeField = document.getElementById('execution-record_date');
|
|
executionexeField.setAttribute('min', executionDateField.value);
|
|
});
|
|
|
|
|
|
|
|
});
|
|
</script>
|
|
|
|
|
|
{{-- <script>
|
|
|
|
// Existing submissions
|
|
let submissions = @json($history->data->submissions);
|
|
|
|
function markMonthlyAddedDoctors() {
|
|
|
|
// Current month & year
|
|
let today = new Date();
|
|
|
|
let currentMonth = today.getMonth();
|
|
let currentYear = today.getFullYear();
|
|
|
|
// Store doctors already added this month
|
|
let addedDoctors = [];
|
|
|
|
submissions.forEach(function(submission){
|
|
|
|
let doctorName = submission.formdata?.contact_id ?? '';
|
|
let planDate = submission.formdata?.plan_date ?? '';
|
|
|
|
if (!doctorName || !planDate) return;
|
|
|
|
let existingDate = new Date(planDate);
|
|
|
|
let existingMonth = existingDate.getMonth();
|
|
let existingYear = existingDate.getFullYear();
|
|
|
|
// Same current month + year
|
|
if (
|
|
existingMonth === currentMonth &&
|
|
existingYear === currentYear
|
|
) {
|
|
addedDoctors.push(doctorName.trim());
|
|
}
|
|
|
|
});
|
|
|
|
// Update dropdown options
|
|
$('#field-contact_id option').each(function(){
|
|
|
|
let optionText = $(this).text().replace(' (Already added)', '').trim();
|
|
|
|
// Reset old text
|
|
$(this).text(optionText);
|
|
|
|
// Skip placeholder
|
|
if ($(this).val() === '') return;
|
|
|
|
// If doctor already added this month
|
|
if (addedDoctors.includes(optionText)) {
|
|
|
|
$(this).text(optionText + ' (Already added)');
|
|
$(this).attr('data-added', 'yes');
|
|
|
|
} else {
|
|
|
|
$(this).removeAttr('data-added');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// Run initially
|
|
markMonthlyAddedDoctors();
|
|
|
|
// Prevent selection
|
|
$('#field-contact_id').change(function () {
|
|
|
|
let selectedOption = $(this).find(':selected');
|
|
|
|
let alreadyAdded = selectedOption.attr('data-added');
|
|
|
|
if (alreadyAdded === 'yes') {
|
|
|
|
alert('Doctor already added in this month');
|
|
|
|
$(this).val('').trigger('change');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script> --}}
|
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
|
|
|
let submissions = @json($history->data->submissions);
|
|
|
|
function normalizeText(text) {
|
|
return text
|
|
.replace(/\s+/g, ' ')
|
|
.trim()
|
|
.toLowerCase();
|
|
}
|
|
|
|
if (!$('#field-plan_date').val()) {
|
|
|
|
let today = new Date();
|
|
|
|
let yyyy = today.getFullYear();
|
|
let mm = String(today.getMonth() + 1).padStart(2, '0');
|
|
let dd = String(today.getDate()).padStart(2, '0');
|
|
|
|
$('#field-plan_date').val(`${yyyy}-${mm}-${dd}`);
|
|
|
|
}
|
|
|
|
$('#field-plan_date').on('change', function () {
|
|
markMonthlyAddedDoctors();
|
|
let selectedOption = $('#field-contact_id').find(':selected');
|
|
|
|
// if now disabled => deselect
|
|
if (selectedOption.prop('disabled')) {
|
|
|
|
alert('Selected doctor already planned for this month');
|
|
|
|
$('#field-contact_id').val('').trigger('change');
|
|
|
|
$('#field-speciality').val('');
|
|
$('#field-msl_code').val('');
|
|
}
|
|
|
|
});
|
|
|
|
function markMonthlyAddedDoctors() {
|
|
|
|
/* let today = new Date();
|
|
|
|
let currentMonth = today.getMonth();
|
|
let currentYear = today.getFullYear(); */
|
|
|
|
let selectedDate = $('#field-plan_date').val();
|
|
|
|
if (!selectedDate) return;
|
|
|
|
let selected = new Date(selectedDate);
|
|
|
|
let currentMonth = selected.getMonth();
|
|
let currentYear = selected.getFullYear();
|
|
|
|
let addedDoctors = [];
|
|
|
|
submissions.forEach(function (submission) {
|
|
|
|
let doctorName = submission.formdata?.contact_id ?? '';
|
|
let planDate = submission.formdata?.plan_date ?? '';
|
|
|
|
if (!doctorName || !planDate) return;
|
|
|
|
let existingDate = new Date(planDate);
|
|
|
|
if (
|
|
existingDate.getMonth() === currentMonth &&
|
|
existingDate.getFullYear() === currentYear
|
|
) {
|
|
|
|
addedDoctors.push(
|
|
normalizeText(doctorName)
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
console.log("Added Doctors:", addedDoctors);
|
|
|
|
$('#field-contact_id option').each(function () {
|
|
|
|
// Original option text
|
|
let optionText = $(this).text();
|
|
|
|
// Remove old label if already exists
|
|
optionText = optionText
|
|
.replace('(Already Added)', '')
|
|
.trim();
|
|
|
|
// Reset first
|
|
$(this).text(optionText);
|
|
$(this).prop('disabled', false);
|
|
$(this).removeAttr('data-added');
|
|
|
|
// Skip empty option
|
|
if ($(this).val() === '') return;
|
|
|
|
let normalizedOption = normalizeText(optionText);
|
|
|
|
// Compare names
|
|
if (addedDoctors.includes(normalizedOption)) {
|
|
|
|
$(this).text(optionText + ' (Already Added)');
|
|
$(this).prop('disabled', true);
|
|
$(this).attr('data-added', 'yes');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// Run on page load
|
|
markMonthlyAddedDoctors();
|
|
|
|
// Extra protection
|
|
$('#field-contact_id').on('change', function () {
|
|
|
|
let selected = $(this).find(':selected');
|
|
|
|
if (selected.attr('data-added') === 'yes') {
|
|
|
|
alert('Doctor already planned for this month');
|
|
|
|
$(this).val('');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|