# CHANGELOG

## Version 0.8.0 - Mobile API v1

### Added

- Mobile token authentication.
- Mobile login endpoint.
- Mobile logout endpoint.
- Mobile user profile endpoint.
- Mobile dashboard endpoint.
- Mobile van boxes endpoint.
- Mobile box items endpoint.
- Mobile barcode product lookup endpoint.

### Technical

- Added mobile_tokens table.
- Added MobileToken model.
- Added MobileAuth middleware.
- Added routes/api.php.
- Added API documentation.

### Next

- Connect Flutter login to Laravel API.
- Save token in Flutter secure storage.
- Load dashboard from API.
- Load van boxes from API.

## Version 0.8.2 - Mobile Van Stock API

### Added

- Mobile van stock endpoint.
- Search support for SKU, barcode, name, and category.

## Version 0.8.4 - Van Stock API Improvements

### Fixed

- Removed repeated products in Mobile My Van API by grouping stock rows.
- Added product image URL to van stock API.
- Added van meta data for mobile screen title.

## Version 0.8.6 - Van Stock Quantity Fix

### Fixed

- Mobile My Van now reads only the latest van stock import.
- Prevented old imports from increasing displayed quantities.

## Version 0.8.11 - Mobile Inventory Check API

### Added

- Mobile inventory check current endpoint.
- Mobile inventory check start endpoint.
- Mobile inventory check mark endpoint.
- Mobile inventory check finish endpoint.
- API documentation for inventory check.

## Version 0.9.4 - Shipment Parser Fix

### Fixed

- Shipment parser now supports new WIWU shipment Excel format.
- Supported columns: Item, Barcode 1, Description, Item Category Name, Qty.
- Shipment upload now auto-parses after upload.
- PDF generation now attempts parsing if shipment items are empty.

## Version 0.9.5 - Smart Price Import

### Added

- Smart price import command.
- Auto-detection for SKU, barcode, Van Sales, Wholesale, and RRP price columns.
- Price update from uploaded price list files.

### Behavior

- Current Van Sales is used first.
- If Van Sales is missing, Wholesale is used.
- If Wholesale is missing, RRP is used.

## Version 0.9.6 - Laravel Smart Price Upload

### Added

- Price list upload now smart-parses automatically from Laravel UI.
- Smart parser detects SKU, Barcode, RRP, Wholesale, and Van Sales columns.
- Product prices are updated during parsing.
- Price import items are saved for review in Laravel.

### Behavior

- Current Van Sales is used first.
- If Van Sales is missing, Wholesale is used.
- If Wholesale is missing, RRP is used.
- Matched products are updated immediately after upload.

## Version 0.9.7 - Import Center v1

### Added

- Import Center module.
- Upload file to Import Center.
- Smart file type detection.
- Detection Review step.
- User confirmation before analysis.
- Analyze preview page.
- Import sessions database table.

### Flow

Upload File
→ System Suggestion
→ User Confirms Type
→ Analyze Preview
→ Final Import later

## Version 0.9.8 - Import Center Final Import

### Added

- Import Now button in Import Center preview.
- Import Center can now import confirmed Shipment files.
- Import Center can now import confirmed Price List files.
- Import Center can now import confirmed SOH files.
- Import sessions now update status to imported or failed.

### Pending

- Van Stock import from Import Center needs salesman/van selection.

## Version 0.9.9 - Smart Import Preview

### Added

- Smart preview for shipment files.
- Smart preview for price list files.
- Matched and not matched product status.
- Product photo preview.
- Shipment quantity and estimated value preview.
- Price old/new comparison preview.
- Ignored rows section for total rows.

## Version 0.9.10 - Import Center Van Stock

### Added

- Van Stock support in Import Center.
- Salesman / van selection before analysis.
- Smart Van Stock preview.
- Final Van Stock import from Import Center.
- Auto generated salesman van catalog after import.

### Behavior

- Upload file.
- Confirm as Van Stock.
- Select salesman / van.
- Analyze preview.
- Import Now.

## Version 0.9.11 - Price Sync Without Replacing Main Catalog

### Fixed

- Price List import no longer replaces the Regular Main Catalog.
- Price List import now updates products and existing active catalog item prices.
- Public portal ignores empty active Regular/Clearance catalogs.
- Empty active main catalogs are archived during the repair step.

### Added

- Catalog item price update tracking.
- UPDATED badge on customer catalog items when price was updated.
- Old price tracking for updated catalog items.

## Version 0.9.12 - Permanent Catalog Architecture

### Added

- Permanent catalog fields.
- Permanent Main Catalog.
- Permanent Clearance Catalog.
- Permanent Salesman Van Catalogs.
- Catalog repair command.
- Salesman van quantity badge inside customer catalog.
- Permanent catalog documentation.

### Changed

- Public portal now prefers protected permanent catalogs.
- Price updates no longer create or replace permanent catalogs.

## Version 0.9.13 - Permanent Catalog Safety Lock

### Added

- Safety lock command for permanent catalogs.
- Van Stock imports now reuse the permanent salesman catalog.
- Old non-permanent van stock catalogs are archived safely.
- Permanent catalogs are never archived by Van Stock import.

### Command

php artisan catalogs:safety-lock

<!-- SNYT_CHANGELOG_DOCS_V2_START -->

## Documentation Hub v2 - 2026-08-08

### Added

- Laravel + Flutter combined internal Developer Documentation Hub.
- Synchronized Flutter documentation snapshot support.
- Cross-project search.
- Shared Business Rules page.
- Shared Development Workflow page.
- Shared Architecture Map page.
- Previous / Next page navigation.
- Reading progress indicator.
- Copy buttons for code blocks.
- Responsive documentation layout.

### Changed

- `/docs` is the internal entry point for Laravel and Flutter technical documentation.
- Existing Markdown documentation remains the source of truth.
- Laravel baseline documentation now reflects the current field-sales, mobile, order, inventory, reporting, chat, and operations foundations.
- Approved RMA, stock receiving, invoice pricing, invoice editing, and release automation work is recorded as planned rather than implemented.

### Business Rules Recorded

- Displayed prices include VAT.
- Current intended Cash discount default is 5% and is controlled by Laravel.
- On Account invoices do not receive the automatic Cash discount.
- Clearance products are excluded from the automatic Cash discount.
- RMA stock must never appear as sellable customer-catalog stock.
- Historical invoices preserve their original pricing rules.

<!-- SNYT_CHANGELOG_DOCS_V2_END -->

<!-- SNYT_RETURNS_RMA_CHANGELOG_V1_START -->
## Returns / RMA Module v1 - 2026-08-08

### Added

- Full Returns module with Customer Return / Resellable and RMA / Defective return types.
- Dedicated non-sellable RMA stock bucket.
- Optional return photos.
- SKU / barcode product lookup and van availability.
- Direct exchange from salesman van stock.
- Opening RMA stock reclassification.
- Accountant pricing and financial settlement recording.
- Warehouse handover batches, confirmation, rejected-item return flow, and A4 PDF.
- Flutter Returns navigation, screens, customer history integration, and global dark SNYT UI foundation.
- English Returns / RMA workflow graphic in `/docs`.

### Stock Safety

- Resellable returns remain non-sellable until accountant approval.
- RMA stock is isolated from customer-visible stock.
- Direct exchange deducts only the replacement quantity from sellable stock.
- Stock edits and warehouse rejection flows remain recorded in `van_stock_movements`.
<!-- SNYT_RETURNS_RMA_CHANGELOG_V1_END -->

## 2026-08-08 - Returns / RMA v1 QA Baseline

- Returns / RMA v1 Flutter integration completed.
- Final analyzer cleanup completed.
- `flutter analyze`: No issues found.
- `flutter test`: 9 tests passed.
- Returns module is ready for device and backend integration QA.
## 2026-08-09 — Returns production hardening

- Required explicit `item_ids` for warehouse handover preparation.
- Required a saved customer for standard returns.
- Added strict return-item ownership and complete settlement checks to accounting review.
- Prevented applying a return to an invoice belonging to another customer.
## 2026-08-09 — Explicit Return workflow

- Added Draft, explicit Submit, Approve, and Reject transitions.
- Added submitter/rejector audit fields and required rejection reasons.
- Preserved RMA stock on rejection and excluded drafts/rejected returns from handover.
- Made duplicate resellable approval stock-safe and froze submitted returns for salesman editing.
## 2026-08-09 — Dedicated RMA Stock

- Added `GET /api/mobile/rma-stock` with search, salesman scoping, admin filtering, and balance summaries.
- Derived ready/prepared/in-transit state from existing RMA and handover records without duplicating inventory.
- Added explicit HTTP 403 guards to approve, reject, and accounting-review actions for normal salesmen.
## 2026-08-09 — Returns / RMA validation fixes

- Validated Returns/RMA in an isolated SQLite environment: 16 related tests and 100 assertions passed.
- Fixed Opening RMA financial initialization referencing an undefined variable.
- Removed the computed handover remaining quantity from model attributes before saving the Return item.
- Added automated coverage for the 21 agreed scenarios, stock invariants, movement audit, financial settlements, and authorization.

## 2026-08-09 — Warehouse handover movement traceability

- Added nullable `van_stock_movements.return_handover_id` linked to `return_handover_batches`.
- New `rma_handover` and `rma_handover_rejected` movements record their exact handover batch without changing stock behavior.
- Left historical movement references `NULL`; no uncertain backfill was attempted.
- Returns/RMA isolated suite: 16 tests, 106 assertions, all passed; all 21 scenarios remain covered and passing.
- Full Laravel suite: 51 passed and one pre-existing, unrelated `PriceImportWorkflowTest` failure.

## 2026-08-09 — SNYT Enterprise UI v1 foundation

- Added centralized dark enterprise CSS tokens and reusable Blade card, metric, status, header, button, empty-state, and form-field components.
- Migrated the global authenticated/guest layouts, desktop sidebar, responsive drawer/topbar, and Dashboard only.
- Standardized semantic status colors across Laravel and Flutter.
- Preserved practical web tables and added contained horizontal scrolling on mobile.
- Verified production Blade compilation, Dashboard route, authenticated rendering, desktop/mobile responsiveness, and browser console with no errors.

## 2026-08-09 — Enterprise UI foundation polish

- Separated Dashboard quick-link context, action title, and arrow into a responsive hierarchy.
- Added compact card hover treatment and mobile-safe padding without changing any destination or business behavior.

## 2026-08-09 — SNYT Enterprise UI v1: Full Laravel Visual Consistency Pass

- Inventoried 97 Blade views and visually opened 57 unique safe Laravel pages/states using authenticated production data.
- Standardized legacy product and customer text, inputs, selects, badges, cards, and semantic utility colors against the centralized dark enterprise tokens.
- Removed the obsolete light-only Customers theme and preserved all customer routes, forms, filters, and validation behavior.
- Fixed full-page mobile overflow on Price Import details and Return details while keeping wide tables inside contained horizontal scrollers.
- Verified desktop 1440px, tablet 768px, and mobile 390px layouts with no remaining page-level horizontal overflow in the representative route set.
- Verified the responsive navigation drawer interaction and browser console with no relevant errors or warnings.
- PHP syntax, Blade compilation, and the 291-route production route list passed.
- Isolated Laravel validation passed: 18 tests and 144 assertions, including all static web-page smoke checks and the complete Returns/RMA suites.
- Added representative screenshots under `docs/screenshots/full-laravel-qa/` and synchronized them with live `/docs`.
