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