261026_01_ENH: 공연 상세정보에 관리번호(NCAS), 변경 메모 추가
This commit is contained in:
@@ -57,6 +57,11 @@ type CodeMap = Partial<Record<CodeGroup, Code[]>>;
|
||||
type PerformanceDetail = PerformanceCompact["performanceDetail"];
|
||||
type MonitoringVisitResetStatus = "departure" | "arrival";
|
||||
|
||||
const DETAIL_TEXT_MAX_LENGTH = 2048;
|
||||
|
||||
// UpdateNoticeDt는 한국시간 ISO 문자열이므로 시간대 변환 없이 표시만 정리한다.
|
||||
const formatUpdateNoticeDt = (value?: string) => (value ?? "").replace("T", " ").replace(/\.\d+/, "");
|
||||
|
||||
function DetailRow({label, children}: {label: string; children: ReactNode}) {
|
||||
return (
|
||||
<div className="grid grid-cols-[130px_1fr] border-b last:border-b-0">
|
||||
@@ -541,7 +546,35 @@ export function PerformanceDetailDialog({
|
||||
|
||||
const save = () => {
|
||||
if (!draft) return;
|
||||
onSave?.(draft);
|
||||
|
||||
const detail = draft.performanceDetail ?? {};
|
||||
const ncas = detail["NCAS"] ?? "";
|
||||
const updateNoticeTarget = detail["UpdateNoticeTarget"] ?? "";
|
||||
const updateNoticeMemo = detail["UpdateNoticeMemo"] ?? "";
|
||||
|
||||
if (!/^\d*$/.test(ncas)) {
|
||||
alert(`${PERFORMANCE_FIELD_LABELS.NCAS}는 숫자만 입력할 수 있습니다.`);
|
||||
return;
|
||||
}
|
||||
if (ncas.length > DETAIL_TEXT_MAX_LENGTH || updateNoticeMemo.length > DETAIL_TEXT_MAX_LENGTH) {
|
||||
alert(`${PERFORMANCE_FIELD_LABELS.NCAS}와 ${PERFORMANCE_FIELD_LABELS.UpdateNoticeMemo}은 최대 2,048자까지 입력할 수 있습니다.`);
|
||||
return;
|
||||
}
|
||||
if (updateNoticeTarget !== "" && updateNoticeMemo.trim() === "") {
|
||||
alert(`${PERFORMANCE_FIELD_LABELS.UpdateNoticeTarget}을 선택한 경우 ${PERFORMANCE_FIELD_LABELS.UpdateNoticeMemo}을 입력해 주세요.`);
|
||||
return;
|
||||
}
|
||||
|
||||
const performanceDetail: PerformanceDetail = {
|
||||
...detail,
|
||||
NCAS: ncas,
|
||||
UpdateNoticeTarget: updateNoticeTarget,
|
||||
UpdateNoticeMemo: updateNoticeMemo,
|
||||
};
|
||||
// 변경 일시는 서버에서 생성하므로 요청에서 제외한다.
|
||||
delete performanceDetail["UpdateNoticeDt"];
|
||||
|
||||
onSave?.({...draft, performanceDetail});
|
||||
setIsEditing(false);
|
||||
};
|
||||
|
||||
@@ -571,6 +604,7 @@ export function PerformanceDetailDialog({
|
||||
<section className="rounded-md border">
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.no}>{draft.performanceDetail["performanceNo"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.id}>{draft.id}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.NCAS}>{isEditing ? <Input inputMode="numeric" maxLength={DETAIL_TEXT_MAX_LENGTH} value={draft.performanceDetail["NCAS"] ?? ""} onChange={(event) => updateDetail("NCAS", event.target.value.replace(/\D/g, ""))} /> : draft.performanceDetail["NCAS"] ?? ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.monitoringAdd}>{draft.id % 100 !== 1? "추가" : ""}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.businessType}>{getCodeLabel(codes, "business_type", draft.businessType)}</DetailRow>
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.performanceGenre}>{getCodeLabel(codes, "genre", draft.performanceGenre)}</DetailRow>
|
||||
@@ -602,6 +636,32 @@ export function PerformanceDetailDialog({
|
||||
<DetailRow label={PERFORMANCE_FIELD_LABELS.checkReport}>{isEditing ? <Input value={draft.performanceDetail["checkReport"] ?? ""} onChange={(event) => updateDetail("checkReport", event.target.value)} /> : draft.performanceDetail["checkReport"] ?? ""}</DetailRow>
|
||||
</section>
|
||||
|
||||
<section className="rounded-md border">
|
||||
<div className="border-b bg-muted px-3 py-2 font-semibold">변경 정보</div>
|
||||
<div className="overflow-auto">
|
||||
<table className="w-full min-w-[620px] border-collapse text-sm">
|
||||
<thead>
|
||||
<tr className="bg-muted">
|
||||
<th className="w-[180px] border p-2">{PERFORMANCE_FIELD_LABELS.UpdateNoticeTarget}</th>
|
||||
<th className="border p-2">{PERFORMANCE_FIELD_LABELS.UpdateNoticeMemo}</th>
|
||||
<th className="w-[170px] border p-2">{PERFORMANCE_FIELD_LABELS.UpdateNoticeDt}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td className="border p-2">
|
||||
{isEditing ? (
|
||||
<FilterSelect value={draft.performanceDetail["UpdateNoticeTarget"] ?? ""} onChange={(value) => updateDetail("UpdateNoticeTarget", value)} options={codes.update_notice_target ?? []} placeholder={PERFORMANCE_FIELD_LABELS.UpdateNoticeTarget} />
|
||||
) : getCodeLabel(codes, "update_notice_target", draft.performanceDetail["UpdateNoticeTarget"])}
|
||||
</td>
|
||||
<td className="border p-2">{isEditing ? <Input maxLength={DETAIL_TEXT_MAX_LENGTH} value={draft.performanceDetail["UpdateNoticeMemo"] ?? ""} onChange={(event) => updateDetail("UpdateNoticeMemo", event.target.value)} /> : draft.performanceDetail["UpdateNoticeMemo"] ?? ""}</td>
|
||||
<td className="border p-2 text-center">{formatUpdateNoticeDt(draft.performanceDetail["UpdateNoticeDt"])}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="rounded-md border">
|
||||
<div className="border-b bg-muted px-3 py-2 font-semibold">관계자 정보</div>
|
||||
<div className="overflow-auto">
|
||||
|
||||
Reference in New Issue
Block a user