854 lines
47 KiB
PHP
854 lines
47 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">Activations</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 Done</th>
|
|
<th>Plan Date</th>
|
|
<th>Activity Type</th>
|
|
<th>Speaker Name</th>
|
|
<th>Doctor</th>
|
|
<th>Speciality</th>
|
|
<th>Execution Date</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) }}"><i class="mdi mdi-pencil"></i> Edit</button>
|
|
</td>
|
|
<td>{{ isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'yes' ? 'Yes' : 'No' }}
|
|
</td>
|
|
<td>{{ $sub->formdata->plan_date }}</td>
|
|
<td>{{ $sub->formdata->activation_type }}</td>
|
|
<td>{{ $sub->formdata->speaker_name }}</td>
|
|
<td>
|
|
<h5 class="m-0 fw-normal">{{ isset($sub->formdata->contact_id) }}</h5>
|
|
</td>
|
|
<td>{{ $sub->formdata->speciality }}</td>
|
|
|
|
<td>{{ $sub->formdata->execution_date }}</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, [
|
|
'contact_id',
|
|
'speciality',
|
|
'no_of_doctors',
|
|
'speaker_name',
|
|
'doctor_potential',
|
|
'remark',
|
|
'record_date',
|
|
'no_of_patients',
|
|
'business_generated',
|
|
'brand_rx',
|
|
'no_of_patients_screened',
|
|
'no_of_patients_counselled',
|
|
'no_of_patients_enrolled_for_virtual_educator',
|
|
'pulmosmart_200_inh',
|
|
'pulmosmart_400_inh',
|
|
'pulmosmart_200_pulmicaps',
|
|
'pulmosmart_400_pulmicaps',
|
|
'viloresp_pulmicaps',
|
|
'innohaler_device',
|
|
'pulmosmart_05_mg',
|
|
'pulmosmart_1_mg',
|
|
'glycoquic',
|
|
'budasure',
|
|
'iprasure',
|
|
'clearneb',
|
|
'other_product_business',
|
|
'overall_clinic_business',
|
|
'execution_date',
|
|
'no_of_paramedics_enrolled',
|
|
'expected_business',
|
|
'quicnac',
|
|
'quicnac_ab',
|
|
'pulmosmart_g',
|
|
'glycoquic_f_cap',
|
|
'iprasure_ls',
|
|
'fibnib_100',
|
|
'fibnib_150',
|
|
'viloresp_200',
|
|
'budasure_l_05',
|
|
'glycoquic_pulmules_25mcg_2ml',
|
|
'iprasure_pulmules_25_ml',
|
|
'zadonase_tablets_10s',
|
|
'innospacer',
|
|
'viloresp_u_pulmicaps_30s'
|
|
]))
|
|
@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)
|
|
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
|
{{ $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="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)
|
|
@if (in_array($question->code, [
|
|
'remark',
|
|
'record_date',
|
|
'no_of_patients',
|
|
'brand_rx',
|
|
'pulmosmart_200_inh',
|
|
'pulmosmart_400_inh',
|
|
'pulmosmart_200_pulmicaps',
|
|
'pulmosmart_400_pulmicaps',
|
|
'viloresp_pulmicaps',
|
|
'innohaler_device',
|
|
'pulmosmart_05_mg',
|
|
'pulmosmart_1_mg',
|
|
'glycoquic',
|
|
'budasure',
|
|
'iprasure',
|
|
'clearneb',
|
|
'overall_clinic_business',
|
|
'other_product_business',
|
|
'quicnac',
|
|
'quicnac_ab',
|
|
'pulmosmart_g',
|
|
'glycoquic_f_cap',
|
|
'iprasure_ls',
|
|
'fibnib_100',
|
|
'fibnib_150',
|
|
'viloresp_200',
|
|
'budasure_l_05',
|
|
'glycoquic_pulmules_25mcg_2ml',
|
|
'iprasure_pulmules_25_ml',
|
|
'zadonase_tablets_10s',
|
|
'innospacer',
|
|
'viloresp_u_pulmicaps_30s'
|
|
]))
|
|
@continue
|
|
@endif
|
|
<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' : '' }}>
|
|
{{ $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">
|
|
@break
|
|
@endswitch
|
|
</div>
|
|
@endforeach
|
|
|
|
{{-- @foreach ($questions as $question)
|
|
@if (in_array($question->code, ['pulmosmart_200_inh']))
|
|
<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
|
|
@endswitch
|
|
</div>
|
|
@else
|
|
@continue
|
|
@endif
|
|
|
|
@endforeach --}}
|
|
<hr>
|
|
<div class="table-responsive" style="background-color: gainsboro; margin-bottom:14px" id="camp_clinic_brand_rx">
|
|
<h5>Brand Rx</h5>
|
|
<table class="table table-border table-responsive">
|
|
<thead>
|
|
<th>
|
|
Brand Rx
|
|
</th>
|
|
<th>Quantity </th>
|
|
<th>Value </th>
|
|
</thead>
|
|
|
|
@foreach ($questions as $question)
|
|
@if (in_array($question->code, [
|
|
'pulmosmart_200_inh',
|
|
'pulmosmart_400_inh',
|
|
'pulmosmart_200_pulmicaps',
|
|
'pulmosmart_400_pulmicaps',
|
|
'viloresp_pulmicaps',
|
|
'innohaler_device',
|
|
'pulmosmart_05_mg',
|
|
'pulmosmart_1_mg',
|
|
'glycoquic',
|
|
'budasure',
|
|
'iprasure',
|
|
'clearneb',
|
|
'quicnac',
|
|
'quicnac_ab',
|
|
'pulmosmart_g',
|
|
'glycoquic_f_cap',
|
|
'iprasure_ls',
|
|
'fibnib_100',
|
|
'fibnib_150',
|
|
'viloresp_200',
|
|
'budasure_l_05',
|
|
'glycoquic_pulmules_25mcg_2ml',
|
|
'iprasure_pulmules_25_ml',
|
|
'zadonase_tablets_10s',
|
|
'innospacer',
|
|
'viloresp_u_pulmicaps_30s'
|
|
]))
|
|
<tbody>
|
|
<tr>
|
|
<td>{{ $question->question }}</td>
|
|
<td>
|
|
<input type="{{ $question->type }}" id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} value="{{ isset($question->value) ? $question->value : 0 }}">
|
|
</td>
|
|
<td>
|
|
<input type="text" min="0" max="9999999999" step="1" id="execution-{{ $question->code }}_total_value" name="{{ $question->code }}_total_value" class="form-control" {{ $question->required == 'yes' ? 'required' : '' }} value="{{ isset($question->value) ? $question->value : 0 }}">
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
@else
|
|
@continue
|
|
@endif
|
|
@endforeach
|
|
|
|
</table>
|
|
</div>
|
|
|
|
|
|
@foreach ($questions as $question)
|
|
@if (in_array($question->code, ['other_product_business', 'overall_clinic_business']))
|
|
<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' : '' }}>
|
|
{{ $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">
|
|
@break
|
|
@endswitch
|
|
</div>
|
|
@else
|
|
@continue
|
|
@endif
|
|
@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">
|
|
let camp_clinic = ['execution-no_of_patients_counselled', 'execution-no_of_patients_screened',
|
|
'execution-no_of_patients_enrolled_for_virtual_educator', 'execution-business_generated',
|
|
'execution-other_product_business',
|
|
'execution-overall_clinic_business', 'camp_clinic_brand_rx', 'field-contact_id',
|
|
'execution-contact_id', 'execution-speciality',
|
|
'field-speciality', 'execution-contact_id'
|
|
];
|
|
|
|
let peak = ['execution-no_of_paramedics_enrolled', 'field-contact_id', 'field-speciality',
|
|
'execution-contact_id', 'execution-speciality', 'execution-contact_id', 'execution-speciality'
|
|
];
|
|
|
|
let rtd = ['execution-no_of_doctors', 'execution-speaker_name', 'execution-doctor_potential',
|
|
'execution-expected_business'
|
|
];
|
|
|
|
function handleActivationTypeChange() {
|
|
let selectedValue = $('#execution-activation_type').val();
|
|
console.log(selectedValue);
|
|
|
|
camp_clinic.forEach(element => {
|
|
$('#' + element).hide().prop('required', false);
|
|
$('label[for="' + element + '"]').hide();
|
|
});
|
|
|
|
peak.forEach(element => {
|
|
$('#' + element).hide().prop('required', false);
|
|
$('label[for="' + element + '"]').hide();
|
|
});
|
|
|
|
rtd.forEach(element => {
|
|
$('#' + element).hide().prop('required', false);
|
|
$('label[for="' + element + '"]').hide();
|
|
});
|
|
|
|
if (selectedValue == 'HL Plus AI Clinics' || selectedValue == 'Camp' || selectedValue == 'Spirometry Clinics') {
|
|
camp_clinic.forEach(element => {
|
|
$('#' + element).show().prop('required', true);
|
|
$('label[for="' + element + '"]').show();
|
|
});
|
|
} else if (selectedValue == 'PEAK') {
|
|
peak.forEach(element => {
|
|
$('#' + element).show().prop('required', true);
|
|
$('label[for="' + element + '"]').show();
|
|
});
|
|
} else if (selectedValue == 'RTD') {
|
|
rtd.forEach(element => {
|
|
$('#' + element).show().prop('required', true);
|
|
$('label[for="' + element + '"]').show();
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
jQuery(document).ready(function($) {
|
|
|
|
camp_clinic.forEach(element => {
|
|
$('#' + element).hide();
|
|
$('label[for="' + element + '"]').hide();
|
|
});
|
|
|
|
peak.forEach(element => {
|
|
$('#' + element).hide();
|
|
$('label[for="' + element + '"]').hide();
|
|
});
|
|
|
|
rtd.forEach(element => {
|
|
$('#' + element).hide();
|
|
$('label[for="' + element + '"]').hide();
|
|
});
|
|
|
|
|
|
$('#field-activation_type, #execution-activation_type').on('change', function() {
|
|
let selectedValue = this.value;
|
|
|
|
camp_clinic.forEach(element => {
|
|
$('#' + element).hide().prop('required', false);
|
|
$('label[for="' + element + '"]').hide();
|
|
});
|
|
peak.forEach(element => {
|
|
$('#' + element).hide().prop('required', false);
|
|
$('label[for="' + element + '"]').hide();
|
|
});
|
|
rtd.forEach(element => {
|
|
$('#' + element).hide().prop('required', false);
|
|
$('label[for="' + element + '"]').hide();
|
|
});
|
|
|
|
if (selectedValue == 'HL Plus AI Clinics' || selectedValue == 'Camp' || selectedValue == 'Spirometry Clinics') {
|
|
camp_clinic.forEach(element => {
|
|
$('#' + element).show().prop('required', true);
|
|
$('label[for="' + element + '"]').show();
|
|
});
|
|
} else if (selectedValue == 'PEAK') {
|
|
peak.forEach(element => {
|
|
$('#' + element).show().prop('required', true);
|
|
$('label[for="' + element + '"]').show();
|
|
});
|
|
} else if (selectedValue == 'RTD') {
|
|
rtd.forEach(element => {
|
|
$('#' + element).show().prop('required', true);
|
|
$('label[for="' + element + '"]').show();
|
|
});
|
|
}
|
|
});
|
|
|
|
|
|
$('#form-wrapper').hide()
|
|
$('#execution-form-wrapper').hide()
|
|
|
|
$('#add-camp-btn').click(function() {
|
|
$('#form-wrapper').show()
|
|
$('#table-wrapper').hide()
|
|
})
|
|
|
|
$('.edit-btn').click(function() {
|
|
$('#execution-form-wrapper').show()
|
|
$('#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-time').prop('disabled', true)
|
|
|
|
let selected = JSON.parse($(this).attr('plan_details'))
|
|
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')).trigger('change');
|
|
//$('#execution-contact_id option').removeAttr('selected').filter('[value='+$("#execution-contact_id option:contains(" + selected[k] + ")").attr('value')+']').prop('selected', true)
|
|
//$('#execution-contact_id').change()
|
|
} 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() == selected['contact_id']) return this;
|
|
// }).attr('value')
|
|
// $('#execution-contact_id').val(docid)
|
|
$('#execution-id').val(selected['id'])
|
|
|
|
handleActivationTypeChange();
|
|
|
|
})
|
|
|
|
$('#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!'
|
|
})
|
|
}
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#value2').keyup(function() {
|
|
const newVal = parseFloat(this.value).toFixed(2)
|
|
$('#execution-other_product_business').val(newVal);
|
|
});
|
|
|
|
|
|
$('#execution-pulmosmart_200_inh_total_value,#execution-pulmosmart_400_inh_total_value,#execution-pulmosmart_200_pulmicaps_total_value,#execution-pulmosmart_400_pulmicaps_total_value,#execution-viloresp_pulmicaps_total_value,#execution-viloresp_pulmicaps_total_value,#execution-innohaler_device_total_value,#execution-pulmosmart_05_mg_total_value,#execution-pulmosmart_1_mg_total_value,#execution-glycoquic_total_value,#execution-budasure_total_value,#execution-iprasure_total_value,#execution-clearneb_total_value,#execution-quicnac_total_value,#execution-quicnac_ab_total_value,#execution-pulmosmart_g_total_value,#execution-glycoquic_f_cap_total_value,#execution-iprasure_ls_total_value,#execution-fibnib_100_total_value,#execution-fibnib_150_total_value,#execution-viloresp_200_total_value,#execution-budasure_l_05_total_value,#execution-zadonase_tablets_10s_total_value,#execution-innospacer_total_value,#execution-viloresp_u_pulmicaps_30s_total_value').attr('readOnly',true)
|
|
// document.getElementById("execution-other_product_business").readOnly = true;
|
|
|
|
$('#execution-pulmosmart_200_inh, #execution-pulmosmart_400_inh, #execution-pulmosmart_200_pulmicaps, #execution-pulmosmart_400_pulmicaps, #execution-viloresp_pulmicaps, #execution-innohaler_device, #execution-pulmosmart_05_mg, #execution-pulmosmart_1_mg, #execution-glycoquic, #execution-budasure, #execution-iprasure, #execution-clearneb, #execution-quicnac, #execution-quicnac_ab,#execution-pulmosmart_g,#execution-glycoquic_f_cap,#execution-iprasure_ls,#execution-fibnib_100,#execution-fibnib_150,#execution-viloresp_200,#execution-budasure_l_05,#execution-glycoquic_pulmules_25mcg_2ml,#execution-iprasure_pulmules_25_ml,#execution-zadonase_tablets_10s,#execution-innospacer,#execution-viloresp_u_pulmicaps_30s')
|
|
.on('keyup', function() {
|
|
var total = 0;
|
|
|
|
var id = $(this).attr('id');
|
|
var fixedValue = getFixedValue(id);
|
|
var enteredValue = parseFloat($(this).val());
|
|
if (!isNaN(enteredValue)) {
|
|
var ptsvalue = fixedValue * enteredValue;
|
|
$('#' + id + '_total_value').val(ptsvalue);
|
|
}
|
|
|
|
$('#execution-pulmosmart_200_inh, #execution-pulmosmart_400_inh, #execution-pulmosmart_200_pulmicaps, #execution-pulmosmart_400_pulmicaps, #execution-viloresp_pulmicaps, #execution-innohaler_device, #execution-pulmosmart_05_mg, #execution-pulmosmart_1_mg, #execution-glycoquic, #execution-budasure, #execution-iprasure, #execution-clearneb, #execution-quicnac, #execution-quicnac_ab,#execution-pulmosmart_g,#execution-glycoquic_f_cap,#execution-iprasure_ls,#execution-fibnib_100,#execution-fibnib_150,#execution-viloresp_200,#execution-budasure_l_05,#execution-glycoquic_pulmules_25mcg_2ml,#execution-iprasure_pulmules_25_ml,#execution-zadonase_tablets_10s,#execution-innospacer,#execution-viloresp_u_pulmicaps_30s')
|
|
.each(function() {
|
|
var id = $(this).attr('id');
|
|
var fixedValue = getFixedValue(id);
|
|
var enteredValue = parseFloat($(this).val());
|
|
if (!isNaN(enteredValue)) {
|
|
total += fixedValue * enteredValue;
|
|
}
|
|
var newVal2 = parseFloat(total).toFixed(2);
|
|
$('#execution-overall_clinic_business').val(newVal2);
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
document.getElementById("execution-overall_clinic_business").readOnly = true;
|
|
|
|
|
|
function getFixedValue(id) {
|
|
switch (id) {
|
|
case 'execution-pulmosmart_200_inh':
|
|
return 260.06;
|
|
case 'execution-pulmosmart_400_inh':
|
|
return 296.35;
|
|
case 'execution-pulmosmart_200_pulmicaps':
|
|
return 123.93;
|
|
case 'execution-pulmosmart_400_pulmicaps':
|
|
return 146.67;
|
|
case 'execution-viloresp_pulmicaps':
|
|
return 186.41;
|
|
case 'execution-innohaler_device':
|
|
return 205.06;
|
|
case 'execution-pulmosmart_05_mg':
|
|
return 51.09;
|
|
case 'execution-pulmosmart_1_mg':
|
|
return 48.48;
|
|
case 'execution-glycoquic':
|
|
return 37.92;
|
|
case 'execution-budasure':
|
|
return 17.3;
|
|
case 'execution-iprasure':
|
|
return 11.86;
|
|
case 'execution-clearneb':
|
|
return 13.17;
|
|
case 'execution-quicnac':
|
|
return 187.71;
|
|
case 'execution-quicnac_ab':
|
|
return 114.41;
|
|
case 'execution-pulmosmart_g':
|
|
return 379.27;
|
|
case 'execution-iprasure_ls':
|
|
return 13.37;
|
|
case 'execution-fibnib_100':
|
|
return 639.63;
|
|
case 'execution-fibnib_150':
|
|
return 758.57;
|
|
case 'execution-viloresp_200':
|
|
return 261.63;
|
|
case 'execution-glycoquic_f_cap':
|
|
return 270.00;
|
|
case 'execution-budasure_l_05':
|
|
return 25.03;
|
|
case 'execution-glycoquic_pulmules_25mcg_2ml':
|
|
return 34.71;
|
|
case 'execution-iprasure_pulmules_25_ml':
|
|
return 10.86;
|
|
case 'execution-zadonase_tablets_10s':
|
|
return 162.62;
|
|
case 'execution-innospacer':
|
|
return 334.29;
|
|
case 'execution-viloresp_u_pulmicaps_30s':
|
|
return 513.6;
|
|
default:
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#execution-form').on('submit', function(event) {
|
|
|
|
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'
|
|
})
|
|
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);
|
|
// });
|
|
|
|
executionDateField.addEventListener('change', function() {
|
|
console.log('gg');
|
|
var executionexeField = document.getElementById('execution-record_date');
|
|
executionexeField.setAttribute('min', executionDateField.value);
|
|
});
|
|
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |