POB and Survey Form Changes
Specific Folder FTP Upload / ftp-deploy (push) Successful in 39s Details

This commit is contained in:
Ravi Gulhane 2026-10-13 15:47:54 +05:30
parent 01bec5add5
commit 698fed99e8
4 changed files with 35 additions and 20 deletions

View File

@ -584,6 +584,10 @@ $(function () {
return /^[A-Za-z0-9]+(?:[ ]+[A-Za-z0-9]+)*$/.test(value);
}
function stockistAddressOk(value) {
return /^(?=.*[A-Za-z0-9])[A-Za-z0-9 ,.\-\/#&()']+$/.test(value);
}
function doctorAddressOk(value) {
return /^[A-Za-z0-9]+(?:[ ,]+[A-Za-z0-9]+)*$/.test(value);
}
@ -773,7 +777,8 @@ $(function () {
fail('A chemist with this mobile number already exists.');
return;
}
var badStockist = false;
var badStockistName = false;
var badStockistAddress = false;
$('#chemist-fields .stockist-pick').each(function () {
if (this.value !== 'others') {
return;
@ -782,12 +787,19 @@ $(function () {
var otherName = block.find('.stockist-other-name').val().trim();
var otherAddress = block.find('.stockist-location').val().trim();
block.find('.stockist-name').val(otherName);
if (!addressOk(otherName) || !addressOk(otherAddress)) {
badStockist = true;
if (!addressOk(otherName)) {
badStockistName = true;
}
if (!stockistAddressOk(otherAddress)) {
badStockistAddress = true;
}
});
if (badStockist) {
fail('Other stockist name and address can contain letters, numbers and spaces only.');
if (badStockistName) {
fail('Other stockist name can contain letters, numbers and spaces only.');
return;
}
if (badStockistAddress) {
fail('Other stockist address can contain letters, numbers, spaces and symbols such as comma, period, hyphen, slash, hash, ampersand, parentheses and apostrophe.');
return;
}
if (!therapiesFilled('#chemist-fields')) {

View File

@ -85,7 +85,6 @@
<tr>
<th>Action</th>
<th>Chemist Name</th>
<th>Speciality</th>
<th>MSL Code</th>
</tr>
</thead>
@ -428,24 +427,27 @@
var child = document.createElement('tr');
child.className = 'pob-child';
child.setAttribute('data-open', 'yes');
child.innerHTML = '<td colspan="4">Loading...</td>';
var colSpan = row.closest('table') && row.closest('table').id === 'chemist-table' ? 3 : 4;
child.innerHTML = '<td colspan="' + colSpan + '">Loading...</td>';
row.after(child);
$.getJSON('/form/pobhistory', { form_id: formId, contact_id: contactId }, function (data) {
var submissions = (data && data.submissions) || [];
var orderRows = submissions.map(function (submission) {
var info = submission.formdata || {};
var open = info.submission_status === 'Order Taken' || info.submission_status === 'Rejected';
var button = open
? '<button type="button" class="btn btn-warning btn-xs edit-order me-1" data-submission="' + esc(JSON.stringify(submission)) + '">Edit</button>'
+ '<button type="button" class="btn btn-warning btn-xs upload-invoice" data-submission="' + esc(JSON.stringify(submission)) + '">Upload Invoice</button>'
: '';
var payload = esc(JSON.stringify(submission));
var button = '';
if (info.supply_status === 'No' && info.submission_status === 'Order Taken') {
button = '<button type="button" class="btn btn-warning btn-xs edit-order" data-submission="' + payload + '">Edit</button>';
} else if (info.supply_status === 'Yes' && info.submission_status === 'Rejected') {
button = '<button type="button" class="btn btn-warning btn-xs upload-invoice" data-submission="' + payload + '">Upload Invoice</button>';
}
return '<tr><td>' + button + '</td><td>' + esc(info.record_date || '') + '</td><td>' + esc(info.submission_status || '') + '</td><td>' + esc(info.total_pob_value || '') + '</td><td>' + esc(info.total_actual_pob_value || '') + '</td></tr>';
}).join('');
child.innerHTML = '<td colspan="4" class="p-0"><div class="table-responsive"><table class="table table-sm mb-0 pob-orders"><thead class="table-light"><tr><th>Action</th><th>Date</th><th>Status</th><th>Total Value</th><th>Actual Total</th></tr></thead><tbody>'
child.innerHTML = '<td colspan="' + colSpan + '" class="p-0"><div class="table-responsive"><table class="table table-sm mb-0 pob-orders"><thead class="table-light"><tr><th>Action</th><th>Date</th><th>Status</th><th>Total Value</th><th>Actual Total</th></tr></thead><tbody>'
+ (orderRows || '<tr><td colspan="5" class="text-muted">No orders yet.</td></tr>')
+ '</tbody></table></div></td>';
}).fail(function () {
child.innerHTML = '<td colspan="4" class="text-danger">Could not load orders.</td>';
child.innerHTML = '<td colspan="' + colSpan + '" class="text-danger">Could not load orders.</td>';
});
}
@ -453,8 +455,9 @@
var body = document.querySelector('#' + tableId + ' tbody');
var rows = contacts[type] || [];
body.innerHTML = '';
var chemist = type === 'ebt_chemist';
if (!rows.length) {
body.innerHTML = '<tr><td colspan="4" class="text-muted">No ' + (type === 'ebt_doctor' ? 'doctors' : 'chemists') + ' yet.</td></tr>';
body.innerHTML = '<tr><td colspan="' + (chemist ? 3 : 4) + '" class="text-muted">No ' + (chemist ? 'chemists' : 'doctors') + ' yet.</td></tr>';
return;
}
rows.forEach(function (item) {
@ -463,7 +466,7 @@
tr.setAttribute('data-contact', item.value);
tr.innerHTML = '<td><button type="button" class="btn btn-info btn-xs report-btn">Report</button></td>'
+ '<td class="pob-toggle"><i class="mdi mdi-arrow-down-drop-circle"></i> ' + esc(item.display || contact.name || '') + '</td>'
+ '<td>' + esc(contact.speciality || '') + '</td>'
+ (chemist ? '' : '<td>' + esc(contact.speciality || '') + '</td>')
+ '<td>' + esc(contact.msl_code || '') + '</td>';
tr.querySelector('.report-btn').addEventListener('click', function () {
showReport(type, item.value);

View File

@ -1,5 +1,5 @@
@php
$chemistTypes = ['Attached','Floating','Semi','Chain Pharmacy'];
$chemistTypes = ['Attached','Floating','Semi','Semi/Sub-Stockists','Chain Pharmacy'];
$products = ['Asthalin Inhaler' => 'asthalin_inhaler','Asthalin Rotacap' => 'asthalin_rotacap','Aerocort Inhaler' => 'aerocort_inhaler','Aerocort Rotacap' => 'aerocort_rotacap','Aerocort Forte Rotacap' => 'aerocort_forte_rotacap'];
$therapies = [
'Nebulization No. of Respules per Month (all included)' => 'neb_respules',
@ -8,7 +8,7 @@ $therapies = [
'Asthalin Syrup No. of Units per Month' => 'asthalin_syrup_units',
'Levolin Syrup No. of Units per Month' => 'levolin_syrup_units',
'Deriphyllin No. of Units per Month' => 'deriphyllin_units',
'Beclomethasone Tablet No. of Units per Month' => 'beclomethasone_units',
'Betnesol Tablet No. of Units per Month' => 'beclomethasone_units',
'Methylprednisolone Tablet No. of Units per Month' => 'methylprednisolone_units',
'Prednisolone Tablet No. of Units per Month' => 'prednisolone_units',
'Cough Syrups No. of Units per Month' => 'cough_syrups_units',

View File

@ -1,6 +1,6 @@
@php
$degrees = ['B. Pharm','D. Pharm','M.B.B.S.','M.D.','B.A.M.S.','B.U.M.S.','B.H.M.S.','D.A.M.S.','D.H.M.S.','B.M.S.','D.M.S.','B.E.M.S.','R.M.P.','B.I.A.M.','D.I.A.M.','C.M.S.','C.M.S. & E.D.','C.C.M.P.','G.A.M.S.','B.P.T.','B.S.C.','Other'];
$specialties = ['G.P (General Physician)','R.M.P (Registered Medical Practitioner)','C.P (Consulting Physician)','Child Specialist','Pediatrician','Family Physician','Multi Speciality','Gynecologist','Urologist','Physiotherapy','Other'];
$specialties = ['G.P (General Physician)','R.M.P (Registered Medical Practitioner)','C.P (Consulting Physician)','Child Specialist','Pediatrician','Family Physician','Multi Speciality','Gynecologist','Urologist','Physiotherapy','D.C.H.','Other'];
$bands = ['0 to 10','10 to 20','20 to 30','30 to 40','40 to 50','More than 50'];
$doctorTypes = ['Standalone Clinic','Nursing Home','Hospital','Dispensing Doctors (Doctor with Self Purchase)'];
$products = ['Asthalin Inhaler' => 'asthalin_inhaler','Asthalin Rotacap' => 'asthalin_rotacap','Aerocort Inhaler' => 'aerocort_inhaler','Aerocort Rotacap' => 'aerocort_rotacap','Aerocort Forte Rotacap' => 'aerocort_forte_rotacap'];
@ -62,7 +62,7 @@ $products = ['Asthalin Inhaler' => 'asthalin_inhaler','Asthalin Rotacap' => 'ast
'Asthalin Syrup No. of Units per Month' => 'asthalin_syrup_units',
'Levolin Syrup No. of Units per Month' => 'levolin_syrup_units',
'Deriphyllin No. of Units per Month' => 'deriphyllin_units',
'Beclomethasone Tablet No. of Units per Month' => 'beclomethasone_units',
'Betnesol Tablet No. of Units per Month' => 'beclomethasone_units',
'Methylprednisolone Tablet No. of Units per Month' => 'methylprednisolone_units',
'Prednisolone Tablet No. of Units per Month' => 'prednisolone_units',
'Cough Syrups No. of Units per Month' => 'cough_syrups_units',