add quantity cap for GENERAL contracts and implement capacity tracking

- Updated ContractClearanceService and ContractsController to remove region parameter from queue method.
- Enhanced ContractsRepository to attach contract files for download and added attachContractFiles method.
- Modified ContractsService to persist cargo scope with quantity cap based on contract kind.
- Introduced quantityCap field in CreateContractCargoScopeDto and ContractCargoScope entity.
- Implemented capacity tracking in the frontend with ContractCapacityNotice component to display remaining bookable quantities.
- Updated various components and services to support new capacity features, including hooks and API calls.
- Added migration to include quantity_cap column in contract_cargo_scope table.
This commit is contained in:
Marshal
2026-06-28 17:32:18 +00:00
parent e1d54746c2
commit 11c7f1bb74
27 changed files with 512 additions and 74 deletions

View File

@@ -46,7 +46,6 @@ import {
} from "@/hooks/contracts/useContracts";
type ViewMode = "table" | "cards";
type Region = "ET" | "DJ";
interface ClearanceRow {
id: string;
@@ -118,12 +117,11 @@ export default function ContractClearanceListPage({
opsMode?: boolean;
} = {}) {
const navigate = useNavigate();
const [region, setRegion] = useState<Region>("ET");
const [query, setQuery] = useState("");
const [view, setView] = useState<ViewMode>("table");
const { pagination, setPagination } = usePagination({ pageSize: 10 });
const glQueue = useContractClearanceQueue(region, !opsMode);
const glQueue = useContractClearanceQueue(!opsMode);
const opsQueue = useOpsClearanceQueue(opsMode);
const { data, isLoading, isError, isFetching, refetch } = opsMode
? opsQueue
@@ -340,24 +338,6 @@ export default function ContractClearanceListPage({
style={{ flex: 1, minWidth: 220 }}
/>
<Group gap="sm" wrap="nowrap">
{!opsMode && (
<SegmentedControl
size="sm"
radius="md"
value={region}
onChange={(v) => {
setRegion(v as Region);
setPagination({
pageIndex: 0,
pageSize: pagination.pageSize,
});
}}
data={[
{ value: "ET", label: "Ethiopia" },
{ value: "DJ", label: "Djibouti" },
]}
/>
)}
<Text size="sm" c="dimmed">
{total} record{total !== 1 ? "s" : ""}
</Text>