').text(item.term));
+ var nameStyle = isSnomed ? 'color:#0d6efd;font-weight:600;max-width:260px' : 'max-width:260px';
+ var $nameDiv = $('
').text(item.term);
+ if (item.concept_id) { $nameDiv.attr('title', 'SNOMED/ICD: ' + item.concept_id); }
+ $nameTd.append($nameDiv);
$tr.append($nameTd);
- // SNOMED code
- var codeText = item.concept_id || '';
- var $codeTd = $('
');
- if (codeText) {
- $codeTd.append(
- $('').text(codeText)
- );
- } else {
- $codeTd.append($('').text('—'));
- }
- $tr.append($codeTd);
-
// Duration input
$tr.append(
$(' | ').append(
- $('')
+ $('')
.val(item.duration || '').attr('data-idx', idx)
)
);
@@ -5367,7 +5349,8 @@
syncDiagnosisJson();
}
$dd.hide().empty();
- $inp.closest('tr').find('.diag-date-input').trigger('focus');
+ // Done with this row — move to lookup for next diagnosis
+ $('#diagnosis_lookup').val('').trigger('focus');
}));
});
_positionDd($dd, $inp);
@@ -5394,14 +5377,14 @@
if (e.key === 'Enter') {
e.preventDefault();
if ($dd.is(':visible') && _diagDurDdIdx >= 0) { $items.eq(_diagDurDdIdx).trigger('click'); }
- else { $(this).closest('tr').find('.diag-date-input').trigger('focus'); }
+ else { $('#diagnosis_lookup').val('').trigger('focus'); }
_diagDurDdIdx = -1;
}
if (e.key === 'Escape') { $dd.hide(); _diagDurDdIdx = -1; }
});
- // Date blur: save date value
- $(document).on('change blur', '.diag-date-input', function() {
+ // Date change: save and move to lookup
+ $(document).on('change', '.diag-date-input', function() {
var idx = parseInt($(this).attr('data-idx'), 10);
if (idx >= 0 && idx < selectedDiagnosisItems.length) {
selectedDiagnosisItems[idx].date = ($(this).val() || '').trim();
@@ -5409,11 +5392,18 @@
markDirty('Diagnosis detail updated');
}
});
+ $(document).on('blur', '.diag-date-input', function() {
+ var idx = parseInt($(this).attr('data-idx'), 10);
+ if (idx >= 0 && idx < selectedDiagnosisItems.length) {
+ selectedDiagnosisItems[idx].date = ($(this).val() || '').trim();
+ syncDiagnosisJson();
+ }
+ });
// Remove diagnosis row
$(document).on('click', '.btn-remove-diagnosis', function() {
- var idx = parseInt($(this).data('idx') || '-1', 10);
- if (idx < 0 || idx >= selectedDiagnosisItems.length) return;
+ var idx = parseInt($(this).attr('data-idx'), 10);
+ if (isNaN(idx) || idx < 0 || idx >= selectedDiagnosisItems.length) return;
selectedDiagnosisItems.splice(idx, 1);
renderDiagnosisTable();
markDirty('Diagnosis removed');
@@ -5497,7 +5487,7 @@
// Hide diagnosis dur dd on outside click
// Close diagnosis dropdown when clicking outside the search area
$(document).on('click', function(e) {
- if (!$(e.target).closest('#rx_sec_diagnosis .position-relative, #diagnosis_dropdown').length) {
+ if (!$(e.target).closest('#rx_sec_diagnosis tfoot, #diagnosis_dropdown').length) {
var $dd = $('#diagnosis_dropdown');
if ($dd.is(':visible')) {
$dd.closest('.rx-foldable').removeClass('dropdown-open');
|