diff --git a/app/Views/billing/opd_prescription_basic.php b/app/Views/billing/opd_prescription_basic.php
index 87b71b1..b377baf 100644
--- a/app/Views/billing/opd_prescription_basic.php
+++ b/app/Views/billing/opd_prescription_basic.php
@@ -4825,13 +4825,18 @@
// # column
$tr.append($('
').text(idx + 1));
- // Complaint name — SNOMED = blue, local = default
- var $nameTd = $(' | ');
- var nameStyle = isSnomed ? 'color:#0d6efd;font-weight:600;max-width:210px' : 'max-width:210px';
- var $nameDiv = $(' ').text(item.term);
- if (item.concept_id) { $nameDiv.attr('title', 'SNOMED: ' + item.concept_id); }
- $nameTd.append($nameDiv);
- $tr.append($nameTd);
+ // Complaint name — editable input (SNOMED = blue, local = default)
+ var nameStyle = isSnomed ? 'color:#0d6efd;font-weight:600;' : '';
+ var titleText = item.concept_id ? 'SNOMED: ' + item.concept_id : '';
+ $tr.append(
+ $(' | ').append(
+ $('')
+ .val(item.term || '')
+ .attr('data-idx', idx)
+ .attr('title', titleText)
+ .css(nameStyle)
+ )
+ );
// Frequency input
$tr.append(
@@ -4958,6 +4963,30 @@
.on('click', function() { onSelect(text); });
}
+ // ─── Complaint Name: event delegation for editing complaint text ──────────
+ $(document).on('input', '.complaint-name-input', function() {
+ var idx = parseInt($(this).attr('data-idx'), 10);
+ if (idx >= 0 && idx < selectedComplaintItems.length) {
+ selectedComplaintItems[idx].term = ($(this).val() || '').trim();
+ syncComplaintSnomedJson();
+ }
+ });
+ $(document).on('blur', '.complaint-name-input', function() {
+ var idx = parseInt($(this).attr('data-idx'), 10);
+ if (idx >= 0 && idx < selectedComplaintItems.length) {
+ selectedComplaintItems[idx].term = ($(this).val() || '').trim();
+ syncComplaintSnomedJson();
+ markDirty('Complaint name updated');
+ }
+ });
+ $(document).on('keydown', '.complaint-name-input', function(e) {
+ if (e.key === 'Enter') {
+ e.preventDefault();
+ // Move to frequency input in same row
+ $(this).closest('tr').find('.complaint-freq-input').trigger('focus');
+ }
+ });
+
// ─── Frequency: event delegation on table rows ────────────────────
var _FREQUENCY_OPTIONS = ['daily', 'twice daily', 'weekly', 'intermittent', 'continuous', 'occasional'];
|