feat: integrate batch schedule dialog
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user