260624_05_ENH: 문자발송 팝업 다중 템플릿 적용
This commit is contained in:
@@ -43,10 +43,15 @@ const AssignPage = () => {
|
||||
keyword: "",
|
||||
});
|
||||
const [selected, setSelected] = useState<PerformanceFull | null>(null);
|
||||
const smsAddParam = useMemo(() => selected ? buildPerformanceSmsParams(selected) : {}, [selected]);
|
||||
|
||||
const [assignSaveTargetIds, setAssignSaveTargetIds] = useState<string[]>([]);
|
||||
|
||||
type SmsMode = "assignConfirm" | "normal";
|
||||
const [smsMode, setSmsMode] = useState<SmsMode>("assignConfirm");
|
||||
const [smsTargetIds, setSmsTargetIds] = useState<string[]>([]);
|
||||
const [smsTemplateIdx, setSmsTemplateIdx] = useState<number[]>([]);
|
||||
const [smsDialogTitle, setSmsDialogTitle] = useState<string>("");
|
||||
const [newSmsTemplateIdx, setNewSmsTemplateIdx] = useState<number|undefined>(undefined);
|
||||
const smsAddParam = useMemo(() => selected ? buildPerformanceSmsParams(selected) : {}, [selected]);
|
||||
|
||||
const refreshAssignList = () => {
|
||||
void refetchPerformanceList();
|
||||
@@ -115,17 +120,35 @@ const AssignPage = () => {
|
||||
return (performance.performanceAssignList ?? []).filter((assign) => assign.assignType === MONITORING_ASSIGN_TYPE);
|
||||
};
|
||||
|
||||
const smsBeforeSendProps =
|
||||
smsMode === "assignConfirm"
|
||||
? {
|
||||
isBeforeSendPending: saveAssignMutation.isPending,
|
||||
onBeforeDefaultTemplateSend: async () => {
|
||||
if (!selected) throw new Error("공연 정보가 없습니다.");
|
||||
|
||||
const monitoringAssigns = await saveAssignMutation.mutateAsync({
|
||||
performanceId: selected.id,
|
||||
userIds: assignSaveTargetIds,
|
||||
});
|
||||
|
||||
applySavedAssignsToSelected(selected.id, monitoringAssigns);
|
||||
},
|
||||
onSent: refreshAssignList,
|
||||
}
|
||||
: {};
|
||||
|
||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||
{accessorKey: "id", header: PERFORMANCE_FIELD_LABELS.id, cell: ({row}) => row.original.id, enableSorting: true},
|
||||
{accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName, enableSorting: true},
|
||||
{accessorKey: "id", header: PERFORMANCE_FIELD_LABELS.id, cell: ({row}) => row.original.id},
|
||||
{accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName},
|
||||
{id: "area", header: PERFORMANCE_FIELD_LABELS.performanceArea, cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
||||
{accessorKey: "performanceDtInfo", header: PERFORMANCE_FIELD_LABELS.performanceDtInfo},
|
||||
{accessorKey: "performanceTimeInfo", header: PERFORMANCE_FIELD_LABELS.performanceTimeInfo},
|
||||
{id: "monitoringDate", header: PERFORMANCE_FIELD_LABELS.monitoringDate, cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "", enableSorting: true},
|
||||
{accessorKey: "performanceDtInfo", header: PERFORMANCE_FIELD_LABELS.performanceDtInfo, enableSorting: false},
|
||||
{accessorKey: "performanceTimeInfo", header: PERFORMANCE_FIELD_LABELS.performanceTimeInfo, enableSorting: false},
|
||||
{id: "monitoringDate", header: PERFORMANCE_FIELD_LABELS.monitoringDate, accessorFn:(row) => row.performanceMonitoringSchedule?.monitoringDate ?? "", cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? ""},
|
||||
{id: "monitoringTime", header: PERFORMANCE_FIELD_LABELS.monitoringTimeInfo, 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},
|
||||
{id: "applyCount", header: "신청자 수", accessorFn:((row) => applyCountMap.get(String(row.id)) ?? 0), cell: ({row}) => applyCountMap.get(String(row.original.id)) ?? 0},
|
||||
{id: "requestCount", header: "확정요청 수", accessorFn:((row) => getMonitoringAssigns(row).length), cell: ({row}) => getMonitoringAssigns(row.original).length},
|
||||
{id: "confirmedCount", header: "확정인원 수", accessorFn:((row) => getMonitoringAssigns(row).filter((assign) => assign.assignConfirm ).length), cell: ({row}) => getMonitoringAssigns(row.original).filter((assign) => assign.assignConfirm).length},
|
||||
], [applyCountMap, codes]);
|
||||
|
||||
if(!mounted) return <LoadingOverlay force={true} />
|
||||
@@ -172,10 +195,29 @@ const AssignPage = () => {
|
||||
{onSuccess: (monitoringAssigns) => applySavedAssignsToSelected(performanceId, monitoringAssigns)}
|
||||
)
|
||||
}
|
||||
onOpenSms={(assignUserIds, smsUserIds) => {
|
||||
onOpenAssignSms={(assignUserIds, smsUserIds) => {
|
||||
suppressAssignCloseRef.current = true;
|
||||
|
||||
setAssignSaveTargetIds(assignUserIds);
|
||||
setSmsTargetIds(smsUserIds);
|
||||
|
||||
setSmsMode("assignConfirm");
|
||||
setSmsTemplateIdx([SMS_TEMPLATE_IDS.ASSIGN_CONFIRM])
|
||||
setSmsDialogTitle("확정 문자 발송")
|
||||
setNewSmsTemplateIdx(undefined);
|
||||
|
||||
showDialog("assignSmsSendDialog", false);
|
||||
}}
|
||||
onOpenNormalSms={(smsUserIds) => {
|
||||
suppressAssignCloseRef.current = true;
|
||||
|
||||
setSmsTargetIds(smsUserIds);
|
||||
|
||||
setSmsMode("normal");
|
||||
setSmsTemplateIdx([SMS_TEMPLATE_IDS.INFORM_ASSIGN, SMS_TEMPLATE_IDS.REMIND_ASSIGN])
|
||||
setSmsDialogTitle("문자 발송")
|
||||
setNewSmsTemplateIdx(SMS_TEMPLATE_IDS.CUSTOM);
|
||||
|
||||
showDialog("assignSmsSendDialog", false);
|
||||
}}
|
||||
/>
|
||||
@@ -195,22 +237,13 @@ const AssignPage = () => {
|
||||
suppressAssignCloseRef.current = false;
|
||||
}, 0);
|
||||
}}
|
||||
title="확정 문자 발송"
|
||||
templateIdx={SMS_TEMPLATE_IDS.ASSIGN_CONFIRM}
|
||||
newMessageTemplateIdx={SMS_TEMPLATE_IDS.CUSTOM}
|
||||
title={smsDialogTitle}
|
||||
templateIdx={smsTemplateIdx}
|
||||
newMessageTemplateIdx={newSmsTemplateIdx}
|
||||
selectedUsers={smsTargetUsers}
|
||||
addParams={smsAddParam}
|
||||
denyParamKeys={["userCmpn", "userTeam", "userRole", "id"]}
|
||||
isBeforeSendPending={saveAssignMutation.isPending}
|
||||
onBeforeDefaultTemplateSend={async () => {
|
||||
if (!selected) throw new Error("공연 정보가 없습니다.");
|
||||
const monitoringAssigns = await saveAssignMutation.mutateAsync({
|
||||
performanceId: selected.id,
|
||||
userIds: assignSaveTargetIds,
|
||||
});
|
||||
applySavedAssignsToSelected(selected.id, monitoringAssigns);
|
||||
}}
|
||||
onSent={refreshAssignList}
|
||||
{...smsBeforeSendProps}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -319,20 +319,22 @@ const PerformancePage = () => {
|
||||
};
|
||||
|
||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||
{accessorKey: "id", header: PERFORMANCE_FIELD_LABELS.id, cell: ({row}) => row.original.id, enableSorting: true},
|
||||
{accessorKey: "id", header: PERFORMANCE_FIELD_LABELS.id, cell: ({row}) => row.original.id},
|
||||
{id: "businessType", header: PERFORMANCE_FIELD_LABELS.businessType, cell: ({row}) => getCodeLabel(codes, "business_type", row.original.businessType)},
|
||||
{id: "genre", header: PERFORMANCE_FIELD_LABELS.performanceGenre, cell: ({row}) => getCodeLabel(codes, "genre", row.original.performanceGenre)},
|
||||
{id: "area", header: PERFORMANCE_FIELD_LABELS.performanceArea, cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
||||
{accessorKey: "artistName", header: PERFORMANCE_FIELD_LABELS.artistName, enableSorting: true},
|
||||
{accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName, enableSorting: true},
|
||||
{id: "startMonth", header: PERFORMANCE_FIELD_LABELS.performanceStartMonth, cell: ({row}) => `${row.original.performanceStartMonth}월`, enableSorting: true},
|
||||
{accessorKey: "performanceDtInfo", header: PERFORMANCE_FIELD_LABELS.performanceDtInfo},
|
||||
{accessorKey: "performanceTimeInfo", header: PERFORMANCE_FIELD_LABELS.performanceTimeInfo},
|
||||
{accessorKey: "artistName", header: PERFORMANCE_FIELD_LABELS.artistName},
|
||||
{accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName},
|
||||
{id: "startMonth", header: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
||||
accessorFn: (row) => row.performanceStartMonth ?? 99,
|
||||
cell: ({row}) => `${row.original.performanceStartMonth}월`},
|
||||
{accessorKey: "performanceDtInfo", header: PERFORMANCE_FIELD_LABELS.performanceDtInfo, enableSorting: false},
|
||||
{accessorKey: "performanceTimeInfo", header: PERFORMANCE_FIELD_LABELS.performanceTimeInfo, enableSorting: false},
|
||||
...(!isWrittenReviewer ? [{
|
||||
id: "monitoringDate",
|
||||
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
||||
accessorFn: (row) => row.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||
enableSorting: true,
|
||||
} satisfies DataTableColumn<PerformanceFull>] : []),
|
||||
{
|
||||
id: "localReview",
|
||||
|
||||
@@ -172,12 +172,12 @@ const UserPage = () => {
|
||||
|
||||
const columns = useMemo<DataTableColumn<UserFull>[]>(() => {
|
||||
const commonColumns: DataTableColumn<UserFull>[] = [
|
||||
{accessorKey: "userId", header: USER_FIELD_LABELS.userId, enableSorting: true},
|
||||
{accessorKey: "userId", header: USER_FIELD_LABELS.userId},
|
||||
{id: "password", header: "PW", cell: () => "****"},
|
||||
];
|
||||
|
||||
const monitoringColumns: DataTableColumn<UserFull>[] = [
|
||||
{id: "participationCount", header: "참여 횟수", cell: ({row}) => assignCountMap.get(row.original.userId) ?? 0, enableSorting: true},
|
||||
{id: "participationCount", header: "참여 횟수", accessorFn: (row) => assignCountMap.get(row.userId) ?? 0, cell: ({row}) => assignCountMap.get(row.original.userId) ?? 0},
|
||||
{id: "userArea", header: USER_FIELD_LABELS.userArea, cell: ({row}) => renderEditableCell(row.original, "userArea", "select", codes.area)},
|
||||
{id: "userGender", header: USER_FIELD_LABELS.gender, cell: ({row}) => renderEditableCell(row.original, "userGender", "select", codes.gender)},
|
||||
{id: "userAge", header: USER_FIELD_LABELS.userAge, cell: ({row}) => renderEditableCell(row.original, "userAge")},
|
||||
@@ -311,7 +311,7 @@ const UserPage = () => {
|
||||
hideDialog("userSmsSendDialog");
|
||||
refreshUserList();
|
||||
}}
|
||||
templateIdx={SMS_TEMPLATE_IDS.ACCOUNT_MONITORING}
|
||||
templateIdx={[SMS_TEMPLATE_IDS.ACCOUNT_MONITORING]}
|
||||
newMessageTemplateIdx={SMS_TEMPLATE_IDS.CUSTOM}
|
||||
selectedUsers={smsTargetUsers}
|
||||
onSent={refreshUserList}
|
||||
|
||||
Reference in New Issue
Block a user