842 lines
49 KiB
PHP
842 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">Add Life Webinar</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>Camp Plan Date</th>
|
|
<th>Execution Done</th>
|
|
|
|
<th>Speaker 1</th>
|
|
<th>Camp Execution Date</th>
|
|
<th>SBU Code</th>
|
|
<th>Speciality</th>
|
|
<th>Speaker 1 Eptus Rx value </th>
|
|
<th>Speaker 1 Eptus DM value</th>
|
|
<th>Speaker 2</th>
|
|
<th>SBU Code</th>
|
|
<th>Speciality</th>
|
|
<th>Speaker 2 Eptus Rx value </th>
|
|
<th>Speaker 2 Eptus DM value</th>
|
|
<th>Date</th>
|
|
<th>Time</th>
|
|
<th>Prescriber</th>
|
|
<th>Honorarium</th>
|
|
<th>Enter Honorarium Amount</th>
|
|
<th>Date of Execution</th>
|
|
<th>Executed as per plan</th>
|
|
<th>Attendee Count</th>
|
|
<th>Eptus DM Value</th>
|
|
<th>Upload Attendence Sheet</th>
|
|
<th>Upload Photograph</th>
|
|
<th>Doctor 1</th>
|
|
<th>SBU Code</th>
|
|
<th>Speciality</th>
|
|
<th>Doctor 1 Eptus Rx</th>
|
|
<th>Doctor 1 Eptus DM Value</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>{{ $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->speaker_1_eptus_rx_value ) ? $sub->formdata->speaker_1_eptus_rx_value : ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->speaker_1_eptus_dm_value ) ? $sub->formdata->speaker_1_eptus_dm_value : ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->doctor_name2) ? $sub->formdata->doctor_name2: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->msl_code2) ? $sub->formdata->msl_code2: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->speciality2) ? $sub->formdata->speciality2: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->speaker_2_eptus_rx_value ) ? $sub->formdata->speaker_2_eptus_rx_value : ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->speaker_2_eptus_dm_value ) ? $sub->formdata->speaker_2_eptus_dm_value : ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->record_date ) ? $sub->formdata->record_date : ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->time) ? $sub->formdata->time: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->prescriber) ? $sub->formdata->prescriber: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->honorarium) ? $sub->formdata->honorarium: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->enter_honorarium_amount) ? $sub->formdata->enter_honorarium_amount: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->execution_date) ? $sub->formdata->execution_date: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->executed_as_per_plan) ? $sub->formdata->executed_as_per_plan: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->attendee_count) ? $sub->formdata->attendee_count: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->eptus_dm_value) ? $sub->formdata->eptus_dm_value: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->upload_attendence_sheet) ? $sub->formdata->upload_attendence_sheet: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->upload_photograph) ? $sub->formdata->upload_photograph: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->doctor_1) ? $sub->formdata->doctor_1: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->msl_code_1) ? $sub->formdata->msl_code_1: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->speciality_1) ? $sub->formdata->speciality_1: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->doctor_1_eptus_rx_1) ? $sub->formdata->doctor_1_eptus_rx_1: ''}}
|
|
</td>
|
|
<td>{{isset($sub->formdata->doctor_1_eptus_dm_value_1) ? $sub->formdata->doctor_1_eptus_dm_value_1: ''}}
|
|
</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' ,'attendee_count','eptus_dm_value','upload_attendence_sheet','upload_photograph','doctor_1','msl_code_1','speciality_1','doctor_1_eptus_rx_1','doctor_1_eptus_dm_value_1']))
|
|
@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')
|
|
@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' : '' }} {{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->msl_code . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality)?$option->contact->speciality:'') . ' ' : '' }}
|
|
{{ $question->code == 'doctor_name2' ? 'msl_code= ' . $option->contact->msl_code . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'doctor_name2' ? 'speciality= ' . (isset($option->contact->speciality)?$option->contact->speciality:'') . ' ' : '' }}
|
|
>
|
|
{{ $option->display }}
|
|
</option>
|
|
|
|
@endforeach
|
|
</select>
|
|
@break
|
|
@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')
|
|
<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
|
|
|
|
<div class="doctor-group-wrapper">
|
|
<div class="row">
|
|
<div class="col-6"><h4>Add Doctors</h4></div>
|
|
<div class="col-6"><button class="btn btn-info btn-xs float-end" type="button" id="add-doctor">Add</button></div>
|
|
</div>
|
|
<div class="doctor-group row">
|
|
<div class="col-10">
|
|
@foreach ($questions as $question)
|
|
@if(in_array($question->code,['doctor_1']))
|
|
<label for="field-{{ $question->code }}"
|
|
class="form-label mt-2">{{ $question->question }} {!! $question->required == 'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
|
</label>
|
|
<select class="form-control doctor_select" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
|
<option value=""> -- Select -- </option>
|
|
@foreach ($question->options as $option)
|
|
<option value="{{ $option->display }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'doctor_1' ? 'msl_code= ' . $option->contact->msl_code . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'doctor_1' ? 'speciality= ' . (isset($option->contact->speciality)?$option->contact->speciality:'') . ' ' : '' }} >
|
|
{{ $option->display }}
|
|
</option>
|
|
|
|
@endforeach
|
|
</select>
|
|
|
|
@endif
|
|
@if(in_array($question->code,['speciality_1','msl_code_1']))
|
|
<label for="field-{{ $question->code }}"
|
|
class="form-label mt-2">{{ $question->question }} {!! $question->required == 'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
|
</label>
|
|
<input type="{{ $question->type }}" id="field-{{ $question->code }}"
|
|
name="{{ $question->code }}" class="form-control"
|
|
{{ $question->required == 'yes' ? 'required' : '' }}
|
|
value="{{ isset($question->value) ? $question->value : '' }}">
|
|
@endif
|
|
@if(in_array($question->code,['doctor_1_eptus_rx_1','doctor_1_eptus_dm_value_1']))
|
|
<label for="field-{{ $question->code }}"
|
|
class="form-label mt-2">{{ $question->question }} {!! $question->required == 'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
|
</label>
|
|
<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 }}">
|
|
@endif
|
|
@endforeach
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<button class="btn btn-danger btn-xs float-end remove-doctor mt-4 d-none" type="button"><i class="mdi mdi-close"></i></button>
|
|
</div>
|
|
</div>
|
|
<hr style="margin:0px" />
|
|
</div>
|
|
<div class="execution-doctor-group-wrapper"></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()
|
|
var count = 1
|
|
$("#add-doctor").click(function(){
|
|
count++;
|
|
var doctor_html = $(".doctor-group").first().html()
|
|
let loop = 4
|
|
while(loop > 0) {
|
|
doctor_html = doctor_html.replace('doctor_1', 'doctor_'+count)
|
|
doctor_html = doctor_html.replace('speciality_1', 'speciality_'+count)
|
|
doctor_html = doctor_html.replace('msl_code_1', 'msl_code_'+count)
|
|
doctor_html = doctor_html.replace('msl_code_1', 'msl_code_'+count)
|
|
doctor_html = doctor_html.replace('doctor_1_eptus_rx_1', 'doctor_1_eptus_rx_'+count)
|
|
doctor_html = doctor_html.replace('doctor_1_eptus_dm_value_1', 'doctor_1_eptus_dm_value_'+count)
|
|
loop--;
|
|
}
|
|
$(".doctor-group-wrapper").append('<div class="doctor-group row">'+doctor_html+'</div>')
|
|
$(".doctor-group").each(function(index){
|
|
if(index > 0)
|
|
$(this).find('.remove-doctor').removeClass('d-none')
|
|
})
|
|
$('.remove-doctor').unbind()
|
|
$('.remove-doctor').click(function(){
|
|
$(this).parent().parent()[0].remove()
|
|
})
|
|
$('#field-doctor_'+count).change(function() {
|
|
$('#field-speciality_'+count).val($('option:selected', this).attr(
|
|
'speciality'))
|
|
$('#field-msl_code_'+count).val($('option:selected', this).attr(
|
|
'msl_code'))
|
|
})
|
|
|
|
});
|
|
$('.remove-doctor').click(function(){
|
|
$(this).parent().parent()[0].remove()
|
|
})
|
|
$('#field-doctor_1').change(function() {
|
|
$('#field-speciality_1').val($('option:selected', this).attr(
|
|
'speciality'))
|
|
$('#field-msl_code_1').val($('option:selected', this).attr(
|
|
'msl_code'))
|
|
})
|
|
|
|
// $('#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);
|
|
})
|
|
|
|
|
|
})
|
|
|
|
$('.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-uid').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'));
|
|
} else
|
|
$('#execution-' + k).val(selected[k]);
|
|
}
|
|
if (selected[k] != '') {
|
|
if (k == 'doctor_name2') {
|
|
//$("#execution-contact_id option:contains(" + selected[k] + ")").prop('selected', true)
|
|
// console.log($("#execution-contact_id option:contains(" + selected[k] + ")").attr('value'))
|
|
$('#execution-doctor_name2').val($("#execution-doctor_name2 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'])
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
$('#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!'
|
|
})
|
|
}
|
|
},
|
|
});
|
|
});
|
|
|
|
let sbucode2=document.querySelector('#field-msl_code2');
|
|
let speciality2=document.querySelector('#field-speciality2');
|
|
let honoriumAmount=document.querySelector('#field-enter_honorarium_amount');
|
|
let speaker2Eptus=document.querySelector('#field-speaker_2_eptus_rx_value');
|
|
let speaker2EptusDm=document.querySelector('#field-speaker_2_eptus_dm_value');
|
|
|
|
$(sbucode2).parent().css('display','none');
|
|
$(speciality2).parent().css('display','none');
|
|
$(honoriumAmount).parent().css('display','none');
|
|
$(speaker2Eptus).parent().css('display','none');
|
|
$(speaker2EptusDm).parent().css('display','none');
|
|
|
|
$(sbucode2).prop({"required":false});
|
|
$(speciality2).prop({"required":false});
|
|
$(honoriumAmount).prop({"required":false});
|
|
$(speaker2Eptus).prop({"required":false});
|
|
$(speaker2EptusDm).parent().css('display','none');
|
|
|
|
|
|
let execution_sbucode2=document.querySelector('#execution-msl_code2');
|
|
let execution_speciality2=document.querySelector('#execution-speciality2');
|
|
let execution_honoriumAmount=document.querySelector('#execution-enter_honorarium_amount');
|
|
let execution_speaker2Eptus=document.querySelector('#execution-speaker_2_eptus_rx_value');
|
|
let execution_speaker2EptusDM=document.querySelector('#execution-speaker_2_eptus_dm_value');
|
|
|
|
$(execution_sbucode2).parent().css('display','none');
|
|
$(execution_speciality2).parent().css('display','none');
|
|
$(execution_honoriumAmount).parent().css('display','none');
|
|
$(execution_speaker2Eptus).parent().css('display','none');
|
|
$(execution_speaker2EptusDM).parent().css('display','none');
|
|
|
|
$(execution_sbucode2).prop({"required":false});
|
|
$(execution_speciality2).prop({"required":false});
|
|
$(execution_honoriumAmount).prop({"required":false});
|
|
$(execution_speaker2Eptus).prop({"required":false});
|
|
$(execution_speaker2EptusDM).prop({"required":false});
|
|
|
|
$('#execution-doctor_name2').on('change',function(e){
|
|
let execution_sbucode2=document.querySelector('#execution-msl_code2');
|
|
let execution_speciality2=document.querySelector('#execution-speciality2');
|
|
let execution_speaker2Eptus=document.querySelector('#execution-speaker_2_eptus_rx_value');
|
|
let execution_speaker2EptusDM=document.querySelector('#execution-speaker_2_eptus_dm_value');
|
|
|
|
$(execution_sbucode2).parent().css('display','none');
|
|
$(execution_speciality2).parent().css('display','none');
|
|
$(execution_speaker2Eptus).parent().css('display','none');
|
|
$(execution_speaker2EptusDM).parent().css('display','none');
|
|
|
|
$(execution_sbucode2).prop({"required":false});
|
|
$(execution_speciality2).prop({"required":false});
|
|
$(execution_speaker2Eptus).prop({"required":false});
|
|
$(execution_speaker2EptusDM).prop({"required":false});
|
|
|
|
if(this.value.toLowerCase()===''){
|
|
$(execution_sbucode2).parent().css('display','none');
|
|
$(execution_sbucode2).prop({"required":false});
|
|
$(execution_speciality2).prop({"required":false});
|
|
$(execution_speciality2).parent().css('display','none');
|
|
$(execution_speaker2Eptus).parent().css('display','none');
|
|
$(execution_speaker2EptusDM).parent().css('display','none');
|
|
}
|
|
else{
|
|
$(execution_sbucode2).parent().css('display','block');
|
|
$(execution_sbucode2).prop({"required":true});
|
|
$(execution_speciality2).prop({"required":true});
|
|
$(execution_speciality2).parent().css('display','block');
|
|
$(execution_speaker2Eptus).parent().css('display','block');
|
|
$(execution_speaker2EptusDM).parent().css('display','block');
|
|
}
|
|
|
|
})
|
|
|
|
$('#execution-honorarium').on('change',function(e){
|
|
let execution_honoriumAmount=document.querySelector('#execution-enter_honorarium_amount');
|
|
$(execution_honoriumAmount).parent().css('display','none');
|
|
$(execution_honoriumAmount).prop({"required":false});
|
|
|
|
if(this.value.toLowerCase()==='yes'){
|
|
$(execution_honoriumAmount).parent().css('display','block');
|
|
$(execution_honoriumAmount).prop({"required":true});
|
|
}else{
|
|
$(execution_honoriumAmount).parent().css('display','none');
|
|
$(execution_honoriumAmount).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-doctor_name2').change(function() {
|
|
$('#field-speciality2').val($('option:selected', this).attr(
|
|
'speciality'))
|
|
})
|
|
|
|
$('#field-doctor_name2').change(function() {
|
|
$('#field-msl_code2').val($('option:selected', this).attr('msl_code'))
|
|
})
|
|
|
|
$('#field-doctor_name2').on('change',function(e){
|
|
let sbucode2=document.querySelector('#field-msl_code2');
|
|
let speciality2=document.querySelector('#field-speciality2');
|
|
let speaker2Eptus=document.querySelector('#field-speaker_2_eptus_rx_value');
|
|
let speaker2EptusDM=document.querySelector('#field-speaker_2_eptus_dm_value');
|
|
|
|
$(sbucode2).parent().css('display','none');
|
|
$(speaker2Eptus).parent().css('display','none');
|
|
$(speaker2EptusDM).parent().css('display','none');
|
|
$(speciality2).parent().css('display','none');
|
|
|
|
$(sbucode2).prop({"required":false});
|
|
$(speciality2).prop({"required":false});
|
|
$(speaker2Eptus).prop({"required":false});
|
|
$(speaker2EptusDM).prop({"required":false});
|
|
|
|
if(this.value.toLowerCase()===''){
|
|
$(sbucode2).parent().css('display','none');
|
|
$(sbucode2).prop({"required":false});
|
|
$(speaker2Eptus).parent().css('display','none');
|
|
(speaker2Eptus).prop({"required":false});
|
|
$(speaker2EptusDM).parent().css('display','none');
|
|
(speaker2EptusDM).prop({"required":false});
|
|
|
|
$(speciality2).prop({"required":false});
|
|
$(speciality2).parent().css('display','none');
|
|
}
|
|
else{
|
|
$(sbucode2).parent().css('display','block');
|
|
$(sbucode2).prop({"required":true});
|
|
$(speciality2).prop({"required":true});
|
|
$(speciality2).parent().css('display','block');
|
|
$(speaker2Eptus).parent().css('display','block');
|
|
$(speaker2Eptus).prop({"required":true});
|
|
$(speaker2EptusDM).parent().css('display','block');
|
|
$(speaker2EptusDM).prop({"required":true});
|
|
}
|
|
|
|
})
|
|
|
|
$('#field-honorarium').on('change',function(e){
|
|
let honoriumAmount=document.querySelector('#field-enter_honorarium_amount');
|
|
$(honoriumAmount).parent().css('display','none');
|
|
$(honoriumAmount).prop({"required":false});
|
|
|
|
if(this.value.toLowerCase()==='yes'){
|
|
$(honoriumAmount).parent().css('display','block');
|
|
$(honoriumAmount).prop({"required":true});
|
|
}else{
|
|
$(honoriumAmount).parent().css('display','none');
|
|
$(honoriumAmount).prop({"required":false});
|
|
}
|
|
})
|
|
|
|
let doctor1=document.querySelector('#execution-doctor_1');
|
|
$(doctor1).parent().css('display','none');
|
|
$(doctor1).prop({"required":false});
|
|
|
|
let mslCode1=document.querySelector('#execution-msl_code_1');
|
|
$(mslCode1).parent().css('display','none');
|
|
$(mslCode1).prop({"required":false});
|
|
|
|
let speciality1=document.querySelector('#execution-speciality_1');
|
|
$(speciality1).parent().css('display','none');
|
|
$(speciality1).prop({"required":false});
|
|
|
|
let doctor1EptusRx=document.querySelector('#execution-doctor_1_eptus_rx_1');
|
|
$(doctor1EptusRx).parent().css('display','none');
|
|
$(doctor1EptusRx).prop({"required":false});
|
|
|
|
let doctor1EptusDm=document.querySelector('#execution-doctor_1_eptus_dm_value_1');
|
|
$(doctor1EptusDm).parent().css('display','none');
|
|
$(doctor1EptusDm).prop({"required":false});
|
|
|
|
|
|
$('#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);
|
|
// });
|
|
|
|
$('.edit-btn').click(function() {
|
|
var executionexeField = document.getElementById('execution-execution_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> |