Merge branch 'main' of https://git.stratawiz.com/Stratawiz/Rapport-Laravel
Specific Folder FTP Upload / ftp-deploy (push) Successful in 6m2s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 6m2s
Details
This commit is contained in:
commit
c64ef8bed2
|
|
@ -92,9 +92,7 @@
|
|||
</td>
|
||||
@endforeach
|
||||
<td>
|
||||
@if(strtolower((string) ($submission->workflow_status ?? '')) === 'rejected')
|
||||
<a href="/form/show?form_id={{ $section['form_id'] }}&id={{ $submission->id }}" class="btn btn-primary btn-xs">Edit / Re-upload</a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
|
|
|
|||
|
|
@ -85,16 +85,97 @@
|
|||
@endif
|
||||
|
||||
@php
|
||||
$submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
||||
$submissions = $submissions->data->submissions;
|
||||
|
||||
$history = Formhelper::getMultiformData($form->partition, $form_id, $form->user_id);
|
||||
$submissions = [];
|
||||
if (isset($history->data->submissions)) {
|
||||
$rawSubmissions = $history->data->submissions;
|
||||
if (is_array($rawSubmissions)) {
|
||||
$submissions = $rawSubmissions;
|
||||
} elseif ($rawSubmissions instanceof \Traversable) {
|
||||
$submissions = iterator_to_array($rawSubmissions);
|
||||
}
|
||||
}
|
||||
|
||||
$singleEdit = !empty($id);
|
||||
$normalizeDate = function ($value) {
|
||||
$value = trim((string) $value);
|
||||
if ($value === '') {
|
||||
return '';
|
||||
}
|
||||
if (preg_match('/^\d{4}-\d{2}-\d{2}/', $value)) {
|
||||
return substr($value, 0, 10);
|
||||
}
|
||||
if (ctype_digit($value)) {
|
||||
$timestamp = strlen($value) > 10 ? (int) ($value / 1000) : (int) $value;
|
||||
return date('Y-m-d', $timestamp);
|
||||
}
|
||||
return $value;
|
||||
};
|
||||
$doctorContactId = function ($row) {
|
||||
if (!$row || !isset($row->formdata)) {
|
||||
return '';
|
||||
}
|
||||
if (!empty($row->formdata->cont_id)) {
|
||||
return trim((string) $row->formdata->cont_id);
|
||||
}
|
||||
$contactId = $row->formdata->contact_id ?? '';
|
||||
if (is_array($contactId)) {
|
||||
$contactId = reset($contactId);
|
||||
}
|
||||
return trim((string) $contactId);
|
||||
};
|
||||
|
||||
$doctorRows = [];
|
||||
if (!$singleEdit) {
|
||||
$seenDoctors = [];
|
||||
foreach ($submissions as $submission) {
|
||||
if (is_array($submission)) {
|
||||
$submission = json_decode(json_encode($submission));
|
||||
}
|
||||
if (empty($submission->id)) {
|
||||
continue;
|
||||
}
|
||||
$contactKey = $doctorContactId($submission);
|
||||
if ($contactKey === '' || isset($seenDoctors[$contactKey])) {
|
||||
continue;
|
||||
}
|
||||
$seenDoctors[$contactKey] = true;
|
||||
$doctorRows[] = $submission;
|
||||
if (count($doctorRows) >= 10) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($doctorRows) === 0) {
|
||||
$doctorRows = [null];
|
||||
}
|
||||
$lockDoctorBlocks = !$singleEdit && $doctorRows[0] !== null && count($doctorRows) >= 10;
|
||||
|
||||
$topValues = [];
|
||||
if (!$singleEdit && $doctorRows[0] !== null && isset($doctorRows[0]->formdata)) {
|
||||
$firstForm = $doctorRows[0]->formdata;
|
||||
foreach (['record_date', 'select_rxber_type'] as $sharedCode) {
|
||||
if (!isset($firstForm->{$sharedCode})) {
|
||||
continue;
|
||||
}
|
||||
$shared = $firstForm->{$sharedCode};
|
||||
if (is_array($shared)) {
|
||||
$shared = reset($shared);
|
||||
}
|
||||
if (is_object($shared)) {
|
||||
continue;
|
||||
}
|
||||
if ($sharedCode === 'record_date') {
|
||||
$shared = $normalizeDate($shared);
|
||||
}
|
||||
$topValues[$sharedCode] = $shared;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
@if(count($submissions)===0 || $id)
|
||||
<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)
|
||||
@if($singleEdit)
|
||||
<input type="hidden" name="id[0]" value="{{$id}}">
|
||||
@endif
|
||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||
|
|
@ -114,6 +195,11 @@
|
|||
["record_date","select_rxber_type"] ) )
|
||||
@continue;
|
||||
@endif
|
||||
@php
|
||||
$topValue = array_key_exists($question->code, $topValues)
|
||||
? $topValues[$question->code]
|
||||
: (isset($question->value) ? $question->value : '');
|
||||
@endphp
|
||||
<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>':''!!}
|
||||
|
|
@ -122,7 +208,7 @@
|
|||
@case('hidden')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
||||
name="{{$question->code}}"
|
||||
value="{{isset($question->value)?$question->value:''}}">
|
||||
value="{{$topValue}}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
|
|
@ -131,24 +217,24 @@
|
|||
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
||||
name="{{$question->code}}" class="form-control"
|
||||
{{$question->required == 'yes'?'required':'' }}
|
||||
value="{{isset($question->value)?$question->value:''}}">
|
||||
value="{{$topValue}}">
|
||||
@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}}">
|
||||
value="{{$topValue !== '' ? $topValue : 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>
|
||||
{{$question->required == 'yes'?'required':'' }}>{{$topValue}}</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 == 'doctor_name' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
<option value="{{ $option->value }}" {{ (string) $topValue === (string) $option->value ? 'selected' : '' }} {{ $question->code == 'contact_id' ? 'msl_code= ' . $option->contact->msl_code . ' ' : '' }} {{ $question->code == 'doctor_name' ? 'speciality= ' . (isset($option->contact->speciality) ? $option->contact->speciality :'') . ' ' : '' }} >
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
|
||||
|
|
@ -158,109 +244,117 @@
|
|||
@endswitch
|
||||
</div>
|
||||
@endforeach
|
||||
@foreach($doctorRows as $index => $row)
|
||||
@php
|
||||
$isFirstDoctor = ((int) $index === 0);
|
||||
@endphp
|
||||
<div class="doctor-wrapper">
|
||||
|
||||
@foreach($questions as $question)
|
||||
@if( in_array($question->code,
|
||||
["record_date","select_rxber_type"] ) )
|
||||
@continue;
|
||||
@if($row && !empty($row->id))
|
||||
<input type="hidden" name="id[{{ $index }}]" value="{{ $row->id }}">
|
||||
@endif
|
||||
@foreach($questions as $question)
|
||||
@if(in_array($question->code, ["record_date","select_rxber_type"]))
|
||||
@continue
|
||||
@endif
|
||||
@php
|
||||
$fieldName = $question->code.'['.$index.']';
|
||||
if ($question->code === 'contact_id') {
|
||||
$fieldId = $isFirstDoctor ? 'field-contact_id' : 'field-contact_id-'.$index;
|
||||
} elseif ($question->type === 'dropdown' && $isFirstDoctor) {
|
||||
$fieldId = 'execution-'.$question->code;
|
||||
} else {
|
||||
$fieldId = $isFirstDoctor ? 'field-'.$question->code : 'field-'.$question->code.'-'.$index;
|
||||
}
|
||||
$textValue = '';
|
||||
if ($row && isset($row->formdata) && isset($row->formdata->{$question->code})) {
|
||||
$textValue = $row->formdata->{$question->code};
|
||||
if (is_array($textValue)) {
|
||||
$textValue = reset($textValue);
|
||||
}
|
||||
if (is_object($textValue)) {
|
||||
$textValue = '';
|
||||
}
|
||||
} elseif (!$row && isset($question->value)) {
|
||||
$textValue = $question->value;
|
||||
}
|
||||
if ($question->code === 'contact_id') {
|
||||
$textValue = $row ? $doctorContactId($row) : (isset($question->value) ? $question->value : '');
|
||||
}
|
||||
$checkedValues = [];
|
||||
if ($row && isset($row->formdata) && isset($row->formdata->{$question->code})) {
|
||||
$rawCheck = $row->formdata->{$question->code};
|
||||
$checkedValues = is_array($rawCheck) ? $rawCheck : [$rawCheck];
|
||||
} elseif (!$row && isset($question->value) && $question->value !== '') {
|
||||
$checkedValues = is_array($question->value) ? $question->value : [$question->value];
|
||||
}
|
||||
@endphp
|
||||
<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>
|
||||
<label for="{{ $fieldId }}" 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}}[0]"
|
||||
value="{{isset($question->value)?$question->value:''}}">
|
||||
<input type="{{$question->type}}" id="{{ $fieldId }}" name="{{ $fieldName }}" value="{{ $textValue }}">
|
||||
@break
|
||||
@case('text')
|
||||
@case('email')
|
||||
@case('tel')
|
||||
@case('date')
|
||||
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
||||
name="{{$question->code}}[0]" class="form-control"
|
||||
{{$question->required == 'yes'?'required':'' }}
|
||||
value="{{isset($question->value)?$question->value:''}}">
|
||||
<input type="{{$question->type}}" id="{{ $fieldId }}" name="{{ $fieldName }}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{ $textValue }}">
|
||||
@break
|
||||
@case('number')
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
|
||||
id="field-{{$question->code}}" name="{{$question->code}}[0]"
|
||||
class="form-control" {{$question->required == 'yes'?'required':'' }}
|
||||
value="{{isset($question->value)?$question->value:0}}">
|
||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1" id="{{ $fieldId }}" name="{{ $fieldName }}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{ $textValue !== '' ? $textValue : 0 }}">
|
||||
@break
|
||||
@case('textarea')
|
||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}[0]"
|
||||
class="form-control"
|
||||
{{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
||||
<textarea id="{{ $fieldId }}" name="{{ $fieldName }}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{ $textValue }}</textarea>
|
||||
@break
|
||||
@case('dropdown')
|
||||
@if ($question->code == 'contact_id')
|
||||
<select class="form-control" id="field-{{ $question->code }}"
|
||||
name="{{ $question->code }}[0]"
|
||||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach ($question->options as $option)
|
||||
|
||||
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor' )
|
||||
<option value="{{ $option->value }}"
|
||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
||||
@if($question->code == 'contact_id')
|
||||
legacy_code="{{ (isset($option->contact->legacy_code) ? $option->contact->legacy_code : '') }}"
|
||||
msl_code="{{ (isset($option->contact->msl_code) ? $option->contact->msl_code : '') }}"
|
||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
||||
@endif
|
||||
>
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
<select class="form-control" id="{{ $fieldId }}" name="{{ $fieldName }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach ($question->options as $option)
|
||||
@if(isset($option->contact->type) && $option->contact->type == 'doctor')
|
||||
<option value="{{ $option->value }}"
|
||||
{{ (string) $textValue === (string) $option->value ? 'selected' : '' }}
|
||||
legacy_code="{{ isset($option->contact->legacy_code) ? $option->contact->legacy_code : '' }}"
|
||||
msl_code="{{ isset($option->contact->msl_code) ? $option->contact->msl_code : '' }}"
|
||||
speciality="{{ isset($option->contact->speciality) ? $option->contact->speciality : '' }}">
|
||||
{{ $option->display }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
@else
|
||||
<select class="form-control" id="execution-{{ $question->code }}"
|
||||
name="{{ $question->code }}[0]"
|
||||
{{ $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>
|
||||
@endif
|
||||
<select class="form-control" id="{{ $fieldId }}" name="{{ $fieldName }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||
<option value=""> -- Select -- </option>
|
||||
@foreach ($question->options as $option)
|
||||
<option value="{{ $option->value }}" {{ (string) $textValue === (string) $option->value ? 'selected' : '' }}>{{ $option->display }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@endif
|
||||
@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}}[0]" 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>
|
||||
id="field-{{$question->code}}-{{$option->value}}{{ $isFirstDoctor ? '' : '-'.$index }}"
|
||||
name="{{ $fieldName }}" value="{{$option->value}}"
|
||||
{{ in_array($option->value, $checkedValues) ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}{{ $isFirstDoctor ? '' : '-'.$index }}">{{$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">
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||
<input type="file" id="{{ $fieldId }}" name="{{ $isFirstDoctor ? $question->code : $fieldName }}" class="form-control" value="" {{$question->required == 'yes'?'required':'' }}>
|
||||
@elseif($textValue !== '')
|
||||
<img src="{{ $textValue }}" class="img-fluid">
|
||||
@endif
|
||||
|
||||
@break
|
||||
@case('multitextbox')
|
||||
<div class="row">
|
||||
@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}}">
|
||||
<input type="number" id="field-{{$option->value}}{{ $isFirstDoctor ? '' : '-'.$index }}" name="{{ $isFirstDoctor ? $option->value : $option->value.'['.$index.']' }}" class="form-control" required value="{{ isset($option->val) ? $option->val : 0 }}">
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
|
|
@ -269,22 +363,19 @@
|
|||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endforeach
|
||||
<div id="doctor-group-wrapper">
|
||||
|
||||
</div>
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval !=
|
||||
'yes' ) )
|
||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||
<div class="text-center button-list">
|
||||
@if(!$id)
|
||||
@if(!$singleEdit && !$lockDoctorBlocks)
|
||||
<button class="btn btn-primary" type="button" id="adddoctor-btn"> Add Doctor </button>
|
||||
@endif
|
||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||
</div>
|
||||
@endif
|
||||
</form>
|
||||
@elseif(!$id)
|
||||
<h4>You have submitted 10 doctors</h4>
|
||||
@endif
|
||||
</div> <!-- end card-body -->
|
||||
</div>
|
||||
<!-- end card -->
|
||||
|
|
@ -341,7 +432,7 @@
|
|||
$('#field-speciality').val($(this).find(":selected").attr("speciality"));
|
||||
})
|
||||
|
||||
$('#field-msl_code,#field-speciality').attr('readonly',true);
|
||||
$('[id^="field-msl_code"],[id^="field-speciality"]').attr('readonly',true);
|
||||
|
||||
function initializeSelect2() {
|
||||
|
||||
|
|
@ -531,16 +622,18 @@
|
|||
|
||||
|
||||
|
||||
var doctor_count = 0
|
||||
let numberOfSubmission=0;
|
||||
console.log("Number of Submission : ",numberOfSubmission);
|
||||
var doctor_count = {{ max(count($doctorRows) - 1, 0) }};
|
||||
let numberOfSubmission = {{ max(count($doctorRows) - 1, 0) }};
|
||||
var singleRecordEdit = {{ $singleEdit ? 'true' : 'false' }};
|
||||
var submitting = false;
|
||||
$('#adddoctor-btn').click(function() {
|
||||
let doctorName=$('#field-contact_id').html();
|
||||
let doctorName = ($('#field-contact_id').html() || '')
|
||||
.replace(/\sselected(?:=(?:"selected"|'selected'|selected))?/gi, '')
|
||||
.replace(/\sdisabled(?:=(?:"disabled"|'disabled'|disabled))?/gi, '')
|
||||
.replace(/ \(Already Added\)/g, '');
|
||||
|
||||
console.log("Doctor Name : ",doctorName);
|
||||
doctor_count++;
|
||||
numberOfSubmission=numberOfSubmission+1;
|
||||
console.log("Number of Submission : ",numberOfSubmission);
|
||||
|
||||
let empty_doctor = `
|
||||
|
||||
|
|
@ -608,8 +701,12 @@
|
|||
|
||||
|
||||
$('#doctor-group-wrapper').append(empty_doctor)
|
||||
|
||||
$('#field-contact_id-'+doctor_count).select2({
|
||||
|
||||
var $addedContact = $('#field-contact_id-' + doctor_count);
|
||||
$addedContact.find('option').prop('selected', false);
|
||||
$addedContact.val('');
|
||||
|
||||
$addedContact.select2({
|
||||
|
||||
width: '100%',
|
||||
placeholder: '-- Select Doctor --'
|
||||
|
|
@ -652,11 +749,10 @@
|
|||
});
|
||||
$(this).closest('.doctor-wrapper').remove();
|
||||
numberOfSubmission--;
|
||||
doctor_count--
|
||||
preventDuplicateDoctors();
|
||||
console.log("New Number of Submission : ",numberOfSubmission);
|
||||
console.log("Number of doctors : ",doctor_count);
|
||||
$('#adddoctor-btn').show();
|
||||
if ($('.doctor-wrapper').length < 10) {
|
||||
$('#adddoctor-btn').show();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
|
@ -704,17 +800,40 @@
|
|||
|
||||
$('#report-form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
let isEditMode = $('input[name="id[0]"]').length > 0 && $('input[name="id[0]"]').val() !== '';
|
||||
|
||||
if (!isEditMode && numberOfSubmission != 9) {
|
||||
alert(`You must submit 10 Doctors , Current Doctors : ${numberOfSubmission+1}`);
|
||||
return;
|
||||
if (submitting) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!singleRecordEdit) {
|
||||
let doctorIds = [];
|
||||
$('select[id^="field-contact_id"]').each(function() {
|
||||
let value = $(this).val();
|
||||
if (value) {
|
||||
doctorIds.push(value);
|
||||
}
|
||||
});
|
||||
if (doctorIds.length !== 10 || new Set(doctorIds).size !== 10) {
|
||||
Swal.fire({
|
||||
icon: 'warning',
|
||||
title: '10 doctors required',
|
||||
text: 'Select 10 different doctors before submitting.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$("#pageloader").fadeIn();
|
||||
submitting = true;
|
||||
$('#submit-btn, #adddoctor-btn').prop('disabled', true);
|
||||
$('#pageloader').show();
|
||||
$('#report-form .doctor-wrapper').each(function(index) {
|
||||
$(this).find('[name]').each(function() {
|
||||
let name = $(this).attr('name') || '';
|
||||
let match = name.match(/^(.*)\[(\d+)\]$/);
|
||||
if (match) {
|
||||
$(this).attr('name', match[1] + '[' + index + ']');
|
||||
}
|
||||
});
|
||||
});
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/form/ajaxsubmitmultiple',
|
||||
|
|
@ -722,41 +841,21 @@
|
|||
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'
|
||||
}).then(() => {
|
||||
location.reload(); // 🔥 page refresh here
|
||||
});
|
||||
$('#report-form').trigger("reset");
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Data not submitted',
|
||||
text: 'Something went wrong, please try again after some time!'
|
||||
})
|
||||
location.reload();
|
||||
}
|
||||
},
|
||||
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
$("#pageloader").fadeOut();
|
||||
|
||||
console.log("HTTP Status:", xhr.status);
|
||||
console.log("Status:", status);
|
||||
console.log("Error:", error);
|
||||
console.log("Response:", xhr.responseText);
|
||||
|
||||
Swal.fire({
|
||||
icon: 'error',
|
||||
title: 'Server Error',
|
||||
text: xhr.responseJSON?.message || error
|
||||
});
|
||||
}
|
||||
error: function() {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -207,6 +207,23 @@
|
|||
</li>
|
||||
@endif
|
||||
|
||||
@if(\App\Helpers\HorizonReportAccess::canView())
|
||||
<li>
|
||||
<a href="#sidebarHorizonReports" data-bs-toggle="collapse">
|
||||
<i data-feather="file-text"></i>
|
||||
<span> Custom Reports </span>
|
||||
<span class="menu-arrow"></span>
|
||||
</a>
|
||||
<div class="collapse {{ request()->is('horizonreport/*') || request()->is('horizonreports') ? 'show' : '' }}" id="sidebarHorizonReports">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="/horizonreport/fieldwork">Monthly Field Work Report</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
@endif
|
||||
|
||||
@if(auth()->user()->domain == 'iva')
|
||||
<li>
|
||||
<a href="#sidebarIvaDashboards" data-bs-toggle="collapse">
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ use App\Http\Controllers\NebmitratmmappingController;
|
|||
use App\Http\Controllers\DepotwithtmmappingController;
|
||||
|
||||
use App\Http\Controllers\GennovadcReportController;
|
||||
use App\Http\Controllers\HorizonreportController;
|
||||
use App\Http\Controllers\IvareportController;
|
||||
use App\Http\Controllers\ZenovaReportController;
|
||||
|
||||
|
|
@ -271,6 +272,7 @@ $modules = ['user' => UserController::class,
|
|||
'coachingtooldashboard' => CoachingtoolDashboard::class,
|
||||
'gennovadcreport' => GennovadcReportController::class,
|
||||
'zenovareport' => ZenovaReportController::class,
|
||||
'horizonreport' => HorizonreportController::class,
|
||||
'ivareport' => IvareportController::class,
|
||||
'formhook' => FormhookController::class,
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue