diff --git a/app/Views/billing/ipd/discharge_create.php b/app/Views/billing/ipd/discharge_create.php index 6cc8cfb..1c241c7 100644 --- a/app/Views/billing/ipd/discharge_create.php +++ b/app/Views/billing/ipd/discharge_create.php @@ -3569,6 +3569,40 @@ $allergyStatusNoKnown = in_array($allergyStatusNormalized, ['no known drug aller } section.dataset.toolsBound = '1'; + // Re-initialize CKEditor for instruction fields after section reload + if (typeof CKEDITOR !== 'undefined') { + // Destroy existing instances first to avoid duplication + if (CKEDITOR.instances['instruction_other']) { + CKEDITOR.instances['instruction_other'].destroy(true); + } + if (CKEDITOR.instances['instruction_remark']) { + CKEDITOR.instances['instruction_remark'].destroy(true); + } + + // Re-create CKEditor instances + if (document.getElementById('instruction_other')) { + CKEDITOR.replace('instruction_other', { + height: 120, + toolbar: [ + { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline'] }, + { name: 'paragraph', items: ['NumberedList', 'BulletedList'] }, + { name: 'editing', items: ['Undo', 'Redo'] } + ] + }); + } + + if (document.getElementById('instruction_remark')) { + CKEDITOR.replace('instruction_remark', { + height: 150, + toolbar: [ + { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline'] }, + { name: 'paragraph', items: ['NumberedList', 'BulletedList'] }, + { name: 'editing', items: ['Undo', 'Redo'] } + ] + }); + } + } + var addSelectedBtn = section.querySelector('#btn_instruction_add_selected_food'); var clearBtn = section.querySelector('#btn_instruction_clear_food'); var remark = section.querySelector('#instruction_remark'); diff --git a/check_instruction_data.php b/check_instruction_data.php new file mode 100644 index 0000000..337e588 --- /dev/null +++ b/check_instruction_data.php @@ -0,0 +1,22 @@ +initialize(); + +$db = \Config\Database::connect(); +$row = $db->table('ipd_discharge_instructions')->where('ipd_id', 1007141)->get()->getRowArray(); + +if ($row) { + echo "=== IPD 1007141 - ipd_discharge_instructions ===" . PHP_EOL . PHP_EOL; + echo "comp_report (contains other_text JSON): " . PHP_EOL; + echo substr($row['comp_report'] ?? '', 0, 300) . PHP_EOL . PHP_EOL; + echo "comp_remark (Discharge Summary field): " . PHP_EOL; + echo substr($row['comp_remark'] ?? '', 0, 300) . PHP_EOL; +} else { + echo "No record found for IPD 1007141" . PHP_EOL; +}