Merge branch 'main' of http://192.168.1.200:3000/Stratawiz/Rapport-Laravel
Specific Folder FTP Upload / ftp-deploy (push) Successful in 38s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 38s
Details
This commit is contained in:
commit
5c44ec5791
|
|
@ -9,7 +9,7 @@
|
|||
<div class="account-pages">
|
||||
<div class="container">
|
||||
|
||||
<!-- start page title -->
|
||||
<!-- start page title -->`
|
||||
<div class="row">
|
||||
<div class="col-8 p-2">
|
||||
<h4 class="page-title">{{$formname}}</h4>
|
||||
|
|
|
|||
|
|
@ -169,12 +169,21 @@
|
|||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@if ($question->code == 'contact_id')
|
||||
@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 . ' ' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . $option->contact->speciality . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . $option->contact->speciality . ' ' : '' }} >
|
||||
@if( isset($option->contact->breathefree_clinics_voltido_trio) && $option->contact->breathefree_clinics_voltido_trio == 'Yes' )
|
||||
<option value="{{ $option->value }}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" msl_code="{{isset($option->contact->msl_code)?$option->contact->msl_code:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
|
||||
@endif
|
||||
@endforeach
|
||||
@else
|
||||
@foreach ($question->options as $option)
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -584,7 +584,7 @@ $brandData2 = [
|
|||
<td>
|
||||
<input type="number" step="1" min="0" id="execution-{{ $brand['slug'] }}"
|
||||
name="{{ $brand['slug'] }}"
|
||||
class="form-control form-control-large" readonly="true" value="{{ isset($formdata->{$brand['slug']}) ? $formdata->{$brand['slug']} : 0 }}" >
|
||||
class="form-control form-control-large" value="{{ isset($formdata->{$brand['slug']}) ? $formdata->{$brand['slug']} : 0 }}" >
|
||||
</td>
|
||||
|
||||
<td>
|
||||
|
|
@ -943,6 +943,8 @@ $brandData2 = [
|
|||
|
||||
$('[id*="_transplant_"][id*="week"]').prop('readonly', true);
|
||||
|
||||
|
||||
|
||||
$('#execution-execution_week').on('change', function () {
|
||||
|
||||
let selectedWeek = $(this).val();
|
||||
|
|
@ -964,12 +966,17 @@ $brandData2 = [
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
$('#execution-total_transplant').prop('readonly', true);
|
||||
|
||||
$('[id^="execution-total_transplant_"]').prop('readonly', true);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).on('input', '[id*="_transplant_"][id*="week"]', function () {
|
||||
/* $(document).on('input', '[id*="_transplant_"][id*="week"]', function () {
|
||||
|
||||
const organs = ['kidney', 'liver', 'heart', 'cardio'];
|
||||
const organsWeek = ['kidney', 'liver', 'heart']; // exclude cardio
|
||||
|
|
@ -1021,8 +1028,68 @@ $brandData2 = [
|
|||
// -------------------------
|
||||
$('#execution-total_transplant').val(totalTransplant);
|
||||
|
||||
}); */
|
||||
|
||||
|
||||
$(document).on('input','[id*="_transplant_"]',function () {
|
||||
|
||||
const organs = ['kidney', 'liver', 'heart'];
|
||||
const organsWeek = ['kidney', 'liver', 'heart'];
|
||||
const types = ['gennova', 'switch', 'graftsol'];
|
||||
|
||||
// -------------------------
|
||||
// 1. WEEK-WISE TOTALS
|
||||
// -------------------------
|
||||
for (let week = 1; week <= 4; week++) {
|
||||
|
||||
types.forEach(type => {
|
||||
|
||||
let total = 0;
|
||||
|
||||
organsWeek.forEach(organ => {
|
||||
|
||||
let id = `#execution-${organ}_transplant_${type}_week${week}`;
|
||||
|
||||
total += parseInt($(id).val()) || 0;
|
||||
|
||||
});
|
||||
|
||||
$(`#execution-total_transplant_${type}_week${week}`).val(total);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// -------------------------
|
||||
// 2. FIRST COLUMN GRAND TOTAL
|
||||
// -------------------------
|
||||
let firstColumnTotal = 0;
|
||||
|
||||
organs.forEach(organ => {
|
||||
|
||||
firstColumnTotal += parseInt(
|
||||
$(`#execution-${organ}_transplant`).val()
|
||||
) || 0;
|
||||
|
||||
});
|
||||
|
||||
$('#execution-total_transplant').val(firstColumnTotal);
|
||||
|
||||
});
|
||||
|
||||
$(document).on('input','#execution-kidney_transplant, #execution-liver_transplant, #execution-heart_transplant',function () {
|
||||
|
||||
let total =
|
||||
(parseInt($('#execution-kidney_transplant').val()) || 0) +
|
||||
(parseInt($('#execution-liver_transplant').val()) || 0) +
|
||||
(parseInt($('#execution-heart_transplant').val()) || 0);
|
||||
|
||||
$('#execution-total_transplant').val(total);
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -1217,8 +1284,12 @@ $brandData2 = [
|
|||
// });
|
||||
|
||||
$('.edit-btn').click(function() {
|
||||
let today = new Date().toISOString().split('T')[0];
|
||||
var executionexeField = document.getElementById('execution-execution_date');
|
||||
executionexeField.setAttribute('min', executionDateField.value);
|
||||
console.log("Edit execution date");
|
||||
//executionexeField.setAttribute('min', executionDateField.value);
|
||||
executionexeField.setAttribute('max',today);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
|
|
@ -96,7 +97,7 @@
|
|||
<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':'' }}>
|
||||
<select class="form-control select2" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}"
|
||||
|
|
@ -234,8 +235,14 @@
|
|||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.select2').select2({
|
||||
placeholder: '-- Select Doctor --',
|
||||
allowClear: true,
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
@ -353,7 +360,28 @@
|
|||
|
||||
syncLOBGTotal();
|
||||
|
||||
$('#field-upload_supporting_document').on('change', function () {
|
||||
let file = this.files[0];
|
||||
|
||||
if (file) {
|
||||
let allowedTypes = ['image/png', 'image/jpg', 'image/jpeg'];
|
||||
let maxSize = 10 * 1024 * 1024; // 10 MB
|
||||
|
||||
// Type validation
|
||||
if (!allowedTypes.includes(file.type)) {
|
||||
alert('Only PNG, JPG, and JPEG files are allowed.');
|
||||
$(this).val('');
|
||||
return;
|
||||
}
|
||||
|
||||
// Size validation
|
||||
if (file.size > maxSize) {
|
||||
alert('File size should not exceed 10 MB.');
|
||||
$(this).val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
|
|
@ -87,7 +88,7 @@
|
|||
<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':'' }}>
|
||||
<select class="form-control select2" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}"
|
||||
|
|
@ -228,9 +229,16 @@
|
|||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
|
||||
$('.select2').select2({
|
||||
placeholder: '-- Select Doctor --',
|
||||
allowClear: true,
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
|
||||
$(document).on(
|
||||
'input',
|
||||
|
|
@ -287,6 +295,29 @@
|
|||
);
|
||||
|
||||
|
||||
$('#field-upload_supporting_document').on('change', function () {
|
||||
let file = this.files[0];
|
||||
|
||||
if (file) {
|
||||
let allowedTypes = ['image/png', 'image/jpg', 'image/jpeg'];
|
||||
let maxSize = 10 * 1024 * 1024; // 10 MB
|
||||
|
||||
// Type validation
|
||||
if (!allowedTypes.includes(file.type)) {
|
||||
alert('Only PNG, JPG, and JPEG files are allowed.');
|
||||
$(this).val('');
|
||||
return;
|
||||
}
|
||||
|
||||
// Size validation
|
||||
if (file.size > maxSize) {
|
||||
alert('File size should not exceed 10 MB.');
|
||||
$(this).val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,340 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/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 bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@if(isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="user_id" value="{{$form->user_id}}">
|
||||
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@foreach($questions as $question)
|
||||
<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 select2" 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 == 'doctor' )
|
||||
<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')
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" {{$question->required == 'yes'?'required':'' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{$question->value}}" class="img-fluid">
|
||||
@endif
|
||||
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
|
||||
@case('time')
|
||||
<input type="time"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes' ? 'required' : ''}}
|
||||
value="{{isset($question->value) ? $question->value : ''}}">
|
||||
@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> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.select2').select2({
|
||||
placeholder: '-- Select Doctor --',
|
||||
allowClear: true,
|
||||
width: '100%'
|
||||
});
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for (let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display).attr("msl_code", itm.contact.msl_code).attr('speciality',itm.contact.speciality));
|
||||
}
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#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,#field-speciality,#field-total_sitazit_rx').attr('readonly',true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('#field-sitazit_d_10100_rx,#field-sitazit_d_550_rx,#field-sitazit_dm_er_100010_rx,#field-sitazit_dm_er_50010_rx').on('input', function() {
|
||||
var total=(
|
||||
(parseInt($('#field-sitazit_d_10100_rx').val()) ||0)+
|
||||
(parseInt($('#field-sitazit_d_550_rx').val()) ||0)+
|
||||
(parseInt($('#field-sitazit_dm_er_100010_rx').val()) ||0)+
|
||||
(parseInt($('#field-sitazit_dm_er_50010_rx').val()) ||0)
|
||||
|
||||
);
|
||||
|
||||
$('#field-total_sitazit_rx').val(total)
|
||||
})
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#field-contact_id').trigger('change');
|
||||
});
|
||||
|
||||
$('#field-sitazit_d_10100_rx,#field-sitazit_d_550_rx,#field-sitazit_dm_er_100010_rx,#field-sitazit_dm_er_50010_rx').on('input', function () {
|
||||
// Remove everything except digits
|
||||
this.value = this.value.replace(/[^0-9]/g, '');
|
||||
});
|
||||
|
||||
|
||||
$('#field-upload_supporting_document').on('change', function () {
|
||||
let file = this.files[0];
|
||||
|
||||
if (file) {
|
||||
let allowedTypes = ['image/png', 'image/jpg', 'image/jpeg'];
|
||||
let maxSize = 10 * 1024 * 1024; // 10 MB
|
||||
|
||||
// Type validation
|
||||
if (!allowedTypes.includes(file.type)) {
|
||||
alert('Only PNG, JPG, and JPEG files are allowed.');
|
||||
$(this).val('');
|
||||
return;
|
||||
}
|
||||
|
||||
// Size validation
|
||||
if (file.size > maxSize) {
|
||||
alert('File size should not exceed 10 MB.');
|
||||
$(this).val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
const formData = new FormData($('#report-form')[0]);
|
||||
// Log form data to console
|
||||
for (let [key, value] of formData.entries()) {
|
||||
console.log(key, value);
|
||||
}
|
||||
$("#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'
|
||||
}).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 plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,339 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/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 bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@if(isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</div>
|
||||
@endif
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form_id" value="{{$form_id}}">
|
||||
<input type="hidden" name="user_id" value="{{$form->user_id}}">
|
||||
|
||||
@csrf
|
||||
@if($id)
|
||||
<input type="hidden" name="id" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@foreach($questions as $question)
|
||||
<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 select2" 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 == 'doctor' )
|
||||
<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')
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" {{$question->required == 'yes'?'required':'' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{$question->value}}" class="img-fluid">
|
||||
@endif
|
||||
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
|
||||
@case('time')
|
||||
<input type="time"
|
||||
id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes' ? 'required' : ''}}
|
||||
value="{{isset($question->value) ? $question->value : ''}}">
|
||||
@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> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
||||
<!-- end row -->
|
||||
|
||||
</div> <!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
<!-- end container -->
|
||||
</div>
|
||||
<!-- end page -->
|
||||
<style type="text/css">
|
||||
#pageloader {
|
||||
background: rgba( 255, 255, 255, 0.8 );
|
||||
display: none;
|
||||
height: 100%;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
#pageloader img {
|
||||
left: 50%;
|
||||
margin-left: -32px;
|
||||
margin-top: -32px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.select2').select2({
|
||||
placeholder: '-- Select Doctor --',
|
||||
allowClear: true,
|
||||
width: '100%'
|
||||
});
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for (let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display).attr("msl_code", itm.contact.msl_code).attr('speciality',itm.contact.speciality));
|
||||
}
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#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,#field-speciality,#field-total_eptus_rx').attr('readonly',true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('#field-eptus_25mg_rx,#field-eptus_50_mg_rx,#field-eptus_t_10_kit_rx,#field-eptus_t_20_kit_rx').on('input', function() {
|
||||
var total=(
|
||||
(parseInt($('#field-eptus_25mg_rx').val()) ||0)+
|
||||
(parseInt($('#field-eptus_50_mg_rx').val()) ||0)+
|
||||
(parseInt($('#field-eptus_t_10_kit_rx').val()) ||0)+
|
||||
(parseInt($('#field-eptus_t_20_kit_rx').val()) ||0)
|
||||
|
||||
);
|
||||
|
||||
$('#field-total_eptus_rx').val(total)
|
||||
})
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#field-contact_id').trigger('change');
|
||||
});
|
||||
|
||||
$('#field-eptus_25mg_rx,#field-eptus_50_mg_rx,#field-eptus_t_10_kit_rx,#field-eptus_t_20_kit_rx').on('input', function () {
|
||||
// Remove everything except digits
|
||||
this.value = this.value.replace(/[^0-9]/g, '');
|
||||
});
|
||||
|
||||
$('#field-upload_supporting_document').on('change', function () {
|
||||
let file = this.files[0];
|
||||
|
||||
if (file) {
|
||||
let allowedTypes = ['image/png', 'image/jpg', 'image/jpeg'];
|
||||
let maxSize = 10 * 1024 * 1024; // 10 MB
|
||||
|
||||
// Type validation
|
||||
if (!allowedTypes.includes(file.type)) {
|
||||
alert('Only PNG, JPG, and JPEG files are allowed.');
|
||||
$(this).val('');
|
||||
return;
|
||||
}
|
||||
|
||||
// Size validation
|
||||
if (file.size > maxSize) {
|
||||
alert('File size should not exceed 10 MB.');
|
||||
$(this).val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
const formData = new FormData($('#report-form')[0]);
|
||||
// Log form data to console
|
||||
for (let [key, value] of formData.entries()) {
|
||||
console.log(key, value);
|
||||
}
|
||||
$("#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'
|
||||
}).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 plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,656 @@
|
|||
<!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="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
</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 bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@if(isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</div>
|
||||
@endif
|
||||
<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
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@foreach($questions as $question)
|
||||
<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':'' }}
|
||||
{{ in_array($question->code, ['msl_code', 'speciality']) ? 'readonly' : '' }}
|
||||
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}}"
|
||||
{{ $question->code == 'total_lobg_rx' ? 'readonly' : '' }}>
|
||||
@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 select2" id="field-{{$question->code}}" name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($question->options as $option)
|
||||
<option value="{{$option->value}}"
|
||||
msl_code="{{isset($option->contact->msl_code) ? $option->contact->msl_code : ''}}"
|
||||
speciality="{{isset($option->contact->speciality) ? $option->contact->speciality : ''}}"
|
||||
{{isset($question->value) && $question->value == $option->value ? 'selected':''}}>
|
||||
{{$option->display}}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@case('radio')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-success">
|
||||
<input class="form-check-input" type="radio" name="{{$question->code}}" id="field-{{$question->code}}_{{$option->value}}" value="{{$option->value}}">
|
||||
<label class="form-check-label" for="field-{{$question->code}}_{{$option->value}}">{{$option->display}}</label>
|
||||
</div>
|
||||
@endforeach
|
||||
@break
|
||||
@case('radiometrix')
|
||||
@php
|
||||
// Decode the first option's value to use as heading labels
|
||||
$headings =
|
||||
count($question->options) > 0
|
||||
? json_decode($question->options[0]->value)
|
||||
: [];
|
||||
@endphp
|
||||
|
||||
{{-- Matrix Wrapper with Horizontal Scroll on Small Screens --}}
|
||||
<div class="table-responsive">
|
||||
<div class="d-table w-100">
|
||||
{{-- Table Headers --}}
|
||||
<div class="d-table-row font-weight-bold">
|
||||
<div class="d-table-cell p-2" style="width: 150px;"></div>
|
||||
{{-- Placeholder for row labels --}}
|
||||
@foreach ($headings as $head)
|
||||
<div class="d-table-cell text-center p-2">{{ $head }}
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
{{-- Table Rows --}}
|
||||
@foreach ($question->options as $option)
|
||||
@php $nn = json_decode($option->value); @endphp
|
||||
<div class="d-table-row align-middle">
|
||||
<div class="d-table-cell font-weight-bold p-2"
|
||||
style="width: 150px;">
|
||||
{{ $option->display }}
|
||||
</div>
|
||||
|
||||
@foreach ($nn as $value)
|
||||
<div class="d-table-cell text-center p-2">
|
||||
<input type="radio"
|
||||
id="field-{{ $option->display }}-{{ $value }}"
|
||||
name="{{ $question->code }}[{{$option->display}}]" value="{{$value}}" class="form-check-input"
|
||||
{{ isset($question->display) && $option->display != $option->display ? 'checked' : '' }}>
|
||||
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@break
|
||||
@case('checkbox')
|
||||
@foreach($question->options as $option)
|
||||
<div class="form-check mb-2 form-check-primary ms-2">
|
||||
<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')
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" {{$question->required == 'yes'?'required':'' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{$question->value}}" class="img-fluid">
|
||||
@endif
|
||||
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@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> <!-- 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%;
|
||||
}
|
||||
.form-label {
|
||||
font-weight:bold;
|
||||
font-size:16px;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($){
|
||||
$('.select2').select2({
|
||||
placeholder: '-- Select Doctor --',
|
||||
allowClear: true,
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// Hide All Fields Initially
|
||||
|
||||
|
||||
$('#field-sitazit_d_10100_pob_units, #field-sitazit_d_550_pob_units, #field-sitazit_dm_er_100010_pob_units, #field-sitazit_dm_er_50010_pob_units, #field-sitazit_d_10100_pob_value, #field-sitazit_d_550_pob_value, #field-sitazit_dm_er_100010_pob_value, #field-sitazit_dm_er_50010_pob_value, #field-eptus_25mg_units, #field-eptus_50_mg_units, #field-eptus_t_10_kit_units, #field-eptus_t_20_kit_units, #field-eptus_25mg_value, #field-eptus_50_mg_value, #field-eptus_t_10_kit_value, #field-eptus_t_20_kit_value, #field-lo_bg_05_mg_units, #field-lo_bg_05_mg_value, #field-ziten_m_20_mg_1000_mg_units, #field-ziten_m_20_mg_500_mg_units, #field-ziten_units, #field-ziten_m_20_mg_1000_mg_value, #field-ziten_m_20_mg_500_mg_value, #field-ziten_value, #field-total_pob_units, #field-total_pob_value').prop({"required":false});
|
||||
|
||||
$('#field-sitazit_d_10100_pob_units, #field-sitazit_d_550_pob_units, #field-sitazit_dm_er_100010_pob_units, #field-sitazit_dm_er_50010_pob_units, #field-sitazit_d_10100_pob_value, #field-sitazit_d_550_pob_value, #field-sitazit_dm_er_100010_pob_value, #field-sitazit_dm_er_50010_pob_value, #field-eptus_25mg_units, #field-eptus_50_mg_units, #field-eptus_t_10_kit_units, #field-eptus_t_20_kit_units, #field-eptus_25mg_value, #field-eptus_50_mg_value, #field-eptus_t_10_kit_value, #field-eptus_t_20_kit_value, #field-lo_bg_05_mg_units, #field-lo_bg_05_mg_value, #field-ziten_m_20_mg_1000_mg_units, #field-ziten_m_20_mg_500_mg_units, #field-ziten_units, #field-ziten_m_20_mg_1000_mg_value, #field-ziten_m_20_mg_500_mg_value, #field-ziten_value, #field-total_pob_units, #field-total_pob_value').parent().hide();
|
||||
|
||||
|
||||
// Reset Total Fields Immediately
|
||||
$('#field-total_pob_units').val(0);
|
||||
$('#field-total_pob_value').val(0);
|
||||
|
||||
// Reset all fields
|
||||
$('#field-sitazit_d_10100_pob_units, #field-sitazit_d_550_pob_units, #field-sitazit_dm_er_100010_pob_units, #field-sitazit_dm_er_50010_pob_units, #field-sitazit_d_10100_pob_value, #field-sitazit_d_550_pob_value, #field-sitazit_dm_er_100010_pob_value, #field-sitazit_dm_er_50010_pob_value, #field-eptus_25mg_units, #field-eptus_50_mg_units, #field-eptus_t_10_kit_units, #field-eptus_t_20_kit_units, #field-eptus_25mg_value, #field-eptus_50_mg_value, #field-eptus_t_10_kit_value, #field-eptus_t_20_kit_value, #field-lo_bg_05_mg_units, #field-lo_bg_05_mg_value, #field-ziten_m_20_mg_1000_mg_units, #field-ziten_m_20_mg_500_mg_units, #field-ziten_units, #field-ziten_m_20_mg_1000_mg_value, #field-ziten_m_20_mg_500_mg_value, #field-ziten_value, #field-total_pob_units, #field-total_pob_value').prop({"required":false});
|
||||
|
||||
$('#field-sitazit_d_10100_pob_units, #field-sitazit_d_550_pob_units, #field-sitazit_dm_er_100010_pob_units, #field-sitazit_dm_er_50010_pob_units, #field-sitazit_d_10100_pob_value, #field-sitazit_d_550_pob_value, #field-sitazit_dm_er_100010_pob_value, #field-sitazit_dm_er_50010_pob_value, #field-eptus_25mg_units, #field-eptus_50_mg_units, #field-eptus_t_10_kit_units, #field-eptus_t_20_kit_units, #field-eptus_25mg_value, #field-eptus_50_mg_value, #field-eptus_t_10_kit_value, #field-eptus_t_20_kit_value, #field-lo_bg_05_mg_units, #field-lo_bg_05_mg_value, #field-ziten_m_20_mg_1000_mg_units, #field-ziten_m_20_mg_500_mg_units, #field-ziten_units, #field-ziten_m_20_mg_1000_mg_value, #field-ziten_m_20_mg_500_mg_value, #field-ziten_value, #field-total_pob_units, #field-total_pob_value').parent().hide();
|
||||
|
||||
// Reset Total Immediately
|
||||
$('#field-total_pob_units').val(0);
|
||||
$('#field-total_pob_value').val(0);
|
||||
|
||||
|
||||
|
||||
|
||||
// Make Value & Total Fields Readonly
|
||||
|
||||
|
||||
$('#field-sitazit_d_10100_pob_value, #field-sitazit_d_550_pob_value, #field-sitazit_dm_er_100010_pob_value, #field-sitazit_dm_er_50010_pob_value, #field-eptus_25mg_value, #field-eptus_50_mg_value, #field-eptus_t_10_kit_value, #field-eptus_t_20_kit_value, #field-lo_bg_05_mg_value, #field-ziten_m_20_mg_1000_mg_value, #field-ziten_m_20_mg_500_mg_value, #field-ziten_value, #field-total_pob_units, #field-total_pob_value').prop('readonly', true);
|
||||
|
||||
|
||||
|
||||
// Brand Dropdown Change
|
||||
|
||||
|
||||
$('#field-select_brand').on('change',function(){
|
||||
// Reset all unit/value field values
|
||||
$('input[id*="_units"], input[id*="_value"]').val('');
|
||||
$('#field-total_pob_units').val(0);
|
||||
$('#field-total_pob_value').val(0);
|
||||
|
||||
let dropDown = $('#field-select_brand').val();
|
||||
|
||||
// Reset all fields
|
||||
$('#field-sitazit_d_10100_pob_units, #field-sitazit_d_550_pob_units, #field-sitazit_dm_er_100010_pob_units, #field-sitazit_dm_er_50010_pob_units, #field-sitazit_d_10100_pob_value, #field-sitazit_d_550_pob_value, #field-sitazit_dm_er_100010_pob_value, #field-sitazit_dm_er_50010_pob_value, #field-eptus_25mg_units, #field-eptus_50_mg_units, #field-eptus_t_10_kit_units, #field-eptus_t_20_kit_units, #field-eptus_25mg_value, #field-eptus_50_mg_value, #field-eptus_t_10_kit_value, #field-eptus_t_20_kit_value, #field-lo_bg_05_mg_units, #field-lo_bg_05_mg_value, #field-ziten_m_20_mg_1000_mg_units, #field-ziten_m_20_mg_500_mg_units, #field-ziten_units, #field-ziten_m_20_mg_1000_mg_value, #field-ziten_m_20_mg_500_mg_value, #field-ziten_value, #field-total_pob_units, #field-total_pob_value').prop({"required":false});
|
||||
|
||||
$('#field-sitazit_d_10100_pob_units, #field-sitazit_d_550_pob_units, #field-sitazit_dm_er_100010_pob_units, #field-sitazit_dm_er_50010_pob_units, #field-sitazit_d_10100_pob_value, #field-sitazit_d_550_pob_value, #field-sitazit_dm_er_100010_pob_value, #field-sitazit_dm_er_50010_pob_value, #field-eptus_25mg_units, #field-eptus_50_mg_units, #field-eptus_t_10_kit_units, #field-eptus_t_20_kit_units, #field-eptus_25mg_value, #field-eptus_50_mg_value, #field-eptus_t_10_kit_value, #field-eptus_t_20_kit_value, #field-lo_bg_05_mg_units, #field-lo_bg_05_mg_value, #field-ziten_m_20_mg_1000_mg_units, #field-ziten_m_20_mg_500_mg_units, #field-ziten_units, #field-ziten_m_20_mg_1000_mg_value, #field-ziten_m_20_mg_500_mg_value, #field-ziten_value, #field-total_pob_units, #field-total_pob_value').parent().hide();
|
||||
|
||||
|
||||
|
||||
// Sitazit
|
||||
|
||||
if(dropDown === 'Sitazit'){
|
||||
|
||||
$('#field-sitazit_d_10100_pob_units, #field-sitazit_d_550_pob_units, #field-sitazit_dm_er_100010_pob_units, #field-sitazit_dm_er_50010_pob_units, #field-sitazit_d_10100_pob_value, #field-sitazit_d_550_pob_value, #field-sitazit_dm_er_100010_pob_value, #field-sitazit_dm_er_50010_pob_value').prop({"required":true});
|
||||
|
||||
$('#field-sitazit_d_10100_pob_units, #field-sitazit_d_550_pob_units, #field-sitazit_dm_er_100010_pob_units, #field-sitazit_dm_er_50010_pob_units, #field-sitazit_d_10100_pob_value, #field-sitazit_d_550_pob_value, #field-sitazit_dm_er_100010_pob_value, #field-sitazit_dm_er_50010_pob_value').parent().show();
|
||||
|
||||
$('#field-total_pob_units, #field-total_pob_value').prop({"required":true});
|
||||
$('#field-total_pob_units, #field-total_pob_value').parent().show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Eptus
|
||||
|
||||
else if(dropDown === 'Eptus'){
|
||||
|
||||
$('#field-eptus_25mg_units, #field-eptus_50_mg_units, #field-eptus_t_10_kit_units, #field-eptus_t_20_kit_units, #field-eptus_25mg_value, #field-eptus_50_mg_value, #field-eptus_t_10_kit_value, #field-eptus_t_20_kit_value').prop({"required":true});
|
||||
|
||||
$('#field-eptus_25mg_units, #field-eptus_50_mg_units, #field-eptus_t_10_kit_units, #field-eptus_t_20_kit_units, #field-eptus_25mg_value, #field-eptus_50_mg_value, #field-eptus_t_10_kit_value, #field-eptus_t_20_kit_value').parent().show();
|
||||
|
||||
$('#field-total_pob_units, #field-total_pob_value').prop({"required":true});
|
||||
$('#field-total_pob_units, #field-total_pob_value').parent().show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// LOBG
|
||||
|
||||
else if(dropDown === 'LOBG'){
|
||||
|
||||
$('#field-lo_bg_05_mg_units, #field-lo_bg_05_mg_value').prop({"required":true});
|
||||
|
||||
$('#field-lo_bg_05_mg_units, #field-lo_bg_05_mg_value').parent().show();
|
||||
|
||||
$('#field-total_pob_units, #field-total_pob_value').prop({"required":true});
|
||||
$('#field-total_pob_units, #field-total_pob_value').parent().show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Ziten
|
||||
|
||||
else if(dropDown === 'Ziten'){
|
||||
|
||||
$('#field-ziten_m_20_mg_1000_mg_units, #field-ziten_m_20_mg_500_mg_units, #field-ziten_units, #field-ziten_m_20_mg_1000_mg_value, #field-ziten_m_20_mg_500_mg_value, #field-ziten_value').prop({"required":true});
|
||||
|
||||
$('#field-ziten_m_20_mg_1000_mg_units, #field-ziten_m_20_mg_500_mg_units, #field-ziten_units, #field-ziten_m_20_mg_1000_mg_value, #field-ziten_m_20_mg_500_mg_value, #field-ziten_value').parent().show();
|
||||
|
||||
$('#field-total_pob_units, #field-total_pob_value').prop({"required":true});
|
||||
$('#field-total_pob_units, #field-total_pob_value').parent().show();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Auto Calculation Function
|
||||
// Formula = Units * 100
|
||||
|
||||
|
||||
// Auto Calculation Function
|
||||
|
||||
function calculateField(unitField, valueField, ptsValue){
|
||||
|
||||
$(unitField).on('input', function(){
|
||||
|
||||
let units = parseInt($(this).val()) || 0;
|
||||
|
||||
// Formula = Units × PTS
|
||||
let value = units * ptsValue;
|
||||
|
||||
// Round to 2 decimal
|
||||
value = value.toFixed(2);
|
||||
|
||||
$(valueField).val(value);
|
||||
|
||||
calculateTotals();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Total Calculation
|
||||
|
||||
|
||||
// function calculateTotals(){
|
||||
|
||||
// let totalUnits = 0;
|
||||
// let totalValue = 0;
|
||||
|
||||
|
||||
// // Total Units (Visible Only)
|
||||
|
||||
// $('input[id*="_units"]:visible').each(function(){
|
||||
|
||||
// if($(this).attr('id') !== 'field-total_pob_units'){
|
||||
|
||||
// totalUnits += parseFloat($(this).val()) || 0;
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
// // Total Value (Visible Only)
|
||||
|
||||
// $('input[id*="_value"]:visible').each(function(){
|
||||
|
||||
// if($(this).attr('id') !== 'field-total_pob_value'){
|
||||
|
||||
// totalValue += parseFloat($(this).val()) || 0;
|
||||
// }
|
||||
// });
|
||||
|
||||
// $('#field-total_pob_units').val(totalUnits);
|
||||
// $('#field-total_pob_value').val(totalValue);
|
||||
// }
|
||||
function calculateTotals(){
|
||||
|
||||
let totalUnits = 0;
|
||||
let totalValue = 0;
|
||||
|
||||
// Total Units
|
||||
$('input[id*="_units"]:visible').each(function(){
|
||||
|
||||
if($(this).attr('id') !== 'field-total_pob_units'){
|
||||
|
||||
totalUnits += parseInt($(this).val()) || 0;
|
||||
}
|
||||
});
|
||||
|
||||
// Total Value
|
||||
$('input[id*="_value"]:visible').each(function(){
|
||||
|
||||
if($(this).attr('id') !== 'field-total_pob_value'){
|
||||
|
||||
totalValue += parseFloat($(this).val()) || 0;
|
||||
}
|
||||
});
|
||||
|
||||
$('#field-total_pob_units').val(totalUnits);
|
||||
|
||||
// Round total value
|
||||
$('#field-total_pob_value').val(totalValue.toFixed(2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Bind Calculations
|
||||
|
||||
|
||||
|
||||
// Sitazit
|
||||
|
||||
|
||||
calculateField(
|
||||
'#field-sitazit_d_10100_pob_units',
|
||||
'#field-sitazit_d_10100_pob_value',
|
||||
160.71
|
||||
);
|
||||
|
||||
calculateField(
|
||||
'#field-sitazit_d_550_pob_units',
|
||||
'#field-sitazit_d_550_pob_value',
|
||||
114.75
|
||||
);
|
||||
|
||||
calculateField(
|
||||
'#field-sitazit_dm_er_100010_pob_units',
|
||||
'#field-sitazit_dm_er_100010_pob_value',
|
||||
182.25
|
||||
);
|
||||
|
||||
calculateField(
|
||||
'#field-sitazit_dm_er_50010_pob_units',
|
||||
'#field-sitazit_dm_er_50010_pob_value',
|
||||
168.10
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Eptus
|
||||
|
||||
|
||||
calculateField(
|
||||
'#field-eptus_25mg_units',
|
||||
'#field-eptus_25mg_value',
|
||||
207.96
|
||||
);
|
||||
|
||||
calculateField(
|
||||
'#field-eptus_50_mg_units',
|
||||
'#field-eptus_50_mg_value',
|
||||
326.25
|
||||
);
|
||||
|
||||
calculateField(
|
||||
'#field-eptus_t_10_kit_units',
|
||||
'#field-eptus_t_10_kit_value',
|
||||
225
|
||||
);
|
||||
|
||||
calculateField(
|
||||
'#field-eptus_t_20_kit_units',
|
||||
'#field-eptus_t_20_kit_value',
|
||||
242.36
|
||||
);
|
||||
|
||||
|
||||
|
||||
// LOBG
|
||||
|
||||
|
||||
calculateField(
|
||||
'#field-lo_bg_05_mg_units',
|
||||
'#field-lo_bg_05_mg_value',
|
||||
73.93
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Ziten
|
||||
|
||||
|
||||
calculateField(
|
||||
'#field-ziten_m_20_mg_1000_mg_units',
|
||||
'#field-ziten_m_20_mg_1000_mg_value',
|
||||
78.64
|
||||
);
|
||||
|
||||
calculateField(
|
||||
'#field-ziten_m_20_mg_500_mg_units',
|
||||
'#field-ziten_m_20_mg_500_mg_value',
|
||||
82.29
|
||||
);
|
||||
|
||||
calculateField(
|
||||
'#field-ziten_units',
|
||||
'#field-ziten_value',
|
||||
63.64
|
||||
);
|
||||
|
||||
// Allow Only Positive Whole Numbers
|
||||
// No Decimal & No Negative
|
||||
|
||||
$('input[id*="_units"]').on('input', function () {
|
||||
|
||||
// Remove non-numeric characters
|
||||
let value = $(this).val().replace(/[^0-9]/g, '');
|
||||
|
||||
// Prevent leading zeros like 0005
|
||||
value = value.replace(/^0+(?=\d)/, '');
|
||||
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
|
||||
// Block Special Keys
|
||||
|
||||
$('input[id*="_units"]').on('keydown', function (e) {
|
||||
|
||||
// Block decimal, minus, plus
|
||||
if (
|
||||
e.key === '.' ||
|
||||
e.key === '-' ||
|
||||
e.key === '+' ||
|
||||
e.key === 'e'
|
||||
) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
// $('#field-user_id').change(function(){
|
||||
// let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
// $('#field-hierarchy_id').val(hierarchy)
|
||||
// event.preventDefault();
|
||||
// $.ajax({
|
||||
// type: "GET",
|
||||
// url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
// processData: false,
|
||||
// contentType: false,
|
||||
// success: function( data ) {
|
||||
// $("#pageloader").fadeOut();
|
||||
// $('#field-contact_id').html('')
|
||||
// $('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
// for(let itm of data) {
|
||||
// $('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
// }
|
||||
// },
|
||||
// });
|
||||
|
||||
// console.log(hierarchy)
|
||||
// })
|
||||
|
||||
$('#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'
|
||||
})
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: data.hasOwnProperty('message') ? 'You are not mapped to any position code' : 'Data not submitted',
|
||||
text: data.hasOwnProperty('message') ? 'for resolution please email Position code, L1 Manager and L2 Manager details to support1@stratawiz.com':'Something went wrong, please try again after some time!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#field-contact_id").change(function(){
|
||||
|
||||
let selected = $('option:selected', this);
|
||||
|
||||
console.log(selected.attr('msl_code'));
|
||||
console.log(selected.attr('speciality'));
|
||||
|
||||
$('#field-msl_code').val(selected.attr('msl_code'));
|
||||
$('#field-speciality').val(selected.attr('speciality'));
|
||||
|
||||
});
|
||||
|
||||
// Auto populate Total LOBG Rx from LO-BG 0.5 mg Rx
|
||||
|
||||
function calculateTotalLOBGRx() {
|
||||
|
||||
let loBgRx = parseFloat($('#field-lo_bg_05_mg_rx').val()) || 0;
|
||||
|
||||
$('#field-total_lobg_rx').val(loBgRx);
|
||||
}
|
||||
|
||||
// Trigger on typing/change
|
||||
$('#field-lo_bg_05_mg_rx').on('keyup change', function () {
|
||||
calculateTotalLOBGRx();
|
||||
});
|
||||
|
||||
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 plandateField = document.getElementById('field-record_date');
|
||||
|
||||
plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -47,7 +47,15 @@ $brandData = [
|
|||
|
||||
['brand'=>"AZEE 500 Tablets 1 x 5'S", 'slug'=>'azee_500_tablets_1_x_5s_units','pseudoId'=>'azee_500_tablets_1_x_5s_value'],
|
||||
['brand'=>"AZEE 500 TABLETS 5'S", 'slug'=>'azee_500_tablets_5s_units','pseudoId'=>'azee_500_tablets_5s_value'],
|
||||
['brand'=>'AZEE PULSE 3 TABLETS', 'slug'=>'azee_pulse_3_tablets_units','pseudoId'=>'azee_pulse_3_tablets_value'],
|
||||
/* ['brand'=>'AZEE PULSE 3 TABLETS', 'slug'=>'azee_pulse_3_tablets_units','pseudoId'=>'azee_pulse_3_tablets_value'] ,*/
|
||||
|
||||
['brand'=>"Bilafav M", 'slug'=>'bilafav_m_units','pseudoId'=>'bilafav_m_value'],
|
||||
['brand'=>"Bilafav M ODT Adult Tablets 1x10s - 20/10", 'slug'=>'bilafav_m_odt_adult_tablets_1x10s_2010_units','pseudoId'=>'bilafav_m_odt_adult_tablets_1x10s_2010_value'],
|
||||
['brand'=>"Bilafav M ODT Pedia Tablets 1X10s 10/4", 'slug'=>'bilafav_m_odt_pedia_tablets_1x10s_104_units','pseudoId'=>'bilafav_m_odt_pedia_tablets_1x10s_104_value'],
|
||||
|
||||
['brand'=>"Bilafav M Oral suspension", 'slug'=>'bilafav_m_oral_suspension_units','pseudoId'=>'bilafav_m_oral_suspension_value'],
|
||||
|
||||
|
||||
['brand'=>"CIVONO 10 MG TABLETS 10'S", 'slug'=>'civono_10_mg_tablets_10s_units','pseudoId'=>'civono_10_mg_tablets_10s_value'],
|
||||
['brand'=>"CIVONO 20 MG TABLETS 10'S", 'slug'=>'civono_20_mg_tablets_10s_units','pseudoId'=>'civono_20_mg_tablets_10s_value'],
|
||||
['brand'=>'COREX-DX COUGH SYRUP 100ML (IP)', 'slug'=>'corex_dx_cough_syrup_100ml_ip_units','pseudoId'=>'corex_dx_cough_syrup_100ml_ip_value'],
|
||||
|
|
@ -61,7 +69,7 @@ $brandData = [
|
|||
['brand'=>"FAROBACT 200 TABS 1 x 10 S", 'slug'=>'farobact_200_tabs_1_x_10_s_units','pseudoId'=>'farobact_200_tabs_1_x_10_s_value'],
|
||||
['brand'=>'Farobact 300 ER TABLETS', 'slug'=>'farobact_300_er_tablets_units','pseudoId'=>'farobact_300_er_tablets_value'],
|
||||
['brand'=>"FAROBACT 300 ER TABS 10 S", 'slug'=>'farobact_300_er_tabs_10_s_units','pseudoId'=>'farobact_300_er_tabs_10_s_value'],
|
||||
['brand'=>"Farobact Dry Syrup", 'slug'=>'farobact_dry_syrup_units','pseudoId'=>'farobact_dry_syrup_value'],
|
||||
/* ['brand'=>"Farobact Dry Syrup", 'slug'=>'farobact_dry_syrup_units','pseudoId'=>'farobact_dry_syrup_value'] ,*/
|
||||
['brand'=>'FLOMIST AQ. 100MD', 'slug'=>'flomist_aq_100md_units','pseudoId'=>'flomist_aq_100md_value'],
|
||||
['brand'=>'Flomist F 240 MD', 'slug'=>'flomist_f_240_md_units','pseudoId'=>'flomist_f_240_md_value'],
|
||||
['brand'=>"Flomist F 27.5 MCG 120 MD", 'slug'=>'flomist_f_275_mcg_120_md_units','pseudoId'=>'flomist_f_275_mcg_120_md_value'],
|
||||
|
|
@ -86,7 +94,7 @@ $brandData = [
|
|||
['brand'=>"OFLOX 200 TAB (10'S)", 'slug'=>'oflox_200_tab_10s_units','pseudoId'=>'oflox_200_tab_10s_value'],
|
||||
['brand'=>"OFLOX 400 10'S", 'slug'=>'oflox_400_10s_units','pseudoId'=>'oflox_400_10s_value'],
|
||||
['brand'=>'OFLOX 50MG REDIUSE 60ML', 'slug'=>'oflox_50mg_rediuse_60ml_units','pseudoId'=>'oflox_50mg_rediuse_60ml_value'],
|
||||
['brand'=>"OFLOX EYE DROPS", 'slug'=>'oflox_eye_drops_units','pseudoId'=>'oflox_eye_drops_value'],
|
||||
/* ['brand'=>"OFLOX EYE DROPS", 'slug'=>'oflox_eye_drops_units','pseudoId'=>'oflox_eye_drops_value'] ,*/
|
||||
['brand'=>"OFLOX OZ TABLETS IP", 'slug'=>'oflox_oz_tablets_ip_units','pseudoId'=>'oflox_oz_tablets_ip_value'],
|
||||
['brand'=>"OFLOX REDIUSE", 'slug'=>'oflox_rediuse_units','pseudoId'=>'oflox_rediuse_value'],
|
||||
|
||||
|
|
@ -425,292 +433,143 @@ if (!empty($submissions->data->submissions)) {
|
|||
})
|
||||
|
||||
|
||||
$(`#field-acivir_200_dt_units,#field-acivir_400_dt_units,#field-acivir_400_dt_10s_units,#field-acivir_800_dt_units,#field-acivir_800_dt_tablets_1x10s_units,#field-acivir_cream_10_gm_units,#field-advent_1000_mg_units,#field-advent_457_dt_6s_units,#field-advent_457_dt_tablets_units,#field-advent_625_tablets_10s_units,
|
||||
#field-advent_drops_10ml_units,#field-advent_es_units,#field-advent_forte_457_syp_60_ml_units,#field-advent_forte_syp_30m_units,#field-advent_kid_2285_tab_units,#field-advent_syp_2285mg_units,#field-advent_syrup_units,#field-azee_500_tabs_units,#field-azee_100_ds_15ml_units,#field-azee_100_dt_units,
|
||||
#field-azee_100_ip_100mg5ml_15ml_units,#field-azee_100_xl_dry_syru_units,#field-azee_100_xl_liquids_30_ml_100mg5ml_units,#field-azee_1000_units,#field-azee_200_ds_15ml_units,#field-azee_200_ip_200mg5ml_15ml_units,#field-azee_200_xl_dry_syru_units,#field-azee_200_xl_liquids_30_ml_200mg5ml_units,#field-azee_250_tablets10s_units,#field-azee_250_tabs_units,
|
||||
#field-azee_500_tablets_1_x_5s_units,#field-azee_500_tablets_5s_units,#field-azee_pulse_3_tablets_units,#field-civono_10_mg_tablets_10s_units,#field-civono_20_mg_tablets_10s_units,#field-corex_dx_cough_syrup_100ml_ip_units,#field-corex_dx_cough_syrup_50ml_ip_units,#field-cpink_200ml_units,#field-cpink_drops_15ml_units,#field-cpink_suspension_150ml_units,
|
||||
#field-farobact_200_units,#field-farobact_200_tabs_1_x_10_s_units,#field-farobact_300_er_tablets_units,#field-farobact_300_er_tabs_10_s_units,#field-farobact_dry_syrup_units,#field-flomist_aq_100md_units,#field-flomist_f_240_md_units,#field-flomist_f_275_mcg_120_md_units,#field-ibugesic_plus_tablets_20s_units,#field-ibugesic_plus_tablets_20s_ip_units,
|
||||
#field-omnix_100_ds_units,#field-omnix_100_dry_syrup_units,#field-omnix_100_dt_tab_units,#field-omnix_200_dt_tab_units,#field-omnix_50_dry_syrup_units,#field-omnix_50_dt_units,#field-omnix_cv_200_tab_units,#field-omnix_o_units,#field-emeset_4_odtindia1_x_10s_units,#field-emeset_4mg_10s_units,
|
||||
#field-emeset_8mg_10s_units,#field-emeset_syrup_units,#field-emeset_syrup_strawberry_30_ml_units,#field-oflox_100mg_rediuse_60ml_units,#field-oflox_200_tab_10s_units,#field-oflox_400_10s_units,#field-oflox_50mg_rediuse_60ml_units,#field-oflox_eye_drops_units,#field-oflox_oz_tablets_ip_units,#field-oflox_rediuse_units,
|
||||
#field-oflox_200_mg_10s_tablets_ip_units,#field-oflox_400_mg_10s_tablets_ip_units,#field-emset_r_10_x_10_tablets_units,#field-montair_ab_tablet_units,#field-pansec_80_mg_tablets_units,#field-pansec_d_sr_capsules_15s_units,#field-pansec_tablets_15s_units,#field-pansec_l_capsules_units`).on('change',function(){
|
||||
let totalvalue=(
|
||||
(parseInt($('#field-acivir_200_dt_units').val())*61.69||0)+
|
||||
(parseInt($('#field-acivir_400_dt_units').val())*55.60||0)+
|
||||
(parseInt($('#field-acivir_400_dt_10s_units').val())*111.20||0)+
|
||||
(parseInt($('#field-acivir_800_dt_units').val())*153.27||0)+
|
||||
(parseInt($('#field-acivir_800_dt_tablets_1x10s_units').val())*306.54||0)+
|
||||
(parseInt($('#field-acivir_cream_10_gm_units').val())*139.18||0)+
|
||||
(parseInt($('#field-advent_1000_mg_units').val())*421.74||0)+
|
||||
(parseInt($('#field-advent_457_dt_6s_units').val())*140.34||0)+
|
||||
(parseInt($('#field-advent_457_dt_tablets_units').val())*257.26||0)+
|
||||
(parseInt($('#field-advent_625_tablets_10s_units').val())*148.95||0)+
|
||||
|
||||
(parseInt($('#field-advent_drops_10ml_units').val())*100.57||0)+
|
||||
(parseInt($('#field-advent_es_units').val())*163.03||0)+
|
||||
(parseInt($('#field-advent_forte_457_syp_60_ml_units').val())*227.76||0)+
|
||||
(parseInt($('#field-advent_forte_syp_30m_units').val())*184.18||0)+
|
||||
(parseInt($('#field-advent_kid_2285_tab_units').val())*174.67||0)+
|
||||
(parseInt($('#field-advent_syp_2285mg_units').val())*98.87||0)+
|
||||
(parseInt($('#field-advent_syrup_units').val())*49.43||0)+
|
||||
(parseInt($('#field-azee_500_tabs_units').val())*57.55||0)+
|
||||
(parseInt($('#field-azee_100_ds_15ml_units').val())*39.64||0)+
|
||||
(parseInt($('#field-azee_100_dt_units').val())*29.05||0)+
|
||||
|
||||
(parseInt($('#field-azee_100_ip_100mg5ml_15ml_units').val())*39.64||0)+
|
||||
(parseInt($('#field-azee_100_xl_dry_syru_units').val())*80.00||0)+
|
||||
(parseInt($('#field-azee_100_xl_liquids_30_ml_100mg5ml_units').val())*80.00||0)+
|
||||
(parseInt($('#field-azee_1000_units').val())*47.02||0)+
|
||||
(parseInt($('#field-azee_200_ds_15ml_units').val())*41.62||0)+
|
||||
(parseInt($('#field-azee_200_ip_200mg5ml_15ml_units').val())*41.62||0)+
|
||||
(parseInt($('#field-azee_200_xl_dry_syru_units').val())*83.28||0)+
|
||||
(parseInt($('#field-azee_200_xl_liquids_30_ml_200mg5ml_units').val())*83.28||0)+
|
||||
(parseInt($('#field-azee_250_tablets10s_units').val())*94.96||0)+
|
||||
(parseInt($('#field-azee_250_tabs_units').val())*56.97||0)+
|
||||
|
||||
(parseInt($('#field-azee_500_tablets_1_x_5s_units').val())*95.91||0)+
|
||||
(parseInt($('#field-azee_500_tablets_5s_units').val())*95.91||0)+
|
||||
(parseInt($('#field-azee_pulse_3_tablets_units').val())*57.55||0)+
|
||||
(parseInt($('#field-civono_10_mg_tablets_10s_units').val())*78.57||0)+
|
||||
(parseInt($('#field-civono_20_mg_tablets_10s_units').val())*121.42||0)+
|
||||
(parseInt($('#field-corex_dx_cough_syrup_100ml_ip_units').val())*121.78||0)+
|
||||
(parseInt($('#field-corex_dx_cough_syrup_50ml_ip_units').val())*80.37||0)+
|
||||
(parseInt($('#field-cpink_200ml_units').val())*246.62||0)+
|
||||
(parseInt($('#field-cpink_drops_15ml_units').val())*94.42||0)+
|
||||
(parseInt($('#field-cpink_suspension_150ml_units').val())*138.97||0)+
|
||||
|
||||
|
||||
(parseInt($('#field-farobact_200_units').val())*495.21||0)+
|
||||
(parseInt($('#field-farobact_200_tabs_1_x_10_s_units').val())*998.67||0)+
|
||||
(parseInt($('#field-farobact_300_er_tablets_units').val())*543.80||0)+
|
||||
(parseInt($('#field-farobact_300_er_tabs_10_s_units').val())*1096.66||0)+
|
||||
(parseInt($('#field-farobact_dry_syrup_units').val())*423.50||0)+
|
||||
(parseInt($('#field-flomist_aq_100md_units').val())*367.44||0)+
|
||||
(parseInt($('#field-flomist_f_240_md_units').val())*616.78||0)+
|
||||
(parseInt($('#field-flomist_f_275_mcg_120_md_units').val())*444.50||0)+
|
||||
(parseInt($('#field-ibugesic_plus_tablets_20s_units').val())*31.61||0)+
|
||||
(parseInt($('#field-ibugesic_plus_tablets_20s_ip_units').val())*31.61||0)+
|
||||
const products = {
|
||||
acivir_200_dt: 61.91,
|
||||
acivir_400_dt: 55.60,
|
||||
acivir_400_dt_10s: 111.20,
|
||||
acivir_800_dt: 153.27,
|
||||
acivir_800_dt_tablets_1x10s: 306.54,
|
||||
acivir_cream_10_gm: 139.18,
|
||||
|
||||
(parseInt($('#field-omnix_100_ds_units').val())*58.31||0)+
|
||||
(parseInt($('#field-omnix_100_dry_syrup_units').val())*116.64||0)+
|
||||
(parseInt($('#field-omnix_100_dt_tab_units').val())*87.48||0)+
|
||||
(parseInt($('#field-omnix_200_dt_tab_units').val())*79.59||0)+
|
||||
(parseInt($('#field-omnix_50_dry_syrup_units').val())*39.83||0)+
|
||||
(parseInt($('#field-omnix_50_dt_units').val())*55.54||0)+
|
||||
(parseInt($('#field-omnix_cv_200_tab_units').val())*291.61||0)+
|
||||
(parseInt($('#field-omnix_o_units').val())*183.71||0)+
|
||||
(parseInt($('#field-emeset_4_odtindia1_x_10s_units').val())*41.83||0)+
|
||||
(parseInt($('#field-emeset_4mg_10s_units').val())*41.83||0)+
|
||||
advent_1000_mg: 421.74,
|
||||
advent_457_dt_6s: 140.34,
|
||||
advent_457_dt_tablets: 257.26,
|
||||
advent_625_tablets_10s: 148.95,
|
||||
advent_drops_10ml: 100.57,
|
||||
advent_es: 163.03,
|
||||
advent_forte_457_syp_60_ml: 227.76,
|
||||
advent_forte_syp_30m: 184.18,
|
||||
advent_kid_2285_tab: 174.67,
|
||||
advent_syp_2285mg: 98.87,
|
||||
advent_syrup: 49.43,
|
||||
|
||||
(parseInt($('#field-emeset_8mg_10s_units').val())*73.75||0)+
|
||||
(parseInt($('#field-emeset_syrup_units').val())*30.71||0)+
|
||||
(parseInt($('#field-emeset_syrup_strawberry_30_ml_units').val())*30.71||0)+
|
||||
(parseInt($('#field-oflox_100mg_rediuse_60ml_units').val())*141.25||0)+
|
||||
(parseInt($('#field-oflox_200_tab_10s_units').val())*84.19||0)+
|
||||
(parseInt($('#field-oflox_400_10s_units').val())*305.58||0)+
|
||||
(parseInt($('#field-oflox_50mg_rediuse_60ml_units').val())*66.78||0)+
|
||||
(parseInt($('#field-oflox_eye_drops_units').val())*38.58||0)+
|
||||
(parseInt($('#field-oflox_oz_tablets_ip_units').val())*157.25||0)+
|
||||
(parseInt($('#field-oflox_rediuse_units').val())*66.78||0)+
|
||||
azee_500_tabs: 57.55,
|
||||
azee_100_ds_15ml: 39.64,
|
||||
azee_100_dt: 29.05,
|
||||
azee_100_ip_100mg5ml_15ml: 39.64,
|
||||
azee_100_xl_dry_syru: 80.00,
|
||||
azee_100_xl_liquids_30_ml_100mg5ml: 80.00,
|
||||
azee_1000: 47.02,
|
||||
azee_200_ds_15ml: 41.62,
|
||||
azee_200_ip_200mg5ml_15ml: 41.62,
|
||||
azee_200_xl_dry_syru: 83.28,
|
||||
azee_200_xl_liquids_30_ml_200mg5ml: 83.28,
|
||||
azee_250_tablets10s: 94.96,
|
||||
azee_250_tabs: 56.97,
|
||||
azee_500_tablets_1_x_5s: 95.91,
|
||||
azee_500_tablets_5s: 95.91,
|
||||
azee_pulse_3_tablets: 57.55,
|
||||
|
||||
(parseInt($('#field-oflox_200_mg_10s_tablets_ip_units').val())*84.19||0)+
|
||||
(parseInt($('#field-oflox_400_mg_10s_tablets_ip_units').val())*305.58||0)+
|
||||
(parseInt($('#field-emset_r_10_x_10_tablets_units').val())*60.09||0)+
|
||||
(parseInt($('#field-montair_ab_tablet_units').val())*238.11||0)+
|
||||
(parseInt($('#field-pansec_80_mg_tablets_units').val())*226.21||0)+
|
||||
(parseInt($('#field-pansec_d_sr_capsules_15s_units').val())*235.22||0)+
|
||||
(parseInt($('#field-pansec_tablets_15s_units').val())*197.71||0)+
|
||||
(parseInt($('#field-pansec_l_capsules_units').val())*132.21||0)
|
||||
civono_10_mg_tablets_10s: 78.57,
|
||||
civono_20_mg_tablets_10s: 121.42,
|
||||
|
||||
corex_dx_cough_syrup_100ml_ip: 121.78,
|
||||
corex_dx_cough_syrup_50ml_ip: 80.37,
|
||||
|
||||
cpink_200ml: 246.62,
|
||||
cpink_drops_15ml: 94.42,
|
||||
cpink_suspension_150ml: 138.97,
|
||||
|
||||
farobact_200: 495.21,
|
||||
farobact_200_tabs_1_x_10_s: 998.67,
|
||||
farobact_300_er_tablets: 543.80,
|
||||
farobact_300_er_tabs_10_s: 1096.66,
|
||||
farobact_dry_syrup: 423.50,
|
||||
|
||||
flomist_aq_100md: 367.44,
|
||||
flomist_f_240_md: 616.78,
|
||||
flomist_f_275_mcg_120_md: 444.50,
|
||||
|
||||
ibugesic_plus_tablets_20s: 31.61,
|
||||
ibugesic_plus_tablets_20s_ip: 31.61,
|
||||
|
||||
omnix_100_ds: 58.31,
|
||||
omnix_100_dry_syrup: 116.64,
|
||||
omnix_100_dt_tab: 87.48,
|
||||
omnix_200_dt_tab: 79.59,
|
||||
omnix_50_dry_syrup: 39.83,
|
||||
omnix_50_dt: 55.54,
|
||||
omnix_cv_200_tab: 291.61,
|
||||
omnix_o: 183.71,
|
||||
|
||||
emeset_4_odtindia1_x_10s: 41.83,
|
||||
emeset_4mg_10s: 41.83,
|
||||
emeset_8mg_10s: 73.75,
|
||||
emeset_syrup: 30.71,
|
||||
emeset_syrup_strawberry_30_ml: 30.71,
|
||||
|
||||
oflox_100mg_rediuse_60ml: 141.25,
|
||||
oflox_200_tab_10s: 84.19,
|
||||
oflox_400_10s: 305.58,
|
||||
oflox_50mg_rediuse_60ml: 66.78,
|
||||
oflox_eye_drops: 38.58,
|
||||
oflox_oz_tablets_ip: 157.25,
|
||||
oflox_rediuse: 66.78,
|
||||
oflox_200_mg_10s_tablets_ip: 84.19,
|
||||
oflox_400_mg_10s_tablets_ip: 305.58,
|
||||
|
||||
emset_r_10_x_10_tablets: 60.09,
|
||||
|
||||
montair_ab_tablet: 238.11,
|
||||
|
||||
pansec_80_mg_tablets: 226.21,
|
||||
pansec_d_sr_capsules_15s: 235.22,
|
||||
pansec_tablets_15s: 197.71,
|
||||
pansec_l_capsules: 132.21,
|
||||
|
||||
bilafav_m: 167.31,
|
||||
bilafav_m_odt_pedia_tablets_1x10s_104: 55.31,
|
||||
bilafav_m_odt_adult_tablets_1x10s_2010: 100.62,
|
||||
|
||||
|
||||
);
|
||||
bilafav_m_oral_suspension: 140.69
|
||||
};
|
||||
|
||||
let totalUnits=(
|
||||
(parseInt($('#field-acivir_200_dt_units').val())||0)+
|
||||
(parseInt($('#field-acivir_400_dt_units').val())||0)+
|
||||
(parseInt($('#field-acivir_400_dt_10s_units').val())||0)+
|
||||
(parseInt($('#field-acivir_800_dt_units').val())||0)+
|
||||
(parseInt($('#field-acivir_800_dt_tablets_1x10s_units').val())||0)+
|
||||
(parseInt($('#field-acivir_cream_10_gm_units').val())||0)+
|
||||
(parseInt($('#field-advent_1000_mg_units').val())||0)+
|
||||
(parseInt($('#field-advent_457_dt_6s_units').val())||0)+
|
||||
(parseInt($('#field-advent_457_dt_tablets_units').val())||0)+
|
||||
(parseInt($('#field-advent_625_tablets_10s_units').val())||0)+
|
||||
$(document).on('input change', '[id^="field-"][id$="_units"]', function () {
|
||||
|
||||
(parseInt($('#field-advent_drops_10ml_units').val())||0)+
|
||||
(parseInt($('#field-advent_es_units').val())||0)+
|
||||
(parseInt($('#field-advent_forte_457_syp_60_ml_units').val())||0)+
|
||||
(parseInt($('#field-advent_forte_syp_30m_units').val())||0)+
|
||||
(parseInt($('#field-advent_kid_2285_tab_units').val())||0)+
|
||||
(parseInt($('#field-advent_syp_2285mg_units').val())||0)+
|
||||
(parseInt($('#field-advent_syrup_units').val())||0)+
|
||||
(parseInt($('#field-azee_500_tabs_units').val())||0)+
|
||||
(parseInt($('#field-azee_100_ds_15ml_units').val())||0)+
|
||||
(parseInt($('#field-azee_100_dt_units').val())||0)+
|
||||
let totalValue = 0;
|
||||
let totalUnits = 0;
|
||||
|
||||
(parseInt($('#field-azee_100_ip_100mg5ml_15ml_units').val())||0)+
|
||||
(parseInt($('#field-azee_100_xl_dry_syru_units').val())||0)+
|
||||
(parseInt($('#field-azee_100_xl_liquids_30_ml_100mg5ml_units').val())||0)+
|
||||
(parseInt($('#field-azee_1000_units').val())||0)+
|
||||
(parseInt($('#field-azee_200_ds_15ml_units').val())||0)+
|
||||
(parseInt($('#field-azee_200_ip_200mg5ml_15ml_units').val())||0)+
|
||||
(parseInt($('#field-azee_200_xl_dry_syru_units').val())||0)+
|
||||
(parseInt($('#field-azee_200_xl_liquids_30_ml_200mg5ml_units').val())||0)+
|
||||
(parseInt($('#field-azee_250_tablets10s_units').val())||0)+
|
||||
(parseInt($('#field-azee_250_tabs_units').val())||0)+
|
||||
$.each(products, function (key, rate) {
|
||||
|
||||
(parseInt($('#field-azee_500_tablets_1_x_5s_units').val())||0)+
|
||||
(parseInt($('#field-azee_500_tablets_5s_units').val())||0)+
|
||||
(parseInt($('#field-azee_pulse_3_tablets_units').val())||0)+
|
||||
(parseInt($('#field-civono_10_mg_tablets_10s_units').val())||0)+
|
||||
(parseInt($('#field-civono_20_mg_tablets_10s_units').val())||0)+
|
||||
(parseInt($('#field-corex_dx_cough_syrup_100ml_ip_units').val())||0)+
|
||||
(parseInt($('#field-corex_dx_cough_syrup_50ml_ip_units').val())||0)+
|
||||
(parseInt($('#field-cpink_200ml_units').val())||0)+
|
||||
(parseInt($('#field-cpink_drops_15ml_units').val())||0)+
|
||||
(parseInt($('#field-cpink_suspension_150ml_units').val())||0)+
|
||||
let unitsField = $(`#field-${key}_units`);
|
||||
let valueField = $(`#field-${key}_value`);
|
||||
|
||||
if (unitsField.length) {
|
||||
|
||||
(parseInt($('#field-farobact_200_units').val())||0)+
|
||||
(parseInt($('#field-farobact_200_tabs_1_x_10_s_units').val())||0)+
|
||||
(parseInt($('#field-farobact_300_er_tablets_units').val())||0)+
|
||||
(parseInt($('#field-farobact_300_er_tabs_10_s_units').val())||0)+
|
||||
(parseInt($('#field-farobact_dry_syrup_units').val())||0)+
|
||||
(parseInt($('#field-flomist_aq_100md_units').val())||0)+
|
||||
(parseInt($('#field-flomist_f_240_md_units').val())||0)+
|
||||
(parseInt($('#field-flomist_f_275_mcg_120_md_units').val())||0)+
|
||||
(parseInt($('#field-ibugesic_plus_tablets_20s_units').val())||0)+
|
||||
(parseInt($('#field-ibugesic_plus_tablets_20s_ip_units').val())||0)+
|
||||
let units = parseFloat(unitsField.val()) || 0;
|
||||
|
||||
(parseInt($('#field-omnix_100_ds_units').val())||0)+
|
||||
(parseInt($('#field-omnix_100_dry_syrup_units').val())||0)+
|
||||
(parseInt($('#field-omnix_100_dt_tab_units').val())||0)+
|
||||
(parseInt($('#field-omnix_200_dt_tab_units').val())||0)+
|
||||
(parseInt($('#field-omnix_50_dry_syrup_units').val())||0)+
|
||||
(parseInt($('#field-omnix_50_dt_units').val())||0)+
|
||||
(parseInt($('#field-omnix_cv_200_tab_units').val())||0)+
|
||||
(parseInt($('#field-omnix_o_units').val())||0)+
|
||||
(parseInt($('#field-emeset_4_odtindia1_x_10s_units').val())||0)+
|
||||
(parseInt($('#field-emeset_4mg_10s_units').val())||0)+
|
||||
let value = units * rate;
|
||||
|
||||
(parseInt($('#field-emeset_8mg_10s_units').val())||0)+
|
||||
(parseInt($('#field-emeset_syrup_units').val())||0)+
|
||||
(parseInt($('#field-emeset_syrup_strawberry_30_ml_units').val())||0)+
|
||||
(parseInt($('#field-oflox_100mg_rediuse_60ml_units').val())||0)+
|
||||
(parseInt($('#field-oflox_200_tab_10s_units').val())||0)+
|
||||
(parseInt($('#field-oflox_400_10s_units').val())||0)+
|
||||
(parseInt($('#field-oflox_50mg_rediuse_60ml_units').val())||0)+
|
||||
(parseInt($('#field-oflox_eye_drops_units').val())||0)+
|
||||
(parseInt($('#field-oflox_oz_tablets_ip_units').val())||0)+
|
||||
(parseInt($('#field-oflox_rediuse_units').val())||0)+
|
||||
totalUnits += units;
|
||||
totalValue += value;
|
||||
|
||||
(parseInt($('#field-oflox_200_mg_10s_tablets_ip_units').val())||0)+
|
||||
(parseInt($('#field-oflox_400_mg_10s_tablets_ip_units').val())||0)+
|
||||
(parseInt($('#field-emset_r_10_x_10_tablets_units').val())||0)+
|
||||
(parseInt($('#field-montair_ab_tablet_units').val())||0)+
|
||||
(parseInt($('#field-pansec_80_mg_tablets_units').val())||0)+
|
||||
(parseInt($('#field-pansec_d_sr_capsules_15s_units').val())||0)+
|
||||
(parseInt($('#field-pansec_tablets_15s_units').val())||0)+
|
||||
(parseInt($('#field-pansec_l_capsules_units').val())||0)
|
||||
valueField.val(value.toFixed(1));
|
||||
|
||||
}
|
||||
|
||||
);
|
||||
});
|
||||
|
||||
$('#field-acivir_200_dt_value').val((parseInt($('#field-acivir_200_dt_units').val())*61.91||0).toFixed(1));
|
||||
$('#field-acivir_400_dt_value').val((parseInt($('#field-acivir_400_dt_units').val())*55.60||0).toFixed(1));
|
||||
$('#field-acivir_400_dt_10s_value').val((parseInt($('#field-acivir_400_dt_10s_units').val())*111.20||0).toFixed(1));
|
||||
$('#field-acivir_800_dt_value').val((parseInt($('#field-acivir_800_dt_units').val())*153.27||0).toFixed(1));
|
||||
$('#field-acivir_800_dt_tablets_1x10s_value').val((parseInt($('#field-acivir_800_dt_tablets_1x10s_units').val())*306.54||0).toFixed(1))
|
||||
$('#field-acivir_cream_10_gm_value').val((parseInt($('#field-acivir_cream_10_gm_units').val())*139.18||0).toFixed(1));
|
||||
$('#field-advent_1000_mg_value').val((parseInt($('#field-advent_1000_mg_units').val())*421.74||0).toFixed(1));
|
||||
$('#field-advent_457_dt_6s_value').val((parseInt($('#field-advent_457_dt_6s_units').val())*140.34||0).toFixed(1));
|
||||
$('#field-advent_457_dt_tablets_value').val((parseInt($('#field-advent_457_dt_tablets_units').val())*257.26||0).toFixed(1));
|
||||
$('#field-advent_625_tablets_10s_value').val((parseInt($('#field-advent_625_tablets_10s_units').val())*148.95||0).toFixed(1));
|
||||
|
||||
$('#field-advent_drops_10ml_value').val((parseInt($('#field-advent_drops_10ml_units').val())*100.57||0).toFixed(1));
|
||||
$('#field-advent_es_value').val((parseInt($('#field-advent_es_units').val())*163.03||0).toFixed(1));
|
||||
$('#field-advent_forte_457_syp_60_ml_value').val((parseInt($('#field-advent_forte_457_syp_60_ml_units').val())*227.76||0).toFixed(1));
|
||||
$('#field-advent_forte_syp_30m_value').val((parseInt($('#field-advent_forte_syp_30m_units').val())*184.18||0).toFixed(1));
|
||||
$('#field-advent_kid_2285_tab_value').val((parseInt($('#field-advent_kid_2285_tab_units').val())*174.67||0).toFixed(1));
|
||||
$('#field-advent_syp_2285mg_value').val((parseInt($('#field-advent_syp_2285mg_units').val())*98.87||0).toFixed(1));
|
||||
$('#field-advent_syrup_value').val((parseInt($('#field-advent_syrup_units').val())*49.43||0).toFixed(1));
|
||||
$('#field-azee_500_tabs_value').val((parseInt($('#field-azee_500_tabs_units').val())*57.55||0).toFixed(1));
|
||||
$('#field-azee_100_ds_15ml_value').val((parseInt($('#field-azee_100_ds_15ml_units').val())*39.64||0).toFixed(1));
|
||||
$('#field-azee_100_dt_value').val((parseInt($('#field-azee_100_dt_units').val())*29.05||0).toFixed(1));
|
||||
|
||||
|
||||
$('#field-azee_100_ip_100mg5ml_15ml_value').val((parseInt($('#field-azee_100_ip_100mg5ml_15ml_units').val())*39.64||0).toFixed(1));
|
||||
$('#field-azee_100_xl_dry_syru_value').val((parseInt($('#field-azee_100_xl_dry_syru_units').val())*80.00||0).toFixed(1));
|
||||
$('#field-azee_100_xl_liquids_30_ml_100mg5ml_value').val((parseInt($('#field-azee_100_xl_liquids_30_ml_100mg5ml_units').val())*80.00||0).toFixed(1));
|
||||
$('#field-azee_1000_value').val((parseInt($('#field-azee_1000_units').val())*47.02||0).toFixed(1));
|
||||
$('#field-azee_200_ds_15ml_value').val((parseInt($('#field-azee_200_ds_15ml_units').val())*41.62||0).toFixed(1));
|
||||
$('#field-azee_200_ip_200mg5ml_15ml_value').val((parseInt($('#field-azee_200_ip_200mg5ml_15ml_units').val())*41.62||0).toFixed(1));
|
||||
$('#field-azee_200_xl_dry_syru_value').val((parseInt($('#field-azee_200_xl_dry_syru_units').val())*83.28||0).toFixed(1));
|
||||
$('#field-azee_200_xl_liquids_30_ml_200mg5ml_value').val((parseInt($('#field-azee_200_xl_liquids_30_ml_200mg5ml_units').val())*83.28||0).toFixed(1));
|
||||
$('#field-azee_250_tablets10s_value').val((parseInt($('#field-azee_250_tablets10s_units').val())*94.96||0).toFixed(1));
|
||||
$('#field-azee_250_tabs_value').val((parseInt($('#field-azee_250_tabs_units').val())*56.97||0).toFixed(1));
|
||||
|
||||
|
||||
$('#field-azee_500_tablets_1_x_5s_value').val((parseInt($('#field-azee_500_tablets_1_x_5s_units').val())*95.91||0).toFixed(1));
|
||||
$('#field-azee_500_tablets_5s_value').val((parseInt($('#field-azee_500_tablets_5s_units').val())*95.91||0).toFixed(1));
|
||||
$('#field-azee_pulse_3_tablets_value').val((parseInt($('#field-azee_pulse_3_tablets_units').val())*57.55||0).toFixed(1));
|
||||
$('#field-civono_10_mg_tablets_10s_value').val((parseInt($('#field-civono_10_mg_tablets_10s_units').val())*78.57||0).toFixed(1));
|
||||
$('#field-civono_20_mg_tablets_10s_value').val((parseInt($('#field-civono_20_mg_tablets_10s_units').val())*121.42||0).toFixed(1));
|
||||
$('#field-corex_dx_cough_syrup_100ml_ip_value').val((parseInt($('#field-corex_dx_cough_syrup_100ml_ip_units').val())*121.78||0).toFixed(1));
|
||||
$('#field-corex_dx_cough_syrup_50ml_ip_value').val((parseInt($('#field-corex_dx_cough_syrup_50ml_ip_units').val())*80.37||0).toFixed(1));
|
||||
$('#field-cpink_200ml_value').val((parseInt($('#field-cpink_200ml_units').val())*246.62||0).toFixed(1));
|
||||
$('#field-cpink_drops_15ml_value').val((parseInt($('#field-cpink_drops_15ml_units').val())*94.42||0).toFixed(1));
|
||||
$('#field-cpink_suspension_150ml_value').val((parseInt($('#field-cpink_suspension_150ml_units').val())*138.97||0).toFixed(1));
|
||||
|
||||
|
||||
$('#field-farobact_200_value').val((parseInt($('#field-farobact_200_units').val())*495.21||0).toFixed(1));
|
||||
$('#field-farobact_200_tabs_1_x_10_s_value').val((parseInt($('#field-farobact_200_tabs_1_x_10_s_units').val())*998.67||0).toFixed(1));
|
||||
$('#field-farobact_300_er_tablets_value').val((parseInt($('#field-farobact_300_er_tablets_units').val())*543.80||0).toFixed(1));
|
||||
$('#field-farobact_300_er_tabs_10_s_value').val((parseInt($('#field-farobact_300_er_tabs_10_s_units').val())*1096.66||0).toFixed(1));
|
||||
$('#field-farobact_dry_syrup_value').val((parseInt($('#field-farobact_dry_syrup_units').val())*423.50||0).toFixed(1));
|
||||
$('#field-flomist_aq_100md_value').val((parseInt($('#field-flomist_aq_100md_units').val())*367.44||0).toFixed(1));
|
||||
$('#field-flomist_f_240_md_value').val((parseInt($('#field-flomist_f_240_md_units').val())*616.78||0).toFixed(1));
|
||||
$('#field-flomist_f_275_mcg_120_md_value').val((parseInt($('#field-flomist_f_275_mcg_120_md_units').val())*444.50||0).toFixed(1));
|
||||
$('#field-ibugesic_plus_tablets_20s_value').val((parseInt($('#field-ibugesic_plus_tablets_20s_units').val())*31.61||0).toFixed(1));
|
||||
$('#field-ibugesic_plus_tablets_20s_ip_value').val((parseInt($('#field-ibugesic_plus_tablets_20s_ip_units').val())*31.61||0).toFixed(1));
|
||||
|
||||
$('#field-omnix_100_ds_value').val((parseInt($('#field-omnix_100_ds_units').val())*58.31||0).toFixed(1));
|
||||
$('#field-omnix_100_dry_syrup_value').val((parseInt($('#field-omnix_100_dry_syrup_units').val())*116.64||0).toFixed(1));
|
||||
$('#field-omnix_100_dt_tab_value').val((parseInt($('#field-omnix_100_dt_tab_units').val())*87.48||0).toFixed(1));
|
||||
$('#field-omnix_200_dt_tab_value').val((parseInt($('#field-omnix_200_dt_tab_units').val())*79.59||0).toFixed(1));
|
||||
$('#field-omnix_50_dry_syrup_value').val((parseInt($('#field-omnix_50_dry_syrup_units').val())*39.83||0).toFixed(1));
|
||||
$('#field-omnix_50_dt_value').val((parseInt($('#field-omnix_50_dt_units').val())*55.54||0).toFixed(1));
|
||||
$('#field-omnix_cv_200_tab_value').val((parseInt($('#field-omnix_cv_200_tab_units').val())*291.61||0).toFixed(1));
|
||||
$('#field-omnix_o_value').val((parseInt($('#field-omnix_o_units').val())*183.71||0).toFixed(1));
|
||||
$('#field-emeset_4_odtindia1_x_10s_value').val((parseInt($('#field-emeset_4_odtindia1_x_10s_units').val())*41.83||0).toFixed(1));
|
||||
$('#field-emeset_4mg_10s_value').val((parseInt($('#field-emeset_4mg_10s_units').val())*41.83||0).toFixed(1));
|
||||
|
||||
|
||||
$('#field-emeset_8mg_10s_value').val((parseInt($('#field-emeset_8mg_10s_units').val())*73.75||0).toFixed(1));
|
||||
$('#field-emeset_syrup_value').val((parseInt($('#field-emeset_syrup_units').val())*30.71||0).toFixed(1));
|
||||
$('#field-emeset_syrup_strawberry_30_ml_value').val((parseInt($('#field-emeset_syrup_strawberry_30_ml_units').val())*30.71||0).toFixed(1));
|
||||
$('#field-oflox_100mg_rediuse_60ml_value').val((parseInt($('#field-oflox_100mg_rediuse_60ml_units').val())*141.25||0).toFixed(1));
|
||||
$('#field-oflox_200_tab_10s_value').val((parseInt($('#field-oflox_200_tab_10s_units').val())*84.19||0).toFixed(1));
|
||||
$('#field-oflox_400_10s_value').val((parseInt($('#field-oflox_400_10s_units').val())*305.58||0).toFixed(1));
|
||||
$('#field-oflox_50mg_rediuse_60ml_value').val((parseInt($('#field-oflox_50mg_rediuse_60ml_units').val())*66.78||0).toFixed(1));
|
||||
$('#field-oflox_eye_drops_value').val((parseInt($('#field-oflox_eye_drops_units').val())*38.58||0).toFixed(1));
|
||||
$('#field-oflox_oz_tablets_ip_value').val((parseInt($('#field-oflox_oz_tablets_ip_units').val())*157.25||0).toFixed(1));
|
||||
$('#field-oflox_rediuse_value').val((parseInt($('#field-oflox_rediuse_units').val())*66.78||0).toFixed(1));
|
||||
|
||||
$('#field-oflox_200_mg_10s_tablets_ip_value').val((parseInt($('#field-oflox_200_mg_10s_tablets_ip_units').val())*84.19||0).toFixed(1));
|
||||
$('#field-oflox_400_mg_10s_tablets_ip_value').val((parseInt($('#field-oflox_400_mg_10s_tablets_ip_units').val())*305.58||0).toFixed(1));
|
||||
$('#field-emset_r_10_x_10_tablets_value').val((parseInt($('#field-emset_r_10_x_10_tablets_units').val())*60.09||0).toFixed(1));
|
||||
$('#field-montair_ab_tablet_value').val((parseInt($('#field-montair_ab_tablet_units').val())*238.11||0).toFixed(1));
|
||||
$('#field-pansec_80_mg_tablets_value').val((parseInt($('#field-pansec_80_mg_tablets_units').val())*226.21||0).toFixed(1));
|
||||
$('#field-pansec_d_sr_capsules_15s_value').val((parseInt($('#field-pansec_d_sr_capsules_15s_units').val())*235.22||0).toFixed(1));
|
||||
$('#field-pansec_tablets_15s_value').val((parseInt($('#field-pansec_tablets_15s_units').val())*197.71||0).toFixed(1));
|
||||
$('#field-pansec_l_capsules_value').val((parseInt($('#field-pansec_l_capsules_units').val())*132.21||0).toFixed(1));
|
||||
|
||||
|
||||
|
||||
$('#field-total_pob_value').val(totalvalue.toFixed(1));
|
||||
$('#field-total_pob_value').val(totalValue.toFixed(1));
|
||||
$('#field-total_pob_units').val(totalUnits);
|
||||
|
||||
})
|
||||
$.each(productGroups, function(groupName, keys) {
|
||||
calculateGroupTotals(groupName, keys);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#field-total_pob_value,#field-total_pob_units').attr('readonly',true);
|
||||
|
|
@ -734,8 +593,158 @@ if (!empty($submissions->data->submissions)) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
const productGroups = {
|
||||
acivir: ["acivir_200_dt","acivir_400_dt","acivir_400_dt_10s","acivir_800_dt","acivir_800_dt_tablets_1x10s","acivir_cream_10_gm"],
|
||||
advent: [
|
||||
"advent_1000_mg",
|
||||
"advent_457_dt_6s",
|
||||
"advent_457_dt_tablets",
|
||||
"advent_625_tablets_10s",
|
||||
"advent_drops_10ml",
|
||||
"advent_es",
|
||||
"advent_forte_457_syp_60_ml",
|
||||
"advent_forte_syp_30m",
|
||||
"advent_kid_2285_tab",
|
||||
"advent_syp_2285mg",
|
||||
"advent_syrup"
|
||||
],
|
||||
azee_solids: ["azee_500_tabs","azee_1000","azee_250_tablets10s","azee_250_tabs","azee_500_tablets_1_x_5s","azee_500_tablets_5s"],
|
||||
azee_ped: ["azee_100_ds_15ml","azee_100_dt","azee_100_ip_100mg5ml_15ml","azee_100_xl_dry_syru","azee_100_xl_liquids_30_ml_100mg5ml","azee_200_ds_15ml","azee_200_ip_200mg5ml_15ml","azee_200_xl_dry_syru","azee_200_xl_liquids_30_ml_200mg5ml"],
|
||||
bilafav: ["bilafav_m","bilafav_m_odt_adult_tablets_1x10s_2010","bilafav_m_odt_pedia_tablets_1x10s_104","bilafav_m_oral_suspension"],
|
||||
civono:["civono_10_mg_tablets_10s","civono_20_mg_tablets_10s"],
|
||||
corex:["corex_dx_cough_syrup_100ml_ip","corex_dx_cough_syrup_50ml_ip"],
|
||||
cpink:["cpink_200ml","cpink_drops_15ml","cpink_suspension_150ml"],
|
||||
farobact:["farobact_200","farobact_200_tabs_1_x_10_s","farobact_300_er_tablets","farobact_300_er_tabs_10_s"],
|
||||
flomist:["flomist_aq_100md"],
|
||||
flomist_f:["flomist_f_240_md","flomist_f_275_mcg_120_md"],
|
||||
|
||||
|
||||
ibugesic:["ibugesic_plus_tablets_20s","ibugesic_plus_tablets_20s_ip"],
|
||||
omnix:["omnix_100_ds","omnix_100_dry_syrup","omnix_100_dt_tab","omnix_200_dt_tab","omnix_50_dry_syrup","omnix_50_dt","omnix_cv_200_tab","omnix_o"],
|
||||
junior_lanzol:["junior_lanzol_15","junior_lanzol_30"],
|
||||
levoflox:["levoflox_250_10s_ip","levoflox_250_tab_10","levoflox_500_10s_ip","levoflox_500_10s","levoflox_750_5s_ip","levoflox_750_tab_5s","levoflox_infusion"],
|
||||
metaspray:["metaspray_100aq"],
|
||||
/* montair:["montair_fx_15s","montair_ab_tablet"], */
|
||||
curkey:["curkey_kof_syrup_p_100ml","curkey_pastiles_10_x_10s","curkey_pastiles_100_mg_5_x_10s","curkey_pastilles_100mg_1_x_10s","curkey_syrup_60ml"],
|
||||
nutramide:["nutramide_200_ml_syrup","nutramide_drops_15_ml"],
|
||||
emeset:["emeset_4_odtindia1_x_10s","emeset_4mg_10s","emeset_8mg_10s","emeset_syrup","emeset_syrup_strawberry_30_ml"],
|
||||
|
||||
oflox:["oflox_100mg_rediuse_60ml","oflox_200_tab_10s","oflox_400_10s","oflox_50mg_rediuse_60ml","oflox_eye_drops","oflox_rediuse","oflox_200_mg_10s_tablets_ip","oflox_400_mg_10s_tablets_ip"],
|
||||
oflox_oz:["oflox_oz_tablets_ip"],
|
||||
emeset_r:["emset_r_10_x_10_tablets"],
|
||||
montair:["montair_ab_tablet"],
|
||||
pansec:["pansec_80_mg_tablets","pansec_d_sr_capsules_15s","pansec_tablets_15s","pansec_l_capsules"]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
function calculateGroupTotals(groupName, keys) {
|
||||
let totalUnits = 0;
|
||||
let totalValue = 0;
|
||||
|
||||
keys.forEach(key => {
|
||||
totalUnits += parseInt($(`#field-${key}_units`).val()) || 0;
|
||||
totalValue += parseFloat($(`#field-${key}_value`).val()) || 0;
|
||||
});
|
||||
|
||||
$(`#field-${groupName}_units`).val(totalUnits);
|
||||
$(`#field-${groupName}_value`).val(totalValue.toFixed(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-acivir_units" name="acivir_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-acivir_value" name="acivir_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-advent_units" name="advent_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-advent_value" name="advent_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-azee_solids_units" name="azee_solids_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-azee_solids_value" name="azee_solids_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-azee_ped_units" name="azee_ped_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-azee_ped_value" name="azee_ped_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-bilafav_units" name="bilafav_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-bilafav_value" name="bilafav_value" />');
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-civono_units" name="civono_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-civono_value" name="civono_value" />');
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-corex_units" name="corex_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-corex_value" name="corex_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-cpink_units" name="cpink_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-cpink_value" name="cpink_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-farobact_units" name="farobact_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-farobact_value" name="farobact_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-flomist_units" name="flomist_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-flomist_value" name="flomist_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-flomist_f_units" name="flomist_f_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-flomist_f_value" name="flomist_f_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-ibugesic_units" name="ibugesic_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-ibugesic_value" name="ibugesic_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-omnix_units" name="omnix_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-omnix_value" name="omnix_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-junior_lanzol_units" name="junior_lanzol_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-junior_lanzol_value" name="junior_lanzol_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-levoflox_units" name="levoflox_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-levoflox_value" name="levoflox_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-metaspray_units" name="metaspray_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-metaspray_value" name="metaspray_value" />');
|
||||
|
||||
/* $('#report-form').append('<input type="hidden" id="field-montair_units" name="montair_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-montair_value" name="montair_value" />'); */
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-curkey_units" name="curkey_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-curkey_value" name="curkey_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-nutramide_units" name="nutramide_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-nutramide_value" name="nutramide_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-emeset_units" name="emeset_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-emeset_value" name="emeset_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-oflox_units" name="oflox_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-oflox_value" name="oflox_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-oflox_oz_units" name="oflox_oz_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-oflox_oz_value" name="oflox_oz_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-emeset_r_units" name="emeset_r_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-emeset_r_value" name="emeset_r_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-montair_units" name="montair_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-montair_value" name="montair_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-pansec_units" name="pansec_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-pansec_value" name="pansec_value" />');
|
||||
|
||||
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ $brandData = [
|
|||
['brand'=>"LEVOFLOX 750 TAB 5'S", 'slug'=>'levoflox_750_tab_5s_units','pseudoId'=>'levoflox_750_tab_5s_value'],
|
||||
['brand'=>'LEVOFLOX INFUSION', 'slug'=>'levoflox_infusion_units','pseudoId'=>'levoflox_infusion_value'],
|
||||
['brand'=>'METASPRAY 100AQ', 'slug'=>'metaspray_100aq_units','pseudoId'=>'metaspray_100aq_value'],
|
||||
|
||||
['brand'=>'MONTAIR FX', 'slug'=>'montair_fx_units','pseudoId'=>'montair_fx_value'],
|
||||
/*
|
||||
['brand'=>'MONTAIR FX', 'slug'=>'montair_fx_units','pseudoId'=>'montair_fx_value'], */
|
||||
['brand'=>'Montair FX 15s', 'slug'=>'montair_fx_15s_units','pseudoId'=>'montair_fx_15s_value'],
|
||||
['brand'=>'CEFOPROX 100 30ML(60)', 'slug'=>'cefoprox_100_30ml60_units','pseudoId'=>'cefoprox_100_30ml60_value'],
|
||||
['brand'=>'CEFOPROX 100DT', 'slug'=>'cefoprox_100dt_units','pseudoId'=>'cefoprox_100dt_value'],
|
||||
|
|
@ -54,7 +54,7 @@ $brandData = [
|
|||
['brand'=>'MUCINAC 600 TABLETS', 'slug'=>'mucinac_600_tablets_units','pseudoId'=>'mucinac_600_tablets_value'],
|
||||
['brand'=>'Mucinac AB 1 X 10 TABLETS', 'slug'=>'mucinac_ab_1_x_10_tablets_units','pseudoId'=>'mucinac_ab_1_x_10_tablets_value'],
|
||||
['brand'=>"Mucinac AB Tablet", 'slug'=>'mucinac_ab_tablet_units','pseudoId'=>'mucinac_ab_tablet_value'],
|
||||
['brand'=>"MUCINAC C Tablets 1 x 15'S", 'slug'=>'mucinac_c_tablets_1_x_15s_units','pseudoId'=>'mucinac_c_tablets_1_x_15s_value'],
|
||||
/* ['brand'=>"MUCINAC C Tablets 1 x 15'S", 'slug'=>'mucinac_c_tablets_1_x_15s_units','pseudoId'=>'mucinac_c_tablets_1_x_15s_value'], */
|
||||
['brand'=>'Mucinac Oral Solution 100ml', 'slug'=>'mucinac_oral_solution_100ml_units','pseudoId'=>'mucinac_oral_solution_100ml_value'],
|
||||
|
||||
|
||||
|
|
@ -501,7 +501,7 @@ if (!empty($submissions->data->submissions)) {
|
|||
// 👉 Continue adding all products same way
|
||||
};
|
||||
|
||||
$(document).on('change', '[id$="_units"]', function () {
|
||||
$(document).on('input', '[id$="_units"]', function () {
|
||||
|
||||
let totalValue = 0;
|
||||
let totalUnits = 0;
|
||||
|
|
@ -523,6 +523,10 @@ if (!empty($submissions->data->submissions)) {
|
|||
|
||||
$('#field-total_pob_value').val(totalValue.toFixed(1));
|
||||
$('#field-total_pob_units').val(totalUnits);
|
||||
|
||||
$.each(productGroups, function(groupName, keys) {
|
||||
calculateGroupTotals(groupName, keys);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -548,6 +552,103 @@ if (!empty($submissions->data->submissions)) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
const productGroups = {
|
||||
junior_lazol: ["junior_lanzol_15", "junior_lanzol_30"],
|
||||
levoflox: [
|
||||
"levoflox_250_10s_ip",
|
||||
"levoflox_250_tab_10",
|
||||
"levoflox_500_10s_ip",
|
||||
"levoflox_500_10s",
|
||||
"levoflox_750_5s_ip",
|
||||
"levoflox_750_tab_5s",
|
||||
"levoflox_infusion"
|
||||
],
|
||||
metaspray: ["metaspray_100aq"],
|
||||
montair:["montair_fx","montair_fx_15s"],
|
||||
cefoprox:["cefoprox_100_30ml60","cefoprox_100dt","cefoprox_200_10s","cefoprox_50_30ml","cefoprox_cv_325_tab"],
|
||||
cheston:["cheston_duo_100ml_syrup","cheston_ls_junior_100_ml","cheston_d_cough_syrup_100_ml","cheston_d_plus_1_x_10s","cheston_ls_cough_syrup_100_ml","cheston_ls_junior_60_ml"],
|
||||
dalacin:["dalacin_c_150mg_caps_10s","dalacin_c_300mg_caps_10s"],
|
||||
dolonex:["dolonex_disp_20mg_tabs_ip","dolonex_im_20mg1ml_inj","dolonex_im_40mg_2ml_inj_hosp_ip","dolonex_im_40mg2ml_inj_ip"],
|
||||
duonase:["duonase_f_70_md","duonase_nasal_spray"],
|
||||
ibugesic:["ibugesic_plus_susp","ibugesic_plus_susp_1","ibugesic_plus_suspension_100ml_orange"],
|
||||
mucinac:["mucinac_200_tablet_1_x_10s","mucinac_600_tablets","mucinac_ab_1_x_10_tablets","mucinac_ab_tablet","mucinac_c_tablets_1_x_15s","mucinac_oral_solution_100ml"],
|
||||
novamox:["novamox_500","novamox_125_rediuse_30_ml","novamox_125_rediuse_60_ml","novamox_250_dt_15s","novamox_250_ru_30","novamox_250_rediuse","novamox_30ml","novamox_60ml","novamox_cv_1000_mg","novamox_cv_2285_dt_tablets","novamox_cv_2285_mg_syrup","novamox_cv_375_tab_10s","novamox_cv_457_dt_10s","novamox_cv_625_tablets_10","novamox_cv_drops","novamox_cv_dry_syrup_30_ml","novamox_cv_ds","novamox_cv_forte_syp","novamox_cv_forte_syp_60_ml","novamox_drops","novamox_lb_500","novamox_rdu_drops","novamox_125_dt_15s","novamox_250_15s"],
|
||||
tedispan:["tedispan_200_tablets_6s"],
|
||||
rabicip:["rabicip_l_capsules","rabicip_20_15s","rabicip_20_tablets_15s","rabicip_20mg_ip_1_x_15s_tablets","rabicip_d_capsules_1_x_15s"],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
function calculateGroupTotals(groupName, keys) {
|
||||
let totalUnits = 0;
|
||||
let totalValue = 0;
|
||||
|
||||
keys.forEach(key => {
|
||||
totalUnits += parseInt($(`#field-${key}_units`).val()) || 0;
|
||||
totalValue += parseFloat($(`#field-${key}_value`).val()) || 0;
|
||||
});
|
||||
|
||||
$(`#field-${groupName}_units`).val(totalUnits);
|
||||
$(`#field-${groupName}_value`).val(totalValue.toFixed(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-junior_lazol_units" name="junior_lazol_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-junior_lazol_value" name="junior_lazol_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-levoflox_units" name="levoflox_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-levoflox_value" name="levoflox_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-metaspray_units" name="metaspray_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-metaspray_value" name="metaspray_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-montair_units" name="montair_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-montair_value" name="montair_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-cefoprox_units" name="cefoprox_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-cefoprox_value" name="cefoprox_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-cheston_units" name="cheston_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-cheston_value" name="cheston_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-dalacin_units" name="dalacin_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-dalacin_value" name="dalacin_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-dolonex_units" name="dolonex_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-dolonex_value" name="dolonex_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-duonase_units" name="duonase_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-duonase_value" name="duonase_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-ibugesic_units" name="ibugesic_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-ibugesic_value" name="ibugesic_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-mucinac_units" name="mucinac_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-mucinac_value" name="mucinac_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-novamox_units" name="novamox_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-novamox_value" name="novamox_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-tedispan_units" name="tedispan_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-tedispan_value" name="tedispan_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-rabicip_units" name="rabicip_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-rabicip_value" name="rabicip_value" />');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ $brandData = [
|
|||
|
||||
['brand'=>"AZEE 500 Tablets 1 x 5'S", 'slug'=>'azee_500_tablets_1_x_5s_units','pseudoId'=>'azee_500_tablets_1_x_5s_value'],
|
||||
['brand'=>"AZEE 500 TABLETS 5'S", 'slug'=>'azee_500_tablets_5s_units','pseudoId'=>'azee_500_tablets_5s_value'],
|
||||
['brand'=>'AZEE PULSE 3 TABLETS', 'slug'=>'azee_pulse_3_tablets_units','pseudoId'=>'azee_pulse_3_tablets_value'],
|
||||
/* ['brand'=>'AZEE PULSE 3 TABLETS', 'slug'=>'azee_pulse_3_tablets_units','pseudoId'=>'azee_pulse_3_tablets_value'], */
|
||||
['brand'=>"CIVONO 10 MG TABLETS 10'S", 'slug'=>'civono_10_mg_tablets_10s_units','pseudoId'=>'civono_10_mg_tablets_10s_value'],
|
||||
['brand'=>"CIVONO 20 MG TABLETS 10'S", 'slug'=>'civono_20_mg_tablets_10s_units','pseudoId'=>'civono_20_mg_tablets_10s_value'],
|
||||
['brand'=>'COREX-DX COUGH SYRUP 100ML (IP)', 'slug'=>'corex_dx_cough_syrup_100ml_ip_units','pseudoId'=>'corex_dx_cough_syrup_100ml_ip_value'],
|
||||
|
|
@ -62,7 +62,7 @@ $brandData = [
|
|||
['brand'=>"FAROBACT 200 TABS 1 x 10 S", 'slug'=>'farobact_200_tabs_1_x_10_s_units','pseudoId'=>'farobact_200_tabs_1_x_10_s_value'],
|
||||
['brand'=>'Farobact 300 ER TABLETS', 'slug'=>'farobact_300_er_tablets_units','pseudoId'=>'farobact_300_er_tablets_value'],
|
||||
['brand'=>"FAROBACT 300 ER TABS 10 S", 'slug'=>'farobact_300_er_tabs_10_s_units','pseudoId'=>'farobact_300_er_tabs_10_s_value'],
|
||||
['brand'=>"Farobact Dry Syrup", 'slug'=>'farobact_dry_syrup_units','pseudoId'=>'farobact_dry_syrup_value'],
|
||||
/* ['brand'=>"Farobact Dry Syrup", 'slug'=>'farobact_dry_syrup_units','pseudoId'=>'farobact_dry_syrup_value'], */
|
||||
['brand'=>'FLOMIST AQ. 100MD', 'slug'=>'flomist_aq_100md_units','pseudoId'=>'flomist_aq_100md_value'],
|
||||
['brand'=>'Flomist F 240 MD', 'slug'=>'flomist_f_240_md_units','pseudoId'=>'flomist_f_240_md_value'],
|
||||
['brand'=>"Flomist F 27.5 MCG 120 MD", 'slug'=>'flomist_f_275_mcg_120_md_units','pseudoId'=>'flomist_f_275_mcg_120_md_value'],
|
||||
|
|
@ -88,15 +88,17 @@ $brandData = [
|
|||
['brand'=>"LEVOFLOX 750 TAB 5'S", 'slug'=>'levoflox_750_tab_5s_units','pseudoId'=>'levoflox_750_tab_5s_value'],
|
||||
['brand'=>"LEVOFLOX INFUSION", 'slug'=>'levoflox_infusion_units','pseudoId'=>'levoflox_infusion_value'],
|
||||
['brand'=>"METASPRAY 100AQ", 'slug'=>'metaspray_100aq_units','pseudoId'=>'metaspray_100aq_value'],
|
||||
['brand'=>"MONTAIR FX", 'slug'=>'montair_fx_units','pseudoId'=>'montair_fx_value'],
|
||||
/* ['brand'=>"MONTAIR FX", 'slug'=>'montair_fx_units','pseudoId'=>'montair_fx_value'], */
|
||||
['brand'=>"Montair FX 15s", 'slug'=>'montair_fx_15s_units','pseudoId'=>'montair_fx_15s_value'],
|
||||
['brand'=>"Montair AB Tablet", 'slug'=>'montair_ab_tablet_units','pseudoId'=>'montair_ab_tablet_value'],
|
||||
|
||||
|
||||
['brand'=>"CURKEY KOF SYRUP (P) 100ML", 'slug'=>'curkey_kof_syrup_p_100ml_units','pseudoId'=>'curkey_kof_syrup_p_100ml_value'],
|
||||
['brand'=>"CURKEY PASTILES 10 X 10S", 'slug'=>'curkey_pastiles_10_x_10s_units','pseudoId'=>'curkey_pastiles_10_x_10s_value'],
|
||||
['brand'=>"CURKEY PASTILES 100 MG 5 X 10'S", 'slug'=>'curkey_pastiles_100_mg_5_x_10s_units','pseudoId'=>'curkey_pastiles_100_mg_5_x_10s_value'],
|
||||
['brand'=>"CURKEY PASTILLES 100MG 1 X 10S", 'slug'=>'curkey_pastilles_100mg_1_x_10s_units','pseudoId'=>'curkey_pastilles_100mg_1_x_10s_value'],
|
||||
['brand'=>"CURKEY SYRUP 60ML", 'slug'=>'curkey_syrup_60ml_units','pseudoId'=>'curkey_syrup_60ml_value'],
|
||||
['brand'=>"CURKEY VAPR", 'slug'=>'curkey_vapr_units','pseudoId'=>'curkey_vapr_value'],
|
||||
/* ['brand'=>"CURKEY VAPR", 'slug'=>'curkey_vapr_units','pseudoId'=>'curkey_vapr_value'], */
|
||||
['brand'=>"Nutramide 200 ML syrup", 'slug'=>'nutramide_200_ml_syrup_units','pseudoId'=>'nutramide_200_ml_syrup_value'],
|
||||
['brand'=>"Nutramide drops 15 ml", 'slug'=>'nutramide_drops_15_ml_units','pseudoId'=>'nutramide_drops_15_ml_value']
|
||||
|
||||
|
|
@ -505,6 +507,7 @@ if (!empty($submissions->data->submissions)) {
|
|||
"metaspray_100aq":454.72,
|
||||
"montair_fx": 158.96,
|
||||
"montair_fx_15s": 307.73,
|
||||
"montair_ab_tablet": 238.11,
|
||||
|
||||
|
||||
"curkey_kof_syrup_p_100ml": 88.57,
|
||||
|
|
@ -541,6 +544,10 @@ if (!empty($submissions->data->submissions)) {
|
|||
|
||||
$('#field-total_pob_value').val(totalValue.toFixed(1));
|
||||
$('#field-total_pob_units').val(totalUnits);
|
||||
|
||||
$.each(productGroups, function(groupName, keys) {
|
||||
calculateGroupTotals(groupName, keys);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -567,6 +574,126 @@ if (!empty($submissions->data->submissions)) {
|
|||
});
|
||||
|
||||
|
||||
const productGroups = {
|
||||
acivir: ["acivir_200_dt","acivir_400_dt","acivir_400_dt_10s","acivir_800_dt","acivir_800_dt_tablets_1x10s","acivir_cream_10_gm"],
|
||||
advent: [
|
||||
"advent_1000_mg",
|
||||
"advent_457_dt_6s",
|
||||
"advent_457_dt_tablets",
|
||||
"advent_625_tablets_10s",
|
||||
"advent_drops_10ml",
|
||||
"advent_es",
|
||||
"advent_forte_457_syp_60_ml",
|
||||
"advent_forte_syp_30m",
|
||||
"advent_kid_2285_tab",
|
||||
"advent_syp_2285mg",
|
||||
"advent_syrup"
|
||||
],
|
||||
azee_solids: ["azee_500_tabs","azee_1000","azee_250_tablets10s","azee_250_tabs","azee_500_tablets_1_x_5s","azee_500_tablets_5s"],
|
||||
azee_ped: ["azee_100_ds_15ml","azee_100_dt","azee_100_ip_100mg5ml_15ml","azee_100_xl_dry_syru","azee_100_xl_liquids_30_ml_100mg5ml","azee_200_ds_15ml","azee_200_ip_200mg5ml_15ml","azee_200_xl_dry_syru","azee_200_xl_liquids_30_ml_200mg5ml"],
|
||||
|
||||
civono:["civono_10_mg_tablets_10s","civono_20_mg_tablets_10s"],
|
||||
corex:["corex_dx_cough_syrup_100ml_ip","corex_dx_cough_syrup_50ml_ip"],
|
||||
cpink:["cpink_200ml","cpink_drops_15ml","cpink_suspension_150ml"],
|
||||
farobact:["farobact_200","farobact_200_tabs_1_x_10_s","farobact_300_er_tablets","farobact_300_er_tabs_10_s"],
|
||||
flomist:["flomist_aq_100md"],
|
||||
flomist_f:["flomist_f_240_md","flomist_f_275_mcg_120_md"],
|
||||
|
||||
|
||||
ibugesic:["ibugesic_plus_tablets_20s","ibugesic_plus_tablets_20s_ip"],
|
||||
omnix:["omnix_100_ds","omnix_100_dry_syrup","omnix_100_dt_tab","omnix_200_dt_tab","omnix_50_dry_syrup","omnix_50_dt","omnix_cv_200_tab","omnix_o"],
|
||||
junior_lanzol:["junior_lanzol_15","junior_lanzol_30"],
|
||||
levoflox:["levoflox_250_10s_ip","levoflox_250_tab_10","levoflox_500_10s_ip","levoflox_500_10s","levoflox_750_5s_ip","levoflox_750_tab_5s","levoflox_infusion"],
|
||||
metaspray:["metaspray_100aq"],
|
||||
montair:["montair_fx_15s","montair_ab_tablet"],
|
||||
curkey:["curkey_kof_syrup_p_100ml","curkey_pastiles_10_x_10s","curkey_pastiles_100_mg_5_x_10s","curkey_pastilles_100mg_1_x_10s","curkey_syrup_60ml"],
|
||||
nutramide:["nutramide_200_ml_syrup","nutramide_drops_15_ml"],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
function calculateGroupTotals(groupName, keys) {
|
||||
let totalUnits = 0;
|
||||
let totalValue = 0;
|
||||
|
||||
keys.forEach(key => {
|
||||
totalUnits += parseInt($(`#field-${key}_units`).val()) || 0;
|
||||
totalValue += parseFloat($(`#field-${key}_value`).val()) || 0;
|
||||
});
|
||||
|
||||
$(`#field-${groupName}_units`).val(totalUnits);
|
||||
$(`#field-${groupName}_value`).val(totalValue.toFixed(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-acivir_units" name="acivir_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-acivir_value" name="acivir_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-advent_units" name="advent_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-advent_value" name="advent_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-azee_solids_units" name="azee_solids_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-azee_solids_value" name="azee_solids_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-azee_ped_units" name="azee_ped_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-azee_ped_value" name="azee_ped_value" />');
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-civono_units" name="civono_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-civono_value" name="civono_value" />');
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-corex_units" name="corex_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-corex_value" name="corex_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-cpink_units" name="cpink_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-cpink_value" name="cpink_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-farobact_units" name="farobact_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-farobact_value" name="farobact_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-flomist_units" name="flomist_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-flomist_value" name="flomist_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-flomist_f_units" name="flomist_f_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-flomist_f_value" name="flomist_f_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-ibugesic_units" name="ibugesic_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-ibugesic_value" name="ibugesic_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-omnix_units" name="omnix_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-omnix_value" name="omnix_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-junior_lanzol_units" name="junior_lanzol_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-junior_lanzol_value" name="junior_lanzol_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-levoflox_units" name="levoflox_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-levoflox_value" name="levoflox_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-metaspray_units" name="metaspray_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-metaspray_value" name="metaspray_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-montair_units" name="montair_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-montair_value" name="montair_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-curkey_units" name="curkey_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-curkey_value" name="curkey_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-nutramide_units" name="nutramide_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-nutramide_value" name="nutramide_value" />');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ $brandData = [
|
|||
['brand'=>"OFLOX 200 TAB (10'S)", 'slug'=>'oflox_200_tab_10s_units','pseudoId'=>'oflox_200_tab_10s_value'],
|
||||
['brand'=>"OFLOX 400 10'S", 'slug'=>'oflox_400_10s_units','pseudoId'=>'oflox_400_10s_value'],
|
||||
['brand'=>'OFLOX 50MG REDIUSE 60ML', 'slug'=>'oflox_50mg_rediuse_60ml_units','pseudoId'=>'oflox_50mg_rediuse_60ml_value'],
|
||||
['brand'=>'OFLOX EYE DROPS', 'slug'=>'oflox_eye_drops_units','pseudoId'=>'oflox_eye_drops_value'],
|
||||
|
||||
/* ['brand'=>'OFLOX EYE DROPS', 'slug'=>'oflox_eye_drops_units','pseudoId'=>'oflox_eye_drops_value'],
|
||||
*/
|
||||
['brand'=>'OFLOX OZ TABLETS IP', 'slug'=>'oflox_oz_tablets_ip_units','pseudoId'=>'oflox_oz_tablets_ip_value'],
|
||||
['brand'=>'OFLOX REDIUSE', 'slug'=>'oflox_rediuse_units','pseudoId'=>'oflox_rediuse_value'],
|
||||
['brand'=>"OFLOX-200 MG 10's TABLETS (IP)", 'slug'=>'oflox_200_mg_10s_tablets_ip_units','pseudoId'=>'oflox_200_mg_10s_tablets_ip_value'],
|
||||
|
|
@ -58,7 +58,7 @@ $brandData = [
|
|||
['brand'=>'Mucinac AB Tablet', 'slug'=>'mucinac_ab_tablet_units','pseudoId'=>'mucinac_ab_tablet_value'],
|
||||
|
||||
|
||||
['brand'=>"MUCINAC C Tablets 1 x 15'S", 'slug'=>'mucinac_c_tablets_1_x_15s_units','pseudoId'=>'mucinac_c_tablets_1_x_15s_value'],
|
||||
/* ['brand'=>"MUCINAC C Tablets 1 x 15'S", 'slug'=>'mucinac_c_tablets_1_x_15s_units','pseudoId'=>'mucinac_c_tablets_1_x_15s_value'], */
|
||||
['brand'=>"Mucinac Oral Solution 100ml", 'slug'=>'mucinac_oral_solution_100ml_units','pseudoId'=>'mucinac_oral_solution_100ml_value'],
|
||||
['brand'=>'NOVAMOX 500', 'slug'=>'novamox_500_units','pseudoId'=>'novamox_500_value'],
|
||||
['brand'=>"NOVAMOX 125 REDIUSE 30 ML", 'slug'=>'novamox_125_rediuse_30_ml_units','pseudoId'=>'novamox_125_rediuse_30_ml_value'],
|
||||
|
|
@ -92,15 +92,21 @@ $brandData = [
|
|||
['brand'=>"Bilafav M ODT Pedia Tablets 1X10s 10/4", 'slug'=>'bilafav_m_odt_pedia_tablets_1x10s_104_units','pseudoId'=>'bilafav_m_odt_pedia_tablets_1x10s_104_value'],
|
||||
|
||||
['brand'=>"Bilafav M Oral suspension", 'slug'=>'bilafav_m_oral_suspension_units','pseudoId'=>'bilafav_m_oral_suspension_value'],
|
||||
['brand'=>"NEKSIUM 20mg TAB (IP)", 'slug'=>'neksium_20mg_tab_ip_units','pseudoId'=>'neksium_20mg_tab_ip_value'],
|
||||
['brand'=>"NEKSIUM 40mg TAB", 'slug'=>'neksium_40mg_tab_units','pseudoId'=>'neksium_40mg_tab_value'],
|
||||
['brand'=>"NEKSIUM-D 20/30mg CAPS 15s (IP)", 'slug'=>'neksium_d_2030mg_caps_15s_ip_units','pseudoId'=>'neksium_d_2030mg_caps_15s_ip_value'],
|
||||
['brand'=>"NEKSIUM-D 40/30mg CAPS 15s (IP)", 'slug'=>'neksium_d_4030mg_caps_15s_ip_units','pseudoId'=>'neksium_d_4030mg_caps_15s_ip_value'],
|
||||
/* ['brand'=>"NEKSIUM 20mg TAB (IP)", 'slug'=>'neksium_20mg_tab_ip_units','pseudoId'=>'neksium_20mg_tab_ip_value'], */
|
||||
/* ['brand'=>"NEKSIUM 40mg TAB", 'slug'=>'neksium_40mg_tab_units','pseudoId'=>'neksium_40mg_tab_value'], */
|
||||
/* ['brand'=>"NEKSIUM-D 20/30mg CAPS 15s (IP)", 'slug'=>'neksium_d_2030mg_caps_15s_ip_units','pseudoId'=>'neksium_d_2030mg_caps_15s_ip_value'], */
|
||||
/*['brand'=>"NEKSIUM-D 40/30mg CAPS 15s (IP)", 'slug'=>'neksium_d_4030mg_caps_15s_ip_units','pseudoId'=>'neksium_d_4030mg_caps_15s_ip_value'],*/
|
||||
['brand'=>"TASIRON 15 CHEW TABS 3X10'S (B12)", 'slug'=>'tasiron_15_chew_tabs_3x10s_b12_units','pseudoId'=>'tasiron_15_chew_tabs_3x10s_b12_value'],
|
||||
['brand'=>"TASIRON 30 CHEW TABS", 'slug'=>'tasiron_30_chew_tabs_units','pseudoId'=>'tasiron_30_chew_tabs_value'],
|
||||
['brand'=>"TASIRON DROPS 30ML WITH EXTERNAL DROPPER", 'slug'=>'tasiron_drops_30ml_with_external_dropper_units','pseudoId'=>'tasiron_drops_30ml_with_external_dropper_value'],
|
||||
['brand'=>"TASIRON SACHET(1X15'S)", 'slug'=>'tasiron_sachet1x15s_units','pseudoId'=>'tasiron_sachet1x15s_value'],
|
||||
['brand'=>"TASIRON SUSPENSION-150ML", 'slug'=>'tasiron_suspension_150ml_units','pseudoId'=>'tasiron_suspension_150ml_value']
|
||||
['brand'=>"TASIRON SUSPENSION-150ML", 'slug'=>'tasiron_suspension_150ml_units','pseudoId'=>'tasiron_suspension_150ml_value'],
|
||||
|
||||
['brand'=>"Pansec 80 MG Tablets", 'slug'=>'pansec_80_mg_tablets_units','pseudoId'=>'pansec_80_mg_tablets_value'],
|
||||
['brand'=>"PANSEC D SR CAPSULES 15'S", 'slug'=>'pansec_d_sr_capsules_15s_units','pseudoId'=>'pansec_d_sr_capsules_15s_value'],
|
||||
['brand'=>"PANSEC TABLETS 15'S", 'slug'=>'pansec_tablets_15s_units','pseudoId'=>'pansec_tablets_15s_value'],
|
||||
['brand'=>"PANSEC-L CAPSULES", 'slug'=>'pansec_l_capsules_units','pseudoId'=>'pansec_l_capsules_value']
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -518,7 +524,14 @@ if (!empty($submissions->data->submissions)) {
|
|||
"tasiron_30_chew_tabs": 840.68,
|
||||
"tasiron_drops_30ml_with_external_dropper": 202.71,
|
||||
"tasiron_sachet1x15s": 217.14,
|
||||
"tasiron_suspension_150ml": 202.71
|
||||
"tasiron_suspension_150ml": 202.71,
|
||||
|
||||
|
||||
"pansec_80_mg_tablets":226.2,
|
||||
"pansec_d_sr_capsules_15s":235.2,
|
||||
"pansec_tablets_15s":197.7,
|
||||
"pansec_l_capsules":132.2,
|
||||
|
||||
|
||||
// 👉 Continue adding all products same way
|
||||
};
|
||||
|
|
@ -545,6 +558,11 @@ if (!empty($submissions->data->submissions)) {
|
|||
|
||||
$('#field-total_pob_value').val(totalValue.toFixed(1));
|
||||
$('#field-total_pob_units').val(totalUnits);
|
||||
|
||||
|
||||
$.each(productGroups, function(groupName, keys) {
|
||||
calculateGroupTotals(groupName, keys);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -569,6 +587,107 @@ if (!empty($submissions->data->submissions)) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
const productGroups = {
|
||||
emeset: ["emeset_4_odtindia1_x_10s","emeset_4mg_10s","emeset_8mg_10s","emeset_syrup","emeset_syrup_strawberry_30_ml"],
|
||||
oflox: [
|
||||
"oflox_100mg_rediuse_60ml",
|
||||
"oflox_200_tab_10s",
|
||||
"oflox_400_10s",
|
||||
"oflox_50mg_rediuse_60ml",
|
||||
"oflox_eye_drops",
|
||||
"oflox_oz_tablets_ip",
|
||||
"oflox_rediuse",
|
||||
"oflox_200_mg_10s_tablets_ip",
|
||||
"oflox_400_mg_10s_tablets_ip"
|
||||
],
|
||||
cefoprox: ["cefoprox_100_30ml60","cefoprox_100dt","cefoprox_200_10s","cefoprox_50_30ml","cefoprox_cv_325_tab"],
|
||||
cheston: ["cheston_duo_100ml_syrup","cheston_ls_junior_100_ml","cheston_d_cough_syrup_100_ml","cheston_d_plus_1_x_10s","cheston_ls_cough_syrup_100_ml","cheston_ls_junior_60_ml"],
|
||||
|
||||
dalacin:["dalacin_c_150mg_caps_10s","dalacin_c_300mg_caps_10s"],
|
||||
dolonex:["dolonex_disp_20mg_tabs_ip","dolonex_im_20mg1ml_inj","dolonex_im_40mg_2ml_inj_hosp_ip","dolonex_im_40mg2ml_inj_ip"],
|
||||
duonase:["duonase_f_70_md","duonase_nasal_spray"],
|
||||
ibugesic:["ibugesic_plus_susp","ibugesic_plus_susp_1","ibugesic_plus_suspension_100ml_orange"],
|
||||
mucinac:["mucinac_200_tablet_1_x_10s","mucinac_600_tablets","mucinac_ab_1_x_10_tablets","mucinac_ab_tablet","mucinac_c_tablets_1_x_15s","mucinac_oral_solution_100ml"],
|
||||
novamox:["novamox_500","novamox_125_rediuse_30_ml","novamox_125_rediuse_60_ml","novamox_250_dt_15s","novamox_250_ru_30","novamox_250_rediuse","novamox_30ml","novamox_60ml","novamox_cv_1000_mg","novamox_cv_2285_dt_tablets","novamox_cv_2285_mg_syrup","novamox_cv_375_tab_10s","novamox_cv_457_dt_10s","novamox_cv_625_tablets_10","novamox_cv_drops","novamox_cv_dry_syrup_30_ml","novamox_cv_ds","novamox_cv_forte_syp","novamox_cv_forte_syp_60_ml","novamox_drops","novamox_lb_500","novamox_rdu_drops","novamox_125_dt_15s","novamox_250_15s"],
|
||||
|
||||
tedispan:["tedispan_200_tablets_6s"],
|
||||
bilafav:["bilafav_m","bilafav_m_odt_adult_tablets_1x10s_2010","bilafav_m_odt_pedia_tablets_1x10s_104","bilafav_m_oral_suspension"],
|
||||
neksium:["neksium_20mg_tab_ip","neksium_40mg_tab","neksium_d_2030mg_caps_15s_ip","neksium_d_4030mg_caps_15s_ip"],
|
||||
tasiron:["tasiron_15_chew_tabs_3x10s_b12","tasiron_30_chew_tabs","tasiron_drops_30ml_with_external_dropper","tasiron_sachet1x15s","tasiron_suspension_150ml"],
|
||||
pansec:["pansec_80_mg_tablets","pansec_d_sr_capsules_15s","pansec_tablets_15s","pansec_l_capsules"],
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
function calculateGroupTotals(groupName, keys) {
|
||||
let totalUnits = 0;
|
||||
let totalValue = 0;
|
||||
|
||||
keys.forEach(key => {
|
||||
totalUnits += parseInt($(`#field-${key}_units`).val()) || 0;
|
||||
totalValue += parseFloat($(`#field-${key}_value`).val()) || 0;
|
||||
});
|
||||
|
||||
$(`#field-${groupName}_units`).val(totalUnits);
|
||||
$(`#field-${groupName}_value`).val(totalValue.toFixed(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-emeset_units" name="emeset_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-emeset_value" name="emeset_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-oflox_units" name="oflox_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-oflox_value" name="oflox_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-cefoprox_units" name="cefoprox_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-cefoprox_value" name="cefoprox_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-cheston_units" name="cheston_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-cheston_value" name="cheston_value" />');
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-dalacin_units" name="dalacin_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-dalacin_value" name="dalacin_value" />');
|
||||
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-dolonex_units" name="dolonex_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-dolonex_value" name="dolonex_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-duonase_units" name="duonase_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-duonase_value" name="duonase_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-ibugesic_units" name="ibugesic_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-ibugesic_value" name="ibugesic_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-mucinac_units" name="mucinac_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-mucinac_value" name="mucinac_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-novamox_units" name="novamox_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-novamox_value" name="novamox_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-tedispan_units" name="tedispan_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-tedispan_value" name="tedispan_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-bilafav_units" name="bilafav_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-bilafav_value" name="bilafav_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-tasiron_units" name="tasiron_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-tasiron_value" name="tasiron_value" />');
|
||||
|
||||
$('#report-form').append('<input type="hidden" id="field-pansec_units" name="pansec_units" />');
|
||||
$('#report-form').append('<input type="hidden" id="field-pansec_value" name="pansec_value" />');
|
||||
|
||||
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
|
|
|
|||
|
|
@ -86,9 +86,25 @@
|
|||
@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)
|
||||
{{-- @foreach($question->options as $option)
|
||||
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach --}}
|
||||
|
||||
@foreach ($question->options as $option)
|
||||
@if($question->code == 'contact_id')
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'uid= ' . (isset($option->contact->uid_number)?$option->contact->uid_number:'') . ' ' : '' }} {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'sbu_code= ' . (isset($option->contact->msl_code) ? $option->contact->msl_code :'') . ' ' : '' }} >
|
||||
{{ $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>
|
||||
@if($id && $question->code == 'select_brandsku')
|
||||
<input type="hidden" name="select_brandsku" id="field-text-{{$question->code}}" value="{{$question->value}}">
|
||||
|
|
@ -219,7 +235,7 @@
|
|||
$('#field-contact_id').append($("<option></option>").attr("value", '').text('-- Select --'));
|
||||
for(let itm of data) {
|
||||
//$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display));
|
||||
$('#field-contact_id').append($("<option></option>").attr("ciscure_dr_tagging", itm.contact.ciscure_dr_tagging).attr("emprogest_gel_dr_tagging", itm.contact.emprogest_gel_dr_tagging).attr("dydroeva_dr_tagging", itm.contact.dydroeva_dr_tagging).attr("depot_dr_tagging", itm.contact.depot_dr_tagging).attr("materna_hcg_dr_tagging", itm.contact.materna_hcg_dr_tagging).attr("materna_hmg_dr_tagging", itm.contact.materna_hmg_dr_tagging).attr("value", itm.value).text(itm.display));
|
||||
$('#field-contact_id').append($("<option></option>").attr("ciscure_dr_tagging", itm.contact.ciscure_dr_tagging).attr("emprogest_gel_dr_tagging", itm.contact.emprogest_gel_dr_tagging).attr("dydroeva_dr_tagging", itm.contact.dydroeva_dr_tagging).attr("depot_dr_tagging", itm.contact.depot_dr_tagging).attr("materna_hcg_dr_tagging", itm.contact.materna_hcg_dr_tagging).attr("materna_hmg_dr_tagging", itm.contact.materna_hmg_dr_tagging).attr("value", itm.value).attr("sbu_code", itm.contact.msl_code).attr("uid", itm.contact.uid_number).text(itm.display));
|
||||
}
|
||||
$('#field-contact_id').unbind()
|
||||
|
||||
|
|
@ -302,6 +318,14 @@
|
|||
})
|
||||
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-sbu_code').val($('option:selected', this).attr('sbu_code'));
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-uid').val($('option:selected', this).attr('uid'));
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
|
@ -326,6 +350,7 @@
|
|||
$('#field-enter_investment_amount').attr("min",0);
|
||||
|
||||
|
||||
|
||||
$('#field-select_brandsku').on('change',function(){
|
||||
let value=$('#field-select_brandsku').val().trim();
|
||||
if(value===''){
|
||||
|
|
@ -355,6 +380,12 @@
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
$('#field-sbu_code').prop('readonly', true);
|
||||
$('#field-uid').prop('readonly', true);
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
|
|
|
|||
|
|
@ -533,7 +533,7 @@
|
|||
$('label[for="' + element + '"]').hide();
|
||||
});
|
||||
|
||||
if (selectedValue == 'Clinic' || selectedValue == 'Camp') {
|
||||
if (selectedValue == 'HL Plus AI Clinics' || selectedValue == 'Camp' || selectedValue == 'Spirometry Clinics') {
|
||||
camp_clinic.forEach(element => {
|
||||
$('#' + element).show().prop('required', true);
|
||||
$('label[for="' + element + '"]').show();
|
||||
|
|
@ -586,7 +586,7 @@
|
|||
$('label[for="' + element + '"]').hide();
|
||||
});
|
||||
|
||||
if (selectedValue == 'Camp' || selectedValue == 'Clinic') {
|
||||
if (selectedValue == 'HL Plus AI Clinics' || selectedValue == 'Camp' || selectedValue == 'Spirometry Clinics') {
|
||||
camp_clinic.forEach(element => {
|
||||
$('#' + element).show().prop('required', true);
|
||||
$('label[for="' + element + '"]').show();
|
||||
|
|
|
|||
|
|
@ -101,6 +101,10 @@
|
|||
<td>
|
||||
@if(isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'yes')
|
||||
Converted
|
||||
<br>
|
||||
<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>
|
||||
|
||||
@else
|
||||
<button type="button" class="btn btn-xs btn-info edit-btn"
|
||||
|
|
@ -212,7 +216,7 @@
|
|||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach ($question->options as $option)
|
||||
@php $spec = $option->contact->speciality ?? ''; @endphp
|
||||
{{-- @php $spec = $option->contact->speciality ?? ''; @endphp
|
||||
@if (in_array($spec, ['BAMS', 'BAMS-MD', 'BHMS', 'CARDIOLOGIST', 'CHEST', 'CHEST PHY','Chest Physician','Chest Speciality','Chest/PULMO','CONSULTANAT NEPHROLOGIST','CONSULTANT PHYSICIAN','CONSULTING PHYSICIAN','CP','dch','DENTIST','DENTIST - BDS','DIABETOLOGIST','DM PAED','DNB CHEST','DNB ENT','DNB MED','DNB PAED','DTCD','ENT','General Physician','General Practice','GENERAL PRACTITIONER','GP MBBS','Gp Non-Mbbs','GYNAECOLOGIST','INTENSIVIST','MBBS','MBBS DCH','MBBS GENERAL PRACTITIONER','MBBS GENERALPRACTITIONER','MBBS MD','MBBS MD CHEST','MBBS-MD DCH','MBBS-PAED','MCH PAEDSURG','MD','MD D','MD CHEST','MD PAED','MD,DCH','MS ENT','Nephrologist/Urologist','NON MBBS GENERAL PRACTITIONER','ORTHOPEDICIAN','OTOLARYNGOLOGIST','PAEDIATRICIAN','Pedia','PEDIATRIC SURGEON','PEDIATRICIAN','PHY','PHYSICIAN','PRACTISING RHEUMATOLOGIST B','PSYCHIATRIST','PULMO','PULMONOLOGIST','SOTs','SURGEON']))
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
|
|
@ -220,7 +224,24 @@
|
|||
speciality="{{ $spec }}">
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif --}}
|
||||
|
||||
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor' )
|
||||
<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>
|
||||
@else
|
||||
|
|
|
|||
|
|
@ -3975,10 +3975,10 @@
|
|||
today = yyyy + '-' + mm + '-' + dd;
|
||||
|
||||
var recordDateField = document.getElementById('field-plan_date');
|
||||
//recordDateField.setAttribute('min', today);
|
||||
//recordDateField.setAttribute('max', today);
|
||||
|
||||
var executionDateField = document.getElementById('execution-plan_date');
|
||||
//executionDateField.setAttribute('min', today);
|
||||
executionDateField.setAttribute('max', today);
|
||||
|
||||
// $('.edit-btn').click(function() {
|
||||
// var executionexeField = document.getElementById('execution-record_date');
|
||||
|
|
@ -3987,7 +3987,7 @@
|
|||
|
||||
$('.edit-btn').click(function() {
|
||||
var executionexeField = document.getElementById('execution-execution_date');
|
||||
executionexeField.setAttribute('min', executionDateField.value);
|
||||
executionexeField.setAttribute('max', executionDateField.value);
|
||||
});
|
||||
|
||||
|
||||
|
|
@ -3995,7 +3995,7 @@
|
|||
executionDateField.addEventListener('change', function() {
|
||||
console.log('gg');
|
||||
var executionexeField = document.getElementById('execution-record_date');
|
||||
executionexeField.setAttribute('min', executionDateField.value);
|
||||
executionexeField.setAttribute('max', executionDateField.value);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@
|
|||
}
|
||||
|
||||
let docid = $('#execution-contact_id option').map(function() {
|
||||
if ($(this).text().trim() == selected['contact_id']) return this;
|
||||
if ($(this).text().trim() == selected['contact_id'] || $(this).val().trim() == selected['cont_id']) return this;
|
||||
}).attr('value')
|
||||
|
||||
$('#execution-contact_id').val(docid)
|
||||
|
|
@ -613,7 +613,7 @@
|
|||
}
|
||||
|
||||
let docid = $('#execution-contact_id option').map(function() {
|
||||
if ($(this).text().trim() == selected['contact_id']) return this;
|
||||
if ($(this).text().trim() == selected['contact_id'] || $(this).val().trim() == selected['cont_id']) return this;
|
||||
}).attr('value')
|
||||
|
||||
$('#execution-contact_id').val(docid)
|
||||
|
|
|
|||
|
|
@ -59,13 +59,27 @@ $brandData = [
|
|||
@endphp
|
||||
|
||||
@php
|
||||
// $submissions = Formhelper::getMultiformData($form->partition, $form_id, $form->user_id);
|
||||
// $submission = null;
|
||||
// if(isset($submissions->data->submissions) && count($submissions->data->submissions) > 0) {
|
||||
// $submission = $submissions->data->submissions[0];
|
||||
// $formdata = $submission->formdata ?? (object)[];
|
||||
// } else {
|
||||
// $formdata = [];
|
||||
// }
|
||||
|
||||
$submissions = Formhelper::getMultiformData($form->partition, $form_id, $form->user_id);
|
||||
$submission = null;
|
||||
if(isset($submissions->data->submissions) && count($submissions->data->submissions) > 0) {
|
||||
$submission = $submissions->data->submissions[0];
|
||||
$formdata = $submission->formdata ?? (object)[];
|
||||
} else {
|
||||
$formdata = [];
|
||||
|
||||
|
||||
$formdata = null;
|
||||
|
||||
if (!empty($submissions->data->submissions)) {
|
||||
foreach ($submissions->data->submissions as $submission) {
|
||||
if ($submission->id == $id) {
|
||||
$formdata = $submission->formdata ?? null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// echo "<pre>";
|
||||
|
|
@ -178,6 +192,36 @@ $brandData = [
|
|||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
@elseif($question->code == 'chemist_list')
|
||||
<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(isset($option->contact->type) && strtolower($option->contact->type) == 'chemist')
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif --}}
|
||||
|
||||
@if(
|
||||
isset($option->contact->type) &&
|
||||
strtolower(trim($option->contact->type)) == 'chemist' &&
|
||||
empty(trim($option->contact->source ?? ''))
|
||||
)
|
||||
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
|
||||
{{ $option->display }}
|
||||
|
||||
</option>
|
||||
|
||||
@endif
|
||||
@endforeach
|
||||
<option value="Others">Others</option>
|
||||
</select>
|
||||
@else
|
||||
|
||||
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
|
|
@ -348,6 +392,22 @@ $brandData = [
|
|||
$('#field-pcode').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-cheemist_name').parent().hide();
|
||||
$('#field-cheemist_name').attr('required',false);
|
||||
|
||||
$('#field-chemist_list').on('change',function(){
|
||||
let value=$(this).val();
|
||||
if(value==='Others'){
|
||||
$('#field-cheemist_name').parent().show();
|
||||
$('#field-cheemist_name').attr('required',true);
|
||||
}
|
||||
else{
|
||||
$('#field-cheemist_name').parent().hide();
|
||||
$('#field-cheemist_name').attr('required',false);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$('#field-chemist_name').parent().hide();
|
||||
$("#field-chemist_name").prop({"required":false});
|
||||
$('#field-pcode').prop('readonly',true);
|
||||
|
|
|
|||
|
|
@ -602,46 +602,6 @@ $(document).ready(function () {
|
|||
|
||||
|
||||
/*
|
||||
function setDateRange() {
|
||||
let today = new Date();
|
||||
|
||||
let currentDay = today.getDate();
|
||||
let currentMonth = today.getMonth();
|
||||
let currentYear = today.getFullYear();
|
||||
|
||||
let lastDayOfMonth = new Date(currentYear, currentMonth + 1, 0).getDate();
|
||||
|
||||
if (currentDay >= 25 || currentDay === lastDayOfMonth) {
|
||||
|
||||
let nextMonthStart = new Date(currentYear, currentMonth + 1, 1);
|
||||
let nextMonthEnd = new Date(currentYear, currentMonth + 2, 0);
|
||||
|
||||
$('#field-plan_date')
|
||||
.attr('min', formatYMD(nextMonthStart))
|
||||
.attr('max', formatYMD(nextMonthEnd))
|
||||
.val(formatYMD(nextMonthStart))
|
||||
.prop('disabled', false);
|
||||
|
||||
// $('#execution-plan_date')
|
||||
// .attr('min', formatYMD(nextMonthStart))
|
||||
// .attr('max', formatYMD(nextMonthEnd))
|
||||
// .val(formatYMD(nextMonthStart))
|
||||
// .prop('disabled', false);
|
||||
|
||||
} else {
|
||||
$('#field-plan_date')
|
||||
.val('')
|
||||
.prop('disabled', true);
|
||||
|
||||
// $('#execution-plan_date')
|
||||
// .val('')
|
||||
// .prop('disabled', true);
|
||||
}
|
||||
}
|
||||
|
||||
setDateRange();
|
||||
*/
|
||||
|
||||
function setPlanDateRange() {
|
||||
let today = new Date();
|
||||
|
||||
|
|
@ -677,13 +637,9 @@ function setPlanDateRange() {
|
|||
// Call on page load
|
||||
setPlanDateRange();
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// $(function () {
|
||||
// $('#field-plan_date')
|
||||
// .attr('min', '2026-02-01')
|
||||
// .attr('max', '2026-02-28'); // use 29 if leap year
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,21 +11,8 @@
|
|||
</div>
|
||||
|
||||
@php
|
||||
// echo "<pre>";
|
||||
// print_r($form);
|
||||
// exit;
|
||||
|
||||
$data = DB::table('team3_tripleimpact')->where('hierarchy_id', $form->hierarchy_id)->get();
|
||||
// echo "<pre>";
|
||||
// print_r($data);
|
||||
// exit;
|
||||
|
||||
$history = Formhelper::getMultiformData($form->partition, $form->form_id, $form->user_id);
|
||||
// echo '<pre>';
|
||||
// print_r($history);
|
||||
// echo '</pre>';
|
||||
// exit
|
||||
|
||||
$existingCounts = [
|
||||
'chest' => 0,
|
||||
'pedia' => 0,
|
||||
|
|
@ -586,9 +573,7 @@ jQuery(document).ready(function($) {
|
|||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -60,7 +60,7 @@
|
|||
<th>Camp Plan Date</th>
|
||||
<th>Execution Done</th>
|
||||
<th>Doctor Name</th>
|
||||
<th>Other Doctor Name</th>
|
||||
{{-- <th>Other Doctor Name</th> --}}
|
||||
<th>Camp Execution Date</th>
|
||||
|
||||
<th>Reporting Date</th>
|
||||
|
|
@ -110,19 +110,19 @@
|
|||
$today=date('d',strtotime("-1 months"));
|
||||
|
||||
?>
|
||||
@if($sub->workflow_status == 'approved')
|
||||
|
||||
@if ( $planDate && $planDate->between($startOfCurrentMonth, $fifthOfNextMonth) && $now->greaterThanOrEqualTo($planDate))
|
||||
<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>
|
||||
|
||||
@endif
|
||||
@elseif ($sub->workflow_status == 'rejected' ||
|
||||
|
||||
{{-- @elseif ($sub->workflow_status == 'rejected' ||
|
||||
(isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'no'))
|
||||
<button type="button" class="btn btn-xs btn-info edit-plan-btn"
|
||||
plan_details="{{ json_encode($sub->formdata) }}">
|
||||
<i class="mdi mdi-pencil"></i> Edit Plan
|
||||
</button>
|
||||
</button> --}}
|
||||
@endif
|
||||
|
||||
</td>
|
||||
|
|
@ -142,17 +142,18 @@
|
|||
{{ '' }}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
|
||||
{{-- <td>
|
||||
@if (isset($sub->formdata->contact_id_2) && $sub->formdata->contact_id_2
|
||||
!== '')
|
||||
{{ $sub->formdata->contact_id_2 }}
|
||||
@elseif (isset($sub->formdata->doctor_name))
|
||||
{{ $sub->formdata->doctor_name }}
|
||||
@else
|
||||
{{-- Default value or empty string, adjust as needed --}}
|
||||
|
||||
{{ '' }}
|
||||
@endif
|
||||
</td>
|
||||
</td> --}}
|
||||
<td>{{$sub->formdata->execution_date}}</td>
|
||||
<td>{{isset($sub->formdata->record_date ) ? $sub->formdata->record_date : ''}}
|
||||
</td>
|
||||
|
|
@ -247,16 +248,20 @@
|
|||
<option value=""> -- Select -- </option>
|
||||
@if ($question->code == 'contact_id')
|
||||
@foreach ($question->options as $option)
|
||||
@if( isset($option->contact->ardc_camp_doctor_octnov) && $option->contact->ardc_camp_doctor_octnov == 'Yes' )
|
||||
<option value="{{ $option->value }}" legacy_code="{{isset($option->contact->legacy_code)?$option->contact->legacy_code:''}}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
|
||||
<option value="{{ $option->value }}"
|
||||
legacy_code="{{isset($option->contact->legacy_code)?$option->contact->legacy_code:''}}"
|
||||
speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
ardc_css_restricted_drs="{{isset($option->contact->ardc_css_restricted_drs)?$option->contact->ardc_css_restricted_drs:''}}"
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
|
||||
|
||||
@endforeach
|
||||
<option value="others" {{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>
|
||||
{{-- <option value="others" {{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>
|
||||
others
|
||||
</option>
|
||||
</option> --}}
|
||||
@elseif($question->code=='contact_id_2')
|
||||
@foreach ($question->options as $option)
|
||||
|
||||
|
|
@ -534,7 +539,7 @@
|
|||
});
|
||||
|
||||
$('#execution-total_rxns').prop({"readonly":true});
|
||||
$('#execution-executed_as_per_plan').prop("disabled",true);
|
||||
//$('#execution-executed_as_per_plan').prop("disabled",true);
|
||||
|
||||
// $('#execution-patients_diagnosed').on('change',function(){
|
||||
// let a=document.getElementById('execution-patients_diagnosed');
|
||||
|
|
@ -572,10 +577,10 @@
|
|||
e.preventDefault();
|
||||
})
|
||||
|
||||
let contact2 = document.getElementById('execution-contact_id_2');
|
||||
/* let contact2 = document.getElementById('execution-contact_id_2');
|
||||
contact2.addEventListener('mousedown', function(e) {
|
||||
e.preventDefault();
|
||||
})
|
||||
}) */
|
||||
|
||||
|
||||
let camp_planned_start = document.getElementById('execution-camp_planned_start_time');
|
||||
|
|
@ -666,6 +671,8 @@
|
|||
$('#execution-form').append('<input type="hidden" name="execution_done" value="yes">');
|
||||
})
|
||||
|
||||
|
||||
/*
|
||||
$('.edit-plan-btn').click(function() {
|
||||
$('#execution-form-wrapper').show(100, () => {
|
||||
$('#add-camp-btn').hide(0);
|
||||
|
|
@ -772,6 +779,10 @@
|
|||
}
|
||||
|
||||
})
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
|
@ -819,12 +830,30 @@
|
|||
|
||||
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
/*$('#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('legacy_code'))
|
||||
})*/
|
||||
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
$('#field-msl_code').val($('option:selected', this).attr('legacy_code'))
|
||||
let restricted=$(this).find(":selected").attr('ardc_css_restricted_drs');
|
||||
console.log("restricted:",restricted);
|
||||
if (restricted === 'Yes') {
|
||||
|
||||
alert('Planning with these Doctors not allowed');
|
||||
|
||||
// Deselect current option
|
||||
$(this).val('').trigger('change');
|
||||
|
||||
// Clear msl code as well
|
||||
$('#field-msl_code').val('');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -974,6 +1003,95 @@
|
|||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
// Existing submissions
|
||||
let submissions = @json($history->data->submissions);
|
||||
|
||||
function markMonthlyAddedDoctors() {
|
||||
|
||||
// Current month & year
|
||||
let today = new Date();
|
||||
|
||||
let currentMonth = today.getMonth();
|
||||
let currentYear = today.getFullYear();
|
||||
|
||||
// Store doctors already added this month
|
||||
let addedDoctors = [];
|
||||
|
||||
submissions.forEach(function(submission){
|
||||
|
||||
let doctorName = submission.formdata?.contact_id ?? '';
|
||||
let planDate = submission.formdata?.plan_date ?? '';
|
||||
|
||||
if (!doctorName || !planDate) return;
|
||||
|
||||
let existingDate = new Date(planDate);
|
||||
|
||||
let existingMonth = existingDate.getMonth();
|
||||
let existingYear = existingDate.getFullYear();
|
||||
|
||||
// Same current month + year
|
||||
if (
|
||||
existingMonth === currentMonth &&
|
||||
existingYear === currentYear
|
||||
) {
|
||||
addedDoctors.push(doctorName.trim());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Update dropdown options
|
||||
$('#field-contact_id option').each(function(){
|
||||
|
||||
let optionText = $(this).text().replace(' (Already added)', '').trim();
|
||||
|
||||
// Reset old text
|
||||
$(this).text(optionText);
|
||||
|
||||
// Skip placeholder
|
||||
if ($(this).val() === '') return;
|
||||
|
||||
// If doctor already added this month
|
||||
if (addedDoctors.includes(optionText)) {
|
||||
|
||||
$(this).text(optionText + ' (Already added)');
|
||||
$(this).attr('data-added', 'yes');
|
||||
|
||||
} else {
|
||||
|
||||
$(this).removeAttr('data-added');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Run initially
|
||||
markMonthlyAddedDoctors();
|
||||
|
||||
// Prevent selection
|
||||
$('#field-contact_id').change(function () {
|
||||
|
||||
let selectedOption = $(this).find(':selected');
|
||||
|
||||
let alreadyAdded = selectedOption.attr('data-added');
|
||||
|
||||
if (alreadyAdded === 'yes') {
|
||||
|
||||
alert('Doctor already added in this month');
|
||||
|
||||
$(this).val('').trigger('change');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -71,6 +71,14 @@ if (!empty($history->data->submissions)) {
|
|||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
echo "<div class='container'>";
|
||||
echo "<pre>";
|
||||
print_r($history->data->submissions);
|
||||
echo "</pre>";
|
||||
|
||||
echo "</div>";
|
||||
*/
|
||||
@endphp
|
||||
|
||||
|
||||
|
|
@ -128,7 +136,7 @@ if (!empty($history->data->submissions)) {
|
|||
<th>Camp Plan Date</th>
|
||||
<th>Execution Done</th>
|
||||
<th>Doctor Name</th>
|
||||
<th>Other Doctor Name</th>
|
||||
{{-- <th>Other Doctor Name</th> --}}
|
||||
<th>Camp Execution Date</th>
|
||||
<th>Legacy Code</th>
|
||||
<th>Speciality</th>
|
||||
|
|
@ -172,19 +180,19 @@ if (!empty($history->data->submissions)) {
|
|||
|
||||
<tr>
|
||||
<td>
|
||||
@if($sub->workflow_status == 'approved')
|
||||
|
||||
@if ( $planDate && $planDate->between($startOfCurrentMonth, $fifthOfNextMonth) && $now->greaterThanOrEqualTo($planDate))
|
||||
<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>
|
||||
|
||||
@endif
|
||||
@elseif ($sub->workflow_status == 'rejected' ||
|
||||
|
||||
{{-- @elseif ($sub->workflow_status == 'rejected' ||
|
||||
(isset($sub->formdata->execution_done) && $sub->formdata->execution_done == 'no'))
|
||||
<button type="button" class="btn btn-xs btn-info edit-plan-btn"
|
||||
plan_details="{{ json_encode($sub->formdata) }}">
|
||||
<i class="mdi mdi-pencil"></i> Edit Plan
|
||||
</button>
|
||||
</button> --}}
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $sub->formdata->plan_date }}</td>
|
||||
|
|
@ -202,17 +210,17 @@ if (!empty($history->data->submissions)) {
|
|||
{{ '' }}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{-- <td>
|
||||
@if (isset($sub->formdata->contact_id_2) && $sub->formdata->contact_id_2
|
||||
!== '')
|
||||
{{ $sub->formdata->contact_id_2 }}
|
||||
@elseif (isset($sub->formdata->doctor_name))
|
||||
{{ $sub->formdata->doctor_name }}
|
||||
@else
|
||||
{{-- Default value or empty string, adjust as needed --}}
|
||||
|
||||
{{ '' }}
|
||||
@endif
|
||||
</td>
|
||||
</td> --}}
|
||||
<td>{{$sub->formdata->execution_date}}</td>
|
||||
<td>{{isset($sub->formdata->msl_code) ? $sub->formdata->msl_code : '' }}
|
||||
</td>
|
||||
|
|
@ -304,16 +312,21 @@ if (!empty($history->data->submissions)) {
|
|||
<option value=""> -- Select -- </option>
|
||||
@if ($question->code == 'contact_id')
|
||||
@foreach ($question->options as $option)
|
||||
@if( isset($option->contact->css_camp_doctor_octnov) && $option->contact->css_camp_doctor_octnov == 'Yes' )
|
||||
<option value="{{ $option->value }}" msl_code="{{isset($option->contact->legacy_code)?$option->contact->legacy_code:''}}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
@if ($option->contact->type == 'doctor')
|
||||
<option value="{{ $option->value }}"
|
||||
msl_code="{{isset($option->contact->legacy_code)?$option->contact->legacy_code:''}}"
|
||||
speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
ardc_css_restricted_drs="{{isset($option->contact->ardc_css_restricted_drs)?$option->contact->ardc_css_restricted_drs:''}}"
|
||||
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
|
||||
@endforeach
|
||||
<option value="others" {{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>
|
||||
{{-- <option value="others" {{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>
|
||||
others
|
||||
</option>
|
||||
</option> --}}
|
||||
@elseif($question->code=='contact_id_2')
|
||||
@foreach ($question->options as $option)
|
||||
|
||||
|
|
@ -424,9 +437,9 @@ if (!empty($history->data->submissions)) {
|
|||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
<option value="others"{{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>
|
||||
{{-- <option value="others"{{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>
|
||||
others
|
||||
</option>
|
||||
</option> --}}
|
||||
|
||||
</select>
|
||||
|
||||
|
|
@ -599,10 +612,10 @@ if (!empty($history->data->submissions)) {
|
|||
e.preventDefault();
|
||||
})
|
||||
|
||||
let contact2 = document.getElementById('execution-contact_id_2');
|
||||
/* let contact2 = document.getElementById('execution-contact_id_2');
|
||||
contact2.addEventListener('mousedown', function(e) {
|
||||
e.preventDefault();
|
||||
})
|
||||
}) */
|
||||
|
||||
// let typeOfDr = document.getElementById('execution-type_of_dr');
|
||||
// typeOfDr.addEventListener('mousedown', function(e) {
|
||||
|
|
@ -696,6 +709,7 @@ if (!empty($history->data->submissions)) {
|
|||
})
|
||||
|
||||
|
||||
/*
|
||||
$('.edit-plan-btn').click(function() {
|
||||
$('#execution-form-wrapper').show(100, () => {
|
||||
$('#add-camp-btn').hide(0);
|
||||
|
|
@ -801,6 +815,9 @@ if (!empty($history->data->submissions)) {
|
|||
$typeDr.on('change', toggleFlutter);
|
||||
})
|
||||
|
||||
*/
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
|
|
@ -832,28 +849,28 @@ if (!empty($history->data->submissions)) {
|
|||
});
|
||||
});
|
||||
|
||||
// $('#execution-sitazit_d_rx').attr({
|
||||
// "min":0,
|
||||
// "max":50
|
||||
// });
|
||||
// $('#execution-sitazit_dm_rx').attr({
|
||||
// "min":0,
|
||||
// "max":50
|
||||
// });
|
||||
// $('#execution-ziten_m_rx').attr({
|
||||
// "min":0,
|
||||
// "max":50
|
||||
// });
|
||||
|
||||
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr(
|
||||
'speciality'))
|
||||
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
let restricted=$(this).find(":selected").attr('ardc_css_restricted_drs');
|
||||
console.log("restricted:",restricted);
|
||||
if (restricted === 'Yes') {
|
||||
|
||||
alert('Planning with these Doctors not allowed');
|
||||
|
||||
// Deselect current option
|
||||
$(this).val('').trigger('change');
|
||||
|
||||
// Clear msl code as well
|
||||
$('#field-msl_code').val('');
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -883,6 +900,7 @@ if (!empty($history->data->submissions)) {
|
|||
|
||||
$('#field-contact_id_2').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
|
||||
})
|
||||
|
||||
$('#execution-form').on('submit', function(event) {
|
||||
|
|
@ -1246,8 +1264,92 @@ $(document).ready(function () {
|
|||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
// Existing submissions
|
||||
let submissions = @json($history->data->submissions);
|
||||
|
||||
function markMonthlyAddedDoctors() {
|
||||
|
||||
// Current month & year
|
||||
let today = new Date();
|
||||
|
||||
let currentMonth = today.getMonth();
|
||||
let currentYear = today.getFullYear();
|
||||
|
||||
// Store doctors already added this month
|
||||
let addedDoctors = [];
|
||||
|
||||
submissions.forEach(function(submission){
|
||||
|
||||
let doctorName = submission.formdata?.contact_id ?? '';
|
||||
let planDate = submission.formdata?.plan_date ?? '';
|
||||
|
||||
if (!doctorName || !planDate) return;
|
||||
|
||||
let existingDate = new Date(planDate);
|
||||
|
||||
let existingMonth = existingDate.getMonth();
|
||||
let existingYear = existingDate.getFullYear();
|
||||
|
||||
// Same current month + year
|
||||
if (
|
||||
existingMonth === currentMonth &&
|
||||
existingYear === currentYear
|
||||
) {
|
||||
addedDoctors.push(doctorName.trim());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Update dropdown options
|
||||
$('#field-contact_id option').each(function(){
|
||||
|
||||
let optionText = $(this).text().replace(' (Already added)', '').trim();
|
||||
|
||||
// Reset old text
|
||||
$(this).text(optionText);
|
||||
|
||||
// Skip placeholder
|
||||
if ($(this).val() === '') return;
|
||||
|
||||
// If doctor already added this month
|
||||
if (addedDoctors.includes(optionText)) {
|
||||
|
||||
$(this).text(optionText + ' (Already added)');
|
||||
$(this).attr('data-added', 'yes');
|
||||
|
||||
} else {
|
||||
|
||||
$(this).removeAttr('data-added');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Run initially
|
||||
markMonthlyAddedDoctors();
|
||||
|
||||
// Prevent selection
|
||||
$('#field-contact_id').change(function () {
|
||||
|
||||
let selectedOption = $(this).find(':selected');
|
||||
|
||||
let alreadyAdded = selectedOption.attr('data-added');
|
||||
|
||||
if (alreadyAdded === 'yes') {
|
||||
|
||||
alert('Doctor already added in this month');
|
||||
|
||||
$(this).val('').trigger('change');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,57 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<style>
|
||||
|
||||
/* =========================
|
||||
SELECT2 CUSTOM HIGHLIGHT
|
||||
========================= */
|
||||
|
||||
.select2-container .select2-selection--single{
|
||||
height: 38px !important;
|
||||
border: 1px solid #ced4da !important;
|
||||
border-radius: 6px !important;
|
||||
padding-top: 4px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered{
|
||||
line-height: 28px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow{
|
||||
height: 36px !important;
|
||||
}
|
||||
|
||||
/* Dropdown option hover */
|
||||
.select2-results__option--highlighted{
|
||||
background-color: #0d6efd !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
/* Selected option */
|
||||
.select2-results__option[aria-selected=true]{
|
||||
background-color: #dbe9ff !important;
|
||||
color: black !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Search box */
|
||||
.select2-search__field{
|
||||
border-radius: 5px !important;
|
||||
padding: 6px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" alt="processing..." />
|
||||
</div>
|
||||
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
|
|
@ -24,7 +68,8 @@
|
|||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
@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>
|
||||
|
|
@ -38,11 +83,19 @@
|
|||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
||||
$submissions = $submissions->data->submissions;
|
||||
|
||||
|
||||
@endphp
|
||||
@if(count($submissions)===0 || $id)
|
||||
<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}}">
|
||||
<input type="hidden" name="id[0]" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
|
|
@ -56,58 +109,144 @@
|
|||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
@foreach($questions as $question)
|
||||
@if( !in_array($question->code,
|
||||
["record_date","select_rxber_type"] ) )
|
||||
@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>
|
||||
<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:''}}">
|
||||
<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:''}}">
|
||||
<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}}">
|
||||
<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>
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@if ($question->code == 'contact_id')
|
||||
@foreach ($question->options as $option)
|
||||
@if( isset($option->contact->montair_lc_kid_non_rxber_survey) && $option->contact->montair_lc_kid_non_rxber_survey == 'Yes' )
|
||||
<option value="{{ $option->value }}" speciality="{{isset($option->contact->speciality)?$option->contact->speciality:''}}" msl_code="{{isset($option->contact->msl_code)?$option->contact->msl_code:''}}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->msl_code . ' ' : '' }} {{ $question->code == 'doctor_name' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
|
||||
@endforeach
|
||||
@else
|
||||
@foreach ($question->options as $option)
|
||||
<option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
<div class="doctor-wrapper">
|
||||
|
||||
@foreach($questions as $question)
|
||||
@if( in_array($question->code,
|
||||
["record_date","select_rxber_type"] ) )
|
||||
@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}}[0]"
|
||||
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}}[0]" 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}}[0]"
|
||||
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}}[0]"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
@if ($question->code == 'contact_id')
|
||||
<select class="form-control" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}[0]"
|
||||
{{ $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' : '' }}
|
||||
@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>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<select class="form-control" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}[0]"
|
||||
{{ $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>
|
||||
@endif
|
||||
@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>
|
||||
<input class="form-check-input" type="checkbox"
|
||||
id="field-{{$question->code}}-{{$option->value}}"
|
||||
name="{{$question->code}}[0]" 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')
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" value="" {{$question->required == 'yes'?'required':'' }}>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) &&
|
||||
$form->is_approval != 'yes' ) )
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}"
|
||||
class="form-control" value=""
|
||||
{{$question->required == 'yes'?'required':'' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{$question->value}}" class="img-fluid">
|
||||
@endif
|
||||
|
|
@ -118,7 +257,9 @@
|
|||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}" name="{{$option->value}}" class="form-control" required value="{{isset($option->val)?$option->val:0}}">
|
||||
<input type="number" id="field-{{$option->value}}"
|
||||
name="{{$option->value}}" class="form-control" required
|
||||
value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
|
@ -126,13 +267,23 @@
|
|||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
</div>
|
||||
<div id="doctor-group-wrapper">
|
||||
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval !=
|
||||
'yes' ) )
|
||||
<div class="text-center button-list">
|
||||
@if(!$id)
|
||||
<button class="btn btn-primary" type="button" id="adddoctor-btn"> Add Doctor </button>
|
||||
@endif
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
@elseif(!$id)
|
||||
<h4>You have submitted 10 doctors</h4>
|
||||
@endif
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
|
@ -163,20 +314,398 @@
|
|||
position: absolute;
|
||||
top: 50%;
|
||||
}
|
||||
.anti-heading{
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.doctor-wrapper {
|
||||
border: 1px solid #ccc;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
$('#field-contact_id').on('change',function(){
|
||||
$('#field-msl_code').val($(this).find(":selected").attr("msl_code"));
|
||||
})
|
||||
|
||||
$('#field-contact_id').on('change',function(){
|
||||
$('#field-speciality').val($(this).find(":selected").attr("speciality"));
|
||||
})
|
||||
|
||||
$('#field-msl_code,#field-speciality').attr('readonly',true);
|
||||
|
||||
function initializeSelect2() {
|
||||
|
||||
$('select[id^="field-contact_id"]').select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
$('#field-user_id').select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select User / Territory --'
|
||||
});
|
||||
|
||||
$('select[id^="execution-"]').select2({
|
||||
width: '100%'
|
||||
});
|
||||
}
|
||||
|
||||
initializeSelect2();
|
||||
preventDuplicateDoctors();
|
||||
|
||||
|
||||
|
||||
/* function preventDuplicateDoctors() {
|
||||
|
||||
let selectedValues = [];
|
||||
|
||||
// Get all selected doctor values
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if (value) {
|
||||
selectedValues.push(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Apply duplicate prevention
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let currentSelect = $(this);
|
||||
let currentValue = currentSelect.val();
|
||||
|
||||
currentSelect.find('option').each(function () {
|
||||
|
||||
let option = $(this);
|
||||
let optionValue = option.val();
|
||||
|
||||
if (!optionValue) return;
|
||||
|
||||
// Remove old text
|
||||
let cleanText = option.text().replace(' (Already Added)', '');
|
||||
|
||||
if (
|
||||
selectedValues.includes(optionValue) &&
|
||||
optionValue !== currentValue
|
||||
) {
|
||||
|
||||
option.prop('disabled', true);
|
||||
option.text(cleanText + ' (Already Added)');
|
||||
|
||||
} else {
|
||||
|
||||
option.prop('disabled', false);
|
||||
option.text(cleanText);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 🔥 IMPORTANT
|
||||
currentSelect.select2('destroy');
|
||||
|
||||
currentSelect.select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
} */
|
||||
|
||||
function preventDuplicateDoctors() {
|
||||
|
||||
let selectedValues = [];
|
||||
|
||||
// Collect selected values
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if (value) {
|
||||
selectedValues.push(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let currentSelect = $(this);
|
||||
let currentValue = currentSelect.val();
|
||||
|
||||
currentSelect.find('option').each(function () {
|
||||
|
||||
let option = $(this);
|
||||
let optionValue = option.val();
|
||||
|
||||
if (!optionValue) return;
|
||||
|
||||
// remove previous label
|
||||
let cleanText = option.text().replace(' (Already Added)', '');
|
||||
|
||||
// IMPORTANT:
|
||||
// keep currently selected option enabled
|
||||
if (
|
||||
selectedValues.includes(optionValue) &&
|
||||
optionValue !== currentValue
|
||||
) {
|
||||
|
||||
option.prop('disabled', true);
|
||||
option.text(cleanText + ' (Already Added)');
|
||||
|
||||
} else {
|
||||
|
||||
option.prop('disabled', false);
|
||||
option.text(cleanText);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// refresh select2 safely
|
||||
if (currentSelect.hasClass("select2-hidden-accessible")) {
|
||||
currentSelect.select2('destroy');
|
||||
}
|
||||
|
||||
currentSelect.select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
// VERY IMPORTANT FOR EDIT MODE
|
||||
currentSelect.val(currentValue).trigger('change.select2');
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(document).on('change', 'select[id^="field-contact_id"]', function () {
|
||||
|
||||
let selectedOption = $(this).find(':selected');
|
||||
|
||||
let id = $(this).attr('id').split('-').pop(); // get doctor_count dynamically
|
||||
|
||||
$('#field-msl_code-' + id).val(selectedOption.attr('msl_code'));
|
||||
$('#field-speciality-' + id).val(selectedOption.attr('speciality'));
|
||||
$('#field-msl_code-'+id).attr('readonly',true);
|
||||
$('#field-speciality-'+id).attr('readonly',true);
|
||||
|
||||
preventDuplicateDoctors();
|
||||
});
|
||||
|
||||
$('#field-monthly_prescription_value,#field-potential_prescription_value,#field-current_prescription_value').parent().hide();
|
||||
$('#field-monthly_prescription_value,#field-potential_prescription_value,#field-current_prescription_value').attr('required',false);
|
||||
|
||||
$('#execution-prescriber').on('change',function(){
|
||||
let value=$(this).val();
|
||||
console.log("Prescriber : ",value);
|
||||
if(value==='Yes'){
|
||||
$('#field-monthly_prescription_value,#field-potential_prescription_value,#field-current_prescription_value').parent().show();
|
||||
$('#field-monthly_prescription_value,#field-potential_prescription_value,#field-current_prescription_value').attr('required',true);
|
||||
|
||||
}
|
||||
else{
|
||||
$('#field-monthly_prescription_value,#field-potential_prescription_value,#field-current_prescription_value').parent().hide();
|
||||
$('#field-monthly_prescription_value,#field-potential_prescription_value,#field-current_prescription_value').attr('required',false);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
var doctor_count = 0
|
||||
let numberOfSubmission=0;
|
||||
console.log("Number of Submission : ",numberOfSubmission);
|
||||
$('#adddoctor-btn').click(function() {
|
||||
let doctorName=$('#field-contact_id').html();
|
||||
|
||||
console.log("Doctor Name : ",doctorName);
|
||||
doctor_count++;
|
||||
numberOfSubmission=numberOfSubmission+1;
|
||||
console.log("Number of Submission : ",numberOfSubmission);
|
||||
|
||||
let empty_doctor = `
|
||||
|
||||
<div class="doctor-wrapper">
|
||||
@foreach($questions as $question)
|
||||
@if( in_array($question->code,
|
||||
["record_date","select_rxber_type"] ) )
|
||||
@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}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('file')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" 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}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" {{$question->required == 'yes'?'required':'' }}>
|
||||
@if($question->code=='contact_id')
|
||||
${doctorName}
|
||||
@else
|
||||
<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 . ' ' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach </div>`;
|
||||
|
||||
|
||||
$('#doctor-group-wrapper').append(empty_doctor)
|
||||
|
||||
$('#field-contact_id-'+doctor_count).select2({
|
||||
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
preventDuplicateDoctors();
|
||||
|
||||
|
||||
$('select[id^="execution-"]').select2({
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
$('#field-msl_code-'+doctor_count).attr('readonly',true);
|
||||
$('#field-speciality-'+doctor_count).attr('readonly',true);
|
||||
|
||||
|
||||
}, 500);
|
||||
|
||||
|
||||
|
||||
|
||||
if ($('.doctor-wrapper').length >= 10) {
|
||||
$('#adddoctor-btn').hide();
|
||||
} else {
|
||||
$('#adddoctor-btn').show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* $('.btn-remove').unbind();
|
||||
$('.btn-remove').click(function() {
|
||||
$(this).closest('.doctor-wrapper').find('select').select2('destroy');
|
||||
$(this).closest('.doctor-wrapper').remove();
|
||||
numberOfSubmission--;
|
||||
doctor_count--
|
||||
preventDuplicateDoctors();
|
||||
console.log("New Number of Submission : ",numberOfSubmission);
|
||||
console.log("Number of doctors : ",doctor_count);
|
||||
$('#adddoctor-btn').show();
|
||||
}) */
|
||||
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
|
||||
$('#field-monthly_prescription_value-' + i).closest('.col-md-12').hide();
|
||||
$('#field-potential_prescription_value-' + i).closest('.col-md-12').hide();
|
||||
$('#field-current_prescription_value-' + i).closest('.col-md-12').hide();
|
||||
|
||||
$('#field-monthly_prescription_value-' + i).prop('required',false);
|
||||
$('#field-potential_prescription_value-' + i).prop('required',false);
|
||||
$('#field-current_prescription_value-' + i).prop('required',false);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Show/Hide fields based on Prescriber dropdown
|
||||
$(document).on('change', 'select[id^="field-prescriber-"]', function () {
|
||||
|
||||
let id = $(this).attr('id').split('-').pop();
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if (value === 'Yes') {
|
||||
|
||||
$('#field-monthly_prescription_value-' + id)
|
||||
.closest('.col-md-12')
|
||||
.show();
|
||||
|
||||
$('#field-potential_prescription_value-' + id)
|
||||
.closest('.col-md-12')
|
||||
.show();
|
||||
|
||||
$('#field-current_prescription_value-' + id)
|
||||
.closest('.col-md-12')
|
||||
.show();
|
||||
|
||||
$('#field-monthly_prescription_value-' + id).prop('required',true);
|
||||
$('#field-potential_prescription_value-' + id).prop('required',true);
|
||||
$('#field-current_prescription_value-' + id).prop('required',true);
|
||||
|
||||
} else {
|
||||
|
||||
$('#field-monthly_prescription_value-' + id)
|
||||
.closest('.col-md-12')
|
||||
.hide();
|
||||
|
||||
$('#field-potential_prescription_value-' + id)
|
||||
.closest('.col-md-12')
|
||||
.hide();
|
||||
|
||||
$('#field-current_prescription_value-' + id)
|
||||
.closest('.col-md-12')
|
||||
.hide();
|
||||
|
||||
$('#field-monthly_prescription_value-' + id).prop('required',false);
|
||||
$('#field-potential_prescription_value-' + id).prop('required',false);
|
||||
$('#field-current_prescription_value-' + id).prop('required',false);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Trigger once on page load (important for edit mode)
|
||||
$('select[id^="field-prescriber-"]').trigger('change');
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
for (let i = 0; i < 9; i++) {
|
||||
$('#adddoctor-btn').trigger('click');
|
||||
}
|
||||
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$('#pageloader').fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
|
|
@ -187,15 +716,15 @@
|
|||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for (let itm of data) {
|
||||
if(itm.contact.hasOwnProperty('montair_lc_kid_non_rxber_survey') && itm.contact.montair_lc_kid_non_rxber_survey.toLowerCase() == 'yes') {
|
||||
console.log(itm)
|
||||
$('#field-contact_id').append($("<option></option>").attr("msl_code", itm.contact.msl_code).attr("value", itm.value).text(itm.display));
|
||||
}
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display).attr("msl_code", itm.contact.msl_code).attr("speciality", itm.contact.speciality));
|
||||
}
|
||||
|
||||
$('#field-contact_id').unbind()
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val( $('option:selected', this).attr('sbu_code') );
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
|
||||
},
|
||||
|
|
@ -204,128 +733,17 @@
|
|||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
$('#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,#field-speciality').attr('readonly',true);
|
||||
|
||||
//$('label[for="field-cough"]').html("<h4>In What % of patients do you prescribe ANTI HISTAMINE? </h4>Cough")
|
||||
$('label[for="field-seasonal_ar"]').html("<h5>4) Duration of Treatment : </h5>A) Seasonal AR <span class='text-danger'>*</span>");
|
||||
$('label[for="field-perrenial_ar"]').html("B) PERRENIAL AR <span class='text-danger'>*</span>");
|
||||
|
||||
$('label[for="field-in_what_conditions_do_you_prescribe_anti_histamine-Asthma"]').after('<h5 class="anti-heading">2)In what % of patients do you prescribe ANTI HISTAMINE?</h5>');
|
||||
|
||||
$('label[for="field-in_what_conditions_do_you_prescribe_anti_histamine"]').html('1) In what conditions do you prescribe ANTI HISTAMINE ?<span class="text-danger">*</span>')
|
||||
|
||||
$('label[for="field-which_is_your_preferred_anti_histamine"]').html("3)Which is your preferred ANTI HISTAMINE ? <span class='text-danger'>*</span>")
|
||||
|
||||
$('label[for="field-reason_to_prefer_a_brand"]').html('5) Reason to prefer a brand <span class="text-danger">*</span>');
|
||||
$('label[for="field-reasons_to_not_prescribe_montair_lc_kid"]').html('6) Reasons to NOT PRESCRIBE MONTAIR LC KID <span class="text-danger">*</span>')
|
||||
|
||||
$('label[for="field-cough"]').html('Cough<span class="text-danger">*</span>');
|
||||
$('label[for="field-cold"]').html('Cold<span class="text-danger">*</span>');
|
||||
$('label[for="field-fever"]').html('Fever<span class="text-danger">*</span>');
|
||||
$('label[for="field-sore_throat"]').html('Sore Throat<span class="text-danger">*</span>');
|
||||
$('label[for="field-seasonal_and_perennial_allergic_rhinitis"]').html('Seasonal & Perennial Allergic Rhinitis<span class="text-danger">*</span>');
|
||||
$('label[for="field-asthma"]').html('Asthma<span class="text-danger">*</span>');
|
||||
|
||||
|
||||
$('.col-md-12').has('select').has('select:not(#field-contact_id)').not(':has(.anti-heading)').each(function () {
|
||||
$(this).css({
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '15px'
|
||||
});
|
||||
|
||||
$(this).find('label').css({
|
||||
width: '50%',
|
||||
marginBottom: '0'
|
||||
});
|
||||
|
||||
$(this).find('select').css({
|
||||
width: '50%'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(document).on('click', 'input[name="seasonal_ar[]"]', function () {
|
||||
$('input[name="seasonal_ar[]"]').not(this).prop('checked', false);
|
||||
$(this).prop('checked', true);
|
||||
});
|
||||
|
||||
$(document).on('click', 'input[name="perrenial_ar[]"]', function () {
|
||||
$('input[name="perrenial_ar[]"]').not(this).prop('checked', false);
|
||||
$(this).prop('checked', true);
|
||||
});
|
||||
|
||||
$("#report-form").on("submit", function (e) {
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
let checkedCount = $('input[name="which_is_your_preferred_anti_histamine[]"]:checked').length;
|
||||
console.log("checkedCount : ",checkedCount);
|
||||
if (checkedCount === 0) {
|
||||
alert("Please select at least one option from your preferred ANTI HISTAMINE.");
|
||||
event.preventDefault(); // stop form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
let checkedCount2 = $('input[name="in_what_conditions_do_you_prescribe_anti_histamine[]"]:checked').length;
|
||||
console.log("checkedCount 2 : ",checkedCount2);
|
||||
if (checkedCount2 === 0) {
|
||||
alert("Please select at least one option from what conditions do you prescribe ANTI HISTAMINE.");
|
||||
event.preventDefault(); // stop form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
let checkedCount3 = $('input[name="seasonal_ar[]"]:checked').length;
|
||||
console.log("checkedCount 3 : ",checkedCount3);
|
||||
if (checkedCount3 === 0) {
|
||||
alert("Please select at least one option from Seasonal AR");
|
||||
event.preventDefault(); // stop form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
let checkedCount4 = $('input[name="perrenial_ar[]"]:checked').length;
|
||||
console.log("checkedCount 4 : ",checkedCount4);
|
||||
if (checkedCount4 === 0) {
|
||||
alert("Please select at least one option from PERRENIAL AR");
|
||||
event.preventDefault(); // stop form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
let checkedCount5 = $('input[name="reason_to_prefer_a_brand[]"]:checked').length;
|
||||
console.log("checkedCount 5 : ",checkedCount5);
|
||||
if (checkedCount5 === 0) {
|
||||
alert("Please select at least one option from Reason to prefer a brand");
|
||||
event.preventDefault(); // stop form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
let checkedCount6 = $('input[name="reasons_to_not_prescribe_montair_lc_kid[]"]:checked').length;
|
||||
console.log("checkedCount 6 : ",checkedCount6);
|
||||
if (checkedCount6 === 0) {
|
||||
alert("Please select at least one option from Reasons to NOT PRESCRIBE MONTAIR LC KID");
|
||||
event.preventDefault(); // stop form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmit',
|
||||
url: '/form/ajaxsubmitmultiple',
|
||||
data: new FormData($('#report-form')[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
|
|
@ -336,7 +754,9 @@
|
|||
title: 'Great!',
|
||||
text: 'Your data is successfully submitted!',
|
||||
icon: 'success'
|
||||
})
|
||||
}).then(() => {
|
||||
location.reload(); // 🔥 page refresh here
|
||||
});
|
||||
$('#report-form').trigger("reset");
|
||||
} else {
|
||||
Swal.fire({
|
||||
|
|
@ -349,15 +769,6 @@
|
|||
});
|
||||
});
|
||||
|
||||
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 plandateField = document.getElementById('field-record_date');
|
||||
|
||||
//plandateField.setAttribute('max', today);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -81,16 +81,16 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
<!-- <div class="col-12 mb-2">
|
||||
|
||||
</div> -->
|
||||
{{-- <div class="col-12 mb-2">
|
||||
<button type="button" class="btn btn-outline-primary btn-sm" id="add-doctor-btn">Add Doctor</button>
|
||||
</div> --}}
|
||||
|
||||
<div class="col-12" id="doctor-cards">
|
||||
<div class="card doctor-card border border-2 mb-3">
|
||||
<div class="card-body p-2">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<div class="fw-bold">Doctor</div>
|
||||
<button type="button" class="btn btn-outline-danger btn-sm remove-doctor-btn d-none">Remove</button>
|
||||
<div class="d-flex align-items-end mb-2">
|
||||
{{-- <div class="fw-bold">Doctor</div> --}}
|
||||
<button type="button" class="btn btn-outline-danger btn-sm remove-doctor-btn d-none ms-auto">Remove</button>
|
||||
</div>
|
||||
|
||||
@foreach($doctorQuestions as $question)
|
||||
|
|
@ -166,16 +166,12 @@
|
|||
</div>
|
||||
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes' ) )
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6 text-center d-grid mt-3" >
|
||||
<div class="d-grid mt-3">
|
||||
<button type="button" class="btn btn-outline-primary btn-sm" id="add-doctor-btn">Add Doctor</button>
|
||||
</div>
|
||||
<div class="text-center d-grid mt-3">
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
<div class="col-6 text-center d-grid mt-3">
|
||||
<button type="button" class="btn btn-warning btn-sm" id="add-doctor-btn">Add Doctor</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endif
|
||||
</form>
|
||||
|
||||
|
|
@ -362,6 +358,189 @@
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
// Define doctor dropdown
|
||||
let $doctorSelect = $('.js-contact-id');
|
||||
|
||||
// Store original options
|
||||
let originalOptions = $doctorSelect.find('option').clone();
|
||||
|
||||
$(document).on('change', '.js-campaign-type', function () {
|
||||
|
||||
/* let selectedCampaign = $(this).html(); */
|
||||
let selectedCampaign = ($(this).val() || '').trim();
|
||||
|
||||
selectedCampaign = selectedCampaign.replace(/@/g, '').replace(/\s+/g, ' ').trim();
|
||||
|
||||
|
||||
/* if (selectedCampaign === '7 PM Conversion Campaign') {
|
||||
console.log("Selected 7 PM");
|
||||
$('[data-code="rxs_given_for_montair_lc_adult"]')
|
||||
.attr('min', 15);
|
||||
|
||||
} else if (selectedCampaign === 'MLC A Pedia Campaign') {
|
||||
console.log("Selected MLC A");
|
||||
$('[data-code="rxs_given_for_montair_lc_adult"]')
|
||||
.attr('min', 8);
|
||||
|
||||
} */
|
||||
|
||||
|
||||
let $wrapper2 = $(this).closest('.doctor-card');
|
||||
|
||||
let $rxField = $wrapper2.find('[data-code="rxs_given_for_montair_lc_adult"]');
|
||||
|
||||
if (selectedCampaign === '7 PM Conversion Campaign') {
|
||||
console.log("Selected 7 PM");
|
||||
|
||||
$rxField.attr('min', 15);
|
||||
|
||||
} else if (selectedCampaign === 'MLC A Pedia Campaign') {
|
||||
console.log("Selected MLC A");
|
||||
|
||||
$rxField.attr('min', 8);
|
||||
}
|
||||
|
||||
|
||||
|
||||
console.log("Selected Campaign:", selectedCampaign);
|
||||
|
||||
let $wrapper = $(this).closest('.doctor-card');
|
||||
|
||||
// Doctor dropdown ONLY inside current wrapper
|
||||
$doctorSelect = $wrapper.find('.js-contact-id');
|
||||
|
||||
// Destroy select2 temporarily
|
||||
$doctorSelect.select2('destroy');
|
||||
|
||||
// Empty dropdown
|
||||
$doctorSelect.empty();
|
||||
|
||||
// Array to collect pediatrician doctors
|
||||
let pediatricianDoctors = [];
|
||||
|
||||
// Loop through original options
|
||||
originalOptions.each(function () {
|
||||
|
||||
let $option = $(this).clone();
|
||||
/* console.log($option); */
|
||||
|
||||
let speciality = ($option.attr('speciality') || '').trim();
|
||||
|
||||
|
||||
/* console.log("Speciality:", speciality); */
|
||||
|
||||
// Keep default option
|
||||
if ($option.val() === '') {
|
||||
console.log("Doctor:",$option.val());
|
||||
$doctorSelect.append($option);
|
||||
return;
|
||||
}
|
||||
|
||||
// Show all doctors
|
||||
if (selectedCampaign === '7 PM Conversion Campaign') {
|
||||
console.log("7PM");
|
||||
$doctorSelect.append($option);
|
||||
}else if (selectedCampaign === 'MLC A Pedia Campaign') {
|
||||
console.log("*",selectedCampaign);
|
||||
|
||||
|
||||
if (speciality === 'PAEDIATRICIAN' || speciality === 'Paediatrician' ||speciality === 'paediatrician' ) {
|
||||
|
||||
pediatricianDoctors.push($option)
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
// Append pediatrician doctors
|
||||
if (selectedCampaign === 'MLC A Pedia Campaign') {
|
||||
|
||||
pediatricianDoctors.forEach(function ($doctor) {
|
||||
|
||||
$doctorSelect.append($doctor);
|
||||
});
|
||||
}
|
||||
|
||||
// Reinitialize select2
|
||||
$doctorSelect.select2();
|
||||
|
||||
// Reset selection
|
||||
$doctorSelect.val('').trigger('change');
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#field-record_date').closest('.col-md-12').before(`
|
||||
<div class="col-md-12 mb-3">
|
||||
<div class="p-3 rounded shadow-sm border"
|
||||
style="background: #fff8e1; border-left: 5px solid #ff9800;">
|
||||
|
||||
<h5 class="fw-bold text-dark mb-3 text-center">
|
||||
Campaign Guidelines
|
||||
</h5>
|
||||
|
||||
<div class="mb-3">
|
||||
<h6 class="fw-bold text-primary">
|
||||
7PM Conversion Campaign
|
||||
</h6>
|
||||
|
||||
<p class="mb-1">
|
||||
<strong>Target Drs :</strong>
|
||||
25 Drs Mont+Fexo & Mont+Bila Drs
|
||||
</p>
|
||||
|
||||
<p class="mb-1">
|
||||
<strong>Conversion :</strong>
|
||||
5 Conversions for Montair LC Adult
|
||||
</p>
|
||||
|
||||
<p class="mb-1">
|
||||
<strong> Goal : </strong>
|
||||
Each conversion with 15 Rxs Montair LC Adult
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div>
|
||||
<h6 class="fw-bold text-primary">
|
||||
MLC Adult @Pedia
|
||||
</h6>
|
||||
|
||||
<p class="mb-1">
|
||||
<strong>Target Drs :</strong>
|
||||
10 Drs Mont+Fexo & Mont+Bila Drs
|
||||
</p>
|
||||
|
||||
<p class="mb-1">
|
||||
<strong>Conversion :</strong>
|
||||
5 Conversions for Montair LC Adult
|
||||
</p>
|
||||
|
||||
<p class="mb-1">
|
||||
<strong>Goal : </strong>
|
||||
Each conversion with 8 Rxs Montair LC Adult
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event){
|
||||
event.preventDefault();
|
||||
$("#pageloader").fadeIn();
|
||||
|
|
|
|||
|
|
@ -329,6 +329,114 @@
|
|||
@endif
|
||||
|
||||
|
||||
|
||||
/* for (let i = 1; i <= 10; i++) {
|
||||
|
||||
$(`#field-email_id_${i}`).on('input', function () {
|
||||
|
||||
// Remove spaces
|
||||
this.value = this.value.replace(/\s/g, '');
|
||||
});
|
||||
|
||||
$(`#field-email_id_${i}`).on('blur', function () {
|
||||
|
||||
let email = $(this).val().trim();
|
||||
|
||||
let emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
|
||||
if (email !== '' && !emailPattern.test(email)) {
|
||||
alert('Please enter a valid email address');
|
||||
$(this).focus();
|
||||
}
|
||||
});
|
||||
|
||||
} */
|
||||
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
|
||||
$(`#field-email_id_${i}`).on('input', function () {
|
||||
|
||||
// Remove spaces
|
||||
this.value = this.value.replace(/\s/g, '');
|
||||
|
||||
});
|
||||
|
||||
$(`#field-email_id_${i}`).on('blur', function () {
|
||||
|
||||
let email = $(this).val().trim();
|
||||
|
||||
let emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
|
||||
// Remove old error
|
||||
$(this).next('.email-error').remove();
|
||||
|
||||
if (email !== '' && !emailPattern.test(email)) {
|
||||
|
||||
$(this).addClass('is-invalid');
|
||||
|
||||
$(this).after(`
|
||||
<small class="text-danger email-error">
|
||||
Please enter a valid email address
|
||||
</small>
|
||||
`);
|
||||
|
||||
} else {
|
||||
|
||||
$(this).removeClass('is-invalid');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
for(let i=1;i<=10;i++){
|
||||
$(`#field-msl_code_${i}`).prop('readonly',true);
|
||||
$(`#field-speciality_${i}`).prop('readonly',true);
|
||||
|
||||
}
|
||||
|
||||
for (let i = 1; i <= 10; i++) {
|
||||
|
||||
$(`#field-mobile_number_${i}`).on('input', function () {
|
||||
|
||||
// Allow only numbers
|
||||
this.value = this.value.replace(/\D/g, '');
|
||||
|
||||
// Limit to 10 digits
|
||||
if (this.value.length > 10) {
|
||||
this.value = this.value.slice(0, 10);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Validation on form submit / field blur
|
||||
$(`#field-mobile_number_${i}`).on('blur', function () {
|
||||
|
||||
if (this.value.length !== 10) {
|
||||
$(this).addClass('is-invalid');
|
||||
|
||||
// Optional message
|
||||
if (!$(this).next('.error-msg').length) {
|
||||
$(this).after(
|
||||
`<small class="text-danger error-msg">
|
||||
Mobile number must be exactly 10 digits
|
||||
</small>`
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
$(this).removeClass('is-invalid');
|
||||
$(this).next('.error-msg').remove();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Loop through hierarcies and fetch contacts for each hierarchy, store in contacts variable
|
||||
|
||||
// $('#field-user_id').change(function(){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,108 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "History"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
</head>
|
||||
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-8 p-2">
|
||||
<h4 class="page-title">{{$formname}}</h4>
|
||||
</div>
|
||||
<div class="col-4 p-2">
|
||||
<a href="/form/show" class="float-end pt-1">New Submission</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">
|
||||
{{ session()->get('message') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">
|
||||
{{ session()->get('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="row">
|
||||
<div class="col-12 p-0">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="responsive-table-plugin">
|
||||
<div class="table-rep-plugin">
|
||||
<div class="table-responsive" data-pattern="priority-columns">
|
||||
<table id="tech-companies-1" class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-priority="1">Submission Date</th>
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'hidden')
|
||||
@continue;
|
||||
@endif
|
||||
<th data-priority="1">{{$question->label}}</th>
|
||||
@endforeach
|
||||
<th data-priority="1">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($submissions as $submission)
|
||||
<tr>
|
||||
<th>{{date("d M Y", strtotime($submission->updatedAt))}}</th>
|
||||
@foreach($questions as $code => $question)
|
||||
@if($question->type == 'hidden')
|
||||
@continue;
|
||||
@endif
|
||||
@if($question->type == 'file')
|
||||
<td><a target="_blank" href="{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) :(is_string($submission->formdata->{$code}) ? $submission->formdata->{$code} : '' ) : $code }}" download="{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) : (is_string($submission->formdata->{$code}) ? $submission->formdata->{$code} : '' ) : $code }}" class="btn btn-dark btn-xs"><i class="mdi mdi-cloud-download me-1"></i> Download</a></td>
|
||||
|
||||
@elseif($question->type == 'radiometrix' && isset($submission->formdata->{$code}) && is_object($submission->formdata->{$code}))
|
||||
<td>
|
||||
{{ collect((array)$submission->formdata->{$code})->map(function($val, $key){ return "$key: $val"; })->implode(', ') }}
|
||||
</td>
|
||||
|
||||
@elseif(count((array)$question->options) > 0 && 1==2 )
|
||||
<td>{{ $question->options->{ $submission->formdata->{$code} } }}</td>
|
||||
@else
|
||||
<td>{{ isset($submission->formdata->{$code}) ? is_array($submission->formdata->{$code})? implode(', ', $submission->formdata->{$code}) :$submission->formdata->{$code} : $code }}</td>
|
||||
@endif
|
||||
@endforeach
|
||||
<th>
|
||||
@if($question->can_edit == 'yes' || sizeof($submission->workflow_approvals) == 0 )
|
||||
@if($submission->workflow == 'yes' && $submission->workflow_status == 'approved' )
|
||||
<p>Approved</p>
|
||||
@else
|
||||
<!-- <a href="/form/show?form_id={{$submission->formdata->form_id}}&id={{$submission->id}}" class="btn btn-primary btn-xs">Edit
|
||||
|
||||
</button> -->
|
||||
@if(isset($form->allow_delete_by_user) && $form->allow_delete_by_user == 'yes')
|
||||
<a href="/form/delete?form_id={{$submission->formdata->form_id}}&id={{$submission->id}}" onclick="return confirm('Are you sure you want to delete this submission? This is not recoverable!');" class="btn btn-danger btn-xs mt-1">Delete</button>
|
||||
@endif
|
||||
@endif
|
||||
@endif
|
||||
</th>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- end .table-responsive -->
|
||||
|
||||
</div> <!-- end .table-rep-plugin-->
|
||||
</div> <!-- end .responsive-table-plugin-->
|
||||
|
||||
</div> <!-- end card body-->
|
||||
</div> <!-- end card -->
|
||||
</div><!-- end col-->
|
||||
</div>
|
||||
<!-- end row-->
|
||||
</div> <!-- container -->
|
||||
|
||||
</div>
|
||||
<!-- end page -->
|
||||
@include('layouts.shared/footer-script')
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,803 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<style>
|
||||
|
||||
/* =========================
|
||||
SELECT2 CUSTOM HIGHLIGHT
|
||||
========================= */
|
||||
|
||||
.select2-container .select2-selection--single{
|
||||
height: 38px !important;
|
||||
border: 1px solid #ced4da !important;
|
||||
border-radius: 6px !important;
|
||||
padding-top: 4px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered{
|
||||
line-height: 28px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow{
|
||||
height: 36px !important;
|
||||
}
|
||||
|
||||
/* Dropdown option hover */
|
||||
.select2-results__option--highlighted{
|
||||
background-color: #0d6efd !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
/* Selected option */
|
||||
.select2-results__option[aria-selected=true]{
|
||||
background-color: #dbe9ff !important;
|
||||
color: black !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Search box */
|
||||
.select2-search__field{
|
||||
border-radius: 5px !important;
|
||||
padding: 6px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/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 bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'
|
||||
) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@if(isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
||||
$submissions = $submissions->data->submissions;
|
||||
/*echo "<pre>";
|
||||
print_r($submissions);
|
||||
echo "</pre>";*/
|
||||
|
||||
$submissions = Formhelper::getMultiformData(
|
||||
$form->partition,
|
||||
$form_id,
|
||||
$form->user_id
|
||||
);
|
||||
|
||||
$submissions = $submissions->data->submissions;
|
||||
|
||||
$submittedDoctors = collect($submissions)->map(function ($item) {
|
||||
|
||||
return $item->formdata->cont_id ?? null;
|
||||
|
||||
})->filter()->unique()->values()->toArray();
|
||||
|
||||
/* echo "<pre>";
|
||||
print_r($submittedDoctors);
|
||||
echo "</pre>";
|
||||
*/
|
||||
|
||||
|
||||
@endphp
|
||||
{{-- @if(count($submissions)===0 || $id) --}}
|
||||
<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[0]" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
@foreach($questions as $question)
|
||||
@if( !in_array($question->code,
|
||||
["record_date","select_rxber_type"] ) )
|
||||
@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' : '' }} {{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->legacy_code . ' ' : '' }} {{ $question->code == 'doctor_name' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
<div class="doctor-wrapper">
|
||||
|
||||
@foreach($questions as $question)
|
||||
@if( in_array($question->code,
|
||||
["record_date","select_rxber_type"] ) )
|
||||
@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}}[0]"
|
||||
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}}[0]" 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}}[0]"
|
||||
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}}[0]"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
@if ($question->code == 'contact_id')
|
||||
<select class="form-control" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}[0]"
|
||||
{{ $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' : '' }}
|
||||
@if($question->code == 'contact_id')
|
||||
msl_code="{{ (isset($option->contact->legacy_code) ? $option->contact->legacy_code : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<select class="form-control" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}[0]"
|
||||
{{ $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>
|
||||
@endif
|
||||
@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}}[0]" 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')
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) &&
|
||||
$form->is_approval != 'yes' ) )
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}"
|
||||
class="form-control" value=""
|
||||
{{$question->required == 'yes'?'required':'' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{$question->value}}" class="img-fluid">
|
||||
@endif
|
||||
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}"
|
||||
name="{{$option->value}}" class="form-control" required
|
||||
value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div id="doctor-group-wrapper">
|
||||
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval !=
|
||||
'yes' ) )
|
||||
<div class="text-center button-list">
|
||||
@if(!$id)
|
||||
<button class="btn btn-primary" type="button" id="adddoctor-btn"> Add Doctor </button>
|
||||
@endif
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
{{-- @elseif(!$id)
|
||||
<h4>You have submitted 10 doctors</h4>
|
||||
@endif --}}
|
||||
</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%;
|
||||
}
|
||||
|
||||
.doctor-wrapper {
|
||||
border: 1px solid #ccc;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
|
||||
$('#field-contact_id').on('change',function(){
|
||||
$('#field-msl_code').val($(this).find(":selected").attr("msl_code"));
|
||||
})
|
||||
|
||||
$('#field-contact_id').on('change',function(){
|
||||
$('#field-speciality').val($(this).find(":selected").attr("speciality"));
|
||||
})
|
||||
|
||||
$('#field-msl_code,#field-speciality').attr('readonly',true);
|
||||
|
||||
window.submittedDoctors = @json($submittedDoctors);
|
||||
|
||||
function initializeSelect2() {
|
||||
|
||||
$('select[id^="field-contact_id"]').select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
$('#field-user_id').select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select User / Territory --'
|
||||
});
|
||||
|
||||
$('select[id^="execution-"]').select2({
|
||||
width: '100%'
|
||||
});
|
||||
}
|
||||
|
||||
initializeSelect2();
|
||||
preventDuplicateDoctors(window.submittedDoctors);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*function preventDuplicateDoctors() {
|
||||
|
||||
let selectedValues = [];
|
||||
|
||||
// Collect selected values
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if (value) {
|
||||
selectedValues.push(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let currentSelect = $(this);
|
||||
let currentValue = currentSelect.val();
|
||||
|
||||
currentSelect.find('option').each(function () {
|
||||
|
||||
let option = $(this);
|
||||
let optionValue = option.val();
|
||||
|
||||
if (!optionValue) return;
|
||||
|
||||
// remove previous label
|
||||
let cleanText = option.text().replace(' (Already Added)', '');
|
||||
|
||||
// IMPORTANT:
|
||||
// keep currently selected option enabled
|
||||
if (
|
||||
selectedValues.includes(optionValue) &&
|
||||
optionValue !== currentValue
|
||||
) {
|
||||
|
||||
option.prop('disabled', true);
|
||||
option.text(cleanText + ' (Already Added)');
|
||||
|
||||
} else {
|
||||
|
||||
option.prop('disabled', false);
|
||||
option.text(cleanText);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// refresh select2 safely
|
||||
if (currentSelect.hasClass("select2-hidden-accessible")) {
|
||||
currentSelect.select2('destroy');
|
||||
}
|
||||
|
||||
currentSelect.select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
// VERY IMPORTANT FOR EDIT MODE
|
||||
currentSelect.val(currentValue).trigger('change.select2');
|
||||
|
||||
});
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
function preventDuplicateDoctors(submittedDoctors = []) {
|
||||
|
||||
let selectedDoctors = [];
|
||||
|
||||
// Get currently selected doctors from form
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if (value) {
|
||||
selectedDoctors.push(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Merge current + submitted doctors
|
||||
let blockedDoctors = [
|
||||
...new Set([
|
||||
...selectedDoctors,
|
||||
...submittedDoctors
|
||||
])
|
||||
];
|
||||
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let currentSelect = $(this);
|
||||
let currentValue = currentSelect.val();
|
||||
|
||||
currentSelect.find('option').each(function () {
|
||||
|
||||
let option = $(this);
|
||||
let optionValue = option.val();
|
||||
|
||||
if (!optionValue) return;
|
||||
|
||||
// Remove old labels
|
||||
let cleanText = option.text()
|
||||
.replace(' (Already Added)', '')
|
||||
.replace(' (Already Submitted)', '');
|
||||
|
||||
// Keep currently selected option enabled
|
||||
if (
|
||||
blockedDoctors.includes(optionValue) &&
|
||||
optionValue !== currentValue
|
||||
) {
|
||||
|
||||
option.prop('disabled', true);
|
||||
|
||||
if (submittedDoctors.includes(optionValue)) {
|
||||
|
||||
option.text(cleanText + ' (Already Submitted)');
|
||||
|
||||
} else {
|
||||
|
||||
option.text(cleanText + ' (Already Added)');
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
option.prop('disabled', false);
|
||||
option.text(cleanText);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Refresh Select2
|
||||
if (currentSelect.hasClass('select2-hidden-accessible')) {
|
||||
currentSelect.select2('destroy');
|
||||
}
|
||||
|
||||
currentSelect.select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
currentSelect.val(currentValue).trigger('change.select2');
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(document).on('change', 'select[id^="field-contact_id"]', function () {
|
||||
|
||||
let selectedOption = $(this).find(':selected');
|
||||
|
||||
let id = $(this).attr('id').split('-').pop(); // get doctor_count dynamically
|
||||
|
||||
$('#field-msl_code-' + id).val(selectedOption.attr('msl_code'));
|
||||
$('#field-speciality-' + id).val(selectedOption.attr('speciality'));
|
||||
|
||||
preventDuplicateDoctors(window.submittedDoctors);
|
||||
});
|
||||
|
||||
|
||||
function createSlug2(value) {
|
||||
|
||||
return value
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^a-z0-9\s-]/g, '') // remove special chars
|
||||
.replace(/\s+/g, '_') // spaces to underscore
|
||||
.replace(/-+/g, '_'); // multiple hyphen to underscore
|
||||
}
|
||||
|
||||
|
||||
// Wrapper dropdowns
|
||||
$("#field-activity_type").on('change', function () {
|
||||
console.log("Selected");
|
||||
let fieldId = $(this).attr('id');
|
||||
|
||||
// Remove only current wrapper hidden input
|
||||
$('#report-form input[data-source="' + fieldId + '"]').remove();
|
||||
|
||||
let slug = createSlug2($(this).val());
|
||||
|
||||
$('#report-form').append(
|
||||
'<input type="hidden" class="dynamic-hidden" data-source="' + fieldId + '" name="' + slug + '[0]" value="1">'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var doctor_count = 0
|
||||
let numberOfSubmission=0;
|
||||
console.log("Number of Submission : ",numberOfSubmission);
|
||||
$('#adddoctor-btn').click(function() {
|
||||
let doctorName=$('#field-contact_id').html();
|
||||
|
||||
console.log("Doctor Name : ",doctorName);
|
||||
doctor_count++;
|
||||
numberOfSubmission=numberOfSubmission+1;
|
||||
console.log("Number of Submission : ",numberOfSubmission);
|
||||
|
||||
let empty_doctor = `
|
||||
|
||||
<div class="doctor-wrapper">
|
||||
@foreach($questions as $question)
|
||||
@if( in_array($question->code,
|
||||
["record_date","select_rxber_type"] ) )
|
||||
@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}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('file')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" 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}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" {{$question->required == 'yes'?'required':'' }}>
|
||||
@if($question->code=='contact_id')
|
||||
${doctorName}
|
||||
@else
|
||||
<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->legacy_code . ' ' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach </div>`;
|
||||
|
||||
|
||||
$('#doctor-group-wrapper').append(empty_doctor)
|
||||
|
||||
$('#field-contact_id-'+doctor_count).select2({
|
||||
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
preventDuplicateDoctors(window.submittedDoctors);
|
||||
|
||||
|
||||
$('select[id^="execution-"]').select2({
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
$('#field-msl_code-'+doctor_count).attr('readonly',true);
|
||||
$('#field-speciality-'+doctor_count).attr('readonly',true);
|
||||
|
||||
|
||||
}, 500);
|
||||
|
||||
|
||||
|
||||
|
||||
if ($('.doctor-wrapper').length >= 10) {
|
||||
$('#adddoctor-btn').hide();
|
||||
} else {
|
||||
$('#adddoctor-btn').show();
|
||||
}
|
||||
|
||||
|
||||
$('.btn-remove').unbind();
|
||||
$('.btn-remove').click(function() {
|
||||
$(this).closest('.doctor-wrapper').find('select').select2('destroy');
|
||||
$(this).closest('.doctor-wrapper').remove();
|
||||
numberOfSubmission--;
|
||||
doctor_count--
|
||||
preventDuplicateDoctors();
|
||||
console.log("New Number of Submission : ",numberOfSubmission);
|
||||
console.log("Number of doctors : ",doctor_count);
|
||||
$('#adddoctor-btn').show();
|
||||
})
|
||||
|
||||
function createSlug(value) {
|
||||
|
||||
return value
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^a-z0-9\s-]/g, '') // remove special chars
|
||||
.replace(/\s+/g, '_') // spaces to underscore
|
||||
.replace(/-+/g, '_'); // multiple hyphen to underscore
|
||||
}
|
||||
|
||||
|
||||
// Wrapper dropdowns
|
||||
$('[id^="field-activity_type-"]').on('change', function () {
|
||||
console.log("Selected");
|
||||
let fieldId = $(this).attr('id');
|
||||
|
||||
// Remove only current wrapper hidden input
|
||||
$('#report-form input[data-source="' + fieldId + '"]').remove();
|
||||
|
||||
let slug = createSlug($(this).val());
|
||||
|
||||
let index = fieldId.split('-').pop();
|
||||
|
||||
$('#report-form').append(
|
||||
'<input type="hidden" class="dynamic-hidden" data-source="' + fieldId + '" name="' + slug + '[' + index + ']" value="1">'
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$('#pageloader').fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for (let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display).attr("msl_code", itm.contact.msl_code).attr("speciality", itm.contact.speciality));
|
||||
}
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
// if (numberOfSubmission !=10) {
|
||||
// alert(`You must submit 10 Doctors for Ciphaler , Current Doctors : ${numberOfSubmission+1}`);
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmitmultiple',
|
||||
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'
|
||||
}).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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -241,7 +241,7 @@
|
|||
|
||||
$('#field-contact_id').on('change',function(){
|
||||
let dropDown=$('#field-contact_id').val();
|
||||
if(dropDown==='others'){
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -81,7 +81,19 @@
|
|||
<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 . ' ' : '' }} {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode)?$option->contact->pcode:'') . ' ' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} {{ $question->code == 'contact_id' ? 'empacip_launched= ' . (isset($option->contact->empacip_launched) ? $option->contact->empacip_launched :'') . ' ' : '' }}>
|
||||
{{-- <option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->legacy_code . ' ' : '' }} {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode)?$option->contact->pcode:'') . ' ' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} {{ $question->code == 'contact_id' ? 'empacip_launched= ' . (isset($option->contact->empacip_launched) ? $option->contact->empacip_launched :'') . ' ' : '' }}>
|
||||
{{ $option->display }}
|
||||
</option> --}}
|
||||
|
||||
<option value="{{ $option->value }}"
|
||||
@if(isset($question->value) && $question->value == $option->value) selected @endif
|
||||
@if($question->code == 'contact_id')
|
||||
msl_code="{{ (isset($option->contact->legacy_code) ? $option->contact->legacy_code : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
pcode="{{ (isset($option->contact->pcode) ? $option->contact->pcode : '') }}"
|
||||
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
|
||||
|
|
@ -206,6 +218,8 @@
|
|||
}
|
||||
})
|
||||
|
||||
$('#field-speciality,#field-msl_code,#field-pcode').attr('readonly',true);
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
|
||||
})
|
||||
|
|
|
|||
|
|
@ -81,7 +81,22 @@
|
|||
<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 . ' ' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} {{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode) ? $option->contact->pcode :'') . ' ' : '' }} >
|
||||
{{-- <option value="{{ $option->value }}" {{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
{{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->legacy_code . ' ' : '' }}
|
||||
{{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }}
|
||||
{{ $question->code == 'contact_id' ? 'pcode= ' . (isset($option->contact->pcode) ? $option->contact->pcode :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option> --}}
|
||||
|
||||
<option value="{{ $option->value }}"
|
||||
@if(isset($question->value) && $question->value == $option->value) selected @endif
|
||||
@if($question->code == 'contact_id')
|
||||
msl_code="{{ (isset($option->contact->legacy_code) ? $option->contact->legacy_code : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
pcode="{{ (isset($option->contact->pcode) ? $option->contact->pcode : '') }}"
|
||||
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
|
||||
|
|
@ -188,6 +203,7 @@
|
|||
$('label[for="field-cresar_am_pob_strips"]').append('w-100').html("<h4 style='color:#9897f7'>Report POB</h4><div>Cresar-AM POB Strips <span style='color:#f1556c'>*</span> </div>")
|
||||
$('label[for="field-new_conversion"]').append('w-100').html("<h4 style='color:#9897f7'>Report Conversion</h4><div>New Conversion <span style='color:#f1556c'>*</span> </div>")
|
||||
|
||||
$('#field-speciality,#field-msl_code,#field-pcode').attr('readonly',true);
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr(
|
||||
|
|
|
|||
|
|
@ -467,7 +467,68 @@
|
|||
"brand": "Sylate",
|
||||
"sku": "SYLATE TABLETS 250 MG 10",
|
||||
"pts": 132.49
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"brand": "OROFER",
|
||||
"sku": "OROFER FCM INJECTION 1K",
|
||||
"pts": 2250.00
|
||||
},
|
||||
{
|
||||
"brand": "OROFER",
|
||||
"sku": "OROFER FCM INJECTION 750 MG / 15 ML ",
|
||||
"pts": 1160.00
|
||||
},
|
||||
{
|
||||
"brand": "OROFER",
|
||||
"sku": "OROFER FCM INJECTION 500 MG / 10 ML",
|
||||
"pts": 1115.00
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
"brand": "Reludro",
|
||||
"sku": "Reludro",
|
||||
"pts": 480.00
|
||||
},
|
||||
{
|
||||
"brand": "Femzact",
|
||||
"sku": "Femzact",
|
||||
"pts": 152.23
|
||||
},
|
||||
{
|
||||
"brand": "Sylate T",
|
||||
"sku": "Sylate Inj",
|
||||
"pts": 80.74
|
||||
},
|
||||
{
|
||||
"brand": "Sylate T",
|
||||
"sku": "Sylate T 500",
|
||||
"pts": 388.22
|
||||
},
|
||||
{
|
||||
"brand": "Sylate T",
|
||||
"sku": "Sylate 500",
|
||||
"pts": 337.78
|
||||
},
|
||||
{
|
||||
"brand": "Sylate T",
|
||||
"sku": "Sylate 250",
|
||||
"pts": 175.85
|
||||
},
|
||||
{
|
||||
"brand": "Emvicure",
|
||||
"sku": "Emvicure",
|
||||
"pts": 365.83
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
]
|
||||
|
||||
console.log( JSON.stringify(brands.map(b => { return { sku:b.sku, slug:slugify(b.sku)+'_units' } } ) ) )
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@
|
|||
@php
|
||||
$brandData = [
|
||||
|
||||
/*['brand'=>'CELOL', 'slug'=>'celol_units','pseudoId'=>'celol_value','slug2'=>'celol2'],
|
||||
/*
|
||||
['brand'=>'CELOL', 'slug'=>'celol_units','pseudoId'=>'celol_value','slug2'=>'celol2'],
|
||||
['brand'=>'Denmab', 'slug'=>'denmab_units','pseudoId'=>'denmab_value','slug2'=>'denmab2'],
|
||||
['brand'=>'Emanzen', 'slug'=>'emanzen_units','pseudoId'=>'emanzen_value','slug2'=>'emanzen2'],
|
||||
['brand'=>'Ferium XT', 'slug'=>'ferium_xt_units','pseudoId'=>'ferium_xt_value','slug2'=>'ferium_xt2'],
|
||||
|
|
@ -23,7 +24,6 @@ $brandData = [
|
|||
['brand'=>'Proxym', 'slug'=>'proxym_units','pseudoId'=>'proxym_value','slug2'=>'proxym2'],
|
||||
['brand'=>'Ferium Injection', 'slug'=>'ferium_injection_units','pseudoId'=>'ferium_injection_value','slug2'=>'ferium_injection2'],
|
||||
|
||||
|
||||
*/
|
||||
['brand'=>'Galact Granules', 'slug'=>'galact_granules_units','pseudoId'=>'galact_granules_value','slug2'=>'galact_granules2'],
|
||||
['brand'=>'Sylate', 'slug'=>'sylate_units','pseudoId'=>'sylate_value','slug2'=>'sylate2'],
|
||||
|
|
@ -37,6 +37,7 @@ $brandData = [
|
|||
['brand'=>'Sylate T 500', 'slug'=>'sylate_t_500_units','pseudoId'=>'sylate_t_500_value','slug2'=>'sylate_t_500_2'],
|
||||
['brand'=>'Sylate 500', 'slug'=>'sylate_500_units','pseudoId'=>'sylate_500_value','slug2'=>'sylate_500_2'],
|
||||
['brand'=>'Sylate 250', 'slug'=>'sylate_250_units','pseudoId'=>'sylate_250_value','slug2'=>'sylate_250_2'],
|
||||
['brand'=>'Emvicure', 'slug'=>'emvicure_units','pseudoId'=>'emvicure_value','slug2'=>'emvicure2'],
|
||||
|
||||
|
||||
|
||||
|
|
@ -388,6 +389,8 @@ $brandData = [
|
|||
$('#field-femzact_value').val(productOfP);
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -522,6 +525,11 @@ $brandData = [
|
|||
unit: '#field-sylate_250_units',
|
||||
value: '#field-sylate_250_value',
|
||||
price: 175.85
|
||||
},
|
||||
{
|
||||
unit: '#field-emvicure_units',
|
||||
value: '#field-emvicure_value',
|
||||
price: 365.83
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,786 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => "Form"])
|
||||
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
||||
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
<style>
|
||||
|
||||
/* =========================
|
||||
SELECT2 CUSTOM HIGHLIGHT
|
||||
========================= */
|
||||
|
||||
.select2-container .select2-selection--single{
|
||||
height: 38px !important;
|
||||
border: 1px solid #ced4da !important;
|
||||
border-radius: 6px !important;
|
||||
padding-top: 4px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered{
|
||||
line-height: 28px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow{
|
||||
height: 36px !important;
|
||||
}
|
||||
|
||||
/* Dropdown option hover */
|
||||
.select2-results__option--highlighted{
|
||||
background-color: #0d6efd !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
/* Selected option */
|
||||
.select2-results__option[aria-selected=true]{
|
||||
background-color: #dbe9ff !important;
|
||||
color: black !important;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* Search box */
|
||||
.select2-search__field{
|
||||
border-radius: 5px !important;
|
||||
padding: 6px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<div id="pageloader">
|
||||
<img src="http://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/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 bg-pattern">
|
||||
<div class="card-body p-3 row">
|
||||
|
||||
@if(Session::has('error'))<div class="alert alert-danger">{{Session::get('error')}}</div>
|
||||
<br>@endif
|
||||
@if(session('success'))<div class=" alert alert-success">{{ session('success') }}
|
||||
</div>
|
||||
<br>@endif
|
||||
<div class="col-8">
|
||||
<h4 class="page-title">{{$form->title}}</h4>
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'
|
||||
) )
|
||||
<div class="col-4">
|
||||
@if($form->link_type == 'form')
|
||||
<a href="/form/history" class="float-end pt-1">View History</a>
|
||||
@else
|
||||
<a href="{{url()->previous()}}" class="float-end pt-1">Back</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@if(isset($form->user_info))
|
||||
<div class="col-12">
|
||||
<h6>Submitted By: {{$form->user_info->name}}</h6>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@php
|
||||
$submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
||||
$submissions = $submissions->data->submissions;
|
||||
|
||||
|
||||
@endphp
|
||||
|
||||
<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[0]" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
<div class="col-md-12 mb-2">
|
||||
<label for="field-user_id" class="form-label"> Select User / Territory <span class="text-danger">*</span> </label>
|
||||
<select class="form-control" id="field-user_id" name="user_id" required>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach($form->users as $option)
|
||||
<option value="{{$option->value}}" hierarchy="{{$option->hierarchy_id}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<input type="hidden" id="field-hierarchy_id" name="hierarchy_id" value="">
|
||||
</div>
|
||||
@endif
|
||||
@foreach($questions as $question)
|
||||
@if( !in_array($question->code,
|
||||
["record_date","select_week","select_month"] ) )
|
||||
@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' : '' }} {{ $question->code == 'contact_id' ? 'uid_number= ' . $option->contact->uid_number . ' ' : '' }} {{ $question->code == 'doctor_name' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
<div class="doctor-wrapper">
|
||||
|
||||
@foreach($questions as $question)
|
||||
@if( in_array($question->code,
|
||||
["record_date","select_week","select_month"] ) )
|
||||
@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}}[0]"
|
||||
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}}[0]" 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}}[0]"
|
||||
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}}[0]"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
@if ($question->code == 'contact_id')
|
||||
<select class="form-control" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}[0]"
|
||||
{{ $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' : '' }}
|
||||
@if($question->code == 'contact_id')
|
||||
uid_number="{{ (isset($option->contact->uid_number) ? $option->contact->uid_number : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<select class="form-control" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}[0]"
|
||||
{{ $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>
|
||||
@endif
|
||||
@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}}[0]" 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')
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) &&
|
||||
$form->is_approval != 'yes' ) )
|
||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}"
|
||||
class="form-control" value=""
|
||||
{{$question->required == 'yes'?'required':'' }}>
|
||||
@elseif(isset($question->value))
|
||||
<img src="{{$question->value}}" class="img-fluid">
|
||||
@endif
|
||||
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@foreach($question->options as $option)
|
||||
<div class="col-6">{{$option->display}}</div>
|
||||
<div class="col-6 mb-1">
|
||||
<input type="number" id="field-{{$option->value}}"
|
||||
name="{{$option->value}}" class="form-control" required
|
||||
value="{{isset($option->val)?$option->val:0}}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div id="doctor-group-wrapper">
|
||||
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval !=
|
||||
'yes' ) )
|
||||
<div class="text-center button-list">
|
||||
@if(!$id)
|
||||
<button class="btn btn-primary" type="button" id="adddoctor-btn"> Add Doctor </button>
|
||||
@endif
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
|
||||
</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%;
|
||||
}
|
||||
|
||||
.doctor-wrapper {
|
||||
border: 1px solid #ccc;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function($) {
|
||||
$('#field-record_date').attr(
|
||||
'max',
|
||||
new Date().toISOString().split('T')[0]
|
||||
);
|
||||
|
||||
$('#field-contact_id').on('change',function(){
|
||||
$('#field-uid_number').val($(this).find(":selected").attr("uid_number"));
|
||||
})
|
||||
|
||||
$('#field-contact_id').on('change',function(){
|
||||
$('#field-speciality').val($(this).find(":selected").attr("speciality"));
|
||||
})
|
||||
|
||||
$('#field-uid_number,#field-speciality').attr('readonly',true);
|
||||
|
||||
function initializeSelect2() {
|
||||
|
||||
$('select[id^="field-contact_id"]').select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
$('#field-user_id').select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select User / Territory --'
|
||||
});
|
||||
|
||||
$('select[id^="execution-"]').select2({
|
||||
width: '100%'
|
||||
});
|
||||
}
|
||||
|
||||
initializeSelect2();
|
||||
preventDuplicateDoctors();
|
||||
|
||||
|
||||
|
||||
/* function preventDuplicateDoctors() {
|
||||
|
||||
let selectedValues = [];
|
||||
|
||||
// Get all selected doctor values
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if (value) {
|
||||
selectedValues.push(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Apply duplicate prevention
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let currentSelect = $(this);
|
||||
let currentValue = currentSelect.val();
|
||||
|
||||
currentSelect.find('option').each(function () {
|
||||
|
||||
let option = $(this);
|
||||
let optionValue = option.val();
|
||||
|
||||
if (!optionValue) return;
|
||||
|
||||
// Remove old text
|
||||
let cleanText = option.text().replace(' (Already Added)', '');
|
||||
|
||||
if (
|
||||
selectedValues.includes(optionValue) &&
|
||||
optionValue !== currentValue
|
||||
) {
|
||||
|
||||
option.prop('disabled', true);
|
||||
option.text(cleanText + ' (Already Added)');
|
||||
|
||||
} else {
|
||||
|
||||
option.prop('disabled', false);
|
||||
option.text(cleanText);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// 🔥 IMPORTANT
|
||||
currentSelect.select2('destroy');
|
||||
|
||||
currentSelect.select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
} */
|
||||
|
||||
function preventDuplicateDoctors() {
|
||||
|
||||
let selectedValues = [];
|
||||
|
||||
// Collect selected values
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if (value) {
|
||||
selectedValues.push(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('select[id^="field-contact_id"]').each(function () {
|
||||
|
||||
let currentSelect = $(this);
|
||||
let currentValue = currentSelect.val();
|
||||
|
||||
currentSelect.find('option').each(function () {
|
||||
|
||||
let option = $(this);
|
||||
let optionValue = option.val();
|
||||
|
||||
if (!optionValue) return;
|
||||
|
||||
// remove previous label
|
||||
let cleanText = option.text().replace(' (Already Added)', '');
|
||||
|
||||
// IMPORTANT:
|
||||
// keep currently selected option enabled
|
||||
if (
|
||||
selectedValues.includes(optionValue) &&
|
||||
optionValue !== currentValue
|
||||
) {
|
||||
|
||||
option.prop('disabled', true);
|
||||
option.text(cleanText + ' (Already Added)');
|
||||
|
||||
} else {
|
||||
|
||||
option.prop('disabled', false);
|
||||
option.text(cleanText);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// refresh select2 safely
|
||||
if (currentSelect.hasClass("select2-hidden-accessible")) {
|
||||
currentSelect.select2('destroy');
|
||||
}
|
||||
|
||||
currentSelect.select2({
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
|
||||
// VERY IMPORTANT FOR EDIT MODE
|
||||
currentSelect.val(currentValue).trigger('change.select2');
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Hide fields initially
|
||||
$('#field-no_of_rx,#field-no_of_strips,#field-total_value').parent().hide();
|
||||
|
||||
$('#field-no_of_rx,#field-no_of_strips,#field-total_value')
|
||||
.attr('required', false);
|
||||
|
||||
// Show when dr_converted = Yes
|
||||
$('#execution-dr_converted').on('change', function(){
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if(value === 'Yes'){
|
||||
|
||||
$('#field-no_of_rx,#field-no_of_strips,#field-total_value')
|
||||
.parent().show();
|
||||
|
||||
$('#field-no_of_rx,#field-no_of_strips,#field-total_value')
|
||||
.attr('required', true);
|
||||
|
||||
}else{
|
||||
|
||||
$('#field-no_of_rx,#field-no_of_strips,#field-total_value')
|
||||
.parent().hide();
|
||||
|
||||
$('#field-no_of_rx,#field-no_of_strips,#field-total_value')
|
||||
.attr('required', false);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#field-total_value').attr('readonly', true);
|
||||
|
||||
$('#field-no_of_strips').on('change keyup', function(){
|
||||
|
||||
let strips = parseFloat($('#field-no_of_strips').val() || 0);
|
||||
|
||||
let ptsValue = 365.83;
|
||||
|
||||
let total = strips * ptsValue;
|
||||
|
||||
$('#field-total_value').val(total.toFixed(2));
|
||||
|
||||
});
|
||||
|
||||
$(document).on('change', 'select[id^="field-contact_id"]', function () {
|
||||
|
||||
let selectedOption = $(this).find(':selected');
|
||||
|
||||
let id = $(this).attr('id').split('-').pop(); // get doctor_count dynamically
|
||||
|
||||
$('#field-uid_number-' + id).val(selectedOption.attr('uid_number'));
|
||||
$('#field-speciality-' + id).val(selectedOption.attr('speciality'));
|
||||
|
||||
preventDuplicateDoctors();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var doctor_count = 0
|
||||
let numberOfSubmission=0;
|
||||
console.log("Number of Submission : ",numberOfSubmission);
|
||||
$('#adddoctor-btn').click(function() {
|
||||
let doctorName=$('#field-contact_id').html();
|
||||
|
||||
console.log("Doctor Name : ",doctorName);
|
||||
doctor_count++;
|
||||
numberOfSubmission=numberOfSubmission+1;
|
||||
console.log("Number of Submission : ",numberOfSubmission);
|
||||
|
||||
let empty_doctor = `
|
||||
|
||||
<div class="doctor-wrapper"><button type="button" class="btn btn-danger btn-remove float-end" style="margin-top:-25px; margin-right:-25px"><i class="mdi mdi-close"></i></button>
|
||||
@foreach($questions as $question)
|
||||
@if( in_array($question->code,
|
||||
["record_date","select_week","select_month"] ) )
|
||||
@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}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" value="{{isset($question->value)?$question->value:''}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('file')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" 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}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||||
@break
|
||||
@case('dropdown')
|
||||
<select class="form-control" id="field-{{$question->code}}-${doctor_count}" name="{{$question->code}}[${doctor_count}]" {{$question->required == 'yes'?'required':'' }}>
|
||||
@if($question->code=='contact_id')
|
||||
${doctorName}
|
||||
@else
|
||||
<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' ? 'uid_number= ' . $option->contact->uid_number . ' ' : '' }} {{ $question->code == 'contact_id' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endforeach
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
@endswitch
|
||||
</div>
|
||||
@endforeach </div>`;
|
||||
|
||||
|
||||
$('#doctor-group-wrapper').append(empty_doctor)
|
||||
|
||||
$('#field-contact_id-'+doctor_count).select2({
|
||||
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
});
|
||||
preventDuplicateDoctors();
|
||||
|
||||
|
||||
$('select[id^="execution-"]').select2({
|
||||
width: '100%'
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
$('#field-uid_number-'+doctor_count).attr('readonly',true);
|
||||
$('#field-speciality-'+doctor_count).attr('readonly',true);
|
||||
let fields =
|
||||
$('#field-no_of_rx-' + doctor_count +
|
||||
',#field-no_of_strips-' + doctor_count +
|
||||
',#field-total_value-' + doctor_count);
|
||||
|
||||
fields.parent().hide();
|
||||
|
||||
fields.attr('required', false);
|
||||
$('#field-dr_converted-' + doctor_count).on('change', function(){
|
||||
|
||||
let value = $(this).val();
|
||||
|
||||
if(value === 'Yes'){
|
||||
|
||||
fields.parent().show();
|
||||
|
||||
fields.attr('required', true);
|
||||
|
||||
}else{
|
||||
|
||||
fields.parent().hide();
|
||||
|
||||
fields.attr('required', false);
|
||||
}
|
||||
|
||||
});
|
||||
$('#field-total_value-' + doctor_count).attr('readonly', true);
|
||||
|
||||
$('#field-no_of_strips-' + doctor_count)
|
||||
.on('change keyup', function(){
|
||||
|
||||
let strips =
|
||||
parseFloat($('#field-no_of_strips-' + doctor_count).val() || 0);
|
||||
|
||||
let ptsValue = 365.83;
|
||||
|
||||
let total = strips * ptsValue;
|
||||
|
||||
$('#field-total_value-' + doctor_count)
|
||||
.val(total.toFixed(2));
|
||||
|
||||
});
|
||||
|
||||
|
||||
}, 500);
|
||||
|
||||
|
||||
|
||||
|
||||
if ($('.doctor-wrapper').length >= 10) {
|
||||
$('#adddoctor-btn').hide();
|
||||
} else {
|
||||
$('#adddoctor-btn').show();
|
||||
}
|
||||
|
||||
|
||||
$('.btn-remove').unbind();
|
||||
$('.btn-remove').click(function() {
|
||||
// $(this).closest('.doctor-wrapper').find('select').select2('destroy');
|
||||
$(this).closest('.doctor-wrapper').find('select').each(function () {
|
||||
|
||||
if ($(this).hasClass('select2-hidden-accessible')) {
|
||||
$(this).select2('destroy');
|
||||
}
|
||||
|
||||
});
|
||||
$(this).closest('.doctor-wrapper').remove();
|
||||
numberOfSubmission--;
|
||||
doctor_count--
|
||||
preventDuplicateDoctors();
|
||||
console.log("New Number of Submission : ",numberOfSubmission);
|
||||
console.log("Number of doctors : ",doctor_count);
|
||||
$('#adddoctor-btn').show();
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
$('#field-user_id').change(function(){
|
||||
let hierarchy = $('option:selected', this).attr('hierarchy');
|
||||
$('#field-hierarchy_id').val(hierarchy)
|
||||
event.preventDefault();
|
||||
$('#pageloader').fadeIn();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '/form/getdoctorlist?partition={{$form->partition}}&hierarchy='+hierarchy,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function( data ) {
|
||||
$("#pageloader").fadeOut();
|
||||
$('#field-contact_id').html('')
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",'').text('-- Select --'));
|
||||
for (let itm of data) {
|
||||
$('#field-contact_id').append($("<option></option>").attr("value",itm.value).text(itm.display).attr("uid_number", itm.contact.uid_number).attr("speciality", itm.contact.speciality));
|
||||
}
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-uid_number').val($('option:selected', this).attr('uid_number'))
|
||||
})
|
||||
|
||||
$('#field-contact_id').change(function() {
|
||||
$('#field-speciality').val($('option:selected', this).attr('speciality'))
|
||||
})
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
console.log(hierarchy)
|
||||
})
|
||||
|
||||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
// if (numberOfSubmission !=10) {
|
||||
// alert(`You must submit 10 Doctors for Ciphaler , Current Doctors : ${numberOfSubmission+1}`);
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmitmultiple',
|
||||
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'
|
||||
}).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!'
|
||||
})
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Loading…
Reference in New Issue