260623_01_ENH: 엑셀 다운로드를 제외한 기능 완성

This commit is contained in:
2026-06-23 09:54:25 +09:00
parent 28da30b865
commit 08ea4d5420
23 changed files with 1202 additions and 349 deletions

View File

@@ -21,6 +21,7 @@ import {SaveTemplateRequest, Template} from "@/types/notification";
import {UserCompact} from "@/types/gwcf";
import {getDetailValue} from "@/lib/gwcf/view";
import {useAuth} from "@/hooks/useAuth";
import {buildUserMsgParam} from "@/lib/gwcf/notification";
type TemplateDraft = Pick<Template, "tmplatIdx" | "tmplatNm" | "tmplatTitle" | "tmplatBody" | "sendTel">;
@@ -34,19 +35,6 @@ const toDraft = (template: Template, emptyBody = false): TemplateDraft => ({
sendTel: toText(template.sendTel),
});
const toParamValue = (value: unknown) => value == null ? "" : String(value);
const buildUserMsgParam = (user: UserCompact): Record<string, string> => ({
...Object.fromEntries(
Object.entries(user.userDetail ?? {}).map(([key, value]) => [key, toParamValue(value)])
),
userId: toParamValue(user.userId),
userCmpn: toParamValue(user.userCmpn),
userTeam: toParamValue(user.userTeam),
userName: toParamValue(user.userName),
userRole: toParamValue(user.userRole),
});
export function SmsSendDialog({
open,
onOpenChange,
@@ -55,6 +43,8 @@ export function SmsSendDialog({
newMessageTemplateIdx,
selectedUsers,
addParams = {},
onBeforeDefaultTemplateSend,
isBeforeSendPending = false,
onSent,
}: Readonly<{
open: boolean;
@@ -64,6 +54,8 @@ export function SmsSendDialog({
newMessageTemplateIdx?: number;
selectedUsers: UserCompact[];
addParams?: Record<string, string>;
onBeforeDefaultTemplateSend?: () => Promise<void>;
isBeforeSendPending?: boolean;
onSent?: () => void;
}>) {
const {auth} = useAuth();
@@ -76,7 +68,7 @@ export function SmsSendDialog({
const saveTemplateMutation = useSaveNotificationTemplateMutation();
const sendSmsMutation = useSendSmsBulkMutation();
const isBusy = templateQuery.isLoading || saveTemplateMutation.isPending || sendSmsMutation.isPending;
const isBusy = templateQuery.isLoading || saveTemplateMutation.isPending || sendSmsMutation.isPending || isBeforeSendPending;
const canEdit = isNewMessage || isEditing;
const destinations = useMemo(() => {
@@ -170,6 +162,8 @@ export function SmsSendDialog({
if (isNewMessage) {
await saveTemplate();
} else {
await onBeforeDefaultTemplateSend?.();
}
const result = await sendSmsMutation.mutateAsync({