1009 lines
49 KiB
PHP
1009 lines
49 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">Core HCP Connect Drive</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,
|
|
);
|
|
@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>Date of Engagement</th>
|
|
<th>Execution Done</th>
|
|
|
|
<th>Doctor Name</th>
|
|
<th>Date of Execution</th>
|
|
<th>PCODE </th>
|
|
<th>Speciality</th>
|
|
<th>Month of Engagement</th>
|
|
<!-- <th>Core Value</th> -->
|
|
<th>Activity</th>
|
|
<th>Executed as per Plan</th>
|
|
<th>No. of Flutter Utilized</th>
|
|
<th>FG-GFB DPI Rxn</th>
|
|
<th>FG-GFB MDI Rxn</th>
|
|
<th>FG-GFB Synchrobreathe Rxn</th>
|
|
<th>FG-GFB Ciphaler Rxn</th>
|
|
<th>FG-GFB Total Rxn</th>
|
|
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (collect($history->data->submissions)->sortByDesc('formdata.record_date') as $sub)
|
|
@php
|
|
$sub->formdata->id = $sub->id;
|
|
|
|
@endphp
|
|
<tr>
|
|
<td>
|
|
@if(isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'yes')
|
|
|
|
Execution Done
|
|
|
|
@elseif(isset($sub->workflow_status) && $sub->workflow_status == 'approved')
|
|
|
|
<button type="button" class="btn btn-xs btn-info edit-btn"
|
|
plan_details="{{ json_encode($sub->formdata) }}">
|
|
<i class="mdi mdi-pencil"></i> Execute
|
|
</button>
|
|
|
|
@elseif(isset($sub->workflow_status) && $sub->workflow_status == 'rejected')
|
|
|
|
<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->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>{{ $sub->formdata->execution_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->month_of_engagement) ? $sub->formdata->month_of_engagement : '' }}
|
|
</td>
|
|
|
|
{{-- <td>{{ isset($sub->formdata->core_value) ? $sub->formdata->core_value : '' }}
|
|
</td> --}}
|
|
<td>{{ isset($sub->formdata->activity) ? $sub->formdata->activity : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->execution_as_per_plan) ? $sub->formdata->execution_as_per_plan : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->no_of_flutter_utilized) ? $sub->formdata->no_of_flutter_utilized : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->dpi) ? $sub->formdata->dpi : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->mdi) ? $sub->formdata->mdi : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->sync) ? $sub->formdata->sync : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->cip) ? $sub->formdata->cip : '' }}
|
|
</td>
|
|
<td>{{ isset($sub->formdata->total) ? $sub->formdata->total : '' }}
|
|
</td>
|
|
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="form-wrapper">
|
|
<div class="alert alert-info mb-3">
|
|
<strong>Please ensure to add Plan for all your Core Drs which will be executed during the period Oct 2026 - Dec 2026</strong>
|
|
</div>
|
|
|
|
<form method="POST" action="/form/submit" id="report-form"
|
|
enctype="multipart/form-data">
|
|
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
|
@csrf
|
|
|
|
<!-- Drive Count Fields -->
|
|
<input type="hidden" name="count_of_plans_lhc" id="count-plans-lhc" value="0">
|
|
<input type="hidden" name="count_of_plans_novel" id="count-plans-novel" value="0">
|
|
|
|
@if ($id)
|
|
<input type="hidden" name="id" value="{{ $id }}">
|
|
@endif
|
|
@foreach ($questions as $question)
|
|
@if (in_array($question->code, [
|
|
'execution_date',
|
|
'execution_as_per_plan',
|
|
'no_of_flutter_utilized',
|
|
'dpi',
|
|
'mdi',
|
|
'sync',
|
|
'cip',
|
|
'total',
|
|
'no_of_patients_screened',
|
|
]))
|
|
@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>
|
|
|
|
@foreach ($question->options as $option)
|
|
@if ($question->code == 'contact_id')
|
|
{{-- Only show doctors with connect drive enabled --}}
|
|
@if(($option->contact->type ?? null) == 'doctor' && ($option->contact->core_hcp_connect_drive_doctors ?? null) == 'Yes')
|
|
<option value="{{ $option->value }}"
|
|
msl_code="{{ $option->contact->msl_code ?? '' }}"
|
|
speciality="{{ $option->contact->speciality ?? '' }}"
|
|
core_value="{{ $option->contact->core_hcp_connect_drive_doctors_core_value ?? '' }}"
|
|
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $option->display }}
|
|
</option>
|
|
@endif
|
|
@else
|
|
{{-- Default options for other dropdowns --}}
|
|
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $option->display }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
</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_mode" id="execution-mode" value="no">
|
|
|
|
<!-- Drive Count Fields -->
|
|
|
|
<input type="hidden" name="count_of_execution_lhc" id="execution-count-execution-lhc" value="0">
|
|
<input type="hidden" name="count_of_execution_novel" id="execution-count-execution-novel" value="0">
|
|
|
|
|
|
|
|
{{-- <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')
|
|
<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 ($question->code == 'contact_id')
|
|
{{-- Only show doctors with connect drive enabled --}}
|
|
@if(($option->contact->type ?? null) == 'doctor' && ($option->contact->core_hcp_connect_drive_doctors ?? null) == 'Yes')
|
|
<option value="{{ $option->value }}"
|
|
msl_code="{{ $option->contact->msl_code ?? '' }}"
|
|
speciality="{{ $option->contact->speciality ?? '' }}"
|
|
core_value="{{ $option->contact->core_hcp_connect_drive_doctors_core_value ?? '' }}"
|
|
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $option->display }}
|
|
</option>
|
|
@endif
|
|
@else
|
|
{{-- Default options for other dropdowns --}}
|
|
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $option->display }}
|
|
</option>
|
|
@endif
|
|
@endforeach
|
|
</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="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">
|
|
@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> <!-- 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()
|
|
|
|
// Patients Screened should only appear in Execution view for LHC
|
|
$('#execution-no_of_patients_screened').closest('.col-md-12').hide();
|
|
$('#execution-no_of_patients_screened').prop('required', false);
|
|
|
|
|
|
|
|
|
|
// Activity change - Plan
|
|
$('#field-activity').on('change', function() {
|
|
let activity=$(this).val();
|
|
console.log("Activity selected in Plan:",activity);
|
|
|
|
if (activity === 'Oscar Screening Camps') {
|
|
$('#count-plans-lhc').val('1');
|
|
}
|
|
else if (activity === 'Novel') {
|
|
$('#count-plans-novel').val('1');
|
|
}
|
|
else{
|
|
|
|
$('#count-plans-lhc').val('0');
|
|
$('#count-plans-novel').val('0');
|
|
}
|
|
});
|
|
|
|
|
|
// Activity change - Execution
|
|
|
|
|
|
|
|
$('#add-camp-btn').click(function() {
|
|
$('#table-wrapper').hide(0)
|
|
$('#form-wrapper').show(100, () => {
|
|
$('#add-camp-btn').hide(0);
|
|
})
|
|
|
|
|
|
})
|
|
|
|
$('.edit-btn').click(function() {
|
|
$('#execution-mode').val('yes');
|
|
$('#execution-form-wrapper').show(100, () => {
|
|
$('#add-camp-btn').hide(0);
|
|
})
|
|
$('#execution-form').append('<input type="hidden" name="execution_done" value="yes" />');
|
|
$('#table-wrapper').hide()
|
|
let contacts = document.getElementById('execution-contact_id');
|
|
contacts.addEventListener('mousedown', function(e) {
|
|
e.preventDefault();
|
|
})
|
|
|
|
let months = document.getElementById('execution-month_of_engagement');
|
|
months.addEventListener('mousedown', function(e) {
|
|
e.preventDefault();
|
|
})
|
|
|
|
let activity = document.getElementById('execution-activity');
|
|
activity.addEventListener('mousedown', function(e) {
|
|
e.preventDefault();
|
|
})
|
|
|
|
$('#execution-speciality').prop('readonly', true)
|
|
$('#execution-plan_date').prop('readonly', true)
|
|
$('#execution-msl_code').prop('readonly', true);
|
|
$('#execution-total').prop('readonly',true);
|
|
|
|
$('#execution-core_value').parent().hide();
|
|
$('#execution-core_value').prop('required',false);
|
|
|
|
|
|
|
|
|
|
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)) {
|
|
//console.log("k",k);
|
|
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 if (k == 'upload_photo_1' || k == 'upload_photo_2') {
|
|
continue;
|
|
} 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'] || $(this).val().trim() == selected['cont_id']) return this;
|
|
}).attr('value')
|
|
|
|
$('#execution-contact_id').val(docid)
|
|
$('#execution-id').val(selected['id'])
|
|
|
|
// Set execution drive count
|
|
|
|
|
|
// Show Patients Screened only for LHC during Execution
|
|
|
|
|
|
|
|
|
|
|
|
$('#execution-dpi,#execution-mdi,#execution-sync,#execution-cip').on('input', function() {
|
|
var total=(
|
|
(parseInt($('#execution-dpi').val()) ||0)+
|
|
(parseInt($('#execution-mdi').val()) ||0)+
|
|
(parseInt($('#execution-sync').val()) ||0)+
|
|
(parseInt($('#execution-cip').val()) ||0)
|
|
|
|
);
|
|
|
|
|
|
$('#execution-total').val(total);
|
|
|
|
$('#execution-no_of_flutter_utilized').on('keyup', function () {
|
|
let val = parseFloat($(this).val());
|
|
|
|
|
|
if ($(this).val() === '') {
|
|
return;
|
|
}
|
|
|
|
|
|
if (val < 0 || isNaN(val)) {
|
|
$(this).val(0);
|
|
}
|
|
});
|
|
|
|
})
|
|
|
|
let activityName=$('#execution-activity').val();
|
|
console.log("Activity selected in Execution:",activityName);
|
|
if(activityName==='Oscar Screening Camps'){
|
|
$('#execution-count-execution-lhc').val('1');
|
|
$('#execution-count-execution-novel').val('0');
|
|
$('#execution-no_of_patients_screened').parent().show();
|
|
$('#execution-no_of_patients_screened').prop('required', true);
|
|
|
|
|
|
}
|
|
else if(activityName==='Novel'){
|
|
$('#execution-count-execution-lhc').val('0');
|
|
$('#execution-count-execution-novel').val('1');
|
|
$('#execution-no_of_patients_screened').parent().hide();
|
|
$('#execution-no_of_patients_screened').prop('required', false);
|
|
}
|
|
else{
|
|
$('#execution-count-execution-lhc').val('0');
|
|
$('#execution-count-execution-novel').val('0');
|
|
$('#execution-no_of_patients_screened').parent().hide();
|
|
$('#execution-no_of_patients_screened').prop('required', false);
|
|
}
|
|
|
|
$('#execution-dpi').prev('label').before('<h4>Prescription Generated</h4>');
|
|
})
|
|
|
|
$('.edit_plan-btn').click(function() {
|
|
$('#execution-form-wrapper').show(100, () => {
|
|
$('#add-camp-btn').hide(0);
|
|
})
|
|
$('#table-wrapper').hide()
|
|
// Restrict Edit Plan date selection to Oct 1, 2026 - Dec 31, 2026
|
|
$('#execution-plan_date').attr('min', '2026-10-01');
|
|
$('#execution-plan_date').attr('max', '2026-12-31');
|
|
|
|
// Edit Plan: Patients Screened is NOT applicable
|
|
$('#execution-no_of_patients_screened').closest('.col-md-12').hide();
|
|
$('#execution-no_of_patients_screened').prop('required', false);
|
|
|
|
|
|
|
|
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']);
|
|
|
|
|
|
$('#execution-execution_as_per_plan,#execution-execution_date,#execution-no_of_flutter_utilized,#execution-dpi,#execution-mdi,#execution-sync,#execution-cip,#execution-total,#execution-no_of_patients_screened').parent().hide();
|
|
$('#execution-execution_as_per_plan,#execution-execution_date,#execution-no_of_flutter_utilized,#execution-dpi,#execution-mdi,#execution-sync,#execution-cip,#execution-total,#execution-no_of_patients_screened').prop('required',false);
|
|
|
|
|
|
|
|
for (let k of Object.keys(selected)) {
|
|
//console.log("k",k);
|
|
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 if (k == 'upload_photo_1' || k == 'upload_photo_2') {
|
|
continue;
|
|
} 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'] || $(this).val().trim() == selected['cont_id']) return this;
|
|
}).attr('value')
|
|
|
|
$('#execution-contact_id').val(docid)
|
|
$('#execution-id').val(selected['id'])
|
|
|
|
|
|
$('#execution-dpi,#execution-mdi,#execution-sync,#execution-cip').on('input', function() {
|
|
var total=(
|
|
(parseInt($('#execution-dpi').val()) ||0)+
|
|
(parseInt($('#execution-mdi').val()) ||0)+
|
|
(parseInt($('#execution-sync').val()) ||0)+
|
|
(parseInt($('#execution-cip').val()) ||0)
|
|
|
|
);
|
|
|
|
|
|
$('#execution-total').val(total);
|
|
|
|
|
|
|
|
})
|
|
|
|
$('#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('msl_code'))
|
|
})
|
|
|
|
|
|
$('#execution-contact_id').change(function() {
|
|
$('#execution-core_value').val($('option:selected', this).attr('core_value'))
|
|
})
|
|
|
|
$('#execution-msl_code').prop('readonly', true);
|
|
$('#execution-speciality').prop('readonly', true);
|
|
$('#execution-core_value').parent().hide();
|
|
$('#execution-core_value').prop('required',false);
|
|
|
|
|
|
|
|
$('#execution-no_of_patients_screened').on('input', function () {
|
|
|
|
let value = $(this).val();
|
|
|
|
// Remove everything except digits
|
|
value = value.replace(/[^0-9]/g, '');
|
|
|
|
$(this).val(value);
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#execution-plan_date').on('change', function () {
|
|
const monthNames = [
|
|
"Oct-26", // Index 0
|
|
"Nov-26", // Index 1
|
|
"Dec-26" // Index 2
|
|
];
|
|
|
|
const selectedDateVal = $(this).val(); // e.g. "2026-10-15"
|
|
|
|
if (selectedDateVal) {
|
|
const parts = selectedDateVal.split('-');
|
|
const monthNumber = parseInt(parts[1], 10); // 10, 11, किंवा 12
|
|
|
|
|
|
const targetMonth = monthNames[monthNumber - 10] || '';
|
|
|
|
// Dropdown madhe targetMonth select karne
|
|
$('#execution-month_of_engagement').val(targetMonth).trigger('change');
|
|
} else {
|
|
// Jar user ne date clear keli tar dropdown reset karne
|
|
$('#execution-month_of_engagement').val('').trigger('change');
|
|
}
|
|
});
|
|
|
|
|
|
$('#execution-activity').on('change', function() {
|
|
let activity=$(this).val();
|
|
console.log("Activity selected in Plan:",activity);
|
|
|
|
if (activity === 'Oscar Screening Camps') {
|
|
|
|
$('#execution-form').append('<input type="hidden" name="count_of_plans_lhc" value="1" />');
|
|
|
|
}
|
|
else if (activity === 'Novel') {
|
|
$('#execution-form').append('<input type="hidden" name="count_of_plans_novel" value="1" />');
|
|
}
|
|
else{
|
|
|
|
$('#execution-form').append('<input type="hidden" name="count_of_plans_lhc" value="0" />');
|
|
$('#execution-form').append('<input type="hidden" name="count_of_plans_novel" value="0" />');
|
|
}
|
|
});
|
|
|
|
})
|
|
|
|
$('#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();
|
|
|
|
} else {
|
|
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Data not submitted',
|
|
text: 'Something went wrong, please try again after some time!'
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
$('#field-core_value').parent().hide();
|
|
$('#field-core_value').prop('required',false);
|
|
|
|
|
|
|
|
|
|
|
|
$('#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-contact_id').change(function() {
|
|
$('#field-core_value').val($('option:selected', this).attr('core_value'))
|
|
})
|
|
|
|
|
|
|
|
$('#field-msl_code').prop('readonly', true);
|
|
$('#field-speciality').prop('readonly', true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () {
|
|
const monthNames = [
|
|
"Oct-26", // index 0
|
|
"Nov-26", // index 1
|
|
"Dec-26" // index 2
|
|
];
|
|
|
|
$('#field-plan_date').on('change', function () {
|
|
const selectedDateVal = $(this).val(); // e.g. "2026-10-15"
|
|
|
|
if (selectedDateVal) {
|
|
const parts = selectedDateVal.split('-');
|
|
const monthNumber = parseInt(parts[1], 10); // 10, 11, किंवा 12
|
|
|
|
// 10 वजा करून 0, 1, 2 इंडेक्स मिळवणे
|
|
const targetMonth = monthNames[monthNumber - 10] || '';
|
|
|
|
// dropdown madhe targetMonth pass karne
|
|
$('#field-month_of_engagement').val(targetMonth).trigger('change');
|
|
} else {
|
|
$('#field-month_of_engagement').val('').trigger('change');
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
let months = document.getElementById('field-month_of_engagement');
|
|
months.addEventListener('mousedown', function(e) {
|
|
e.preventDefault();
|
|
})
|
|
|
|
|
|
$(document).ready(function () {
|
|
$('#field-contact_id').trigger('change');
|
|
});
|
|
|
|
$('#execution-form').on('submit', function(event) {
|
|
|
|
const activity = ($('#execution-activity').val() || '')
|
|
.trim()
|
|
.toUpperCase();
|
|
|
|
const executionMode = $('#execution-mode').val();
|
|
|
|
/*
|
|
* Reset all counters first
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
* Only set Execution counters when
|
|
* this is actual Execution, NOT Edit Plan.
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
* Patients Screened validation
|
|
*/
|
|
if (activity === 'Oscar Screening Camps') {
|
|
|
|
const patientsScreened =
|
|
$('#execution-no_of_patients_screened').val();
|
|
|
|
if (
|
|
patientsScreened === '' ||
|
|
!/^\d+$/.test(patientsScreened)
|
|
) {
|
|
|
|
event.preventDefault();
|
|
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Invalid No. of Patients Screened',
|
|
text: 'Please enter a valid whole number. Negative numbers and decimal values are not allowed.'
|
|
});
|
|
|
|
$('#execution-no_of_patients_screened').focus();
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
$("#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'
|
|
}).then(() => {
|
|
location.reload();
|
|
});
|
|
|
|
} else {
|
|
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Data not submitted',
|
|
text: 'Something went wrong, please try again after some time!'
|
|
});
|
|
}
|
|
},
|
|
|
|
error: function() {
|
|
|
|
$("#pageloader").fadeOut();
|
|
|
|
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', "2026-10-01");
|
|
recordDateField.setAttribute('max', "2026-12-31");
|
|
|
|
|
|
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', "2026-10-01");
|
|
executionexeField.setAttribute('max', "2026-12-31");
|
|
|
|
});
|
|
|
|
|
|
|
|
executionDateField.addEventListener('change', function() {
|
|
console.log('gg');
|
|
var executionexeField = document.getElementById('execution-record_date');
|
|
executionexeField.setAttribute('min', executionDateField.value);
|
|
});
|
|
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|