```
### Section-Specific HTML Changes
| Section | ID Mapping | Key Field Changes |
|---|---|---|
| 1. Policy & Account | accordion1 / collapseOne | Added Policy Start Date & Expiry Date fields (readonly, `readonly-color`). Insurer field gets `readonly-color`. Policy No gets `readonly-color`. All labels get `label-font-size`. |
| 2. Insured Contact | accordion2 / collapseTwo | Added `id` attrs on inputs. Added `minlength="3"`, `pattern` on contact name. Added `minlength="10" maxlength="15" pattern="^[0-9]+$"` on contact number. Added `invalid-feedback` divs. |
| 3. Loss / Incident | accordion3 / collapseThree | Added `id` attrs, `minlength="3"` on nature_of_loss, `min="0"` on loss_estimate. Added `invalid-feedback` divs. Date placeholder changed to `dd-mm-yyyy`. |
| 4. Intimation & Ref | accordion4 / collapseFour | Added `id` attrs, `maxlength="100"` on nhance_claim_ref_no, `pattern` on claim_number. Added `invalid-feedback` divs. Date placeholder `dd-mm-yyyy`. |
| 5. Status & Tracking | accordion5 / collapseFive | Labels get `label-font-size`. |
| 6. Asset Details | accordion6 / collapseSix | Labels get `label-font-size`. |
| 7. Surveyor Details | section_surveyor / collapseSeven | Added `minlength="10" maxlength="15" pattern="^[0-9]+$"` on contact number. Added `invalid-feedback` divs on contact number and email. `maxlength="255"` on name/contact person. |
| 8. Documents | accordion8 / collapseEight | Labels get `label-font-size`. Date placeholder `dd-mm-yyyy`. |
| 9. Settlement | section_settlement / collapseNine | Added `min="0"` on numeric fields, `maxlength="100"` on UTR. Added `invalid-feedback` divs. |
### Form Tag Changes
- Added `onsubmit="return false;"` to prevent native submit
### C. JavaScript Changes
| Change | Details |
|---|---|
| Removed `toggleAccordion()` | No longer needed — Bootstrap collapse handles it |
| Added `validateNonEbForm()` | Full JS validation matching create form — all 16+ field rules |
| Added `clearValidation()` | Removes `.is-invalid` / `.is-invalid-select2` |
| Added `setInvalid()` | Marks field invalid with message |
| Added `formatDate()` | Handles MySQL YYYY-MM-DD to dd-mm-yyyy conversion |
| Added `resetContact()` | Clears insured contact fields |
| Added `noneb_contact_list` | Stores contact data from AJAX |
| Branch change handler | Added contact auto-fill from `noneb_contact_list` |
| `appendPolicies()` | Added `data-policy-type`, `data-start-date`, `data-end-date` attrs |
| Policy change handler | Added date auto-fill (policy start/end date) with YYYY-MM-DD → dd-mm-yyyy |
| `resetPolicy()` | Added clearing of policy start/end date fields |
| `submitNonEbClaim()` | Now calls `validateNonEbForm()` before AJAX |
| Real-time validation clearing | `input`/`change` on `.form-control` removes `.is-invalid`. `change` on `select` removes `.is-invalid-select2`. Asset file change clears error. |
| flatpickr dateFormat | Changed from `d/m/Y` to `d-m-Y` to match create form |
---
## Files Modified (Updated)
| File | Changes |
|---|---|
| `app/Views/non_eb_claim_form.php` | Full UI restyle, validation, asset file upload (session 1) |
| `app/Views/non_eb_claim_edit.php` | Full UI restyle sync, validation, contact auto-fill, date fields (session 2) |
| `app/Controllers/NonEbClaimController.php` | `asset_file` upload handling in create/update |
| `app/Models/NonEbTicketMasterModel.php` | Added `asset_file`, `branch_id` to allowedFields |
| `app/Config/Constants.php` | Added `UPLOAD_EXT_ASSET_FILES` |
| `db.md` | Added `branch_id`, `asset_file` columns + ALTER TABLE queries |
---
## 6. Edit View (`non_eb_claim_edit.php`) — Full Sync with Create Form (Session 3)
### Objective
Complete remaining sections (3–9) and all JS that were still using the old accordion pattern. This session fully brings `non_eb_claim_edit.php` in parity with `non_eb_claim_form.php`.
---
### A. HTML — Sections 3–9 Converted to Bootstrap Card/Collapse
| Section | Old | New |
|---|---|---|
| 3. Loss / Incident Details | `
` + `onclick="toggleAccordion(this)"` | `
` + Bootstrap card/collapse (`collapseThree`) |
| 4. Intimation & Claim Reference | Same old pattern | `
` (`collapseFour`) |
| 5. Status & Tracking | Same old pattern | `
` (`collapseFive`) |
| 6. Asset Details | Same old pattern | `
` (`collapseSix`) |
| 7. Surveyor Details | `
` | `
` + inner Bootstrap card/collapse (`collapseSeven`) |
| 8. Documents & Attachments | Same old pattern | `
` (`collapseEight`) |
| 9. Settlement Details | `
` | `
` + inner Bootstrap card/collapse (`collapseNine`) |
### Section-Specific Field Changes
| Section | Field Changes |
|---|---|
| 3. Loss / Incident | Added `id` attrs on all inputs. Added `minlength="3"` on `nature_of_loss`. Added `min="0"` on `loss_estimate`. Added `invalid-feedback` divs. Date placeholder `dd/mm/yyyy` → `dd-mm-yyyy`. All labels get `label-font-size`. |
| 4. Intimation | Added `id` attrs. Added `maxlength="100"` on `nhance_claim_ref_no`. Added `pattern="^[a-zA-Z0-9\/_-]+$"` on `claim_number`. Added `invalid-feedback` divs. Date placeholders `dd/mm/yyyy` → `dd-mm-yyyy`. Labels get `label-font-size`. |
| 5. Status & Tracking | Labels get `label-font-size`. |
| 6. Asset Details | Asset row labels get `label-font-size`. Asset file upload label gets `label-font-size`. |
| 7. Surveyor Details | Added `minlength="10" maxlength="15" pattern="^[0-9]+$"` on contact number. Added `maxlength="255"` on name and contact person. Added `invalid-feedback` on contact number and email. Labels get `label-font-size`. |
| 8. Documents | Labels get `label-font-size`. Date placeholder `dd/mm/yyyy` → `dd-mm-yyyy`. |
| 9. Settlement | Added `min="0"` on `loss_assessed_value` and `settled_amount`. Added `maxlength="100"` on `settlement_utr`. Added `invalid-feedback` divs on all three. Labels get `label-font-size`. |
---
### B. JavaScript Changes
| Change | Details |
|---|---|
| Removed `toggleAccordion()` | No longer needed — Bootstrap collapse handles it |
| `appendPolicies()` | Added `data-policy-type`, `data-start-date`, `data-end-date` attrs; also added `insurer_short_name`/`insurer_branch_code` display logic matching create form |
| `resetPolicy()` | Added `$('#policy_start_date').val('')` and `$('#policy_end_date').val('')` |
| Added `noneb_contact_list` | Variable to store contact data keyed by branch |
| Removed `noneb_branch_list` | Was unused; removed |
| Added `resetContact()` | Clears `insured_contact_name`, `insured_contact_number`, `insured_contact_email` |
| Client change handler | Added `resetContact()` call; populates `noneb_contact_list` from `response.contact_data`; added error toastr on failure |
| Branch change handler | Added contact auto-fill from `noneb_contact_list[branch_id]` (name, number, email) |
| Policy change handler | Changed `.data()` to `.attr()` for custom data attributes. Added date auto-fill: reads `data-start-date`/`data-end-date`, converts YYYY-MM-DD → dd-mm-yyyy via inline split, writes to `#policy_start_date`/`#policy_end_date` |
| Added `formatDate()` | Handles both `dd-Mon-yyyy hh:mm` and `YYYY-MM-DD` formats → `dd-mm-yyyy` |
| Added `clearValidation()` | Removes `.is-invalid` and `.is-invalid-select2` from all form elements |
| Added `setInvalid()` | Marks a field invalid with optional custom message |
| Added `validateNonEbForm()` | Full validation matching backend rules — 16+ fields including conditional surveyor/settlement sections and asset row/file check |
| `submitNonEbClaim()` | Added `if (!validateNonEbForm()) return;` before AJAX |
| `flatpickr` dateFormat | Changed from `d/m/Y` to `d-m-Y` |
| Select2 init | Added `$('#client_select').select2()`, `$('#branch_id').select2()`, `$('#client_policy_id').select2()` alongside existing `.select2-init` |
| Real-time validation clearing | `input`/`change` on `.form-control` removes `.is-invalid`; `change` on `select` removes `.is-invalid` and `.is-invalid-select2`; `#asset_file` change hides `#asset_section_error`; asset row input hides `#asset_section_error` |
---
## Files Modified (Session 3)
| File | Changes |
|---|---|
| `app/Views/non_eb_claim_edit.php` | Sections 3–9 HTML converted to Bootstrap card/collapse; full JS sync — validation, contact auto-fill, policy date auto-fill, real-time clearing |