Arise (3 Forms)
This commit is contained in:
parent
4fe210274a
commit
970cef567a
|
|
@ -425,7 +425,7 @@
|
|||
e.preventDefault();
|
||||
})
|
||||
|
||||
$('#execution-msl_code,#execution-speciality,execution-plan_date').prop('readonly',true);
|
||||
$('#execution-msl_code,#execution-speciality,#execution-plan_date').prop('readonly',true);
|
||||
|
||||
let selected = JSON.parse($(this).attr('plan_details'));
|
||||
console.log("Plan Detail : ", selected);
|
||||
|
|
@ -467,6 +467,9 @@
|
|||
$('#execution-reason').parent().hide();
|
||||
$('#execution-reason').prop('required',false);
|
||||
|
||||
var today = new Date().toISOString().split('T')[0];
|
||||
document.getElementById('execution-execution_date').max = today;
|
||||
|
||||
/* $('#execution-execution_done').on('change',function(){
|
||||
let value=$(this).val();
|
||||
console.log("Value is ",value);
|
||||
|
|
@ -555,10 +558,12 @@
|
|||
let typeValue=$('#execution-type_of_camp').val();
|
||||
console.log("Type of Value : ",typeValue);
|
||||
if(typeValue==='In Clinic camp'){
|
||||
console.log("In Clinic Camp");
|
||||
$('#execution-form').append('<input type="hidden" name="in_clinic_camp_exe" value="1">');
|
||||
|
||||
}
|
||||
else{
|
||||
console.log("Outreach Camp");
|
||||
$('#execution-form').append('<input type="hidden" name="outreach_camp_exe" value="1">');
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,636 @@
|
|||
<!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">Dr Meeting (Planning and Execution)</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>Plan Date</th>
|
||||
<th>Execution Done</th>
|
||||
|
||||
|
||||
<th>Camp Execution Date</th>
|
||||
<th>Type of meet</th>
|
||||
<th>Location</th>
|
||||
<th>Module Type</th>
|
||||
<th>Meeting Done</th>
|
||||
<th>Dr list submitted to HO</th>
|
||||
<th>No of Drs attended</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (collect($history->data->submissions)->sortByDesc('formdata.record_date') 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>{{ $sub->formdata->execution_date }}</td>
|
||||
|
||||
<td>{{ isset($sub->formdata->type_of_meet) ? $sub->formdata->type_of_meet : '' }}</td>
|
||||
<td>{{ isset($sub->formdata->location) ? $sub->formdata->location : '' }}</td>
|
||||
<td>{{ isset($sub->formdata->module_type) ? $sub->formdata->module_type : '' }}</td>
|
||||
<td>{{ isset($sub->formdata->meeting_done) ? $sub->formdata->meeting_done : '' }}</td>
|
||||
<td>{{ isset($sub->formdata->dr_list_submitted_to_ho) ? $sub->formdata->dr_list_submitted_to_ho : '' }}</td>
|
||||
<td>{{ isset($sub->formdata->no_of_drs_attended) ? $sub->formdata->no_of_drs_attended : '' }}</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',
|
||||
'meeting_done',
|
||||
'dr_list_submitted_to_ho',
|
||||
'no_of_drs_attended'
|
||||
]))
|
||||
@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' && isset($option->contact->type) && $option->contact->type != 'Chemist' )
|
||||
<option value="{{ $option->value }}"
|
||||
@if(isset($question->value) && $question->value == $option->value) selected @endif
|
||||
@if($question->code == 'contact_id')
|
||||
msl_code="{{ (isset($option->contact->msl_code) ? $option->contact->msl_code : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@elseif($question->code != 'contact_id')
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode)?$option->contact->pcode:'') . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
|
||||
|
||||
@endforeach
|
||||
@if($question->code=='contact_id')
|
||||
<option value="others" {{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>Others</option>
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
|
||||
@case('checkbox')
|
||||
@foreach ($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary">
|
||||
<input class="form-check-input" type="checkbox"
|
||||
id="field-{{ $question->code }}-{{ $option->value }}"
|
||||
name="{{ $question->code }}[]" value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked' : '' }}>
|
||||
<label class="form-check-label"
|
||||
for="field-{{ $question->code }}-{{ $option->value }}">{{ $option->display }}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
|
||||
@case('file')
|
||||
<input type="file" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control" value=""
|
||||
accept="image/jpg, image/jpeg, image/png" required>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if (!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit
|
||||
</button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div id="execution-form-wrapper">
|
||||
<form method="POST" action="/form/submit" id="execution-form"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{ $form_id }}">
|
||||
@csrf
|
||||
<input type="hidden" name="id" value="" id="execution-id">
|
||||
<input type="hidden" name="execution_done" value="yes">
|
||||
@foreach ($questions as $question)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="execution-{{ $question->code }}"
|
||||
class="form-label">{{ $question->question }} {!! $question->required == 'yes' ? '<span class="text-danger">*</span>' : '' !!}
|
||||
</label>
|
||||
@switch($question->type)
|
||||
@case('hidden')
|
||||
<input type="{{ $question->type }}" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}"
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('text')
|
||||
@case('email')
|
||||
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{ $question->type }}" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : '' }}">
|
||||
@break
|
||||
|
||||
@case('number')
|
||||
<input type="{{ $question->type }}" min="0" max="9999999999"
|
||||
step="1" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}
|
||||
value="{{ isset($question->value) ? $question->value : 0 }}">
|
||||
@break
|
||||
|
||||
@case('textarea')
|
||||
<textarea id="execution-{{ $question->code }}" name="{{ $question->code }}" class="form-control"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>{{ isset($question->value) ? $question->value : '' }}</textarea>
|
||||
@break
|
||||
|
||||
@case('dropdown')
|
||||
<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' && isset($option->contact->type) && $option->contact->type != 'Chemist' )
|
||||
<option value="{{ $option->value }}"
|
||||
@if(isset($question->value) && $question->value == $option->value) selected @endif
|
||||
@if($question->code == 'contact_id')
|
||||
msl_code="{{ (isset($option->contact->msl_code) ? $option->contact->msl_code : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@elseif($question->code != 'contact_id')
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode)?$option->contact->pcode:'') . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $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()
|
||||
|
||||
|
||||
|
||||
$('#add-camp-btn').click(function() {
|
||||
$('#table-wrapper').hide(0)
|
||||
$('#form-wrapper').show(100, () => {
|
||||
$('#add-camp-btn').hide(0);
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
$('#field-module_type').parent().hide();
|
||||
$('#field-module_type').attr('required',false);
|
||||
|
||||
$('#field-type_of_meet').on('change',function(){
|
||||
let value=$('#field-type_of_meet').val();
|
||||
console.log("Value is : ",value);
|
||||
if(value==='Step Up'){
|
||||
$('#field-module_type').parent().show();
|
||||
$('#field-module_type').attr('required',true);
|
||||
}
|
||||
else{
|
||||
$('#field-module_type').parent().hide();
|
||||
$('#field-module_type').attr('required',false);
|
||||
}
|
||||
})
|
||||
|
||||
$('#field-type_of_meet').on('change', function () {
|
||||
$('#report-form input.dynamic-hidden').remove();
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
// Convert to slug
|
||||
let slug = value
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/\s+/g, '_') // spaces → underscore
|
||||
.replace(/[^\w\-]+/g, ''); // remove special chars
|
||||
console.log("Slug is ",slug);
|
||||
$('#report-form').append('<input type="hidden" class="dynamic-hidden" name="' + slug + '" value="1">');
|
||||
});
|
||||
|
||||
|
||||
$('.edit-btn').click(function() {
|
||||
$('#execution-form-wrapper').show(100, () => {
|
||||
$('#add-camp-btn').hide(0);
|
||||
})
|
||||
$('#table-wrapper').hide()
|
||||
let meeting_type = document.getElementById('execution-type_of_meet');
|
||||
meeting_type.addEventListener('mousedown', function(e) {
|
||||
e.preventDefault();
|
||||
})
|
||||
|
||||
let module_type = document.getElementById('execution-module_type');
|
||||
module_type.addEventListener('mousedown', function(e) {
|
||||
e.preventDefault();
|
||||
})
|
||||
|
||||
$('#execution-location').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'));
|
||||
console.log("Plan Detail : ", selected);
|
||||
|
||||
|
||||
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
$('#execution-module_type').parent().hide();
|
||||
$('#execution-module_type').attr('required',false);
|
||||
|
||||
let meeting=$('#execution-type_of_meet').val();
|
||||
console.log("Type of Meeting : ",meeting);
|
||||
if(meeting==='Step Up'){
|
||||
$('#execution-module_type').parent().show();
|
||||
$('#execution-module_type').attr('required',true);
|
||||
}
|
||||
else{
|
||||
$('#execution-module_type').parent().hide();
|
||||
$('#execution-module_type').attr('required',false);
|
||||
}
|
||||
|
||||
$('#execution-execution_date,#execution-dr_list_submitted_to_ho,#execution-no_of_drs_attended').parent().hide();
|
||||
$('#execution-execution_date,#execution-dr_list_submitted_to_ho,#execution-no_of_drs_attended').attr('required',false);
|
||||
|
||||
$('#execution-meeting_done').on('change',function(){
|
||||
$('#execution-form input.dynamic-hidden').remove();
|
||||
let value=$('#execution-meeting_done').val();
|
||||
if(value==='Yes'){
|
||||
$('#execution-execution_date,#execution-dr_list_submitted_to_ho,#execution-no_of_drs_attended').parent().show();
|
||||
$('#execution-execution_date,#execution-dr_list_submitted_to_ho,#execution-no_of_drs_attended').attr('required',true);
|
||||
$('#execution-form').append('<input type="hidden" class="dynamic-hidden" name="executed" value="1">');
|
||||
}
|
||||
else{
|
||||
$('#execution-execution_date,#execution-dr_list_submitted_to_ho,#execution-no_of_drs_attended').parent().hide();
|
||||
$('#execution-execution_date,#execution-dr_list_submitted_to_ho,#execution-no_of_drs_attended').attr('required',false);
|
||||
$('#execution-form').append('<input type="hidden" class="dynamic-hidden" name="not_executed" value="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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#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-msl_code').prop('readonly', true);
|
||||
$('#field-speciality').prop('readonly', true);
|
||||
|
||||
|
||||
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').prop({"required":false});
|
||||
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').parent().hide();
|
||||
|
||||
|
||||
$('#field-contact_id').on('change',function(){
|
||||
let dropDown=$('#field-contact_id').val();
|
||||
if(dropDown==='others'){
|
||||
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').parent().show();
|
||||
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').prop({"required":true});
|
||||
$('#field-speciality,#field-msl_code').parent().hide();
|
||||
$('#field-speciality,#field-msl_code').prop({"required":false});
|
||||
}
|
||||
else{
|
||||
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').parent().hide();
|
||||
$('#field-other_doctor_name,#field-other_speciality,#field-other_msl_code').prop({"required":false});
|
||||
$('#field-speciality,#field-msl_code').parent().show();
|
||||
$('#field-speciality,#field-msl_code').prop({"required":true});
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
//$('#field-contact_id').append('<option value="others">Others</option>');
|
||||
|
||||
$('#execution-sitazit_d_rx,#execution-sitazit_dm_rx,#execution-ziten_m_rx').on('input', function() {
|
||||
var total=(
|
||||
(parseInt($('#execution-sitazit_d_rx').val()) ||0)+
|
||||
(parseInt($('#execution-sitazit_dm_rx').val()) ||0)+
|
||||
(parseInt($('#execution-ziten_m_rx').val()) ||0)
|
||||
);
|
||||
|
||||
|
||||
$('#execution-total_camp_rx').val(total)
|
||||
})
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#field-contact_id').trigger('change');
|
||||
});
|
||||
|
||||
$('#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'
|
||||
}).then(() => {
|
||||
location.reload(); // 🔥 page refresh here
|
||||
});
|
||||
$('#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>
|
||||
|
|
@ -416,7 +416,8 @@
|
|||
e.preventDefault();
|
||||
})
|
||||
|
||||
$('#execution-msl_code,#execution-speciality,execution-plan_date').prop('readonly',true);
|
||||
$('#execution-msl_code,#execution-speciality,#execution-plan_date').prop('readonly',true);
|
||||
|
||||
|
||||
let selected = JSON.parse($(this).attr('plan_details'));
|
||||
console.log("Plan Detail : ", selected);
|
||||
|
|
@ -458,6 +459,9 @@
|
|||
$('#execution-reason').parent().hide();
|
||||
$('#execution-reason').prop('required',false);
|
||||
|
||||
var today = new Date().toISOString().split('T')[0];
|
||||
document.getElementById('execution-execution_date').max = today;
|
||||
|
||||
/* $('#execution-execution_done').on('change',function(){
|
||||
let value=$(this).val();
|
||||
console.log("Value is ",value);
|
||||
|
|
@ -476,14 +480,14 @@
|
|||
}
|
||||
}) */
|
||||
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx').parent().hide();
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx').attr('required',false);
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx,#execution-foracort_g_rx').parent().hide();
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx,#execution-foracort_g_rx').attr('required',false);
|
||||
|
||||
$('#execution-execution').on('change',function(){
|
||||
let value=$('#execution-execution').val();
|
||||
if(value==='Yes'){
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx').parent().show();
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx').attr('required',true);
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx,#execution-foracort_g_rx').parent().show();
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx,#execution-foracort_g_rx').attr('required',true);
|
||||
$('#execution-reason').parent().hide();
|
||||
$('#execution-reason').prop('required',false);
|
||||
$('#execution-form input.dynamic-hidden').remove();
|
||||
|
|
@ -492,8 +496,8 @@
|
|||
|
||||
}
|
||||
else{
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx').parent().hide();
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx').attr('required',false);
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx,#execution-foracort_g_rx').parent().hide();
|
||||
$('#execution-execution_date,#execution-patient_screened,#execution-patients_diagnosed,#execution-foracort_rx,#execution-seroflo_rx,#execution-duolin_rx,#execution-aerocort_rx,#execution-glycohale_fb_rx,#execution-e_voltido_rx,#execution-e_foracort_g_rx,#execution-e_synchrobreathe_range_rx,#execution-foracort_g_rx').attr('required',false);
|
||||
$('#execution-reason').parent().show();
|
||||
$('#execution-reason').prop('required',true);
|
||||
$('#execution-form input.dynamic-hidden').remove();
|
||||
|
|
@ -545,11 +549,13 @@
|
|||
|
||||
let typeValue=$('#execution-type_of_camp').val();
|
||||
console.log("Type of Value : ",typeValue);
|
||||
if(typeValue==='In Clinic camp'){
|
||||
if(typeValue==='In Clinic Camp'){
|
||||
console.log("In Clinic")
|
||||
$('#execution-form').append('<input type="hidden" name="in_clinic_camp_exe" value="1">');
|
||||
|
||||
}
|
||||
else{
|
||||
console.log("Outreach")
|
||||
$('#execution-form').append('<input type="hidden" name="outreach_camp_exe" value="1">');
|
||||
|
||||
}
|
||||
|
|
@ -681,12 +687,15 @@ recordDateField.max = maxDate;
|
|||
recordDateField.value = todayFormatted;
|
||||
|
||||
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.setAttribute('min', today);
|
||||
|
||||
|
||||
$('.edit-btn').click(function() {
|
||||
var executionexeField = document.getElementById('execution-record_date');
|
||||
executionDateField.setAttribute('min', executionDateField.value);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
@ -696,6 +705,10 @@ recordDateField.value = todayFormatted;
|
|||
executionexeField.setAttribute('min', executionDateField.value);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue