mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 13:05:44 +00:00
Fix checkin time cutoff
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useState, useEffect, useRef } from 'react';
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { Plus, Loader2, Zap, Trash2, Edit, Search, X, GripVertical } from 'lucide-react';
|
||||
import { Plus, Loader2, Zap, Trash2, Edit, Search, X, GripVertical, RefreshCw } from 'lucide-react';
|
||||
import DataTable from '@/components/ui/DataTable';
|
||||
import ActionButton from '@/components/ui/ActionButton';
|
||||
import Modal from '@/components/ui/Modal';
|
||||
@@ -210,6 +210,13 @@ export default function SchedulesPage() {
|
||||
},
|
||||
});
|
||||
|
||||
const recalculateStopsMutation = useMutation({
|
||||
mutationFn: (id: string) => apiClient.post(`/schedules/${id}/recalculate-stops`, {}),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['schedules'] });
|
||||
},
|
||||
});
|
||||
|
||||
const deleteScheduleMutation = useMutation({
|
||||
mutationFn: ({ id, cascade }: { id: string; cascade?: boolean }) => apiClient.delete(`/schedules/${id}${cascade ? '?cascade=true' : ''}`),
|
||||
onSuccess: () => {
|
||||
@@ -1130,6 +1137,15 @@ export default function SchedulesPage() {
|
||||
>
|
||||
Cancel
|
||||
</ActionButton>
|
||||
<ActionButton
|
||||
type="button"
|
||||
variant="secondary"
|
||||
icon={RefreshCw}
|
||||
loading={recalculateStopsMutation.isPending}
|
||||
onClick={() => editingSchedule && recalculateStopsMutation.mutate(editingSchedule.id)}
|
||||
>
|
||||
Recalculate Stop Times
|
||||
</ActionButton>
|
||||
<ActionButton type="submit" loading={updateScheduleMutation.isPending}>
|
||||
Update Schedule
|
||||
</ActionButton>
|
||||
|
||||
Reference in New Issue
Block a user