614 lines
30 KiB
PHP
614 lines
30 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
@include('layouts.shared/title-meta', ['title' => "Form"])
|
|
@include('layouts.shared/head-css', ["mode" => $mode ?? '', "demo" => $demo ?? ''])
|
|
<link href="{{asset('assets/libs/sweetalert2/sweetalert2.min.css')}}" rel="stylesheet" type="text/css" />
|
|
<link href="{{ asset('assets/libs/select2/select2.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..." />
|
|
</div>
|
|
@php
|
|
$brandData = [
|
|
|
|
/*
|
|
['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'],
|
|
['brand'=>'Fitjoint', 'slug'=>'fitjoint_units','pseudoId'=>'fitjoint_value','slug2'=>'fitjoint2'],
|
|
['brand'=>'Infen P', 'slug'=>'infen_p_units','pseudoId'=>'infen_p_value','slug2'=>'infen_p2'],
|
|
['brand'=>'Osteri', 'slug'=>'osteri_units','pseudoId'=>'osteri_value','slug2'=>'osteri2'],
|
|
['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'],
|
|
['brand'=>'OROFER FCM INJECTION 1K', 'slug'=>'orofer_fcm_injection_1k_units','pseudoId'=>'orofer_fcm_injection_1k_value','slug2'=>'orofer_fcm_injection_1k2'],
|
|
['brand'=>'OROFER FCM INJECTION 750 MG / 15 ML', 'slug'=>'orofer_fcm_injection_750_mg_15_ml_units','pseudoId'=>'orofer_fcm_injection_750_mg_15_ml_value','slug2'=>'orofer_fcm_injection_750_mg_15_ml2'],
|
|
['brand'=>'OROFER FCM INJECTION 500 MG / 10 ML', 'slug'=>'orofer_fcm_injection_500_mg_10_ml_units','pseudoId'=>'orofer_fcm_injection_500_mg_10_ml_value','slug2'=>'orofer_fcm_injection_500_mg_10_ml2'],
|
|
['brand'=>'Reludro', 'slug'=>'reludro_units','pseudoId'=>'reludro_value','slug2'=>'reludro_2'],
|
|
['brand'=>'Femzact', 'slug'=>'femzact_units','pseudoId'=>'femzact_value','slug2'=>'femzact_2'],
|
|
|
|
['brand'=>'Sylate Inj', 'slug'=>'sylate_inj_units','pseudoId'=>'sylate_inj_value','slug2'=>'sylate_inj_2'],
|
|
['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'],
|
|
|
|
|
|
|
|
|
|
];
|
|
|
|
@endphp
|
|
|
|
<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="record_date" value="" id="field-record_date">
|
|
@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 == 'no'?'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 == 'no'?'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" {!!($question->code
|
|
== 'contact_id')?'data-toggle="select2"':'' !!} id="field-{{$question->code}}"
|
|
name="{{$question->code}}" {{$question->required == 'yes'?'required':'' }}>
|
|
<option value="" selected> -- Select -- </option>
|
|
@foreach($question->options as $option)
|
|
<option value="{{$option->value}}"
|
|
{{isset($question->value) && $question->value == $option->value ? 'selected':''}}>
|
|
{{$option->display}}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
@break
|
|
@case('checkbox')
|
|
@foreach($question->options as $option)
|
|
<div class="form-check mb-2 form-check-primary">
|
|
<input class="form-check-input" type="checkbox"
|
|
id="field-{{$question->code}}-{{$option->value}}"
|
|
name="{{$question->code}}[]" value="{{$option->value}}"
|
|
{{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
|
<label class="form-check-label"
|
|
for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
|
</div>
|
|
@endforeach
|
|
@break
|
|
@case('file')
|
|
@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">
|
|
<div style="width: auto; overflow-y: auto; overflow-x: auto;">
|
|
<table class="table tableclass">
|
|
<thead id="heading">
|
|
<tr>
|
|
<th>Brand</th>
|
|
<th>Units</th>
|
|
<th>Value</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($brandData as $brand)
|
|
<tr id="field_{{ $brand['slug2'] }}">
|
|
|
|
<td>{{ $brand['brand'] }}</td>
|
|
<td>
|
|
<input type="number" id="field-{{ $brand['slug'] }}"
|
|
name="{{ $brand['slug'] }}"
|
|
class="form-control form-control-large" value="{{ $id && isset($formdata) && isset($formdata->{$brand['slug']}) ? $formdata->{$brand['slug']} : 0 }}" >
|
|
</td>
|
|
<td>
|
|
<input type="number" id="field-{{ $brand['pseudoId'] }}"
|
|
name="{{ $brand['pseudoId'] }}"
|
|
class="form-control form-control-large" readonly="true" value="{{ $id && isset($formdata) && isset($formdata->{$brand['pseudoId']}) ? $formdata->{$brand['pseudoId']} : 0 }}">
|
|
</td>
|
|
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- @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%;
|
|
}
|
|
</style>
|
|
@include('layouts.shared/footer-script')
|
|
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
|
<script src="{{ asset('assets/libs/select2/select2.min.js') }}"></script>
|
|
<script type="text/javascript">
|
|
jQuery(document).ready(function($) {
|
|
$('[data-toggle="select2"]').select2();
|
|
let selected_user_id = ''
|
|
$('#field-user_id').change(function() {
|
|
$("#pageloader").fadeIn();
|
|
selected_user_id = $(this).val()
|
|
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) {
|
|
if(itm.contact.c2c == 'Yes') {
|
|
$('#field-contact_id').append($("<option></option>").attr("value",
|
|
itm.value).text(itm.display).attr("speciality", itm
|
|
.contact.speciality));
|
|
}
|
|
}
|
|
|
|
$('#field-contact_id').change(function() {
|
|
$('#field-speciality').val($('option:selected', this).attr(
|
|
'speciality'))
|
|
})
|
|
|
|
},
|
|
});
|
|
|
|
console.log(hierarchy)
|
|
})
|
|
|
|
// $('#field-record_date').change(function(){
|
|
// let date = new Date( $(this).val() )
|
|
// $('#field-select_month').val( date.toLocaleString('default', { month: 'long' }) + ' ' + date.getFullYear().toString().substr(-2) )
|
|
// })
|
|
$('#field-select_month').change(function(){
|
|
let record_date = new Date( '20 ' + $(this).val() )
|
|
//record_date = record_date.getFullYear() + '/' + (record_date.getMonth()+1) + '/' + record_date.getDate()
|
|
$('#field-record_date').val(record_date.toISOString().split('T')[0])
|
|
})
|
|
|
|
/* $('#field-celol_units,#field-denmab_units,#field-emanzen_units,#field-ferium_xt_units,#field-fitjoint_units,#field-galact_granules_units,#field-infen_p_units,#field-osteri_units,#field-proxym_units,#field-ferium_injection_units,#field-sylate_units,#field-orofer_fcm_injection_1k_units,#field-orofer_fcm_injection_750_mg_15_ml_units,#field-orofer_fcm_injection_500_mg_10_ml_units,#field-reludro_units,#field-femzact_units')
|
|
.on('input', function() {
|
|
let a = parseFloat($('#field-celol_units').val()) || 0;
|
|
let priceOfA = 215;
|
|
let productOfA = (a * priceOfA).toFixed(2);
|
|
$('#field-celol_value').val(productOfA);
|
|
|
|
let b = parseFloat($('#field-denmab_units').val()) || 0;
|
|
let priceOfB = 4465;
|
|
let productOfB = (b * priceOfB).toFixed(2);
|
|
$('#field-denmab_value').val(productOfB);
|
|
|
|
let c = parseFloat($('#field-emanzen_units').val()) || 0;
|
|
let priceOfC = 164;
|
|
let productOfC = (c * priceOfC).toFixed(2);
|
|
$('#field-emanzen_value').val(productOfC);
|
|
|
|
let d = parseFloat($('#field-ferium_xt_units').val()) || 0;
|
|
let priceOfD = 218;
|
|
let productOfD = (d * priceOfD).toFixed(2);
|
|
$('#field-ferium_xt_value').val(productOfD);
|
|
|
|
let e = parseFloat($('#field-fitjoint_units').val()) || 0;
|
|
let priceOfE = 553;
|
|
let productOfE = (e * priceOfE).toFixed(2);
|
|
$('#field-fitjoint_value').val(productOfE);
|
|
|
|
let f = parseFloat($('#field-galact_granules_units').val()) || 0;
|
|
let priceOfF = 513.60;
|
|
let productOfF = (f * priceOfF).toFixed(2);
|
|
$('#field-galact_granules_value').val(productOfF);
|
|
|
|
let g = parseFloat($('#field-infen_p_units').val()) || 0;
|
|
let priceOfG = 112;
|
|
let productOfG = (g * priceOfG).toFixed(2);
|
|
$('#field-infen_p_value').val(productOfG);
|
|
|
|
let h = parseFloat($('#field-osteri_units').val()) || 0;
|
|
let priceOfH = 3186;
|
|
let productOfH = (h * priceOfH).toFixed(2);
|
|
$('#field-osteri_value').val(productOfH);
|
|
|
|
let i = parseFloat($('#field-proxym_units').val()) || 0;
|
|
let priceOfI = 274;
|
|
let productOfI = (i * priceOfI).toFixed(2);
|
|
$('#field-proxym_value').val(productOfI);
|
|
|
|
let j = parseFloat($('#field-ferium_injection_units').val()) || 0;
|
|
let priceOfJ = 1200;
|
|
let productOfJ = (j * priceOfJ).toFixed(2);
|
|
$('#field-ferium_injection_value').val(productOfJ);
|
|
|
|
let k = parseFloat($('#field-sylate_units').val()) || 0;
|
|
let priceOfK = 353;
|
|
let productOfK = (k * priceOfK).toFixed(2);
|
|
$('#field-sylate_value').val(productOfK);
|
|
|
|
|
|
let l = parseFloat($('#field-orofer_fcm_injection_1k_units').val()) || 0;
|
|
let priceOfL = 2250;
|
|
let productOfL = (l * priceOfL).toFixed(2);
|
|
$('#field-orofer_fcm_injection_1k_value').val(productOfL);
|
|
|
|
let m = parseFloat($('#field-orofer_fcm_injection_750_mg_15_ml_units').val()) || 0;
|
|
let priceOfM = 1160;
|
|
let productOfM = (m * priceOfM).toFixed(2);
|
|
$('#field-orofer_fcm_injection_750_mg_15_ml_value').val(productOfM);
|
|
|
|
let n = parseFloat($('#field-orofer_fcm_injection_500_mg_10_ml_units').val()) || 0;
|
|
let priceOfN = 1115;
|
|
let productOfN = (n * priceOfN).toFixed(2);
|
|
$('#field-orofer_fcm_injection_500_mg_10_ml_value').val(productOfN);
|
|
|
|
let o = parseFloat($('#field-reludro_units').val()) || 0;
|
|
let priceOfO = 480;
|
|
let productOfO = (o * priceOfO).toFixed(2);
|
|
$('#field-reludro_value').val(productOfO);
|
|
|
|
let p = parseFloat($('#field-femzact_units').val()) || 0;
|
|
let priceOfP = 152.23;
|
|
let productOfP = (p * priceOfP).toFixed(2);
|
|
$('#field-femzact_value').val(productOfP);
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
$('#field-celol_units,#field-denmab_units,#field-emanzen_units,#field-ferium_xt_units,#field-fitjoint_units,#field-galact_granules_units,#field-infen_p_units,#field-osteri_units,#field-proxym_units,#field-ferium_injection_units,#field-sylate_units,#field-orofer_fcm_injection_1k_units,#field-orofer_fcm_injection_750_mg_15_ml_units,#field-orofer_fcm_injection_500_mg_10_ml_units,#field-reludro_units,#field-femzact_units')
|
|
.on('input', function() {
|
|
let a = parseInt($('#field-celol_value').val()) || 0;
|
|
let b = parseInt($('#field-denmab_value').val()) || 0;
|
|
let c = parseInt($('#field-emanzen_value').val()) || 0;
|
|
let d = parseInt($('#field-ferium_xt_value').val()) || 0;
|
|
let e = parseInt($('#field-fitjoint_value').val()) || 0;
|
|
//let f = parseInt($('#field-fitjoint_value').val()) || 0;
|
|
let f = parseInt($('#field-galact_granules_value').val()) || 0;
|
|
let g = parseInt($('#field-infen_p_value').val()) || 0;
|
|
let h = parseInt($('#field-proxym_value').val()) || 0;
|
|
let i= parseInt($('#field-osteri_value').val()) ||0;
|
|
let j= parseInt($('#field-ferium_injection_value').val()) ||0;
|
|
let k= parseInt($('#field-sylate_value').val()) ||0;
|
|
let l= parseInt($('#field-orofer_fcm_injection_1k_value').val()) ||0;
|
|
let m= parseInt($('#field-orofer_fcm_injection_750_mg_15_ml_value').val()) ||0;
|
|
let n= parseInt($('#field-orofer_fcm_injection_500_mg_10_ml_value').val()) ||0;
|
|
let o= parseInt($('#field-reludro_value').val()) ||0;
|
|
let p= parseInt($('#field-femzact_value').val()) ||0;
|
|
|
|
|
|
|
|
let total = (a + b + c + d + e + f + g + h + i + j + k+l+m+n+o+p).toFixed(2);
|
|
$('#field-total_pob_in_strips').val(total);
|
|
}) */
|
|
|
|
|
|
const products = [
|
|
{
|
|
unit: '#field-celol_units',
|
|
value: '#field-celol_value',
|
|
price: 215
|
|
},
|
|
{
|
|
unit: '#field-denmab_units',
|
|
value: '#field-denmab_value',
|
|
price: 4465
|
|
},
|
|
{
|
|
unit: '#field-emanzen_units',
|
|
value: '#field-emanzen_value',
|
|
price: 164
|
|
},
|
|
{
|
|
unit: '#field-ferium_xt_units',
|
|
value: '#field-ferium_xt_value',
|
|
price: 218
|
|
},
|
|
{
|
|
unit: '#field-fitjoint_units',
|
|
value: '#field-fitjoint_value',
|
|
price: 553
|
|
},
|
|
{
|
|
unit: '#field-galact_granules_units',
|
|
value: '#field-galact_granules_value',
|
|
price: 513.60
|
|
},
|
|
{
|
|
unit: '#field-infen_p_units',
|
|
value: '#field-infen_p_value',
|
|
price: 112
|
|
},
|
|
{
|
|
unit: '#field-osteri_units',
|
|
value: '#field-osteri_value',
|
|
price: 3186
|
|
},
|
|
{
|
|
unit: '#field-proxym_units',
|
|
value: '#field-proxym_value',
|
|
price: 274
|
|
},
|
|
{
|
|
unit: '#field-ferium_injection_units',
|
|
value: '#field-ferium_injection_value',
|
|
price: 1200
|
|
},
|
|
{
|
|
unit: '#field-sylate_units',
|
|
value: '#field-sylate_value',
|
|
price: 353
|
|
},
|
|
{
|
|
unit: '#field-orofer_fcm_injection_1k_units',
|
|
value: '#field-orofer_fcm_injection_1k_value',
|
|
price: 2250
|
|
},
|
|
{
|
|
unit: '#field-orofer_fcm_injection_750_mg_15_ml_units',
|
|
value: '#field-orofer_fcm_injection_750_mg_15_ml_value',
|
|
price: 1160
|
|
},
|
|
{
|
|
unit: '#field-orofer_fcm_injection_500_mg_10_ml_units',
|
|
value: '#field-orofer_fcm_injection_500_mg_10_ml_value',
|
|
price: 1115
|
|
},
|
|
{
|
|
unit: '#field-reludro_units',
|
|
value: '#field-reludro_value',
|
|
price: 480
|
|
},
|
|
{
|
|
unit: '#field-femzact_units',
|
|
value: '#field-femzact_value',
|
|
price: 152.23
|
|
},
|
|
|
|
{
|
|
unit: '#field-sylate_inj_units',
|
|
value: '#field-sylate_inj_value',
|
|
price: 80.74
|
|
},
|
|
|
|
{
|
|
unit: '#field-sylate_t_500_units',
|
|
value: '#field-sylate_t_500_value',
|
|
price: 388.22
|
|
},
|
|
|
|
{
|
|
unit: '#field-sylate_500_units',
|
|
value: '#field-sylate_500_value',
|
|
price: 337.78
|
|
},
|
|
|
|
{
|
|
unit: '#field-sylate_250_units',
|
|
value: '#field-sylate_250_value',
|
|
price: 175.85
|
|
},
|
|
{
|
|
unit: '#field-emvicure_units',
|
|
value: '#field-emvicure_value',
|
|
price: 365.83
|
|
}
|
|
];
|
|
|
|
// Create selector string
|
|
const selectors = products.map(p => p.unit).join(',');
|
|
|
|
// Single event
|
|
$(selectors).on('input', function () {
|
|
|
|
let total = 0;
|
|
|
|
products.forEach(product => {
|
|
|
|
let units = parseFloat($(product.unit).val()) || 0;
|
|
|
|
let value = (units * product.price).toFixed(2);
|
|
|
|
$(product.value).val(value);
|
|
|
|
total += parseFloat(value);
|
|
|
|
});
|
|
|
|
$('#field-total_pob_in_strips').val(total.toFixed(2));
|
|
|
|
});
|
|
|
|
$('#field-total_pob_in_strips').prop('readonly',true);
|
|
|
|
|
|
$('#report-form').on('submit', function(event) {
|
|
event.preventDefault();
|
|
$("#pageloader").fadeIn();
|
|
|
|
let record_date = new Date( '20 ' + $('#field-select_month').val() )
|
|
$('#field-record_date').val(record_date.toISOString().split('T')[0])
|
|
|
|
$.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");
|
|
$('#field-user_id').val(selected_user_id)
|
|
$('#field-user_id').trigger("change");
|
|
} 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> |