694 lines
32 KiB
PHP
694 lines
32 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" />
|
|
</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","no_of_launch_call_done"] ) )
|
|
@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':''}}>
|
|
{{$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","no_of_launch_call_done"] ) )
|
|
@continue;
|
|
@endif
|
|
<div class="col-6 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 text_{{$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}}"
|
|
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 Doctor </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 type="text/javascript">
|
|
jQuery(document).ready(function($) {
|
|
let doctors = [];
|
|
function slugify(str) {
|
|
str = str.replace(/^\s+|\s+$/g, ''); // trim leading/trailing white space
|
|
str = str.toLowerCase(); // convert string to lowercase
|
|
str = str.replace(/[^a-z0-9 ]/g, '') // remove any non-alphanumeric characters
|
|
.replace(/\s+/g, '_') // replace spaces with hyphens
|
|
.replace(/-+/g, '_'); // remove consecutive hyphens
|
|
return str;
|
|
}
|
|
|
|
$('#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) {
|
|
console.log(obj)
|
|
$(this).html('')
|
|
$(this).append($("<option></option>").attr("value", '')
|
|
.text('-- Select --'));
|
|
for (let itm of data) {
|
|
//console.log(itm)
|
|
$(this).append($("<option></option>").attr("value", itm.value).attr("speciality", itm.contact.speciality).text(itm.display));
|
|
}
|
|
});
|
|
$('.select_contact_id').change(function() {
|
|
$(this).parent().parent().find('.text_speciality').val( $('option:selected', $(this)).attr('speciality') )
|
|
})
|
|
},
|
|
});
|
|
|
|
console.log(hierarchy)
|
|
})
|
|
|
|
let brands = [
|
|
{
|
|
"brand": "Celol",
|
|
"sku": "CELOL D3 + TABLETS",
|
|
"pts": 169.84
|
|
},
|
|
{
|
|
"brand": "Celol",
|
|
"sku": "CELOL MAX CAPSULES",
|
|
"pts": 244.07
|
|
},
|
|
{
|
|
"brand": "Celol",
|
|
"sku": "CELOL XT + TABLETS",
|
|
"pts": 174.2
|
|
},
|
|
{
|
|
"brand": "Celol",
|
|
"sku": "CELOL+TABLET",
|
|
"pts": 195.78
|
|
},
|
|
{
|
|
"brand": "Denmab",
|
|
"sku": "DENMAB INJECTION 60 MG/ML",
|
|
"pts": 5860
|
|
},
|
|
{
|
|
"brand": "Emanzen",
|
|
"sku": "EMANZEN D TABLET",
|
|
"pts": 148.92
|
|
},
|
|
{
|
|
"brand": "Emanzen",
|
|
"sku": "EMANZEN DP TABLET",
|
|
"pts": 132.27
|
|
},
|
|
{
|
|
"brand": "Emanzen",
|
|
"sku": "EMANZEN FORTE TABLET 10 MG",
|
|
"pts": 145.22
|
|
},
|
|
{
|
|
"brand": "Emanzen",
|
|
"sku": "EMANZEN TABLET 5 MG",
|
|
"pts": 100.12
|
|
},
|
|
{
|
|
"brand": "Ferium",
|
|
"sku": "FERIUM CHEWABLE TABLET 10",
|
|
"pts": 94.47
|
|
},
|
|
{
|
|
"brand": "Ferium",
|
|
"sku": "FERIUM D3 TABLET",
|
|
"pts": 123.14
|
|
},
|
|
{
|
|
"brand": "Ferium",
|
|
"sku": "FERIUM INJECTION 500MG",
|
|
"pts": 1200.00
|
|
},
|
|
{
|
|
"brand": "Ferium",
|
|
"sku": "FERIUM INJECTION 750MG/15ML",
|
|
"pts": 3085.71
|
|
},
|
|
{
|
|
"brand": "Ferium",
|
|
"sku": "FERIUM XT + SUSPENSION 200 ML",
|
|
"pts": 185.46
|
|
},
|
|
{
|
|
"brand": "Ferium",
|
|
"sku": "FERIUM XT DROPS 15 ML [IP-21]",
|
|
"pts": 88.01
|
|
},
|
|
{
|
|
"brand": "Ferium",
|
|
"sku": "FERIUM XT TABLET 10x15T",
|
|
"pts": 200.79
|
|
},
|
|
{
|
|
"brand": "Ferium",
|
|
"sku": "FERIUM XT TABLET 15T",
|
|
"pts": 200.79
|
|
},
|
|
{
|
|
"brand": "Ferri",
|
|
"sku": "FERRI-100 INJECTION",
|
|
"pts": 206.68
|
|
},
|
|
{
|
|
"brand": "Fitjoint",
|
|
"sku": "FITJOINT CAPSULES",
|
|
"pts": 355.12
|
|
},
|
|
{
|
|
"brand": "Fitjoint",
|
|
"sku": "FITJOINT MAX CAPSULES",
|
|
"pts": 552.82
|
|
},
|
|
{
|
|
"brand": "Galact",
|
|
"sku": "GALACT CAPSULES 1x30C",
|
|
"pts": 170.36
|
|
},
|
|
{
|
|
"brand": "Galact",
|
|
"sku": "GALACT GRANULES",
|
|
"pts": 513.60
|
|
},
|
|
{
|
|
"brand": "Galact",
|
|
"sku": "GALACT GRANULES CHOCOLATE",
|
|
"pts": 513.60
|
|
},
|
|
{
|
|
"brand": "Galact",
|
|
"sku": "GALACT GRANULES KESAR",
|
|
"pts": 513.60
|
|
},
|
|
{
|
|
"brand": "Infen",
|
|
"sku": "INFEN P TABLETS",
|
|
"pts": 102.25
|
|
},
|
|
{
|
|
"brand": "Infen",
|
|
"sku": "INFEN PLASTER 1X7",
|
|
"pts": 321.43
|
|
},
|
|
{
|
|
"brand": "Osteri",
|
|
"sku": "OSTERI INJ.600MCG /2.4MLPEN DEVICE",
|
|
"pts": 3900
|
|
},
|
|
{
|
|
"brand": "Osteri",
|
|
"sku": "OSTERI INJECTION NEEDLES",
|
|
"pts": 0.01
|
|
},
|
|
{
|
|
"brand": "Panpure",
|
|
"sku": "PANPURE TABLET",
|
|
"pts": 77.53
|
|
},
|
|
{
|
|
"brand": "Proxym",
|
|
"sku": "PROXYM ERTABLETS",
|
|
"pts": 182.83
|
|
},
|
|
{
|
|
"brand": "Proxym",
|
|
"sku": "PROXYM ER 200 TABLETS",
|
|
"pts": 153.61
|
|
},
|
|
{
|
|
"brand": "Proxym",
|
|
"sku": "PROXYM ER 200 TABLETS 15 T",
|
|
"pts": 230.4
|
|
},
|
|
{
|
|
"brand": "Proxym",
|
|
"sku": "PROXYM ER TABLET 1X15T",
|
|
"pts": 274.24
|
|
},
|
|
{
|
|
"brand": "Proxym",
|
|
"sku": "PROXYM GEL 30 GM",
|
|
"pts": 135.32
|
|
},
|
|
{
|
|
"brand": "Proxym",
|
|
"sku": "PROXYM TH8 TABLET 1x10T",
|
|
"pts": 250.71
|
|
},
|
|
{
|
|
"brand": "Proxym",
|
|
"sku": "PROXYM XT TABLET 1X15T",
|
|
"pts": 270.03
|
|
},
|
|
{
|
|
"brand": "Proxym",
|
|
"sku": "PROXYM-MR TABLET",
|
|
"pts": 247.69
|
|
},
|
|
{
|
|
"brand": "Proxym",
|
|
"sku": "PROXYM-XT TABLETS",
|
|
"pts": 163.83
|
|
},
|
|
{
|
|
"brand": "Sylate",
|
|
"sku": "SYLATE INJECTION 2 ML",
|
|
"pts": 66.89
|
|
},
|
|
{
|
|
"brand": "Sylate",
|
|
"sku": "SYLATE T 500 TABLET",
|
|
"pts": 321.46
|
|
},
|
|
{
|
|
"brand": "Sylate",
|
|
"sku": "SYLATE TABLET 500 MG",
|
|
"pts": 279.71
|
|
},
|
|
{
|
|
"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' } } ) ) )
|
|
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","no_of_launch_call_done"] ) )
|
|
@continue;
|
|
@endif
|
|
<div class="col-6 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 text_{{$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}}" 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>`
|
|
$('#adddoctor-btn').click(function() {
|
|
console.log(doctorformhtml)
|
|
$('#doctor-wrapper-group').append(doctorformhtml)
|
|
$('.btn-remove').unbind()
|
|
$('.btn-remove').click(function() {
|
|
$(this).parent().parent().remove()
|
|
})
|
|
|
|
$('.select_select_brand_group').unbind()
|
|
$('.select_select_brand_group').change(function() {
|
|
let skus = brands.filter(b => b.brand == $(this).val()).map(m => m.sku)
|
|
let skuSelect = $(this).parent().parent().find('.select_select_sku')
|
|
skuSelect.html('')
|
|
for (let sku of skus) {
|
|
skuSelect.append('<option value="' + sku + '">' + sku + '</option>')
|
|
}
|
|
console.log(skus)
|
|
})
|
|
$('.number_pob_units').unbind()
|
|
$('.number_pob_units').change(function() {
|
|
$(this).parent().parent().find('.number_pob_value').val(parseFloat(brands.find(
|
|
b => b.sku == $(this).parent().parent().find(
|
|
'.select_select_sku').val()).pts * $(this).val()))
|
|
})
|
|
|
|
$('#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("value", itm.value).attr("speciality", itm.contact.speciality).text(itm.display));
|
|
}
|
|
|
|
$('.select_contact_id').unbind()
|
|
$('.select_contact_id').change(function() {
|
|
$(this).parent().parent().find('.text_speciality').val( $('option:selected', $(this)).attr('speciality') )
|
|
})
|
|
})
|
|
|
|
$('.select_select_brand_group').change(function() {
|
|
let skus = brands.filter(b => b.brand == $(this).val()).map(m => m.sku)
|
|
console.log(skus)
|
|
let skuSelect = $(this).parent().parent().find('.select_select_sku')
|
|
skuSelect.html('')
|
|
for (let sku of skus) {
|
|
skuSelect.append('<option value="' + sku + '">' + sku + '</option>')
|
|
}
|
|
console.log(skus)
|
|
})
|
|
$('.number_pob_units').change(function() {
|
|
$(this).parent().parent().find('.number_pob_value').val(parseFloat(brands.find(b => b.sku ==
|
|
$(this).parent().parent().find('.select_select_sku').val()).pts * $(this)
|
|
.val()))
|
|
})
|
|
|
|
$('#report-form').on('submit', function(event) {
|
|
event.preventDefault();
|
|
|
|
$('.doctor-wrapper').each(function(index) {
|
|
for (let ques of ["record_date", "no_of_launch_call_done"]) {
|
|
$('#report-form').append('<input type="hidden" name="' + ques + '[]" value="' + $('#field-' + ques).val() + '">')
|
|
}
|
|
$('#report-form').append('<input type="hidden" name="'+$('.select_select_brand_group').eq(index).val().toLowerCase()+'_units[]" value="' +
|
|
($('.number_pob_units').eq(index).val()) + '">')
|
|
$('#report-form').append('<input type="hidden" name="'+slugify($('.select_select_sku').eq(index).val())+'_units[]" value="' +
|
|
($('.number_pob_units').eq(index).val()) + '">')
|
|
|
|
// $('#report-form').append('<input type="hidden" name="ferium_units[]" value="' +
|
|
// ($('.select_select_brand_group').eq(index).val() == 'Ferium' ? $(
|
|
// '.number_pob_units').eq(index).val() : 0) + '">')
|
|
// $('#report-form').append('<input type="hidden" name="galact_units[]" value="' +
|
|
// ($('.select_select_brand_group').eq(index).val() == 'Galact' ? $(
|
|
// '.number_pob_units').eq(index).val() : 0) + '">')
|
|
// $('#report-form').append('<input type="hidden" name="proxym_units[]" value="' +
|
|
// ($('.select_select_brand_group').eq(index).val() == 'Proxym' ? $(
|
|
// '.number_pob_units').eq(index).val() : 0) + '">')
|
|
|
|
$('#report-form').append('<input type="hidden" name="'+$('.select_select_brand_group').eq(index).val().toLowerCase()+'_value[]" value="' +
|
|
($('.number_pob_value').eq(index).val()) + '">')
|
|
$('#report-form').append('<input type="hidden" name="'+slugify($('.select_select_sku').eq(index).val())+'_value[]" value="' +
|
|
($('.number_pob_value').eq(index).val()) + '">')
|
|
|
|
// $('#report-form').append('<input type="hidden" name="ferium_value[]" value="' +
|
|
// ($('.select_select_brand_group').eq(index).val() == 'Ferium' ? $(
|
|
// '.number_pob_value').eq(index).val() : 0) + '">')
|
|
// $('#report-form').append('<input type="hidden" name="galact_value[]" value="' +
|
|
// ($('.select_select_brand_group').eq(index).val() == 'Galact' ? $(
|
|
// '.number_pob_value').eq(index).val() : 0) + '">')
|
|
// $('#report-form').append('<input type="hidden" name="proxym_value[]" value="' +
|
|
// ($('.select_select_brand_group').eq(index).val() == 'Proxym' ? $(
|
|
// '.number_pob_value').eq(index).val() : 0) + '">')
|
|
});
|
|
|
|
|
|
$("#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!'
|
|
})
|
|
}
|
|
},
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |