Rapport-Laravel/resources/views/form/rapport-maxterneo/1742476442-96704307-2555-4a...

719 lines
37 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>
<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)
@if( !in_array($question->code,
["record_date","contact_id","msl_code","hospital_name","current_business","potential_business","speciality"] ) )
@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->msl_code . ' ' : '' }} {{ $question->code == 'contact_id' ? 'hospital_name= ' . (isset($option->contact->hospital_name) ? $option->contact->hospital_name :'') . ' ' : '' }} >
{{ $option->display }}
</option>
@endforeach
</select>
@break
@endswitch
</div>
@endforeach
<div class="col-md-12" id="doctor-wrapper-group">
<div class="doctor-wrapper row mt-3">
@foreach($questions as $question)
@if(in_array($question->code,
["record_date","contact_id","msl_code","hospital_name","current_business","potential_business","speciality"] ) )
@continue;
@endif
<div class="col-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}}" name="{{$question->code}}[]"
value="{{isset($question->value)?$question->value:''}}">
@break
@case('text')
@case('email')
@case('tel')
@case('date')
<input type="{{$question->type}}" name="{{$question->code}}[]"
class="form-control {{$question->type}}_{{$question->code}}" {{$question->required == 'yes'?'required':'' }}
value="{{isset($question->value)?$question->value:''}}">
@break
@case('number')
<input type="{{$question->type}}" min="0" max="9999999999" step="any"
name="{{$question->code}}[]"
class="form-control number_{{$question->code}}"
{{$question->required == 'yes'?'required':'' }}
value="{{isset($question->value)?$question->value:0}}">
@break
@case('dropdown')
<select class="form-control select_{{$question->code}}" {!!($question->code == 'contact_id')?'data-toggle="select2"':'' !!}
name="{{$question->code}}[]"
{{$question->required == 'yes'?'required':'' }}>
<option value=""> -- Select -- </option>
@foreach($question->options as $option)
<option value="{{$option->value}}"
{{isset($question->value) && $question->value == $option->value ? 'selected':''}}>
{{$option->display}}
</option>
@endforeach
</select>
@break
@endswitch
</div>
@endforeach
</div>
</div>
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval !=
'yes' ) )
<div class="text-center button-list row mt-3">
<div class="col-6 d-grid"><button class="btn btn-primary" type="submit"
id="submit-btn"> Submit </button></div>
<div class="col-6 d-grid"><button class="btn btn-warning" type="button"
id="adddoctor-btn"> Add Brand </button></div>
</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;
border-radius: 15px;
padding: 15px;
position: relative;
}
</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($) {
let doctors = [];
$('[data-toggle="select2"]').select2();
$('#field-user_id').change(function() {
$("#pageloader").fadeIn();
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) {
//doctors = data
$("#pageloader").fadeOut();
$('.select_contact_id').each(function(i, obj) {
$(this).html('')
$(this).append($("<option></option>").attr("value", '')
.text('-- Select --'));
for (let itm of data) {
if(itm.contact.proxym_tuesday == 'Yes') {
doctors.push(itm)
$(this).append($("<option></option>").attr("speciality", itm.contact.speciality).attr("value", itm.value).text(itm.display));
}
}
});
},
});
console.log(hierarchy)
})
const temp_input = $('input[name^="speciality"]');
console.log('in --- ',temp_input);
$(temp_input).addClass('text_speciality');
$('.number_proxym_pob_value').prop('readonly', 'true');
$('.number_proxym_pob_in_strips_units').on('change', function() {
$(this).parent().parent().find('.number_proxym_pob_value').val( (parseFloat($(this).val())*182.83).toFixed(2) )
})
$('.select_contact_id').on('change', function() {
$(this).parent().parent().find('.text_speciality').val( $("option:selected" ,this).attr("speciality") )
})
$('label[for="field-current_business"]').addClass('w-100').html(
'Current Business (in INR) <span style="color:#f1556c">*</span><br/><p style="font-size:11px">(Note- This value will be in multiples of 1000) <br> Eg. 2 Thousand , enter 2</p>'
)
$('label[for="field-potential_business"]').addClass('w-100').html(
'Potential Business (in INR) <span style="color:#f1556c">*</span><br/><p style="font-size:11px">(Note- This value will be in multiples of 1000) <br> Eg. 2 Thousand , enter 2</p>'
)
var doctorformhtml = `<div class="doctor-wrapper row mt-3">
<div class="col-12">
<button type="button" class="btn btn-danger btn-remove float-end" style="position:absolute; right:0px; top:0px;"><i class="mdi mdi-close"></i></button>
</div>
@foreach($questions as $question)
@if(in_array($question->code, ["record_date","contact_id","msl_code","hospital_name","current_business","potential_business","speciality"] ) )
@continue;
@endif
<div class="col-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}}" name="{{$question->code}}[]" value="{{isset($question->value)?$question->value:''}}">
@break
@case('text')
@case('email')
@case('tel')
@case('date')
<input type="{{$question->type}}" name="{{$question->code}}[]" class="form-control {{$question->type}}_{{$question->code}}" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:''}}">
@break
@case('number')
<input type="{{$question->type}}" min="0" max="9999999999" step="any" name="{{$question->code}}[]" class="form-control number_{{$question->code}}" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
@break
@case('dropdown')
<select class="form-control select_{{$question->code}}" {!!($question->code == 'contact_id')?'data-toggle="select2"':'' !!} name="{{$question->code}}[]" {{$question->required == 'yes'?'required':'' }}>
<option value=""> -- Select -- </option>
@foreach($question->options as $option)
<option value="{{$option->value}}" {{isset($question->value) && $question->value == $option->value ? 'selected':''}}>{{$option->display}}</option>
@endforeach
</select>
@break
@endswitch
</div>
@endforeach
</div>`
let numberOfSubmission=0;
console.log("Number of Submission : ",numberOfSubmission);
$('#adddoctor-btn').click(function() {
console.log(doctorformhtml)
numberOfSubmission=numberOfSubmission+1;
console.log("Number of Submission : ",numberOfSubmission);
$('#doctor-wrapper-group').append(doctorformhtml)
$('.btn-remove').unbind()
$('.btn-remove').click(function() {
$(this).parent().parent().remove()
})
// $('[data-toggle="select2"]').unbind();
// $('[data-toggle="select2"]').select2();
$('#doctor-wrapper-group').children().last().find('.select_contact_id').html('')
$('#doctor-wrapper-group').children().last().find('.select_contact_id').append($(
"<option></option>").attr("value", '').text('-- Select --'));
for (let itm of doctors) {
$('#doctor-wrapper-group').children().last().find('.select_contact_id').append($(
"<option></option>").attr("speciality", itm.contact.speciality).attr("value", itm.value).text(itm.display));
}
$('.number_proxym_pob_value').prop('readonly', 'true');
$('.number_proxym_pob_in_strips_units').unbind()
$('.number_proxym_pob_in_strips_units').on('change', function() {
$(this).parent().parent().find('.number_proxym_pob_value').val( (parseFloat($(this).val())*182.83).toFixed(2) )
})
$('.select_contact_id').unbind()
$('.select_contact_id').on('change', function() {
$(this).parent().parent().find('.text_speciality').val( $("option:selected" ,this).attr("speciality") )
})
$('.text_other_brand').prop({"required":false});
$('.text_other_brand').parent().hide();
$('.select_contact_id').unbind()
$('.text_pack_size').prop({"readonly":true});
$('.number_price').prop({"readonly":true});
$('.select_select_brand').on('change',function(){
let brand=$(this).val();
console.log("Brand is : ",brand);
if(brand==='ZEFTABAC INJECTION (20ML)'){
$('.text_pack_size').val("20 ML");
$('.number_price').val("4950");
}
else if(brand==='BIASTRONG 300MG INJECTION'){
$('.text_pack_size').val("1V");
$('.number_price').val("2200");
}
else if(brand==='CEFANTRAL 0.50G IP(10X1V) W/O WFI'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("272");
}
else if(brand==='CEFANTRAL 1.00G IP(10X1V) W/O WFI'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("447");
}
else if(brand==='CEFAXONE 0.25 GM (10X1V)'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("306.50");
}
else if(brand==='CEFAXONE 0.50 GM (10X1V)'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("384.50");
}
else if(brand==='CEFAXONE 1.00 GM (10X1V)'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("464");
}
else if(brand==='COMBITAZ-1GM INJ: 10X1V'){
$('.text_pack_size').val("10 V + A");
$('.number_price').val("3459");
}
else if(brand==='COMBITAZ-250 MG INJ:20X1V'){
$('.text_pack_size').val("20 x 1 V");
$('.number_price').val("2250");
}
else if(brand==='LUPINEM 500MG INJ'){
$('.text_pack_size').val("1 V");
$('.number_price').val("1170.30");
}
else if(brand==="LUPIN'S LUPITUM INJ (1GM+125MG)10X1V"){
$('.text_pack_size').val("10 x 1 V");
$('.number_price').val("3468");
}
else if(brand==="LUPIN'S TAZOX (1GX20)"){
$('.text_pack_size').val("20 x 1 V+A");
$('.number_price').val("4912");
}
else if(brand==="MAGNOVA- 250 MG INJ: 10X1V"){
$('.text_pack_size').val("10 x 1 V");
$('.number_price').val("1521.50");
}
else if(brand==="MAGNOVA-0.500GM INJ: 10X1V"){
$('.text_pack_size').val("10 X1 V+A");
$('.number_price').val("3313.50");
}
else if(brand==="MAGNOVA-1GM INJ: 10X1V"){
$('.text_pack_size').val("10 X1 V+A");
$('.number_price').val("6172");
}
else if(brand==="MEROTROL 0.25 GM 1 V"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("292.50");
}
else if(brand==="MEROTROL 0.5 GM 1 V"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("652.80");
}
else if(brand==="MEROTROL 1 GM 1 V"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("1067");
}
else if(brand==="MEROTROL S 1.5 GM 1 V"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("1624.55");
}
else if(brand==="NOVAPIME 0.25 GM (10X1V)"){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("1599.50");
}
else if(brand==="NOVAPIME 0.5 GM (10X1V)"){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("2509");
}
else if(brand==="NOVAPIME 1 GM (10X1V)"){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("4609.50");
}
else if(brand==="SUDOSTAR 1 MIU"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("844.25");
}
else if(brand==="SUDOSTAR 2 MIU"){
$('.text_pack_size').val("Vial");
$('.number_price').val("1446.50");
}
else if(brand==="SUDOSTAR 3 MIU"){
$('.text_pack_size').val("3 Million IU / Vial");
$('.number_price').val("2310");
}
else if(brand==="TAZAR INJ 1.125 GM (10X1V)"){
$('.text_pack_size').val("10 x 1 Single");
$('.number_price').val("1115.50");
}
else if(brand==="TAZAR INJ 2.25 GM (5X1V)"){
$('.text_pack_size').val("5x1 V");
$('.number_price').val("1072.25");
}
else if(brand==="TAZAR INJ 4.5GM 5X1V"){
$('.text_pack_size').val("5x1 V");
$('.number_price').val("1573.75");
}
else if(brand==="TICOGEM 400 INJ 1V"){
$('.text_pack_size').val("1V");
$('.number_price').val("1645.60");
}
else if(brand==="TIGEZ  INJ 1V"){
$('.text_pack_size').val("1V");
$('.number_price').val("3033.80");
}
else if(brand==="UPXIGA 100000 IU"){
$('.text_pack_size').val("1 vial");
$('.number_price').val("4489.80");
}
else if(brand==="VORITROL INJ 200MG"){
$('.text_pack_size').val("1V");
$('.number_price').val("3270.90");
}
else if(brand==="VORITROL200 TAB  (5X1 X 4T)"){
$('.text_pack_size').val("5X1 X 4T");
$('.number_price').val("13965.50");
}
else{
$('.text_pack_size').val("");
$('.number_price').val("");
}
})
})
// $('#field-total_pob_in_strips_units').prop('readonly', true);
// $('#field-no_of_proxym_rx_generated').on('input', function() {
// let proxym_rx_generated = parseInt($('#field-no_of_proxym_rx_generated').val()) || 0;
// $('#field-total_pob_in_strips_units').val(proxym_rx_generated);
// })
$('#adddoctor-btn').on('click',function(){
if(numberOfSubmission>2){
$('#adddoctor-btn').hide();
return ;
}
else if(numberOfSubmission<=2){
$('#adddoctor-btn').show();
}
})
$('.text_pack_size').prop({"readonly":true});
$('.number_price').prop({"readonly":true});
$('.select_select_brand').on('change',function(){
let brand=$(this).val();
console.log("Brand is : ",brand);
if(brand==='ZEFTABAC INJECTION (20ML)'){
$('.text_pack_size').val("20 ML");
$('.number_price').val("4950");
}
else if(brand==='BIASTRONG 300MG INJECTION'){
$('.text_pack_size').val("1V");
$('.number_price').val("2200");
}
else if(brand==='CEFANTRAL 0.50G IP(10X1V) W/O WFI'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("272");
}
else if(brand==='CEFANTRAL 1.00G IP(10X1V) W/O WFI'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("447");
}
else if(brand==='CEFAXONE 0.25 GM (10X1V)'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("306.50");
}
else if(brand==='CEFAXONE 0.50 GM (10X1V)'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("384.50");
}
else if(brand==='CEFAXONE 1.00 GM (10X1V)'){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("464");
}
else if(brand==='COMBITAZ-1GM INJ: 10X1V'){
$('.text_pack_size').val("10 V + A");
$('.number_price').val("3459");
}
else if(brand==='COMBITAZ-250 MG INJ:20X1V'){
$('.text_pack_size').val("20 x 1 V");
$('.number_price').val("2250");
}
else if(brand==='LUPINEM 500MG INJ'){
$('.text_pack_size').val("1 V");
$('.number_price').val("1170.30");
}
else if(brand==="LUPIN'S LUPITUM INJ (1GM+125MG)10X1V"){
$('.text_pack_size').val("10 x 1 V");
$('.number_price').val("3468");
}
else if(brand==="LUPIN'S TAZOX (1GX20)"){
$('.text_pack_size').val("20 x 1 V+A");
$('.number_price').val("4912");
}
else if(brand==="MAGNOVA- 250 MG INJ: 10X1V"){
$('.text_pack_size').val("10 x 1 V");
$('.number_price').val("1521.50");
}
else if(brand==="MAGNOVA-0.500GM INJ: 10X1V"){
$('.text_pack_size').val("10 X1 V+A");
$('.number_price').val("3313.50");
}
else if(brand==="MAGNOVA-1GM INJ: 10X1V"){
$('.text_pack_size').val("10 X1 V+A");
$('.number_price').val("6172");
}
else if(brand==="MEROTROL 0.25 GM 1 V"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("292.50");
}
else if(brand==="MEROTROL 0.5 GM 1 V"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("652.80");
}
else if(brand==="MEROTROL 1 GM 1 V"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("1067");
}
else if(brand==="MEROTROL S 1.5 GM 1 V"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("1624.55");
}
else if(brand==="NOVAPIME 0.25 GM (10X1V)"){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("1599.50");
}
else if(brand==="NOVAPIME 0.5 GM (10X1V)"){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("2509");
}
else if(brand==="NOVAPIME 1 GM (10X1V)"){
$('.text_pack_size').val("10x1 V");
$('.number_price').val("4609.50");
}
else if(brand==="SUDOSTAR 1 MIU"){
$('.text_pack_size').val("1 Vial");
$('.number_price').val("844.25");
}
else if(brand==="SUDOSTAR 2 MIU"){
$('.text_pack_size').val("Vial");
$('.number_price').val("1446.50");
}
else if(brand==="SUDOSTAR 3 MIU"){
$('.text_pack_size').val("3 Million IU / Vial");
$('.number_price').val("2310");
}
else if(brand==="TAZAR INJ 1.125 GM (10X1V)"){
$('.text_pack_size').val("10 x 1 Single");
$('.number_price').val("1115.50");
}
else if(brand==="TAZAR INJ 2.25 GM (5X1V)"){
$('.text_pack_size').val("5x1 V");
$('.number_price').val("1072.25");
}
else if(brand==="TAZAR INJ 4.5GM 5X1V"){
$('.text_pack_size').val("5x1 V");
$('.number_price').val("1573.75");
}
else if(brand==="TICOGEM 400 INJ 1V"){
$('.text_pack_size').val("1V");
$('.number_price').val("1645.60");
}
else if(brand==="TIGEZ  INJ 1V"){
$('.text_pack_size').val("1V");
$('.number_price').val("3033.80");
}
else if(brand==="UPXIGA 100000 IU"){
$('.text_pack_size').val("1 vial");
$('.number_price').val("4489.80");
}
else if(brand==="VORITROL INJ 200MG"){
$('.text_pack_size').val("1V");
$('.number_price').val("3270.90");
}
else if(brand==="VORITROL200 TAB  (5X1 X 4T)"){
$('.text_pack_size').val("5X1 X 4T");
$('.number_price').val("13965.50");
}
else{
$('.text_pack_size').val("");
$('.number_price').val("");
}
})
$('#field-contact_id').change(function() {
$('#field-msl_code').val($('option:selected', this).attr('msl_code'))
})
$('#field-contact_id').change(function() {
$('#field-hospital_name').val($('option:selected', this).attr('hospital_name'))
})
$('#report-form').on('submit', function(event) {
event.preventDefault();
$('.doctor-wrapper').each(function(index) {
for (let ques of ["record_date", "select_rehab_tuesday_week"]) {
$('#report-form').append('<input type="hidden" name="' + ques +
'[]" value="' + $('#field-' + ques).val() + '">')
}
});
$("#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'
})
$('#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>