Mesalo (mesalo premier league) POB Form
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m25s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 1m25s
Details
This commit is contained in:
parent
1f3f1bccea
commit
a12d713f06
|
|
@ -15,7 +15,7 @@ $brandData = [
|
|||
|
||||
['brand'=>"Mesalo OD POB Units", 'slug'=>'mesalo_od_pob_units','pseudoId'=>'mesalo_od_pob_value'],
|
||||
['brand'=>"Mesalo Foam POB Units", 'slug'=>'mesalo_foam_pob_units','pseudoId'=>'mesalo_foam_pob_value'],
|
||||
['brand'=>"Total", 'slug'=>'total_units','pseudoId'=>'total_value'],
|
||||
['brand'=>"Total", 'slug'=>'total_pob_units','pseudoId'=>'total_pob_value'],
|
||||
|
||||
|
||||
];
|
||||
|
|
@ -139,19 +139,43 @@ if (!empty($submissions->data->submissions)) {
|
|||
{{$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" {!!($question->code
|
||||
== 'contact_id')?'data-toggle="select2"':'' !!} id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach ($question->options as $option)
|
||||
@php $spec = $option->contact->speciality ?? ''; @endphp
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
msl_code="{{ $option->contact->msl_code ?? '' }}"
|
||||
speciality="{{ $spec }}">
|
||||
{{ $option->display }}
|
||||
</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 == 'chemist_name' && isset($option->contact->type) && $option->contact->type == 'chemist' )
|
||||
<option value="{{ $option->value }}"
|
||||
@if(isset($question->value) && $question->value == $option->value) selected @endif
|
||||
@if($question->code == 'chemist_name')
|
||||
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=='chemist_name')
|
||||
<option value="others" {{ isset($question->value) && $question->value == 'others' ? 'selected' : '' }}>Others</option>
|
||||
@endif
|
||||
</select>
|
||||
@break
|
||||
@case('checkbox')
|
||||
|
|
@ -221,6 +245,9 @@ if (!empty($submissions->data->submissions)) {
|
|||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
<div class=" mb-2" id="doctor_msl_wrapper">
|
||||
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval !=
|
||||
'yes' ) )
|
||||
<div class="text-center d-grid mt-3">
|
||||
|
|
@ -312,8 +339,32 @@ if (!empty($submissions->data->submissions)) {
|
|||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$('#field-chemist_name').on('change',function(){
|
||||
|
||||
$('#doctor_msl_wrapper').html('')
|
||||
if ($(this).val() == 'others') {
|
||||
$('#doctor_msl_wrapper').append(`<div class="col-md-12 mb-2">
|
||||
<label for="field-other_chemist_name" class="form-label">Other Chemist Name <span class="text-danger">*</span> </label>
|
||||
<input type="text" id="field-other_chemist_name" name="other_chemist_name" class="form-control" value="" required>
|
||||
</div>
|
||||
`)
|
||||
}
|
||||
else{
|
||||
$('#doctor_msl_wrapper').html('')
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('#field-speciality,#field-msl_code').attr('readonly',true);
|
||||
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count,#field-chemist_table,#field-brand,#field-chemist_name').parent().hide();
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count,#field-chemist_table,#field-brand,#field-chemist_name').attr('required',false);
|
||||
$('label[for="field-brand"]').hide();
|
||||
|
||||
|
||||
$('#field-select_type').on('change',function(){
|
||||
let type=$(this).val();
|
||||
|
|
@ -321,21 +372,23 @@ if (!empty($submissions->data->submissions)) {
|
|||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count').parent().show();
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count').attr('required',true);
|
||||
|
||||
$('#field-chemist_table,#field-brand').parent().hide();
|
||||
$('#field-chemist_table,#field-brand').attr('required',false);
|
||||
$('#field-chemist_table,#field-brand,#field-chemist_name,').parent().hide();
|
||||
$('#field-chemist_table,#field-brand,#field-chemist_name,').attr('required',false);
|
||||
$('label[for="field-brand"]').hide();
|
||||
}
|
||||
else if(type=='Chemist'){
|
||||
|
||||
$('#field-chemist_table,#field-brand').parent().show();
|
||||
$('#field-chemist_table,#field-brand').attr('required',true);
|
||||
$('#field-chemist_table,#field-brand,#field-chemist_name').parent().show();
|
||||
$('#field-chemist_table,#field-brand,#field-chemist_name').attr('required',true);
|
||||
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count').parent().hide();
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count').attr('required',false);
|
||||
$('label[for="field-brand"]').show();
|
||||
}
|
||||
else if(type=='msl_code'){
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count,#field-chemist_table,#field-brand').parent().hide();
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count,#field-chemist_table,#field-brand').attr('required',false);
|
||||
|
||||
else {
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count,#field-chemist_table,#field-brand,#field-chemist_name').parent().hide();
|
||||
$('#field-contact_id,#field-msl_code,#field-speciality,#field-mesalo_od_conv,#field-mesalo_foam_conv,#field-mesalo_od_rx_count,#field-mesalo_foam_rx_count,#field-chemist_table,#field-brand,#field-chemist_name').attr('required',false);
|
||||
$('label[for="field-brand"]').hide();
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -343,8 +396,8 @@ if (!empty($submissions->data->submissions)) {
|
|||
|
||||
|
||||
const products = {
|
||||
mesalo_od_pob: 10.00,
|
||||
clearneb_pulmules_3_wv: 20.00,
|
||||
mesalo_od_pob: 10,
|
||||
mesalo_foam_pob: 20,
|
||||
};
|
||||
|
||||
$(document).on('input change', '[id^="field-"][id$="_units"]', function () {
|
||||
|
|
@ -375,9 +428,7 @@ 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);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -415,7 +466,55 @@ if (!empty($submissions->data->submissions)) {
|
|||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if($('#field-mesalo_od_conv').val()==='Yes'){
|
||||
$('#report-form').append('<input type="hidden" name="mesalo_od_conv_count" value="1">');
|
||||
}
|
||||
|
||||
if($('#field-mesalo_foam_conv').val()==='Yes'){
|
||||
$('#report-form').append('<input type="hidden" name="mesalo_foam_conv_count" value="1">');
|
||||
}
|
||||
|
||||
if($('#field-select_type').val()==='Doctor'){
|
||||
$('#field-chemist_name').val('');
|
||||
$('#field-mesalo_od_pob_units').val('');
|
||||
$('#field-mesalo_od_pob_value').val('');
|
||||
$('#field-mesalo_foam_pob_units').val('');
|
||||
$('#field-mesalo_foam_pob_value').val('');
|
||||
$('#field-total_pob_units').val('');
|
||||
$('#field-total_pob_value').val('');
|
||||
}
|
||||
|
||||
if($('#field-select_type').val()==='Chemist'){
|
||||
$('#field-contact_id').val('');
|
||||
$('#field-msl_code').val('');
|
||||
$('#field-speciality').val('');
|
||||
$('#field-mesalo_od_conv').val('');
|
||||
$('#field-mesalo_foam_conv').val('');
|
||||
$('#field-mesalo_od_rx_count').val('');
|
||||
$('#field-mesalo_foam_rx_count').val('');
|
||||
}
|
||||
|
||||
if($('#field-total_pob_units').val()<=0){
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Invalid Input',
|
||||
text: 'Atleast one POB Unit should be greater than 0!'
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
if ($('#field-chemist_name').val() === 'others') {
|
||||
let otherName = $('#field-other_chemist_name').val().trim();
|
||||
|
||||
if (otherName !== '') {
|
||||
|
||||
$('#field-chemist_name').append(
|
||||
$('<option>', { value: otherName, text: otherName, selected: true })
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
|
|
|||
Loading…
Reference in New Issue