feat(hms): add Document Type selection dropdown to HMS Desktop Scan Upload Modal and save document_type with badges

This commit is contained in:
DevSoftTech Server 2026-08-29 04:45:28 +05:30
parent 888b4039f6
commit 2d68a19584
3 changed files with 27 additions and 3 deletions

View File

@ -6364,6 +6364,11 @@ class Opd extends BaseController
$scanType = $this->detectScanType((string) $filename);
$docType = trim((string) ($this->request->getPost('document_type') ?? 'Paper Document'));
if (empty($docType)) {
$docType = 'Paper Document';
}
if ($insertId > 0 && $this->db->tableExists('file_upload_data')) {
$fields = $this->db->getFieldNames('file_upload_data');
$update = [];
@ -6371,7 +6376,7 @@ class Opd extends BaseController
$update['scan_type'] = $scanType;
}
if (in_array('document_type', $fields, true)) {
$update['document_type'] = '';
$update['document_type'] = $docType;
}
if (in_array('content_description', $fields, true)) {
$update['content_description'] = 'Queued for AI analysis';

View File

@ -25,8 +25,9 @@
</div>
<div class="d-flex justify-content-between align-items-center mt-2" style="position:relative;z-index:3;">
<div class="small text-muted">
Uploaded: <?= esc($item['insert_date'] ?? '') ?>
<div class="small">
<span class="badge bg-primary me-2"><i class="bi bi-file-earmark-medical me-1"></i><?= esc(!empty($item['document_type']) ? $item['document_type'] : 'Scanned Document') ?></span>
<span class="text-muted">Uploaded: <?= esc($item['insert_date'] ?? '') ?></span>
</div>
<?php if ((int) ($item['can_delete_limited'] ?? $item['can_delete_today'] ?? 0) === 1) : ?>
<button

View File

@ -22,6 +22,19 @@
<div id="opd_scan_resolution" class="small text-muted mt-1">Camera: detecting resolution...</div>
<canvas id="opd_scan_canvas" style="display:none;"></canvas>
<input type="hidden" id="opd_scan_opdid" value="<?= esc((int) ($opdid ?? 0)) ?>">
<div class="mt-2 mb-2 bg-light p-2 rounded border">
<label for="opd_scan_document_type" class="form-label mb-1 small fw-bold text-dark">
<i class="bi bi-folder2-open text-primary me-1"></i> Document Type
</label>
<select id="opd_scan_document_type" class="form-select form-select-sm border-primary-subtle">
<option value="Paper Document">Paper Document (General)</option>
<option value="Vitals Sheet">Vitals Sheet / Chart</option>
<option value="Lab Test Report">Lab / Pathology Report</option>
<option value="Handwritten Doctor Note">Handwritten Doctor Note</option>
<option value="Signed Consent Form">Signed Consent Form</option>
</select>
</div>
<div class="mt-2 d-flex gap-2">
<button type="button" id="opd_scan_capture_btn" class="btn btn-warning btn-sm">Capture</button>
<button type="button" id="opd_scan_stop_btn" class="btn btn-outline-secondary btn-sm">Stop</button>
@ -572,6 +585,11 @@
function submitScanFormData(formData) {
// Common upload handler used by both camera capture and file upload.
var docType = $('#opd_scan_document_type').val() || 'Paper Document';
if (formData && !formData.has('document_type')) {
formData.append('document_type', docType);
}
$.ajax({
url: '<?= base_url('Opd/save_image') ?>/' + opdid,
type: 'POST',