mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 16:28:12 +00:00
resolve confilict
This commit is contained in:
@@ -258,7 +258,7 @@ export default function BookingRequestDetailPage() {
|
||||
)}
|
||||
{(booking.status === "PENDING_APPROVAL" ||
|
||||
booking.status === "APPROVED_PENDING_SIGNATURE") && (
|
||||
<ApprovalStepsCard booking={booking} />
|
||||
<ApprovalStepsCard booking={booking} mutations={mutations} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useCargoes } from '@/hooks/useCargoes';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
// import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { LoadCargoDialog } from '@/components/cargoes/LoadCargoDialog';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@edr/ui-common';
|
||||
|
||||
export default function CargoesPage() {
|
||||
const { data: cargoes, refetch, isLoading } = useCargoes();
|
||||
@@ -14,7 +15,7 @@ export default function CargoesPage() {
|
||||
<Table>
|
||||
<TableHeader><TableRow><TableHead>Reference</TableHead><TableHead>Description</TableHead><TableHead>Quantity</TableHead><TableHead>Weight</TableHead><TableHead>Status</TableHead><TableHead>Actions</TableHead></TableRow></TableHeader>
|
||||
<TableBody>
|
||||
{cargoes?.map(c => (
|
||||
{cargoes?.map((c:any) => (
|
||||
<TableRow key={c.id}>
|
||||
<TableCell>{c.cargoReference}</TableCell>
|
||||
<TableCell>{c.description || '-'}</TableCell>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { useContainers } from '@/hooks/useContainers';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
// import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@edr/ui-common';
|
||||
|
||||
export default function ContainersPage() {
|
||||
const { data: containers, isLoading } = useContainers();
|
||||
@@ -13,7 +14,7 @@ export default function ContainersPage() {
|
||||
<Table>
|
||||
<TableHeader><TableRow><TableHead>Number</TableHead><TableHead>Type</TableHead><TableHead>Wagon</TableHead><TableHead>Status</TableHead></TableRow></TableHeader>
|
||||
<TableBody>
|
||||
{containers?.map(c => (
|
||||
{containers?.map((c:any) => (
|
||||
<TableRow key={c.id}>
|
||||
<TableCell>{c.containerNumber}</TableCell>
|
||||
<TableCell>{c.containerTypeId}</TableCell>
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useTrain } from '@/hooks/useTrains';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { AssignWagonDialog } from '@/components/AssignWagonDialog';
|
||||
import { WagonsTable } from '@/components/WagonsTable';
|
||||
// import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
// import { Skeleton } from '@/components/ui/skeleton';
|
||||
// import { AssignWagonDialog } from '@/components/AssignWagonDialog';
|
||||
// import { WagonsTable } from '@/components/WagonsTable';
|
||||
import { Card, CardContent, CardHeader, CardTitle, Skeleton } from '@edr/ui-common';
|
||||
import { AssignWagonDialog } from '@/components/wagons/AssignWagonDialog';
|
||||
import { WagonsTable } from '@/components/wagons/WagonsTable';
|
||||
|
||||
export default function TrainDetailPage() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
|
||||
@@ -1,42 +1,3 @@
|
||||
<<<<<<< HEAD
|
||||
import { useState } from 'react';
|
||||
import { useTrains, useDeleteTrain, useCreateTrain } from '@/hooks/useTrains';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { Plus, Eye, Trash2 } from 'lucide-react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
const CreateTrainForm = ({ onSuccess }: { onSuccess: () => void }) => {
|
||||
const [form, setForm] = useState({ code: '', capacityTons: 0, trainNumber: '', trainName: '' });
|
||||
const createTrain = useCreateTrain();
|
||||
const { toast } = useToast();
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
try {
|
||||
await createTrain.mutateAsync(form);
|
||||
toast({ title: 'Train created', description: `${form.code} added.` });
|
||||
onSuccess();
|
||||
} catch {
|
||||
toast({ title: 'Error', description: 'Failed to create train.', variant: 'destructive' });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
<div><Label>Code*</Label><Input required value={form.code} onChange={e => setForm({...form, code: e.target.value})} /></div>
|
||||
<div><Label>Capacity (tons)*</Label><Input type="number" required value={form.capacityTons} onChange={e => setForm({...form, capacityTons: parseFloat(e.target.value)})} /></div>
|
||||
<div><Label>Train Number</Label><Input value={form.trainNumber} onChange={e => setForm({...form, trainNumber: e.target.value})} /></div>
|
||||
<div><Label>Train Name</Label><Input value={form.trainName} onChange={e => setForm({...form, trainName: e.target.value})} /></div>
|
||||
<Button type="submit" disabled={createTrain.isPending}>Save</Button>
|
||||
</form>
|
||||
=======
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { isAxiosError } from 'axios';
|
||||
@@ -794,45 +755,44 @@ const TrainsPage = () => {
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
>>>>>>> 523d7e58422f1bde8024c2dd237092a7cf6aa190
|
||||
);
|
||||
};
|
||||
|
||||
export default function TrainsPage() {
|
||||
const { data: trains, isLoading } = useTrains();
|
||||
const deleteTrain = useDeleteTrain();
|
||||
const [open, setOpen] = useState(false);
|
||||
// export default function TrainsPage() {
|
||||
// const { data: trains, isLoading } = useTrains();
|
||||
// const deleteTrain = useDeleteTrain();
|
||||
// const [open, setOpen] = useState(false);
|
||||
|
||||
if (isLoading) return <div className="p-8">Loading trains...</div>;
|
||||
// if (isLoading) return <div className="p-8">Loading trains...</div>;
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between">
|
||||
<CardTitle>Trains</CardTitle>
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild><Button size="sm"><Plus className="mr-2 h-4 w-4" />New Train</Button></DialogTrigger>
|
||||
<DialogContent><DialogHeader><DialogTitle>Create Train</DialogTitle></DialogHeader><CreateTrainForm onSuccess={() => setOpen(false)} /></DialogContent>
|
||||
</Dialog>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Table>
|
||||
<TableHeader><TableRow><TableHead>Number</TableHead><TableHead>Name</TableHead><TableHead>Status</TableHead><TableHead>Capacity</TableHead><TableHead>Actions</TableHead></TableRow></TableHeader>
|
||||
<TableBody>
|
||||
{trains?.map(train => (
|
||||
<TableRow key={train.id}>
|
||||
<TableCell>{train.trainNumber || train.code}</TableCell>
|
||||
<TableCell>{train.trainName || '-'}</TableCell>
|
||||
<TableCell><Badge variant="outline">{train.status}</Badge></TableCell>
|
||||
<TableCell>{train.capacityTons} t</TableCell>
|
||||
<TableCell className="flex space-x-2">
|
||||
<Link to={`/trains/${train.id}`}><Button variant="ghost" size="icon"><Eye className="h-4 w-4" /></Button></Link>
|
||||
<Button variant="ghost" size="icon" onClick={() => deleteTrain.mutate(train.id)}><Trash2 className="h-4 w-4" /></Button>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
// return (
|
||||
// <Card>
|
||||
// <CardHeader className="flex flex-row items-center justify-between">
|
||||
// <CardTitle>Trains</CardTitle>
|
||||
// <Dialog open={open} onOpenChange={setOpen}>
|
||||
// <DialogTrigger asChild><Button size="sm"><Plus className="mr-2 h-4 w-4" />New Train</Button></DialogTrigger>
|
||||
// <DialogContent><DialogHeader><DialogTitle>Create Train</DialogTitle></DialogHeader><CreateTrainForm onSuccess={() => setOpen(false)} /></DialogContent>
|
||||
// </Dialog>
|
||||
// </CardHeader>
|
||||
// <CardContent>
|
||||
// <Table>
|
||||
// <TableHeader><TableRow><TableHead>Number</TableHead><TableHead>Name</TableHead><TableHead>Status</TableHead><TableHead>Capacity</TableHead><TableHead>Actions</TableHead></TableRow></TableHeader>
|
||||
// <TableBody>
|
||||
// {trains?.map(train => (
|
||||
// <TableRow key={train.id}>
|
||||
// <TableCell>{train.trainNumber || train.code}</TableCell>
|
||||
// <TableCell>{train.trainName || '-'}</TableCell>
|
||||
// <TableCell><Badge variant="outline">{train.status}</Badge></TableCell>
|
||||
// <TableCell>{train.capacityTons} t</TableCell>
|
||||
// <TableCell className="flex space-x-2">
|
||||
// <Link to={`/trains/${train.id}`}><Button variant="ghost" size="icon"><Eye className="h-4 w-4" /></Button></Link>
|
||||
// <Button variant="ghost" size="icon" onClick={() => deleteTrain.mutate(train.id)}><Trash2 className="h-4 w-4" /></Button>
|
||||
// </TableCell>
|
||||
// </TableRow>
|
||||
// ))}
|
||||
// </TableBody>
|
||||
// </Table>
|
||||
// </CardContent>
|
||||
// </Card>
|
||||
// );
|
||||
// }
|
||||
@@ -1,7 +1,9 @@
|
||||
import { useWagons } from '@/hooks/useWagons';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
// import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@edr/ui-common';
|
||||
|
||||
|
||||
export default function WagonsPage() {
|
||||
const { data: wagons, isLoading } = useWagons();
|
||||
@@ -13,7 +15,7 @@ export default function WagonsPage() {
|
||||
<Table>
|
||||
<TableHeader><TableRow><TableHead>Number</TableHead><TableHead>Type</TableHead><TableHead>Train</TableHead><TableHead>Status</TableHead></TableRow></TableHeader>
|
||||
<TableBody>
|
||||
{wagons?.map(w => (
|
||||
{wagons?.map((w:any) => (
|
||||
<TableRow key={w.id}>
|
||||
<TableCell>{w.wagonNumber}</TableCell>
|
||||
<TableCell>{w.wagonTypeId}</TableCell>
|
||||
|
||||
Reference in New Issue
Block a user