Let the Doctor and Chemist survey open saved answers from History and keep the shared form on edit.
Specific Folder FTP Upload / ftp-deploy (push) Successful in 53s
Details
Specific Folder FTP Upload / ftp-deploy (push) Successful in 53s
Details
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
11f670e0b9
commit
957beb7ae0
|
|
@ -56,6 +56,13 @@ class FormController extends Controller
|
|||
return $value === true || $value === 1 || $value === '1' || $value === 'true';
|
||||
}
|
||||
|
||||
protected function doctorChemistBladeId($formId) {
|
||||
if ($formId === '1790230856-704c97b6-61f7-4eda-901a-2cb4ff6f293d') {
|
||||
return '1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e';
|
||||
}
|
||||
return $formId;
|
||||
}
|
||||
|
||||
protected function deliverform($formdata, $questions, $id = false) {
|
||||
$additional_info = $this->get_additional_info($formdata);
|
||||
// if($formdata->form_id == '1711609582-e93dba24-9c98-43e7-b97a-b22d64d9b9fc') {
|
||||
|
|
@ -91,10 +98,11 @@ class FormController extends Controller
|
|||
// return view('form.common', $data);
|
||||
// }
|
||||
|
||||
if (\View::exists('form.'.$formdata->partition.'.'.$formdata->form_id)) {
|
||||
return view('form.'.$formdata->partition.'.'.$formdata->form_id)->with($data);
|
||||
} elseif (\View::exists('form.'.$formdata->form_id)) {
|
||||
return view('form.'.$formdata->form_id)->with($data);
|
||||
$viewId = $this->doctorChemistBladeId($formdata->form_id);
|
||||
if (\View::exists('form.'.$formdata->partition.'.'.$viewId)) {
|
||||
return view('form.'.$formdata->partition.'.'.$viewId)->with($data);
|
||||
} elseif (\View::exists('form.'.$viewId)) {
|
||||
return view('form.'.$viewId)->with($data);
|
||||
} elseif(isset($formdata->form_type) && $formdata->form_type == 'enrollment_form'){
|
||||
return view('form.common-enrollmentform', $data);
|
||||
} elseif(isset($formdata->form_type) && $formdata->form_type == 'plan_vs_execution'){
|
||||
|
|
@ -563,6 +571,11 @@ class FormController extends Controller
|
|||
public function show(Request $request) {
|
||||
$formdata = $request->session()->get('formdata');
|
||||
//Log::debug(print_r($formdata, true));
|
||||
$requestedFormId = $request->input('form_id', '');
|
||||
if (is_string($requestedFormId) && $requestedFormId !== '') {
|
||||
$formdata->form_id = $requestedFormId;
|
||||
$request->session()->put('formdata', $formdata);
|
||||
}
|
||||
$id = $request->input('id', false);
|
||||
$action = $request->input('action', false);
|
||||
Log::debug(print_r(['form_id' => $formdata->form_id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition, 'id' => $id ], true));
|
||||
|
|
@ -8345,6 +8358,34 @@ class FormController extends Controller
|
|||
$data['incept_neb'] = $inceptService->withOrgTotals([], $formdata);
|
||||
}
|
||||
|
||||
$doctorSurveyId = '1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e';
|
||||
$chemistSurveyId = '1790230856-704c97b6-61f7-4eda-901a-2cb4ff6f293d';
|
||||
if (in_array($form_id, [$doctorSurveyId, $chemistSurveyId], true)) {
|
||||
$loadHistory = function ($id) use ($formdata, $form_id, $history) {
|
||||
if ($id === $form_id) {
|
||||
return $history;
|
||||
}
|
||||
return LambdaRequest::postrequest('form', 'formentity/getformhistory', ['form_id' => $id, 'user_id' => $formdata->user_id, 'partition' => $formdata->partition]);
|
||||
};
|
||||
$doctorHistory = $loadHistory($doctorSurveyId);
|
||||
$chemistHistory = $loadHistory($chemistSurveyId);
|
||||
$historyRows = function ($response) {
|
||||
return [
|
||||
'questions' => isset($response->data->questions) ? $response->data->questions : [],
|
||||
'submissions' => isset($response->data->submissions) ? $response->data->submissions : [],
|
||||
];
|
||||
};
|
||||
$doctorRows = $historyRows($doctorHistory);
|
||||
$chemistRows = $historyRows($chemistHistory);
|
||||
$data['doctor_form_id'] = $doctorSurveyId;
|
||||
$data['chemist_form_id'] = $chemistSurveyId;
|
||||
$data['doctor_questions'] = $doctorRows['questions'];
|
||||
$data['doctor_submissions'] = $doctorRows['submissions'];
|
||||
$data['chemist_questions'] = $chemistRows['questions'];
|
||||
$data['chemist_submissions'] = $chemistRows['submissions'];
|
||||
return view('form.'.$formdata->partition.'.'.$doctorSurveyId.'-history')->with($data);
|
||||
}
|
||||
|
||||
if (\View::exists('form.'.$formdata->partition.'.'.$formdata->form_id.'-history')) {
|
||||
return view('form.'.$formdata->partition.'.'.$formdata->form_id.'-history')->with($data);
|
||||
} elseif (\View::exists('form.'.$formdata->form_id.'-history')) {
|
||||
|
|
@ -8359,15 +8400,22 @@ class FormController extends Controller
|
|||
public function edit(Request $request) {
|
||||
$formdata = $request->session()->get('formdata');
|
||||
//Log::debug(print_r($formdata, true));
|
||||
$requestedFormId = $request->input('form_id', '');
|
||||
if (is_string($requestedFormId) && $requestedFormId !== '') {
|
||||
$formdata->form_id = $requestedFormId;
|
||||
$request->session()->put('formdata', $formdata);
|
||||
}
|
||||
$id = $request->input('id', false);
|
||||
//'user_id' => $formdata->user_id,
|
||||
$finfo = LambdaRequest::postrequest('form', 'formentity/getformdefination', ['form_id' => $formdata->form_id, 'partition' => $formdata->partition, 'id' => $id ]);
|
||||
$formdata->title = $finfo->data->formdata->title;
|
||||
$formdata->formdata = $finfo->data->formdata;
|
||||
//Log::debug(print_r($finfo->data->formdata, true));
|
||||
if (\View::exists('form.'.$formdata->partition.'.'.$formdata->form_id)) {
|
||||
return view('form.'.$formdata->partition.'.'.$formdata->form_id)->with(['questions' => $finfo->data->questions,'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id, 'formdata' => $finfo->data->formdata ]);
|
||||
} elseif (\View::exists('form.'.$formdata->form_id)) {
|
||||
return view('form.'.$formdata->form_id)->with(['questions' => $finfo->data->questions,'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id, 'formdata' => $finfo->data->formdata ]);
|
||||
$viewId = $this->doctorChemistBladeId($formdata->form_id);
|
||||
if (\View::exists('form.'.$formdata->partition.'.'.$viewId)) {
|
||||
return view('form.'.$formdata->partition.'.'.$viewId)->with(['questions' => $finfo->data->questions,'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id, 'formdata' => $finfo->data->formdata ]);
|
||||
} elseif (\View::exists('form.'.$viewId)) {
|
||||
return view('form.'.$viewId)->with(['questions' => $finfo->data->questions,'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id, 'formdata' => $finfo->data->formdata ]);
|
||||
} else {
|
||||
return view('form.common')->with(['questions' => $finfo->data->questions, 'form_id' => $formdata->form_id, 'form' => $formdata, 'id' => $id, 'formdata' => $finfo->data->formdata ]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@include('layouts.shared/title-meta', ['title' => 'History'])
|
||||
@include('layouts.shared/head-css', ['mode' => $mode ?? '', 'demo' => $demo ?? ''])
|
||||
</head>
|
||||
<body class="loading">
|
||||
<div class="account-pages">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-8 p-2">
|
||||
<h4 class="page-title">Doctor & Chemist Survey</h4>
|
||||
</div>
|
||||
<div class="col-4 p-2">
|
||||
<a href="/form/show?form_id={{ $doctor_form_id }}" class="float-end pt-1">New Submission</a>
|
||||
</div>
|
||||
</div>
|
||||
@if(session()->has('message'))
|
||||
<div class="alert alert-success">{{ session()->get('message') }}</div>
|
||||
@endif
|
||||
@if(session()->has('error'))
|
||||
<div class="alert alert-danger">{{ session()->get('error') }}</div>
|
||||
@endif
|
||||
|
||||
@foreach([
|
||||
['title' => 'Doctor Survey', 'form_id' => $doctor_form_id, 'questions' => $doctor_questions, 'submissions' => $doctor_submissions],
|
||||
['title' => 'Chemist Survey', 'form_id' => $chemist_form_id, 'questions' => $chemist_questions, 'submissions' => $chemist_submissions],
|
||||
] as $section)
|
||||
<div class="row">
|
||||
<div class="col-12 p-0">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="mb-3">{{ $section['title'] }}</h5>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Submission Date</th>
|
||||
<th>Submitted By</th>
|
||||
<th>Workflow Status</th>
|
||||
@foreach($section['questions'] as $code => $question)
|
||||
@if(($question->type ?? '') === 'hidden')
|
||||
@continue
|
||||
@endif
|
||||
<th>{{ $question->label ?? $code }}</th>
|
||||
@endforeach
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($section['submissions'] as $submission)
|
||||
<tr>
|
||||
<td>{{ date('d M Y', strtotime($submission->updatedAt ?? $submission->createdAt)) }}</td>
|
||||
<td>{{ $submission->user_info->name ?? '' }}</td>
|
||||
<td>{{ $submission->workflow_status ?? '' }}</td>
|
||||
@foreach($section['questions'] as $code => $question)
|
||||
@if(($question->type ?? '') === 'hidden')
|
||||
@continue
|
||||
@endif
|
||||
@php
|
||||
$cell = $submission->formdata->{$code} ?? '';
|
||||
if (is_array($cell)) {
|
||||
$cell = implode(', ', $cell);
|
||||
} elseif (is_object($cell)) {
|
||||
$cell = collect((array) $cell)->map(function ($val, $key) {
|
||||
return $key.': '.$val;
|
||||
})->implode(', ');
|
||||
}
|
||||
@endphp
|
||||
<td>
|
||||
@if(($question->type ?? '') === 'file' && $cell)
|
||||
<a href="{{ $cell }}" target="_blank" rel="noopener">View</a>
|
||||
@else
|
||||
{{ $cell }}
|
||||
@endif
|
||||
</td>
|
||||
@endforeach
|
||||
<td>
|
||||
<a href="/form/show?form_id={{ $section['form_id'] }}&id={{ $submission->id }}" class="btn btn-primary btn-xs">Edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="4">No submissions</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@include('layouts.shared/footer-script')
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -42,7 +42,8 @@
|
|||
</div>
|
||||
<form method="POST" action="/form/submit" id="report-form" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<input type="hidden" name="form_id" id="field-form_id" value="1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e">
|
||||
<input type="hidden" name="form_id" id="field-form_id" value="{{ $form_id ?? $form->form_id }}">
|
||||
<input type="hidden" name="id" id="field-submission_id" value="{{ $id ?: '' }}">
|
||||
|
||||
<div class="mb-2">
|
||||
<label class="form-label" for="field-record_date">Date <span class="text-danger">*</span></label>
|
||||
|
|
@ -73,6 +74,33 @@
|
|||
</div>
|
||||
@include('layouts.shared/footer-script')
|
||||
<script src="{{asset('assets/libs/sweetalert2/sweetalert2.min.js')}}"></script>
|
||||
@php
|
||||
$savedAnswers = [];
|
||||
$savedSource = null;
|
||||
if (!empty($id)) {
|
||||
if (isset($formdata) && (is_object($formdata) || is_array($formdata))) {
|
||||
$savedSource = $formdata;
|
||||
} elseif (isset($form->formdata)) {
|
||||
$savedSource = $form->formdata;
|
||||
}
|
||||
}
|
||||
if (is_object($savedSource) || is_array($savedSource)) {
|
||||
foreach ((array) $savedSource as $savedKey => $savedValue) {
|
||||
if ($savedKey === 'title' || is_array($savedValue) || is_object($savedValue) || $savedValue === null || $savedValue === '') {
|
||||
continue;
|
||||
}
|
||||
$savedAnswers[$savedKey] = $savedValue;
|
||||
}
|
||||
}
|
||||
foreach (($questions ?? []) as $savedQuestion) {
|
||||
if (!is_object($savedQuestion) || empty($savedQuestion->code)) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($savedAnswers[$savedQuestion->code]) && isset($savedQuestion->value) && $savedQuestion->value !== '' && !is_array($savedQuestion->value) && !is_object($savedQuestion->value)) {
|
||||
$savedAnswers[$savedQuestion->code] = $savedQuestion->value;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
<script>
|
||||
$(function () {
|
||||
var doctorFormId = '1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e';
|
||||
|
|
@ -85,6 +113,10 @@ $(function () {
|
|||
dateInput.max = today.getFullYear() + '-' + month + '-' + day;
|
||||
var surveyContacts = [];
|
||||
var contactsReady = false;
|
||||
// Dev only: open every section. Set to false to lock later sections until the previous step is complete.
|
||||
var unlockAllSections = true;
|
||||
var savedAnswers = @json($savedAnswers);
|
||||
var photoFields = ['visiting_card', 'rx_pad', 'doctor_board', 'chemist_board'];
|
||||
|
||||
function activeRoot() {
|
||||
return $('#field-visit_type').val() === 'chemist' ? '#chemist-fields' : '#doctor-fields';
|
||||
|
|
@ -102,7 +134,7 @@ $(function () {
|
|||
var section = $(this);
|
||||
section.toggleClass('locked', !open);
|
||||
section.find(':input').prop('disabled', !open);
|
||||
if (!open) {
|
||||
if (!open || unlockAllSections) {
|
||||
return;
|
||||
}
|
||||
var gates = section.find('[data-gate]');
|
||||
|
|
@ -185,6 +217,7 @@ $(function () {
|
|||
document.querySelectorAll('#chemist-fields .stockist-pick').forEach(function (select) {
|
||||
fillSelect(select, stockists);
|
||||
});
|
||||
matchSavedContacts();
|
||||
},
|
||||
error: function () {
|
||||
contactsReady = true;
|
||||
|
|
@ -242,10 +275,124 @@ $(function () {
|
|||
$('#doctor-fields').prop('disabled', !doctor).toggle(doctor);
|
||||
$('#chemist-fields').prop('disabled', doctor).toggle(!doctor);
|
||||
$('#field-form_id').val(doctor ? doctorFormId : chemistFormId);
|
||||
$('#field-doctor_name').val(doctor ? ($('#field-doctor_name').val() || 'Dr. ') : $('#field-doctor_name').val());
|
||||
if (doctor && !$('#field-doctor_name').val()) {
|
||||
$('#field-doctor_name').val('Dr. ');
|
||||
}
|
||||
if (doctor) {
|
||||
lockDoctorPrefix();
|
||||
}
|
||||
refreshSections();
|
||||
}
|
||||
|
||||
function lockDoctorPrefix() {
|
||||
var input = document.getElementById('field-doctor_name');
|
||||
if (!input || input.value.indexOf('Dr. ') === 0) {
|
||||
return;
|
||||
}
|
||||
var rest = input.value.replace(/^Dr\.\s*/i, '');
|
||||
var caret = input.selectionStart || 0;
|
||||
input.value = 'Dr. ' + rest;
|
||||
var next = Math.max(4, caret);
|
||||
if (document.activeElement === input) {
|
||||
input.setSelectionRange(next, next);
|
||||
}
|
||||
}
|
||||
|
||||
function showSavedPhoto(field, url) {
|
||||
var link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.target = '_blank';
|
||||
link.rel = 'noopener';
|
||||
link.className = 'd-block mt-1';
|
||||
link.textContent = 'View current photo';
|
||||
field.parentNode.appendChild(link);
|
||||
field.removeAttribute('required');
|
||||
if (!field.parentNode.querySelector('input.saved-file[name="' + field.name + '"]')) {
|
||||
var hidden = document.createElement('input');
|
||||
hidden.type = 'hidden';
|
||||
hidden.name = field.name;
|
||||
hidden.value = url;
|
||||
hidden.className = 'saved-file';
|
||||
field.parentNode.appendChild(hidden);
|
||||
}
|
||||
}
|
||||
|
||||
function applySaved() {
|
||||
if (!$('#field-submission_id').val()) {
|
||||
return;
|
||||
}
|
||||
var root = $(activeRoot());
|
||||
Object.keys(savedAnswers).forEach(function (code) {
|
||||
if (photoFields.indexOf(code) !== -1 || /_charge$/.test(code)) {
|
||||
return;
|
||||
}
|
||||
var fields = root.find('[name="' + code + '"]');
|
||||
if (!fields.length && code === 'record_date') {
|
||||
fields = $('#field-record_date');
|
||||
}
|
||||
fields.each(function () {
|
||||
if (this.type === 'file') {
|
||||
return;
|
||||
}
|
||||
if (this.type === 'radio' || this.type === 'checkbox') {
|
||||
this.checked = this.value === String(savedAnswers[code]);
|
||||
} else {
|
||||
this.value = savedAnswers[code];
|
||||
}
|
||||
});
|
||||
});
|
||||
if ($('#field-visit_type').val() !== 'chemist') {
|
||||
lockDoctorPrefix();
|
||||
}
|
||||
refreshSections();
|
||||
Object.keys(savedAnswers).forEach(function (code) {
|
||||
if (!/_charge$/.test(code)) {
|
||||
return;
|
||||
}
|
||||
root.find('[name="' + code + '"]').val(savedAnswers[code]);
|
||||
});
|
||||
photoFields.forEach(function (code) {
|
||||
if (!savedAnswers[code]) {
|
||||
return;
|
||||
}
|
||||
var field = document.getElementById('field-' + code);
|
||||
if (!field || !root.find(field).length) {
|
||||
return;
|
||||
}
|
||||
showSavedPhoto(field, savedAnswers[code]);
|
||||
});
|
||||
}
|
||||
|
||||
function selectSavedOption(select, label) {
|
||||
if (!label) {
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < select.options.length; i++) {
|
||||
if (select.options[i].textContent === label) {
|
||||
select.value = select.options[i].value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
var option = document.createElement('option');
|
||||
option.value = label;
|
||||
option.textContent = label;
|
||||
select.appendChild(option);
|
||||
select.value = label;
|
||||
}
|
||||
|
||||
function matchSavedContacts() {
|
||||
if (!$('#field-submission_id').val() || $('#field-visit_type').val() !== 'chemist') {
|
||||
return;
|
||||
}
|
||||
document.querySelectorAll('#chemist-fields .rcpa-doctor').forEach(function (select) {
|
||||
selectSavedOption(select, $(select).closest('tr').find('.rcpa-name').val());
|
||||
});
|
||||
document.querySelectorAll('#chemist-fields .stockist-pick').forEach(function (select) {
|
||||
selectSavedOption(select, $(select).closest('.stockist-block').find('.stockist-name').val());
|
||||
});
|
||||
}
|
||||
|
||||
$('#field-doctor_name').on('input', lockDoctorPrefix);
|
||||
$('#field-visit_type').on('change', function () { setVisit(this.value); });
|
||||
$('#report-form').on('input change', '.survey-section :input', refreshSections);
|
||||
$('#chemist-fields').on('change', '.rcpa-doctor', function () { applyDoctor(this); refreshSections(); });
|
||||
|
|
@ -305,7 +452,7 @@ $(function () {
|
|||
fail('Contact list is still loading. Please try again.');
|
||||
return;
|
||||
}
|
||||
if (mobileTaken('ebt_doctor', $('#field-mobile_number').val())) {
|
||||
if (!$('#field-submission_id').val() && mobileTaken('ebt_doctor', $('#field-mobile_number').val())) {
|
||||
fail('A doctor with this mobile number already exists.');
|
||||
return;
|
||||
}
|
||||
|
|
@ -336,7 +483,8 @@ $(function () {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (!hasPhoto) {
|
||||
var savedDoctorPhoto = $('#field-submission_id').val() && photoFields.slice(0, 3).some(function (code) { return savedAnswers[code]; });
|
||||
if (!hasPhoto && !savedDoctorPhoto) {
|
||||
fail('Upload at least one of visiting card, Rx pad or doctor board.');
|
||||
return;
|
||||
}
|
||||
|
|
@ -353,7 +501,7 @@ $(function () {
|
|||
fail('Contact list is still loading. Please try again.');
|
||||
return;
|
||||
}
|
||||
if (mobileTaken('ebt_chemist', $('#field-chemist_mobile').val())) {
|
||||
if (!$('#field-submission_id').val() && mobileTaken('ebt_chemist', $('#field-chemist_mobile').val())) {
|
||||
fail('A chemist with this mobile number already exists.');
|
||||
return;
|
||||
}
|
||||
|
|
@ -382,12 +530,20 @@ $(function () {
|
|||
return;
|
||||
}
|
||||
var board = document.getElementById('field-chemist_board').files[0];
|
||||
if (!board || !/\.(jpe?g|png)$/i.test(board.name) || board.size > 10 * 1024 * 1024) {
|
||||
if (board && (!/\.(jpe?g|png)$/i.test(board.name) || board.size > 10 * 1024 * 1024)) {
|
||||
fail('Chemist board must be a JPG, JPEG or PNG no larger than 10 MB.');
|
||||
return;
|
||||
}
|
||||
if (!board && !($('#field-submission_id').val() && savedAnswers.chemist_board)) {
|
||||
fail('Chemist board must be a JPG, JPEG or PNG no larger than 10 MB.');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var emptyFiles = $('#report-form input[type="file"]').filter(function () {
|
||||
return !this.files || !this.files.length;
|
||||
});
|
||||
emptyFiles.prop('disabled', true);
|
||||
$('#pageloader').css('display', 'flex').hide().fadeIn();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
|
|
@ -396,24 +552,32 @@ $(function () {
|
|||
processData: false,
|
||||
contentType: false,
|
||||
success: function (data) {
|
||||
emptyFiles.prop('disabled', false);
|
||||
$('#pageloader').fadeOut();
|
||||
if (data.status == 'success') {
|
||||
Swal.fire({ title: 'Great!', text: 'Your data is successfully submitted!', icon: 'success' });
|
||||
$('#report-form .saved-file').remove();
|
||||
$('#report-form a').filter(function () { return $(this).text() === 'View current photo'; }).remove();
|
||||
$('#report-form')[0].reset();
|
||||
setVisit('doctor');
|
||||
$('#field-submission_id').val('').attr('value', '');
|
||||
$('#field-visit_type').val('doctor');
|
||||
setVisit('doctor');
|
||||
} else {
|
||||
Swal.fire({ icon: 'error', title: 'Data not submitted', text: 'Please try again.' });
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
emptyFiles.prop('disabled', false);
|
||||
$('#pageloader').fadeOut();
|
||||
Swal.fire({ icon: 'error', title: 'Data not submitted', text: 'Please try again.' });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
setVisit('doctor');
|
||||
var openingType = ($('#field-form_id').val() === chemistFormId || @json($form->form_id ?? '') === chemistFormId) ? 'chemist' : 'doctor';
|
||||
$('#field-visit_type').val(openingType);
|
||||
setVisit(openingType);
|
||||
applySaved();
|
||||
loadContacts();
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@ $services = ['BP Monitoring' => 'chemist_bp_monitoring','Weighing Machine' => 'c
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="survey-section locked">
|
||||
<div class="survey-section">
|
||||
<button type="button" class="section-head">Upload photo</button>
|
||||
<div class="section-body">
|
||||
<div class="mb-2"><label class="form-label">Chemist Board <span class="text-danger">*</span></label><input type="file" class="form-control" id="field-chemist_board" name="chemist_board" accept=".jpg,.jpeg,.png,image/jpeg,image/png" data-gate required></div>
|
||||
<div class="mb-2"><label class="form-label">Chemist Board <span class="text-danger">*</span></label><input type="file" class="form-control" id="field-chemist_board" name="chemist_board" accept=".jpg,.jpeg,.png,image/jpeg,image/png" capture="environment" data-gate required></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="survey-section locked">
|
||||
<div class="survey-section">
|
||||
<button type="button" class="section-head">RCPA details</button>
|
||||
<div class="section-body">
|
||||
@foreach($products as $label => $code)
|
||||
|
|
@ -72,7 +72,7 @@ $services = ['BP Monitoring' => 'chemist_bp_monitoring','Weighing Machine' => 'c
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="survey-section locked">
|
||||
<div class="survey-section">
|
||||
<button type="button" class="section-head">Stockist</button>
|
||||
<div class="section-body">
|
||||
@foreach([1,2] as $n)
|
||||
|
|
@ -86,7 +86,7 @@ $services = ['BP Monitoring' => 'chemist_bp_monitoring','Weighing Machine' => 'c
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="survey-section locked">
|
||||
<div class="survey-section">
|
||||
<button type="button" class="section-head">Other therapies</button>
|
||||
<div class="section-body">
|
||||
@foreach($therapies as $label => $code)
|
||||
|
|
@ -95,7 +95,7 @@ $services = ['BP Monitoring' => 'chemist_bp_monitoring','Weighing Machine' => 'c
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="survey-section locked">
|
||||
<div class="survey-section">
|
||||
<button type="button" class="section-head">Services</button>
|
||||
<div class="section-body">
|
||||
@foreach($services as $label => $code)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ $products = ['Asthalin Inhaler' => 'asthalin_inhaler','Asthalin Rotacap' => 'ast
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="survey-section locked">
|
||||
<div class="survey-section">
|
||||
<button type="button" class="section-head">Chemist details</button>
|
||||
<div class="section-body">
|
||||
<div class="mb-2"><label class="form-label">Attached Chemist Name (If any)</label><input type="text" class="form-control" name="attached_chemist_name"></div>
|
||||
|
|
@ -34,7 +34,7 @@ $products = ['Asthalin Inhaler' => 'asthalin_inhaler','Asthalin Rotacap' => 'ast
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="survey-section locked">
|
||||
<div class="survey-section">
|
||||
<button type="button" class="section-head">Is the Doctor Prescriber of our Products?</button>
|
||||
<div class="section-body">
|
||||
@foreach($products as $label => $code)
|
||||
|
|
@ -43,12 +43,12 @@ $products = ['Asthalin Inhaler' => 'asthalin_inhaler','Asthalin Rotacap' => 'ast
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="survey-section locked">
|
||||
<div class="survey-section">
|
||||
<button type="button" class="section-head">Upload photos</button>
|
||||
<div class="section-body">
|
||||
<p class="text-muted">Upload one of visiting card, Rx pad or doctor board. JPG, JPEG or PNG, max 10 MB.</p>
|
||||
<div class="mb-2"><label class="form-label">Visiting Card</label><input type="file" class="form-control" id="field-visiting_card" name="visiting_card" accept=".jpg,.jpeg,.png,image/jpeg,image/png"></div>
|
||||
<div class="mb-2"><label class="form-label">Rx Pad</label><input type="file" class="form-control" id="field-rx_pad" name="rx_pad" accept=".jpg,.jpeg,.png,image/jpeg,image/png"></div>
|
||||
<div class="mb-2"><label class="form-label">Doctor Board</label><input type="file" class="form-control" id="field-doctor_board" name="doctor_board" accept=".jpg,.jpeg,.png,image/jpeg,image/png"></div>
|
||||
<div class="mb-2"><label class="form-label">Visiting Card</label><input type="file" class="form-control" id="field-visiting_card" name="visiting_card" accept=".jpg,.jpeg,.png,image/jpeg,image/png" capture="environment"></div>
|
||||
<div class="mb-2"><label class="form-label">Rx Pad</label><input type="file" class="form-control" id="field-rx_pad" name="rx_pad" accept=".jpg,.jpeg,.png,image/jpeg,image/png" capture="environment"></div>
|
||||
<div class="mb-2"><label class="form-label">Doctor Board</label><input type="file" class="form-control" id="field-doctor_board" name="doctor_board" accept=".jpg,.jpeg,.png,image/jpeg,image/png" capture="environment"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue