260624_03_ENH: label 일괄 관리 및 문자 발송 팝업에 사용가능 변수 추가
This commit is contained in:
@@ -25,6 +25,7 @@ import {useMounted} from "@/hooks/useMounted";
|
|||||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||||
import {SMS_TEMPLATE_IDS} from "@/query/notification";
|
import {SMS_TEMPLATE_IDS} from "@/query/notification";
|
||||||
import {buildPerformanceSmsParams} from "@/lib/gwcf/notification";
|
import {buildPerformanceSmsParams} from "@/lib/gwcf/notification";
|
||||||
|
import {PERFORMANCE_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||||
|
|
||||||
const AssignPage = () => {
|
const AssignPage = () => {
|
||||||
const mounted = useMounted();
|
const mounted = useMounted();
|
||||||
@@ -115,13 +116,13 @@ const AssignPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||||
{accessorKey: "id", header: "연번", cell: ({row}) => row.original.id, enableSorting: true},
|
{accessorKey: "id", header: PERFORMANCE_FIELD_LABELS.id, cell: ({row}) => row.original.id, enableSorting: true},
|
||||||
{accessorKey: "performanceName", header: "사업명", enableSorting: true},
|
{accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName, enableSorting: true},
|
||||||
{id: "area", header: "지역", cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
{id: "area", header: PERFORMANCE_FIELD_LABELS.performanceArea, cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
||||||
{accessorKey: "performanceDtInfo", header: "사업 일정"},
|
{accessorKey: "performanceDtInfo", header: PERFORMANCE_FIELD_LABELS.performanceDtInfo},
|
||||||
{accessorKey: "performanceTimeInfo", header: "운영 시간"},
|
{accessorKey: "performanceTimeInfo", header: PERFORMANCE_FIELD_LABELS.performanceTimeInfo},
|
||||||
{id: "monitoringDate", header: "모니터링 일정", cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "", enableSorting: true},
|
{id: "monitoringDate", header: PERFORMANCE_FIELD_LABELS.monitoringDate, cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "", enableSorting: true},
|
||||||
{id: "monitoringTime", header: "모니터링 시간", cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringTimeInfo ?? ""},
|
{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: "applyCount", header: "신청자 수", cell: ({row}) => applyCountMap.get(String(row.original.id)) ?? 0, enableSorting: true},
|
||||||
{id: "requestCount", header: "확정요청 수", cell: ({row}) => getMonitoringAssigns(row.original).length},
|
{id: "requestCount", header: "확정요청 수", cell: ({row}) => getMonitoringAssigns(row.original).length},
|
||||||
{id: "confirmedCount", header: "확정인원 수", cell: ({row}) => getMonitoringAssigns(row.original).filter((assign) => assign.assignConfirm).length},
|
{id: "confirmedCount", header: "확정인원 수", cell: ({row}) => getMonitoringAssigns(row.original).filter((assign) => assign.assignConfirm).length},
|
||||||
@@ -133,10 +134,10 @@ const AssignPage = () => {
|
|||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<PagePanel>
|
<PagePanel>
|
||||||
<div className="grid gap-2 md:grid-cols-[160px_160px_180px_1fr_auto]">
|
<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.businessType} onChange={(value) => updateFilters((prev) => ({...prev, businessType: value}))} options={codes.business_type} placeholder={PERFORMANCE_FIELD_LABELS.businessType} />
|
||||||
<MultiFilterSelect value={filters.area} onChange={(value) => updateFilters((prev) => ({...prev, area: value}))} options={codes.area} placeholder="지역" />
|
<MultiFilterSelect value={filters.area} onChange={(value) => updateFilters((prev) => ({...prev, area: value}))} options={codes.area} placeholder={PERFORMANCE_FIELD_LABELS.performanceArea} />
|
||||||
<Input type="date" value={filters.monitoringDate} onChange={(event) => updateFilters((prev) => ({...prev, monitoringDate: event.target.value}))} />
|
<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 사업명" />
|
<Input value={filters.keyword} onChange={(event) => updateFilters((prev) => ({...prev, keyword: event.target.value}))} placeholder={`${PERFORMANCE_FIELD_LABELS.id} or ${PERFORMANCE_FIELD_LABELS.performanceName}`} />
|
||||||
<Button type="button" variant="outline" onClick={refreshAssignList}>
|
<Button type="button" variant="outline" onClick={refreshAssignList}>
|
||||||
<Search className="h-4 w-4" />
|
<Search className="h-4 w-4" />
|
||||||
검색
|
검색
|
||||||
@@ -199,6 +200,7 @@ const AssignPage = () => {
|
|||||||
newMessageTemplateIdx={SMS_TEMPLATE_IDS.CUSTOM}
|
newMessageTemplateIdx={SMS_TEMPLATE_IDS.CUSTOM}
|
||||||
selectedUsers={smsTargetUsers}
|
selectedUsers={smsTargetUsers}
|
||||||
addParams={smsAddParam}
|
addParams={smsAddParam}
|
||||||
|
denyParamKeys={["userCmpn", "userTeam", "userRole", "id"]}
|
||||||
isBeforeSendPending={saveAssignMutation.isPending}
|
isBeforeSendPending={saveAssignMutation.isPending}
|
||||||
onBeforeDefaultTemplateSend={async () => {
|
onBeforeDefaultTemplateSend={async () => {
|
||||||
if (!selected) throw new Error("공연 정보가 없습니다.");
|
if (!selected) throw new Error("공연 정보가 없습니다.");
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {toLocalDateString} from "@/lib/gwcf/date";
|
|||||||
import {
|
import {
|
||||||
getMonitoringDisplayRow,
|
getMonitoringDisplayRow,
|
||||||
} from "@/lib/gwcf/performance-status";
|
} from "@/lib/gwcf/performance-status";
|
||||||
|
import {PERFORMANCE_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||||
|
|
||||||
const today = toLocalDateString();
|
const today = toLocalDateString();
|
||||||
const todayTime = new Date(`${today}T00:00:00`).getTime();
|
const todayTime = new Date(`${today}T00:00:00`).getTime();
|
||||||
@@ -114,7 +115,7 @@ const MonitoringPage = () => {
|
|||||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||||
{
|
{
|
||||||
accessorKey: "performanceName",
|
accessorKey: "performanceName",
|
||||||
header: "사업명",
|
header: PERFORMANCE_FIELD_LABELS.performanceName,
|
||||||
cell: ({row}) => (
|
cell: ({row}) => (
|
||||||
<div className="max-w-[180px] whitespace-normal py-2 text-sm font-semibold leading-5">
|
<div className="max-w-[180px] whitespace-normal py-2 text-sm font-semibold leading-5">
|
||||||
{row.original.performanceName}
|
{row.original.performanceName}
|
||||||
@@ -123,12 +124,12 @@ const MonitoringPage = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "monitoringDate",
|
id: "monitoringDate",
|
||||||
header: "일정",
|
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
||||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate?.slice(5) || "-",
|
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate?.slice(5) || "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "monitoringTime",
|
id: "monitoringTime",
|
||||||
header: "시간",
|
header: PERFORMANCE_FIELD_LABELS.monitoringTimeInfo,
|
||||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringTimeInfo || "-",
|
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringTimeInfo || "-",
|
||||||
},
|
},
|
||||||
], []);
|
], []);
|
||||||
@@ -242,11 +243,11 @@ const MonitoringPage = () => {
|
|||||||
{selected.performanceMonitoringSchedule?.monitoringDate} {selected.performanceMonitoringSchedule?.monitoringTimeInfo}
|
{selected.performanceMonitoringSchedule?.monitoringDate} {selected.performanceMonitoringSchedule?.monitoringTimeInfo}
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-[80px_1fr] border-b">
|
<div className="grid grid-cols-[80px_1fr] border-b">
|
||||||
<div className="bg-muted px-3 py-2 text-sm font-semibold">사업명</div>
|
<div className="bg-muted px-3 py-2 text-sm font-semibold">{PERFORMANCE_FIELD_LABELS.performanceName}</div>
|
||||||
<div className="px-3 py-2 text-sm">{selected.performanceName}</div>
|
<div className="px-3 py-2 text-sm">{selected.performanceName}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-[80px_1fr]">
|
<div className="grid grid-cols-[80px_1fr]">
|
||||||
<div className="bg-muted px-3 py-2 text-sm font-semibold">장소</div>
|
<div className="bg-muted px-3 py-2 text-sm font-semibold">{PERFORMANCE_FIELD_LABELS.monitoringAddress}</div>
|
||||||
<div className="px-3 py-2 text-sm">{selected.performanceMonitoringSchedule?.monitoringAddress}</div>
|
<div className="px-3 py-2 text-sm">{selected.performanceMonitoringSchedule?.monitoringAddress}</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ import {
|
|||||||
openWrittenReviewWindow,
|
openWrittenReviewWindow,
|
||||||
} from "@/lib/gwcf/file";
|
} from "@/lib/gwcf/file";
|
||||||
import ExcelDownloadButton from "@/components/common/ExcelDownloadButton";
|
import ExcelDownloadButton from "@/components/common/ExcelDownloadButton";
|
||||||
|
import {PERFORMANCE_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||||
|
|
||||||
type PerformanceFilters = {
|
type PerformanceFilters = {
|
||||||
businessType: string[];
|
businessType: string[];
|
||||||
@@ -69,7 +70,7 @@ type PerformanceFilters = {
|
|||||||
const monthOptions: Code[] = Array.from({length: 12}, (_, index) => ({
|
const monthOptions: Code[] = Array.from({length: 12}, (_, index) => ({
|
||||||
codeGroup: "month",
|
codeGroup: "month",
|
||||||
codeValue: index + 1,
|
codeValue: index + 1,
|
||||||
codeGroupLabel: "사업 수행 월",
|
codeGroupLabel: PERFORMANCE_FIELD_LABELS.performanceStartMonth,
|
||||||
codeLabel: `${index + 1}월`,
|
codeLabel: `${index + 1}월`,
|
||||||
memo: "",
|
memo: "",
|
||||||
}));
|
}));
|
||||||
@@ -318,18 +319,18 @@ const PerformancePage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
const columns = useMemo<DataTableColumn<PerformanceFull>[]>(() => [
|
||||||
{accessorKey: "id", header: "연번", cell: ({row}) => row.original.id, enableSorting: true},
|
{accessorKey: "id", header: PERFORMANCE_FIELD_LABELS.id, cell: ({row}) => row.original.id, enableSorting: true},
|
||||||
{id: "businessType", header: "사업 유형", cell: ({row}) => getCodeLabel(codes, "business_type", row.original.businessType)},
|
{id: "businessType", header: PERFORMANCE_FIELD_LABELS.businessType, cell: ({row}) => getCodeLabel(codes, "business_type", row.original.businessType)},
|
||||||
{id: "genre", header: "분야(장르)", cell: ({row}) => getCodeLabel(codes, "genre", row.original.performanceGenre)},
|
{id: "genre", header: PERFORMANCE_FIELD_LABELS.performanceGenre, cell: ({row}) => getCodeLabel(codes, "genre", row.original.performanceGenre)},
|
||||||
{id: "area", header: "지역", cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
{id: "area", header: PERFORMANCE_FIELD_LABELS.performanceArea, cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)},
|
||||||
{accessorKey: "artistName", header: "단체(인)명", enableSorting: true},
|
{accessorKey: "artistName", header: PERFORMANCE_FIELD_LABELS.artistName, enableSorting: true},
|
||||||
{accessorKey: "performanceName", header: "사업명", enableSorting: true},
|
{accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName, enableSorting: true},
|
||||||
{id: "startMonth", header: "사업 수행 월", cell: ({row}) => `${row.original.performanceStartMonth}월`, enableSorting: true},
|
{id: "startMonth", header: PERFORMANCE_FIELD_LABELS.performanceStartMonth, cell: ({row}) => `${row.original.performanceStartMonth}월`, enableSorting: true},
|
||||||
{accessorKey: "performanceDtInfo", header: "사업 일정"},
|
{accessorKey: "performanceDtInfo", header: PERFORMANCE_FIELD_LABELS.performanceDtInfo},
|
||||||
{accessorKey: "performanceTimeInfo", header: "운영 시간"},
|
{accessorKey: "performanceTimeInfo", header: PERFORMANCE_FIELD_LABELS.performanceTimeInfo},
|
||||||
...(!isWrittenReviewer ? [{
|
...(!isWrittenReviewer ? [{
|
||||||
id: "monitoringDate",
|
id: "monitoringDate",
|
||||||
header: "모니터링 일정",
|
header: PERFORMANCE_FIELD_LABELS.monitoringDate,
|
||||||
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "",
|
cell: ({row}) => row.original.performanceMonitoringSchedule?.monitoringDate ?? "",
|
||||||
enableSorting: true,
|
enableSorting: true,
|
||||||
} satisfies DataTableColumn<PerformanceFull>] : []),
|
} satisfies DataTableColumn<PerformanceFull>] : []),
|
||||||
@@ -394,14 +395,14 @@ const PerformancePage = () => {
|
|||||||
<PagePanel>
|
<PagePanel>
|
||||||
<div className="space-y-2">
|
<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]"}>
|
<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.businessType} onChange={(value) => updateFilters((prev) => ({...prev, businessType: value}))} options={codes.business_type} placeholder={PERFORMANCE_FIELD_LABELS.businessType} />
|
||||||
<MultiFilterSelect value={filters.genre} onChange={(value) => updateFilters((prev) => ({...prev, genre: value}))} options={codes.genre} placeholder="분야(장르)" />
|
<MultiFilterSelect value={filters.genre} onChange={(value) => updateFilters((prev) => ({...prev, genre: value}))} options={codes.genre} placeholder={PERFORMANCE_FIELD_LABELS.performanceGenre} />
|
||||||
<MultiFilterSelect value={filters.area} onChange={(value) => updateFilters((prev) => ({...prev, area: value}))} options={codes.area} placeholder="지역" />
|
<MultiFilterSelect value={filters.area} onChange={(value) => updateFilters((prev) => ({...prev, area: value}))} options={codes.area} placeholder={PERFORMANCE_FIELD_LABELS.performanceArea} />
|
||||||
<MultiFilterSelect value={filters.startMonth} onChange={(value) => updateFilters((prev) => ({...prev, startMonth: value}))} options={monthOptions} placeholder="사업 수행 월" />
|
<MultiFilterSelect value={filters.startMonth} onChange={(value) => updateFilters((prev) => ({...prev, startMonth: value}))} options={monthOptions} placeholder={PERFORMANCE_FIELD_LABELS.performanceStartMonth} />
|
||||||
{!isWrittenReviewer && (
|
{!isWrittenReviewer && (
|
||||||
<DatePicker value={filters.monitoringDate} onChange={(value) => updateFilters((prev) => ({...prev, monitoringDate: value}))} placeholder="모니터링 일정" />
|
<DatePicker value={filters.monitoringDate} onChange={(value) => updateFilters((prev) => ({...prev, monitoringDate: value}))} placeholder={PERFORMANCE_FIELD_LABELS.monitoringDate} />
|
||||||
)}
|
)}
|
||||||
<Input value={filters.keyword} onChange={(event) => updateFilters((prev) => ({...prev, keyword: event.target.value}))} placeholder="연번 or 사업명" />
|
<Input value={filters.keyword} onChange={(event) => updateFilters((prev) => ({...prev, keyword: event.target.value}))} placeholder={`${PERFORMANCE_FIELD_LABELS.id} or ${PERFORMANCE_FIELD_LABELS.performanceName}`} />
|
||||||
<Button type="button" variant="outline" onClick={refreshPerformanceList}>
|
<Button type="button" variant="outline" onClick={refreshPerformanceList}>
|
||||||
<Search className="h-4 w-4" />
|
<Search className="h-4 w-4" />
|
||||||
검색
|
검색
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import {useMounted} from "@/hooks/useMounted";
|
|||||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||||
import {downloadExcelBuffer} from "@/lib/gwcf/file";
|
import {downloadExcelBuffer} from "@/lib/gwcf/file";
|
||||||
import ExcelDownloadButton from "@/components/common/ExcelDownloadButton";
|
import ExcelDownloadButton from "@/components/common/ExcelDownloadButton";
|
||||||
|
import {USER_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||||
|
|
||||||
type UserTab = "monitoring" | "written";
|
type UserTab = "monitoring" | "written";
|
||||||
type UserFilters = {area: string[]; gender: string[]; genre: string[]; keyword: string};
|
type UserFilters = {area: string[]; gender: string[]; genre: string[]; keyword: string};
|
||||||
@@ -171,30 +172,30 @@ const UserPage = () => {
|
|||||||
|
|
||||||
const columns = useMemo<DataTableColumn<UserFull>[]>(() => {
|
const columns = useMemo<DataTableColumn<UserFull>[]>(() => {
|
||||||
const commonColumns: DataTableColumn<UserFull>[] = [
|
const commonColumns: DataTableColumn<UserFull>[] = [
|
||||||
{accessorKey: "userId", header: "ID", enableSorting: true},
|
{accessorKey: "userId", header: USER_FIELD_LABELS.userId, enableSorting: true},
|
||||||
{id: "password", header: "PW", cell: () => "****"},
|
{id: "password", header: "PW", cell: () => "****"},
|
||||||
];
|
];
|
||||||
|
|
||||||
const monitoringColumns: DataTableColumn<UserFull>[] = [
|
const monitoringColumns: DataTableColumn<UserFull>[] = [
|
||||||
{id: "participationCount", header: "참여 횟수", cell: ({row}) => assignCountMap.get(row.original.userId) ?? 0, enableSorting: true},
|
{id: "participationCount", header: "참여 횟수", cell: ({row}) => assignCountMap.get(row.original.userId) ?? 0, enableSorting: true},
|
||||||
{id: "area", header: "지역", cell: ({row}) => renderEditableCell(row.original, "userArea", "select", codes.area)},
|
{id: "area", header: USER_FIELD_LABELS.userArea, cell: ({row}) => renderEditableCell(row.original, "userArea", "select", codes.area)},
|
||||||
{id: "gender", header: "성별", cell: ({row}) => renderEditableCell(row.original, "gender", "select", codes.gender)},
|
{id: "gender", header: USER_FIELD_LABELS.gender, cell: ({row}) => renderEditableCell(row.original, "gender", "select", codes.gender)},
|
||||||
{id: "userAge", header: "연령", cell: ({row}) => renderEditableCell(row.original, "userAge")},
|
{id: "userAge", header: USER_FIELD_LABELS.userAge, cell: ({row}) => renderEditableCell(row.original, "userAge")},
|
||||||
{id: "userTel", header: "연락처", cell: ({row}) => renderEditableCell(row.original, "userTel")},
|
{id: "userTel", header: USER_FIELD_LABELS.userTel, cell: ({row}) => renderEditableCell(row.original, "userTel")},
|
||||||
{id: "userEmail", header: "이메일", cell: ({row}) => renderEditableCell(row.original, "userEmail")},
|
{id: "userEmail", header: USER_FIELD_LABELS.userEmail, cell: ({row}) => renderEditableCell(row.original, "userEmail")},
|
||||||
{id: "userHasCar", header: "자차 여부", cell: ({row}) => renderEditableCell(row.original, "userHasCar", "select", codes.has_car)},
|
{id: "userHasCar", header: USER_FIELD_LABELS.userHasCar, cell: ({row}) => renderEditableCell(row.original, "userHasCar", "select", codes.has_car)},
|
||||||
];
|
];
|
||||||
|
|
||||||
const writtenColumns: DataTableColumn<UserFull>[] = [
|
const writtenColumns: DataTableColumn<UserFull>[] = [
|
||||||
{id: "userGenre", header: "장르", cell: ({row}) => renderEditableCell(row.original, "userGenre", "select", codes.genre)},
|
{id: "userGenre", header: USER_FIELD_LABELS.userGenre, cell: ({row}) => renderEditableCell(row.original, "userGenre", "select", codes.genre)},
|
||||||
{id: "userTel", header: "연락처", cell: ({row}) => renderEditableCell(row.original, "userTel")},
|
{id: "userTel", header: USER_FIELD_LABELS.userTel, cell: ({row}) => renderEditableCell(row.original, "userTel")},
|
||||||
{id: "userEmail", header: "이메일", cell: ({row}) => renderEditableCell(row.original, "userEmail")},
|
{id: "userEmail", header: USER_FIELD_LABELS.userEmail, cell: ({row}) => renderEditableCell(row.original, "userEmail")},
|
||||||
];
|
];
|
||||||
|
|
||||||
const actionColumns: DataTableColumn<UserFull>[] = [
|
const actionColumns: DataTableColumn<UserFull>[] = [
|
||||||
{
|
{
|
||||||
id: "memo",
|
id: "memo",
|
||||||
header: "메모",
|
header: USER_FIELD_LABELS.memo,
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
const draft = draftRef.current;
|
const draft = draftRef.current;
|
||||||
return editingId === row.original.userId && draft ? (
|
return editingId === row.original.userId && draft ? (
|
||||||
@@ -314,6 +315,7 @@ const UserPage = () => {
|
|||||||
newMessageTemplateIdx={SMS_TEMPLATE_IDS.CUSTOM}
|
newMessageTemplateIdx={SMS_TEMPLATE_IDS.CUSTOM}
|
||||||
selectedUsers={smsTargetUsers}
|
selectedUsers={smsTargetUsers}
|
||||||
onSent={refreshUserList}
|
onSent={refreshUserList}
|
||||||
|
denyParamKeys={["userCmpn", "userTeam", "userRole"]}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {Code, MonitoringApplyUser, PerformanceFull} from "@/types/gwcf";
|
|||||||
import {CodeGroup} from "@/query/code";
|
import {CodeGroup} from "@/query/code";
|
||||||
import {getCodeLabel, getDetailValue} from "@/lib/gwcf/view";
|
import {getCodeLabel, getDetailValue} from "@/lib/gwcf/view";
|
||||||
import {getAssignStatusDisplay, MONITORING_ASSIGN_TYPE} from "@/lib/gwcf/performance-status";
|
import {getAssignStatusDisplay, MONITORING_ASSIGN_TYPE} from "@/lib/gwcf/performance-status";
|
||||||
|
import {PERFORMANCE_FIELD_LABELS, USER_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||||
|
|
||||||
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
||||||
|
|
||||||
@@ -107,7 +108,7 @@ export function AssignMonitoringDialog({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "user",
|
id: "user",
|
||||||
header: "신청자",
|
header: USER_FIELD_LABELS.userName,
|
||||||
cell: ({row}) => (
|
cell: ({row}) => (
|
||||||
<div>
|
<div>
|
||||||
<div className="font-semibold">{row.original.user?.userName || row.original.userId}</div>
|
<div className="font-semibold">{row.original.user?.userName || row.original.userId}</div>
|
||||||
@@ -117,13 +118,13 @@ export function AssignMonitoringDialog({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "area",
|
id: "area",
|
||||||
header: "지역",
|
header: USER_FIELD_LABELS.userArea,
|
||||||
cell: ({row}) =>
|
cell: ({row}) =>
|
||||||
getCodeLabel(codes, "area", getDetailValue(row.original.user?.userDetail, "userArea")) || "-",
|
getCodeLabel(codes, "area", getDetailValue(row.original.user?.userDetail, "userArea")) || "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "tel",
|
id: "tel",
|
||||||
header: "연락처",
|
header: USER_FIELD_LABELS.userTel,
|
||||||
cell: ({row}) => getDetailValue(row.original.user?.userDetail, "userTel", "-"),
|
cell: ({row}) => getDetailValue(row.original.user?.userDetail, "userTel", "-"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -152,19 +153,19 @@ export function AssignMonitoringDialog({
|
|||||||
<table className="w-full border-collapse text-sm">
|
<table className="w-full border-collapse text-sm">
|
||||||
<tbody>
|
<tbody>
|
||||||
{[
|
{[
|
||||||
["연번", selected?.id],
|
[PERFORMANCE_FIELD_LABELS.id, selected?.id],
|
||||||
["사업유형", getCodeLabel(codes, "business_type", selected?.businessType)],
|
[PERFORMANCE_FIELD_LABELS.businessType, getCodeLabel(codes, "business_type", selected?.businessType)],
|
||||||
["분야(장르)", getCodeLabel(codes, "genre", selected?.performanceGenre)],
|
[PERFORMANCE_FIELD_LABELS.performanceGenre, getCodeLabel(codes, "genre", selected?.performanceGenre)],
|
||||||
["지역", getCodeLabel(codes, "area", selected?.performanceArea)],
|
[PERFORMANCE_FIELD_LABELS.performanceArea, getCodeLabel(codes, "area", selected?.performanceArea)],
|
||||||
["단체(팀)명", selected?.artistName],
|
[PERFORMANCE_FIELD_LABELS.artistName, selected?.artistName],
|
||||||
["사업명", selected?.performanceName],
|
[PERFORMANCE_FIELD_LABELS.performanceName, selected?.performanceName],
|
||||||
["사업 일정", selected?.performanceDtInfo],
|
[PERFORMANCE_FIELD_LABELS.performanceDtInfo, selected?.performanceDtInfo],
|
||||||
["운영 시간", selected?.performanceTimeInfo],
|
[PERFORMANCE_FIELD_LABELS.performanceTimeInfo, selected?.performanceTimeInfo],
|
||||||
["모니터링 일정", selected?.performanceMonitoringSchedule?.monitoringDate],
|
[PERFORMANCE_FIELD_LABELS.monitoringDate, selected?.performanceMonitoringSchedule?.monitoringDate],
|
||||||
["모니터링 시간", selected?.performanceMonitoringSchedule?.monitoringTimeInfo],
|
[PERFORMANCE_FIELD_LABELS.monitoringTimeInfo, selected?.performanceMonitoringSchedule?.monitoringTimeInfo],
|
||||||
["방문 장소", selected?.performanceMonitoringSchedule?.monitoringAddress],
|
[PERFORMANCE_FIELD_LABELS.monitoringAddress, selected?.performanceMonitoringSchedule?.monitoringAddress],
|
||||||
["티켓 예약", getCodeLabel(codes, "ticket_reservation_status", selected?.ticketReservationStatus)],
|
[PERFORMANCE_FIELD_LABELS.ticketReservationStatus, getCodeLabel(codes, "ticket_reservation_status", selected?.ticketReservationStatus)],
|
||||||
["티 비고", selected?.ticketReservationMemo],
|
[PERFORMANCE_FIELD_LABELS.ticketReservationMemo, selected?.ticketReservationMemo],
|
||||||
].map(([label, value]) => (
|
].map(([label, value]) => (
|
||||||
<tr key={String(label)}>
|
<tr key={String(label)}>
|
||||||
<th className="w-32 border bg-muted p-2 text-left">{label}</th>
|
<th className="w-32 border bg-muted p-2 text-left">{label}</th>
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import {
|
|||||||
getReviewPdfDownloadName,
|
getReviewPdfDownloadName,
|
||||||
openPreviewWindow,
|
openPreviewWindow,
|
||||||
} from "@/lib/gwcf/file";
|
} from "@/lib/gwcf/file";
|
||||||
|
import {PERFORMANCE_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||||
|
|
||||||
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
||||||
|
|
||||||
@@ -202,21 +203,21 @@ export function MonitoringPerformanceDetailDialog({
|
|||||||
{performance ? (
|
{performance ? (
|
||||||
<>
|
<>
|
||||||
<section className="overflow-hidden rounded-md border">
|
<section className="overflow-hidden rounded-md border">
|
||||||
<MobileDetailRow label="연번">{performance.id}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.id}>{performance.id}</MobileDetailRow>
|
||||||
<MobileDetailRow label="사업유형">{getCodeLabel(codes, "business_type", performance.businessType)}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.businessType}>{getCodeLabel(codes, "business_type", performance.businessType)}</MobileDetailRow>
|
||||||
<MobileDetailRow label="분야(장르)">{getCodeLabel(codes, "genre", performance.performanceGenre)}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceGenre}>{getCodeLabel(codes, "genre", performance.performanceGenre)}</MobileDetailRow>
|
||||||
<MobileDetailRow label="지역">{getCodeLabel(codes, "area", performance.performanceArea)}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceArea}>{getCodeLabel(codes, "area", performance.performanceArea)}</MobileDetailRow>
|
||||||
<MobileDetailRow label="단체(인)명">{performance.artistName}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.artistName}>{performance.artistName}</MobileDetailRow>
|
||||||
<MobileDetailRow label="사업명">{performance.performanceName}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceName}>{performance.performanceName}</MobileDetailRow>
|
||||||
<MobileDetailRow label="사업 수행 월">{performance.performanceStartMonth}월</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceStartMonth}>{performance.performanceStartMonth}월</MobileDetailRow>
|
||||||
<MobileDetailRow label="사업 일정">{performance.performanceDtInfo}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceDtInfo}>{performance.performanceDtInfo}</MobileDetailRow>
|
||||||
<MobileDetailRow label="운영 시간">{performance.performanceTimeInfo}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceTimeInfo}>{performance.performanceTimeInfo}</MobileDetailRow>
|
||||||
<MobileDetailRow label="예매 예약">{getCodeLabel(codes, "ticket_reservation_status", performance.ticketReservationStatus)}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationStatus}>{getCodeLabel(codes, "ticket_reservation_status", performance.ticketReservationStatus)}</MobileDetailRow>
|
||||||
<MobileDetailRow label="예매 비고">{performance.ticketReservationMemo}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationMemo}>{performance.ticketReservationMemo}</MobileDetailRow>
|
||||||
<MobileDetailRow label="모니터링 일정">{performance.performanceMonitoringSchedule?.monitoringDate}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.monitoringDate}>{performance.performanceMonitoringSchedule?.monitoringDate}</MobileDetailRow>
|
||||||
<MobileDetailRow label="모니터링 시간">{performance.performanceMonitoringSchedule?.monitoringTimeInfo}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.monitoringTimeInfo}>{performance.performanceMonitoringSchedule?.monitoringTimeInfo}</MobileDetailRow>
|
||||||
<MobileDetailRow label="방문 장소">{performance.performanceMonitoringSchedule?.monitoringAddress}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAddress}>{performance.performanceMonitoringSchedule?.monitoringAddress}</MobileDetailRow>
|
||||||
<MobileDetailRow label="메모">{performance.performanceMemo}</MobileDetailRow>
|
<MobileDetailRow label={PERFORMANCE_FIELD_LABELS.performanceMemo}>{performance.performanceMemo}</MobileDetailRow>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="space-y-3 rounded-md border p-3">
|
<section className="space-y-3 rounded-md border p-3">
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import {
|
|||||||
openPreviewWindow,
|
openPreviewWindow,
|
||||||
openWrittenReviewWindow,
|
openWrittenReviewWindow,
|
||||||
} from "@/lib/gwcf/file";
|
} from "@/lib/gwcf/file";
|
||||||
|
import {PERFORMANCE_FIELD_LABELS, USER_FIELD_LABELS} from "@/lib/gwcf/field-labels";
|
||||||
|
|
||||||
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ function AssignedUserInfo({
|
|||||||
const metaValue = type === "monitoring"
|
const metaValue = type === "monitoring"
|
||||||
? getCodeLabel(codes, "area", getDetailValue(detail, "userArea"))
|
? getCodeLabel(codes, "area", getDetailValue(detail, "userArea"))
|
||||||
: getCodeLabel(codes, "genre", getDetailValue(detail, "userGenre"));
|
: getCodeLabel(codes, "genre", getDetailValue(detail, "userGenre"));
|
||||||
const metaLabel = type === "monitoring" ? "지역" : "장르";
|
const metaLabel = type === "monitoring" ? USER_FIELD_LABELS.userArea : USER_FIELD_LABELS.userGenre;
|
||||||
const hasCar = getCodeLabel(codes, "has_car", getDetailValue(detail, "userHasCar")) || "-";
|
const hasCar = getCodeLabel(codes, "has_car", getDetailValue(detail, "userHasCar")) || "-";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -99,9 +100,9 @@ function AssignedUserInfo({
|
|||||||
<div className="grid gap-1 text-xs text-muted-foreground sm:grid-cols-2">
|
<div className="grid gap-1 text-xs text-muted-foreground sm:grid-cols-2">
|
||||||
<span>ID: {userId || "-"}</span>
|
<span>ID: {userId || "-"}</span>
|
||||||
<span>{metaLabel}: {metaValue || "-"}</span>
|
<span>{metaLabel}: {metaValue || "-"}</span>
|
||||||
<span>연락처: {tel}</span>
|
<span>{USER_FIELD_LABELS.userTel}: {tel}</span>
|
||||||
<span>이메일: {email}</span>
|
<span>{USER_FIELD_LABELS.userEmail}: {email}</span>
|
||||||
{type === "monitoring" && <span>자차유무: {hasCar}</span>}
|
{type === "monitoring" && <span>{USER_FIELD_LABELS.userHasCar}: {hasCar}</span>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -480,25 +481,25 @@ export function PerformanceDetailDialog({
|
|||||||
<div className="grid gap-4 lg:grid-cols-[1.1fr_0.9fr]">
|
<div className="grid gap-4 lg:grid-cols-[1.1fr_0.9fr]">
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<section className="rounded-md border">
|
<section className="rounded-md border">
|
||||||
<DetailRow label="연번">{draft.id}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.id}>{draft.id}</DetailRow>
|
||||||
<DetailRow label="사업유형">{getCodeLabel(codes, "business_type", draft.businessType)}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.businessType}>{getCodeLabel(codes, "business_type", draft.businessType)}</DetailRow>
|
||||||
<DetailRow label="분야(장르)">{getCodeLabel(codes, "genre", draft.performanceGenre)}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceGenre}>{getCodeLabel(codes, "genre", draft.performanceGenre)}</DetailRow>
|
||||||
<DetailRow label="지역">{getCodeLabel(codes, "area", draft.performanceArea)}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceArea}>{getCodeLabel(codes, "area", draft.performanceArea)}</DetailRow>
|
||||||
<DetailRow label="단체(인)명">{draft.artistName}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.artistName}>{draft.artistName}</DetailRow>
|
||||||
<DetailRow label="사업명">{isEditing ? <Input value={draft.performanceName} onChange={(event) => updateDraft("performanceName", event.target.value)} /> : draft.performanceName}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceName}>{isEditing ? <Input value={draft.performanceName} onChange={(event) => updateDraft("performanceName", event.target.value)} /> : draft.performanceName}</DetailRow>
|
||||||
<DetailRow label="사업 수행 월">{isEditing ? <Input type="number" value={draft.performanceStartMonth} onChange={(event) => updateDraft("performanceStartMonth", Number(event.target.value))} /> : `${draft.performanceStartMonth}월`}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceStartMonth}>{isEditing ? <Input type="number" value={draft.performanceStartMonth} onChange={(event) => updateDraft("performanceStartMonth", Number(event.target.value))} /> : `${draft.performanceStartMonth}월`}</DetailRow>
|
||||||
<DetailRow label="사업 일정">{isEditing ? <Input value={draft.performanceDtInfo} onChange={(event) => updateDraft("performanceDtInfo", event.target.value)} /> : draft.performanceDtInfo}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceDtInfo}>{isEditing ? <Input value={draft.performanceDtInfo} onChange={(event) => updateDraft("performanceDtInfo", event.target.value)} /> : draft.performanceDtInfo}</DetailRow>
|
||||||
<DetailRow label="운영 시간">{isEditing ? <Input value={draft.performanceTimeInfo} onChange={(event) => updateDraft("performanceTimeInfo", event.target.value)} /> : draft.performanceTimeInfo}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceTimeInfo}>{isEditing ? <Input value={draft.performanceTimeInfo} onChange={(event) => updateDraft("performanceTimeInfo", event.target.value)} /> : draft.performanceTimeInfo}</DetailRow>
|
||||||
<DetailRow label="예매 예약">
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationStatus}>
|
||||||
{isEditing ? (
|
{isEditing ? (
|
||||||
<FilterSelect value={String(draft.ticketReservationStatus ?? "")} onChange={(value) => updateDraft("ticketReservationStatus", Number(value))} options={codes.ticket_reservation_status ?? []} placeholder="예매 예약" />
|
<FilterSelect value={String(draft.ticketReservationStatus ?? "")} onChange={(value) => updateDraft("ticketReservationStatus", Number(value))} options={codes.ticket_reservation_status ?? []} placeholder={PERFORMANCE_FIELD_LABELS.ticketReservationStatus} />
|
||||||
) : getCodeLabel(codes, "ticket_reservation_status", draft.ticketReservationStatus)}
|
) : getCodeLabel(codes, "ticket_reservation_status", draft.ticketReservationStatus)}
|
||||||
</DetailRow>
|
</DetailRow>
|
||||||
<DetailRow label="예매 비고">{isEditing ? <Input value={draft.ticketReservationMemo} onChange={(event) => updateDraft("ticketReservationMemo", event.target.value)} /> : draft.ticketReservationMemo}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.ticketReservationMemo}>{isEditing ? <Input value={draft.ticketReservationMemo} onChange={(event) => updateDraft("ticketReservationMemo", event.target.value)} /> : draft.ticketReservationMemo}</DetailRow>
|
||||||
<DetailRow label="모니터링 일정">{isEditing ? <DatePicker value={draft.performanceMonitoringSchedule?.monitoringDate ?? ""} onChange={(value) => updateSchedule("monitoringDate", value)} /> : draft.performanceMonitoringSchedule?.monitoringDate}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringDate}>{isEditing ? <DatePicker value={draft.performanceMonitoringSchedule?.monitoringDate ?? ""} onChange={(value) => updateSchedule("monitoringDate", value)} /> : draft.performanceMonitoringSchedule?.monitoringDate}</DetailRow>
|
||||||
<DetailRow label="모니터링 시간">{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringTimeInfo ?? ""} onChange={(event) => updateSchedule("monitoringTimeInfo", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringTimeInfo}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringTimeInfo}>{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringTimeInfo ?? ""} onChange={(event) => updateSchedule("monitoringTimeInfo", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringTimeInfo}</DetailRow>
|
||||||
<DetailRow label="방문 장소">{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringAddress ?? ""} onChange={(event) => updateSchedule("monitoringAddress", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringAddress}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAddress}>{isEditing ? <Input value={draft.performanceMonitoringSchedule?.monitoringAddress ?? ""} onChange={(event) => updateSchedule("monitoringAddress", event.target.value)} /> : draft.performanceMonitoringSchedule?.monitoringAddress}</DetailRow>
|
||||||
<DetailRow label="메모">{isEditing ? <Input value={draft.performanceMemo} onChange={(event) => updateDraft("performanceMemo", event.target.value)} /> : draft.performanceMemo}</DetailRow>
|
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceMemo}>{isEditing ? <Input value={draft.performanceMemo} onChange={(event) => updateDraft("performanceMemo", event.target.value)} /> : draft.performanceMemo}</DetailRow>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="rounded-md border">
|
<section className="rounded-md border">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import {useEffect, useMemo, useState} from "react";
|
import {useEffect, useMemo, useRef, useState} from "react";
|
||||||
import {Edit, RotateCcw, Save, Send} from "lucide-react";
|
import {Edit, RotateCcw, Save, Send} from "lucide-react";
|
||||||
import {Button} from "@/components/ui/button";
|
import {Button} from "@/components/ui/button";
|
||||||
import {Input} from "@/components/ui/input";
|
import {Input} from "@/components/ui/input";
|
||||||
@@ -22,9 +22,12 @@ import {UserCompact} from "@/types/gwcf";
|
|||||||
import {getDetailValue} from "@/lib/gwcf/view";
|
import {getDetailValue} from "@/lib/gwcf/view";
|
||||||
import {useAuth} from "@/hooks/useAuth";
|
import {useAuth} from "@/hooks/useAuth";
|
||||||
import {buildUserMsgParam} from "@/lib/gwcf/notification";
|
import {buildUserMsgParam} from "@/lib/gwcf/notification";
|
||||||
|
import {getSmsParamLabel} from "@/lib/gwcf/field-labels";
|
||||||
|
|
||||||
type TemplateDraft = Pick<Template, "tmplatIdx" | "tmplatNm" | "tmplatTitle" | "tmplatBody" | "sendTel">;
|
type TemplateDraft = Pick<Template, "tmplatIdx" | "tmplatNm" | "tmplatTitle" | "tmplatBody" | "sendTel">;
|
||||||
|
|
||||||
|
const EMPTY_DENY_PARAM_KEYS: string[] = [];
|
||||||
|
|
||||||
const toText = (value: string | null | undefined) => value ?? "";
|
const toText = (value: string | null | undefined) => value ?? "";
|
||||||
|
|
||||||
const toDraft = (template: Template, emptyBody = false): TemplateDraft => ({
|
const toDraft = (template: Template, emptyBody = false): TemplateDraft => ({
|
||||||
@@ -43,6 +46,7 @@ export function SmsSendDialog({
|
|||||||
newMessageTemplateIdx,
|
newMessageTemplateIdx,
|
||||||
selectedUsers,
|
selectedUsers,
|
||||||
addParams = {},
|
addParams = {},
|
||||||
|
denyParamKeys = EMPTY_DENY_PARAM_KEYS,
|
||||||
onBeforeDefaultTemplateSend,
|
onBeforeDefaultTemplateSend,
|
||||||
isBeforeSendPending = false,
|
isBeforeSendPending = false,
|
||||||
onSent,
|
onSent,
|
||||||
@@ -54,6 +58,7 @@ export function SmsSendDialog({
|
|||||||
newMessageTemplateIdx?: number;
|
newMessageTemplateIdx?: number;
|
||||||
selectedUsers: UserCompact[];
|
selectedUsers: UserCompact[];
|
||||||
addParams?: Record<string, string>;
|
addParams?: Record<string, string>;
|
||||||
|
denyParamKeys?: string[];
|
||||||
onBeforeDefaultTemplateSend?: () => Promise<void>;
|
onBeforeDefaultTemplateSend?: () => Promise<void>;
|
||||||
isBeforeSendPending?: boolean;
|
isBeforeSendPending?: boolean;
|
||||||
onSent?: () => void;
|
onSent?: () => void;
|
||||||
@@ -63,6 +68,7 @@ export function SmsSendDialog({
|
|||||||
const [isNewMessage, setIsNewMessage] = useState(false);
|
const [isNewMessage, setIsNewMessage] = useState(false);
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
const [draft, setDraft] = useState<TemplateDraft | null>(null);
|
const [draft, setDraft] = useState<TemplateDraft | null>(null);
|
||||||
|
const bodyTextareaRef = useRef<HTMLTextAreaElement | null>(null);
|
||||||
|
|
||||||
const templateQuery = useNotificationTemplateQuery(activeTemplateIdx, open);
|
const templateQuery = useNotificationTemplateQuery(activeTemplateIdx, open);
|
||||||
const saveTemplateMutation = useSaveNotificationTemplateMutation();
|
const saveTemplateMutation = useSaveNotificationTemplateMutation();
|
||||||
@@ -71,19 +77,27 @@ export function SmsSendDialog({
|
|||||||
const isBusy = templateQuery.isLoading || saveTemplateMutation.isPending || sendSmsMutation.isPending || isBeforeSendPending;
|
const isBusy = templateQuery.isLoading || saveTemplateMutation.isPending || sendSmsMutation.isPending || isBeforeSendPending;
|
||||||
const canEdit = isNewMessage || isEditing;
|
const canEdit = isNewMessage || isEditing;
|
||||||
|
|
||||||
|
const denyParamKeySet = useMemo(() => new Set(denyParamKeys), [denyParamKeys]);
|
||||||
|
|
||||||
const destinations = useMemo(() => {
|
const destinations = useMemo(() => {
|
||||||
return selectedUsers
|
return selectedUsers
|
||||||
.map((user) => ({
|
.map((user) => {
|
||||||
|
const msgParam = Object.fromEntries(
|
||||||
|
Object.entries({
|
||||||
|
...buildUserMsgParam(user),
|
||||||
|
...addParams,
|
||||||
|
}).filter(([key]) => !denyParamKeySet.has(key))
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
sid: user.userId,
|
sid: user.userId,
|
||||||
destTel: getDetailValue(user.userDetail, "userTel"),
|
destTel: getDetailValue(user.userDetail, "userTel"),
|
||||||
destNm: user.userName || user.userId,
|
destNm: user.userName || user.userId,
|
||||||
msgParam: {
|
msgParam,
|
||||||
...buildUserMsgParam(user),
|
};
|
||||||
...addParams,
|
})
|
||||||
},
|
|
||||||
}))
|
|
||||||
.filter((item) => item.destTel);
|
.filter((item) => item.destTel);
|
||||||
}, [selectedUsers, addParams]);
|
}, [selectedUsers, addParams, denyParamKeySet]);
|
||||||
|
|
||||||
const msgParamKeys = useMemo(() => {
|
const msgParamKeys = useMemo(() => {
|
||||||
return Array.from(
|
return Array.from(
|
||||||
@@ -111,11 +125,24 @@ export function SmsSendDialog({
|
|||||||
setDraft((prev) => prev ? {...prev, [key]: value} : prev);
|
setDraft((prev) => prev ? {...prev, [key]: value} : prev);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
const insertMsgParam = (key: string) => {
|
||||||
if (!open) return;
|
if (!draft || !canEdit || isBusy) return;
|
||||||
|
|
||||||
console.log("d\estinations msgParam keys", msgParamKeys, destinations);
|
const token = `#{${key}}`;
|
||||||
}, [msgParamKeys, open]);
|
const textarea = bodyTextareaRef.current;
|
||||||
|
const body = draft.tmplatBody;
|
||||||
|
const selectionStart = textarea?.selectionStart ?? body.length;
|
||||||
|
const selectionEnd = textarea?.selectionEnd ?? selectionStart;
|
||||||
|
const nextBody = `${body.slice(0, selectionStart)}${token}${body.slice(selectionEnd)}`;
|
||||||
|
const nextCursor = selectionStart + token.length;
|
||||||
|
|
||||||
|
updateDraft("tmplatBody", nextBody);
|
||||||
|
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
textarea?.focus();
|
||||||
|
textarea?.setSelectionRange(nextCursor, nextCursor);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const saveTemplate = async () => {
|
const saveTemplate = async () => {
|
||||||
if (!draft) return null;
|
if (!draft) return null;
|
||||||
@@ -134,6 +161,13 @@ export function SmsSendDialog({
|
|||||||
return saved;
|
return saved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const cancelEdit = () => {
|
||||||
|
if (templateQuery.data) {
|
||||||
|
setDraft(toDraft(templateQuery.data, isNewMessage));
|
||||||
|
}
|
||||||
|
setIsEditing(false);
|
||||||
|
};
|
||||||
|
|
||||||
const switchToNewMessage = () => {
|
const switchToNewMessage = () => {
|
||||||
if (!newMessageTemplateIdx) return;
|
if (!newMessageTemplateIdx) return;
|
||||||
|
|
||||||
@@ -243,12 +277,32 @@ export function SmsSendDialog({
|
|||||||
<label className="space-y-1 text-sm">
|
<label className="space-y-1 text-sm">
|
||||||
<span className="font-medium">내용</span>
|
<span className="font-medium">내용</span>
|
||||||
<textarea
|
<textarea
|
||||||
|
ref={bodyTextareaRef}
|
||||||
value={draft.tmplatBody}
|
value={draft.tmplatBody}
|
||||||
disabled={!canEdit || isBusy}
|
disabled={!canEdit || isBusy}
|
||||||
onChange={(event) => updateDraft("tmplatBody", event.target.value)}
|
onChange={(event) => updateDraft("tmplatBody", event.target.value)}
|
||||||
className="min-h-56 w-full rounded-md border border-input bg-background p-3 text-sm disabled:cursor-not-allowed disabled:opacity-70"
|
className="min-h-56 w-full rounded-md border border-input bg-background p-3 text-sm disabled:cursor-not-allowed disabled:opacity-70"
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
{msgParamKeys.length > 0 && (
|
||||||
|
<div className="space-y-1 text-sm">
|
||||||
|
<div className="font-medium text-muted-foreground">사용 가능 변수값</div>
|
||||||
|
<div className="flex flex-wrap gap-1.5">
|
||||||
|
{msgParamKeys.map((key) => (
|
||||||
|
<Button
|
||||||
|
key={key}
|
||||||
|
type="button"
|
||||||
|
className="h-auto flex-col items-start gap-0 rounded bg-muted px-2 py-1 text-center text-xs text-foreground hover:bg-muted/80 disabled:cursor-not-allowed disabled:opacity-50"
|
||||||
|
disabled={!canEdit || isBusy}
|
||||||
|
onClick={() => insertMsgParam(key)}
|
||||||
|
>
|
||||||
|
<span className="text-center">{getSmsParamLabel(key)}</span>
|
||||||
|
<code className="font-mono text-muted-foreground">{`#{${key}}`}</code>
|
||||||
|
</Button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -261,10 +315,16 @@ export function SmsSendDialog({
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{!isNewMessage && draft && isEditing && (
|
{!isNewMessage && draft && isEditing && (
|
||||||
|
<>
|
||||||
<Button type="button" variant="outline" onClick={saveTemplate} disabled={isBusy}>
|
<Button type="button" variant="outline" onClick={saveTemplate} disabled={isBusy}>
|
||||||
<Save className="h-4 w-4" />
|
<Save className="h-4 w-4" />
|
||||||
저장
|
저장
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button type="button" variant="outline" onClick={cancelEdit} disabled={isBusy}>
|
||||||
|
<RotateCcw className="h-4 w-4" />
|
||||||
|
취소
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
<Button type="button" disabled={!draft || isBusy || isEditing || selectedUsers.length === 0} onClick={send}>
|
<Button type="button" disabled={!draft || isBusy || isEditing || selectedUsers.length === 0} onClick={send}>
|
||||||
<Send className="h-4 w-4" />
|
<Send className="h-4 w-4" />
|
||||||
|
|||||||
44
src/lib/gwcf/field-labels.ts
Normal file
44
src/lib/gwcf/field-labels.ts
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
export const USER_FIELD_LABELS = {
|
||||||
|
userId: "ID",
|
||||||
|
userName: "이름",
|
||||||
|
userCmpn: "소속",
|
||||||
|
userTeam: "팀",
|
||||||
|
userRole: "권한",
|
||||||
|
memo: "메모",
|
||||||
|
userArea: "지역",
|
||||||
|
gender: "성별",
|
||||||
|
userGender: "성별",
|
||||||
|
userAge: "연령",
|
||||||
|
userTel: "연락처",
|
||||||
|
userEmail: "이메일",
|
||||||
|
userHasCar: "자차 여부",
|
||||||
|
userGenre: "장르",
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const PERFORMANCE_FIELD_LABELS = {
|
||||||
|
id: "연번",
|
||||||
|
businessType: "사업유형",
|
||||||
|
performanceGenre: "분야(장르)",
|
||||||
|
performanceArea: "지역",
|
||||||
|
artistName: "단체(인)명",
|
||||||
|
performanceName: "사업명",
|
||||||
|
performanceStartMonth: "사업 수행 월",
|
||||||
|
performanceDtInfo: "사업 일정",
|
||||||
|
performanceTimeInfo: "운영 시간",
|
||||||
|
ticketReservationStatus: "티켓 예약",
|
||||||
|
ticketReservationMemo: "티켓 비고",
|
||||||
|
performanceMemo: "메모",
|
||||||
|
monitoringDate: "모니터링 일정",
|
||||||
|
monitoringTimeInfo: "모니터링 시간",
|
||||||
|
monitoringAddress: "방문 장소",
|
||||||
|
performanceId: "사업 ID",
|
||||||
|
monitoringPaymentDate: "요원 비용지급일",
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const SMS_PARAM_LABELS = {
|
||||||
|
...USER_FIELD_LABELS,
|
||||||
|
...PERFORMANCE_FIELD_LABELS,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const getSmsParamLabel = (key: string) =>
|
||||||
|
SMS_PARAM_LABELS[key as keyof typeof SMS_PARAM_LABELS] ?? key;
|
||||||
Reference in New Issue
Block a user