738 lines
41 KiB
PHP
738 lines
41 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" />
|
|
<link href="{{ asset('assets/libs/flatpickr/flatpickr.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">{{ $form->title }}</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>Execution Status</th>
|
|
<th>Plan Date</th>
|
|
<th>Executed Date</th>
|
|
<th>Doctor Name</th>
|
|
<th>Specialty</th>
|
|
<th>MSL Code</th>
|
|
<th>Glycohale FB DPI Rx (no)</th>
|
|
<th>Glycohale FB MDI Rx (no)</th>
|
|
<th>Glycohale F Rx (no)</th>
|
|
<th>Glycohale FB Synchrobreathe Rx (no)</th>
|
|
<th>ZVT Rx ( no)</th>
|
|
<th>HQ</th>
|
|
<th>State</th>
|
|
<th>Executed as per planned</th>
|
|
<th>Number of Flutter Device Used</th>
|
|
<th>Number of ZVT Device Used</th>
|
|
<th>Number of Patients Screened</th>
|
|
<!-- <th>Upload Glycohale FB DPI Rx</th>
|
|
<th>Upload Glycohale FB MDI Rx</th>
|
|
<th>Upload Glycohale F Rx</th> -->
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($history->data->submissions as $sub)
|
|
@php
|
|
$sub->formdata->id = $sub->id;
|
|
@endphp
|
|
<tr>
|
|
<td>
|
|
<button type="button" class="btn btn-xs btn-info edit-btn" plan_details="{{ json_encode($sub->formdata) }}" contacts="{{ json_encode($sub->contacts) }}"><i class="mdi mdi-pencil"></i> Edit</button>
|
|
</td>
|
|
<td>{{ isset($sub->formdata->execution_date) && $sub->formdata->execution_date != '' ? 'Yes' : 'No' }}
|
|
</td>
|
|
<td>{{ $sub->formdata->plan_date }}
|
|
</td>
|
|
<td>{{ $sub->formdata->execution_date }}
|
|
</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->speciality }}
|
|
<td>{{ $sub->formdata->msl_code }}
|
|
<td>{{ isset($sub->formdata->gfb_glycohale_fb_rx) ? $sub->formdata->gfb_glycohale_fb_rx : '' }}
|
|
<td>{{ isset($sub->formdata->gfb_glycohale_fb_mdi_rx) ? $sub->formdata->gfb_glycohale_fb_mdi_rx : '' }}
|
|
<td>{{ isset($sub->formdata->gfb_glycohale_f_rx) ? $sub->formdata->gfb_glycohale_f_rx : '' }}
|
|
<td>{{ isset($sub->formdata->glycohale_fb_synchrobreathe_rx_no) ? $sub->formdata->glycohale_fb_synchrobreathe_rx_no : '' }}
|
|
<td>{{ isset($sub->formdata->zvt_rx_no) ? $sub->formdata->zvt_rx_no : '' }}
|
|
<td>{{ isset($sub->formdata->hq) ? $sub->formdata->hq : '' }} </td>
|
|
<td>{{ isset($sub->formdata->state) ? $sub->formdata->state : '' }}</td>
|
|
<td>{{ isset($sub->formdata->execution_as_per_planned) ? $sub->formdata->execution_as_per_planned : '' }}</td>
|
|
<td>{{ isset($sub->formdata->number_of_flutter_device_used) ? $sub->formdata->number_of_flutter_device_used : '' }}</td>
|
|
<td>{{ isset($sub->formdata->number_of_zvt_device_used) ? $sub->formdata->number_of_zvt_device_used : '' }}</td>
|
|
<td>{{ isset($sub->formdata->number_patients_screened) ? $sub->formdata->number_patients_screened : '' }}</td>
|
|
<!-- <td>{{ isset($sub->formdata->upload_rx) ? $sub->formdata->upload_rx : '' }}</td>
|
|
<td>{{ isset($sub->formdata->upload_glycohale_fb_mdi_rx) ? $sub->formdata->upload_glycohale_fb_mdi_rx : '' }}</td>
|
|
<td>{{ isset($sub->formdata->upload_glycohale_f_rx) ? $sub->formdata->upload_glycohale_f_rx : '' }}</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 }}">
|
|
<input type="hidden" name="other_doctor_name" value="">
|
|
@csrf
|
|
@if ($id)
|
|
<input type="hidden" name="id" value="{{ $id }}">
|
|
@endif
|
|
@foreach ($questions as $question)
|
|
@if (in_array($question->code, [
|
|
'execution_date',
|
|
'gfb_glycohale_fb_rx',
|
|
'gfb_glycohale_fb_mdi_rx',
|
|
'gfb_glycohale_f_rx',
|
|
'glycohale_fb_synchrobreathe_rx_no',
|
|
'zvt_rx_no',
|
|
'hq',
|
|
'state',
|
|
'execution_as_per_planned',
|
|
'number_of_flutter_device_used',
|
|
'number_of_zvt_device_used',
|
|
'number_patients_screened',
|
|
'upload_rx',
|
|
'upload_glycohale_fb_mdi_rx',
|
|
'upload_glycohale_f_rx',
|
|
|
|
]))
|
|
@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')
|
|
<input type="{{ $question->type }}" id="field-{{ $question->code }}" name="{{ $question->code }}" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} {{ $question->code == 'camp_date' ? 'min="' . date('Y-m-d', strtotime('now') + 604800) . '"' : '' }} value="{{ isset($question->value) ? $question->value : '' }}">
|
|
@break
|
|
|
|
@case('date')
|
|
<input type="{{ $question->type }}" id="field-{{ $question->code }}" name="{{ $question->code }}" class="form-control datepicker" {{ $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')
|
|
@php
|
|
$doctors = $question->options;
|
|
@endphp
|
|
@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">
|
|
@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)
|
|
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {!! $question->code == 'contact_id'
|
|
? 'comp_rxber="' . (isset($option->contact->comp_rxber) ? $option->contact->comp_rxber : '') . '"'
|
|
: '' !!}>{{ $option->display }}</option>
|
|
@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" {{ $question->required == 'yes' ? '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> <!-- 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 src="{{ asset('assets/libs/flatpickr/flatpickr.min.js') }}"></script>
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function($) {
|
|
$('#form-wrapper').hide()
|
|
$('#execution-form-wrapper').hide()
|
|
$('#field-doctor_name').hide();
|
|
$('label[for="field-doctor_name"]').hide();
|
|
|
|
|
|
$('#add-camp-btn').click(function() {
|
|
$('#execution-form-wrapper').hide()
|
|
$('#form-wrapper').show()
|
|
$('#table-wrapper').hide()
|
|
})
|
|
|
|
$('#report-form').append('<input type="hidden" name="gfb_dpi_clinic_planned" id="gfb_dpi_clinic_planned" value="0">');
|
|
$('#report-form').append('<input type="hidden" name="gfb_mdi_clinic_planned" id="gfb_mdi_clinic_planned" value="0">');
|
|
$('#execution-form-wrapper').append('<input type="hidden" name="gfb_dpi_clinic_executed" id="gfb_dpi_clinic_executed" value="0">');
|
|
$('#execution-form-wrapper').append('<input type="hidden" name="gfb_mdi_clinic_executed" id="gfb_mdi_clinic_executed" value="0">');
|
|
|
|
let c3_doctors = []
|
|
let all_doctors = []
|
|
let contacts = []
|
|
let gfb_mdi_doctor = []
|
|
let gfb_synchrobreathe_doctor=[]
|
|
let doctors = {!! json_encode($doctors) !!}
|
|
|
|
// $('#field-contact_id option').each(function() {
|
|
// if ($(this).val() != '') {
|
|
// // console.log($(this).attr('contact'))
|
|
// contacts.push(JSON.parse($(this).attr('contact')))
|
|
// all_doctors.push({
|
|
// value: $(this).val(),
|
|
// text: $(this).html()
|
|
// })
|
|
// if ($(this).attr('comp_rxber') == 'Yes') {
|
|
// c3_doctors.push({
|
|
// value: $(this).val(),
|
|
// text: $(this).html()
|
|
// })
|
|
// }
|
|
// if ($(this).attr('gfb_mdi') == 'Yes') {
|
|
// gfb_mdi_doctor.push({
|
|
// value: $(this).val(),
|
|
// text: $(this).html()
|
|
// })
|
|
// }
|
|
// if ($(this).attr('gfb_synchrobreathe_doctors') == 'Yes') {
|
|
// gfb_synchrobreathe_doctor.push({
|
|
// value: $(this).val(),
|
|
// text: $(this).html()
|
|
// })
|
|
// }
|
|
// }
|
|
// })
|
|
|
|
|
|
|
|
|
|
$('#field-activity').change(function() {
|
|
$('#field-contact_id').html('')
|
|
$('#field-contact_id').append('<option value=""> -- Select -- </option>')
|
|
if ($(this).val() == 'GFB MDI clinic') {
|
|
let selected = doctors.filter(d => d.contact.hasOwnProperty('gfb_mdi') && d.contact.gfb_mdi && d.contact.gfb_mdi.toLowerCase() == 'yes')
|
|
for (let doc of selected) {
|
|
$('#field-contact_id').append('<option value="' + doc.value + '" msl_code="'+doc.contact.msl_code+'" speciality="'+doc.contact.speciality+'">' + doc.display + '</option>')
|
|
}
|
|
} else if ($(this).val() == 'GFB DPI Clinic' || $(this).val() == 'DRT') {
|
|
let selected = doctors.filter(d => d.contact.hasOwnProperty('gfb_dpi') && d.contact.gfb_dpi && d.contact.gfb_dpi.toLowerCase() == 'yes')
|
|
for (let doc of selected) {
|
|
$('#field-contact_id').append('<option value="' + doc.value + '" msl_code="'+doc.contact.msl_code+'" speciality="'+doc.contact.speciality+'">' + doc.display + '</option>')
|
|
}
|
|
}
|
|
$('#field-contact_id').unbind()
|
|
$('#field-contact_id').change(function() {
|
|
let contact = doctors.find(c => c.value == $(this).val())
|
|
$('#field-speciality').val(contact.contact.speciality)
|
|
$('#field-msl_code').val(contact.contact.msl_code)
|
|
})
|
|
})
|
|
|
|
function resetValue(){
|
|
$('#gfb_dpi_clinic_planned').val(0);
|
|
$('#gfb_mdi_clinic_planned').val(0);
|
|
$('#gfb_synchrobreathe_clinic_planned').val(0);
|
|
}
|
|
|
|
$('#field-activity').change(function() {
|
|
console.log("changed",$(this).val());
|
|
|
|
if ($(this).val() == 'GFB DPI Clinic' ) {
|
|
resetValue();
|
|
$('#gfb_dpi_clinic_planned').val(1);
|
|
}
|
|
else if ($(this).val() == 'GFB MDI clinic') {
|
|
resetValue();
|
|
$('#gfb_mdi_clinic_planned').val(1);
|
|
}
|
|
else if ($(this).val() == 'GFB Synchrobreathe Clinic') {
|
|
resetValue();
|
|
$('#gfb_synchrobreathe_clinic_planned').val(1);
|
|
}
|
|
|
|
})
|
|
|
|
$('#field-speciality').prop('readonly', true)
|
|
$('#field-msl_code').prop('readonly', true)
|
|
|
|
|
|
|
|
|
|
$('.edit-btn').click(function() {
|
|
let selected = JSON.parse($(this).attr('plan_details'))
|
|
let contacts = JSON.parse($(this).attr('contacts'))
|
|
let editable = true
|
|
|
|
if (selected.activity == 'GFB MDI clinic') {
|
|
let selected = doctors.filter(d => d.contact.hasOwnProperty('gfb_mdi') && d.contact.gfb_mdi && d.contact.gfb_mdi.toLowerCase() == 'yes')
|
|
for (let doc of selected) {
|
|
$('#field-contact_id').append('<option value="' + doc.value + '" msl_code="'+doc.contact.msl_code+'" speciality="'+doc.contact.speciality+'">' + doc.text + '</option>')
|
|
}
|
|
} else if (selected.activity == 'GFB DPI Clinic' || $(this).val() == 'DRT') {
|
|
let selected = doctors.filter(d => d.contact.hasOwnProperty('gfb_dpi') && d.contact.gfb_dpi && d.contact.gfb_dpi.toLowerCase() == 'yes')
|
|
for (let doc of selected) {
|
|
$('#field-contact_id').append('<option value="' + doc.value + '" msl_code="'+doc.contact.msl_code+'" speciality="'+doc.contact.speciality+'">' + doc.text + '</option>')
|
|
}
|
|
}
|
|
|
|
|
|
//console.log(selected)
|
|
//console.log(contacts)
|
|
for (let k of Object.keys(selected)) {
|
|
if (selected[k] != '') {
|
|
if (k == 'attach_prescription')
|
|
continue;
|
|
if (k == 'contact_id') {
|
|
$('#execution-contact_id').append('<option value="' + contacts[0].id +
|
|
'" selected>' + contacts[0].name + '</option>');
|
|
console.log(contacts)
|
|
if (contacts.length > 0) {
|
|
$('#execution-contact_id')
|
|
.val(contacts[0].id)
|
|
.trigger('change');
|
|
editable = false
|
|
} else {
|
|
$('#execution-contact_id')
|
|
.val($("#execution-contact_id option:contains(" + selected[k] + ")")
|
|
.attr('value'))
|
|
.trigger('change');
|
|
}
|
|
} else
|
|
$('#execution-' + k).val(selected[k]);
|
|
}
|
|
}
|
|
if (!editable) {
|
|
$('#execution-contact_id').prop('disabled', true)
|
|
}
|
|
$('#execution-id').val(selected['id'])
|
|
$('#execution-form-wrapper').show()
|
|
$('#table-wrapper').hide()
|
|
|
|
function resetValue(){
|
|
$('#gfb_dpi_clinic_executed').val(0);
|
|
$('#gfb_mdi_clinic_executed').val(0);
|
|
|
|
|
|
}
|
|
|
|
let execution_activity=$('#execution-activity').val();
|
|
console.log("fetched value ",execution_activity);
|
|
if (execution_activity == 'GFB DPI Clinic' ) {
|
|
resetValue();
|
|
$('#gfb_dpi_clinic_executed').val(1);
|
|
}
|
|
else if (execution_activity == 'GFB MDI clinic') {
|
|
resetValue();
|
|
$('#gfb_mdi_clinic_executed').val(1);
|
|
}
|
|
|
|
$('#execution-activity').change(function() {
|
|
console.log("changed",$(this).val());
|
|
|
|
if ($(this).val() == 'GFB DPI Clinic' ) {
|
|
resetValue();
|
|
$('#gfb_dpi_clinic_executed').val(1);
|
|
}
|
|
else if ($(this).val() == 'GFB MDI clinic') {
|
|
resetValue();
|
|
$('#gfb_mdi_clinic_executed').val(1);
|
|
}
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
$('#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-form').on('submit', function(event) {
|
|
event.preventDefault();
|
|
$('#execution-contact_id').prop('disabled', false)
|
|
|
|
//$('#execution-form').append('contact_id', $('#execution-contact_id').val());
|
|
$('#execution-form').append('<input type="hidden" name="contact_id" value="' + $(
|
|
'#execution-contact_id').val() + '">')
|
|
$('#execution-form').append('<input type="hidden" name="' + $(
|
|
'#execution-rx_generated_for_product').val() + '" value="' + $(
|
|
'#execution-no_of_rx_generated').val() + '">')
|
|
|
|
if ($('#execution-activity').val() == 'DRT (Duolin)') {
|
|
$('#execution-form').append('<input type="hidden" name="drt_camp_count" value="1">')
|
|
$('#execution-form input[type=number]').each(function() {
|
|
$('#execution-form').append('<input type="hidden" name="drt_' + $(this)
|
|
.attr("name") + '" value="' + $(this).val() + '">')
|
|
})
|
|
} else if ($('#execution-activity').val() == 'GFB Clinic (Glycohale FB)') {
|
|
$('#execution-form').append('<input type="hidden" name="gfb_clinics_count" value="1">')
|
|
$('#execution-form input[type=number]').each(function() {
|
|
$('#execution-form').append('<input type="hidden" name="gfb_' + $(this)
|
|
.attr("name") + '" value="' + $(this).val() + '">')
|
|
})
|
|
} else if ($('#execution-activity').val() == 'Maxiflo Monday') {
|
|
$('#execution-form').append(
|
|
'<input type="hidden" name="maxiflo_monday_count" value="1">')
|
|
$('#execution-form input[type=number]').each(function() {
|
|
$('#execution-form').append('<input type="hidden" name="mm_' + $(this).attr(
|
|
"name") + '" value="' + $(this).val() + '">')
|
|
})
|
|
}
|
|
|
|
|
|
|
|
|
|
$("#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');
|
|
|
|
$('.edit-btn').click(function() {
|
|
var executionexeField = document.getElementById('execution-execution_date');
|
|
// executionexeField.setAttribute('min', executionDateField.value);
|
|
executionexeField.setAttribute('max', today);
|
|
|
|
|
|
|
|
|
|
var doctorNameValue = $('#execution-doctor_name').val();
|
|
if (doctorNameValue !== '') {
|
|
$('#execution-doctor_name').show();
|
|
$('label[for="execution-doctor_name"]').show();
|
|
|
|
$('#execution-contact_id').hide();
|
|
$('label[for="execution-contact_id"]').hide();
|
|
|
|
} else {
|
|
$('#execution-doctor_name').hide();
|
|
$('label[for="execution-doctor_name"]').hide();
|
|
|
|
$('#execution-contact_id').show();
|
|
$('label[for="execution-contact_id"]').show();
|
|
}
|
|
|
|
var activityName=$("#execution-activity").val();
|
|
console.log("activity :",activityName);
|
|
var zvt=$('#execution-zvt_rx_no');
|
|
var flutter=$('#execution-number_of_flutter_device_used');
|
|
var zvtDevice=$('#execution-number_of_zvt_device_used');
|
|
if(activityName==='GFB DPI Clinic' ||'GFB Synchrobreathe Clinic'){
|
|
console.log("Inside if : ",activityName);
|
|
$(zvt).parent().hide();
|
|
$(zvt).prop({
|
|
"required":"false"
|
|
});
|
|
$(zvtDevice).parent().hide();
|
|
$(zvtDevice).prop({
|
|
"required":"false"
|
|
});
|
|
}
|
|
if(activityName==='GFB MDI clinic'){
|
|
console.log("Inside else : ",activityName);
|
|
|
|
$(zvt).parent().show();
|
|
$(zvt).prop({
|
|
"required":"true"
|
|
});
|
|
$(zvtDevice).parent().show();
|
|
$(zvtDevice).prop({
|
|
"required":"true"
|
|
});
|
|
}
|
|
|
|
$('#execution-activity').on('change',function(e){
|
|
var activityName=$("#execution-activity").val();
|
|
console.log("activity :",activityName);
|
|
var zvt=$('#execution-zvt_rx_no');
|
|
var flutter=$('#execution-number_of_flutter_device_used');
|
|
var zvtDevice=$('#execution-number_of_zvt_device_used');
|
|
if(activityName==='GFB DPI Clinic' ||'GFB Synchrobreathe Clinic'){
|
|
console.log("Inside if : ",activityName);
|
|
$(zvt).parent().hide();
|
|
$(zvt).prop({
|
|
"required":"false"
|
|
});
|
|
$(zvtDevice).parent().hide();
|
|
$(zvtDevice).prop({
|
|
"required":"false"
|
|
});
|
|
$(flutter).parent().show();
|
|
$(flutter).prop({
|
|
"required":"true"
|
|
});
|
|
}
|
|
if(activityName==='GFB MDI clinic'){
|
|
console.log("Inside else : ",activityName);
|
|
|
|
$(zvt).parent().show();
|
|
$(zvt).prop({
|
|
"required":"true"
|
|
});
|
|
$(zvtDevice).parent().show();
|
|
$(zvtDevice).prop({
|
|
"required":"true"
|
|
});
|
|
$(flutter).parent().hide();
|
|
$(flutter).prop({
|
|
"required":"false"
|
|
});
|
|
}
|
|
})
|
|
|
|
|
|
});
|
|
|
|
executionDateField.addEventListener('change', function() {
|
|
// console.log('gg');
|
|
var executionexeField = document.getElementById('execution-execution_date');
|
|
// executionexeField.setAttribute('min', executionDateField.value);
|
|
executionexeField.setAttribute('max', today);
|
|
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |