feat: integrate batch schedule dialog

This commit is contained in:
mlogclub
2026-04-29 20:16:17 +08:00
parent cc3e80a3cc
commit dedb4e64b1
@@ -8,6 +8,7 @@ import {
CalendarSearchIcon,
ChevronLeftIcon,
ChevronRightIcon,
LayersIcon,
ListIcon,
MoreHorizontalIcon,
PlusIcon,
@@ -49,6 +50,7 @@ import {
type UpdateAdminAgentTeamSchedulePayload,
} from "@/lib/api/admin"
import { formatDateTime } from "@/lib/utils"
import { BatchScheduleDialog } from "./_components/batch-schedule-dialog"
import { ScheduleCalendar } from "./_components/calendar"
import {
addDays,
@@ -89,6 +91,7 @@ export default function DashboardAgentTeamSchedulesPage() {
const [saving, setSaving] = useState(false)
const [actionLoadingId, setActionLoadingId] = useState<number | null>(null)
const [dialogOpen, setDialogOpen] = useState(false)
const [batchDialogOpen, setBatchDialogOpen] = useState(false)
const [editingItem, setEditingItem] = useState<AdminAgentTeamSchedule | null>(null)
const [dialogDefaults, setDialogDefaults] = useState<Partial<CreateAdminAgentTeamSchedulePayload> | null>(null)
const [teams, setTeams] = useState<AdminAgentTeam[]>([])
@@ -232,6 +235,10 @@ export default function DashboardAgentTeamSchedulesPage() {
}
}
async function handleBatchSuccess() {
await refreshActiveView()
}
async function handleDeleteById(id: number) {
setActionLoadingId(id)
try {
@@ -374,6 +381,10 @@ export default function DashboardAgentTeamSchedulesPage() {
<RefreshCwIcon className={loading || calendarLoading ? "animate-spin" : ""} />
</Button>
<Button variant="outline" onClick={() => setBatchDialogOpen(true)}>
<LayersIcon />
</Button>
<Button onClick={() => openCreateDialog()}>
<PlusIcon />
@@ -486,6 +497,11 @@ export default function DashboardAgentTeamSchedulesPage() {
onSubmit={handleSubmit}
onDelete={handleDeleteById}
/>
<BatchScheduleDialog
open={batchDialogOpen}
onOpenChange={setBatchDialogOpen}
onSuccess={handleBatchSuccess}
/>
</>
)
}