조사사업 등록·수정 양식 다운로드 흐름 보완
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import LoadingOverlay from "@/components/ui/LoadingBar";
|
||||
import { getStartYearArray } from "@/components/ui/YearRangeSelectBox";
|
||||
import useStore from "@/store/useStore";
|
||||
import {
|
||||
postPopupMessage,
|
||||
postPopupMessageAndClose,
|
||||
} from "@/features/windowPopup/lib/popupMessage";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
|
||||
import { postPopupMessage } from "@/features/windowPopup/lib/popupMessage";
|
||||
import { WINDOW_POPUP_MESSAGE_TYPE } from "@/features/windowPopup/model/types";
|
||||
import {
|
||||
StandardFormField,
|
||||
@@ -22,8 +20,7 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@common/components";
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import {
|
||||
createExmnBusiness,
|
||||
createExmnTemplates,
|
||||
@@ -40,6 +37,10 @@ import type {
|
||||
} from "../model/exmn-business-types";
|
||||
import type { TrtdstSettingDto } from "../model/trtdst-types";
|
||||
|
||||
import LoadingOverlay from "@/components/ui/LoadingBar";
|
||||
import { getStartYearArray } from "@/components/ui/YearRangeSelectBox";
|
||||
import useStore from "@/store/useStore";
|
||||
|
||||
type Notice = { type: "success" | "error" | "info"; text: string } | null;
|
||||
|
||||
interface ExmnBusinessRegisterPopupPageProps {
|
||||
@@ -92,6 +93,11 @@ export function ExmnBusinessRegisterPopupPage({
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [notice, setNotice] = useState<Notice>(null);
|
||||
const formLocked = Boolean(savedBusiness) && !isEditMode;
|
||||
/** 저장 전 비활성 양식버튼에 표시할 업무 안내와 활성 조건이다. */
|
||||
const templateDownloadReady = Boolean(savedBusiness?.exmnBizId);
|
||||
const templateDownloadGuide = templateDownloadReady
|
||||
? undefined
|
||||
: "사업정보와 처리분구를 먼저 저장해주세요.";
|
||||
|
||||
/** 팝업 레이아웃은 BaseLayout 초기화를 거치지 않으므로 행정구역 공통코드를 직접 준비한다. */
|
||||
useEffect(() => {
|
||||
@@ -326,10 +332,14 @@ export function ExmnBusinessRegisterPopupPage({
|
||||
exmnBizId: persisted.exmnBizId,
|
||||
};
|
||||
if (!isEditMode) {
|
||||
postPopupMessageAndClose(
|
||||
postPopupMessage(
|
||||
WINDOW_POPUP_MESSAGE_TYPE.EXMN_BUSINESS_CREATED,
|
||||
popupPayload,
|
||||
);
|
||||
setNotice({
|
||||
type: "success",
|
||||
text: "사업정보를 등록했습니다. 조사 입력양식과 조사보고서 양식을 다운로드할 수 있습니다.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -416,22 +426,29 @@ export function ExmnBusinessRegisterPopupPage({
|
||||
showDefaultCancelAction={false}
|
||||
actions={
|
||||
<>
|
||||
<Button
|
||||
type="button"
|
||||
color="primary"
|
||||
disabled={isLoading}
|
||||
onClick={() => void handleDownloadTemplates()}
|
||||
<span
|
||||
className="inline-flex"
|
||||
title={templateDownloadGuide}
|
||||
>
|
||||
양식다운로드
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
color="primary"
|
||||
disabled={isLoading}
|
||||
onClick={() => void handleReportTemplate()}
|
||||
>
|
||||
조사보고서 양식다운로드
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
color="primary"
|
||||
disabled={isLoading || !templateDownloadReady}
|
||||
onClick={() => void handleDownloadTemplates()}
|
||||
>
|
||||
양식다운로드
|
||||
</Button>
|
||||
</span>
|
||||
{!isEditMode ? (
|
||||
<Button
|
||||
type="button"
|
||||
color="primary"
|
||||
disabled={isLoading}
|
||||
onClick={() => void handleReportTemplate()}
|
||||
>
|
||||
조사보고서 양식다운로드
|
||||
</Button>
|
||||
) : null}
|
||||
<Button
|
||||
type="button"
|
||||
color="primary"
|
||||
|
||||
Reference in New Issue
Block a user