260617_01_ENH: 배정 테스트를 위해 개발 중도 커밋
This commit is contained in:
220
src/app/(pages)/(main)/assign/page.tsx
Normal file
220
src/app/(pages)/(main)/assign/page.tsx
Normal file
@@ -0,0 +1,220 @@
|
||||
"use client";
|
||||
|
||||
import {useMemo, useRef, useState} from "react";
|
||||
import {Search} from "lucide-react";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {MultiFilterSelect} from "@/components/gwcf/MultiFilterSelect";
|
||||
import {PagePanel} from "@/components/gwcf/PagePanel";
|
||||
import {DataTable} from "@/components/data-table/DataTable";
|
||||
import {DataTableColumn} from "@/components/data-table/DataTable.type";
|
||||
import {SmsSendDialog} from "@/components/dialog/SmsSendDialog";
|
||||
import {AssignMonitoringDialog} from "@/components/dialog/AssignMonitoringDialog";
|
||||
import {useCodesQuery} from "@/query/code";
|
||||
import {usePerformanceListQuery} from "@/query/performance";
|
||||
import {
|
||||
useMonitoringApplyUserCountsQuery,
|
||||
useMonitoringApplyUsersQuery,
|
||||
useSaveMonitoringAssignMutation,
|
||||
} from "@/query/assign";
|
||||
import {filterPerformance, getCodeLabel} from "@/lib/gwcf/view";
|
||||
import {MONITORING_ASSIGN_TYPE} from "@/lib/gwcf/performance-status";
|
||||
import {PerformanceAssign, PerformanceFull} from "@/types/gwcf";
|
||||
import {useDialog} from "@/hooks/useDialog";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {SMS_TEMPLATE_IDS} from "@/query/notification";
|
||||
|
||||
const toParamValue = (value: unknown) => value == null ? "" : String(value);
|
||||
|
||||
const buildPerformanceSmsParams = (performance: PerformanceFull): Record<string, string> => ({
|
||||
businessType: toParamValue(performance.businessType),
|
||||
performanceGenre: toParamValue(performance.performanceGenre),
|
||||
performanceArea: toParamValue(performance.performanceArea),
|
||||
artistName: toParamValue(performance.artistName),
|
||||
performanceName: toParamValue(performance.performanceName),
|
||||
performanceStartMonth: toParamValue(performance.performanceStartMonth),
|
||||
performanceDtInfo: toParamValue(performance.performanceDtInfo),
|
||||
performanceTimeInfo: toParamValue(performance.performanceTimeInfo),
|
||||
ticketReservationStatus: toParamValue(performance.ticketReservationStatus),
|
||||
ticketReservationMemo: toParamValue(performance.ticketReservationMemo),
|
||||
performanceMemo: toParamValue(performance.performanceMemo),
|
||||
...Object.fromEntries(
|
||||
Object.entries(performance.performanceDetail ?? {}).map(([key, value]) => [key, toParamValue(value)])
|
||||
),
|
||||
...Object.fromEntries(
|
||||
Object.entries(performance.performanceMonitoringSchedule ?? {}).map(([key, value]) => [key, toParamValue(value)])
|
||||
),
|
||||
performanceId: toParamValue(performance.id),
|
||||
});
|
||||
|
||||
const AssignPage = () => {
|
||||
const mounted = useMounted();
|
||||
const {data: codes} = useCodesQuery();
|
||||
const {isDialogOpen, showDialog, hideDialog} = useDialog();
|
||||
const {data = [], refetch: refetchPerformanceList} = usePerformanceListQuery();
|
||||
const {data: applyCounts = [], refetch: refetchApplyCounts} = useMonitoringApplyUserCountsQuery();
|
||||
const saveAssignMutation = useSaveMonitoringAssignMutation();
|
||||
const suppressAssignCloseRef = useRef(false);
|
||||
|
||||
const [filters, setFilters] = useState({
|
||||
businessType: [] as string[],
|
||||
area: [] as string[],
|
||||
monitoringDate: "",
|
||||
keyword: "",
|
||||
});
|
||||
const [selected, setSelected] = useState<PerformanceFull | null>(null);
|
||||
const smsAddParam = useMemo(() => selected ? buildPerformanceSmsParams(selected) : {}, [selected]);
|
||||
|
||||
const [smsTargetIds, setSmsTargetIds] = useState<string[]>([]);
|
||||
|
||||
const refreshAssignList = () => {
|
||||
void refetchPerformanceList();
|
||||
void refetchApplyCounts();
|
||||
};
|
||||
|
||||
const updateFilters = (updater: (prev: typeof filters) => typeof filters) => {
|
||||
setFilters(updater);
|
||||
refreshAssignList();
|
||||
};
|
||||
|
||||
const assignOpen = isDialogOpen("assignMonitoringDialog");
|
||||
const smsOpen = isDialogOpen("assignSmsSendDialog");
|
||||
const selectedPerformanceId = selected?.id ?? 0;
|
||||
const {data: applyUsers = []} = useMonitoringApplyUsersQuery(selectedPerformanceId, assignOpen && selectedPerformanceId > 0);
|
||||
const smsTargetUsers = useMemo(
|
||||
() => applyUsers
|
||||
.filter((applyUser) => smsTargetIds.includes(applyUser.userId))
|
||||
.map((applyUser) => applyUser.user),
|
||||
[applyUsers, smsTargetIds]
|
||||
);
|
||||
|
||||
const applyCountMap = useMemo(() => {
|
||||
return new Map(applyCounts.map((item) => [String(item.performanceId), item.applyCnt]));
|
||||
}, [applyCounts]);
|
||||
|
||||
const filteredData = useMemo(() => {
|
||||
return data
|
||||
.filter((item) => filterPerformance(item, filters))
|
||||
.sort((a, b) => {
|
||||
const aDate = a.performanceMonitoringSchedule?.monitoringDate ?? "";
|
||||
const bDate = b.performanceMonitoringSchedule?.monitoringDate ?? "";
|
||||
return bDate.localeCompare(aDate);
|
||||
});
|
||||
}, [data, filters]);
|
||||
|
||||
const openAssign = (performance: PerformanceFull) => {
|
||||
suppressAssignCloseRef.current = false;
|
||||
setSelected(performance);
|
||||
showDialog("assignMonitoringDialog");
|
||||
};
|
||||
|
||||
const applySavedAssignsToSelected = (performanceId: number, monitoringAssigns: PerformanceAssign[]) => {
|
||||
setSelected((prev) => {
|
||||
if (!prev || prev.id !== performanceId) return prev;
|
||||
|
||||
return {
|
||||
...prev,
|
||||
performanceAssignList: [
|
||||
...(prev.performanceAssignList ?? []).filter((assign) => assign.assignType !== MONITORING_ASSIGN_TYPE),
|
||||
...monitoringAssigns,
|
||||
],
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const getMonitoringAssigns = (performance: PerformanceFull) => {
|
||||
return (performance.performanceAssignList ?? []).filter((assign) => assign.assignType === MONITORING_ASSIGN_TYPE);
|
||||
};
|
||||
|
||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||
{accessorKey: "id", header: "연번", cell: ({row}) => row.original.id, enableSorting: true},
|
||||
{accessorKey: "performanceName", header: "사업명", enableSorting: true},
|
||||
{id: "area", header: "지역", cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
||||
{accessorKey: "performanceDtInfo", header: "사업 일정"},
|
||||
{accessorKey: "performanceTimeInfo", header: "운영 시간"},
|
||||
{id: "monitoringDate", header: "모니터링 일정", cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "", enableSorting: true},
|
||||
{id: "monitoringTime", header: "모니터링 시간", cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringTimeInfo ?? ""},
|
||||
{id: "applyCount", header: "신청자 수", cell: ({row}) => applyCountMap.get(String(row.original.id)) ?? 0, enableSorting: true},
|
||||
{id: "requestCount", header: "확정요청 수", cell: ({row}) => getMonitoringAssigns(row.original).length},
|
||||
{id: "confirmedCount", header: "확정인원 수", cell: ({row}) => getMonitoringAssigns(row.original).filter((assign) => assign.assignConfirm).length},
|
||||
], [applyCountMap, codes]);
|
||||
|
||||
if(!mounted) return <LoadingOverlay force={true} />
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<PagePanel>
|
||||
<div className="grid gap-2 md:grid-cols-[160px_160px_180px_1fr_auto]">
|
||||
<MultiFilterSelect value={filters.businessType} onChange={(value) => updateFilters((prev) => ({...prev, businessType: value}))} options={codes.business_type} placeholder="사업 유형" />
|
||||
<MultiFilterSelect value={filters.area} onChange={(value) => updateFilters((prev) => ({...prev, area: value}))} options={codes.area} placeholder="지역" />
|
||||
<Input type="date" value={filters.monitoringDate} onChange={(event) => updateFilters((prev) => ({...prev, monitoringDate: event.target.value}))} />
|
||||
<Input value={filters.keyword} onChange={(event) => updateFilters((prev) => ({...prev, keyword: event.target.value}))} placeholder="연번 or 사업명" />
|
||||
<Button type="button" variant="outline" onClick={refreshAssignList}>
|
||||
<Search className="h-4 w-4" />
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
</PagePanel>
|
||||
|
||||
<PagePanel className="overflow-x-auto">
|
||||
<DataTable columns={columns} data={filteredData} getRowId={(row) => String(row.id)} selectMode="click-event" onRowClick={openAssign} defaultPageSize={10} />
|
||||
</PagePanel>
|
||||
|
||||
<AssignMonitoringDialog
|
||||
open={assignOpen}
|
||||
onOpenChange={(open) => {
|
||||
if (open) {
|
||||
showDialog("assignMonitoringDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
if (suppressAssignCloseRef.current) return;
|
||||
|
||||
hideDialog("assignMonitoringDialog");
|
||||
refreshAssignList();
|
||||
}}
|
||||
selected={selected}
|
||||
codes={codes}
|
||||
applyUsers={applyUsers}
|
||||
isSavingAssign={saveAssignMutation.isPending}
|
||||
onSaveAssign={(performanceId, userIds) =>
|
||||
saveAssignMutation.mutate(
|
||||
{performanceId, userIds},
|
||||
{onSuccess: (monitoringAssigns) => applySavedAssignsToSelected(performanceId, monitoringAssigns)}
|
||||
)
|
||||
}
|
||||
onOpenSms={(userIds) => {
|
||||
suppressAssignCloseRef.current = true;
|
||||
setSmsTargetIds(userIds);
|
||||
showDialog("assignSmsSendDialog", false);
|
||||
}}
|
||||
/>
|
||||
|
||||
<SmsSendDialog
|
||||
open={smsOpen}
|
||||
onOpenChange={(open) => {
|
||||
if (open) {
|
||||
suppressAssignCloseRef.current = true;
|
||||
showDialog("assignSmsSendDialog", false);
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("assignSmsSendDialog");
|
||||
refreshAssignList();
|
||||
window.setTimeout(() => {
|
||||
suppressAssignCloseRef.current = false;
|
||||
}, 0);
|
||||
}}
|
||||
title="확정 문자 발송"
|
||||
templateIdx={SMS_TEMPLATE_IDS.ASSIGN_CONFIRM}
|
||||
newMessageTemplateIdx={SMS_TEMPLATE_IDS.CUSTOM}
|
||||
selectedUsers={smsTargetUsers}
|
||||
addParams={smsAddParam}
|
||||
onSent={refreshAssignList}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AssignPage;
|
||||
@@ -12,7 +12,7 @@ export default async function MainLayoutWrapper({
|
||||
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value;
|
||||
|
||||
if (!accessToken) {
|
||||
//redirect("/logout");
|
||||
redirect("/logout");
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,227 @@
|
||||
'use client'
|
||||
"use client";
|
||||
|
||||
import {useMemo, useState} from "react";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {FilterSelect} from "@/components/gwcf/FilterSelect";
|
||||
import {MonitoringVisitDialog} from "@/components/dialog/MonitoringVisitDialog";
|
||||
import {PerformanceDetailDialog} from "@/components/dialog/PerformanceDetailDialog";
|
||||
import {DataTable} from "@/components/data-table/DataTable";
|
||||
import {DataTableColumn} from "@/components/data-table/DataTable.type";
|
||||
import {usePerformanceDetailQuery, usePerformanceListQuery} from "@/query/performance";
|
||||
import {useCodesQuery} from "@/query/code";
|
||||
import {useSaveArrivalMutation, useSaveDepartureMutation} from "@/query/monitoring";
|
||||
import {MonitoringGpsRequest, PerformanceFull} from "@/types/gwcf";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {useDialog} from "@/hooks/useDialog";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
|
||||
const today = new Date().toISOString().slice(0, 10);
|
||||
|
||||
const MonitoringPage = () => {
|
||||
return (
|
||||
<div>MonitoringPage</div>
|
||||
);
|
||||
}
|
||||
const mounted = useMounted();
|
||||
const {auth} = useAuth();
|
||||
const {isDialogOpen, showDialog, hideDialog} = useDialog();
|
||||
const departureMutation = useSaveDepartureMutation();
|
||||
const arrivalMutation = useSaveArrivalMutation();
|
||||
const {data = [], refetch: refetchPerformanceList} = usePerformanceListQuery();
|
||||
const {data: codes} = useCodesQuery();
|
||||
const userId = auth.user?.userId;
|
||||
|
||||
export default MonitoringPage;
|
||||
const [selectedId, setSelectedId] = useState<number | null>(null);
|
||||
const [visitMode, setVisitMode] = useState<"departure" | "arrival">("departure");
|
||||
|
||||
const refreshMonitoringList = () => {
|
||||
void refetchPerformanceList();
|
||||
};
|
||||
|
||||
|
||||
const assignedItems = useMemo(() => {
|
||||
if (!userId) return [];
|
||||
return data.filter((item) => item.performanceAssignList?.some((assign) => assign.assignUser === userId));
|
||||
}, [data, userId]);
|
||||
|
||||
const todayItems = useMemo(() => {
|
||||
const matched = assignedItems
|
||||
.filter((item) => item.performanceMonitoringSchedule?.monitoringDate === today)
|
||||
.sort((a, b) => a.performanceName.localeCompare(b.performanceName, "ko"));
|
||||
|
||||
return matched.length > 0 ? matched : assignedItems;
|
||||
}, [assignedItems]);
|
||||
|
||||
const selected = useMemo(() => {
|
||||
return todayItems.find((item) => item.id === selectedId) ?? todayItems[0] ?? null;
|
||||
}, [selectedId, todayItems]);
|
||||
|
||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||
{
|
||||
accessorKey: "performanceName",
|
||||
header: "사업명",
|
||||
cell: ({row}) => (
|
||||
<div className="max-w-[180px] whitespace-normal py-2 text-sm font-semibold leading-5">
|
||||
{row.original.performanceName}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: "monitoringDate",
|
||||
header: "일정",
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate?.slice(5) || "-",
|
||||
},
|
||||
{
|
||||
id: "monitoringTime",
|
||||
header: "시간",
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringTimeInfo || "-",
|
||||
},
|
||||
], []);
|
||||
|
||||
const visitOpen = isDialogOpen("monitoringVisitDialog");
|
||||
const detailOpen = isDialogOpen("monitoringDetailDialog");
|
||||
const {data: detailData} = usePerformanceDetailQuery(selected?.id ?? 0, Boolean(selected?.id && detailOpen));
|
||||
|
||||
const openVisit = (mode: "departure" | "arrival") => {
|
||||
setVisitMode(mode);
|
||||
showDialog("monitoringVisitDialog");
|
||||
};
|
||||
|
||||
const getGps = (): Promise<MonitoringGpsRequest> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!navigator.geolocation) {
|
||||
reject(new Error("GPS를 사용할 수 없습니다."));
|
||||
return;
|
||||
}
|
||||
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
(position) => {
|
||||
const {latitude, longitude, accuracy} = position.coords;
|
||||
resolve({
|
||||
gpsLatitude: latitude,
|
||||
gpsLongitude: longitude,
|
||||
gpsAccuracyM: accuracy,
|
||||
gpsRaw: {
|
||||
latitude,
|
||||
longitude,
|
||||
accuracy,
|
||||
timestamp: position.timestamp,
|
||||
},
|
||||
});
|
||||
},
|
||||
(error) => reject(error),
|
||||
{enableHighAccuracy: true, timeout: 10000, maximumAge: 0}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const saveVisit = async (files?: File[]) => {
|
||||
if (!selected) return;
|
||||
|
||||
const gps = await getGps();
|
||||
if (visitMode === "departure") {
|
||||
await departureMutation.mutateAsync({performanceId: selected.id, gps});
|
||||
} else {
|
||||
await arrivalMutation.mutateAsync({performanceId: selected.id, gps, files});
|
||||
}
|
||||
hideDialog("monitoringVisitDialog");
|
||||
refreshMonitoringList();
|
||||
};
|
||||
|
||||
if(!mounted) return <LoadingOverlay force={true} />
|
||||
|
||||
return (
|
||||
<div className="mx-auto min-h-[calc(100vh-160px)] max-w-[430px] bg-white shadow-sm sm:border">
|
||||
<main className="space-y-3 p-3">
|
||||
<FilterSelect
|
||||
value={selected ? String(selected.id) : ""}
|
||||
onChange={(value) => {
|
||||
setSelectedId(Number(value));
|
||||
refreshMonitoringList();
|
||||
}}
|
||||
options={todayItems.map((item) => ({
|
||||
codeGroup: "performance",
|
||||
codeValue: item.id,
|
||||
codeGroupLabel: "사업",
|
||||
codeLabel: item.performanceName,
|
||||
memo: "",
|
||||
}))}
|
||||
placeholder="모니터링 사업 선택"
|
||||
className="w-full"
|
||||
useClear={false}
|
||||
/>
|
||||
|
||||
{selected && (
|
||||
<section className="rounded-md border">
|
||||
<div className="border-b bg-muted px-3 py-2 text-center font-semibold">
|
||||
{selected.performanceMonitoringSchedule?.monitoringDate} {selected.performanceMonitoringSchedule?.monitoringTimeInfo}
|
||||
</div>
|
||||
<div className="grid grid-cols-[80px_1fr] border-b">
|
||||
<div className="bg-muted px-3 py-2 text-sm font-semibold">사업명</div>
|
||||
<div className="px-3 py-2 text-sm">{selected.performanceName}</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-[80px_1fr]">
|
||||
<div className="bg-muted px-3 py-2 text-sm font-semibold">장소</div>
|
||||
<div className="px-3 py-2 text-sm">{selected.performanceMonitoringSchedule?.monitoringAddress}</div>
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<Button type="button" disabled={!selected} onClick={() => openVisit("departure")}>출발</Button>
|
||||
<Button type="button" disabled={!selected} variant="outline" onClick={() => openVisit("arrival")}>도착</Button>
|
||||
</div>
|
||||
|
||||
<section className="space-y-2 overflow-x-auto">
|
||||
<div className="text-sm font-semibold text-muted-foreground">오늘의 모니터링 목록</div>
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={todayItems}
|
||||
getRowId={(row) => String(row.id)}
|
||||
selectMode="click-event"
|
||||
onRowClick={(item) => {
|
||||
setSelectedId(item.id);
|
||||
showDialog("monitoringDetailDialog");
|
||||
}}
|
||||
highlightRowIds={selected ? [String(selected.id)] : []}
|
||||
defaultPageSize={10}
|
||||
pageSizeOptions={[10, 20, 30]}
|
||||
paginationItemsToDisplay={3}
|
||||
/>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<MonitoringVisitDialog
|
||||
open={visitOpen}
|
||||
onOpenChange={(open) => {
|
||||
if (open) {
|
||||
showDialog("monitoringVisitDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("monitoringVisitDialog");
|
||||
refreshMonitoringList();
|
||||
}}
|
||||
performance={selected}
|
||||
mode={visitMode}
|
||||
onSubmit={saveVisit}
|
||||
isSubmitting={departureMutation.isPending || arrivalMutation.isPending}
|
||||
/>
|
||||
|
||||
<PerformanceDetailDialog
|
||||
open={detailOpen}
|
||||
onOpenChange={(open) => {
|
||||
if (open) {
|
||||
showDialog("monitoringDetailDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("monitoringDetailDialog");
|
||||
refreshMonitoringList();
|
||||
}}
|
||||
performance={detailData ?? selected}
|
||||
codes={codes}
|
||||
canEdit={false}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MonitoringPage;
|
||||
|
||||
@@ -4,7 +4,6 @@ import {useAuth} from "@/hooks/useAuth";
|
||||
import {useEffect} from "react";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import {MONITORING_USER_ROLE} from "@/config/gwcf.config";
|
||||
import {useRouter} from "next/navigation";
|
||||
|
||||
const MainPage = () => {
|
||||
|
||||
@@ -1,9 +1,484 @@
|
||||
'use client'
|
||||
"use client";
|
||||
|
||||
import {useMemo, useRef, useState} from "react";
|
||||
import {Search, Upload} from "lucide-react";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {DatePicker} from "@/components/common/DatePicker";
|
||||
import {MultiFilterSelect} from "@/components/gwcf/MultiFilterSelect";
|
||||
import {PagePanel} from "@/components/gwcf/PagePanel";
|
||||
import {StatusPill} from "@/components/gwcf/StatusPill";
|
||||
import {ExcelRegisterDialog} from "@/components/dialog/ExcelRegisterDialog";
|
||||
import {PerformanceDetailDialog} from "@/components/dialog/PerformanceDetailDialog";
|
||||
import {DataTable} from "@/components/data-table/DataTable";
|
||||
import {DataTableColumn} from "@/components/data-table/DataTable.type";
|
||||
import {useCodesQuery} from "@/query/code";
|
||||
import {
|
||||
useDownloadAssignExcelTemplateMutation,
|
||||
useDownloadPerformanceExcelTemplateMutation,
|
||||
usePerformanceDetailQuery,
|
||||
usePerformanceListQuery,
|
||||
useUpdatePerformanceMutation,
|
||||
useUploadPerformanceExcelMutation,
|
||||
} from "@/query/performance";
|
||||
import {useUploadWrittenAssignExcelMutation} from "@/query/assign";
|
||||
import {useDownloadReviewPdfMutation} from "@/query/review";
|
||||
import {useDownloadEvidenceZipMutation} from "@/query/monitoring";
|
||||
import {filterPerformance, getCodeLabel, isInternalRole, isWrittenReviewerRole} from "@/lib/gwcf/view";
|
||||
import {
|
||||
getMonitoringRecordedAt,
|
||||
getMonitoringRecordedUser,
|
||||
getMonitoringSlots,
|
||||
getMonitoringStatusDisplay,
|
||||
getReviewByType,
|
||||
getReviewStatusDisplay,
|
||||
getWrittenReviewRows,
|
||||
getWrittenReviewerSimpleMonitoringStatusDisplay,
|
||||
getWrittenReviewerSimpleReviewStatusDisplay,
|
||||
isReviewComplete,
|
||||
LOCAL_GOVERNMENT_REVIEW_TYPE,
|
||||
} from "@/lib/gwcf/performance-status";
|
||||
import {buildWrittenReviewLink} from "@/config/gwcf.config";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {Code, PerformanceFull, PerformanceReview} from "@/types/gwcf";
|
||||
import {useDialog} from "@/hooks/useDialog";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import {downloadFile} from "@/lib/utils";
|
||||
|
||||
type PerformanceFilters = {
|
||||
businessType: string[];
|
||||
genre: string[];
|
||||
area: string[];
|
||||
startMonth: string[];
|
||||
monitoringDate: string;
|
||||
localReviewStatus: string[];
|
||||
monitoring1Status: string[];
|
||||
monitoring2Status: string[];
|
||||
writtenReviewStatus: string[];
|
||||
keyword: string;
|
||||
};
|
||||
|
||||
const monthOptions: Code[] = Array.from({length: 12}, (_, index) => ({
|
||||
codeGroup: "month",
|
||||
codeValue: index + 1,
|
||||
codeGroupLabel: "사업 수행 월",
|
||||
codeLabel: `${index + 1}월`,
|
||||
memo: "",
|
||||
}));
|
||||
|
||||
const STATUS_FILTER = {
|
||||
UNASSIGNED: "-1001",
|
||||
INCOMPLETE: "-1002",
|
||||
PENDING: "-1003",
|
||||
IN_PROGRESS: "-1004",
|
||||
DEPARTED: "-1005",
|
||||
ARRIVED: "-1006",
|
||||
DONE: "-1007",
|
||||
} as const;
|
||||
|
||||
const makeStatusOption = (value: string, label: string): Code => ({
|
||||
codeGroup: "status_filter",
|
||||
codeValue: Number(value),
|
||||
codeGroupLabel: "상태",
|
||||
codeLabel: label,
|
||||
memo: "",
|
||||
});
|
||||
|
||||
const normalizeStatusLabel = (label?: string) => label?.replace(/\s/g, "") ?? "";
|
||||
const labelHasComplete = (label?: string) => normalizeStatusLabel(label).includes("완료");
|
||||
const labelHasInProgress = (label?: string) => normalizeStatusLabel(label).includes("진행");
|
||||
const labelHasDeparted = (label?: string) => normalizeStatusLabel(label).includes("출발");
|
||||
const labelHasArrived = (label?: string) => normalizeStatusLabel(label).includes("도착");
|
||||
|
||||
const statusFilterOptions = {
|
||||
incomplete: makeStatusOption(STATUS_FILTER.INCOMPLETE, "미완료"),
|
||||
pending: makeStatusOption(STATUS_FILTER.PENDING, "미진행"),
|
||||
inProgress: makeStatusOption(STATUS_FILTER.IN_PROGRESS, "진행중"),
|
||||
departed: makeStatusOption(STATUS_FILTER.DEPARTED, "출발"),
|
||||
arrived: makeStatusOption(STATUS_FILTER.ARRIVED, "도착"),
|
||||
done: makeStatusOption(STATUS_FILTER.DONE, "완료"),
|
||||
};
|
||||
|
||||
const PerformancePage = () => {
|
||||
return (
|
||||
<div>PerformancePage</div>
|
||||
);
|
||||
}
|
||||
const mounted = useMounted();
|
||||
const {auth} = useAuth();
|
||||
const userRole = auth.user?.userRole;
|
||||
const canEdit = isInternalRole(userRole);
|
||||
const isWrittenReviewer = isWrittenReviewerRole(userRole);
|
||||
const {isDialogOpen, showDialog, hideDialog} = useDialog();
|
||||
|
||||
export default PerformancePage;
|
||||
const {data: codes} = useCodesQuery();
|
||||
const {data = [], refetch: refetchPerformanceList} = usePerformanceListQuery();
|
||||
const updateMutation = useUpdatePerformanceMutation();
|
||||
const performanceUploadMutation = useUploadPerformanceExcelMutation();
|
||||
const writtenAssignUploadMutation = useUploadWrittenAssignExcelMutation();
|
||||
const performanceTemplateMutation = useDownloadPerformanceExcelTemplateMutation();
|
||||
const writtenAssignTemplateMutation = useDownloadAssignExcelTemplateMutation();
|
||||
const reviewPdfMutation = useDownloadReviewPdfMutation();
|
||||
const evidenceZipMutation = useDownloadEvidenceZipMutation();
|
||||
|
||||
const [filters, setFilters] = useState<PerformanceFilters>({
|
||||
businessType: [],
|
||||
genre: [],
|
||||
area: [],
|
||||
startMonth: [],
|
||||
monitoringDate: "",
|
||||
localReviewStatus: [],
|
||||
monitoring1Status: [],
|
||||
monitoring2Status: [],
|
||||
writtenReviewStatus: [],
|
||||
keyword: "",
|
||||
});
|
||||
const [selectedId, setSelectedId] = useState<number | null>(null);
|
||||
const lastSelectedRef = useRef<number | null>(null);
|
||||
|
||||
const detailOpen = isDialogOpen("performanceDetailDialog");
|
||||
const performanceRegisterOpen = isDialogOpen("performanceExcelRegisterDialog");
|
||||
const assignWrittenOpen = isDialogOpen("assignWrittenExcelDialog");
|
||||
const {data: detailData} = usePerformanceDetailQuery(selectedId ?? 0, Boolean(selectedId && detailOpen && !isWrittenReviewer));
|
||||
|
||||
const refreshPerformanceList = () => {
|
||||
void refetchPerformanceList();
|
||||
};
|
||||
|
||||
const updateFilters = (updater: (prev: PerformanceFilters) => PerformanceFilters) => {
|
||||
setFilters(updater);
|
||||
refreshPerformanceList();
|
||||
};
|
||||
|
||||
const handlePerformanceDetailOpenChange = (open: boolean) => {
|
||||
if (open) {
|
||||
showDialog("performanceDetailDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("performanceDetailDialog");
|
||||
refreshPerformanceList();
|
||||
};
|
||||
|
||||
const handlePerformanceRegisterOpenChange = (open: boolean) => {
|
||||
if (open) {
|
||||
showDialog("performanceExcelRegisterDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("performanceExcelRegisterDialog");
|
||||
refreshPerformanceList();
|
||||
};
|
||||
|
||||
const handleAssignWrittenOpenChange = (open: boolean) => {
|
||||
if (open) {
|
||||
showDialog("assignWrittenExcelDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("assignWrittenExcelDialog");
|
||||
refreshPerformanceList();
|
||||
};
|
||||
const matchesStatus = (filter: string[], value: string) => filter.length === 0 || filter.includes(value);
|
||||
|
||||
const getReviewFilterValue = (review?: PerformanceReview, allowInProgress = false, alwaysAssigned = false) => {
|
||||
const label = getCodeLabel(codes, "review_status", review?.reviewStatus);
|
||||
|
||||
if (isWrittenReviewer) {
|
||||
if (isReviewComplete(review) || labelHasComplete(label)) return STATUS_FILTER.DONE;
|
||||
return STATUS_FILTER.INCOMPLETE;
|
||||
}
|
||||
|
||||
if (!alwaysAssigned && !review) return STATUS_FILTER.UNASSIGNED;
|
||||
if (isReviewComplete(review) || labelHasComplete(label)) return STATUS_FILTER.DONE;
|
||||
if (allowInProgress && labelHasInProgress(label)) return STATUS_FILTER.IN_PROGRESS;
|
||||
return STATUS_FILTER.PENDING;
|
||||
};
|
||||
|
||||
const getMonitoringFilterValue = (performance: PerformanceFull, index: 0 | 1) => {
|
||||
const slot = getMonitoringSlots(performance)[index];
|
||||
const label = getCodeLabel(codes, "monitoring_visit_status", slot.visit?.monitoringVisitStatus);
|
||||
|
||||
if (isWrittenReviewer) {
|
||||
return slot.visit ? STATUS_FILTER.DONE : STATUS_FILTER.INCOMPLETE;
|
||||
}
|
||||
|
||||
if (!slot.assign) return STATUS_FILTER.UNASSIGNED;
|
||||
if (!slot.visit) return STATUS_FILTER.PENDING;
|
||||
if (labelHasComplete(label)) return STATUS_FILTER.DONE;
|
||||
if (labelHasDeparted(label)) return STATUS_FILTER.DEPARTED;
|
||||
if (labelHasArrived(label)) return STATUS_FILTER.ARRIVED;
|
||||
return STATUS_FILTER.PENDING;
|
||||
};
|
||||
|
||||
const localReviewStatusOptions = isWrittenReviewer
|
||||
? [statusFilterOptions.incomplete, statusFilterOptions.done]
|
||||
: [statusFilterOptions.pending, statusFilterOptions.done];
|
||||
const monitoringStatusOptions = isWrittenReviewer
|
||||
? [statusFilterOptions.incomplete, statusFilterOptions.done]
|
||||
: [statusFilterOptions.pending, statusFilterOptions.departed, statusFilterOptions.arrived, statusFilterOptions.done];
|
||||
const writtenReviewStatusOptions = isWrittenReviewer
|
||||
? [statusFilterOptions.incomplete, statusFilterOptions.done]
|
||||
: [statusFilterOptions.pending, statusFilterOptions.inProgress, statusFilterOptions.done];
|
||||
|
||||
const filteredData = useMemo(() => {
|
||||
return data.filter((item) => {
|
||||
const localReview = getReviewByType(item, LOCAL_GOVERNMENT_REVIEW_TYPE)?.review;
|
||||
const writtenReviewRow = getWrittenReviewRows(item)[0];
|
||||
|
||||
return (
|
||||
filterPerformance(item, {
|
||||
businessType: filters.businessType,
|
||||
genre: filters.genre,
|
||||
area: filters.area,
|
||||
monitoringDate: filters.monitoringDate,
|
||||
keyword: filters.keyword,
|
||||
}) &&
|
||||
matchesStatus(filters.startMonth, String(item.performanceStartMonth)) &&
|
||||
matchesStatus(filters.localReviewStatus, getReviewFilterValue(localReview, false, true)) &&
|
||||
matchesStatus(filters.monitoring1Status, getMonitoringFilterValue(item, 0)) &&
|
||||
matchesStatus(filters.monitoring2Status, getMonitoringFilterValue(item, 1)) &&
|
||||
matchesStatus(filters.writtenReviewStatus, getReviewFilterValue(writtenReviewRow?.review, true, Boolean(writtenReviewRow?.assign)))
|
||||
);
|
||||
});
|
||||
}, [codes, data, filters, isWrittenReviewer]);
|
||||
|
||||
const openDetail = (performance: PerformanceFull) => {
|
||||
if (isWrittenReviewer) return;
|
||||
lastSelectedRef.current = performance.id;
|
||||
setSelectedId(performance.id);
|
||||
showDialog("performanceDetailDialog");
|
||||
};
|
||||
|
||||
const downloadBlob = (buffer: ArrayBuffer, fileName: string, type = "application/octet-stream") => {
|
||||
downloadFile(new Blob([buffer], {type}), fileName);
|
||||
};
|
||||
|
||||
const downloadReviewPdf = async (performanceId: number, review?: PerformanceReview) => {
|
||||
if (!review || !isReviewComplete(review)) return;
|
||||
const buffer = await reviewPdfMutation.mutateAsync({performanceId, reviewType: review.reviewType});
|
||||
downloadBlob(buffer, review.pdfFileName || `review-${performanceId}-${review.reviewType}.pdf`, "application/pdf");
|
||||
};
|
||||
|
||||
const downloadEvidenceZip = async (performanceId: number, userId?: string) => {
|
||||
if (!userId) return;
|
||||
const buffer = await evidenceZipMutation.mutateAsync({performanceId, userId});
|
||||
downloadBlob(buffer, `monitoring-evidence-${performanceId}-${userId}.zip`, "application/zip");
|
||||
};
|
||||
|
||||
const openWrittenReviewLink = (performanceId: number, userId?: string, complete = false) => {
|
||||
if (!userId) return;
|
||||
window.open(buildWrittenReviewLink({performanceId, userId, complete}), "_blank", "noopener,noreferrer");
|
||||
};
|
||||
|
||||
const renderReviewStatus = ({
|
||||
performance,
|
||||
review,
|
||||
userId,
|
||||
useWrittenLink = false,
|
||||
alwaysAssigned = false,
|
||||
noTooltip = false,
|
||||
}: {
|
||||
performance: PerformanceFull;
|
||||
review?: PerformanceReview;
|
||||
userId?: string;
|
||||
useWrittenLink?: boolean;
|
||||
alwaysAssigned?: boolean;
|
||||
noTooltip?: boolean;
|
||||
}) => {
|
||||
const label = getCodeLabel(codes, "review_status", review?.reviewStatus);
|
||||
const display = isWrittenReviewer
|
||||
? getWrittenReviewerSimpleReviewStatusDisplay(review, false, label)
|
||||
: getReviewStatusDisplay(label, review, alwaysAssigned || Boolean(review));
|
||||
const complete = isReviewComplete(review);
|
||||
const onClick = !useWrittenLink && isReviewComplete(review)
|
||||
? () => downloadReviewPdf(performance.id, review)
|
||||
: useWrittenLink
|
||||
? () => openWrittenReviewLink(performance.id, userId, complete)
|
||||
: undefined;
|
||||
|
||||
return (
|
||||
<div className="flex min-w-24 justify-center text-xs">
|
||||
<StatusPill
|
||||
variant={display.variant}
|
||||
onClick={onClick}
|
||||
tooltip={useWrittenLink || noTooltip ? undefined : (
|
||||
<div className="space-y-1">
|
||||
<div>사용자: {userId || "-"}</div>
|
||||
<div>기록일시: -</div>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
{display.label}
|
||||
</StatusPill>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const renderMonitoringStatus = (performance: PerformanceFull, index: 0 | 1) => {
|
||||
const slot = getMonitoringSlots(performance)[index];
|
||||
const label = getCodeLabel(codes, "monitoring_visit_status", slot.visit?.monitoringVisitStatus);
|
||||
const display = isWrittenReviewer
|
||||
? getWrittenReviewerSimpleMonitoringStatusDisplay(slot)
|
||||
: getMonitoringStatusDisplay(label, slot);
|
||||
|
||||
return (
|
||||
<div className="flex min-w-24 justify-center text-xs">
|
||||
<StatusPill
|
||||
variant={display.variant}
|
||||
onClick={!isWrittenReviewer && slot.visit ? () => downloadEvidenceZip(performance.id, slot.assign?.assignUser) : undefined}
|
||||
tooltip={isWrittenReviewer ? undefined : (
|
||||
<div className="space-y-1">
|
||||
<div>사용자: {getMonitoringRecordedUser(slot.visit)}</div>
|
||||
<div>기록일시: {getMonitoringRecordedAt(slot.visit)}</div>
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
{display.label}
|
||||
</StatusPill>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||
{accessorKey: "id", header: "연번", cell: ({row}) => row.original.id, enableSorting: true},
|
||||
{id: "businessType", header: "사업 유형", cell: ({row}) => getCodeLabel(codes, "business_type", row.original.businessType)},
|
||||
{id: "genre", header: "분야(장르)", cell: ({row}) => getCodeLabel(codes, "genre", row.original.performanceGenre)},
|
||||
{id: "area", header: "지역", cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
||||
{accessorKey: "artistName", header: "단체(팀)명", enableSorting: true},
|
||||
{accessorKey: "performanceName", header: "사업명", enableSorting: true},
|
||||
{id: "startMonth", header: "사업 수행 월", cell: ({row}) => `${row.original.performanceStartMonth}월`, enableSorting: true},
|
||||
{accessorKey: "performanceDtInfo", header: "사업 일정"},
|
||||
{accessorKey: "performanceTimeInfo", header: "운영 시간"},
|
||||
...(!isWrittenReviewer ? [{
|
||||
id: "monitoringDate",
|
||||
header: "모니터링 일정",
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||
enableSorting: true,
|
||||
} satisfies DataTableColumn<PerformanceFull>] : []),
|
||||
{
|
||||
id: "localReview",
|
||||
header: "지자체 평가",
|
||||
cell: ({row}) => {
|
||||
const found = getReviewByType(row.original, LOCAL_GOVERNMENT_REVIEW_TYPE);
|
||||
return renderReviewStatus({
|
||||
performance: row.original,
|
||||
review: found?.review,
|
||||
userId: found?.userId,
|
||||
alwaysAssigned: true,
|
||||
noTooltip: isWrittenReviewer,
|
||||
});
|
||||
},
|
||||
},
|
||||
{id: "monitoring1", header: "모니터링 1", cell: ({row}) => renderMonitoringStatus(row.original, 0)},
|
||||
{id: "monitoring2", header: "모니터링 2", cell: ({row}) => renderMonitoringStatus(row.original, 1)},
|
||||
{
|
||||
id: "writtenReview",
|
||||
header: "서면 평가",
|
||||
cell: ({row}) => {
|
||||
const found = getWrittenReviewRows(row.original)[0];
|
||||
return renderReviewStatus({
|
||||
performance: row.original,
|
||||
review: found?.review,
|
||||
userId: found?.userId,
|
||||
useWrittenLink: isWrittenReviewer,
|
||||
alwaysAssigned: Boolean(found?.assign),
|
||||
});
|
||||
},
|
||||
},
|
||||
], [codes, isWrittenReviewer]);
|
||||
|
||||
const downloadPerformanceTemplate = async () => {
|
||||
const buffer = await performanceTemplateMutation.mutateAsync();
|
||||
const blob = new Blob([buffer], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
||||
downloadFile(blob, "사업 등록 template.xlsx");
|
||||
};
|
||||
|
||||
const downloadWrittenAssignTemplate = async () => {
|
||||
const buffer = await writtenAssignTemplateMutation.mutateAsync();
|
||||
const blob = new Blob([buffer], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
||||
downloadFile(blob, "서면 평가 배정 template.xlsx");
|
||||
};
|
||||
|
||||
if(!mounted) return <LoadingOverlay force={true} />
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<PagePanel>
|
||||
<div className="space-y-2">
|
||||
<div className={isWrittenReviewer ? "grid gap-2 md:grid-cols-[280px_170px_140px_140px_1fr_auto]" : "grid gap-2 md:grid-cols-[280px_170px_140px_140px_140px_1fr_auto]"}>
|
||||
<MultiFilterSelect value={filters.businessType} onChange={(value) => updateFilters((prev) => ({...prev, businessType: value}))} options={codes.business_type} placeholder="사업 유형" />
|
||||
<MultiFilterSelect value={filters.genre} onChange={(value) => updateFilters((prev) => ({...prev, genre: value}))} options={codes.genre} placeholder="분야(장르)" />
|
||||
<MultiFilterSelect value={filters.area} onChange={(value) => updateFilters((prev) => ({...prev, area: value}))} options={codes.area} placeholder="지역" />
|
||||
<MultiFilterSelect value={filters.startMonth} onChange={(value) => updateFilters((prev) => ({...prev, startMonth: value}))} options={monthOptions} placeholder="사업 수행 월" />
|
||||
{!isWrittenReviewer && (
|
||||
<DatePicker value={filters.monitoringDate} onChange={(value) => updateFilters((prev) => ({...prev, monitoringDate: value}))} placeholder="모니터링 일정" />
|
||||
)}
|
||||
<Input value={filters.keyword} onChange={(event) => updateFilters((prev) => ({...prev, keyword: event.target.value}))} placeholder="연번 or 사업명" />
|
||||
<Button type="button" variant="outline" onClick={refreshPerformanceList}>
|
||||
<Search className="h-4 w-4" />
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
<div className="grid gap-2 md:grid-cols-[183px_183px_183px_183px]">
|
||||
<MultiFilterSelect value={filters.localReviewStatus} onChange={(value) => updateFilters((prev) => ({...prev, localReviewStatus: value}))} options={localReviewStatusOptions} placeholder="지자체 평가 상태" />
|
||||
<MultiFilterSelect value={filters.monitoring1Status} onChange={(value) => updateFilters((prev) => ({...prev, monitoring1Status: value}))} options={monitoringStatusOptions} placeholder="모니터링1 상태" />
|
||||
<MultiFilterSelect value={filters.monitoring2Status} onChange={(value) => updateFilters((prev) => ({...prev, monitoring2Status: value}))} options={monitoringStatusOptions} placeholder="모니터링2 상태" />
|
||||
<MultiFilterSelect value={filters.writtenReviewStatus} onChange={(value) => updateFilters((prev) => ({...prev, writtenReviewStatus: value}))} options={writtenReviewStatusOptions} placeholder="서면평가 상태" />
|
||||
</div>
|
||||
</div>
|
||||
</PagePanel>
|
||||
|
||||
<PagePanel>
|
||||
{canEdit && (
|
||||
<div className="mb-3 flex justify-end gap-2">
|
||||
<Button type="button" onClick={() => showDialog("performanceExcelRegisterDialog")}>
|
||||
<Upload className="h-4 w-4" />
|
||||
사업 등록
|
||||
</Button>
|
||||
<Button type="button" variant="outline" onClick={() => showDialog("assignWrittenExcelDialog")}>
|
||||
서면 평가 배정
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={filteredData}
|
||||
getRowId={(row) => String(row.id)}
|
||||
selectMode={isWrittenReviewer ? "none" : "click-event"}
|
||||
onRowClick={isWrittenReviewer ? undefined : openDetail}
|
||||
defaultPageSize={10}
|
||||
/>
|
||||
</PagePanel>
|
||||
|
||||
{!isWrittenReviewer && (
|
||||
<PerformanceDetailDialog
|
||||
open={detailOpen}
|
||||
onOpenChange={handlePerformanceDetailOpenChange}
|
||||
performance={detailData ?? data.find((item) => item.id === selectedId) ?? null}
|
||||
codes={codes}
|
||||
canEdit={canEdit}
|
||||
isWrittenReviewer={false}
|
||||
onSave={(draft) => updateMutation.mutate(draft)}
|
||||
/>
|
||||
)}
|
||||
|
||||
<ExcelRegisterDialog
|
||||
open={performanceRegisterOpen}
|
||||
onOpenChange={handlePerformanceRegisterOpenChange}
|
||||
title="사업 등록"
|
||||
onDownloadTemplate={downloadPerformanceTemplate}
|
||||
onUpload={(file) => performanceUploadMutation.mutateAsync(file)}
|
||||
isUploading={performanceUploadMutation.isPending}
|
||||
/>
|
||||
|
||||
<ExcelRegisterDialog
|
||||
open={assignWrittenOpen}
|
||||
onOpenChange={handleAssignWrittenOpenChange}
|
||||
title="서면 평가 위원 배정"
|
||||
onDownloadTemplate={downloadWrittenAssignTemplate}
|
||||
onUpload={(file) => writtenAssignUploadMutation.mutateAsync(file)}
|
||||
isUploading={writtenAssignUploadMutation.isPending}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PerformancePage;
|
||||
|
||||
@@ -1,9 +1,307 @@
|
||||
'use client'
|
||||
"use client";
|
||||
|
||||
const UserPage = () => {
|
||||
return (
|
||||
<div>UserPage</div>
|
||||
);
|
||||
import {MouseEvent, ReactNode, useEffect, useMemo, useRef, useState} from "react";
|
||||
import {Search, Send, Upload} from "lucide-react";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {FilterSelect} from "@/components/gwcf/FilterSelect";
|
||||
import {MultiFilterSelect} from "@/components/gwcf/MultiFilterSelect";
|
||||
import {PagePanel} from "@/components/gwcf/PagePanel";
|
||||
import {ExcelRegisterDialog} from "@/components/dialog/ExcelRegisterDialog";
|
||||
import {SmsSendDialog} from "@/components/dialog/SmsSendDialog";
|
||||
import {DataTable} from "@/components/data-table/DataTable";
|
||||
import {DataTableColumn} from "@/components/data-table/DataTable.type";
|
||||
import {useCodesQuery} from "@/query/code";
|
||||
import {useAssignUserCountsQuery} from "@/query/assign";
|
||||
import {
|
||||
useDeleteUserMutation,
|
||||
useDownloadUserExcelTemplateMutation,
|
||||
useUpdateUserMutation,
|
||||
useUploadUsersExcelMutation,
|
||||
useUsersQuery,
|
||||
} from "@/query/user";
|
||||
import {filterUser, getDetailValue, ROLE} from "@/lib/gwcf/view";
|
||||
import {Code, UserFull} from "@/types/gwcf";
|
||||
import {SMS_TEMPLATE_IDS} from "@/query/notification";
|
||||
import {useDialog} from "@/hooks/useDialog";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {downloadFile} from "@/lib/utils";
|
||||
|
||||
type UserTab = "monitoring" | "written";
|
||||
type UserFilters = {area: string[]; gender: string[]; genre: string[]; keyword: string};
|
||||
|
||||
const tabRole: Record<UserTab, number> = {
|
||||
monitoring: ROLE.MONITORING,
|
||||
written: ROLE.WRITTEN_REVIEWER,
|
||||
};
|
||||
|
||||
function StopCell({children}: {children: ReactNode}) {
|
||||
const stop = (event: MouseEvent<HTMLDivElement>) => event.stopPropagation();
|
||||
return <div onClick={stop}>{children}</div>;
|
||||
}
|
||||
|
||||
export default UserPage;
|
||||
const getOptionLabel = (options: Code[], value: string) => {
|
||||
if (!value) return "";
|
||||
return options.find((option) => String(option.codeValue) === value)?.codeLabel ?? value;
|
||||
};
|
||||
|
||||
const UserPage = () => {
|
||||
const mounted = useMounted();
|
||||
const {data: codes} = useCodesQuery();
|
||||
const {data: assignCounts = [], refetch: refetchAssignCounts} = useAssignUserCountsQuery();
|
||||
const {isDialogOpen, showDialog, hideDialog} = useDialog();
|
||||
const [tab, setTab] = useState<UserTab>("monitoring");
|
||||
const [selectedIds, setSelectedIds] = useState<string[]>([]);
|
||||
const [editingId, setEditingId] = useState<string | null>(null);
|
||||
const [, forceDraftRender] = useState(0);
|
||||
const draftRef = useRef<UserFull | null>(null);
|
||||
const [filters, setFilters] = useState<UserFilters>({area: [], gender: [], genre: [], keyword: ""});
|
||||
|
||||
const userRole = tabRole[tab];
|
||||
const {data = [], refetch: refetchUsers} = useUsersQuery(userRole);
|
||||
const updateMutation = useUpdateUserMutation();
|
||||
const deleteMutation = useDeleteUserMutation();
|
||||
const uploadMutation = useUploadUsersExcelMutation(userRole);
|
||||
const templateMutation = useDownloadUserExcelTemplateMutation(userRole);
|
||||
|
||||
const assignCountMap = useMemo(() => new Map(assignCounts.map((item) => [item.assignUser, item.assignCount])), [assignCounts]);
|
||||
|
||||
const refreshUserList = () => {
|
||||
void refetchUsers();
|
||||
void refetchAssignCounts();
|
||||
};
|
||||
|
||||
const updateFilters = (updater: (prev: UserFilters) => UserFilters) => {
|
||||
setFilters(updater);
|
||||
refreshUserList();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedIds([]);
|
||||
setEditingId(null);
|
||||
draftRef.current = null;
|
||||
forceDraftRender((prev) => prev + 1);
|
||||
setFilters({area: [], gender: [], genre: [], keyword: ""});
|
||||
}, [tab]);
|
||||
|
||||
const filteredData = useMemo(() => data.filter((user) => filterUser(user, filters)), [data, filters]);
|
||||
const smsTargetUsers = useMemo(
|
||||
() => data.filter((user) => selectedIds.includes(user.userId)),
|
||||
[data, selectedIds]
|
||||
);
|
||||
|
||||
const startEdit = (user: UserFull) => {
|
||||
setEditingId(user.userId);
|
||||
draftRef.current = {...user, userDetail: {...user.userDetail}};
|
||||
forceDraftRender((prev) => prev + 1);
|
||||
};
|
||||
|
||||
const updateDraft = (updater: (prev: UserFull) => UserFull) => {
|
||||
if (!draftRef.current) return;
|
||||
draftRef.current = updater(draftRef.current);
|
||||
forceDraftRender((prev) => prev + 1);
|
||||
};
|
||||
|
||||
const updateDetail = (key: string, value: string) => {
|
||||
updateDraft((prev) => ({...prev, userDetail: {...prev.userDetail, [key]: value}}));
|
||||
};
|
||||
|
||||
const saveEdit = () => {
|
||||
if (!draftRef.current) return;
|
||||
updateMutation.mutate(draftRef.current, {
|
||||
onSuccess: () => {
|
||||
alert("사용자 정보가 수정되었습니다.");
|
||||
setEditingId(null);
|
||||
draftRef.current = null;
|
||||
forceDraftRender((prev) => prev + 1);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const deleteUser = (userId: string) => {
|
||||
if (!confirm("사용자 정보가 완전히 지워집니다 정말로 삭제 하시겠습니까?")) return;
|
||||
deleteMutation.mutate(userId, {
|
||||
onSuccess: () => alert("사용자 정보가 삭제되었습니다."),
|
||||
});
|
||||
};
|
||||
|
||||
const downloadTemplate = async () => {
|
||||
const buffer = await templateMutation.mutateAsync();
|
||||
const blob = new Blob([buffer], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});
|
||||
downloadFile(blob, tab === "monitoring" ? "모니터링 요원 template.xlsx" : "서면 평가위원 template.xlsx");
|
||||
};
|
||||
|
||||
const renderEditableCell = (user: UserFull, key: string, fallbackKeys: string[], type: "text" | "select" = "text", options: Code[] = []) => {
|
||||
const draft = draftRef.current;
|
||||
const isEditing = editingId === user.userId && draft;
|
||||
const source = isEditing ? draft.userDetail : user.userDetail;
|
||||
const value = getDetailValue(source, [key, ...fallbackKeys]);
|
||||
|
||||
if (!isEditing) return type === "select" ? (getOptionLabel(options, value) || "-") : (value || "-");
|
||||
|
||||
if (type === "select") {
|
||||
return (
|
||||
<StopCell>
|
||||
<FilterSelect value={value} onChange={(next) => updateDetail(key, next)} options={options} placeholder="선택" className="w-full min-w-28" />
|
||||
</StopCell>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<StopCell>
|
||||
<Input value={value} onChange={(event) => updateDetail(key, event.target.value)} />
|
||||
</StopCell>
|
||||
);
|
||||
};
|
||||
|
||||
const columns = useMemo<DataTableColumn<UserFull>[]>(() => {
|
||||
const commonColumns: DataTableColumn<UserFull>[] = [
|
||||
{accessorKey: "userId", header: "ID", enableSorting: true},
|
||||
{id: "password", header: "PW", cell: () => "****"},
|
||||
];
|
||||
|
||||
const monitoringColumns: DataTableColumn<UserFull>[] = [
|
||||
{id: "participationCount", header: "참여 횟수", cell: ({row}) => assignCountMap.get(row.original.userId) ?? 0, enableSorting: true},
|
||||
{id: "area", header: "지역", cell: ({row}) => renderEditableCell(row.original, "area", ["userArea", "region"], "select", codes.area)},
|
||||
{id: "gender", header: "성별", cell: ({row}) => renderEditableCell(row.original, "gender", ["userGender"], "select", codes.gender)},
|
||||
{id: "age", header: "연령", cell: ({row}) => renderEditableCell(row.original, "age", ["userAge"])},
|
||||
{id: "tel", header: "연락처", cell: ({row}) => renderEditableCell(row.original, "tel", ["phone", "userTel"])},
|
||||
{id: "email", header: "이메일", cell: ({row}) => renderEditableCell(row.original, "email", ["userEmail"])},
|
||||
{id: "hasCar", header: "자차 여부", cell: ({row}) => renderEditableCell(row.original, "userHasCar", ["has_car", "hasCar"], "select", codes.has_car)},
|
||||
];
|
||||
|
||||
const writtenColumns: DataTableColumn<UserFull>[] = [
|
||||
{id: "genre", header: "장르", cell: ({row}) => renderEditableCell(row.original, "userGenre", ["genre", "reviewGenre"], "select", codes.genre)},
|
||||
{id: "tel", header: "연락처", cell: ({row}) => renderEditableCell(row.original, "tel", ["phone", "userTel"])},
|
||||
{id: "email", header: "이메일", cell: ({row}) => renderEditableCell(row.original, "email", ["userEmail"])},
|
||||
];
|
||||
|
||||
const actionColumns: DataTableColumn<UserFull>[] = [
|
||||
{
|
||||
id: "memo",
|
||||
header: "메모",
|
||||
cell: ({row}) => {
|
||||
const draft = draftRef.current;
|
||||
return editingId === row.original.userId && draft ? (
|
||||
<StopCell>
|
||||
<Input value={draft.memo} onChange={(event) => updateDraft((prev) => ({...prev, memo: event.target.value}))} />
|
||||
</StopCell>
|
||||
) : row.original.memo;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "edit",
|
||||
header: "수정",
|
||||
cell: ({row}) => (
|
||||
<StopCell>
|
||||
{editingId === row.original.userId ? (
|
||||
<Button type="button" size="xs" onClick={saveEdit}>저장</Button>
|
||||
) : (
|
||||
<Button type="button" size="xs" variant="outline" onClick={() => startEdit(row.original)}>수정</Button>
|
||||
)}
|
||||
</StopCell>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: "delete",
|
||||
header: "삭제",
|
||||
cell: ({row}) => (
|
||||
<StopCell>
|
||||
<Button type="button" size="xs" variant="destructive" onClick={() => deleteUser(row.original.userId)}>삭제</Button>
|
||||
</StopCell>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return [...commonColumns, ...(tab === "monitoring" ? monitoringColumns : writtenColumns), ...actionColumns];
|
||||
}, [assignCountMap, codes, editingId, tab]);
|
||||
|
||||
if(!mounted) return <LoadingOverlay force={true} />
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex gap-2">
|
||||
<Button type="button" variant={tab === "monitoring" ? "default" : "outline"} onClick={() => setTab("monitoring")}>모니터링</Button>
|
||||
<Button type="button" variant={tab === "written" ? "default" : "outline"} onClick={() => setTab("written")}>서면평가</Button>
|
||||
</div>
|
||||
|
||||
<PagePanel>
|
||||
<div className="grid gap-2 md:grid-cols-[160px_160px_1fr_auto]">
|
||||
{tab === "monitoring" ? (
|
||||
<>
|
||||
<MultiFilterSelect value={filters.area} onChange={(value) => updateFilters((prev) => ({...prev, area: value}))} options={codes.area} placeholder="지역" />
|
||||
<MultiFilterSelect value={filters.gender} onChange={(value) => updateFilters((prev) => ({...prev, gender: value}))} options={codes.gender} placeholder="성별" />
|
||||
</>
|
||||
) : (
|
||||
<MultiFilterSelect value={filters.genre} onChange={(value) => updateFilters((prev) => ({...prev, genre: value}))} options={codes.genre} placeholder="장르" className="md:col-span-2" />
|
||||
)}
|
||||
<Input value={filters.keyword} onChange={(event) => updateFilters((prev) => ({...prev, keyword: event.target.value}))} placeholder={tab === "monitoring" ? "ID or 연락처 or 이메일" : "ID or 이름 or 연락처 or 이메일"} />
|
||||
<Button type="button" variant="outline" onClick={refreshUserList}>
|
||||
<Search className="h-4 w-4" />
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
</PagePanel>
|
||||
|
||||
<PagePanel className="overflow-x-auto">
|
||||
<div className="flex gap-2 justify-end mb-3">
|
||||
{tab === "monitoring" && (
|
||||
<Button type="button" variant="outline" onClick={() => showDialog("userSmsSendDialog")} disabled={selectedIds.length === 0}>
|
||||
<Send className="h-4 w-4" />
|
||||
문자 발송
|
||||
</Button>
|
||||
)}
|
||||
<Button type="button" onClick={() => showDialog("userExcelRegisterDialog")}>
|
||||
<Upload className="h-4 w-4" />
|
||||
계정 등록
|
||||
</Button>
|
||||
</div>
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={filteredData}
|
||||
getRowId={(row) => row.userId}
|
||||
selectMode={tab === "monitoring" ? "multi" : "none"}
|
||||
onRowSelectionChange={(rows) => setSelectedIds(rows.map((row) => row.userId))}
|
||||
defaultPageSize={10}
|
||||
/>
|
||||
</PagePanel>
|
||||
|
||||
<ExcelRegisterDialog
|
||||
open={isDialogOpen("userExcelRegisterDialog")}
|
||||
onOpenChange={(open) => {
|
||||
if (open) {
|
||||
showDialog("userExcelRegisterDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("userExcelRegisterDialog");
|
||||
refreshUserList();
|
||||
}}
|
||||
title="계정 등록"
|
||||
onDownloadTemplate={downloadTemplate}
|
||||
onUpload={(file) => uploadMutation.mutateAsync(file)}
|
||||
isUploading={uploadMutation.isPending}
|
||||
/>
|
||||
|
||||
<SmsSendDialog
|
||||
open={isDialogOpen("userSmsSendDialog")}
|
||||
onOpenChange={(open) => {
|
||||
if (open) {
|
||||
showDialog("userSmsSendDialog");
|
||||
return;
|
||||
}
|
||||
|
||||
hideDialog("userSmsSendDialog");
|
||||
refreshUserList();
|
||||
}}
|
||||
templateIdx={SMS_TEMPLATE_IDS.ACCOUNT_MONITORING}
|
||||
newMessageTemplateIdx={SMS_TEMPLATE_IDS.CUSTOM}
|
||||
selectedUsers={smsTargetUsers}
|
||||
onSent={refreshUserList}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default UserPage;
|
||||
|
||||
116
src/app/api/assign/[[...slug]]/route.ts
Normal file
116
src/app/api/assign/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,116 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createBackApi} from "@/lib/server-api";
|
||||
import {ExcelUploadResult} from "@/types/common";
|
||||
import {AssignUserCount, MonitoringApplyUser, PerformanceApplyCount, PerformanceAssign} from "@/types/gwcf";
|
||||
|
||||
export const GET = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
void req;
|
||||
const {slug = []} = await context.params;
|
||||
const [action, subAction, performanceId] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "monitoring" && subAction === "apply-users" && performanceId === "count" && slug.length === 3) {
|
||||
const result = await backApi.get<PerformanceApplyCount[]>("/assign/monitoring/apply-users/count");
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "monitoring" && subAction === "apply-users" && performanceId && slug.length === 3) {
|
||||
const result = await backApi.get<MonitoringApplyUser[]>(`/assign/monitoring/apply-users/${encodeURIComponent(performanceId)}`);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "users" && subAction === "count" && slug.length === 2) {
|
||||
const result = await backApi.get<AssignUserCount[]>("/assign/users/count");
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const POST = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action, second, third] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "monitoring" && slug.length === 1) {
|
||||
const body = await req.json();
|
||||
const result = await backApi.post<PerformanceAssign[]>("/assign/monitoring", body);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "confirm" && second && third && slug.length === 3) {
|
||||
const result = await backApi.post<string>(
|
||||
`/assign/confirm/${encodeURIComponent(second)}/${encodeURIComponent(third)}`
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if(action === "written" && second === "excel-template"){
|
||||
const result = await backApi.post<ArrayBuffer>(
|
||||
"/assign/written/excel/template",
|
||||
undefined,
|
||||
{ expectBinary: true }
|
||||
);
|
||||
|
||||
return new NextResponse(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "written" && second === "excel-upload" && slug.length === 2) {
|
||||
const formData = await req.formData();
|
||||
const file = formData.get("file") as File | null;
|
||||
|
||||
if (!file) {
|
||||
return NextResponse.json({ message: "file field is required." }, { status: 400 });
|
||||
}
|
||||
|
||||
const backendForm = new FormData();
|
||||
backendForm.append("file", file, file.name);
|
||||
|
||||
const result = await backApi.postForm<ExcelUploadResult>(
|
||||
"/assign/written/excel/upload",
|
||||
backendForm
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const PATCH = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
void req;
|
||||
const {slug = []} = await context.params;
|
||||
const [action, performanceId, userId] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if ((action === "confirm" || action === "cancel") && performanceId && userId && slug.length === 3) {
|
||||
await backApi.patch<void>(
|
||||
`/assign/${action}/${encodeURIComponent(performanceId)}/${encodeURIComponent(userId)}`
|
||||
);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
25
src/app/api/code/[[...slug]]/route.ts
Normal file
25
src/app/api/code/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createBackApi} from "@/lib/server-api";
|
||||
import {Code} from "@/types/gwcf";
|
||||
|
||||
export const GET = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [codeGroup] = slug;
|
||||
|
||||
if (!codeGroup || slug.length !== 1) {
|
||||
return NextResponse.json({ message: "codeGroup is required." }, { status: 400 });
|
||||
}
|
||||
|
||||
const backApi = await createBackApi();
|
||||
const result = await backApi.get<Code[]>(`/code/${encodeURIComponent(codeGroup)}`);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
@@ -66,8 +66,10 @@ export const POST = async (
|
||||
const [action] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if(action === "assign-confirm" && slug.length === 2) {
|
||||
const result = await backApi.post<boolean>(`/assign/confirm/${slug[1]}`)
|
||||
if(action === "assign-confirm" && slug.length === 3) {
|
||||
const result = await backApi.post<string>(
|
||||
`/assign/confirm/${encodeURIComponent(slug[1])}/${encodeURIComponent(slug[2])}`
|
||||
);
|
||||
return withCors(NextResponse.json(result, { status: 200 }));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import {createBackApi} from "@/lib/server-api";
|
||||
import {LoginRequest, LoginResponse} from "@/types/auth";
|
||||
import {serverEnv} from "@/lib/env.server";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {CookieKeys} from "@/store/cookie/cookie-keys";
|
||||
|
||||
export const POST = async (req: NextRequest) => {
|
||||
try {
|
||||
@@ -11,7 +12,7 @@ export const POST = async (req: NextRequest) => {
|
||||
const result = await backApi.post<LoginResponse>("/auth/login", body);
|
||||
|
||||
const res = NextResponse.json(result.user, { status: 200 });
|
||||
res.cookies.set("access_token", result.accessToken, {
|
||||
res.cookies.set(CookieKeys.AuthToken, result.accessToken, {
|
||||
httpOnly: true,
|
||||
secure: serverEnv.ENV === "prod",
|
||||
sameSite: "lax",
|
||||
|
||||
100
src/app/api/monitoring/[[...slug]]/route.ts
Normal file
100
src/app/api/monitoring/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createBackApi} from "@/lib/server-api";
|
||||
import {MonitoringGpsRequest, PerformanceMonitoringVisit} from "@/types/gwcf";
|
||||
|
||||
export const GET = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
void req;
|
||||
const {slug = []} = await context.params;
|
||||
const [action, subAction, third, fourth, fifth] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "visit" && subAction === "evidence" && third && fourth && slug.length === 4) {
|
||||
const result = await backApi.get<PerformanceMonitoringVisit[]>(
|
||||
`/monitoring/visit/evidence/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "visit" && subAction === "evidence" && third === "zip" && fourth && fifth && slug.length === 5) {
|
||||
const result = await backApi.get<ArrayBuffer>(
|
||||
`/monitoring/visit/evidence/zip/${encodeURIComponent(fourth)}/${encodeURIComponent(fifth)}`,
|
||||
{ expectBinary: true }
|
||||
);
|
||||
|
||||
return new NextResponse(result, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/zip",
|
||||
"Content-Disposition": `attachment; filename="monitoring-evidence-${fourth}-${fifth}.zip"`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const POST = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action, subAction, performanceId] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "visit" && subAction === "departure" && performanceId && slug.length === 3) {
|
||||
const body = await req.json().catch(() => null) as MonitoringGpsRequest | null;
|
||||
if (!body) {
|
||||
return NextResponse.json({ message: "Request body is required." }, { status: 400 });
|
||||
}
|
||||
|
||||
const result = await backApi.post<PerformanceMonitoringVisit>(
|
||||
`/monitoring/visit/departure/${encodeURIComponent(performanceId)}`,
|
||||
body
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "visit" && subAction === "arrival" && performanceId && slug.length === 3) {
|
||||
const formData = await req.formData();
|
||||
const gpsPart = formData.get("gps");
|
||||
|
||||
if (!gpsPart) {
|
||||
return NextResponse.json({ message: "gps field is required." }, { status: 400 });
|
||||
}
|
||||
|
||||
const backendForm = new FormData();
|
||||
|
||||
if (gpsPart instanceof File) {
|
||||
backendForm.append("gps", gpsPart, gpsPart.name);
|
||||
} else {
|
||||
backendForm.append("gps", new Blob([String(gpsPart)], {type: "application/json"}));
|
||||
}
|
||||
|
||||
formData.getAll("files").forEach((file) => {
|
||||
if (file instanceof File) {
|
||||
backendForm.append("files", file, file.name);
|
||||
}
|
||||
});
|
||||
|
||||
const result = await backApi.postForm<PerformanceMonitoringVisit>(
|
||||
`/monitoring/visit/arrival/${encodeURIComponent(performanceId)}`,
|
||||
backendForm
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
117
src/app/api/notification/[[...slug]]/route.ts
Normal file
117
src/app/api/notification/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createNotiHubApi} from "@/lib/server-api";
|
||||
import {
|
||||
BulkSendResponse,
|
||||
SaveTemplateRequest,
|
||||
SendSmsBulkRequest,
|
||||
Template,
|
||||
} from "@/types/notification";
|
||||
|
||||
export const GET = async (
|
||||
_req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action, templateIdx] = slug;
|
||||
|
||||
if (action !== "template" || !templateIdx) {
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const notiHubApi = await createNotiHubApi();
|
||||
const template = await notiHubApi.get<Template>(`/template/${encodeURIComponent(templateIdx)}`);
|
||||
|
||||
return NextResponse.json(template, { status: 200 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const PATCH = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action] = slug;
|
||||
|
||||
if (action !== "template") {
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const body = await req.json().catch(() => null) as SaveTemplateRequest | null;
|
||||
if (!body || !body.tmplatIdx) {
|
||||
return NextResponse.json({ message: "Template request body is invalid." }, { status: 400 });
|
||||
}
|
||||
|
||||
const notiHubApi = await createNotiHubApi();
|
||||
const current = await notiHubApi.get<Template>(`/template/${body.tmplatIdx}`);
|
||||
const next: Template = {
|
||||
...current,
|
||||
tmplatNm: body.tmplatNm,
|
||||
tmplatTitle: body.tmplatTitle,
|
||||
tmplatBody: body.tmplatBody,
|
||||
sendTel: body.sendTel,
|
||||
};
|
||||
|
||||
await notiHubApi.patch<void>("/template", next);
|
||||
|
||||
return NextResponse.json(next, { status: 200 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const POST = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action] = slug;
|
||||
|
||||
if (action !== "sms-bulk") {
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const body = await req.json().catch(() => null) as SendSmsBulkRequest | null;
|
||||
if (
|
||||
!body ||
|
||||
!body.templateIdx ||
|
||||
!body.reqstCmpn ||
|
||||
!body.reqstUser ||
|
||||
!body.reqstSvc ||
|
||||
!Array.isArray(body.destinations) ||
|
||||
body.destinations.length === 0
|
||||
) {
|
||||
return NextResponse.json({ message: "SMS request body is invalid." }, { status: 400 });
|
||||
}
|
||||
|
||||
const notiHubApi = await createNotiHubApi();
|
||||
const template = await notiHubApi.get<Template>(`/template/${body.templateIdx}`);
|
||||
|
||||
const bulkSendKey = await notiHubApi.put<string>("/send-sms/create/bulk", {
|
||||
reqstCmpn: body.reqstCmpn,
|
||||
reqstUser: body.reqstUser,
|
||||
reqstSvc: body.reqstSvc,
|
||||
prjctCd: template.itrntPrjctCd,
|
||||
tmplatIdx: template.tmplatIdx,
|
||||
resve: false,
|
||||
trgtCnt: body.destinations.length,
|
||||
});
|
||||
|
||||
const result = await notiHubApi.post<BulkSendResponse>("/send-sms/bulk", {
|
||||
sendTel: template.sendTel,
|
||||
sendNm: template.sendNm,
|
||||
bulkSendKey,
|
||||
destInfoList: body.destinations,
|
||||
});
|
||||
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
124
src/app/api/performance/[[...slug]]/route.ts
Normal file
124
src/app/api/performance/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,124 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createBackApi} from "@/lib/server-api";
|
||||
import {ExcelUploadResult} from "@/types/common";
|
||||
import {PerformanceCompact, PerformanceFull} from "@/types/gwcf";
|
||||
|
||||
export const GET = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "list" && slug.length === 1) {
|
||||
const result = await backApi.get<PerformanceFull[]>("/performance/list");
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "list" && slug[1] === "compact" && slug.length === 2) {
|
||||
const result = await backApi.get<PerformanceCompact[]>("/performance/list/compact");
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (slug.length === 1 && action) {
|
||||
const result = await backApi.get<PerformanceFull>(`/performance/${encodeURIComponent(action)}`);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const POST = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "excel-upload" && slug.length === 1) {
|
||||
const formData = await req.formData();
|
||||
const file = formData.get("file") as File | null;
|
||||
|
||||
if (!file) {
|
||||
return NextResponse.json({ message: "file field is required." }, { status: 400 });
|
||||
}
|
||||
|
||||
const backendForm = new FormData();
|
||||
backendForm.append("file", file, file.name);
|
||||
|
||||
const result = await backApi.postForm<ExcelUploadResult>(
|
||||
"/performance/excel/upload",
|
||||
backendForm
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "excel-template" && slug.length === 1) {
|
||||
const result = await backApi.post<ArrayBuffer>(
|
||||
"/performance/excel/template",
|
||||
undefined,
|
||||
{ expectBinary: true }
|
||||
);
|
||||
|
||||
return new NextResponse(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const PATCH = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (!action) {
|
||||
const body = await req.json().catch(() => null);
|
||||
if (!body) {
|
||||
return NextResponse.json({ message: "Request body is required." }, { status: 400 });
|
||||
}
|
||||
|
||||
await backApi.patch<void>("/performance", body);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const DELETE = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [performanceId] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (performanceId && slug.length === 1) {
|
||||
await backApi.del<void>(`/performance/${encodeURIComponent(performanceId)}`);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
104
src/app/api/review/[[...slug]]/route.ts
Normal file
104
src/app/api/review/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,104 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createBackApi} from "@/lib/server-api";
|
||||
import {PerformanceReview} from "@/types/gwcf";
|
||||
|
||||
const reviewFileName = (prefix: string, performanceId: string, reviewType: string) =>
|
||||
`${prefix}-${performanceId}-${reviewType}`;
|
||||
|
||||
export const GET = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
void req;
|
||||
const {slug = []} = await context.params;
|
||||
const [action, second, third] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "download" && second && third && slug.length === 3) {
|
||||
const result = await backApi.get<ArrayBuffer>(
|
||||
`/review/download/${encodeURIComponent(second)}/${encodeURIComponent(third)}`,
|
||||
{ expectBinary: true }
|
||||
);
|
||||
|
||||
return new NextResponse(result, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/octet-stream",
|
||||
"Content-Disposition": `attachment; filename="${reviewFileName("review-original", second, third)}"`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (action === "pdf" && second && third && slug.length === 3) {
|
||||
const result = await backApi.get<ArrayBuffer>(
|
||||
`/review/pdf/${encodeURIComponent(second)}/${encodeURIComponent(third)}`,
|
||||
{ expectBinary: true }
|
||||
);
|
||||
|
||||
return new NextResponse(result, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/pdf",
|
||||
"Content-Disposition": `attachment; filename="${reviewFileName("review-pdf", second, third)}.pdf"`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (action && second && slug.length === 2) {
|
||||
const result = await backApi.get<PerformanceReview>(
|
||||
`/review/${encodeURIComponent(action)}/${encodeURIComponent(second)}`
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const POST = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action, second, third] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "start" && second && slug.length === 2) {
|
||||
await backApi.post<void>(`/review/start/${encodeURIComponent(second)}`);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
if (action === "end" && second && third && slug.length === 3) {
|
||||
await backApi.post<void>(`/review/end/${encodeURIComponent(second)}/${encodeURIComponent(third)}`);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
if (action && second && slug.length === 2) {
|
||||
const formData = await req.formData();
|
||||
const file = formData.get("file") as File | null;
|
||||
|
||||
if (!file) {
|
||||
return NextResponse.json({ message: "file field is required." }, { status: 400 });
|
||||
}
|
||||
|
||||
const backendForm = new FormData();
|
||||
backendForm.append("file", file, file.name);
|
||||
|
||||
const result = await backApi.postForm<PerformanceReview>(
|
||||
`/review/${encodeURIComponent(action)}/${encodeURIComponent(second)}`,
|
||||
backendForm
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
125
src/app/api/user/[[...slug]]/route.ts
Normal file
125
src/app/api/user/[[...slug]]/route.ts
Normal file
@@ -0,0 +1,125 @@
|
||||
import {NextRequest, NextResponse} from "next/server";
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {errorToResponse} from "@/lib/http-util";
|
||||
import {createBackApi} from "@/lib/server-api";
|
||||
import {ExcelUploadResult} from "@/types/common";
|
||||
import {UserFull} from "@/types/gwcf";
|
||||
|
||||
export const GET = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "list" && slug.length === 2) {
|
||||
const result = await backApi.get<UserFull[]>(`/user/list/${encodeURIComponent(slug[1])}`);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (slug.length === 1 && action) {
|
||||
const result = await backApi.get<UserFull>(`/user/${encodeURIComponent(action)}`);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const POST = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (action === "excel-upload" && slug.length === 2) {
|
||||
const formData = await req.formData();
|
||||
const file = formData.get("file") as File | null;
|
||||
|
||||
if (!file) {
|
||||
return NextResponse.json({ message: "file field is required." }, { status: 400 });
|
||||
}
|
||||
|
||||
const backendForm = new FormData();
|
||||
backendForm.append("file", file, file.name);
|
||||
|
||||
const result = await backApi.postForm<ExcelUploadResult>(
|
||||
`/user/excel/upload/${encodeURIComponent(slug[1])}`,
|
||||
backendForm
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "excel-template" && slug.length === 2) {
|
||||
const result = await backApi.post<ArrayBuffer>(
|
||||
`/user/excel/template/${encodeURIComponent(slug[1])}`,
|
||||
undefined,
|
||||
{ expectBinary: true }
|
||||
);
|
||||
|
||||
return new NextResponse(result, {
|
||||
status: 200,
|
||||
headers: {
|
||||
"Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"Content-Disposition": `attachment; filename="user_${slug[1]}_template.xlsx"`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const PATCH = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [action] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (!action) {
|
||||
const body = await req.json().catch(() => null);
|
||||
if (!body) {
|
||||
return NextResponse.json({ message: "Request body is required." }, { status: 400 });
|
||||
}
|
||||
|
||||
await backApi.patch<void>("/user", body);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const DELETE = async (
|
||||
req: NextRequest,
|
||||
context: RouteContext
|
||||
) => {
|
||||
try {
|
||||
const {slug = []} = await context.params;
|
||||
const [userId] = slug;
|
||||
const backApi = await createBackApi();
|
||||
|
||||
if (userId && slug.length === 1) {
|
||||
await backApi.del<void>(`/user/${encodeURIComponent(userId)}`);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
@@ -188,14 +188,18 @@
|
||||
--status-departed-bg: #ecedf7;
|
||||
--status-departed-fg: #272154;
|
||||
|
||||
--status-arrived: #35b6b4; /* 3 도착: CI Emerald Green (메인컬러) */
|
||||
--status-arrived-bg: #e6f8f8;
|
||||
--status-arrived-fg: #1e9896;
|
||||
--status-arrived: #0072a3; /* 3 도착: blue-cyan, 완료와 구분 */
|
||||
--status-arrived-bg: #e8f6fb;
|
||||
--status-arrived-fg: #005f86;
|
||||
|
||||
--status-done: #004844; /* 10 완료: CI Deep Green — 최종 완결 */
|
||||
--status-done-bg: #e0f0ef;
|
||||
--status-done-fg: #004844;
|
||||
|
||||
--status-danger: var(--destructive);
|
||||
--status-danger-bg: #fff0f0;
|
||||
--status-danger-fg: #b91c1c;
|
||||
|
||||
/* Excel */
|
||||
--excel: #1d6f42;
|
||||
--excel-foreground: #ffffff;
|
||||
@@ -309,14 +313,18 @@
|
||||
--status-departed-bg: #1a1b2e;
|
||||
--status-departed-fg: #9fa1d6;
|
||||
|
||||
--status-arrived: #5ec7c5;
|
||||
--status-arrived-bg: #0d2e2e;
|
||||
--status-arrived-fg: #92d9d8;
|
||||
--status-arrived: #00a0d4;
|
||||
--status-arrived-bg: #082838;
|
||||
--status-arrived-fg: #7ddcff;
|
||||
|
||||
--status-done: #28aaa8;
|
||||
--status-done-bg: #0a1f1f;
|
||||
--status-done-fg: #5ec7c5;
|
||||
|
||||
--status-danger: #e03333;
|
||||
--status-danger-bg: #2e1111;
|
||||
--status-danger-fg: #ff8a8a;
|
||||
|
||||
/* Excel */
|
||||
--excel: #28a852;
|
||||
--excel-foreground: #ffffff;
|
||||
@@ -479,18 +487,21 @@
|
||||
.bg-status-departed { background-color: var(--status-departed-bg) !important; }
|
||||
.bg-status-arrived { background-color: var(--status-arrived-bg) !important; }
|
||||
.bg-status-done { background-color: var(--status-done-bg) !important; }
|
||||
.bg-status-danger { background-color: var(--status-danger-bg) !important; }
|
||||
|
||||
.text-status-pending { color: var(--status-pending-fg) !important; }
|
||||
.text-status-inprogress { color: var(--status-inprogress-fg) !important; }
|
||||
.text-status-departed { color: var(--status-departed-fg) !important; }
|
||||
.text-status-arrived { color: var(--status-arrived-fg) !important; }
|
||||
.text-status-done { color: var(--status-done-fg) !important; }
|
||||
.text-status-danger { color: var(--status-danger-fg) !important; }
|
||||
|
||||
.border-status-pending { border-color: var(--status-pending) !important; }
|
||||
.border-status-inprogress { border-color: var(--status-inprogress) !important; }
|
||||
.border-status-departed { border-color: var(--status-departed) !important; }
|
||||
.border-status-arrived { border-color: var(--status-arrived) !important; }
|
||||
.border-status-done { border-color: var(--status-done) !important; }
|
||||
.border-status-danger { border-color: var(--status-danger) !important; }
|
||||
|
||||
/* =============================
|
||||
Content Text Size Utilities
|
||||
@@ -818,4 +829,10 @@
|
||||
color: var(--status-done-fg);
|
||||
border-color: var(--status-done);
|
||||
}
|
||||
|
||||
.gwcf-status-badge--danger {
|
||||
background-color: var(--status-danger-bg);
|
||||
color: var(--status-danger-fg);
|
||||
border-color: var(--status-danger);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user