mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix(warehouse): disable Receive-At-Warehouse once booking is received
The Warehouse Information card kept the receive button active after the booking already had an inventory record. Disable it (relabel "Received At Warehouse", add a tooltip) when an inventory item exists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { Badge, Button, Card, Divider, Group, Stack, Text } from '@mantine/core';
|
||||
import { Badge, Button, Card, Divider, Group, Stack, Text, Tooltip } from '@mantine/core';
|
||||
import { PackagePlus, Train as TrainIcon, Warehouse as WarehouseIcon } from 'lucide-react';
|
||||
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
@@ -126,14 +126,24 @@ export function WarehouseInfoCard({ bookingId, bookingReference }: WarehouseInfo
|
||||
</>
|
||||
)}
|
||||
|
||||
<Button
|
||||
variant="light"
|
||||
leftSection={<PackagePlus size={16} />}
|
||||
onClick={() => setModalOpen(true)}
|
||||
fullWidth
|
||||
<Tooltip
|
||||
label="This booking is already received at the warehouse"
|
||||
disabled={!latest}
|
||||
withArrow
|
||||
>
|
||||
Receive At Warehouse
|
||||
</Button>
|
||||
{/* span wrapper so the tooltip still fires on the disabled button */}
|
||||
<span style={{ display: 'block' }}>
|
||||
<Button
|
||||
variant="light"
|
||||
leftSection={<PackagePlus size={16} />}
|
||||
onClick={() => setModalOpen(true)}
|
||||
fullWidth
|
||||
disabled={Boolean(latest)}
|
||||
>
|
||||
{latest ? 'Received At Warehouse' : 'Receive At Warehouse'}
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</Stack>
|
||||
|
||||
<ReceiveInventoryModal
|
||||
|
||||
Reference in New Issue
Block a user