Commit Graph

6 Commits

Author SHA1 Message Date
Vasyka bd8e42d3d1 diag(work-order-dashboard): log every mount + include URL in error
Adds Log::warning() on every mount() so we can trace exactly what
record id and URL the button navigates to. Also includes the full URL
in the "not found" alert so the user can copy it back to us.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-08-05 20:23:28 +00:00
Vasyka c33e96caf8 fix(work-order-dashboard): use Livewire's $this->redirect() in mount
Livewire's Redirector doesn't have ->send(); the correct API inside a
Livewire mount() is $this->redirect($url).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-08-05 19:44:08 +00:00
Vasyka 33d1675182 feat(work-order-dashboard): friendly redirect for missing/foreign WO
Instead of a bare 404 when a work-order id doesn't resolve, redirect to
the list with a persistent notification explaining why: either the WO
doesn't exist, or it belongs to a different tenant.

This is the most common 404 cause: user types /app/work-orders/2/dashboard
but WO id 2 is in another tenant's slice — the tenant scope filters it
out and find() returns null.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-08-05 19:37:00 +00:00
Vasyka 114ae31b15 fix(work-order-dashboard): mount signature + null-safe record property
Made record property nullable (?WorkOrder) and mount() calls find() +
explicit abort(404) instead of findOrFail() (which pass-through the
model's tenant-scoped scope but doesn't clarify the 404 source).

Added Feature test that boots the dashboard route via tenant subdomain
(psauto.service.mir.md-style host), authenticates a user, and verifies
the page returns non-404, non-500. Test passes both with and without
route:cache, so the routing itself is fine — user-side 404 is most
likely browser cache or CDN cache.

307/307 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-08-05 19:28:54 +00:00
Vasyka 9830dd9a6f feat(work-order-dashboard): Phase 2 — Timeline + Chat + Bottom action bar
Right column now shows:
- Timeline card: synthesised events from WO lifecycle fields (created,
  opened, approved, closed) + payments + activity_log entries (spatie/
  activitylog). Sorted newest first, scrollable.
- Chat client card: outbound notifications history (ClientNotificationLog)
  + inline send form. Prefers Telegram if client has telegram_chat_id,
  else falls back to SMS/WhatsApp. Logged either way for UI history.

New bottom action bar (fixed, above footer):
- Previous / Next WO links (adjacent by id) with number preview
- Repeat order: pre-fills create form with same client/vehicle
- Close order (danger button): sets status='done' + closed_at=now, with
  wire:confirm guard. Hidden when already closed.

+14 translations. Fixed ready_at reference (not in schema, removed).
All 306 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-08-05 19:00:28 +00:00
Vasyka fa8704f8b6 feat(work-orders): new Mitchell1-style dashboard view (Phase 1 — layout + tabs)
Custom Filament Page at /app/work-orders/{id}/dashboard renders a
Mitchell1-inspired 3-column layout:
  - Top bar: WO#, status badge, actions (Edit / Tracking link)
  - Meta header row: creation / opened / ETA / responsible / urgency /
    paid amount (6 cells)
  - Left sidebar (300px): Client card (avatar, phone, email, status
    tag, 3-stat grid: visits/total/debt) + Vehicle card (photo, plate,
    VIN, mileage, engine, gearbox) + Repair history (latest 5 for this
    vehicle, links to dashboards)
  - Middle: tab bar (Lucrări/Piese/Diagnostic/Foto/Documente/Note)
    with Alpine-driven switching. Works & Parts show the tables read-
    only; add/edit still goes through existing EditWorkOrder Filament
    resource. Photos tab shows gallery from spatie/media-library.
  - Right (300px): Finance summary card (works cost, parts cost,
    discount, total, paid, balance) + placeholder for Timeline+Chat
    (Phase 2)
  - Responsive: right column collapses <1280px, left <900px.

'Vizualizare dashboard' button added on top of the existing
EditWorkOrder page so users can switch between edit form and info-
dense dashboard.

Fixed getSlug() signature (must match parent with ?Panel $panel).

+14 translations. All 306 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-08-05 18:48:52 +00:00