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>
|
</td>
|
||||||
@endforeach
|
@endforeach
|
||||||
<td>
|
<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>
|
<a href="/form/show?form_id={{ $section['form_id'] }}&id={{ $submission->id }}" class="btn btn-primary btn-xs">Edit / Re-upload</a>
|
||||||
@endif
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@empty
|
@empty
|
||||||
|
|
|
||||||
|
|
@ -85,16 +85,97 @@
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$submissions = Formhelper::getMultiformData( $form->partition, $form_id, $form->user_id);
|
$history = Formhelper::getMultiformData($form->partition, $form_id, $form->user_id);
|
||||||
$submissions = $submissions->data->submissions;
|
$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
|
@endphp
|
||||||
@if(count($submissions)===0 || $id)
|
|
||||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
<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="form_id" value="{{$form_id}}">
|
||||||
@csrf
|
@csrf
|
||||||
@if($id)
|
@if($singleEdit)
|
||||||
<input type="hidden" name="id[0]" value="{{$id}}">
|
<input type="hidden" name="id[0]" value="{{$id}}">
|
||||||
@endif
|
@endif
|
||||||
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
@if(isset($form->manager_can_submit) && $form->manager_can_submit == true)
|
||||||
|
|
@ -114,6 +195,11 @@
|
||||||
["record_date","select_rxber_type"] ) )
|
["record_date","select_rxber_type"] ) )
|
||||||
@continue;
|
@continue;
|
||||||
@endif
|
@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">
|
<div class="col-md-12 mb-2">
|
||||||
<label for="field-{{$question->code}}" class="form-label">{{$question->question}}
|
<label for="field-{{$question->code}}" class="form-label">{{$question->question}}
|
||||||
{!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!}
|
{!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!}
|
||||||
|
|
@ -122,7 +208,7 @@
|
||||||
@case('hidden')
|
@case('hidden')
|
||||||
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
||||||
name="{{$question->code}}"
|
name="{{$question->code}}"
|
||||||
value="{{isset($question->value)?$question->value:''}}">
|
value="{{$topValue}}">
|
||||||
@break
|
@break
|
||||||
@case('text')
|
@case('text')
|
||||||
@case('email')
|
@case('email')
|
||||||
|
|
@ -131,24 +217,24 @@
|
||||||
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
||||||
name="{{$question->code}}" class="form-control"
|
name="{{$question->code}}" class="form-control"
|
||||||
{{$question->required == 'yes'?'required':'' }}
|
{{$question->required == 'yes'?'required':'' }}
|
||||||
value="{{isset($question->value)?$question->value:''}}">
|
value="{{$topValue}}">
|
||||||
@break
|
@break
|
||||||
@case('number')
|
@case('number')
|
||||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
|
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
|
||||||
id="field-{{$question->code}}" name="{{$question->code}}" class="form-control"
|
id="field-{{$question->code}}" name="{{$question->code}}" class="form-control"
|
||||||
{{$question->required == 'yes'?'required':'' }}
|
{{$question->required == 'yes'?'required':'' }}
|
||||||
value="{{isset($question->value)?$question->value:0}}">
|
value="{{$topValue !== '' ? $topValue : 0}}">
|
||||||
@break
|
@break
|
||||||
@case('textarea')
|
@case('textarea')
|
||||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}"
|
<textarea id="field-{{$question->code}}" name="{{$question->code}}"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
{{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
{{$question->required == 'yes'?'required':'' }}>{{$topValue}}</textarea>
|
||||||
@break
|
@break
|
||||||
@case('dropdown')
|
@case('dropdown')
|
||||||
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
<select class="form-control" id="field-{{ $question->code }}" name="{{ $question->code }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||||
<option value=""> -- Select -- </option>
|
<option value=""> -- Select -- </option>
|
||||||
@foreach ($question->options as $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->display }}
|
||||||
</option>
|
</option>
|
||||||
|
|
||||||
|
|
@ -158,109 +244,117 @@
|
||||||
@endswitch
|
@endswitch
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
@foreach($doctorRows as $index => $row)
|
||||||
|
@php
|
||||||
|
$isFirstDoctor = ((int) $index === 0);
|
||||||
|
@endphp
|
||||||
<div class="doctor-wrapper">
|
<div class="doctor-wrapper">
|
||||||
|
@if($row && !empty($row->id))
|
||||||
@foreach($questions as $question)
|
<input type="hidden" name="id[{{ $index }}]" value="{{ $row->id }}">
|
||||||
@if( in_array($question->code,
|
|
||||||
["record_date","select_rxber_type"] ) )
|
|
||||||
@continue;
|
|
||||||
@endif
|
@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">
|
<div class="col-md-12 mb-2">
|
||||||
<label for="field-{{$question->code}}"
|
<label for="{{ $fieldId }}" class="form-label">{{$question->question}} {!!$question->required == 'yes' ? '<span class="text-danger">*</span>':''!!} </label>
|
||||||
class="form-label">{{$question->question}} {!!$question->required == 'yes' ?
|
|
||||||
'<span class="text-danger">*</span>':''!!} </label>
|
|
||||||
@switch($question->type)
|
@switch($question->type)
|
||||||
@case('hidden')
|
@case('hidden')
|
||||||
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
<input type="{{$question->type}}" id="{{ $fieldId }}" name="{{ $fieldName }}" value="{{ $textValue }}">
|
||||||
name="{{$question->code}}[0]"
|
|
||||||
value="{{isset($question->value)?$question->value:''}}">
|
|
||||||
@break
|
@break
|
||||||
@case('text')
|
@case('text')
|
||||||
@case('email')
|
@case('email')
|
||||||
@case('tel')
|
@case('tel')
|
||||||
@case('date')
|
@case('date')
|
||||||
<input type="{{$question->type}}" id="field-{{$question->code}}"
|
<input type="{{$question->type}}" id="{{ $fieldId }}" name="{{ $fieldName }}" class="form-control" {{$question->required == 'yes'?'required':'' }} value="{{ $textValue }}">
|
||||||
name="{{$question->code}}[0]" class="form-control"
|
|
||||||
{{$question->required == 'yes'?'required':'' }}
|
|
||||||
value="{{isset($question->value)?$question->value:''}}">
|
|
||||||
@break
|
@break
|
||||||
@case('number')
|
@case('number')
|
||||||
<input type="{{$question->type}}" min="0" max="9999999999" step="1"
|
<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 }}">
|
||||||
id="field-{{$question->code}}" name="{{$question->code}}[0]"
|
|
||||||
class="form-control" {{$question->required == 'yes'?'required':'' }}
|
|
||||||
value="{{isset($question->value)?$question->value:0}}">
|
|
||||||
@break
|
@break
|
||||||
@case('textarea')
|
@case('textarea')
|
||||||
<textarea id="field-{{$question->code}}" name="{{$question->code}}[0]"
|
<textarea id="{{ $fieldId }}" name="{{ $fieldName }}" class="form-control" {{$question->required == 'yes'?'required':'' }}>{{ $textValue }}</textarea>
|
||||||
class="form-control"
|
|
||||||
{{$question->required == 'yes'?'required':'' }}>{{isset($question->value)?$question->value:''}}</textarea>
|
|
||||||
@break
|
@break
|
||||||
@case('dropdown')
|
@case('dropdown')
|
||||||
@if ($question->code == 'contact_id')
|
@if ($question->code == 'contact_id')
|
||||||
<select class="form-control" id="field-{{ $question->code }}"
|
<select class="form-control" id="{{ $fieldId }}" name="{{ $fieldName }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||||
name="{{ $question->code }}[0]"
|
<option value=""> -- Select -- </option>
|
||||||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
@foreach ($question->options as $option)
|
||||||
<option value=""> -- Select -- </option>
|
@if(isset($option->contact->type) && $option->contact->type == 'doctor')
|
||||||
@foreach ($question->options as $option)
|
<option value="{{ $option->value }}"
|
||||||
|
{{ (string) $textValue === (string) $option->value ? 'selected' : '' }}
|
||||||
@if($question->code == 'contact_id' && isset($option->contact->type) && $option->contact->type == 'doctor' )
|
legacy_code="{{ isset($option->contact->legacy_code) ? $option->contact->legacy_code : '' }}"
|
||||||
<option value="{{ $option->value }}"
|
msl_code="{{ isset($option->contact->msl_code) ? $option->contact->msl_code : '' }}"
|
||||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}
|
speciality="{{ isset($option->contact->speciality) ? $option->contact->speciality : '' }}">
|
||||||
@if($question->code == 'contact_id')
|
{{ $option->display }}
|
||||||
legacy_code="{{ (isset($option->contact->legacy_code) ? $option->contact->legacy_code : '') }}"
|
</option>
|
||||||
msl_code="{{ (isset($option->contact->msl_code) ? $option->contact->msl_code : '') }}"
|
@endif
|
||||||
speciality="{{ (isset($option->contact->speciality) ? $option->contact->speciality : '') }}"
|
@endforeach
|
||||||
@endif
|
</select>
|
||||||
>
|
|
||||||
{{ $option->display }}
|
|
||||||
</option>
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
@else
|
@else
|
||||||
<select class="form-control" id="execution-{{ $question->code }}"
|
<select class="form-control" id="{{ $fieldId }}" name="{{ $fieldName }}" {{ $question->required == 'yes' ? 'required' : '' }}>
|
||||||
name="{{ $question->code }}[0]"
|
<option value=""> -- Select -- </option>
|
||||||
{{ $question->required == 'yes' ? 'required' : '' }}>
|
@foreach ($question->options as $option)
|
||||||
<option value=""> -- Select -- </option>
|
<option value="{{ $option->value }}" {{ (string) $textValue === (string) $option->value ? 'selected' : '' }}>{{ $option->display }}</option>
|
||||||
@foreach ($question->options as $option)
|
@endforeach
|
||||||
<option value="{{ $option->value }}"
|
</select>
|
||||||
{{ isset($question->value) && $question->value == $option->value ? 'selected' : '' }}>
|
@endif
|
||||||
{{ $option->display }}</option>
|
|
||||||
@endforeach
|
|
||||||
</select>
|
|
||||||
@endif
|
|
||||||
@break
|
@break
|
||||||
@case('checkbox')
|
@case('checkbox')
|
||||||
@foreach($question->options as $option)
|
@foreach($question->options as $option)
|
||||||
<div class="form-check mb-2 form-check-primary">
|
<div class="form-check mb-2 form-check-primary">
|
||||||
<input class="form-check-input" type="checkbox"
|
<input class="form-check-input" type="checkbox"
|
||||||
id="field-{{$question->code}}-{{$option->value}}"
|
id="field-{{$question->code}}-{{$option->value}}{{ $isFirstDoctor ? '' : '-'.$index }}"
|
||||||
name="{{$question->code}}[0]" value="{{$option->value}}"
|
name="{{ $fieldName }}" value="{{$option->value}}"
|
||||||
{{isset($question->value) && $question->value != '' && in_array($option->value, $question->value) ? 'checked':''}}>
|
{{ in_array($option->value, $checkedValues) ? 'checked' : '' }}>
|
||||||
<label class="form-check-label"
|
<label class="form-check-label" for="field-{{$question->code}}-{{$option->value}}{{ $isFirstDoctor ? '' : '-'.$index }}">{{$option->display}}</label>
|
||||||
for="field-{{$question->code}}-{{$option->value}}">{{$option->display}}</label>
|
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@break
|
@break
|
||||||
@case('file')
|
@case('file')
|
||||||
@if(!isset($form->is_approval) || (isset($form->is_approval) &&
|
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||||
$form->is_approval != 'yes' ) )
|
<input type="file" id="{{ $fieldId }}" name="{{ $isFirstDoctor ? $question->code : $fieldName }}" class="form-control" value="" {{$question->required == 'yes'?'required':'' }}>
|
||||||
<input type="file" id="field-{{$question->code}}" name="{{$question->code}}"
|
@elseif($textValue !== '')
|
||||||
class="form-control" value=""
|
<img src="{{ $textValue }}" class="img-fluid">
|
||||||
{{$question->required == 'yes'?'required':'' }}>
|
|
||||||
@elseif(isset($question->value))
|
|
||||||
<img src="{{$question->value}}" class="img-fluid">
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@break
|
@break
|
||||||
@case('multitextbox')
|
@case('multitextbox')
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@foreach($question->options as $option)
|
@foreach($question->options as $option)
|
||||||
<div class="col-6">{{$option->display}}</div>
|
<div class="col-6">{{$option->display}}</div>
|
||||||
<div class="col-6 mb-1">
|
<div class="col-6 mb-1">
|
||||||
<input type="number" id="field-{{$option->value}}"
|
<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 }}">
|
||||||
name="{{$option->value}}" class="form-control" required
|
|
||||||
value="{{isset($option->val)?$option->val:0}}">
|
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -269,22 +363,19 @@
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
@endforeach
|
||||||
<div id="doctor-group-wrapper">
|
<div id="doctor-group-wrapper">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval !=
|
@if(!isset($form->is_approval) || (isset($form->is_approval) && $form->is_approval != 'yes'))
|
||||||
'yes' ) )
|
|
||||||
<div class="text-center button-list">
|
<div class="text-center button-list">
|
||||||
@if(!$id)
|
@if(!$singleEdit && !$lockDoctorBlocks)
|
||||||
<button class="btn btn-primary" type="button" id="adddoctor-btn"> Add Doctor </button>
|
<button class="btn btn-primary" type="button" id="adddoctor-btn"> Add Doctor </button>
|
||||||
@endif
|
@endif
|
||||||
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
<button class="btn btn-primary" type="submit" id="submit-btn"> Submit </button>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</form>
|
</form>
|
||||||
@elseif(!$id)
|
|
||||||
<h4>You have submitted 10 doctors</h4>
|
|
||||||
@endif
|
|
||||||
</div> <!-- end card-body -->
|
</div> <!-- end card-body -->
|
||||||
</div>
|
</div>
|
||||||
<!-- end card -->
|
<!-- end card -->
|
||||||
|
|
@ -341,7 +432,7 @@
|
||||||
$('#field-speciality').val($(this).find(":selected").attr("speciality"));
|
$('#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() {
|
function initializeSelect2() {
|
||||||
|
|
||||||
|
|
@ -531,16 +622,18 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var doctor_count = 0
|
var doctor_count = {{ max(count($doctorRows) - 1, 0) }};
|
||||||
let numberOfSubmission=0;
|
let numberOfSubmission = {{ max(count($doctorRows) - 1, 0) }};
|
||||||
console.log("Number of Submission : ",numberOfSubmission);
|
var singleRecordEdit = {{ $singleEdit ? 'true' : 'false' }};
|
||||||
|
var submitting = false;
|
||||||
$('#adddoctor-btn').click(function() {
|
$('#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++;
|
doctor_count++;
|
||||||
numberOfSubmission=numberOfSubmission+1;
|
numberOfSubmission=numberOfSubmission+1;
|
||||||
console.log("Number of Submission : ",numberOfSubmission);
|
|
||||||
|
|
||||||
let empty_doctor = `
|
let empty_doctor = `
|
||||||
|
|
||||||
|
|
@ -608,8 +701,12 @@
|
||||||
|
|
||||||
|
|
||||||
$('#doctor-group-wrapper').append(empty_doctor)
|
$('#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%',
|
width: '100%',
|
||||||
placeholder: '-- Select Doctor --'
|
placeholder: '-- Select Doctor --'
|
||||||
|
|
@ -652,11 +749,10 @@
|
||||||
});
|
});
|
||||||
$(this).closest('.doctor-wrapper').remove();
|
$(this).closest('.doctor-wrapper').remove();
|
||||||
numberOfSubmission--;
|
numberOfSubmission--;
|
||||||
doctor_count--
|
|
||||||
preventDuplicateDoctors();
|
preventDuplicateDoctors();
|
||||||
console.log("New Number of Submission : ",numberOfSubmission);
|
if ($('.doctor-wrapper').length < 10) {
|
||||||
console.log("Number of doctors : ",doctor_count);
|
$('#adddoctor-btn').show();
|
||||||
$('#adddoctor-btn').show();
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -704,17 +800,40 @@
|
||||||
|
|
||||||
$('#report-form').on('submit', function(event) {
|
$('#report-form').on('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
if (submitting) {
|
||||||
let isEditMode = $('input[name="id[0]"]').length > 0 && $('input[name="id[0]"]').val() !== '';
|
return;
|
||||||
|
|
||||||
if (!isEditMode && numberOfSubmission != 9) {
|
|
||||||
alert(`You must submit 10 Doctors , Current Doctors : ${numberOfSubmission+1}`);
|
|
||||||
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({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: '/form/ajaxsubmitmultiple',
|
url: '/form/ajaxsubmitmultiple',
|
||||||
|
|
@ -722,41 +841,21 @@
|
||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
$("#pageloader").fadeOut();
|
|
||||||
|
|
||||||
if (data.status == 'success') {
|
if (data.status == 'success') {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: 'Great!',
|
title: 'Great!',
|
||||||
text: 'Your data is successfully submitted!',
|
text: 'Your data is successfully submitted!',
|
||||||
icon: 'success'
|
icon: 'success'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
location.reload(); // 🔥 page refresh here
|
location.reload();
|
||||||
});
|
});
|
||||||
$('#report-form').trigger("reset");
|
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
location.reload();
|
||||||
icon: 'error',
|
|
||||||
title: 'Data not submitted',
|
|
||||||
text: 'Something went wrong, please try again after some time!'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
error: function() {
|
||||||
error: function(xhr, status, error) {
|
location.reload();
|
||||||
|
}
|
||||||
$("#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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,23 @@
|
||||||
</li>
|
</li>
|
||||||
@endif
|
@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')
|
@if(auth()->user()->domain == 'iva')
|
||||||
<li>
|
<li>
|
||||||
<a href="#sidebarIvaDashboards" data-bs-toggle="collapse">
|
<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\DepotwithtmmappingController;
|
||||||
|
|
||||||
use App\Http\Controllers\GennovadcReportController;
|
use App\Http\Controllers\GennovadcReportController;
|
||||||
|
use App\Http\Controllers\HorizonreportController;
|
||||||
use App\Http\Controllers\IvareportController;
|
use App\Http\Controllers\IvareportController;
|
||||||
use App\Http\Controllers\ZenovaReportController;
|
use App\Http\Controllers\ZenovaReportController;
|
||||||
|
|
||||||
|
|
@ -271,6 +272,7 @@ $modules = ['user' => UserController::class,
|
||||||
'coachingtooldashboard' => CoachingtoolDashboard::class,
|
'coachingtooldashboard' => CoachingtoolDashboard::class,
|
||||||
'gennovadcreport' => GennovadcReportController::class,
|
'gennovadcreport' => GennovadcReportController::class,
|
||||||
'zenovareport' => ZenovaReportController::class,
|
'zenovareport' => ZenovaReportController::class,
|
||||||
|
'horizonreport' => HorizonreportController::class,
|
||||||
'ivareport' => IvareportController::class,
|
'ivareport' => IvareportController::class,
|
||||||
'formhook' => FormhookController::class,
|
'formhook' => FormhookController::class,
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue