401 lines
27 KiB
PHP
401 lines
27 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 = json_decode('[{"sku":"CEFAXONE 0.25 GM (10X1V)","pack_size":"10 x 1 V","mrp":307,"ptr":138,"pts":124,"brand":"CEFAXONE","slug":"cefaxone_025_gm_10x1v_units"},{"sku":"CEFAXONE 1.00 GM (10X1V)","pack_size":"10 x 1 V","mrp":464,"ptr":222,"pts":200,"brand":"CEFAXONE","slug":"cefaxone_100_gm_10x1v_units"},{"sku":"CEFAXONE 0.50 GM (10X1V)","pack_size":"10 x 1 V","mrp":385,"ptr":178,"pts":160,"brand":"CEFAXONE","slug":"cefaxone_050_gm_10x1v_units"},{"sku":"TAZAR INJ 1.125 GM (10X1V)","pack_size":"10 x 1 Single","mrp":1116,"ptr":797,"pts":717,"brand":"TAZAR","slug":"tazar_inj_1125_gm_10x1v_units"},{"sku":"LUPIN\'S TAZOX (1GX20)","pack_size":"20 x 1 V+A","mrp":4912,"ptr":3190,"pts":2871,"brand":"LUPIN","slug":"lupins_tazox_1gx20_units"},{"sku":"LUPIN\'S LUPITUM INJ (1GM+125MG)10X1V","pack_size":"10 x 1 V","mrp":3469,"ptr":2254,"pts":2028,"brand":"LUPIN","slug":"lupins_lupitum_inj_1gm125mg10x1v_units"},{"sku":"TAZAR INJ 2.25 GM (5X1V)","pack_size":"5x1 V","mrp":1072,"ptr":766,"pts":689,"brand":"TAZAR","slug":"tazar_inj_225_gm_5x1v_units"},{"sku":"VORITROL INJ 200MG","pack_size":"1V","mrp":3271,"ptr":1932,"pts":1739,"brand":"VORITROL","slug":"voritrol_inj_200mg_units"},{"sku":"LUPINEM 500MG INJ","pack_size":"1 V","mrp":1172,"ptr":427,"pts":384,"brand":"LUPINEM","slug":"lupinem_500mg_inj_units"},{"sku":"MEROTROL 0.25 GM 1 V","pack_size":"1 Vial","mrp":293,"ptr":190,"pts":171,"brand":"MEROTROL","slug":"merotrol_025_gm_1_v_units"},{"sku":"MEROTROL 0.5 GM 1 V","pack_size":"1 Vial","mrp":653,"ptr":335,"pts":301,"brand":"MEROTROL","slug":"merotrol_05_gm_1_v_units"},{"sku":"MEROTROL S 1.5 GM 1 V","pack_size":"1 vial","mrp":1625,"ptr":786,"pts":707,"brand":"MEROTROL","slug":"merotrol_s_15_gm_1_v_units"},{"sku":"UPXIGA 100000 IU","pack_size":"1 vial","mrp":4490,"ptr":2917,"pts":2625,"brand":"UPXIGA","slug":"upxiga_100000_iu_units"},{"sku":"TAZAR INJ 4.5GM 5X1V","pack_size":"5x1 V","mrp":1574,"ptr":528,"pts":475,"brand":"TAZAR","slug":"tazar_inj_45gm_5x1v_units"},{"sku":"SUDOSTAR 1 MIU","pack_size":"1 Vial","mrp":844,"ptr":303,"pts":272,"brand":"SUDOSTAR","slug":"sudostar_1_miu_units"},{"sku":"SUDOSTAR 2 MIU","pack_size":"Vial","mrp":1447,"ptr":517,"pts":465,"brand":"SUDOSTAR","slug":"sudostar_2_miu_units"},{"sku":"SUDOSTAR 3 MIU","pack_size":"3 Million IU / Vial","mrp":2310,"ptr":1011,"pts":910,"brand":"SUDOSTAR","slug":"sudostar_3_miu_units"},{"sku":"TICOGEM 400 INJ 1V","pack_size":"1V","mrp":1646,"ptr":886,"pts":797,"brand":"TICOGEM","slug":"ticogem_400_inj_1v_units"},{"sku":"TIGEZ INJ 1V","pack_size":"1 V","mrp":3034,"ptr":685,"pts":617,"brand":"TIGEZ","slug":"tigez_inj_1v_units"},{"sku":"COMBITAZ-1GM INJ: 10X1V","pack_size":"10 V + A","mrp":3460,"ptr":1270,"pts":1143,"brand":"COMBITAZ","slug":"combitaz_1gm_inj_10x1v_units"},{"sku":"COMBITAZ-250 MG INJ:20X1V","pack_size":"20 x 1 V","mrp":2250,"ptr":930,"pts":837,"brand":"COMBITAZ","slug":"combitaz_250_mg_inj20x1v_units"},{"sku":"MAGNOVA-0.500GM INJ: 10X1V","pack_size":"10 X1 V+A","mrp":3314,"ptr":685,"pts":617,"brand":"MAGNOVA","slug":"magnova_0500gm_inj_10x1v_units"},{"sku":"MAGNOVA-1GM INJ: 10X1V","pack_size":"10 X 1V+A","mrp":6172,"ptr":1300,"pts":1170,"brand":"MAGNOVA","slug":"magnova_1gm_inj_10x1v_units"},{"sku":"MAGNOVA- 250 MG INJ: 10X1V","pack_size":"10 x 1 V","mrp":1522,"ptr":421,"pts":379,"brand":"MAGNOVA","slug":"magnova_250_mg_inj_10x1v_units"},{"sku":"NOVAPIME 1 GM (10X1V)","pack_size":"10x1 V","mrp":4610,"ptr":1100,"pts":990,"brand":"NOVAPIME","slug":"novapime_1_gm_10x1v_units"},{"sku":"NOVAPIME 0.25 GM (10X1V)","pack_size":"10x1 V","mrp":1600,"ptr":478,"pts":430,"brand":"NOVAPIME","slug":"novapime_025_gm_10x1v_units"},{"sku":"NOVAPIME 0.5 GM (10X1V)","pack_size":"10x1 V","mrp":2509,"ptr":700,"pts":630,"brand":"NOVAPIME","slug":"novapime_05_gm_10x1v_units"},{"sku":"MEROTROL 1 GM 1 V","pack_size":"1 Vial","mrp":1067,"ptr":267,"pts":240,"brand":"MEROTROL","slug":"merotrol_1_gm_1_v_units"},{"sku":"VORITROL200 TAB (5X1 X 4T)","pack_size":"5X1 X 4T","mrp":13966,"ptr":8244,"pts":7420,"brand":"VORITROL","slug":"voritrol200_tab_5x1_x_4t_units"},{"sku":"CEFANTRAL 0.50G IP(10X1V) W/O WFI","pack_size":"10x1 V","mrp":272,"ptr":204,"pts":188,"brand":"CEFANTRAL","slug":"cefantral_050g_ip10x1v_wo_wfi_units"},{"sku":"CEFANTRAL 1.00G IP(10X1V) W/O WFI","pack_size":"10x1 V","mrp":447,"ptr":335,"pts":308,"brand":"CEFANTRAL","slug":"cefantral_100g_ip10x1v_wo_wfi_units"},{"sku":"BIASTRONG 300MG INJECTION","pack_size":"1V","mrp":2200,"ptr":1729,"pts":1556,"brand":"BIASTRONG","slug":"biastrong_300mg_injection_units"},{"sku":"ZEFTABAC INJECTION (20ML)","pack_size":"20 ML","mrp":4950,"ptr":3214,"pts":2893,"brand":"ZEFTABAC","slug":"zeftabac_injection_20ml_units"},{"sku":"CEFAXONE 0.25 GM (10X1V)","pack_size":"10 x 1 V","mrp":307,"ptr":138,"pts":124,"brand":"CEFAXONE","slug":"cefaxone_025_gm_10x1v_units"},{"sku":"CEFAXONE 0.50 GM (10X1V)","pack_size":"10 x 1 V","mrp":385,"ptr":178,"pts":160,"brand":"CEFAXONE","slug":"cefaxone_050_gm_10x1v_units"},{"sku":"CEFAXONE 1.00 GM (10X1V)","pack_size":"10 x 1 V","mrp":464,"ptr":222,"pts":200,"brand":"CEFAXONE","slug":"cefaxone_100_gm_10x1v_units"}]');
|
||
@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 == 'yes'?'required':'' }}
|
||
value="{{isset($question->value)?$question->value:''}}">
|
||
@break
|
||
@case('number')
|
||
@if($question->code == 'current_business' || $question->code == 'current_business')
|
||
<input type="{{$question->type}}" min="0" max="9999999999" step="1000" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}" title="Value must be in multiples of 1000">
|
||
@else
|
||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="field-{{$question->code}}" name="{{$question->code}}" class="form-control" step="0.01" {{$question->required == 'yes'?'required':'' }} value="{{isset($question->value)?$question->value:0}}">
|
||
@endif
|
||
@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
|
||
@case('checkbox')
|
||
<div class="row checkboxes-{{$question->code}}">
|
||
@foreach($question->options as $option)
|
||
<div class="form-check mb-2 form-check-primary col-3">
|
||
<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
|
||
</div>
|
||
@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 multitextbox">
|
||
<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>Pricing Slab</th>
|
||
<th>Value</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@foreach($brandData as $brand)
|
||
@php
|
||
$brand = (array)$brand;
|
||
@endphp
|
||
<input type="hidden" name="{{ $brand['slug'] }}_pack_size" value="{{$brand['pack_size']}}" id="field-{{ $brand['slug'] }}_pack_size">
|
||
<input type="hidden" name="{{ $brand['slug'] }}_mrp" value="{{$brand['mrp']}}" id="field-{{ $brand['slug'] }}_mrp">
|
||
<input type="hidden" name="{{ $brand['slug'] }}_ptr" value="{{$brand['ptr']}}" id="field-{{ $brand['slug'] }}_ptr">
|
||
<input type="hidden" name="{{ $brand['slug'] }}_pts" value="{{$brand['pts']}}" id="field-{{ $brand['slug'] }}_pts">
|
||
<tr class="{{$brand['brand']}}">
|
||
<td>{{ $brand['sku'] }} <br/> <small> Size :{{$brand['pack_size']}}</small><small> PTS :{{$brand['pts']}}</small></td>
|
||
<td>
|
||
<input type="number" id="field-{{ $brand['slug'] }}" name="{{ $brand['slug'] }}" class="form-control form-control-large sku_units" value="{{ $id && isset($formdata) && isset($formdata->{$brand['slug']}) ? $formdata->{$brand['slug']} : 0 }}">
|
||
</td>
|
||
<td>
|
||
<select class="form-control form-control-large" id="field-{{ $brand['slug'] }}_discount" name="{{ $brand['slug'] }}_discount" >
|
||
<option value=""> -- Select -- </option>
|
||
@for ($i = 10; $i <= 50; $i++)
|
||
<option value="{{ $i }}"> {{ $i }} %</option>
|
||
@endfor
|
||
</select>
|
||
</td>
|
||
<td>
|
||
<input type="number" readonly id="field-{{ $brand['slug'] }}_value" name="{{ $brand['slug'] }}_value" class="form-control form-control-large sku_value" value="{{ $id && isset($formdata) && isset($formdata->{$brand['slug'].'_value'}) ? $formdata->{$brand['slug'].'_value'} : 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%;
|
||
}
|
||
.form-control-large{
|
||
width: 100px;
|
||
|
||
}
|
||
.hidden{
|
||
display: none;
|
||
}
|
||
.show{
|
||
display: table-row;
|
||
}
|
||
|
||
</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-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'))
|
||
})
|
||
|
||
// $("#field-speciality").parent().hide();
|
||
// $("#field-speciality").prop({"required":false});
|
||
// $("#field-legacy_code").parent().hide();
|
||
// $("#field-legacy_code").prop({"required":false});
|
||
|
||
$('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- Value entered will be rounded off to nearest 1000)</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- Value entered will be rounded off to nearest 1000)</p>'
|
||
)
|
||
|
||
$('#field-total_units').prop({"readonly":true});
|
||
$('#field-total_value').prop({"readonly":true});
|
||
|
||
$('.multitextbox tbody tr').hide()
|
||
$('.checkboxes-select_brands input[type="checkbox"]').click(function() {
|
||
console.log($(this))
|
||
if ($(this).is(':checked')) {
|
||
$('.multitextbox tbody .' + $(this).val()).show()
|
||
} else {
|
||
$('.multitextbox tbody .' + $(this).val()).hide()
|
||
}
|
||
});
|
||
|
||
$('#field-current_business').change(function(){
|
||
$('#field-current_business').val( Math.round($(this).val()/1000)*1000 );
|
||
})
|
||
$('#field-potential_business').change(function(){
|
||
$('#field-potential_business').val( Math.round($(this).val()/1000)*1000 );
|
||
})
|
||
|
||
@foreach($brandData as $brand)
|
||
@php
|
||
$brand = (array)$brand;
|
||
@endphp
|
||
$('#field-{{ $brand['slug'] }},#field-{{ $brand['slug'] }}_discount').change(function(){
|
||
$('#field-{{ $brand['slug'] }}_value').val( parseInt( ( ($('#field-{{ $brand['slug'] }}').val() * $('#field-{{ $brand['slug'] }}_pts').val()) - ( $('#field-{{ $brand['slug'] }}').val() * $('#field-{{ $brand['slug'] }}_pts').val() * ($('#field-{{ $brand['slug'] }}_discount').val()/100) ) ) * 100 )/100 )
|
||
let total = 0;
|
||
$('.sku_value').each(function() {
|
||
let val = parseFloat($(this).val());
|
||
if (!isNaN(val)) {
|
||
total += val;
|
||
}
|
||
});
|
||
$('#field-total_value').val( parseInt(total*100)/100 )
|
||
total = 0;
|
||
$('.sku_units').each(function() {
|
||
let val = parseFloat($(this).val());
|
||
if (!isNaN(val)) {
|
||
total += val;
|
||
}
|
||
});
|
||
$('#field-total_units').val( parseInt(total*100)/100 )
|
||
})
|
||
@endforeach
|
||
|
||
$('#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");
|
||
$('#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> |