101 lines
5.1 KiB
Markdown
101 lines
5.1 KiB
Markdown
# Dev Log — 2026-03-27
|
|
|
|
## Non-EB Claims Module — Session 4
|
|
|
|
---
|
|
|
|
### 1. Edit Page: Policy & Account Details — Read-Only (Section 1 & 2)
|
|
|
|
- Replaced all dropdowns (Client, Branch, Policy, ACM) in Section 1 with readonly text inputs showing stored values
|
|
- Added hidden form inputs for `branch_id` and `acm_id` to ensure values are submitted on update
|
|
- Removed all AJAX-based client/branch/policy population JS (appendBranches, appendPolicies, resetBranch, resetPolicy, resetContact, formatDate, existingBranchId, existingPolicyId, client_select/branch_id/client_policy_id change handlers)
|
|
- Removed client/branch/ACM/contact validation from `validateNonEbForm()` since sections are non-editable
|
|
- Made Section 2 (Insured Contact Details) fully readonly — all 3 inputs get `readonly` + `readonly-color` class
|
|
|
|
**Model:** Added `branch_name` to `getTicketDataByTicketID` select + `JOIN client_branch cb` so branch name is available in `$td`
|
|
|
|
---
|
|
|
|
### 2. Remove policy_section & policy_period
|
|
|
|
- Removed from `non_eb_claim_edit.php` Section 1 (already done previous session)
|
|
- Removed `tm.policy_section`, `tm.policy_period` from `claimSearch()` select in controller
|
|
- Removed both validation rules from `getValidationRules()`
|
|
- Removed from `NonEbTicketMasterModel` allowedFields
|
|
- Removed hidden `<th>` and `<td>` columns from `non_eb_claim_list.php`
|
|
- Added commented-out DROP COLUMN statements to `db.md` for future cleanup
|
|
|
|
---
|
|
|
|
### 3. Policy Start Date & Policy Expiry Date
|
|
|
|
- Added `policy_start_date VARCHAR(20)` and `policy_end_date VARCHAR(20)` to `non_eb_ticket_master` (ALTER TABLE in `db.md`)
|
|
- Added both fields to `NonEbTicketMasterModel` allowedFields
|
|
- Edit page: populated readonly inputs with `$td['policy_start_date']` and `$td['policy_end_date']`
|
|
- Added PHP formatting at top of edit view — if stored value is `YYYY-MM-DD`, converts to `DD-MM-YYYY` for display
|
|
|
|
---
|
|
|
|
### 4. After Successful Update — Redirect to List
|
|
|
|
- Changed `location.reload()` in `submitNonEbClaim()` AJAX success handler to `setTimeout(() => window.location.href = base_url + 'non-eb-claim/list', 800)` — 800ms delay so toast is visible
|
|
|
|
---
|
|
|
|
### 5. Claim Files Tab (new) — Edit Page
|
|
|
|
**DB changes:**
|
|
- `claim_files`: added `ticket_type TINYINT(1) DEFAULT 1` (1=EB, 2=Non-EB) — existing EB records unaffected
|
|
- `non_eb_ticket_master`: added `required_docs TEXT` for IR Documents checklist JSON
|
|
|
|
**Model changes:**
|
|
- `ClaimFilesModel`: added `ticket_type` to allowedFields
|
|
- `NonEbTicketMasterModel`: added `required_docs` to allowedFields
|
|
|
|
**Controller — 4 new methods in `NonEbClaimController`:**
|
|
- `uploadFile()` — URL or file upload into `claim_files` with `ticket_type=2`
|
|
- `getClaimFiles()` — fetch files for ticket filtered by `ticket_type=2`
|
|
- `removeFile()` — soft delete (`is_active=0`) by file id
|
|
- `saveIRDocs()` — save IR Documents JSON to `non_eb_ticket_master.required_docs`
|
|
|
|
**Routes — 4 new routes added to `/non-eb-claim` group:**
|
|
```
|
|
POST non-eb-claim/uploadFile
|
|
POST non-eb-claim/getClaimFiles
|
|
GET non-eb-claim/removeFile
|
|
POST non-eb-claim/saveIRDocs
|
|
```
|
|
|
|
**Edit view:**
|
|
- Added "Claim Files" tab to nav tabs
|
|
- Tab content includes: IR Documents checklist (with freeze toggle + save), file upload form (URL/file toggle), file list table, edit URL modal
|
|
- Full JS: `nonebLoadClaimFiles`, `nonebCreateFileList`, `nonebAddHTMLInput`, `nonebAddFileUploadHtml`, `nonebToggleUploadType`, IR docs CRUD (`nonebLoadConfiguration`, `nonebRenderDocumentList`, `nonebCreateDocumentRow`, `nonebAddDocument`, `nonebRemoveDocument`, `nonebSaveIRDocs`, `nonebToggleActionFreeze`)
|
|
- Reuses `downloadClaimFile` global route for file downloads
|
|
|
|
**Section 8 (Documents & Attachments):**
|
|
- Commented out in both `non_eb_claim_form.php` and `non_eb_claim_edit.php` (code preserved, not deleted)
|
|
|
|
---
|
|
|
|
### 6. Trigger — `non_eb_ticket_master_after_update`
|
|
|
|
- Written and added to `db.md` Section 6
|
|
- Tracks 22 fields into `ticket_history` on every UPDATE
|
|
- TEXT fields (`loss_description`, `lor`, `surveyor_remarks`, `closure_remark`) truncated to 500 chars in history
|
|
- Skipped set-once/bulk fields: `client_id`, `branch_id`, `insurer_id`, `client_policy_id`, `insured_contact_*`, `google_drive_links`, `documents_*`, `asset_file`, `required_docs`
|
|
|
|
---
|
|
|
|
### Files Modified Today
|
|
|
|
| File | Changes |
|
|
|---|---|
|
|
| `app/Models/NonEbTicketMasterModel.php` | Added branch_name join, policy_start/end_date, required_docs to allowedFields; removed policy_section/period |
|
|
| `app/Models/ClaimFilesModel.php` | Added ticket_type to allowedFields |
|
|
| `app/Controllers/NonEbClaimController.php` | Removed policy_section/period from query & validation; added ClaimFilesModel; added 4 new Claim Files methods |
|
|
| `app/Config/Routes.php` | Added 4 non-eb-claim routes |
|
|
| `app/Views/non_eb_claim_edit.php` | Section 1 & 2 read-only; date formatting; Section 8 commented out; Claim Files tab added; redirect on update |
|
|
| `app/Views/non_eb_claim_form.php` | Section 8 commented out |
|
|
| `app/Views/non_eb_claim_list.php` | Removed policy_section/period hidden columns |
|
|
| `db.md` | ALTER TABLEs for policy dates, required_docs, ticket_type; trigger added as Section 6 |
|