Commit Graph

994 Commits

Author SHA1 Message Date
Hagernesh
a5973de6e1 feat(intercity): a facility only handles the cargo its equipment can lift
Containers need a reach stacker or gantry, so only Indode, Modjo and Dire Dawa
take them. Bulk needs far less and is handled at all five facilities. Having a
facility was previously enough to load anything, so a container booking through
Sebeta or Adama would have been accepted and then had nothing to lift it.

- yard_facilities gains handles_container / handles_bulk, both defaulting true so
  a facility handles everything unless told otherwise; the seeder states the real
  capability.
- The intercity gate now refuses cargo a facility cannot lift, saying which type,
  not just "no facility". canHandleFreight keeps that rule in the resolver so
  callers cannot get it subtly wrong.
- The intercity list resolves each end against the booking's own freight type, so
  the view flags a container booking routed through a bulk-only yard while the
  train is still coming rather than when the load is refused.

Import/export untouched — the gate is still DOMESTIC-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 07:13:51 +00:00
Marshal
771aa2a605 Add train deactivation feature and import train number management
- Introduced DEACTIVATED status for trains, allowing staff to park trains indefinitely.
- Implemented methods to deactivate and reactivate trains in the TrainBuilderService.
- Added UI components for train deactivation and reactivation in TrainBuilderDetailPage.
- Created a dropdown setting for admin-managed import train numbers, with corresponding migrations.
- Updated yard code length to accommodate soft-delete suffix.
- Enhanced train status handling to include DEACTIVATED state.
2026-07-20 07:04:23 +00:00
marshal
f672d66a92 Merge pull request #826 from Tria-plc/freight_feature/usermanagement
changes
2026-07-20 06:06:06 +03:00
Marshal
4969f62896 changes 2026-07-20 03:05:28 +00:00
marshal
9170c12a73 Merge pull request #808 from Tria-plc/freight_feature/usermanagement
add contract clearance detail page and enhance contract requests fil…
2026-07-19 13:25:44 +03:00
marshal
3ab7a09d2d Merge pull request #807 from Tria-plc/freight_feature/usermanagement
add contract clearance detail page and enhance contract requests fil…
2026-07-19 12:48:00 +03:00
Marshal
de816ea9d4 add contract clearance detail page and enhance contract requests filtering and ui fix 2026-07-19 09:47:36 +00:00
Marshal
5de1853c0d add contract clearance detail page and enhance contract requests filtering and ui fix 2026-07-19 09:37:48 +00:00
marshal
5ac48bf05b Merge pull request #799 from Tria-plc/freight_feature/usermanagement
add per-container handling options for hazardous, reefer, and return…
2026-07-18 22:22:46 +03:00
Marshal
0dead281ce add per-container handling options for hazardous, reefer, and return services
- Introduced new boolean fields (isHazardous, isReefer, isReturn) in UnitDraft and related interfaces to allow individual container handling options.
- Updated emptyUnit function to initialize these new fields.
- Modified GlCreateBookingForm to handle and display these options for each container.
- Adjusted calculations for hazardous, reefer, and return quantities based on the new handling options.
- Updated the schema for container units and booking container lines to include handling options.
- Added migration to support the new return flag in the database.
- Enhanced various components to reflect gross weight calculations, ensuring consistency across the application.
2026-07-18 19:20:45 +00:00
marshal
bc6999cd10 Merge pull request #786 from Tria-plc/freight_feature/usermanagement
split export
2026-07-18 12:20:48 +03:00
Marshal
406fbf6c45 split export 2026-07-18 09:12:52 +00:00
natib21
dc4512c15b gMerge branch 'dev' of github.com:Tria-plc/edr-platform into dev 2026-07-18 09:04:52 +00:00
natib21
d5e87449b5 fix gps 2026-07-18 09:04:34 +00:00
natib21
20eb54521b fix 2026-07-18 08:34:43 +00:00
marshal
f8d5030e97 Merge pull request #782 from Tria-plc/freight_feature/usermanagement
add lashing surcharge for cargo types with hasLashing flag
2026-07-18 02:27:50 +03:00
Marshal
3a1a08b1e1 add lashing surcharge for cargo types with hasLashing flag
add lashing surcharge for cargo types with hasLashing flag
2026-07-17 23:25:53 +00:00
natib21
c8ec0be6b2 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight/feature/user_management_UI 2026-07-17 15:01:51 +00:00
natib21
6ee771c953 fix search 2026-07-17 15:01:30 +00:00
marshal
2e3e5d20dd Merge pull request #771 from Tria-plc/freight_feature/usermanagement
fix
2026-07-17 16:59:36 +03:00
Marshal
6467173c76 fix 2026-07-17 13:57:59 +00:00
natib21
6f126a2345 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight/feature/user_management_UI 2026-07-17 12:01:39 +00:00
Hagernesh Tadesse
41d7a04d2f Merge pull request #768 from Tria-plc/intercity-load-unload
feat(intercity): show intercity cargo across every train
2026-07-17 15:00:15 +03:00
natib21
30188c1031 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight/feature/user_management_UI 2026-07-17 11:59:13 +00:00
natib21
47780c614a fix 2026-07-17 11:59:00 +00:00
marshal
f690b635eb Merge pull request #767 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
2026-07-17 14:40:59 +03:00
Marshal
3a697e12f2 changes 2026-07-17 11:40:25 +00:00
natib21
838ea5efc8 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight/feature/user_management_UI 2026-07-17 11:30:49 +00:00
natib21
149e4105f4 seed vehicle 2026-07-17 11:30:25 +00:00
Hagernesh
30f48ea37f feat(intercity): show intercity cargo across every train
Intercity bookings never get their own train — they ride whichever import/export
train passes through their corridor — so the work is scattered across other
people's schedules and there was nowhere to see it as a whole. The per-schedule
ride-along panel answers "what can THIS train carry"; this answers "what is
happening to intercity cargo".

Purely additive: the existing ride-along panel and the schedule detail page are
untouched, and loading/unloading still happens there, where the train's position
is confirmed. This is a read-only view that points back to it.

Each row carries both ends' facility status, because a booking whose origin or
destination has no equipment can never be worked there — the operator should see
that while the train is still coming, not when the load is refused. Those
bookings are counted and called out.

New GET /train-scheduling/intercity/bookings; the type is IntercityRideAlongRow,
not IntercityBookingRow, which already means the per-schedule candidate row.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 11:27:40 +00:00
Nathnael Wondisha
4abc2aa7ae Merge pull request #765 from Tria-plc/freight/feat/chat-app
Freight/feat/chat app
2026-07-17 14:12:05 +03:00
natib21
35303ece58 Merge branch 'dev' of github.com:Tria-plc/edr-platform into freight/feature/user_management_UI 2026-07-17 11:03:37 +00:00
natib21
57f49a9333 fix 2026-07-17 11:03:23 +00:00
Nathnael
031e5ab292 Merge branch 'dev' into freight/feat/chat-app 2026-07-17 11:01:39 +00:00
Nathnael
1fd46afaaa fix: added chat to the freight api 2026-07-17 10:59:25 +00:00
Hagernesh
a73faecbe3 feat(intercity): raise a GRN when a facility loads or unloads cargo
Every facility raises a GRN — the goods changed hands, whether or not anyone
stores them. What differs is what happens next: Indode has a warehouse, so cargo
left there goes through the existing warehouse flow and accrues storage and
demurrage; Sebeta, Modjo, Adama and Dire Dawa only move cargo between train and
truck, so the handling event and its GRN are the whole record.

facility_handling_events carries that record because warehouse_inventory cannot:
its warehouse/yard/zone are NOT NULL, so a facility with equipment but no
warehouse could never have a row there. inventory_id links the storage record
when the facility does keep the cargo, which is what ties an Indode handover to
its demurrage.

generateGrnNumber moves to common/grn.util.ts so a GRN raised at a facility is
indistinguishable from one raised in a warehouse — the two live in different
tables, and a second generator would let the formats drift.

Recording is best-effort: the cargo moved regardless, so paperwork must never
fail the journey.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 10:40:16 +00:00
Hagernesh
a411e0bdd0 feat(intercity): only load/unload where the yard has a facility
Intercity cargo rides a passing train and is handled at the booking's own yards,
so those yards need the equipment to do it — a train stopping somewhere is not
the same as somewhere being able to load it. Loading at an origin or unloading at
a destination without has_facility is now refused, naming the yard.

The check sits inside loadBooking/unloadBooking rather than the intercity
controller wrapper, because recording a checkpoint auto-unloads every booking
destined at that yard (autoUnloadAtYard) and would otherwise route around it.

Import/export are untouched: their cargo is handled at the route's terminal
ports, not at an arbitrary mid-corridor yard, so the gate returns early for
anything that isn't DOMESTIC.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 10:40:16 +00:00
Hagernesh
ce3ef15e7c feat(yards): record which yards can load/unload cargo
Intercity cargo is loaded at its origin yard and unloaded at its destination, but
only some yards have the equipment. EDR's facilities are Indode, Sebeta, Modjo,
Adama and Dire Dawa — and the set grows, so it has to be data.

- yards.has_facility marks a yard as a load/unload point; the new yard_facilities
  record says what it can do. Only Indode stores cargo (has_warehouse), so only it
  accrues storage/demurrage — the rest just move cargo on and off the train.
- facility_handling_events records each load/unload and carries its GRN.
  warehouse_inventory cannot: its warehouse/yard/zone are NOT NULL, so a facility
  without a warehouse could never have a row. inventory_id links to the storage
  record when there is one.
- YardFacilitiesService.facilityForYard is the single resolver the handling flows
  share, so they cannot drift on what a facility is.
- The seeder flags EXISTING yards and creates none. The codes are historical and
  do not read like the facility names — Indode is KALITY ("Gelan Multi Purpose
  Port (Indode)") and Sebeta is LEGACY_DEST — so it maps by code. Creating fresh
  INDODE/SEBETA yards would have split data that routes and bookings already
  reference.

Negad is deliberately absent: NAGAD ("DCT/SGDT") is in Djibouti while
NEGAD_FY_BCC is in Ethiopia and inactive, and which one is the intercity facility
is unsettled.

No behaviour change yet — nothing reads has_facility until the gate lands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 10:40:16 +00:00
marshal
39a48a2c30 Merge pull request #761 from Tria-plc/freight_feature/usermanagement
fix rate edit
2026-07-17 13:31:08 +03:00
Marshal
801872c106 fix rate edit 2026-07-17 10:15:26 +00:00
natib21
a9d65e04fc fix number of wagon 2026-07-17 10:12:43 +00:00
yaschalew10
9ade4b2c83 Merge pull request #757 from Tria-plc/freight/feature/user_management_UI
Freight/feature/user management UI
2026-07-17 12:37:22 +03:00
Marshal
18311f22f7 Comment out payment event handling for local demos in BillingService 2026-07-17 09:20:36 +00:00
Marshal
308df1c61c fix schule issue and contianer type issue 2026-07-17 09:18:26 +00:00
Marshal
7b7e7c3f62 fix schule issue and contianer type issue 2026-07-17 09:16:35 +00:00
Nathnael
ef74bc442a fix: prevent the backoffice from approve the user before he submits 2026-07-17 08:54:24 +00:00
natib21
b4118e1bd4 add export/inport number 2026-07-17 08:47:52 +00:00
Hagernesh
fc636fbe4f fix(warehouse): scope the arrival GRN stamp to EXPORT only
The previous commit made autoUnloadArrived and unloadBooking raise a GRN for any
direction, which changed import behaviour. Import keeps its own GRN handling
(autoUnloadArrivedBookings) and is left exactly as it was. Both paths now stamp a
GRN only when the booking is EXPORT — the direction whose cargo needs one to be
loaded onto a train. Import and domestic behave as before.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 08:01:58 +00:00
Hagernesh
a95667fde4 fix(warehouse): raise a GRN on every warehouse receipt
Requiring a GRN before loading only works if every path into the warehouse
issues one. Two did not: autoUnloadArrived and unloadBooking created RECEIVED
inventory with a null grn_number, so cargo that genuinely arrived — by first
mile or self haul — would have been stuck un-loadable behind the new gate.

Both now stamp a GRN, derived from the booking's trade direction, matching
receive/bulkReceive/autoUnloadArrivedBookings. unloadBooking keeps an
already-issued GRN when it re-unloads an existing row rather than reissuing one.

Every path that creates warehouse inventory now issues a GRN, so the chain is
seamless: booking arrives (first mile or self haul) -> received -> GRN -> loadable
onto its allocated wagon.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 08:01:58 +00:00
Hagernesh
a26fa61d66 feat(warehouse): require a GRN before export cargo can be loaded onto a train
The export chain is: paid -> received into the warehouse -> GRN raised on arrival
-> loaded onto the allocated wagon. Receipt was already structural (the inventory
row only exists once receive() runs) and the wagon was already required, but the
GRN was merely displayed, never enforced — so cargo could be loaded and
dispatched without one.

- loadable now also requires a GRN, so the queue won't offer un-GRN'd cargo.
- loadItemsOntoTrain skips items with no GRN, so the rule holds server-side and
  a hand-made API call can't bypass it.
- Read the GRN from inv.grn_number (what receive() stamps) and fall back to the
  note only for legacy/seeded rows; it previously read the note alone, which the
  real receive path merely mirrors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 08:01:57 +00:00