Commit Graph

1869 Commits

Author SHA1 Message Date
Nathnael Wondisha
826a313c9d Merge pull request #1207 from Tria-plc/freight/nati-2
Freight/nati 2
2026-08-10 09:56:59 +03:00
Nathnael
3d53f67156 fix: gm and poa email requirement 2026-08-10 06:46:25 +00:00
Nathnael Wondisha
f5c37d3374 Merge pull request #1204 from Tria-plc/freight/nati-2
fix: rm the exception
2026-08-09 22:29:56 +03:00
Nathnael
f6dac28ac0 fix: rm the exception 2026-08-09 19:27:47 +00:00
Hagernesh
cde67e4c6a fix(freight): correct direct CAS lines and sync inventory on schedule load
End-to-end testing of the direct truck-to-train flow surfaced two defects
in the carriage acceptance sheet's no-wagon fallback. Container numbers
were read from freight.containers, which only gains rows at allocation,
so a direct booking's declared containers never appeared; they are read
from booking_container_units now, seal numbers included. The weight used
bulkTotalWeightTons alone, which is null for CONTAINER and PER_TON bulk
bookings, printing 0.00 — cargoTotalWeightVgm is the real weight there
and only holds an item count for PER_ITEM break-bulk.

Separately, warehouse cargo can be loaded from the Load-to-Train queue or
from the schedule, but loading from the schedule never advanced
warehouse_inventory. The booking went IN_TRANSIT while its cargo still
read as sitting in the warehouse — the same inconsistency that produced
the spurious dispatch block. loadBooking now moves the inventory to
LOADED in the same transaction, and no-ops for direct bookings.
2026-08-09 16:05:59 +00:00
Nathnael
a47c7f6b7a Merge branch 'dev' into freight/nati-2 2026-08-09 13:44:18 +00:00
Nathnael
f9f4b22a21 fix: video thumbnail 2026-08-09 13:42:28 +00:00
Nathnael
5e0674e2fb fix: poa email 2026-08-09 13:28:45 +00:00
Nathnael
ff9bb4954a fix: the content document 2026-08-09 13:27:05 +00:00
Nathnael
182787e143 fix: gm email 2026-08-09 07:57:45 +00:00
Marshal
622c690ed1 keep cents in CBE bills and prices 2026-08-08 20:58:37 +00:00
Marshal
80a14c176b keep cents in CBE bills and prices 2026-08-08 20:45:05 +00:00
Nathnael
e03ccf0f69 fix 2026-08-08 18:09:40 +00:00
Marshal
aad9ebaf78 fix issue 2026-08-08 18:06:47 +00:00
Nathnael Wondisha
12eb07752e Merge pull request #1192 from Tria-plc/freight/nati-2
Freight/nati 2
2026-08-08 20:38:37 +03:00
Hagernesh
337ff6cfe3 feat(freight): support direct truck-to-train export handover
Export cargo reaches a train two ways, but the platform only modelled
one. Direct truck-to-train cargo loads straight onto the wagon, never
enters a warehouse and so never has a GRN — yet assertExportReceivedWithGrn
required one before the carriage acceptance sheet could be issued or the
booking loaded from inside its schedule.

Adds export_handover_mode to freight.bookings (null = WAREHOUSE, so
existing bookings are unaffected) and teaches the shared gate to skip
DIRECT_TO_TRAIN. Both call sites are fixed by that single early return.

For direct bookings the carriage acceptance sheet builds its lines from
the booking's own containers, falling back to the declared bulk tonnage,
and is issuable as soon as the mode is chosen. Direct bookings are also
removed from the warehouse receive queue, since that cargo is never
coming to the shed.

Staff choose the mode from the booking detail page via a new endpoint
reusing bookings:operations. Switching to direct is refused once
warehouse inventory exists, so the two flows cannot cross.

Warehouse-then-train keeps every gate it had.
2026-08-08 15:16:31 +00:00
Marshal
fb6f8afc0c add usd for import 2026-08-08 15:14:10 +00:00
Nathnael
7a32bb95ff refactor: rm company profile 2026-08-08 15:06:46 +00:00
Marshal
4b8119fd3c chnages 2026-08-08 14:02:58 +00:00
Marshal
1700ae0747 chnages 2026-08-08 14:00:45 +00:00
Nathnael
d337fa0d85 fix(freight:backoffice): remove coarse fleet.view/fleet.manage/admin fallbacks
Now that every fleet-resource page and settings page has its own
dedicated permission key (previous commit), the broad fallbacks are
redundant and over-grant: anyone holding only fleet:view/fleet:manage
or admin could reach every page in that whole section, not just one.

Removed fleet.view fallback from: Routes, Locomotives, Train Builder,
Wagons, Containers, Cargoes, Compliance & Alerts, Procurement, and the
Overview dashboard's Fleet KPI tab.

Removed fleet.manage fallback from: canFleetAction() (per-resource
fleet CRUD, lib/permissions.ts) and TrainBuilderDetailPage's wagon-
assignment check. Hard-delete already had no such fallback.

Removed admin fallback from: File settings, Dropdown settings,
Contract templates, Portal content, Trade access, Exchange rate.

Left untouched: Incidents (sole gate is fleet.view — no dedicated
edr_freight_app:incidents:* key exists on the backend yet, so there's
nothing to fall back FROM; removing it would make the page
super-admin-only).

Access-narrowing change: anyone currently relying on the coarse grant
without also holding the specific resource/settings key will lose
access to these pages until roles are updated to grant the specific
keys directly. Audit role assignments before this deploys.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-08 13:59:06 +00:00
Marshal
a42d32c27c feat(billing): USD offline bank-transfer payments 2026-08-08 13:37:05 +00:00
Hagernesh
80e1648672 fix 2026-08-08 13:17:43 +00:00
Hagernesh
204bfd2421 fix: let trains dispatch with cargo still in the warehouse
The export-only assertAllocatedCargoLoaded guard threw a
BadRequestException whenever a booking on the schedule had warehouse
inventory in RECEIVED, STORED or READY_FOR_LOADING, making it
impossible to dispatch a train whose cargo had not been inspected and
loaded onto a wagon.

Leaving cargo behind is an operational decision, not an error state.
The dispatch confirm dialog already lists unassigned and unloaded
bookings and offers Dispatch anyway, so the readiness signal is
preserved — only the hard block is gone.

Wagon/locomotive conflicts and the Djibouti gatepass check still block
dispatch: those are physical and legal conflicts, not cargo readiness.
2026-08-08 13:17:43 +00:00
Marshal
83b9e32670 usd remove from the portal 2026-08-08 12:40:07 +00:00
Marshal
7a84826947 usd remove from the portal 2026-08-08 12:39:56 +00:00
marshal
1b0978bc1e Merge pull request #1183 from Tria-plc/freight_feature/usermanagement
feat(freight-web): restrict booking currency to ETB and portal ETB pa…
2026-08-08 13:49:16 +03:00
Marshal
229d9c6651 feat(freight-web): restrict booking currency to ETB and portal ETB payments to CBE bill only 2026-08-08 10:47:48 +00:00
Nathnael Wondisha
a140add64e Merge pull request #1181 from Tria-plc/freight/nati-2
Freight/nati 2
2026-08-08 12:38:32 +03:00
Nathnael
41e8c08ba3 feat: WIP Contnet managemtn 2026-08-08 09:37:28 +00:00
Nathnael
ee25de8817 fix(freight:backoffice): wire dedicated permission keys instead of broad fallbacks
Compliance & Alerts, Procurement, File settings, Dropdown settings,
Trade access, and Exchange rate all fell back to a broad permission
(fleet:view or admin) even though a dedicated key already existed in
FREIGHT_PERMS — meaning granting one of these pages meant granting
several unrelated ones too. Each now checks its own key first, with
the broad permission kept as a fallback for existing role grants.

Incidents left as-is: no dedicated edr_freight_app:incidents:* key
exists yet on the backend.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-08 09:36:51 +00:00
Hagernesh Tadesse
268737cc4f Merge pull request #1180 from Tria-plc/lastmilerequest
Lastmilerequest
2026-08-08 12:30:43 +03:00
Hagernesh
375cf55e5f LM map missing map api fall back fix 2026-08-08 07:51:41 +00:00
Hagernesh
e12cb78e9b feat(portal): pay-later last-mile note, gated by service type
Last-mile toggle explains deferred billing (confirm containers after
Djibouti departure, sign supplementary LM contract on truck approval,
pay advance) — shown only when the service defers mile billing, not
for RAIL_CONTAINER_PAID_MILE where the mile is priced into the booking.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-08 05:24:22 +00:00
Hagernesh
6b1ffa831f feat(eims): surface filing state in backoffice and alert on failures
Two gaps that only bite in production: nobody could see an invoice's filing
state, and a blocked chain was visible only in the logs.

A failed filing now notifies the staff who can act on it. An ambiguous result
is HIGH priority because it blocks every further invoice for the system number
until someone resolves it, and nothing else would surface that -- the sweep
just goes quiet. A deterministic rejection affects one invoice, so it is
normal priority. The alert never throws: it must not mask the filing outcome.

The backoffice invoice detail page gains an EIMS card showing status, IRN,
counter, submitted and acknowledged timestamps, and the gateway's own error
message, with actions gated on invoices:eims_register. FAILED offers "File
again" -- the reservation model already allows re-registering a rejected
invoice, so retry needed no new endpoint. UNKNOWN offers no re-file button at
all, since resubmitting risks a duplicate registration, and instead explains
that a supervisor must record the IRN or discard the attempt.

Also aligns the migration class name with its renamed file. The DDL is
idempotent, so re-applying under the new name is a no-op against the columns;
it leaves one superseded row in freight.migrations.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 04:56:57 +00:00
Marshal
a05753f4a6 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight_feature/usermanagement
# Conflicts:
#	apps/edr-freight-web/backoffice/src/App.tsx
2026-08-07 23:55:30 +00:00
Marshal
cd90ccb0f5 feat(contracts): per-cargo bulk contract templates 2026-08-07 23:50:27 +00:00
marshal
7d8a2847e0 Merge pull request #1172 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
2026-08-08 02:00:59 +03:00
Marshal
d2eb47d14b feat(ui): 2026-08-07 23:00:06 +00:00
Nathnael Wondisha
22e6e550bc Merge pull request #1164 from Tria-plc/freight/nati-2
Freight/nati 2
2026-08-07 15:58:02 +03:00
Nathnael
c9bb105e94 feat: add nationality indicator to the customer 2026-08-07 12:54:00 +00:00
Nathnael Wondisha
116ea97be8 Merge pull request #1163 from Tria-plc/freight/nati-2
Freight/nati 2
2026-08-07 15:26:32 +03:00
Nathnael
1e9149ce00 feat: better navigation in backoffice 2026-08-07 12:24:30 +00:00
Marshal
70215a9f37 feat(wagons): audited maintenance/availability toggle 2026-08-07 12:10:43 +00:00
Marshal
ffdb4c5117 merge 2026-08-07 09:04:11 +00:00
Marshal
64150acdca issue fix 2026-08-07 08:44:03 +00:00
Nathnael
7d2f17d767 Merge branch 'dev' into freight/nati-2 2026-08-07 08:09:34 +00:00
Nathnael
c1fcabcba2 feat(backoffice): guard routes and actions by permission
Mirrors the new keys in lib/permissions.ts, wraps the warehouse,
overview, reports, support and booking-request routes in
RequirePermission, and gates the dispatch, mark-paid, invoice pay/cancel,
export and support-send actions behind their own keys. Removes duplicate
route blocks.
2026-08-07 07:32:25 +00:00
Marshal
fc7f40a373 fix wagon cancellation 2026-08-07 07:18:12 +00:00
Marshal
296878cbde fix wagon cncellation 2026-08-07 06:59:31 +00:00