devsofttech_hms_ci4/app/Views/billing/ipd
DevSoftTech Server fd70cc46cf Change medicine save to auto-save on Add button click (AJAX)
Medicine Save Behavior Change:
- Previously: Medicines added to table locally, saved on 'Save Discharge Advice' click
- Now: AJAX auto-save immediately when '+ADD / Update' button is clicked
- Matches OPD Consult Form workflow (instant save on add)

Implementation:
- Modified btn_discharge_med_add click handler to make AJAX POST
- POST parameters: action='add_drug', ajax_mode='json', new_drug_name, new_drug_type,
  new_drug_dose, new_drug_when, new_drug_freq, new_drug_day, new_drug_qty, new_drug_remark
- Controller add_drug action already existed - now returns JSON when ajax_mode='json'
- On success: adds row to table, clears form, shows 'Medicine saved successfully'
- On failure: shows error message from server
- CSRF token updated after each AJAX call

Remove Button Behavior:
- Remove button now shows confirmation dialog
- Warns user: 'This will only remove from current view. Reload to see saved medicines.'
- Note: Remove action is NOT yet AJAX - full page reload shows actual DB state
- Future enhancement: make Remove button also AJAX (action='remove_drug')

Technical Notes:
- Kept discharge_medicine_json serialization as backup (unused now, but harmless)
- Medicine data: med_id=0 marks client-added medicines
- Success check: data.update === 1
- Error handling: network timeout 30s, shows xhr.status on fail
- Form fields cleared after successful save
- Focus returns to medicine name field for next entry

User Benefits:
- Instant feedback - no need to scroll down and click 'Save Discharge Advice'
- Medicines immediately persisted to database
- Can add multiple medicines in quick succession
- Consistent with OPD prescription workflow
- Reduced risk of data loss (saves immediately vs. waiting for form submit)
2026-06-06 21:00:30 +05:30
..
ayushman_claim_sheet.php Add Ayushman package import, billing claim sheet, and reporting dashboards 2026-03-26 15:42:40 +05:30
bill_print.php fix: correct IPD balance display when computed balance is zero 2026-04-10 21:07:01 +05:30
cash_balance_table.php Implement OPD template builder, doctor template selection, and OPD print integration fixes 2026-02-27 19:44:36 +05:30
cash_balance.php IPD cash balance: fix date range picker submission and parser 2026-04-03 14:13:05 +05:30
current_admission.php Implement OPD template builder, doctor template selection, and OPD print integration fixes 2026-02-27 19:44:36 +05:30
dashboard.php Implement OPD template builder, doctor template selection, and OPD print integration fixes 2026-02-27 19:44:36 +05:30
discharge_create.php Change medicine save to auto-save on Add button click (AJAX) 2026-06-06 21:00:30 +05:30
discharge_preview.php Make discharge preview top panel sticky and add action buttons 2026-06-06 04:46:17 +05:30
discharge_print.php Add report panel updates and related billing/discharge enhancements 2026-03-10 02:43:35 +05:30
invoice_list.php Implement IPD admission/discharge editing, bill PDF modes, and invoice list view action 2026-03-21 15:47:18 +05:30
ipd_form_print.php Port CI3 vitals chart and treatment chart forms to CI4 IPD form print (form_no 6 and 7) 2026-04-09 04:26:09 +05:30
ipd_model_payment_box.php refactor: set number input step to 1 across views 2026-04-10 21:16:25 +05:30
ipd_panel_deduction_payment.php refactor: set number input step to 1 across views 2026-04-10 21:16:25 +05:30
ipd_panel_tpa_payment.php refactor: set number input step to 1 across views 2026-04-10 21:16:25 +05:30
ipd_payment_receipt_pdf.php IPD payment receipt: fix modal loader, add PDF print route, and bank mode details 2026-04-03 13:29:03 +05:30
ipd_payment_receipt_print.php IPD payment receipt: fix modal loader, add PDF print route, and bank mode details 2026-04-03 13:29:03 +05:30
legacy_registration.php Fix legacy billing prints and pathology template compatibility 2026-03-21 02:23:31 +05:30
nursing_chart_print.php Add nursing scan-to-structured workflow and discharge UI polish 2026-03-09 00:12:04 +05:30
panel_admission.php Implement IPD admission/discharge editing, bill PDF modes, and invoice list view action 2026-03-21 15:47:18 +05:30
panel_bed_assign.php Implement OPD template builder, doctor template selection, and OPD print integration fixes 2026-02-27 19:44:36 +05:30
panel_bill_details.php fix: correct IPD balance display when computed balance is zero 2026-04-10 21:07:01 +05:30
panel_diagnosis.php Add Ayushman package import, billing claim sheet, and reporting dashboards 2026-03-26 15:42:40 +05:30
panel_discharge.php refactor: set number input step to 1 across views 2026-04-10 21:16:25 +05:30
panel_documents.php Make IPD forms dynamic and stop stale OPD refresh polling 2026-04-08 11:41:33 +05:30
panel_ipd_charges.php feat(ipd-charges): group delete, sort order, Up/Down buttons, foldable billing panels 2026-04-18 06:56:38 +05:30
panel_medical_bills.php Implement OPD template builder, doctor template selection, and OPD print integration fixes 2026-02-27 19:44:36 +05:30
panel_package.php billing: add ABHA create/verify tab in patient billing view and update IPD panel package; add hospital logo image 2026-05-08 10:48:43 +05:30
panel_payments.php IPD payment receipt: fix modal loader, add PDF print route, and bank mode details 2026-04-03 13:29:03 +05:30
panel_placeholder.php Implement OPD template builder, doctor template selection, and OPD print integration fixes 2026-02-27 19:44:36 +05:30
panel.php Restore legacy HMS flows and add IPD document master templates 2026-03-24 04:24:19 +05:30