Changes
This commit is contained in:
parent
2a1a2d3550
commit
b2cc08c957
|
|
@ -109,17 +109,10 @@
|
||||||
$(function () {
|
$(function () {
|
||||||
var doctorFormId = '1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e';
|
var doctorFormId = '1790230856-a5ff58a6-d509-4ac0-9b18-6d366a74965e';
|
||||||
var chemistFormId = '1790230856-704c97b6-61f7-4eda-901a-2cb4ff6f293d';
|
var chemistFormId = '1790230856-704c97b6-61f7-4eda-901a-2cb4ff6f293d';
|
||||||
var dateInput = document.getElementById('field-record_date');
|
|
||||||
var today = new Date();
|
|
||||||
var month = String(today.getMonth() + 1).padStart(2, '0');
|
|
||||||
var day = String(today.getDate()).padStart(2, '0');
|
|
||||||
dateInput.min = '2026-09-01';
|
|
||||||
dateInput.max = today.getFullYear() + '-' + month + '-' + day;
|
|
||||||
var surveyContacts = [];
|
var surveyContacts = [];
|
||||||
var submittedIdentities = [];
|
var submittedIdentities = [];
|
||||||
var contactsReady = false;
|
var contactsReady = false;
|
||||||
// Dev only: open every section. Set to false to lock later sections until the previous step is complete.
|
var unlockAllSections = false;
|
||||||
var unlockAllSections = true;
|
|
||||||
var savedAnswers = @json($savedAnswers);
|
var savedAnswers = @json($savedAnswers);
|
||||||
var photoFields = ['visiting_card', 'rx_pad', 'doctor_board', 'chemist_board'];
|
var photoFields = ['visiting_card', 'rx_pad', 'doctor_board', 'chemist_board'];
|
||||||
|
|
||||||
|
|
@ -499,6 +492,7 @@ $(function () {
|
||||||
}
|
}
|
||||||
showSavedPhoto(field, savedAnswers[code]);
|
showSavedPhoto(field, savedAnswers[code]);
|
||||||
});
|
});
|
||||||
|
syncStatusFields(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectSavedOption(select, label) {
|
function selectSavedOption(select, label) {
|
||||||
|
|
@ -549,8 +543,17 @@ $(function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function syncStatusFields(root) {
|
||||||
|
$(root || '#report-form').find('select.status-source').each(function () {
|
||||||
|
$(this).siblings('input.status-value').val(this.value === 'Yes' ? '1' : '0');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$('#field-doctor_name').on('input', lockDoctorPrefix);
|
$('#field-doctor_name').on('input', lockDoctorPrefix);
|
||||||
$('#doctor-fields').on('change', '.product-choice', syncProductUnits);
|
$('#doctor-fields').on('change', '.product-choice', function () {
|
||||||
|
syncProductUnits();
|
||||||
|
syncStatusFields(this.parentNode);
|
||||||
|
});
|
||||||
$('#chemist-fields').on('input', '.stockist-other-name', function () {
|
$('#chemist-fields').on('input', '.stockist-other-name', function () {
|
||||||
$(this).closest('.stockist-block').find('.stockist-name').val(this.value);
|
$(this).closest('.stockist-block').find('.stockist-name').val(this.value);
|
||||||
});
|
});
|
||||||
|
|
@ -561,6 +564,9 @@ $(function () {
|
||||||
$('#chemist-fields').on('change', '.service-choice', syncServiceFields);
|
$('#chemist-fields').on('change', '.service-choice', syncServiceFields);
|
||||||
|
|
||||||
$('#field-degree, #field-specialty').on('change', syncOtherFields);
|
$('#field-degree, #field-specialty').on('change', syncOtherFields);
|
||||||
|
$('#report-form').on('change', 'select.status-source', function () {
|
||||||
|
syncStatusFields(this.parentNode);
|
||||||
|
});
|
||||||
|
|
||||||
function fail(text) {
|
function fail(text) {
|
||||||
Swal.fire({ icon: 'error', title: 'Please check the form', text: text });
|
Swal.fire({ icon: 'error', title: 'Please check the form', text: text });
|
||||||
|
|
@ -663,8 +669,8 @@ $(function () {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var type = $('#field-visit_type').val();
|
var type = $('#field-visit_type').val();
|
||||||
var recordDate = $('#field-record_date').val();
|
var recordDate = $('#field-record_date').val();
|
||||||
if (!recordDate || recordDate < dateInput.min || recordDate > dateInput.max) {
|
if (!recordDate) {
|
||||||
fail('Date must be from 1 Sep 2026 through today.');
|
fail('Date is required.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type === 'doctor') {
|
if (type === 'doctor') {
|
||||||
|
|
@ -817,6 +823,7 @@ $(function () {
|
||||||
return !this.files || !this.files.length;
|
return !this.files || !this.files.length;
|
||||||
});
|
});
|
||||||
emptyFiles.prop('disabled', true);
|
emptyFiles.prop('disabled', true);
|
||||||
|
syncStatusFields(activeRoot());
|
||||||
$('#pageloader').css('display', 'flex').hide().fadeIn();
|
$('#pageloader').css('display', 'flex').hide().fadeIn();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ $services = ['BP Monitoring' => 'chemist_bp_monitoring','Weighing Machine' => 'c
|
||||||
<div class="mb-2"><label class="form-label">Chemist Address <span class="text-danger">*</span></label><input type="text" class="form-control" id="field-chemist_location" name="chemist_location" data-gate required></div>
|
<div class="mb-2"><label class="form-label">Chemist Address <span class="text-danger">*</span></label><input type="text" class="form-control" id="field-chemist_location" name="chemist_location" data-gate required></div>
|
||||||
<div class="mb-2"><label class="form-label">Chemist Pincode <span class="text-danger">*</span></label><input type="text" class="form-control" id="field-chemist_pincode" name="chemist_pincode" inputmode="numeric" maxlength="6" data-gate required></div>
|
<div class="mb-2"><label class="form-label">Chemist Pincode <span class="text-danger">*</span></label><input type="text" class="form-control" id="field-chemist_pincode" name="chemist_pincode" inputmode="numeric" maxlength="6" data-gate required></div>
|
||||||
<div class="mb-2"><label class="form-label">Chemist Type <span class="text-danger">*</span></label><select class="form-control" name="chemist_type" data-gate required><option value="">-- Select --</option>@foreach($chemistTypes as $item)<option value="{{$item}}">{{$item}}</option>@endforeach</select></div>
|
<div class="mb-2"><label class="form-label">Chemist Type <span class="text-danger">*</span></label><select class="form-control" name="chemist_type" data-gate required><option value="">-- Select --</option>@foreach($chemistTypes as $item)<option value="{{$item}}">{{$item}}</option>@endforeach</select></div>
|
||||||
<div class="mb-2"><label class="form-label" for="field-chemist_manager_joint_visit">Manager (EBM) Joint Visit Status <span class="text-danger">*</span></label><select class="form-control" id="field-chemist_manager_joint_visit" name="manager_joint_visit" data-gate required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select></div>
|
<div class="mb-2"><label class="form-label" for="field-chemist_manager_joint_visit">Manager (EBM) Joint Visit Status <span class="text-danger">*</span></label><select class="form-control status-source" id="field-chemist_manager_joint_visit" name="manager_joint_visit" data-gate required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select><input type="hidden" name="manager_joint_visit_status" class="status-value" value="0"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ $products = ['Asthalin Inhaler' => 'asthalin_inhaler','Asthalin Rotacap' => 'ast
|
||||||
<div class="mb-2"><label class="form-label">Doctor Type <span class="text-danger">*</span></label><select class="form-control" id="field-doctor_type" name="doctor_type" data-gate required><option value="">-- Select --</option>@foreach($doctorTypes as $item)<option value="{{$item}}">{{$item}}</option>@endforeach</select></div>
|
<div class="mb-2"><label class="form-label">Doctor Type <span class="text-danger">*</span></label><select class="form-control" id="field-doctor_type" name="doctor_type" data-gate required><option value="">-- Select --</option>@foreach($doctorTypes as $item)<option value="{{$item}}">{{$item}}</option>@endforeach</select></div>
|
||||||
<div class="mb-2"><label class="form-label">No. of Total Patients Seen in a Day <span class="text-danger">*</span></label><select class="form-control" name="total_patients" data-gate required><option value="">-- Select --</option>@foreach($bands as $item)<option value="{{$item}}">{{$item}}</option>@endforeach</select></div>
|
<div class="mb-2"><label class="form-label">No. of Total Patients Seen in a Day <span class="text-danger">*</span></label><select class="form-control" name="total_patients" data-gate required><option value="">-- Select --</option>@foreach($bands as $item)<option value="{{$item}}">{{$item}}</option>@endforeach</select></div>
|
||||||
<div class="mb-2"><label class="form-label">No. of Respiratory Patients Seen in a Day <span class="text-danger">*</span></label><select class="form-control" name="respiratory_patients" data-gate required><option value="">-- Select --</option>@foreach($bands as $item)<option value="{{$item}}">{{$item}}</option>@endforeach</select></div>
|
<div class="mb-2"><label class="form-label">No. of Respiratory Patients Seen in a Day <span class="text-danger">*</span></label><select class="form-control" name="respiratory_patients" data-gate required><option value="">-- Select --</option>@foreach($bands as $item)<option value="{{$item}}">{{$item}}</option>@endforeach</select></div>
|
||||||
<div class="mb-2"><label class="form-label" for="field-doctor_manager_joint_visit">Manager (EBM) Joint Visit Status <span class="text-danger">*</span></label><select class="form-control" id="field-doctor_manager_joint_visit" name="manager_joint_visit" data-gate required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select></div>
|
<div class="mb-2"><label class="form-label" for="field-doctor_manager_joint_visit">Manager (EBM) Joint Visit Status <span class="text-danger">*</span></label><select class="form-control status-source" id="field-doctor_manager_joint_visit" name="manager_joint_visit" data-gate required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select><input type="hidden" name="manager_joint_visit_status" class="status-value" value="0"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -40,7 +40,8 @@ $products = ['Asthalin Inhaler' => 'asthalin_inhaler','Asthalin Rotacap' => 'ast
|
||||||
@foreach($products as $label => $code)
|
@foreach($products as $label => $code)
|
||||||
<div class="mb-2 product-row">
|
<div class="mb-2 product-row">
|
||||||
<label class="form-label">{{$label}} <span class="text-danger">*</span></label>
|
<label class="form-label">{{$label}} <span class="text-danger">*</span></label>
|
||||||
<select class="form-control product-choice" name="{{$code}}" data-gate required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select>
|
<select class="form-control product-choice status-source" name="{{$code}}" data-gate required><option value="">-- Select --</option><option value="Yes">Yes</option><option value="No">No</option></select>
|
||||||
|
<input type="hidden" name="{{$code}}_status" class="status-value" value="0">
|
||||||
<div class="mt-2 product-units" style="display:none">
|
<div class="mt-2 product-units" style="display:none">
|
||||||
<label class="form-label">No. of Units in a Month <span class="text-danger">*</span></label>
|
<label class="form-label">No. of Units in a Month <span class="text-danger">*</span></label>
|
||||||
<input type="number" min="0" step="1" class="form-control" name="{{$code}}_units" disabled>
|
<input type="number" min="0" step="1" class="form-control" name="{{$code}}_units" disabled>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue