[as] feat: 재원협의 신청 페이지 작업 및 설치인가 신청 폼 섹션 공통 컴포넌트화
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { FnrsEditPage } from "@/pages/fnrs-cnsltn";
|
||||
|
||||
interface PageProps {
|
||||
params: Promise<{ id: string }>;
|
||||
}
|
||||
|
||||
export default async function Page({ params }: PageProps) {
|
||||
const { id } = await params;
|
||||
return <FnrsEditPage id={id} />;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { FnrsViewPage } from "@/pages/fnrs-cnsltn";
|
||||
|
||||
interface PageProps {
|
||||
params: Promise<{ id: string }>;
|
||||
}
|
||||
|
||||
export default async function Page({ params }: PageProps) {
|
||||
const { id } = await params;
|
||||
return <FnrsViewPage id={id} />;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { FnrsListPage } from "@/pages/fnrs-cnsltn";
|
||||
|
||||
export default FnrsListPage;
|
||||
@@ -0,0 +1,12 @@
|
||||
import { FnrsRegistPage } from "@/pages/fnrs-cnsltn";
|
||||
import { parseTaskSeComCdFromApi } from "@/pages/fnrs-cnsltn/lib/fnrs-cnsltn-regist-schema";
|
||||
|
||||
interface PageProps {
|
||||
searchParams: Promise<{ taskSeComCd?: string }>;
|
||||
}
|
||||
|
||||
export default async function Page({ searchParams }: PageProps) {
|
||||
const params = await searchParams;
|
||||
const taskSeComCd = parseTaskSeComCdFromApi(params.taskSeComCd);
|
||||
return <FnrsRegistPage taskSeComCd={taskSeComCd.length ? taskSeComCd : undefined} />;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import type {
|
||||
|
||||
import { fnrsCnsltnMngService } from "./fnrs-cnsltn-service";
|
||||
|
||||
const fnrsCnsltnMngBaseKey = [ENDPOINT.AS_SERVICE.FNRS_CNSLTN_MNG] as const;
|
||||
export const fnrsCnsltnMngBaseKey = [ENDPOINT.AS_SERVICE.FNRS_CNSLTN_MNG] as const;
|
||||
|
||||
export function useFnrsCnsltnMngPage(params: FnrsCnsltnMngSearchDto) {
|
||||
return useQuery({
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export { fnrsCnsltnMngService } from "./api/fnrs-cnsltn-service";
|
||||
export { fnrsCnsltnMngBaseKey } from "./api/queries";
|
||||
export {
|
||||
useChangePrgrsSttsComCd,
|
||||
useDeleteFnrsCnsltnMng,
|
||||
|
||||
@@ -1,61 +1,28 @@
|
||||
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||
import type {
|
||||
BizCstSaveBase,
|
||||
BzScaleSaveBase,
|
||||
CklstResultSaveBase,
|
||||
DocPrgrsUpdateRequestDto,
|
||||
EsntlAtchFileSaveBase,
|
||||
PageableParams,
|
||||
PageResponse,
|
||||
PbadmsApplySaveHeader,
|
||||
PbadmsMngDetResponseBase,
|
||||
RvwOpnnResponseExtension,
|
||||
RvwOpnnSaveBase,
|
||||
SplmntDmndResponseExtension,
|
||||
SplmntDmndSaveBase,
|
||||
} from "@/shared/model";
|
||||
|
||||
/** 백엔드 FnrsCnsltnMngResponseDto */
|
||||
export interface FnrsCnsltnMngResponseDto {
|
||||
fnrsCnsltnDocNo: string;
|
||||
admdstCd?: string;
|
||||
envoSeComCd?: string;
|
||||
envoSeCdNm?: string;
|
||||
taskSeComCd?: string;
|
||||
taskSeCdNm?: string;
|
||||
cfmtnBgtBizNo?: string;
|
||||
bgtAplyYr?: string;
|
||||
bizNm?: string;
|
||||
bizBgngYr?: string;
|
||||
bizEndYr?: string;
|
||||
bizCn?: string;
|
||||
aplcntNm?: string;
|
||||
aplcntMblTelno?: string;
|
||||
aplcntOgdpNm?: string;
|
||||
aplcntEmlAddr?: string;
|
||||
dsgnrNm?: string;
|
||||
dsgnrTelno?: string;
|
||||
dsgnrOgdpNm?: string;
|
||||
dsgnrEmlAddr?: string;
|
||||
atchFileGroupId?: string;
|
||||
prgrsSttsComCd?: string;
|
||||
prgrsSttsCdNm?: string;
|
||||
regDt?: string;
|
||||
rgtr?: string;
|
||||
rgtrNm?: string;
|
||||
mdfcnDt?: string;
|
||||
sido?: string;
|
||||
gugun?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 FnrsCnsltnMngSearchDto + Pageable */
|
||||
export interface FnrsCnsltnMngSearchDto extends PageableParams {
|
||||
fnrsCnsltnDocNo?: string;
|
||||
admdstCd?: string;
|
||||
envoSeComCd?: string;
|
||||
taskSeComCd?: string;
|
||||
cfmtnBgtBizNo?: string;
|
||||
bgtAplyYr?: string;
|
||||
bizNm?: string;
|
||||
bizBgngYr?: string;
|
||||
bizEndYr?: string;
|
||||
bizCn?: string;
|
||||
aplcntNm?: string;
|
||||
aplcntMblTelno?: string;
|
||||
aplcntOgdpNm?: string;
|
||||
aplcntEmlAddr?: string;
|
||||
dsgnrNm?: string;
|
||||
dsgnrTelno?: string;
|
||||
dsgnrOgdpNm?: string;
|
||||
dsgnrEmlAddr?: string;
|
||||
atchFileGroupId?: string;
|
||||
prgrsSttsComCd?: string;
|
||||
}
|
||||
export type {
|
||||
AtflMngClientResponseDto,
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
CklstRvwRsltTreeDto,
|
||||
DocPrgrsUpdateRequestDto,
|
||||
ElaprDocPrgrsClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
} from "@/shared/model";
|
||||
|
||||
/** 백엔드 FnrsCnsltnMngSaveRequestDto */
|
||||
export interface FnrsCnsltnMngSaveRequestDto {
|
||||
@@ -79,48 +46,76 @@ export interface FnrsCnsltnMngSaveRequestDto {
|
||||
dsgnrEmlAddr?: string;
|
||||
atchFileGroupId?: string;
|
||||
prgrsSttsComCd?: string;
|
||||
rtlztnFcltSeComCd?: string;
|
||||
rtlztnUsgSeComCd?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 FnrsCnsltnMngUpdateRequestDto */
|
||||
export interface FnrsCnsltnMngUpdateRequestDto {
|
||||
admdstCd?: string;
|
||||
envoSeComCd?: string;
|
||||
taskSeComCd?: string;
|
||||
cfmtnBgtBizNo?: string;
|
||||
bgtAplyYr?: string;
|
||||
bizNm?: string;
|
||||
bizBgngYr?: string;
|
||||
bizEndYr?: string;
|
||||
bizCn?: string;
|
||||
aplcntNm?: string;
|
||||
aplcntMblTelno?: string;
|
||||
aplcntOgdpNm?: string;
|
||||
aplcntEmlAddr?: string;
|
||||
dsgnrNm?: string;
|
||||
dsgnrTelno?: string;
|
||||
dsgnrOgdpNm?: string;
|
||||
dsgnrEmlAddr?: string;
|
||||
atchFileGroupId?: string;
|
||||
prgrsSttsComCd?: string;
|
||||
export type FnrsCnsltnMngUpdateRequestDto = Omit<
|
||||
FnrsCnsltnMngSaveRequestDto,
|
||||
"fnrsCnsltnDocNo"
|
||||
>;
|
||||
|
||||
/** 백엔드 FnrsCnsltnMngSearchDto + Pageable */
|
||||
export type FnrsCnsltnMngSearchDto = PageableParams & Partial<FnrsCnsltnMngSaveRequestDto>;
|
||||
|
||||
interface FnrsCnsltnMngResponseExtension {
|
||||
fnrsCnsltnDocNo: string;
|
||||
envoSeCdNm?: string;
|
||||
taskSeCdNm?: string;
|
||||
prgrsSttsCdNm?: string;
|
||||
regDt?: string;
|
||||
rgtr?: string;
|
||||
rgtrNm?: string;
|
||||
mdfcnDt?: string;
|
||||
sido?: string;
|
||||
gugun?: string;
|
||||
}
|
||||
|
||||
/** 백엔드 FnrsCnsltnMngResponseDto */
|
||||
export type FnrsCnsltnMngResponseDto = Omit<FnrsCnsltnMngSaveRequestDto, "fnrsCnsltnDocNo"> &
|
||||
FnrsCnsltnMngResponseExtension;
|
||||
|
||||
export type BzScaleItem = BzScaleSaveBase;
|
||||
|
||||
export type BizCstItem = BizCstSaveBase;
|
||||
|
||||
export interface CklstResultItem extends CklstResultSaveBase {
|
||||
selected?: string;
|
||||
}
|
||||
|
||||
export type EsntlAtchFileItem = EsntlAtchFileSaveBase;
|
||||
|
||||
export type FnrsCnsltnSplmntDmndItem = SplmntDmndSaveBase;
|
||||
|
||||
/** 백엔드 FnrsCnsltnRvwOpnnSaveRequestDto */
|
||||
export interface FnrsCnsltnRvwOpnnSaveRequestDto extends RvwOpnnSaveBase {
|
||||
fnrsCnsltnDocNo: string;
|
||||
rvwOpnnSn: number;
|
||||
}
|
||||
|
||||
/** 백엔드 FnrsCnsltnRvwOpnnResponseDto */
|
||||
export type FnrsCnsltnRvwOpnnResponseDto = Partial<
|
||||
Pick<FnrsCnsltnRvwOpnnSaveRequestDto, "fnrsCnsltnDocNo" | "rvwOpnnSn">
|
||||
> &
|
||||
Omit<FnrsCnsltnRvwOpnnSaveRequestDto, "fnrsCnsltnDocNo" | "rvwOpnnSn"> &
|
||||
RvwOpnnResponseExtension;
|
||||
|
||||
/** 백엔드 FnrsCnsltnSplmntDmndResponseDto */
|
||||
export type FnrsCnsltnSplmntDmndResponseDto = FnrsCnsltnSplmntDmndItem &
|
||||
SplmntDmndResponseExtension & {
|
||||
fnrsCnsltnDocNo?: string;
|
||||
};
|
||||
|
||||
/** 백엔드 FnrsCnsltnMngDetResponseDto */
|
||||
export interface FnrsCnsltnMngDetResponseDto {
|
||||
detDto?: FnrsCnsltnMngResponseDto;
|
||||
bizSclList?: BizSclTreeDto[];
|
||||
bizCstList?: BizCstTreeDto[];
|
||||
cklstResultList?: CklstRvwRsltTreeDto[];
|
||||
esntlFileList?: EsntlAtchFileMngTreeResponseDto[];
|
||||
etcFileList?: AtflMngClientResponseDto[];
|
||||
rvwList?: FnrsCnsltnRvwOpnnResponseDto[];
|
||||
splmntDmndList?: FnrsCnsltnSplmntDmndResponseDto[];
|
||||
elaprDocPrgrsList?: ElaprDocPrgrsClientResponseDto[];
|
||||
}
|
||||
export type FnrsCnsltnMngDetResponseDto = PbadmsMngDetResponseBase<
|
||||
FnrsCnsltnMngResponseDto,
|
||||
FnrsCnsltnRvwOpnnResponseDto,
|
||||
FnrsCnsltnSplmntDmndResponseDto
|
||||
>;
|
||||
|
||||
/** 백엔드 FnrsCnsltnApplySaveRequestDto */
|
||||
export interface FnrsCnsltnApplySaveRequestDto {
|
||||
techReViewSaveCd?: string;
|
||||
rvwStpCd?: string;
|
||||
export interface FnrsCnsltnApplySaveRequestDto extends PbadmsApplySaveHeader {
|
||||
fnrsCnsltnMng: FnrsCnsltnMngSaveRequestDto;
|
||||
bzScaleList?: BzScaleItem[];
|
||||
bizCstList?: BizCstItem[];
|
||||
@@ -131,137 +126,6 @@ export interface FnrsCnsltnApplySaveRequestDto {
|
||||
splmntDmndList?: FnrsCnsltnSplmntDmndItem[];
|
||||
}
|
||||
|
||||
/** 백엔드 DocPrgrsUpdateRequestDto */
|
||||
export interface DocPrgrsUpdateRequestDto {
|
||||
docNo?: string;
|
||||
prgrsSttsComCd?: string;
|
||||
}
|
||||
|
||||
export interface BzScaleItem {
|
||||
cnstpSeCd?: string;
|
||||
bscPl?: number;
|
||||
budgetReflct?: number;
|
||||
thtiDsgn?: number;
|
||||
}
|
||||
|
||||
export interface BizCstItem {
|
||||
acntgSeCd?: string;
|
||||
bscPlanAmt?: number;
|
||||
bgtRfltAmt?: number;
|
||||
tstmDesignAmt?: number;
|
||||
}
|
||||
|
||||
export interface CklstResultItem {
|
||||
cklstRvwSn?: number;
|
||||
cklstArtclSn?: number;
|
||||
cklstSn?: number;
|
||||
rvwStpComCd: string;
|
||||
selected?: string;
|
||||
picRvwCn?: string;
|
||||
}
|
||||
|
||||
export interface EsntlAtchFileItem {
|
||||
esntlAtchFileId?: string;
|
||||
atchFileGroupId?: string;
|
||||
}
|
||||
|
||||
export interface FnrsCnsltnSplmntDmndItem {
|
||||
splmntDmndSn?: number;
|
||||
splmntArtclComCd?: string;
|
||||
splmntDmndCn?: string;
|
||||
splmntDmndDt?: string;
|
||||
splmntDmndAtchFileGroupId?: string;
|
||||
splmntCn?: string;
|
||||
splmntPicNm?: string;
|
||||
splmntCmptnDt?: string;
|
||||
splmntAtchFileGroupId?: string;
|
||||
cmptnYn?: string;
|
||||
}
|
||||
|
||||
export interface BizSclTreeDto {
|
||||
cnstpSeCd?: string;
|
||||
cnstpSeNm?: string;
|
||||
bscPl?: number;
|
||||
budgetReflct?: number;
|
||||
thtiDsgn?: number;
|
||||
}
|
||||
|
||||
export interface BizCstTreeDto {
|
||||
acntgSeCd?: string;
|
||||
acntgSeNm?: string;
|
||||
bscPlanAmt?: number;
|
||||
bgtRfltAmt?: number;
|
||||
tstmDesignAmt?: number;
|
||||
}
|
||||
|
||||
export interface CklstRvwRsltTreeDto {
|
||||
cklstRvwSn?: number;
|
||||
cklstArtclSn?: number;
|
||||
cklstSn?: number;
|
||||
rvwStpComCd?: string;
|
||||
selected?: string;
|
||||
picRvwCn?: string;
|
||||
cklstNm?: string;
|
||||
cklstArtclNm?: string;
|
||||
}
|
||||
|
||||
export interface EsntlAtchFileMngTreeResponseDto {
|
||||
esntlAtchFileId?: string;
|
||||
atchFileGroupId?: string;
|
||||
esntlAtchFileNm?: string;
|
||||
esntlAtchYn?: string;
|
||||
}
|
||||
|
||||
export interface AtflMngClientResponseDto {
|
||||
atflId?: string;
|
||||
orgnlFileNm?: string;
|
||||
atflFlieSz?: number;
|
||||
atflType?: string;
|
||||
dwnldNocs?: number;
|
||||
regDt?: string;
|
||||
}
|
||||
|
||||
export interface FnrsCnsltnRvwOpnnResponseDto {
|
||||
fnrsCnsltnRvwOpnnSn?: number;
|
||||
fnrsCnsltnDocNo?: string;
|
||||
rvwStpComCd?: string;
|
||||
rvwOpnn?: string;
|
||||
rvwOpnnDt?: string;
|
||||
rgtr?: string;
|
||||
rgtrNm?: string;
|
||||
}
|
||||
|
||||
export interface FnrsCnsltnRvwOpnnSaveRequestDto {
|
||||
fnrsCnsltnDocNo?: string;
|
||||
rvwStpComCd?: string;
|
||||
rvwOpnn?: string;
|
||||
}
|
||||
|
||||
export interface FnrsCnsltnSplmntDmndResponseDto {
|
||||
splmntDmndSn?: number;
|
||||
fnrsCnsltnDocNo?: string;
|
||||
splmntArtclComCd?: string;
|
||||
splmntDmndCn?: string;
|
||||
splmntDmndDt?: string;
|
||||
splmntDmndAtchFileGroupId?: string;
|
||||
splmntCn?: string;
|
||||
splmntPicNm?: string;
|
||||
splmntCmptnDt?: string;
|
||||
splmntAtchFileGroupId?: string;
|
||||
cmptnYn?: string;
|
||||
}
|
||||
|
||||
export interface ElaprDocPrgrsClientResponseDto {
|
||||
elaprDmndNo?: string;
|
||||
elaprAplnNo?: string;
|
||||
docNo?: string;
|
||||
docPrgrsSn?: number;
|
||||
prgrsSttsComCd?: string;
|
||||
prgrsSttsCdNm?: string;
|
||||
aprvrNm?: string;
|
||||
aprvDt?: string;
|
||||
}
|
||||
|
||||
/** Controller public 메서드명·시그니처와 동일 */
|
||||
export interface FnrsCnsltnMngService {
|
||||
findPage(searchDto: FnrsCnsltnMngSearchDto): Promise<PageResponse<FnrsCnsltnMngResponseDto>>;
|
||||
|
||||
@@ -1,4 +1,32 @@
|
||||
import type { PageableParams, PageResponse } from "@/shared/model";
|
||||
import type {
|
||||
AtflMngClientResponseDto,
|
||||
BizCstSaveBase,
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
BzScaleSaveBase,
|
||||
CklstResultSaveBase,
|
||||
DocPrgrsUpdateRequestDto,
|
||||
ElaprDocPrgrsClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
EsntlAtchFileSaveBase,
|
||||
PageableParams,
|
||||
PageResponse,
|
||||
PbadmsApplySaveHeader,
|
||||
PbadmsMngDetResponseBase,
|
||||
RvwOpnnResponseExtension,
|
||||
RvwOpnnSaveBase,
|
||||
SplmntDmndSaveBase,
|
||||
} from "@/shared/model";
|
||||
|
||||
export type {
|
||||
AtflMngClientResponseDto,
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
CklstRvwRsltTreeDto,
|
||||
DocPrgrsUpdateRequestDto,
|
||||
ElaprDocPrgrsClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
} from "@/shared/model";
|
||||
|
||||
/** 행정구역(시도·시군구) 콤보 응답 DTO */
|
||||
export interface AdstZoneResponseDto {
|
||||
@@ -70,16 +98,6 @@ export interface InstlSncnMngSaveRequestDto {
|
||||
/** 설치인가관리 수정 요청 DTO */
|
||||
export type InstlSncnMngUpdateRequestDto = InstlSncnMngSaveRequestDto;
|
||||
|
||||
/** 문서 진행상태 수정 요청 DTO */
|
||||
export interface DocPrgrsUpdateRequestDto {
|
||||
/** 행정지원문서번호 */
|
||||
docNo: string;
|
||||
/** 문서구분코드 */
|
||||
docSeComCd: string;
|
||||
/** 진행상태공통코드 */
|
||||
prgrsSttsComCd: string;
|
||||
}
|
||||
|
||||
/** 설치인가관리 응답 DTO */
|
||||
export interface InstlSncnMngResponseDto extends InstlSncnMngSaveRequestDto {
|
||||
/** 설치인가문서번호 (필수로 재정의) */
|
||||
@@ -111,7 +129,7 @@ export interface InstlSncnMngResponseDto extends InstlSncnMngSaveRequestDto {
|
||||
}
|
||||
|
||||
/** 설치인가 신청 - 사업규모 저장 DTO(배열 원소) */
|
||||
export interface InstlSncnBzScaleSaveDto {
|
||||
export interface InstlSncnBzScaleSaveDto extends BzScaleSaveBase {
|
||||
/** 공종구분코드 */
|
||||
cnstpSeCd: string;
|
||||
/** 기본계획수량 */
|
||||
@@ -125,7 +143,7 @@ export interface InstlSncnBzScaleSaveDto {
|
||||
}
|
||||
|
||||
/** 설치인가 신청 - 총사업비 저장 DTO(배열 원소) */
|
||||
export interface InstlSncnBizCstSaveRequestDto {
|
||||
export interface InstlSncnBizCstSaveRequestDto extends BizCstSaveBase {
|
||||
/** 회계구분코드 */
|
||||
acntgSeCd: string;
|
||||
/** 기본계획금액 */
|
||||
@@ -137,15 +155,13 @@ export interface InstlSncnBizCstSaveRequestDto {
|
||||
}
|
||||
|
||||
/** 설치인가 신청 - 체크리스트 결과 저장 DTO(배열 원소) */
|
||||
export interface InstlSncnCklstResultSaveDto {
|
||||
export interface InstlSncnCklstResultSaveDto extends CklstResultSaveBase {
|
||||
/** 점검표일련번호 */
|
||||
cklstSn: number;
|
||||
/** 점검표항목일련번호 */
|
||||
cklstArtclSn: number;
|
||||
/** 점검표검토일련번호 */
|
||||
cklstRvwSn: number;
|
||||
/** 검토단계공통코드 */
|
||||
rvwStpComCd: string;
|
||||
/** 선택값(Y/N/null) */
|
||||
selected: "Y" | "N" | null;
|
||||
/** 담당자검토내용(기술검토의견) */
|
||||
@@ -153,7 +169,7 @@ export interface InstlSncnCklstResultSaveDto {
|
||||
}
|
||||
|
||||
/** 설치인가 신청 - 필수첨부파일 저장 DTO(배열 원소) */
|
||||
export interface InstlSncnEsntlAtchFileSaveDto {
|
||||
export interface InstlSncnEsntlAtchFileSaveDto extends EsntlAtchFileSaveBase {
|
||||
/** 필수첨부파일아이디 */
|
||||
esntlAtchFileId: string;
|
||||
/** 첨부파일그룹아이디 */
|
||||
@@ -161,53 +177,16 @@ export interface InstlSncnEsntlAtchFileSaveDto {
|
||||
}
|
||||
|
||||
/** 설치인가검토의견 저장 요청 DTO */
|
||||
export interface InstlSncnRvwOpnnSaveRequestDto {
|
||||
export interface InstlSncnRvwOpnnSaveRequestDto extends RvwOpnnSaveBase {
|
||||
/** 설치인가문서번호 */
|
||||
instlSncnDocNo: string;
|
||||
/** 검토의견일련번호 */
|
||||
rvwOpnnSn?: number;
|
||||
/** 의견자구분공통코드 */
|
||||
opnrSeComCd?: string;
|
||||
/** 의견자명 */
|
||||
opnrNm?: string;
|
||||
/** 검토결과내용 */
|
||||
rvwRsltCn?: string;
|
||||
/** 검토결과이상여부 */
|
||||
rvwRsltAnmlyYn?: string;
|
||||
/** 첨부파일그룹아이디 */
|
||||
atchFileGroupId?: string;
|
||||
}
|
||||
|
||||
/** 설치인가 보완요구 저장 DTO(배열 원소) */
|
||||
export interface InstlSncnSplmntDmndSaveDto {
|
||||
/** 보완요구 일련번호 */
|
||||
splmntDmndSn?: number;
|
||||
/** 보완항목 공통코드 */
|
||||
splmntArtclComCd?: string;
|
||||
/** 보완요구 내용 */
|
||||
splmntDmndCn?: string;
|
||||
/** 보완요구 일시 */
|
||||
splmntDmndDt?: string;
|
||||
/** 보완요구 첨부파일 그룹 ID */
|
||||
splmntDmndAtchFileGroupId?: string;
|
||||
/** 보완 내용 */
|
||||
splmntCn?: string;
|
||||
/** 보완 담당자 명 */
|
||||
splmntPicNm?: string;
|
||||
/** 보완완료 일시 */
|
||||
splmntCmptnDt?: string;
|
||||
/** 보완 첨부파일 그룹 ID */
|
||||
splmntAtchFileGroupId?: string;
|
||||
/** 완료 여부 */
|
||||
cmptnYn?: string;
|
||||
}
|
||||
export type InstlSncnSplmntDmndSaveDto = SplmntDmndSaveBase;
|
||||
|
||||
/** 설치인가 신청 - 통합 저장 요청 DTO */
|
||||
export interface InstlSncnApplySaveRequestDto {
|
||||
/** 기술검토저장구분(SV.저장, CP.검토완료) */
|
||||
techReViewSaveCd?: string;
|
||||
/** 검토단계공통코드(ENV.환경청.EP, KECO.환경공단.TE) */
|
||||
rvwStpCd?: string;
|
||||
export interface InstlSncnApplySaveRequestDto extends PbadmsApplySaveHeader {
|
||||
/** 설치인가관리 정보 */
|
||||
instlSncnMng: InstlSncnMngSaveRequestDto;
|
||||
/** 사업규모 목록 */
|
||||
@@ -228,184 +207,28 @@ export interface InstlSncnApplySaveRequestDto {
|
||||
|
||||
export type ReviewStepCode = "LOCAL" | "ENV" | "KECO";
|
||||
|
||||
/** 공종 트리와 사업규모(수량) 조합 DTO */
|
||||
export interface BizSclTreeDto {
|
||||
/** 들여쓰기 적용된 공종명(시각적) */
|
||||
indCnstpSeCdNm: string;
|
||||
/** 공종 코드 */
|
||||
cnstpSeCd: string;
|
||||
/** 공종 코드명 */
|
||||
cnstpSeCdNm: string;
|
||||
/** 사용 여부(Y/N) */
|
||||
useYn: string;
|
||||
/** 트리 레벨(깊이) */
|
||||
treeLevel: number;
|
||||
/** 트리 경로 표시용 문자열 */
|
||||
treePath: string;
|
||||
/** 기본계획수량 */
|
||||
bscPlanQty: number;
|
||||
/** 예산반영수량 */
|
||||
bgtRfltQty: number;
|
||||
/** 금회설계수량 */
|
||||
tstmDesignQty: number;
|
||||
}
|
||||
|
||||
/** 회계구분 트리와 사업비용 조합 DTO */
|
||||
export interface BizCstTreeDto {
|
||||
/** 들여쓰기 적용된 회계구분명(시각적) */
|
||||
indAcntgSeCdNm: string;
|
||||
/** 회계구분 코드 */
|
||||
acntgSeCd: string;
|
||||
/** 회계구분 코드명 */
|
||||
acntgSeCdNm: string;
|
||||
/** 사용 여부(Y/N) */
|
||||
useYn: string;
|
||||
/** 트리 레벨(깊이) */
|
||||
treeLevel: number;
|
||||
/** 트리 경로 표시용 문자열 */
|
||||
treePath: string;
|
||||
/** 기본계획금액 */
|
||||
bscPlanAmt: number;
|
||||
/** 예산반영금액 */
|
||||
bgtRfltAmt: number;
|
||||
/** 금회설계금액 */
|
||||
tstmDesignAmt: number;
|
||||
}
|
||||
|
||||
/** 점검표 검토결과 트리 DTO */
|
||||
export interface CklstRvwRsltTreeDto {
|
||||
/** 점검표일련번호 */
|
||||
cklstSn: number;
|
||||
/** 점검표명 */
|
||||
cklstNm: string;
|
||||
/** 점검표항목일련번호 */
|
||||
cklstArtclSn: number;
|
||||
/** 점검표항목명 */
|
||||
cklstArtclNm: string;
|
||||
/** 검토일련번호 */
|
||||
cklstRvwSn: number;
|
||||
/** 상위검토일련번호 */
|
||||
upCklstRvwSn: number | null;
|
||||
/** 트리 레벨 */
|
||||
treeLevel: number;
|
||||
/** 검토내용 */
|
||||
rvwCn: string;
|
||||
/** 점검 사용 여부 */
|
||||
bchckUseYn: string;
|
||||
/** 정렬순서 */
|
||||
sortSeq: number;
|
||||
/** 업무구분코드 */
|
||||
taskSeComCd: string;
|
||||
/** 검토단계공통코드 */
|
||||
rvwStpComCd: string;
|
||||
/** 검토결과이상여부 */
|
||||
rvwRsltAnmlyYn: string;
|
||||
/** 검토담당자 UUID */
|
||||
rvwPicUuid: string | null;
|
||||
/** 담당자검토내용 */
|
||||
picRvwCn: string | null;
|
||||
/** 검토일시 */
|
||||
rvwDt: string | null;
|
||||
}
|
||||
|
||||
/** 필수첨부파일관리 트리 조회 응답 DTO */
|
||||
export interface EsntlAtchFileMngTreeResponseDto {
|
||||
/** 필수첨부파일아이디 */
|
||||
esntlAtchFileId: string;
|
||||
/** 문서구분공통코드 */
|
||||
docSeComCd: string;
|
||||
/** 필수첨부파일명 */
|
||||
esntlAtchFileNm: string;
|
||||
/** 필수첨부여부 */
|
||||
esntlAtchYn: string;
|
||||
/** 필수첨부파일비고 */
|
||||
esntlAtchFileRmrk: string | null;
|
||||
/** 첨부파일 코드 */
|
||||
atflCd?: string;
|
||||
/** 첨부파일 일련번호 */
|
||||
atflSn?: number;
|
||||
/** 첨부파일 ID */
|
||||
atflId?: string;
|
||||
/** 원본 파일명 */
|
||||
orgnlFileNm?: string;
|
||||
/** 첨부파일 크기 */
|
||||
atflFlieSz?: number;
|
||||
/** 첨부파일 타입 */
|
||||
atflType?: string;
|
||||
/** 다운로드 횟수 */
|
||||
dwnldNocs?: number;
|
||||
/** 등록일시 */
|
||||
regDt?: string;
|
||||
}
|
||||
|
||||
/** 첨부파일 응답 DTO (attach-service client) */
|
||||
export interface AtflMngClientResponseDto {
|
||||
atflCd: string;
|
||||
atflSn: number;
|
||||
atflId: string;
|
||||
physFileNm: string;
|
||||
orgnlFileNm: string;
|
||||
atflFlieSz: number;
|
||||
atflType: string;
|
||||
dwnldNocs: number;
|
||||
delYn: string;
|
||||
lnkgDmnId: string | null;
|
||||
lnkgDmnNm: string | null;
|
||||
regDt: string;
|
||||
}
|
||||
|
||||
/** 설치인가검토의견 응답 DTO */
|
||||
export interface InstlSncnRvwOpnnResponseDto {
|
||||
/** 설치인가문서번호 */
|
||||
instlSncnDocNo: string;
|
||||
/** 검토의견일련번호 */
|
||||
rvwOpnnSn: number;
|
||||
/** 의견자구분공통코드 */
|
||||
opnrSeComCd: string;
|
||||
/** 의견자구분공통코드명 */
|
||||
opnrSeCdNm: string | null;
|
||||
/** 의견자명 */
|
||||
opnrNm: string;
|
||||
/** 검토결과내용 */
|
||||
rvwRsltCn: string;
|
||||
/** 검토결과이상여부 */
|
||||
rvwRsltAnmlyYn: string;
|
||||
/** 첨부파일그룹아이디 */
|
||||
atchFileGroupId: string | null;
|
||||
/** 첨부파일 상세 정보 */
|
||||
atchFileInfo?: AtflMngClientResponseDto;
|
||||
/** 등록일시 */
|
||||
regDt: string;
|
||||
}
|
||||
|
||||
/** 전자결재 진행상태 (클라이언트 응답용) */
|
||||
export interface ElaprDocPrgrsClientResponseDto {
|
||||
elaprDocNo?: string;
|
||||
elaprDmndId?: string;
|
||||
elaprPrgrsId?: string;
|
||||
atrzSeqNo?: number;
|
||||
atrzSeComCd?: string;
|
||||
atrzSeComNm?: string;
|
||||
aprvrUuid?: string;
|
||||
aprvrUuidNm?: string;
|
||||
atrzPrgrsSttsComCd?: string;
|
||||
atrzPrgrsSttsComNm?: string;
|
||||
rjctRsn?: string | null;
|
||||
atrzDt?: string | null;
|
||||
jbpsSeNm?: string;
|
||||
jbgdSeNm?: string;
|
||||
ognzNm?: string;
|
||||
}
|
||||
export type InstlSncnRvwOpnnResponseDto = InstlSncnRvwOpnnSaveRequestDto &
|
||||
RvwOpnnResponseExtension & {
|
||||
instlSncnDocNo: string;
|
||||
rvwOpnnSn: number;
|
||||
opnrSeComCd: string;
|
||||
opnrNm: string;
|
||||
rvwRsltCn: string;
|
||||
rvwRsltAnmlyYn: string;
|
||||
atchFileGroupId: string | null;
|
||||
opnrSeCdNm: string | null;
|
||||
regDt: string;
|
||||
};
|
||||
|
||||
/** 설치인가관리 상세 응답 DTO */
|
||||
export interface InstlSncnMngDetResponse {
|
||||
export interface InstlSncnMngDetResponse
|
||||
extends PbadmsMngDetResponseBase<InstlSncnMngResponseDto, InstlSncnRvwOpnnResponseDto> {
|
||||
detDto: InstlSncnMngResponseDto;
|
||||
bizSclList: BizSclTreeDto[];
|
||||
bizCstList: BizCstTreeDto[];
|
||||
cklstResultList?: CklstRvwRsltTreeDto[];
|
||||
esntlFileList: EsntlAtchFileMngTreeResponseDto[];
|
||||
etcFileList: AtflMngClientResponseDto[];
|
||||
rvwList?: InstlSncnRvwOpnnResponseDto[];
|
||||
elaprDocPrgrsList?: ElaprDocPrgrsClientResponseDto[] | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export { FnrsEditPage } from "./ui/fnrs-edit-page";
|
||||
export { FnrsFormPage } from "./ui/fnrs-form-page";
|
||||
export { FnrsListPage } from "./ui/fnrs-list-page";
|
||||
export { FnrsRegistPage } from "./ui/fnrs-regist-page";
|
||||
export { FnrsViewPage } from "./ui/fnrs-view-page";
|
||||
@@ -0,0 +1,28 @@
|
||||
import type { ElaprDocPrgrsClientResponseDto } from "@/entities/fnrs-cnsltn";
|
||||
|
||||
export interface ApproverStatusConfig {
|
||||
label: string;
|
||||
badgeClass: string;
|
||||
}
|
||||
|
||||
export const APPROVER_STATUS_MAP: Record<string, ApproverStatusConfig> = {
|
||||
ATRZ_PRGRS_001: { label: "대기", badgeClass: "bg-gray-100 text-gray-700" },
|
||||
ATRZ_PRGRS_002: { label: "요청", badgeClass: "bg-yellow-100 text-yellow-800" },
|
||||
ATRZ_PRGRS_003: { label: "승인", badgeClass: "bg-green-100 text-green-800" },
|
||||
ATRZ_PRGRS_004: { label: "반려", badgeClass: "bg-red-100 text-red-800" },
|
||||
};
|
||||
|
||||
export function sortByAtrzSeqNo(
|
||||
list: ElaprDocPrgrsClientResponseDto[],
|
||||
): ElaprDocPrgrsClientResponseDto[] {
|
||||
return list.slice().sort((a, b) => Number(a.atrzSeqNo ?? 0) - Number(b.atrzSeqNo ?? 0));
|
||||
}
|
||||
|
||||
export function getApproverStatus(status: string | undefined): ApproverStatusConfig {
|
||||
return (
|
||||
APPROVER_STATUS_MAP[status ?? ""] ?? {
|
||||
label: status || "-",
|
||||
badgeClass: "bg-gray-100 text-gray-700",
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { BizCstTreeDto } from "@/entities/fnrs-cnsltn";
|
||||
|
||||
const ACNTG_TREE_PATH_SEPARATOR = "|";
|
||||
|
||||
/** treePath를 회계구분 코드 배열로 파싱 */
|
||||
export function parseAcntgTreePath(treePath: string): string[] {
|
||||
return treePath.split(ACNTG_TREE_PATH_SEPARATOR).filter(Boolean);
|
||||
}
|
||||
|
||||
/** treePath에서 직계 부모 acntgSeCd 반환 (루트면 null) */
|
||||
export function getParentAcntgSeCd(node: Pick<BizCstTreeDto, "treePath">): string | null {
|
||||
const segments = parseAcntgTreePath(node.treePath);
|
||||
if (segments.length <= 1) return null;
|
||||
return segments[segments.length - 2];
|
||||
}
|
||||
|
||||
/** treePath 기준으로 bizCstList 정렬 (원본 불변) */
|
||||
export function sortBizCstListByTreePath(list: BizCstTreeDto[]): BizCstTreeDto[] {
|
||||
return [...list].sort((a, b) => {
|
||||
const byPath = a.treePath.localeCompare(b.treePath);
|
||||
if (byPath !== 0) return byPath;
|
||||
return a.acntgSeCd.localeCompare(b.acntgSeCd);
|
||||
});
|
||||
}
|
||||
|
||||
/** 자식 노드가 없는 leaf 여부 (treePath | 구분자 기준) */
|
||||
export function isBizCstLeafNode(
|
||||
node: Pick<BizCstTreeDto, "acntgSeCd" | "treePath">,
|
||||
allNodes: Pick<BizCstTreeDto, "acntgSeCd" | "treePath">[],
|
||||
): boolean {
|
||||
const childPrefix = `${node.treePath}${ACNTG_TREE_PATH_SEPARATOR}`;
|
||||
return !allNodes.some(
|
||||
(other) => other.acntgSeCd !== node.acntgSeCd && other.treePath.startsWith(childPrefix),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
export const FNRS_CNSLTN_VIEW_BUTTON_ACTION = {
|
||||
strg: "strg",
|
||||
aply: "aply",
|
||||
del: "del",
|
||||
splmntCmptn: "splmntCmptn",
|
||||
fnrsCnsltnAncmnt: "fnrsCnsltnAncmnt",
|
||||
envoSbmsn: "envoSbmsn",
|
||||
rjct: "rjct",
|
||||
sncnAprv: "sncnAprv",
|
||||
rvwRply: "rvwRply",
|
||||
rqstTechRvw: "rqstTechRvw",
|
||||
dsgntRvwr: "dsgntRvwr",
|
||||
rvwStrg: "rvwStrg",
|
||||
rvwCmptn: "rvwCmptn",
|
||||
dmndSplmnt: "dmndSplmnt",
|
||||
atrzAprv: "atrzAprv",
|
||||
atrzRply: "atrzRply",
|
||||
grndsChck: "grndsChck",
|
||||
} as const;
|
||||
|
||||
export type FnrsCnsltnViewButtonAction =
|
||||
(typeof FNRS_CNSLTN_VIEW_BUTTON_ACTION)[keyof typeof FNRS_CNSLTN_VIEW_BUTTON_ACTION];
|
||||
|
||||
const ROLE_STATUS_BUTTON_ACTIONS: Record<string, Record<string, FnrsCnsltnViewButtonAction[]>> = {
|
||||
ROLE_USER05: {
|
||||
"": [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.strg,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.aply,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.del,
|
||||
],
|
||||
SV: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.strg,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.aply,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.del,
|
||||
],
|
||||
SL: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.splmntCmptn],
|
||||
TA: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.fnrsCnsltnAncmnt],
|
||||
},
|
||||
ROLE_USER04: {
|
||||
ST: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.envoSbmsn, FNRS_CNSLTN_VIEW_BUTTON_ACTION.rjct],
|
||||
EP: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.sncnAprv],
|
||||
},
|
||||
ROLE_USER03: {
|
||||
LE: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRply, FNRS_CNSLTN_VIEW_BUTTON_ACTION.rqstTechRvw],
|
||||
TP: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRply],
|
||||
},
|
||||
ROLE_USER01: {
|
||||
TE: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.grndsChck],
|
||||
SL: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.splmntCmptn],
|
||||
},
|
||||
};
|
||||
|
||||
const ROLE_USER01_ATRZ_STATUS_CODES = ["ER", "TE"] as const;
|
||||
|
||||
const ROLE_USER01_ATRZ_STATUS_ACTIONS: Record<
|
||||
string,
|
||||
Record<string, FnrsCnsltnViewButtonAction[]>
|
||||
> = {
|
||||
ER: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.dsgntRvwr],
|
||||
},
|
||||
TE: {
|
||||
ATRZ02: [
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwStrg,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwCmptn,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||
],
|
||||
ATRZ03: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzAprv],
|
||||
ATRZ99: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply],
|
||||
},
|
||||
};
|
||||
|
||||
function resolveButtonConfigs(actions: FnrsCnsltnViewButtonAction[]): FnrsCnsltnViewButtonAction[] {
|
||||
return actions.map((action) => FNRS_CNSLTN_VIEW_BUTTON_ACTION[action]);
|
||||
}
|
||||
|
||||
function resolveRoleUser01AtrzButtonActions(
|
||||
prgrsSttsComCd: string,
|
||||
atrzSeComCdList: string[],
|
||||
): FnrsCnsltnViewButtonAction[] {
|
||||
const atrzStatusMap = ROLE_USER01_ATRZ_STATUS_ACTIONS[prgrsSttsComCd];
|
||||
if (!atrzStatusMap || atrzSeComCdList.length === 0) return [];
|
||||
|
||||
const seen = new Set<FnrsCnsltnViewButtonAction>();
|
||||
const actions: FnrsCnsltnViewButtonAction[] = [];
|
||||
|
||||
for (const atrzSeComCd of atrzSeComCdList) {
|
||||
const mappedActions = atrzStatusMap[atrzSeComCd];
|
||||
if (!mappedActions) continue;
|
||||
|
||||
for (const action of mappedActions) {
|
||||
if (seen.has(action)) continue;
|
||||
seen.add(action);
|
||||
actions.push(action);
|
||||
}
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
export function needsRoleUser01AtrzResolve(
|
||||
dtlInstCd: string | undefined,
|
||||
prgrsSttsComCd: string,
|
||||
): boolean {
|
||||
return (
|
||||
dtlInstCd === "ROLE_USER01" &&
|
||||
ROLE_USER01_ATRZ_STATUS_CODES.includes(
|
||||
prgrsSttsComCd as (typeof ROLE_USER01_ATRZ_STATUS_CODES)[number],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export function getButtonConfigs(
|
||||
dtlInstCd: string | undefined,
|
||||
prgrsSttsComCd: string,
|
||||
atrzSeComCdList?: string[],
|
||||
): FnrsCnsltnViewButtonAction[] {
|
||||
if (!dtlInstCd) return [];
|
||||
|
||||
if (needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd)) {
|
||||
return resolveButtonConfigs(
|
||||
resolveRoleUser01AtrzButtonActions(prgrsSttsComCd, atrzSeComCdList ?? []),
|
||||
);
|
||||
}
|
||||
|
||||
const statusMap = ROLE_STATUS_BUTTON_ACTIONS[dtlInstCd];
|
||||
if (!statusMap) return [];
|
||||
|
||||
const actions = statusMap[prgrsSttsComCd];
|
||||
if (!actions) return [];
|
||||
|
||||
return resolveButtonConfigs(actions);
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
import type { CklstRvwRsltTreeDto, CklstResultItem } from "@/entities/fnrs-cnsltn";
|
||||
|
||||
import {
|
||||
type ChecklistFormState,
|
||||
type ChecklistProgress,
|
||||
type ChecklistRowKey,
|
||||
type ChecklistStepMap,
|
||||
type ReviewStepCode,
|
||||
REVIEW_STEP_CODES,
|
||||
} from "../model/view-types";
|
||||
|
||||
export function buildChecklistRowKey(
|
||||
row: CklstRvwRsltTreeDto,
|
||||
reviewStep?: ReviewStepCode,
|
||||
): ChecklistRowKey {
|
||||
const step = reviewStep ?? (row.rvwStpComCd as ReviewStepCode) ?? "LOCAL";
|
||||
return `${row.taskSeComCd}_${row.cklstSn}_${row.cklstArtclSn}_${row.cklstRvwSn}_${step}`;
|
||||
}
|
||||
|
||||
export function groupByReviewStep(rows: CklstRvwRsltTreeDto[]): ChecklistStepMap {
|
||||
const base: ChecklistStepMap = { LOCAL: [], ENV: [], KECO: [] };
|
||||
rows.forEach((row) => {
|
||||
const step = (row.rvwStpComCd ?? "LOCAL") as ReviewStepCode;
|
||||
if (REVIEW_STEP_CODES.includes(step)) base[step].push(row);
|
||||
});
|
||||
return base;
|
||||
}
|
||||
|
||||
export function extractTaskCodes(rows: CklstRvwRsltTreeDto[]): string[] {
|
||||
return Array.from(new Set(rows.map((row) => row.taskSeComCd).filter(Boolean)));
|
||||
}
|
||||
|
||||
export function filterChecklistRows(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
taskCode: string | null,
|
||||
): CklstRvwRsltTreeDto[] {
|
||||
return rows.filter((row) => (taskCode ? row.taskSeComCd === taskCode : true)).slice();
|
||||
}
|
||||
|
||||
export function getChecklistDisplayRows(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
taskCode?: string | null,
|
||||
): CklstRvwRsltTreeDto[] {
|
||||
const filtered = filterChecklistRows(rows, taskCode ?? null);
|
||||
const seen = new Set<string>();
|
||||
const deduped: CklstRvwRsltTreeDto[] = [];
|
||||
|
||||
for (const row of filtered) {
|
||||
const dedupeKey = `${row.taskSeComCd}_${row.cklstRvwSn}`;
|
||||
if (seen.has(dedupeKey)) continue;
|
||||
seen.add(dedupeKey);
|
||||
deduped.push(row);
|
||||
}
|
||||
|
||||
return deduped;
|
||||
}
|
||||
|
||||
export function computeChecklistProgress(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
results: ChecklistFormState["results"],
|
||||
): ChecklistProgress {
|
||||
const activeRows = rows.filter((row) => row.bchckUseYn === "Y");
|
||||
const total = activeRows.length;
|
||||
const completed = activeRows.reduce((acc, row) => {
|
||||
const key = buildChecklistRowKey(row);
|
||||
const val = results[key] ?? row.rvwRsltAnmlyYn ?? "";
|
||||
return acc + (val ? 1 : 0);
|
||||
}, 0);
|
||||
const percent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||
return { total, completed, percent };
|
||||
}
|
||||
|
||||
export function filterChecklistRowsByReviewStep(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
reviewStep: ReviewStepCode,
|
||||
): CklstRvwRsltTreeDto[] {
|
||||
return rows.filter((row) => row.rvwStpComCd === reviewStep);
|
||||
}
|
||||
|
||||
export function computeReviewStepChecklistProgress(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
results: ChecklistFormState["results"],
|
||||
reviewStep: ReviewStepCode,
|
||||
): ChecklistProgress {
|
||||
const activeRows = getChecklistDisplayRows(rows).filter((row) => row.bchckUseYn === "Y");
|
||||
const total = activeRows.length;
|
||||
const completed = activeRows.reduce((acc, row) => {
|
||||
const key = buildChecklistRowKey(row, reviewStep);
|
||||
const val = results[key];
|
||||
return acc + (val === "Y" || val === "N" ? 1 : 0);
|
||||
}, 0);
|
||||
const percent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||
return { total, completed, percent };
|
||||
}
|
||||
|
||||
export function buildChecklistFormState(rows: CklstRvwRsltTreeDto[]): ChecklistFormState {
|
||||
const results: ChecklistFormState["results"] = {};
|
||||
const comments: ChecklistFormState["comments"] = {};
|
||||
rows.forEach((row) => {
|
||||
const key = buildChecklistRowKey(row);
|
||||
if (row.rvwRsltAnmlyYn === "Y" || row.rvwRsltAnmlyYn === "N") {
|
||||
results[key] = row.rvwRsltAnmlyYn;
|
||||
}
|
||||
if (row.picRvwCn) comments[key] = row.picRvwCn;
|
||||
});
|
||||
return {
|
||||
results,
|
||||
comments,
|
||||
progress: computeChecklistProgress(rows, results),
|
||||
};
|
||||
}
|
||||
|
||||
export function mergeChecklistFormStateFromServer(
|
||||
prev: ChecklistFormState,
|
||||
allRows: CklstRvwRsltTreeDto[],
|
||||
): ChecklistFormState {
|
||||
const results = { ...prev.results };
|
||||
const comments = { ...prev.comments };
|
||||
|
||||
for (const row of allRows) {
|
||||
const step = row.rvwStpComCd as ReviewStepCode | undefined;
|
||||
if (!step || !REVIEW_STEP_CODES.includes(step)) continue;
|
||||
|
||||
const key = buildChecklistRowKey(row);
|
||||
if ((row.rvwRsltAnmlyYn === "Y" || row.rvwRsltAnmlyYn === "N") && results[key] === undefined) {
|
||||
results[key] = row.rvwRsltAnmlyYn;
|
||||
}
|
||||
if (row.picRvwCn && !comments[key]) {
|
||||
comments[key] = row.picRvwCn;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
results,
|
||||
comments,
|
||||
progress: computeChecklistProgress(getChecklistDisplayRows(allRows), results),
|
||||
};
|
||||
}
|
||||
|
||||
export function patchChecklistFormState(
|
||||
prev: ChecklistFormState,
|
||||
patch: Partial<Pick<ChecklistFormState, "results" | "comments">>,
|
||||
allRows: CklstRvwRsltTreeDto[],
|
||||
reviewStep?: ReviewStepCode,
|
||||
): ChecklistFormState {
|
||||
const results = patch.results ?? prev.results;
|
||||
const comments = patch.comments ?? prev.comments;
|
||||
const progress = reviewStep
|
||||
? computeReviewStepChecklistProgress(allRows, results, reviewStep)
|
||||
: computeChecklistProgress(getChecklistDisplayRows(allRows), results);
|
||||
|
||||
return {
|
||||
results,
|
||||
comments,
|
||||
progress,
|
||||
};
|
||||
}
|
||||
|
||||
export function toCklstSaveDto(
|
||||
rows: CklstRvwRsltTreeDto[],
|
||||
formState: ChecklistFormState,
|
||||
reviewStep: ReviewStepCode,
|
||||
): CklstResultItem[] {
|
||||
return getChecklistDisplayRows(rows)
|
||||
.filter((row) => row.bchckUseYn === "Y")
|
||||
.map((row) => {
|
||||
const key = buildChecklistRowKey(row, reviewStep);
|
||||
const selected = formState.results[key] ?? null;
|
||||
return {
|
||||
cklstSn: row.cklstSn,
|
||||
cklstArtclSn: row.cklstArtclSn,
|
||||
cklstRvwSn: row.cklstRvwSn,
|
||||
rvwStpComCd: reviewStep,
|
||||
selected,
|
||||
picRvwCn: formState.comments[key] ?? null,
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const fnrsCnsltnRegistSchema = z.object({
|
||||
fnrsCnsltnMng: z.object({
|
||||
bizNm: z.string().min(1, "사업명은 필수입니다"),
|
||||
bizBgngYr: z.string().min(1, "사업시작연도는 필수입니다"),
|
||||
bizEndYr: z.string().min(1, "사업종료연도는 필수입니다"),
|
||||
bizCn: z.string().min(1, "사업내용은 필수입니다"),
|
||||
taskSeComCd: z.array(z.string()).min(1, "구분은 필수입니다"),
|
||||
cfmtnBgtBizNo: z.string().optional(),
|
||||
bgtAplyYr: z.string().optional(),
|
||||
dsgnrNm: z.string().min(1, "설계자 이름은 필수입니다"),
|
||||
dsgnrTelno: z.string().min(1, "설계자 전화번호는 필수입니다"),
|
||||
dsgnrOgdpNm: z.string().min(1, "설계자 소속은 필수입니다"),
|
||||
dsgnrEmlAddr: z
|
||||
.string()
|
||||
.min(1, "설계자 이메일은 필수입니다")
|
||||
.email("올바른 이메일 형식이 아닙니다"),
|
||||
aplcntNm: z.string().optional(),
|
||||
aplcntMblTelno: z.string().optional(),
|
||||
aplcntOgdpNm: z.string().optional(),
|
||||
aplcntEmlAddr: z.string().optional(),
|
||||
fnrsCnsltnDocNo: z.string().optional(),
|
||||
admdstCd: z.string().optional(),
|
||||
envoSeComCd: z.string().optional(),
|
||||
rtlztnFcltSeComCd: z.string().optional(),
|
||||
rtlztnUsgSeComCd: z.string().optional(),
|
||||
prgrsSttsComCd: z.string().optional(),
|
||||
atchFileGroupId: z.string().optional(),
|
||||
envoSeCdNm: z.string().optional(),
|
||||
taskSeCdNm: z.string().optional(),
|
||||
prgrsSttsCdNm: z.string().optional(),
|
||||
sido: z.string().optional(),
|
||||
gugun: z.string().optional(),
|
||||
regDt: z.string().optional(),
|
||||
rgtr: z.string().optional(),
|
||||
rgtrNm: z.string().optional(),
|
||||
mdfcnDt: z.string().optional(),
|
||||
}),
|
||||
bzScaleList: z.array(
|
||||
z.object({
|
||||
cnstpSeCd: z.string(),
|
||||
bscPl: z.number(),
|
||||
budgetReflct: z.number(),
|
||||
thtiDsgn: z.number(),
|
||||
diff: z.number().optional(),
|
||||
}),
|
||||
),
|
||||
bizCstList: z.array(
|
||||
z.object({
|
||||
acntgSeCd: z.string(),
|
||||
bscPlanAmt: z.number(),
|
||||
bgtRfltAmt: z.number(),
|
||||
tstmDesignAmt: z.number(),
|
||||
}),
|
||||
),
|
||||
cklstResultList: z.array(
|
||||
z.object({
|
||||
cklstSn: z.number(),
|
||||
cklstArtclSn: z.number(),
|
||||
cklstRvwSn: z.number(),
|
||||
rvwStpComCd: z.string(),
|
||||
selected: z.enum(["Y", "N"]).nullable(),
|
||||
picRvwCn: z.string().nullable().optional(),
|
||||
}),
|
||||
),
|
||||
esntlAtchFileList: z.array(
|
||||
z.object({
|
||||
esntlAtchFileId: z.string(),
|
||||
atchFileGroupId: z.string(),
|
||||
}),
|
||||
),
|
||||
privacyConsent: z.enum(["Y", "N"], {
|
||||
required_error: "개인정보 수집/이용 동의는 필수입니다",
|
||||
}),
|
||||
});
|
||||
|
||||
export type FnrsCnsltnRegistFormData = z.infer<typeof fnrsCnsltnRegistSchema>;
|
||||
|
||||
export function formatTaskSeComCdForApi(taskSeComCd: string[]): string {
|
||||
return taskSeComCd.join(",");
|
||||
}
|
||||
|
||||
export function parseTaskSeComCdFromApi(taskSeComCd?: string): string[] {
|
||||
if (!taskSeComCd) return [];
|
||||
return taskSeComCd.split(",").filter(Boolean);
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
import type { IUserInfo } from "@/shared/store/user-store";
|
||||
import type { FnrsCnsltnMngDetResponseDto } from "@/entities/fnrs-cnsltn";
|
||||
|
||||
import type { FnrsCnsltnRegistFormData } from "./fnrs-cnsltn-regist-schema";
|
||||
import { parseTaskSeComCdFromApi } from "./fnrs-cnsltn-regist-schema";
|
||||
|
||||
function mapSelectedValue(value?: string | null): "Y" | "N" | null {
|
||||
if (value === "Y" || value === "N") return value;
|
||||
return null;
|
||||
}
|
||||
|
||||
function mapEsntlAtchFileList(esntlFileList: FnrsCnsltnMngDetResponseDto["esntlFileList"]) {
|
||||
const esntlMap = new Map<string, string>();
|
||||
|
||||
for (const item of esntlFileList ?? []) {
|
||||
if (!item.esntlAtchFileId || !item.atflCd) continue;
|
||||
esntlMap.set(item.esntlAtchFileId, item.atflCd);
|
||||
}
|
||||
|
||||
return Array.from(esntlMap.entries()).map(([esntlAtchFileId, atchFileGroupId]) => ({
|
||||
esntlAtchFileId,
|
||||
atchFileGroupId,
|
||||
}));
|
||||
}
|
||||
|
||||
export function mapDetailToFormData(data: FnrsCnsltnMngDetResponseDto): FnrsCnsltnRegistFormData {
|
||||
const detDto = data.detDto;
|
||||
if (!detDto) {
|
||||
throw new Error("상세 정보(detDto)가 없습니다.");
|
||||
}
|
||||
|
||||
const bizSclList = data.bizSclList ?? [];
|
||||
const bizCstList = data.bizCstList ?? [];
|
||||
const cklstResultList = data.cklstResultList;
|
||||
const esntlFileList = data.esntlFileList;
|
||||
|
||||
return {
|
||||
fnrsCnsltnMng: {
|
||||
fnrsCnsltnDocNo: detDto.fnrsCnsltnDocNo,
|
||||
bizNm: detDto.bizNm ?? "",
|
||||
bizBgngYr: detDto.bizBgngYr ?? "",
|
||||
bizEndYr: detDto.bizEndYr ?? "",
|
||||
bizCn: detDto.bizCn ?? "",
|
||||
taskSeComCd: parseTaskSeComCdFromApi(detDto.taskSeComCd),
|
||||
cfmtnBgtBizNo: detDto.cfmtnBgtBizNo,
|
||||
bgtAplyYr: detDto.bgtAplyYr,
|
||||
dsgnrNm: detDto.dsgnrNm ?? "",
|
||||
dsgnrTelno: detDto.dsgnrTelno ?? "",
|
||||
dsgnrOgdpNm: detDto.dsgnrOgdpNm ?? "",
|
||||
dsgnrEmlAddr: detDto.dsgnrEmlAddr ?? "",
|
||||
aplcntNm: detDto.aplcntNm ?? "",
|
||||
aplcntMblTelno: detDto.aplcntMblTelno ?? "",
|
||||
aplcntOgdpNm: detDto.aplcntOgdpNm ?? "",
|
||||
aplcntEmlAddr: detDto.aplcntEmlAddr ?? "",
|
||||
admdstCd: detDto.admdstCd,
|
||||
envoSeComCd: detDto.envoSeComCd,
|
||||
rtlztnFcltSeComCd: detDto.rtlztnFcltSeComCd ?? "",
|
||||
rtlztnUsgSeComCd: detDto.rtlztnUsgSeComCd ?? "",
|
||||
prgrsSttsComCd: detDto.prgrsSttsComCd,
|
||||
atchFileGroupId: detDto.atchFileGroupId ?? "",
|
||||
envoSeCdNm: detDto.envoSeCdNm,
|
||||
taskSeCdNm: detDto.taskSeCdNm,
|
||||
prgrsSttsCdNm: detDto.prgrsSttsCdNm,
|
||||
sido: detDto.sido,
|
||||
gugun: detDto.gugun,
|
||||
regDt: detDto.regDt,
|
||||
rgtr: detDto.rgtr,
|
||||
rgtrNm: detDto.rgtrNm,
|
||||
mdfcnDt: detDto.mdfcnDt,
|
||||
},
|
||||
bzScaleList: bizSclList.map((item) => ({
|
||||
cnstpSeCd: item.cnstpSeCd,
|
||||
bscPl: item.bscPlanQty,
|
||||
budgetReflct: item.bgtRfltQty,
|
||||
thtiDsgn: item.tstmDesignQty,
|
||||
diff: item.tstmDesignQty - item.bgtRfltQty,
|
||||
})),
|
||||
bizCstList: bizCstList.map((item) => ({
|
||||
acntgSeCd: item.acntgSeCd,
|
||||
bscPlanAmt: item.bscPlanAmt,
|
||||
bgtRfltAmt: item.bgtRfltAmt,
|
||||
tstmDesignAmt: item.tstmDesignAmt,
|
||||
})),
|
||||
cklstResultList:
|
||||
cklstResultList?.map((item) => ({
|
||||
cklstSn: item.cklstSn,
|
||||
cklstArtclSn: item.cklstArtclSn,
|
||||
cklstRvwSn: item.cklstRvwSn,
|
||||
rvwStpComCd: item.rvwStpComCd,
|
||||
selected: mapSelectedValue(item.rvwRsltAnmlyYn),
|
||||
picRvwCn: item.picRvwCn,
|
||||
})) ?? [],
|
||||
esntlAtchFileList: mapEsntlAtchFileList(esntlFileList),
|
||||
privacyConsent: "Y",
|
||||
};
|
||||
}
|
||||
|
||||
export function getCreateDefaultValues(
|
||||
userInfo: IUserInfo | null,
|
||||
taskSeComCd?: string[],
|
||||
): FnrsCnsltnRegistFormData {
|
||||
return {
|
||||
fnrsCnsltnMng: {
|
||||
bizNm: "",
|
||||
bizBgngYr: "",
|
||||
bizEndYr: "",
|
||||
bizCn: "",
|
||||
taskSeComCd: taskSeComCd ?? [],
|
||||
cfmtnBgtBizNo: "",
|
||||
bgtAplyYr: "",
|
||||
dsgnrNm: "",
|
||||
dsgnrTelno: "",
|
||||
dsgnrOgdpNm: "",
|
||||
dsgnrEmlAddr: "",
|
||||
aplcntNm: userInfo?.userName ?? "",
|
||||
aplcntMblTelno: userInfo?.mphn ?? "",
|
||||
aplcntOgdpNm: userInfo?.ogdpSeNm ?? "",
|
||||
aplcntEmlAddr: userInfo?.email ?? "",
|
||||
prgrsSttsComCd: "SV",
|
||||
atchFileGroupId: "",
|
||||
rtlztnFcltSeComCd: "",
|
||||
rtlztnUsgSeComCd: "",
|
||||
},
|
||||
bzScaleList: [],
|
||||
bizCstList: [],
|
||||
cklstResultList: [],
|
||||
esntlAtchFileList: [],
|
||||
privacyConsent: "N",
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import type {
|
||||
FnrsCnsltnMngDetResponseDto,
|
||||
FnrsCnsltnRvwOpnnSaveRequestDto,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
|
||||
export interface ReviewOpinionFormData {
|
||||
rvwRsltCn: string;
|
||||
rvwRsltAnmlyYn: "Y" | "N" | "";
|
||||
atchFileGroupId: string;
|
||||
opnrSeComCd: string;
|
||||
rvwOpnnSn?: number;
|
||||
}
|
||||
|
||||
export function toRvwOpnnSaveDto(
|
||||
data: FnrsCnsltnMngDetResponseDto,
|
||||
reviewOpinionFormData: ReviewOpinionFormData | null | undefined,
|
||||
opnrNm?: string,
|
||||
): FnrsCnsltnRvwOpnnSaveRequestDto[] | undefined {
|
||||
if (!reviewOpinionFormData || !data.detDto) return undefined;
|
||||
|
||||
const hasContent =
|
||||
reviewOpinionFormData.rvwRsltCn.trim() ||
|
||||
reviewOpinionFormData.rvwRsltAnmlyYn ||
|
||||
reviewOpinionFormData.atchFileGroupId;
|
||||
|
||||
if (!hasContent) return undefined;
|
||||
|
||||
const existingSn =
|
||||
reviewOpinionFormData.rvwOpnnSn ??
|
||||
data.rvwList?.find((item) => item.opnrSeComCd === reviewOpinionFormData.opnrSeComCd)
|
||||
?.rvwOpnnSn ??
|
||||
1;
|
||||
|
||||
return [
|
||||
{
|
||||
fnrsCnsltnDocNo: data.detDto.fnrsCnsltnDocNo,
|
||||
rvwOpnnSn: existingSn,
|
||||
opnrSeComCd: reviewOpinionFormData.opnrSeComCd,
|
||||
opnrNm: opnrNm ?? "",
|
||||
rvwRsltCn: reviewOpinionFormData.rvwRsltCn,
|
||||
rvwRsltAnmlyYn: reviewOpinionFormData.rvwRsltAnmlyYn || undefined,
|
||||
atchFileGroupId: reviewOpinionFormData.atchFileGroupId || undefined,
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import {
|
||||
PBADMS_PROGRESS_ORDER,
|
||||
REVIEW_STEP_CODES,
|
||||
REVIEW_STEP_ROLE_RANK,
|
||||
type ReviewStepCode,
|
||||
ROLE_TO_REVIEW_STEP,
|
||||
} from "../model/view-types";
|
||||
|
||||
export function getProgressStepCount(prgrsSttsComCd?: string): number {
|
||||
const idx = PBADMS_PROGRESS_ORDER.indexOf(
|
||||
prgrsSttsComCd as (typeof PBADMS_PROGRESS_ORDER)[number],
|
||||
);
|
||||
if (idx <= PBADMS_PROGRESS_ORDER.indexOf("SV")) return 1;
|
||||
if (idx <= PBADMS_PROGRESS_ORDER.indexOf("LE")) return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
export function getRoleStepCount(dtlInstCd?: string): number {
|
||||
const mapped = dtlInstCd ? ROLE_TO_REVIEW_STEP[dtlInstCd] : undefined;
|
||||
return mapped ? REVIEW_STEP_ROLE_RANK[mapped] : 0;
|
||||
}
|
||||
|
||||
export function getVisibleReviewSteps(
|
||||
prgrsSttsComCd: string,
|
||||
userRoleCode?: string,
|
||||
): ReviewStepCode[] {
|
||||
const count = Math.min(getProgressStepCount(prgrsSttsComCd), getRoleStepCount(userRoleCode));
|
||||
return REVIEW_STEP_CODES.slice(0, count);
|
||||
}
|
||||
|
||||
export function getEditableReviewStep(
|
||||
dtlInstCd?: string,
|
||||
prgrsSttsComCd?: string,
|
||||
): ReviewStepCode | undefined {
|
||||
if (dtlInstCd === "ROLE_USER03" && (prgrsSttsComCd === "LE" || prgrsSttsComCd === "TP")) {
|
||||
return "ENV";
|
||||
}
|
||||
|
||||
if (dtlInstCd === "ROLE_USER01" && prgrsSttsComCd === "TE") {
|
||||
return "KECO";
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
import type {
|
||||
BizCstItem,
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
BzScaleItem,
|
||||
CklstResultItem,
|
||||
EsntlAtchFileItem,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
FnrsCnsltnApplySaveRequestDto,
|
||||
FnrsCnsltnMngDetResponseDto,
|
||||
FnrsCnsltnMngResponseDto,
|
||||
FnrsCnsltnSplmntDmndItem,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
|
||||
import type { ChecklistFormState, ReviewStepCode } from "../model/view-types";
|
||||
|
||||
import { toCklstSaveDto } from "./checklist-utils";
|
||||
import { type ReviewOpinionFormData, toRvwOpnnSaveDto } from "./review-opinion-utils";
|
||||
|
||||
export function toBzScaleSaveDto(bizSclList: BizSclTreeDto[]): BzScaleItem[] {
|
||||
return bizSclList
|
||||
.filter((node) => node.useYn === "Y")
|
||||
.map((node) => ({
|
||||
cnstpSeCd: node.cnstpSeCd,
|
||||
bscPl: node.bscPlanQty,
|
||||
budgetReflct: node.bgtRfltQty,
|
||||
thtiDsgn: node.tstmDesignQty,
|
||||
}));
|
||||
}
|
||||
|
||||
export function toBizCstSaveDto(bizCstList: BizCstTreeDto[]): BizCstItem[] {
|
||||
return bizCstList
|
||||
.filter((node) => node.useYn === "Y")
|
||||
.map((node) => ({
|
||||
acntgSeCd: node.acntgSeCd,
|
||||
bscPlanAmt: node.bscPlanAmt,
|
||||
bgtRfltAmt: node.bgtRfltAmt,
|
||||
tstmDesignAmt: node.tstmDesignAmt,
|
||||
}));
|
||||
}
|
||||
|
||||
export function toEsntlAtchFileSaveDto(
|
||||
esntlFileList: EsntlAtchFileMngTreeResponseDto[],
|
||||
): EsntlAtchFileItem[] {
|
||||
const esntlMap = new Map<string, string>();
|
||||
|
||||
for (const item of esntlFileList) {
|
||||
if (!item.esntlAtchFileId || !item.atflCd) continue;
|
||||
esntlMap.set(item.esntlAtchFileId, item.atflCd);
|
||||
}
|
||||
|
||||
return Array.from(esntlMap.entries()).map(([esntlAtchFileId, atchFileGroupId]) => ({
|
||||
esntlAtchFileId,
|
||||
atchFileGroupId,
|
||||
}));
|
||||
}
|
||||
|
||||
export function buildSavePayload(
|
||||
data: FnrsCnsltnMngDetResponseDto,
|
||||
checklistFormState: ChecklistFormState,
|
||||
reviewStep: ReviewStepCode,
|
||||
prgrsSttsComCd: string,
|
||||
): FnrsCnsltnApplySaveRequestDto {
|
||||
const detDto = data.detDto;
|
||||
if (!detDto) {
|
||||
throw new Error("상세 정보(detDto)가 없습니다.");
|
||||
}
|
||||
|
||||
const bizSclList = data.bizSclList ?? [];
|
||||
const bizCstList = data.bizCstList ?? [];
|
||||
const cklstResultList = data.cklstResultList ?? [];
|
||||
const esntlFileList = data.esntlFileList ?? [];
|
||||
|
||||
return {
|
||||
fnrsCnsltnMng: { ...detDto, prgrsSttsComCd },
|
||||
bzScaleList: toBzScaleSaveDto(bizSclList),
|
||||
bizCstList: toBizCstSaveDto(bizCstList),
|
||||
cklstResultList: toCklstSaveDto(cklstResultList, checklistFormState, reviewStep),
|
||||
esntlAtchFileList: toEsntlAtchFileSaveDto(esntlFileList),
|
||||
};
|
||||
}
|
||||
|
||||
export function buildTechReviewReplyPayload(
|
||||
data: FnrsCnsltnMngDetResponseDto,
|
||||
checklistFormState: ChecklistFormState,
|
||||
reviewStep: ReviewStepCode,
|
||||
prgrsSttsComCd: string,
|
||||
techReViewSaveCd: string,
|
||||
reviewOpinionFormData?: ReviewOpinionFormData | null,
|
||||
opnrNm?: string,
|
||||
): FnrsCnsltnApplySaveRequestDto {
|
||||
return {
|
||||
...buildSavePayload(data, checklistFormState, reviewStep, prgrsSttsComCd),
|
||||
techReViewSaveCd,
|
||||
rvwStpCd: reviewStep,
|
||||
rvwOpnnList: toRvwOpnnSaveDto(data, reviewOpinionFormData, opnrNm),
|
||||
};
|
||||
}
|
||||
|
||||
export function buildSupplementReqPayload(
|
||||
data: FnrsCnsltnMngDetResponseDto,
|
||||
splmntDmndCn: string,
|
||||
): FnrsCnsltnApplySaveRequestDto {
|
||||
const detDto = data.detDto;
|
||||
if (!detDto) {
|
||||
throw new Error("상세 정보(detDto)가 없습니다.");
|
||||
}
|
||||
|
||||
const nextSn =
|
||||
(data.splmntDmndList?.reduce((max, item) => Math.max(max, item.splmntDmndSn ?? 0), 0) ?? 0) + 1;
|
||||
|
||||
const splmntDmndList: FnrsCnsltnSplmntDmndItem[] = [
|
||||
...(data.splmntDmndList ?? []),
|
||||
{
|
||||
splmntDmndSn: nextSn,
|
||||
splmntDmndCn,
|
||||
cmptnYn: "N",
|
||||
},
|
||||
];
|
||||
|
||||
return {
|
||||
fnrsCnsltnMng: detDto,
|
||||
splmntDmndList,
|
||||
};
|
||||
}
|
||||
|
||||
export function buildSupplementSubmitPayload(
|
||||
data: FnrsCnsltnMngDetResponseDto,
|
||||
checklistFormState: ChecklistFormState,
|
||||
): FnrsCnsltnApplySaveRequestDto {
|
||||
return {
|
||||
...buildSavePayload(data, checklistFormState, "LOCAL", "SL"),
|
||||
splmntDmndList: data.splmntDmndList,
|
||||
};
|
||||
}
|
||||
|
||||
export function buildTechReviewPayload(
|
||||
det: FnrsCnsltnMngResponseDto,
|
||||
cklstResultList: CklstResultItem[],
|
||||
): FnrsCnsltnApplySaveRequestDto {
|
||||
return {
|
||||
fnrsCnsltnMng: { ...det, prgrsSttsComCd: "ER" },
|
||||
bzScaleList: [],
|
||||
bizCstList: [],
|
||||
cklstResultList,
|
||||
esntlAtchFileList: [],
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
|
||||
import type { CklstRvwRsltTreeDto } from "@/entities/fnrs-cnsltn";
|
||||
|
||||
import {
|
||||
type ChecklistFormState,
|
||||
DEFAULT_CHECKLIST_PROGRESS,
|
||||
type ReviewStepCode,
|
||||
} from "../model/view-types";
|
||||
|
||||
import { mergeChecklistFormStateFromServer, patchChecklistFormState } from "./checklist-utils";
|
||||
|
||||
const EMPTY_CKLST_RESULT_LIST: CklstRvwRsltTreeDto[] = [];
|
||||
|
||||
function isSameChecklistFormState(a: ChecklistFormState, b: ChecklistFormState): boolean {
|
||||
if (
|
||||
a.progress.total !== b.progress.total ||
|
||||
a.progress.completed !== b.progress.completed ||
|
||||
a.progress.percent !== b.progress.percent
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const aResultKeys = Object.keys(a.results);
|
||||
if (aResultKeys.length !== Object.keys(b.results).length) return false;
|
||||
if (!aResultKeys.every((key) => a.results[key] === b.results[key])) return false;
|
||||
|
||||
const aCommentKeys = Object.keys(a.comments);
|
||||
if (aCommentKeys.length !== Object.keys(b.comments).length) return false;
|
||||
|
||||
return aCommentKeys.every((key) => a.comments[key] === b.comments[key]);
|
||||
}
|
||||
|
||||
function useChecklistFormState(cklstResultList: CklstRvwRsltTreeDto[] = EMPTY_CKLST_RESULT_LIST) {
|
||||
const [formState, setFormState] = useState<ChecklistFormState>({
|
||||
results: {},
|
||||
comments: {},
|
||||
progress: DEFAULT_CHECKLIST_PROGRESS,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setFormState((prev) => {
|
||||
const next = mergeChecklistFormStateFromServer(prev, cklstResultList);
|
||||
return isSameChecklistFormState(prev, next) ? prev : next;
|
||||
});
|
||||
}, [cklstResultList]);
|
||||
|
||||
const patchFormState = useCallback(
|
||||
(
|
||||
patch: Partial<Pick<ChecklistFormState, "results" | "comments">>,
|
||||
reviewStep?: ReviewStepCode,
|
||||
) => {
|
||||
setFormState((prev) => patchChecklistFormState(prev, patch, cklstResultList, reviewStep));
|
||||
},
|
||||
[cklstResultList],
|
||||
);
|
||||
|
||||
return { formState, setFormState, patchFormState };
|
||||
}
|
||||
|
||||
export { EMPTY_CKLST_RESULT_LIST, useChecklistFormState };
|
||||
@@ -0,0 +1,170 @@
|
||||
"use client";
|
||||
|
||||
import { Fragment } from "react";
|
||||
|
||||
import { createColumnHelper } from "@tanstack/react-table";
|
||||
|
||||
import { dayjs } from "@/shared/lib";
|
||||
import type { FnrsCnsltnMngResponseDto } from "@/entities/fnrs-cnsltn";
|
||||
import { Badge } from "@common/components";
|
||||
|
||||
const columnHelper = createColumnHelper<FnrsCnsltnMngResponseDto>();
|
||||
|
||||
const MAIN_STEP_LABELS = {
|
||||
save: "저장",
|
||||
apply: "신청완료",
|
||||
techReview: "기술검토",
|
||||
reply: "검토결과 회신",
|
||||
} as const;
|
||||
|
||||
const TECH_REVIEW_STATUS_CODES = new Set(["LE", "ER", "EE", "TE", "TS", "TR", "TP"]);
|
||||
|
||||
type BadgeState = "completed" | "current" | "pending" | "action";
|
||||
|
||||
interface ProgressBadge {
|
||||
label: string;
|
||||
state: BadgeState;
|
||||
}
|
||||
|
||||
function buildProgressBadges(prgrsSttsComCd: string, prgrsSttsCdNm: string): ProgressBadge[] {
|
||||
const techReviewLabel = prgrsSttsCdNm || MAIN_STEP_LABELS.techReview;
|
||||
const replyLabel = prgrsSttsCdNm || MAIN_STEP_LABELS.reply;
|
||||
|
||||
if (prgrsSttsComCd === "SV") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "current" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "pending" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "pending" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
|
||||
];
|
||||
}
|
||||
|
||||
if (prgrsSttsComCd === "ST") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "current" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "pending" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
|
||||
];
|
||||
}
|
||||
|
||||
if (TECH_REVIEW_STATUS_CODES.has(prgrsSttsComCd)) {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
|
||||
{ label: techReviewLabel, state: "action" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
|
||||
];
|
||||
}
|
||||
|
||||
if (prgrsSttsComCd === "EP") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "completed" },
|
||||
{ label: replyLabel, state: "action" },
|
||||
];
|
||||
}
|
||||
|
||||
if (prgrsSttsComCd === "TA" || prgrsSttsComCd === "TB") {
|
||||
return [
|
||||
{ label: MAIN_STEP_LABELS.save, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.techReview, state: "completed" },
|
||||
{ label: MAIN_STEP_LABELS.reply, state: "completed" },
|
||||
];
|
||||
}
|
||||
|
||||
return [{ label: prgrsSttsCdNm || prgrsSttsComCd || "-", state: "current" }];
|
||||
}
|
||||
|
||||
function getBadgeColor(state: BadgeState) {
|
||||
switch (state) {
|
||||
case "completed":
|
||||
return "green";
|
||||
case "current":
|
||||
return "blue";
|
||||
case "pending":
|
||||
return "lightGray";
|
||||
case "action":
|
||||
return "orange";
|
||||
}
|
||||
}
|
||||
|
||||
function formatOptional(value: string | undefined) {
|
||||
return value?.trim() ? value : "-";
|
||||
}
|
||||
|
||||
interface ProgressStepBadgeProps {
|
||||
prgrsSttsComCd: string;
|
||||
prgrsSttsCdNm: string;
|
||||
}
|
||||
|
||||
function ProgressStepBadge({ prgrsSttsComCd, prgrsSttsCdNm }: ProgressStepBadgeProps) {
|
||||
const badges = buildProgressBadges(prgrsSttsComCd, prgrsSttsCdNm);
|
||||
|
||||
return (
|
||||
<div className="flex flex-wrap items-center justify-start">
|
||||
{badges.map((badge, index) => (
|
||||
<Fragment key={badge.label}>
|
||||
{index > 0 && <span className="mx-2">></span>}
|
||||
<Badge color={getBadgeColor(badge.state)}>{badge.label}</Badge>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function createFnrsCnsltnColumns() {
|
||||
return [
|
||||
columnHelper.accessor("sido", {
|
||||
header: "시도",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("gugun", {
|
||||
header: "시군구",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("bizNm", {
|
||||
header: "사업명",
|
||||
meta: { align: "left" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("taskSeCdNm", {
|
||||
header: "업무구분",
|
||||
meta: { align: "center" },
|
||||
cell: ({ row }) => formatOptional(row.original.taskSeCdNm || row.original.taskSeComCd),
|
||||
}),
|
||||
columnHelper.accessor("aplcntNm", {
|
||||
header: "담당자",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.accessor("envoSeCdNm", {
|
||||
header: "해당기관",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => formatOptional(getValue()),
|
||||
}),
|
||||
columnHelper.display({
|
||||
id: "progress",
|
||||
header: "진행상황",
|
||||
meta: { align: "center" },
|
||||
cell: ({ row }) => (
|
||||
<ProgressStepBadge
|
||||
prgrsSttsComCd={row.original.prgrsSttsComCd || ""}
|
||||
prgrsSttsCdNm={row.original.prgrsSttsCdNm || ""}
|
||||
/>
|
||||
),
|
||||
}),
|
||||
columnHelper.accessor("regDt", {
|
||||
header: "신청일",
|
||||
meta: { align: "center" },
|
||||
cell: ({ getValue }) => {
|
||||
const value = getValue();
|
||||
return value ? dayjs(value).format("YYYY-MM-DD") : "-";
|
||||
},
|
||||
}),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import type {
|
||||
AtflMngClientResponseDto,
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
CklstRvwRsltTreeDto,
|
||||
ElaprDocPrgrsClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
FnrsCnsltnMngDetResponseDto,
|
||||
FnrsCnsltnMngResponseDto,
|
||||
FnrsCnsltnRvwOpnnResponseDto,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
|
||||
export type ReviewStepCode = "LOCAL" | "ENV" | "KECO";
|
||||
|
||||
export type {
|
||||
AtflMngClientResponseDto,
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
CklstRvwRsltTreeDto,
|
||||
ElaprDocPrgrsClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
FnrsCnsltnMngDetResponseDto,
|
||||
FnrsCnsltnMngResponseDto,
|
||||
FnrsCnsltnRvwOpnnResponseDto,
|
||||
};
|
||||
|
||||
export type ChecklistRowKey = string;
|
||||
|
||||
export interface ChecklistProgress {
|
||||
total: number;
|
||||
completed: number;
|
||||
percent: number;
|
||||
}
|
||||
|
||||
export const DEFAULT_CHECKLIST_PROGRESS: ChecklistProgress = {
|
||||
total: 0,
|
||||
completed: 0,
|
||||
percent: 0,
|
||||
};
|
||||
|
||||
export interface ChecklistFormState {
|
||||
results: Record<ChecklistRowKey, "Y" | "N">;
|
||||
comments: Record<ChecklistRowKey, string>;
|
||||
progress: ChecklistProgress;
|
||||
}
|
||||
|
||||
export type ChecklistStepMap = Record<ReviewStepCode, CklstRvwRsltTreeDto[]>;
|
||||
|
||||
export const REVIEW_STEP_CODES: ReviewStepCode[] = ["LOCAL", "ENV", "KECO"];
|
||||
|
||||
export const REVIEW_STEP_LABELS: Record<ReviewStepCode, string> = {
|
||||
LOCAL: "지자체",
|
||||
ENV: "환경청",
|
||||
KECO: "환경공단",
|
||||
};
|
||||
|
||||
export const TASK_CODE_LABELS: Record<string, string> = {
|
||||
RE: "재이용수",
|
||||
SP: "하수관로",
|
||||
SF: "하수처리시설",
|
||||
};
|
||||
|
||||
export const PBADMS_PROGRESS_ORDER = [
|
||||
"SV",
|
||||
"SL",
|
||||
"TA",
|
||||
"ST",
|
||||
"EP",
|
||||
"LE",
|
||||
"TP",
|
||||
"ER",
|
||||
"TE",
|
||||
"TB",
|
||||
] as const;
|
||||
|
||||
export const ROLE_TO_REVIEW_STEP: Record<string, ReviewStepCode> = {
|
||||
ROLE_USER05: "LOCAL",
|
||||
ROLE_USER03: "ENV",
|
||||
ROLE_USER01: "KECO",
|
||||
};
|
||||
|
||||
export const REVIEW_STEP_ROLE_RANK: Record<ReviewStepCode, number> = {
|
||||
LOCAL: 1,
|
||||
ENV: 2,
|
||||
KECO: 3,
|
||||
};
|
||||
@@ -0,0 +1,164 @@
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
|
||||
import type { CklstRvwRsltTreeDto } from "@/entities/fnrs-cnsltn";
|
||||
import {
|
||||
cn,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
Textarea,
|
||||
} from "@common/components";
|
||||
|
||||
import { buildChecklistRowKey, patchChecklistFormState } from "../../lib/checklist-utils";
|
||||
import type { ReviewStepCode } from "../../model/view-types";
|
||||
import { type ChecklistFormState, ROLE_TO_REVIEW_STEP } from "../../model/view-types";
|
||||
|
||||
interface ChecklistTaskPanelProps {
|
||||
selectedReviewStep: ReviewStepCode;
|
||||
selectedRows: CklstRvwRsltTreeDto[];
|
||||
allRows: CklstRvwRsltTreeDto[];
|
||||
formState: ChecklistFormState;
|
||||
setFormState: Dispatch<SetStateAction<ChecklistFormState>>;
|
||||
userRoleCode?: string;
|
||||
}
|
||||
|
||||
function ChecklistTaskPanel({
|
||||
selectedReviewStep,
|
||||
selectedRows,
|
||||
allRows,
|
||||
formState,
|
||||
setFormState,
|
||||
userRoleCode,
|
||||
}: ChecklistTaskPanelProps) {
|
||||
const currentUserReviewStep = userRoleCode ? ROLE_TO_REVIEW_STEP[userRoleCode] : undefined;
|
||||
const isStepEditable = currentUserReviewStep === selectedReviewStep;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[20rem]" rowSpan={2}>
|
||||
검토항목
|
||||
</TableHead>
|
||||
<TableHead rowSpan={2}>주요 검토내용</TableHead>
|
||||
<TableHead colSpan={2}>검토 결과</TableHead>
|
||||
{selectedReviewStep !== "LOCAL" ? (
|
||||
<TableHead rowSpan={2} className="w-[20rem]">
|
||||
기술검토 의견
|
||||
</TableHead>
|
||||
) : null}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead className="w-[9rem]">예</TableHead>
|
||||
<TableHead className="w-[9rem]">아니오</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{selectedRows.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={5} className="py-12 text-center text-muted-foreground">
|
||||
조회된 체크리스트 항목이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
selectedRows.map((row) => {
|
||||
const key = buildChecklistRowKey(row, selectedReviewStep);
|
||||
const isFieldVisible = row.bchckUseYn === "Y";
|
||||
const isLocalReviewStep = selectedReviewStep === "LOCAL";
|
||||
|
||||
return (
|
||||
<TableRow key={key}>
|
||||
<TableCell className="text-center text-[1.2rem]">{row.cklstArtclNm}</TableCell>
|
||||
<TableCell
|
||||
className="pl-2 !text-left text-[1.2rem] text-gray-600"
|
||||
style={{ paddingLeft: `${Math.max(0, row.treeLevel - 1) * 16 + 8}px` }}
|
||||
colSpan={isFieldVisible ? 0 : isLocalReviewStep ? 3 : 4}
|
||||
>
|
||||
{row.rvwCn}
|
||||
</TableCell>
|
||||
{isFieldVisible && (
|
||||
<>
|
||||
<TableCell className="text-center">
|
||||
<input
|
||||
type="radio"
|
||||
name={`chk_${key}`}
|
||||
value="Y"
|
||||
checked={formState.results[key] === "Y"}
|
||||
readOnly={!isStepEditable}
|
||||
onChange={() => {
|
||||
if (!isStepEditable) return;
|
||||
setFormState((prev) =>
|
||||
patchChecklistFormState(
|
||||
prev,
|
||||
{ results: { ...prev.results, [key]: "Y" } },
|
||||
allRows,
|
||||
selectedReviewStep,
|
||||
),
|
||||
);
|
||||
}}
|
||||
className={cn(isStepEditable ? "cursor-pointer" : "cursor-not-allowed")}
|
||||
/>
|
||||
</TableCell>
|
||||
<TableCell className="text-center">
|
||||
<input
|
||||
type="radio"
|
||||
name={`chk_${key}`}
|
||||
value="N"
|
||||
checked={formState.results[key] === "N"}
|
||||
readOnly={!isStepEditable}
|
||||
onChange={() => {
|
||||
if (!isStepEditable) return;
|
||||
setFormState((prev) =>
|
||||
patchChecklistFormState(
|
||||
prev,
|
||||
{ results: { ...prev.results, [key]: "N" } },
|
||||
allRows,
|
||||
selectedReviewStep,
|
||||
),
|
||||
);
|
||||
}}
|
||||
className={cn(isStepEditable ? "cursor-pointer" : "cursor-not-allowed")}
|
||||
/>
|
||||
</TableCell>
|
||||
</>
|
||||
)}
|
||||
{!isLocalReviewStep && isFieldVisible && (
|
||||
<TableCell className="text-left">
|
||||
<Textarea
|
||||
className={cn(
|
||||
"min-h-[6rem] !text-xl",
|
||||
isStepEditable ? "cursor-pointer" : "cursor-not-allowed",
|
||||
)}
|
||||
value={formState.comments[key] ?? ""}
|
||||
readOnly={!isStepEditable}
|
||||
onChange={(event) => {
|
||||
if (!isStepEditable) return;
|
||||
setFormState((prev) =>
|
||||
patchChecklistFormState(
|
||||
prev,
|
||||
{ comments: { ...prev.comments, [key]: event.target.value } },
|
||||
allRows,
|
||||
selectedReviewStep,
|
||||
),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</TableCell>
|
||||
)}
|
||||
</TableRow>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { ChecklistTaskPanel };
|
||||
@@ -0,0 +1,223 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { AxiosError } from "axios";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { useElaprDocPrgrsByDocNo } from "@/entities/elapr";
|
||||
import { processElaprPrgrs } from "@/entities/elapr/api/elapr-prgrs-service";
|
||||
import {
|
||||
Button,
|
||||
cn,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Skeleton,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
Textarea,
|
||||
} from "@common/components";
|
||||
|
||||
import { getApproverStatus, sortByAtrzSeqNo } from "../../lib/approval-utils";
|
||||
|
||||
interface ElaprApprovalDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
elaprDocNo: string;
|
||||
currentUserUuid: string;
|
||||
onSuccess: () => void;
|
||||
}
|
||||
|
||||
function ElaprApprovalDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
elaprDocNo,
|
||||
currentUserUuid,
|
||||
onSuccess,
|
||||
}: ElaprApprovalDialogProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const [rjctRsn, setRjctRsn] = useState("");
|
||||
const [isProcessing, setIsProcessing] = useState(false);
|
||||
|
||||
const { data: elaprDocPrgrsList = [], isLoading } = useElaprDocPrgrsByDocNo(
|
||||
open ? elaprDocNo : null,
|
||||
);
|
||||
|
||||
const orderedApprovers = sortByAtrzSeqNo(elaprDocPrgrsList);
|
||||
|
||||
const currentUserPrgrs = elaprDocPrgrsList.find(
|
||||
(row) => row.aprvrUuid === currentUserUuid && row.atrzPrgrsSttsComCd === "ATRZ_PRGRS_002",
|
||||
);
|
||||
const canApprove = Boolean(currentUserPrgrs?.elaprPrgrsId);
|
||||
|
||||
async function handleApprove() {
|
||||
if (!currentUserPrgrs?.elaprPrgrsId) return;
|
||||
|
||||
setIsProcessing(true);
|
||||
try {
|
||||
await processElaprPrgrs(currentUserPrgrs.elaprPrgrsId, "ATRZ_PRGRS_003");
|
||||
alert("결재가 완료되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
||||
});
|
||||
onSuccess();
|
||||
onOpenChange(false);
|
||||
} catch (error: unknown) {
|
||||
let errorMessage = "";
|
||||
if (error instanceof AxiosError) {
|
||||
errorMessage = error.response?.data?.message ?? "";
|
||||
} else {
|
||||
errorMessage = "결재 처리 중 오류가 발생했습니다.";
|
||||
}
|
||||
alert(errorMessage);
|
||||
} finally {
|
||||
setIsProcessing(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleReject() {
|
||||
if (!currentUserPrgrs?.elaprPrgrsId) return;
|
||||
if (!rjctRsn.trim()) {
|
||||
alert("반려 사유를 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
setIsProcessing(true);
|
||||
try {
|
||||
await processElaprPrgrs(currentUserPrgrs.elaprPrgrsId, "ATRZ_PRGRS_004");
|
||||
alert("반려 처리가 완료되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", elaprDocNo],
|
||||
});
|
||||
onSuccess();
|
||||
onOpenChange(false);
|
||||
} catch (error: unknown) {
|
||||
let errorMessage = "";
|
||||
if (error instanceof AxiosError) {
|
||||
errorMessage = error.response?.data?.message ?? "";
|
||||
} else {
|
||||
errorMessage = "반려 처리 중 오류가 발생했습니다.";
|
||||
}
|
||||
alert(errorMessage);
|
||||
} finally {
|
||||
setIsProcessing(false);
|
||||
}
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
setRjctRsn("");
|
||||
onOpenChange(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleClose}>
|
||||
<DialogContent className="max-w-[72rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>전자결재</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<h4 className="mb-3 text-xl font-semibold">결재 진행 단계</h4>
|
||||
{isLoading ? (
|
||||
<div className="space-y-3">
|
||||
<Skeleton className="h-12 w-full" />
|
||||
<Skeleton className="h-32 w-full" />
|
||||
</div>
|
||||
) : orderedApprovers.length === 0 ? (
|
||||
<div className="text-center text-gray-500">결재 정보가 없습니다.</div>
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="line">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
{orderedApprovers.map((row) => (
|
||||
<TableHead key={String(row.elaprPrgrsId ?? row.atrzSeComCd)}>
|
||||
{row.atrzSeComNm ?? row.atrzSeComCd}
|
||||
</TableHead>
|
||||
))}
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
{orderedApprovers.map((row) => {
|
||||
const status = row.atrzPrgrsSttsComCd ?? "";
|
||||
const st = getApproverStatus(status);
|
||||
|
||||
return (
|
||||
<TableCell
|
||||
key={String(row.elaprPrgrsId ?? row.atrzSeComCd)}
|
||||
align="center"
|
||||
>
|
||||
<div className="flex items-center justify-center gap-2">
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex items-center rounded-md px-2 py-1 text-base font-semibold",
|
||||
st.badgeClass,
|
||||
)}
|
||||
>
|
||||
{st.label}
|
||||
</span>
|
||||
<span className="font-semibold">{row.aprvrUuidNm ?? "-"}</span>
|
||||
</div>
|
||||
<div className="mt-2 text-base text-gray-500">
|
||||
{row.ognzNm ?? ""}
|
||||
{row.jbpsSeNm || row.jbgdSeNm
|
||||
? ` · ${row.jbpsSeNm ?? ""}${row.jbgdSeNm ? ` ${row.jbgdSeNm}` : ""}`
|
||||
: ""}
|
||||
</div>
|
||||
</TableCell>
|
||||
);
|
||||
})}
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{canApprove && (
|
||||
<div>
|
||||
<h4 className="mb-3 text-xl font-semibold">반려 의견</h4>
|
||||
<Textarea
|
||||
value={rjctRsn}
|
||||
onChange={(event) => setRjctRsn(event.target.value)}
|
||||
placeholder="반려 시 사유를 입력하세요"
|
||||
rows={4}
|
||||
className="!text-xl"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" color="white" onClick={handleClose} disabled={isProcessing}>
|
||||
취소
|
||||
</Button>
|
||||
{canApprove && (
|
||||
<>
|
||||
<Button color="red" onClick={handleReject} disabled={isProcessing}>
|
||||
반려
|
||||
</Button>
|
||||
<Button onClick={handleApprove} disabled={isProcessing}>
|
||||
결재
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export { ElaprApprovalDialog };
|
||||
@@ -0,0 +1,137 @@
|
||||
"use client";
|
||||
|
||||
import { Fragment } from "react";
|
||||
|
||||
import { type ElaprTmplt, useElaprAplnPage, useElaprTmpltPage } from "@/entities/elapr";
|
||||
import {
|
||||
Badge,
|
||||
Button,
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Skeleton,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
const PAGE_SIZE = 100;
|
||||
|
||||
interface ElaprTmpltPickerDialogProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onSelect: (tmplt: ElaprTmplt) => void;
|
||||
}
|
||||
|
||||
function ElaprTmpltPickerDialog({ open, onClose, onSelect }: ElaprTmpltPickerDialogProps) {
|
||||
const { data, isPending, isError } = useElaprTmpltPage({
|
||||
page: 0,
|
||||
size: PAGE_SIZE,
|
||||
sort: "regDt,desc",
|
||||
docSeComCd: "FNRS",
|
||||
});
|
||||
|
||||
const items = data?.content ?? [];
|
||||
|
||||
function handleSelect(tmplt: ElaprTmplt) {
|
||||
onSelect(tmplt);
|
||||
onClose();
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onClose}>
|
||||
<DialogContent className="max-w-[80rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>결재선 선택</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="max-h-[36rem] overflow-auto">
|
||||
{isPending ? (
|
||||
<div className="flex flex-col gap-2">
|
||||
<Skeleton className="h-[4rem]" />
|
||||
<Skeleton className="h-[16rem]" />
|
||||
</div>
|
||||
) : isError ? (
|
||||
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||
결재서식 목록을 불러오지 못했습니다.
|
||||
</p>
|
||||
) : items.length === 0 ? (
|
||||
<p className="py-8 text-center text-lg text-muted-foreground">
|
||||
선택 가능한 결재서식이 없습니다.
|
||||
</p>
|
||||
) : (
|
||||
<Table className="w-full">
|
||||
<colgroup>
|
||||
<col width="25%" />
|
||||
<col width="25%" />
|
||||
<col width="40%" />
|
||||
<col width="10%" />
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>결재서식명</TableHead>
|
||||
<TableHead>서식 설명</TableHead>
|
||||
<TableHead>검토자</TableHead>
|
||||
<TableHead>선택</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{items.map((item) => (
|
||||
<TableRow key={item.elaprTmpltId}>
|
||||
<TableCell align="center">{item.elaprTmpltNm}</TableCell>
|
||||
<TableCell align="center">{item.elaprTmpltExpln || "-"}</TableCell>
|
||||
<TableCell align="center">
|
||||
<ElaprAplnCell elaprTmpltId={item.elaprTmpltId} />
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
<Button type="button" size="sm" onClick={() => handleSelect(item)}>
|
||||
선택
|
||||
</Button>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<DialogFooter>
|
||||
<Button type="button" color="white" onClick={onClose}>
|
||||
닫기
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
function ElaprAplnCell({ elaprTmpltId }: { elaprTmpltId: string }) {
|
||||
const { data } = useElaprAplnPage({
|
||||
elaprTmpltId,
|
||||
page: 0,
|
||||
size: PAGE_SIZE,
|
||||
sort: "atrzSeqNo,asc",
|
||||
});
|
||||
|
||||
const items = data?.content ?? [];
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-2">
|
||||
{items.map((item) => (
|
||||
<Fragment key={item.aplnId}>
|
||||
<div className="flex items-center gap-1">
|
||||
<Badge color="gray">{item.atrzSeComNm}</Badge>
|
||||
{item.aprvrNm}
|
||||
</div>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { ElaprTmpltPickerDialog };
|
||||
@@ -0,0 +1,640 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { AxiosError } from "axios";
|
||||
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import { type ElaprDmndSaveRequestDto, elaprDmndService, type ElaprTmplt } from "@/entities/elapr";
|
||||
import {
|
||||
type DocPrgrsUpdateRequestDto,
|
||||
type FnrsCnsltnApplySaveRequestDto,
|
||||
fnrsCnsltnMngBaseKey,
|
||||
type FnrsCnsltnMngDetResponseDto,
|
||||
fnrsCnsltnMngService,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
import { useRvwMnpwMngLoginUserList } from "@/entities/rvw-mnpw";
|
||||
import { TextInputDialog } from "@/widgets/pbadms-sprt";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import {
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION,
|
||||
type FnrsCnsltnViewButtonAction,
|
||||
getButtonConfigs,
|
||||
needsRoleUser01AtrzResolve,
|
||||
} from "../../lib/button-config";
|
||||
import { computeReviewStepChecklistProgress } from "../../lib/checklist-utils";
|
||||
import {
|
||||
buildSavePayload,
|
||||
buildSupplementReqPayload,
|
||||
buildSupplementSubmitPayload,
|
||||
buildTechReviewReplyPayload,
|
||||
} from "../../lib/save-payload-utils";
|
||||
import { type ChecklistFormState } from "../../model/view-types";
|
||||
import type { TechReviewOpinionSectionHandle } from "../sections/tech-review-opinion-section";
|
||||
|
||||
import { ElaprApprovalDialog } from "./elapr-approval-dialog";
|
||||
import { ElaprTmpltPickerDialog } from "./elapr-tmplt-picker-dialog";
|
||||
|
||||
interface FloatingActionButtonsProps {
|
||||
data: FnrsCnsltnMngDetResponseDto;
|
||||
docSeComCd: string;
|
||||
fnrsCnsltnDocNo: string;
|
||||
prgrsSttsComCd: string;
|
||||
dtlInstCd: string | undefined;
|
||||
checklistFormState: ChecklistFormState;
|
||||
techReviewOpinionRef?: React.RefObject<TechReviewOpinionSectionHandle | null>;
|
||||
opnrNm?: string;
|
||||
}
|
||||
|
||||
type ActiveDialog = "elaprTmplt" | "rjct" | "dmndSplmnt" | "elaprApproval" | null;
|
||||
|
||||
function FloatingActionButtons({
|
||||
data,
|
||||
docSeComCd,
|
||||
fnrsCnsltnDocNo,
|
||||
prgrsSttsComCd,
|
||||
dtlInstCd,
|
||||
checklistFormState,
|
||||
techReviewOpinionRef,
|
||||
opnrNm,
|
||||
}: FloatingActionButtonsProps) {
|
||||
const router = useRouter();
|
||||
const { confirm } = useConfirm();
|
||||
const queryClient = useQueryClient();
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const [isProcessing, setIsProcessing] = useState(false);
|
||||
const [activeDialog, setActiveDialog] = useState<ActiveDialog>(null);
|
||||
|
||||
const docNo = data.detDto?.fnrsCnsltnDocNo ?? fnrsCnsltnDocNo;
|
||||
const isRegister = data.detDto?.rgtr === userInfo?.userUnqId;
|
||||
|
||||
const needsAtrzResolve = needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd);
|
||||
const { data: rvwLoginUserData, isLoading: isRvwLoginUserLoading } = useRvwMnpwMngLoginUserList(
|
||||
{},
|
||||
{ enabled: needsAtrzResolve },
|
||||
);
|
||||
|
||||
const atrzSeComCdList = useMemo(
|
||||
() => rvwLoginUserData?.content?.map((item) => item.atrzSeComCd) ?? [],
|
||||
[rvwLoginUserData],
|
||||
);
|
||||
|
||||
const actionButtons = useMemo(() => {
|
||||
if (needsAtrzResolve && isRvwLoginUserLoading) return [];
|
||||
return getButtonConfigs(dtlInstCd, prgrsSttsComCd, atrzSeComCdList);
|
||||
}, [atrzSeComCdList, dtlInstCd, isRvwLoginUserLoading, needsAtrzResolve, prgrsSttsComCd]);
|
||||
|
||||
const canEdit =
|
||||
isRegister && actionButtons.some((button) => button === FNRS_CNSLTN_VIEW_BUTTON_ACTION.strg);
|
||||
|
||||
function handleGoToList() {
|
||||
router.push("/fnrs-cnsltn");
|
||||
}
|
||||
|
||||
function handleEdit() {
|
||||
router.push(`/fnrs-cnsltn/${fnrsCnsltnDocNo}/edit`);
|
||||
}
|
||||
|
||||
function shouldShowButton(action: FnrsCnsltnViewButtonAction) {
|
||||
return actionButtons.some((button) => button === action);
|
||||
}
|
||||
|
||||
async function executeAction({
|
||||
action,
|
||||
request,
|
||||
successMessage,
|
||||
}: {
|
||||
action: FnrsCnsltnViewButtonAction;
|
||||
request?: unknown;
|
||||
successMessage?: string;
|
||||
}) {
|
||||
const handler = buttonActionHandlers[action];
|
||||
if (!handler) return;
|
||||
|
||||
setIsProcessing(true);
|
||||
try {
|
||||
await handler({
|
||||
request,
|
||||
data,
|
||||
onSuccess: () => {
|
||||
alert(successMessage ?? "처리가 완료되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", fnrsCnsltnDocNo],
|
||||
});
|
||||
},
|
||||
onError: (error) => {
|
||||
let errorMessage = "";
|
||||
if (error instanceof AxiosError) {
|
||||
errorMessage = error.response?.data?.message ?? "";
|
||||
} else {
|
||||
errorMessage = error.message ?? "처리 중 오류가 발생했습니다.";
|
||||
}
|
||||
alert(errorMessage);
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
setIsProcessing(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleStrgClick() {
|
||||
const payload: FnrsCnsltnApplySaveRequestDto = buildSavePayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"LOCAL",
|
||||
"SV",
|
||||
);
|
||||
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.strg,
|
||||
request: payload,
|
||||
successMessage: "저장되었습니다.",
|
||||
});
|
||||
}
|
||||
|
||||
async function handleAplyClick() {
|
||||
const { percent } = computeReviewStepChecklistProgress(
|
||||
data.cklstResultList ?? [],
|
||||
checklistFormState.results,
|
||||
"LOCAL",
|
||||
);
|
||||
const payload: FnrsCnsltnApplySaveRequestDto = buildSavePayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"LOCAL",
|
||||
"ST",
|
||||
);
|
||||
|
||||
if (percent !== 100) {
|
||||
alert("모든 체크리스트 항목을 체크해야 신청이 가능합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.aply,
|
||||
request: payload,
|
||||
successMessage: "신청 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleDelClick() {
|
||||
if (!(await confirm("삭제하시겠습니까?"))) return;
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.del,
|
||||
successMessage: "삭제되었습니다.",
|
||||
});
|
||||
router.push("/fnrs-cnsltn");
|
||||
}
|
||||
|
||||
async function handleFnrsCnsltnAncmntClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "TB",
|
||||
};
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.fnrsCnsltnAncmnt,
|
||||
request: payload,
|
||||
successMessage: "고시되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleEnvoSbmsnClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "LE",
|
||||
};
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.envoSbmsn,
|
||||
request: payload,
|
||||
successMessage: "제출되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleRjctClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "SV",
|
||||
};
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.rjct,
|
||||
request: payload,
|
||||
successMessage: "반려되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleSncnAprvClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "TA",
|
||||
};
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.sncnAprv,
|
||||
request: payload,
|
||||
successMessage: "인가승인되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
function getReviewOpinionFormData() {
|
||||
return techReviewOpinionRef?.current?.getFormData() ?? null;
|
||||
}
|
||||
|
||||
async function handleRvwRplyClick() {
|
||||
const { percent } = computeReviewStepChecklistProgress(
|
||||
data.cklstResultList ?? [],
|
||||
checklistFormState.results,
|
||||
"ENV",
|
||||
);
|
||||
|
||||
if (percent !== 100) {
|
||||
alert("모든 체크리스트 항목을 체크해야 검토결과 회신이 가능합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = buildTechReviewReplyPayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"ENV",
|
||||
"EP",
|
||||
"CP",
|
||||
getReviewOpinionFormData(),
|
||||
opnrNm,
|
||||
);
|
||||
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRply,
|
||||
request: payload,
|
||||
successMessage: "검토결과 회신이 완료되었습니다.",
|
||||
});
|
||||
techReviewOpinionRef?.current?.resetForm();
|
||||
}
|
||||
|
||||
async function handleRqstTechRvwClick() {
|
||||
const payload: DocPrgrsUpdateRequestDto = {
|
||||
docNo,
|
||||
docSeComCd,
|
||||
prgrsSttsComCd: "ER",
|
||||
};
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.rqstTechRvw,
|
||||
request: payload,
|
||||
successMessage: "기술검토 의뢰가 완료되었습니다.",
|
||||
});
|
||||
queryClient.invalidateQueries({ queryKey: fnrsCnsltnMngBaseKey });
|
||||
}
|
||||
|
||||
async function handleElaprTmpltSelect(tmplt: ElaprTmplt) {
|
||||
const payload = {
|
||||
elaprDocNo: data.detDto?.fnrsCnsltnDocNo ?? fnrsCnsltnDocNo,
|
||||
elaprTmpltId: tmplt.elaprTmpltId,
|
||||
dmndTtl: data.detDto?.bizNm,
|
||||
dmndCn: data.detDto?.bizCn,
|
||||
};
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.dsgntRvwr,
|
||||
request: payload,
|
||||
successMessage: "검토자가 지정되었습니다.",
|
||||
});
|
||||
}
|
||||
|
||||
async function handleRvwStrgClick() {
|
||||
const payload = buildTechReviewReplyPayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"KECO",
|
||||
"TE",
|
||||
"SV",
|
||||
getReviewOpinionFormData(),
|
||||
opnrNm,
|
||||
);
|
||||
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwStrg,
|
||||
request: payload,
|
||||
successMessage: "저장되었습니다.",
|
||||
});
|
||||
techReviewOpinionRef?.current?.resetForm();
|
||||
}
|
||||
|
||||
async function handleRvwCmptnClick() {
|
||||
const { percent } = computeReviewStepChecklistProgress(
|
||||
data.cklstResultList ?? [],
|
||||
checklistFormState.results,
|
||||
"KECO",
|
||||
);
|
||||
|
||||
if (percent !== 100) {
|
||||
alert("모든 체크리스트 항목을 체크해야 검토완료가 가능합니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = buildTechReviewReplyPayload(
|
||||
data,
|
||||
checklistFormState,
|
||||
"KECO",
|
||||
"TE",
|
||||
"CP",
|
||||
getReviewOpinionFormData(),
|
||||
opnrNm,
|
||||
);
|
||||
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwCmptn,
|
||||
request: payload,
|
||||
successMessage: "검토완료 처리되었습니다.",
|
||||
});
|
||||
techReviewOpinionRef?.current?.resetForm();
|
||||
}
|
||||
|
||||
function handleDmndSplmntClick() {
|
||||
setActiveDialog("dmndSplmnt");
|
||||
}
|
||||
|
||||
async function handleDmndSplmntConfirm(splmntDmndCn: string) {
|
||||
setActiveDialog(null);
|
||||
const payload = buildSupplementReqPayload(data, splmntDmndCn);
|
||||
await executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt,
|
||||
request: payload,
|
||||
successMessage: "보완요청이 처리되었습니다.",
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="sticky bottom-0 z-40 !-mb-2 border-t bg-white pb-8 pt-6 shadow-[0_-4px_12px_rgba(0,0,0,0.06)]">
|
||||
<div className="mx-4 flex flex-wrap justify-center gap-3 sm:gap-4">
|
||||
<Button color="white" type="button" onClick={handleGoToList} disabled={isProcessing}>
|
||||
목록
|
||||
</Button>
|
||||
{canEdit && (
|
||||
<Button color="gray" onClick={handleEdit} disabled={isProcessing}>
|
||||
수정
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.strg) && (
|
||||
<Button onClick={handleStrgClick} disabled={isProcessing}>
|
||||
저장
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.aply) && (
|
||||
<Button color="green" onClick={handleAplyClick} disabled={isProcessing}>
|
||||
신청완료
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.del) && (
|
||||
<Button color="red" onClick={handleDelClick} disabled={isProcessing}>
|
||||
삭제
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.splmntCmptn) && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
const payload = buildSupplementSubmitPayload(data, checklistFormState);
|
||||
void executeAction({
|
||||
action: FNRS_CNSLTN_VIEW_BUTTON_ACTION.splmntCmptn,
|
||||
request: payload,
|
||||
successMessage: "보완완료 처리되었습니다.",
|
||||
});
|
||||
}}
|
||||
disabled={isProcessing}
|
||||
>
|
||||
보완완료
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.fnrsCnsltnAncmnt) && (
|
||||
<Button onClick={handleFnrsCnsltnAncmntClick} disabled={isProcessing}>
|
||||
재원협의 고시
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.envoSbmsn) && (
|
||||
<Button onClick={handleEnvoSbmsnClick} disabled={isProcessing}>
|
||||
환경청제출
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rjct) && (
|
||||
<Button color="red" onClick={handleRjctClick} disabled={isProcessing}>
|
||||
반려
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.sncnAprv) && (
|
||||
<Button onClick={handleSncnAprvClick} disabled={isProcessing}>
|
||||
인가승인
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwRply) && (
|
||||
<Button color="green" onClick={handleRvwRplyClick} disabled={isProcessing}>
|
||||
검토결과 회신
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rqstTechRvw) && (
|
||||
<Button onClick={handleRqstTechRvwClick} disabled={isProcessing}>
|
||||
기술검토 의뢰
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.dsgntRvwr) && (
|
||||
<Button onClick={() => setActiveDialog("elaprTmplt")} disabled={isProcessing}>
|
||||
검토자지정
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwStrg) && (
|
||||
<Button onClick={handleRvwStrgClick} disabled={isProcessing}>
|
||||
저장
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.rvwCmptn) && (
|
||||
<Button color="green" onClick={handleRvwCmptnClick} disabled={isProcessing}>
|
||||
검토완료
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.dmndSplmnt) && (
|
||||
<Button color="gray" onClick={handleDmndSplmntClick} disabled={isProcessing}>
|
||||
보완요청
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzAprv) && (
|
||||
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isProcessing}>
|
||||
결재(승인)
|
||||
</Button>
|
||||
)}
|
||||
{shouldShowButton(FNRS_CNSLTN_VIEW_BUTTON_ACTION.atrzRply) && (
|
||||
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isProcessing}>
|
||||
결재(회신)
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ElaprTmpltPickerDialog
|
||||
open={activeDialog === "elaprTmplt"}
|
||||
onClose={() => setActiveDialog(null)}
|
||||
onSelect={handleElaprTmpltSelect}
|
||||
/>
|
||||
|
||||
<TextInputDialog
|
||||
open={activeDialog === "dmndSplmnt"}
|
||||
onOpenChange={() => setActiveDialog(null)}
|
||||
title="보완요청 내용 입력"
|
||||
placeholder="보완요청 내용을 입력하세요."
|
||||
isSubmitting={isProcessing}
|
||||
onConfirm={(value) => void handleDmndSplmntConfirm(value)}
|
||||
/>
|
||||
|
||||
<ElaprApprovalDialog
|
||||
open={activeDialog === "elaprApproval"}
|
||||
onOpenChange={(open) => setActiveDialog(open ? "elaprApproval" : null)}
|
||||
elaprDocNo={data.detDto?.fnrsCnsltnDocNo ?? fnrsCnsltnDocNo}
|
||||
currentUserUuid={userInfo?.userUnqId ?? ""}
|
||||
onSuccess={() => {
|
||||
setActiveDialog(null);
|
||||
alert("결재가 완료되었습니다.");
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", fnrsCnsltnDocNo],
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { FloatingActionButtons };
|
||||
|
||||
async function handleSaveApply(
|
||||
context: ActionHandlerContext<FnrsCnsltnApplySaveRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await fnrsCnsltnMngService.saveApply(context.request);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDel(context: ActionHandlerContext): Promise<void> {
|
||||
try {
|
||||
await fnrsCnsltnMngService.remove(context.data.detDto?.fnrsCnsltnDocNo ?? "");
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSplmntCmptn(
|
||||
context: ActionHandlerContext<FnrsCnsltnApplySaveRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const docNo = context.data.detDto?.fnrsCnsltnDocNo;
|
||||
if (!docNo) throw new Error("문서번호가 없습니다.");
|
||||
await fnrsCnsltnMngService.submitSupplement(docNo, context.request);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleChangePrgrsSttsComCd(
|
||||
context: ActionHandlerContext<DocPrgrsUpdateRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await fnrsCnsltnMngService.changePrgrsSttsComCd(context.request);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleTechReview(
|
||||
context: ActionHandlerContext<FnrsCnsltnApplySaveRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await fnrsCnsltnMngService.techReview(
|
||||
context.data.detDto?.fnrsCnsltnDocNo ?? "",
|
||||
context.request,
|
||||
);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDsgntRvwr(
|
||||
context: ActionHandlerContext<ElaprDmndSaveRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
await elaprDmndService.save(context.request);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDmndSplmnt(
|
||||
context: ActionHandlerContext<FnrsCnsltnApplySaveRequestDto>,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const docNo = context.data.detDto?.fnrsCnsltnDocNo;
|
||||
if (!docNo) throw new Error("문서번호가 없습니다.");
|
||||
await fnrsCnsltnMngService.submitReqSupplement(docNo, context.request);
|
||||
context.onSuccess?.();
|
||||
} catch (error) {
|
||||
context.onError?.(error as Error);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAtrzAprv(context: ActionHandlerContext): Promise<void> {
|
||||
// TODO: 결재 승인 처리 API 호출
|
||||
context.onSuccess?.();
|
||||
}
|
||||
|
||||
async function handleAtrzRply(context: ActionHandlerContext): Promise<void> {
|
||||
// TODO: 결재 회신 처리 API 호출
|
||||
context.onSuccess?.();
|
||||
}
|
||||
|
||||
async function handleGrndsChck(context: ActionHandlerContext): Promise<void> {
|
||||
// TODO: 현장점검 등록 API 호출
|
||||
context.onSuccess?.();
|
||||
}
|
||||
|
||||
const buttonActionHandlers: Record<FnrsCnsltnViewButtonAction, ActionHandler> = {
|
||||
strg: handleSaveApply,
|
||||
aply: handleSaveApply,
|
||||
del: handleDel,
|
||||
splmntCmptn: handleSplmntCmptn,
|
||||
fnrsCnsltnAncmnt: handleChangePrgrsSttsComCd,
|
||||
envoSbmsn: handleChangePrgrsSttsComCd,
|
||||
rjct: handleChangePrgrsSttsComCd,
|
||||
sncnAprv: handleChangePrgrsSttsComCd,
|
||||
rvwRply: handleTechReview,
|
||||
rqstTechRvw: handleChangePrgrsSttsComCd,
|
||||
dsgntRvwr: handleDsgntRvwr,
|
||||
rvwStrg: handleTechReview,
|
||||
rvwCmptn: handleTechReview,
|
||||
dmndSplmnt: handleDmndSplmnt,
|
||||
atrzAprv: handleAtrzAprv,
|
||||
atrzRply: handleAtrzRply,
|
||||
grndsChck: handleGrndsChck,
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
interface ActionHandlerContext<T = any> {
|
||||
request: T;
|
||||
data: FnrsCnsltnMngDetResponseDto;
|
||||
onSuccess?: () => void;
|
||||
onError?: (error: Error) => void;
|
||||
}
|
||||
|
||||
type ActionHandler = (context: ActionHandlerContext) => Promise<void>;
|
||||
@@ -0,0 +1,25 @@
|
||||
"use client";
|
||||
|
||||
import { useFnrsCnsltnMng } from "@/entities/fnrs-cnsltn";
|
||||
|
||||
import { FnrsFormPage } from "./fnrs-form-page";
|
||||
|
||||
interface FnrsEditPageProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
function FnrsEditPage({ id }: FnrsEditPageProps) {
|
||||
const { data, isLoading } = useFnrsCnsltnMng(id);
|
||||
|
||||
if (isLoading) {
|
||||
return <div className="mt-6 text-[1.4rem]">불러오는 중...</div>;
|
||||
}
|
||||
|
||||
if (!data?.detDto) {
|
||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
return <FnrsFormPage id={id} mode="edit" initialData={data} />;
|
||||
}
|
||||
|
||||
export { FnrsEditPage };
|
||||
@@ -0,0 +1,137 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { FormProvider, useForm } from "react-hook-form";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import {
|
||||
fnrsCnsltnMngBaseKey,
|
||||
type FnrsCnsltnMngDetResponseDto,
|
||||
fnrsCnsltnMngService,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
import {
|
||||
AttachmentsFormSection,
|
||||
BusinessCostFormSection,
|
||||
BusinessScaleFormSection,
|
||||
ChecklistFormSection,
|
||||
ContactInfoFormSection,
|
||||
PrivacyConsentSection,
|
||||
} from "@/widgets/pbadms-sprt";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import {
|
||||
type FnrsCnsltnRegistFormData,
|
||||
fnrsCnsltnRegistSchema,
|
||||
formatTaskSeComCdForApi,
|
||||
} from "../lib/fnrs-cnsltn-regist-schema";
|
||||
import { getCreateDefaultValues, mapDetailToFormData } from "../lib/form-data-mapper";
|
||||
|
||||
import { BasicInfoFormSection } from "./sections/basic-info-form-section";
|
||||
interface FnrsFormPageProps {
|
||||
id?: string;
|
||||
mode: "create" | "edit";
|
||||
initialData?: FnrsCnsltnMngDetResponseDto;
|
||||
taskSeComCd?: string[];
|
||||
}
|
||||
|
||||
function FnrsFormPage({ id, mode, initialData, taskSeComCd }: FnrsFormPageProps) {
|
||||
const queryClient = useQueryClient();
|
||||
const router = useRouter();
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const isEditMode = mode === "edit";
|
||||
|
||||
const form = useForm<FnrsCnsltnRegistFormData>({
|
||||
resolver: zodResolver(fnrsCnsltnRegistSchema),
|
||||
mode: "onChange",
|
||||
defaultValues:
|
||||
isEditMode && initialData
|
||||
? mapDetailToFormData(initialData)
|
||||
: getCreateDefaultValues(userInfo, taskSeComCd),
|
||||
});
|
||||
|
||||
async function onSave(data: FnrsCnsltnRegistFormData) {
|
||||
if (isSubmitting) return;
|
||||
|
||||
try {
|
||||
setIsSubmitting(true);
|
||||
|
||||
const { taskSeComCd, ...fnrsCnsltnMngRest } = data.fnrsCnsltnMng;
|
||||
|
||||
const payload = {
|
||||
fnrsCnsltnMng: {
|
||||
...fnrsCnsltnMngRest,
|
||||
taskSeComCd: formatTaskSeComCdForApi(taskSeComCd),
|
||||
fnrsCnsltnDocNo: isEditMode ? initialData?.detDto?.fnrsCnsltnDocNo : undefined,
|
||||
prgrsSttsComCd: "SV",
|
||||
},
|
||||
bzScaleList: data.bzScaleList,
|
||||
bizCstList: data.bizCstList,
|
||||
cklstResultList: data.cklstResultList.map((item) => ({
|
||||
...item,
|
||||
selected: item.selected ?? undefined,
|
||||
})),
|
||||
esntlAtchFileList: data.esntlAtchFileList,
|
||||
};
|
||||
|
||||
const fnrsCnsltnDocNo = await fnrsCnsltnMngService.saveApply(payload);
|
||||
|
||||
alert("저장되었습니다.");
|
||||
router.push(`/fnrs-cnsltn/${fnrsCnsltnDocNo}`);
|
||||
if (isEditMode && id) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [...fnrsCnsltnMngBaseKey, "findById", id],
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("저장 실패:", error);
|
||||
alert("저장 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<FormProvider {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSave)} className="mt-6 space-y-4">
|
||||
<BasicInfoFormSection />
|
||||
<ContactInfoFormSection fieldPrefix="fnrsCnsltnMng" />
|
||||
<PrivacyConsentSection />
|
||||
<BusinessScaleFormSection />
|
||||
<BusinessCostFormSection />
|
||||
<ChecklistFormSection docSeComCd="FNRS" fieldPrefix="fnrsCnsltnMng" />
|
||||
<AttachmentsFormSection
|
||||
docSeComCd="FNRS"
|
||||
fieldPrefix="fnrsCnsltnMng"
|
||||
initialEsntlFiles={isEditMode ? initialData?.esntlFileList : undefined}
|
||||
initialEtcFiles={isEditMode ? initialData?.etcFileList : undefined}
|
||||
/>
|
||||
|
||||
<div className="sticky bottom-0 z-40 !-mb-2 border-t bg-white pb-8 pt-6 shadow-[0_-4px_12px_rgba(0,0,0,0.06)]">
|
||||
<div className="mx-4 flex flex-wrap justify-center gap-3 sm:gap-4">
|
||||
<Button
|
||||
color="white"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
router.back();
|
||||
}}
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
목록
|
||||
</Button>
|
||||
<Button type="submit" disabled={isSubmitting}>
|
||||
저장
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</FormProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export { FnrsFormPage };
|
||||
@@ -0,0 +1,152 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
import type { PaginationState } from "@tanstack/react-table";
|
||||
|
||||
import {
|
||||
type CmCdAdstDstrComboResponseDto,
|
||||
useFindGugunCombo,
|
||||
useFindSidoCombo,
|
||||
} from "@/entities/adstdstr";
|
||||
import { CodeSelect } from "@/entities/code";
|
||||
import type { FnrsCnsltnMngSearchDto } from "@/entities/fnrs-cnsltn";
|
||||
import {
|
||||
Button,
|
||||
Input,
|
||||
Label,
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@common/components";
|
||||
|
||||
import { FnrsList } from "./fnrs-list";
|
||||
|
||||
const DEFAULT_PAGE_INDEX = 0;
|
||||
const DEFAULT_PAGE_SIZE = 10;
|
||||
const DEFAULT_SORT = "fnrsCnsltnDocNo,desc";
|
||||
const EMPTY_ADST_LIST: CmCdAdstDstrComboResponseDto[] = [];
|
||||
|
||||
const DEFAULT_SEARCH_PARAMS: FnrsCnsltnMngSearchDto = {
|
||||
bizNm: "",
|
||||
taskSeComCd: "",
|
||||
admdstCd: "",
|
||||
page: DEFAULT_PAGE_INDEX,
|
||||
size: DEFAULT_PAGE_SIZE,
|
||||
sort: DEFAULT_SORT,
|
||||
};
|
||||
|
||||
const ALL_SELECT_VALUE = "__ALL__";
|
||||
|
||||
function FnrsListPage() {
|
||||
const [bizNm, setBizNm] = useState("");
|
||||
const [taskSeComCd, setTaskSeComCd] = useState("");
|
||||
const [sidoComCd, setSidoComCd] = useState("");
|
||||
const [sggComCd, setSggComCd] = useState("");
|
||||
const [pagination, setPagination] = useState<PaginationState>({
|
||||
pageIndex: DEFAULT_PAGE_INDEX,
|
||||
pageSize: DEFAULT_PAGE_SIZE,
|
||||
});
|
||||
const [searchParams, setSearchParams] = useState<FnrsCnsltnMngSearchDto>(DEFAULT_SEARCH_PARAMS);
|
||||
|
||||
const { data: sidoData } = useFindSidoCombo();
|
||||
const { data: gugunData } = useFindGugunCombo(sidoComCd);
|
||||
const sidoOptions = sidoData ?? EMPTY_ADST_LIST;
|
||||
const gugunOptions = gugunData ?? EMPTY_ADST_LIST;
|
||||
|
||||
const handleSearch = (event: React.FormEvent<HTMLFormElement>) => {
|
||||
event.preventDefault();
|
||||
setPagination((prev) => ({ ...prev, pageIndex: DEFAULT_PAGE_INDEX }));
|
||||
setSearchParams({
|
||||
...DEFAULT_SEARCH_PARAMS,
|
||||
bizNm,
|
||||
taskSeComCd,
|
||||
admdstCd: sggComCd || sidoComCd || "",
|
||||
page: DEFAULT_PAGE_INDEX,
|
||||
size: pagination.pageSize,
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-4 px-[1.8rem] pb-6">
|
||||
<section className="card card-border mx-0 bg-background">
|
||||
<form className="flex flex-wrap items-center gap-4 p-2" onSubmit={handleSearch}>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="sidoComCd" className="whitespace-nowrap">
|
||||
시도
|
||||
</Label>
|
||||
<Select
|
||||
value={sidoComCd}
|
||||
onValueChange={(value) => {
|
||||
setSidoComCd(value === ALL_SELECT_VALUE ? "" : value);
|
||||
setSggComCd("");
|
||||
}}
|
||||
>
|
||||
<SelectTrigger id="sidoComCd" className="w-[12rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value={ALL_SELECT_VALUE}>전체</SelectItem>
|
||||
{sidoOptions.map((option) => (
|
||||
<SelectItem key={option.adstDstrCd} value={option.adstDstrCd}>
|
||||
{option.adstDstrNm}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="sggComCd" className="whitespace-nowrap">
|
||||
시군구
|
||||
</Label>
|
||||
<Select
|
||||
value={sggComCd}
|
||||
onValueChange={(value) => setSggComCd(value === ALL_SELECT_VALUE ? "" : value)}
|
||||
disabled={!sidoComCd}
|
||||
>
|
||||
<SelectTrigger id="sggComCd" className="w-[12rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value={ALL_SELECT_VALUE}>전체</SelectItem>
|
||||
{gugunOptions.map((option) => (
|
||||
<SelectItem key={option.adstDstrCd} value={option.adstDstrCd}>
|
||||
{option.adstDstrNm}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="taskSeComCd" className="whitespace-nowrap">
|
||||
구분
|
||||
</Label>
|
||||
<CodeSelect upCd="INSTL" value={taskSeComCd} onValueChange={setTaskSeComCd} />
|
||||
</div>
|
||||
<div className="flex w-[24rem] items-center gap-2">
|
||||
<Label htmlFor="bizNm" className="whitespace-nowrap">
|
||||
사업명
|
||||
</Label>
|
||||
<Input
|
||||
id="bizNm"
|
||||
value={bizNm}
|
||||
onChange={(event) => setBizNm(event.target.value)}
|
||||
placeholder="사업명"
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit">조회</Button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<FnrsList
|
||||
searchParams={searchParams}
|
||||
pagination={pagination}
|
||||
onPaginationChange={setPagination}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { FnrsListPage };
|
||||
@@ -0,0 +1,86 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { getCoreRowModel, type PaginationState } from "@tanstack/react-table";
|
||||
|
||||
import { useDataTable } from "@/shared/lib";
|
||||
import { type FnrsCnsltnMngSearchDto, useFnrsCnsltnMngPage } from "@/entities/fnrs-cnsltn";
|
||||
import { TaskSePickerDialog } from "@/widgets/pbadms-sprt";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import { formatTaskSeComCdForApi } from "../lib/fnrs-cnsltn-regist-schema";
|
||||
import { createFnrsCnsltnColumns } from "../model/columns";
|
||||
|
||||
interface FnrsListProps {
|
||||
searchParams: FnrsCnsltnMngSearchDto;
|
||||
pagination: PaginationState;
|
||||
onPaginationChange: (pagination: PaginationState) => void;
|
||||
}
|
||||
|
||||
function FnrsList({ searchParams, pagination, onPaginationChange }: FnrsListProps) {
|
||||
const router = useRouter();
|
||||
const [isTaskSeDialogOpen, setIsTaskSeDialogOpen] = useState(false);
|
||||
|
||||
const queryParams = useMemo(
|
||||
() => ({
|
||||
bizNm: searchParams.bizNm,
|
||||
taskSeComCd: searchParams.taskSeComCd,
|
||||
admdstCd: searchParams.admdstCd,
|
||||
page: pagination.pageIndex,
|
||||
size: pagination.pageSize,
|
||||
sort: searchParams.sort ?? "fnrsCnsltnDocNo,desc",
|
||||
}),
|
||||
[searchParams, pagination],
|
||||
);
|
||||
|
||||
const pageQuery = useFnrsCnsltnMngPage(queryParams);
|
||||
const columns = useMemo(() => createFnrsCnsltnColumns(), []);
|
||||
|
||||
const { tableComponent } = useDataTable({
|
||||
query: pageQuery,
|
||||
tableOptions: {
|
||||
columns,
|
||||
state: { pagination },
|
||||
onPaginationChange: (updater) => {
|
||||
const next = typeof updater === "function" ? updater(pagination) : updater;
|
||||
onPaginationChange(next);
|
||||
},
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
manualPagination: true,
|
||||
},
|
||||
dataTableOptions: {
|
||||
viewPagination: true,
|
||||
onRowClick: (row) => router.push(`/fnrs-cnsltn/${row.fnrsCnsltnDocNo}`),
|
||||
},
|
||||
});
|
||||
|
||||
const handleConfirmTaskSe = (selectedCodes: string[]) => {
|
||||
setIsTaskSeDialogOpen(false);
|
||||
router.push(`/fnrs-cnsltn/regist?taskSeComCd=${formatTaskSeComCdForApi(selectedCodes)}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<section className="card card-border mx-0 bg-background pb-8 pt-0">
|
||||
<div className="card-header flex items-center justify-between">
|
||||
<h3 className="text-2xl font-semibold">재원협의 목록</h3>
|
||||
<Button type="button" color="green" onClick={() => setIsTaskSeDialogOpen(true)}>
|
||||
신청
|
||||
</Button>
|
||||
</div>
|
||||
{tableComponent}
|
||||
</section>
|
||||
<TaskSePickerDialog
|
||||
open={isTaskSeDialogOpen}
|
||||
onOpenChange={setIsTaskSeDialogOpen}
|
||||
onConfirm={handleConfirmTaskSe}
|
||||
title="재원협의 신청"
|
||||
codeUpCd="FNRS"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { FnrsList };
|
||||
@@ -0,0 +1,11 @@
|
||||
import { FnrsFormPage } from "./fnrs-form-page";
|
||||
|
||||
interface FnrsRegistPageProps {
|
||||
taskSeComCd?: string[];
|
||||
}
|
||||
|
||||
function FnrsRegistPage({ taskSeComCd }: FnrsRegistPageProps) {
|
||||
return <FnrsFormPage mode="create" taskSeComCd={taskSeComCd} />;
|
||||
}
|
||||
|
||||
export { FnrsRegistPage };
|
||||
@@ -0,0 +1,107 @@
|
||||
"use client";
|
||||
|
||||
import { useRef } from "react";
|
||||
|
||||
import { useUserStore } from "@/shared/lib";
|
||||
import { useFnrsCnsltnMng } from "@/entities/fnrs-cnsltn";
|
||||
import { Skeleton } from "@common/components";
|
||||
|
||||
import { getEditableReviewStep } from "../lib/review-step-utils";
|
||||
import { EMPTY_CKLST_RESULT_LIST, useChecklistFormState } from "../lib/use-checklist-form-state";
|
||||
|
||||
import { FloatingActionButtons } from "./components/floating-action-buttons";
|
||||
import { AttachmentsSection } from "./sections/attachments-section";
|
||||
import { BasicInfoSection } from "./sections/basic-info-section";
|
||||
import { BusinessCostSection } from "./sections/business-cost-section";
|
||||
import { BusinessScaleSection } from "./sections/business-scale-section";
|
||||
import { ChecklistSection } from "./sections/checklist-section";
|
||||
import { ContactInfoSection } from "./sections/contact-info-section";
|
||||
import { SupplementDemandSection } from "./sections/supplement-demand-section";
|
||||
import {
|
||||
TechReviewOpinionSection,
|
||||
type TechReviewOpinionSectionHandle,
|
||||
} from "./sections/tech-review-opinion-section";
|
||||
|
||||
interface FnrsViewPageProps {
|
||||
id: string;
|
||||
}
|
||||
|
||||
function FnrsViewPage({ id }: FnrsViewPageProps) {
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const techReviewOpinionRef = useRef<TechReviewOpinionSectionHandle>(null);
|
||||
const { data, isLoading, isError } = useFnrsCnsltnMng(id);
|
||||
const { formState: checklistFormState, setFormState: setChecklistFormState } =
|
||||
useChecklistFormState(data?.cklstResultList ?? EMPTY_CKLST_RESULT_LIST);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="mt-6 flex flex-col gap-4 px-6">
|
||||
<div className="flex flex-col gap-2">
|
||||
<Skeleton className="h-[4rem] rounded-xl" />
|
||||
<Skeleton className="h-[16rem] rounded-xl" />
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Skeleton className="h-[4rem] rounded-xl" />
|
||||
<Skeleton className="h-[16rem] rounded-xl" />
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<Skeleton className="h-[4rem] rounded-xl" />
|
||||
<Skeleton className="h-[32rem] rounded-xl" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (isError || !data?.detDto) {
|
||||
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
|
||||
}
|
||||
|
||||
const detDto = data.detDto;
|
||||
const bizSclList = data.bizSclList ?? [];
|
||||
const bizCstList = data.bizCstList ?? [];
|
||||
const cklstResultList = data.cklstResultList ?? [];
|
||||
const esntlFileList = data.esntlFileList ?? [];
|
||||
const etcFileList = data.etcFileList ?? [];
|
||||
const rvwList = data.rvwList ?? [];
|
||||
const splmntDmndList = data.splmntDmndList ?? [];
|
||||
|
||||
const editableReviewStep = getEditableReviewStep(
|
||||
userInfo?.dtlInstCd,
|
||||
detDto.prgrsSttsComCd || "",
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="mt-6 space-y-4">
|
||||
<BasicInfoSection det={detDto} />
|
||||
<ContactInfoSection det={detDto} />
|
||||
<BusinessScaleSection bizSclList={bizSclList} />
|
||||
<BusinessCostSection bizCstList={bizCstList} />
|
||||
<ChecklistSection
|
||||
cklstResultList={cklstResultList}
|
||||
prgrsSttsComCd={detDto.prgrsSttsComCd || ""}
|
||||
userRoleCode={userInfo?.dtlInstCd}
|
||||
formState={checklistFormState}
|
||||
setFormState={setChecklistFormState}
|
||||
/>
|
||||
<AttachmentsSection esntlFileList={esntlFileList} etcFileList={etcFileList} />
|
||||
<SupplementDemandSection splmntDmndList={splmntDmndList} />
|
||||
<TechReviewOpinionSection
|
||||
ref={techReviewOpinionRef}
|
||||
rvwList={rvwList}
|
||||
editableReviewStep={editableReviewStep}
|
||||
/>
|
||||
<FloatingActionButtons
|
||||
data={data}
|
||||
docSeComCd="FNRS"
|
||||
fnrsCnsltnDocNo={detDto.fnrsCnsltnDocNo}
|
||||
prgrsSttsComCd={detDto.prgrsSttsComCd || ""}
|
||||
dtlInstCd={userInfo?.dtlInstCd}
|
||||
checklistFormState={checklistFormState}
|
||||
techReviewOpinionRef={techReviewOpinionRef}
|
||||
opnrNm={userInfo?.userName}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { FnrsViewPage };
|
||||
@@ -0,0 +1,118 @@
|
||||
"use client";
|
||||
|
||||
import { formatFileSize } from "@/shared/lib/file-utils";
|
||||
import { useDownloadAttachmentByAtflCd } from "@/entities/attach";
|
||||
import type {
|
||||
AtflMngClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
} from "@/entities/fnrs-cnsltn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
interface AttachmentsSectionProps {
|
||||
esntlFileList: EsntlAtchFileMngTreeResponseDto[];
|
||||
etcFileList: AtflMngClientResponseDto[];
|
||||
}
|
||||
|
||||
function AttachmentsSection({ esntlFileList, etcFileList }: AttachmentsSectionProps) {
|
||||
const { mutate: downloadAttachment } = useDownloadAttachmentByAtflCd();
|
||||
|
||||
return (
|
||||
<>
|
||||
<SectionCollapsible title="필수 첨부파일">
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>필수 자료명</TableHead>
|
||||
<TableHead>파일명</TableHead>
|
||||
<TableHead className="w-[8rem] text-right">크기</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{esntlFileList.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={3} className="py-12 text-center text-muted-foreground">
|
||||
조회된 필수 첨부파일 항목이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
esntlFileList.map((file) => (
|
||||
<TableRow key={file.esntlAtchFileId}>
|
||||
<TableCell className="pl-2 text-left">
|
||||
{file.esntlAtchFileNm}
|
||||
{file.esntlAtchYn === "Y" ? (
|
||||
<span className="ml-1 text-red-500">*</span>
|
||||
) : null}
|
||||
</TableCell>
|
||||
<TableCell className="text-left">
|
||||
{file.atflCd ? (
|
||||
<a
|
||||
className="cursor-pointer text-blue-600 hover:underline"
|
||||
onClick={() => downloadAttachment(file.atflCd ?? "")}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{file.orgnlFileNm || "다운로드"}
|
||||
</a>
|
||||
) : (
|
||||
<span className="text-gray-500">첨부없음</span>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className="text-right">{formatFileSize(file.atflFlieSz)}</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
|
||||
<SectionCollapsible title="기타 첨부파일">
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>파일명</TableHead>
|
||||
<TableHead className="w-[8rem] text-right">크기</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{etcFileList.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={2} className="py-12 text-center text-muted-foreground">
|
||||
등록된 기타첨부파일이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
etcFileList.map((file) => (
|
||||
<TableRow key={file.atflId}>
|
||||
<TableCell className="text-left">
|
||||
{file.atflCd ? (
|
||||
<a
|
||||
className="cursor-pointer text-blue-600 hover:underline"
|
||||
onClick={() => downloadAttachment(file.atflCd)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{file.orgnlFileNm || file.physFileNm || file.atflId}
|
||||
</a>
|
||||
) : (
|
||||
<span>{file.orgnlFileNm || file.physFileNm || file.atflId}</span>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className="text-right text-gray-500">
|
||||
{formatFileSize(file.atflFlieSz)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export { AttachmentsSection };
|
||||
@@ -0,0 +1,247 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Controller, useFormContext } from "react-hook-form";
|
||||
|
||||
import { useUserStore } from "@/shared/lib";
|
||||
import { Field, FieldError, FieldGroup, FieldLabel, FieldSet } from "@/shared/ui/field";
|
||||
import { findCodeLabel, useCodeList } from "@/entities/code";
|
||||
import { type BnsApplyData, BnsPickerDialog } from "@/widgets/bns-picker";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Input,
|
||||
RadioGroup,
|
||||
RadioGroupItem,
|
||||
Table,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import type { FnrsCnsltnRegistFormData } from "../../lib/fnrs-cnsltn-regist-schema";
|
||||
|
||||
function BasicInfoFormSection() {
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const { control, watch, setValue } = useFormContext<FnrsCnsltnRegistFormData>();
|
||||
const [isPickerOpen, setIsPickerOpen] = useState(false);
|
||||
const taskSeComCd = watch("fnrsCnsltnMng.taskSeComCd");
|
||||
const { data: taskOptions } = useCodeList("FNRS");
|
||||
const { data: rtlztnFcltOptions } = useCodeList("RTLZTNFCLTSE");
|
||||
const { data: rtlztnUsgOptions } = useCodeList("RTLZTNUSGSE");
|
||||
|
||||
function handleBnsSelect(data: BnsApplyData) {
|
||||
setValue("fnrsCnsltnMng.bizNm", data.bizNm);
|
||||
setValue("fnrsCnsltnMng.bizBgngYr", data.bizBgngYr);
|
||||
setValue("fnrsCnsltnMng.bizEndYr", data.bizEndYr);
|
||||
setValue("fnrsCnsltnMng.bizCn", data.bizCn);
|
||||
}
|
||||
|
||||
const taskSeComCdLabel =
|
||||
taskSeComCd
|
||||
.map((code) => findCodeLabel(taskOptions, code))
|
||||
.filter(Boolean)
|
||||
.join(", ") || "-";
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="기본 정보">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[20rem]" data-required>
|
||||
사업명
|
||||
</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="fnrsCnsltnMng.bizNm"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
<div className="flex gap-2">
|
||||
<Input
|
||||
{...field}
|
||||
id={field.name}
|
||||
placeholder="사업명 입력"
|
||||
aria-invalid={fieldState.invalid}
|
||||
className="w-[40rem]"
|
||||
/>
|
||||
<Button type="button" onClick={() => setIsPickerOpen(true)}>
|
||||
사업찾기
|
||||
</Button>
|
||||
</div>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead data-required>사업기간</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<FieldGroup className="flex-row items-center gap-2">
|
||||
<Controller
|
||||
name="fnrsCnsltnMng.bizBgngYr"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid} className="w-auto">
|
||||
<Input
|
||||
{...field}
|
||||
id={field.name}
|
||||
placeholder="시작연도"
|
||||
className="max-w-[12rem]"
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
<span>~</span>
|
||||
<Controller
|
||||
name="fnrsCnsltnMng.bizEndYr"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid} className="w-auto">
|
||||
<Input
|
||||
{...field}
|
||||
id={field.name}
|
||||
placeholder="종료연도"
|
||||
className="max-w-[12rem]"
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</FieldGroup>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead data-required>사업내용</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="fnrsCnsltnMng.bizCn"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
<Input
|
||||
{...field}
|
||||
id={field.name}
|
||||
placeholder="사업내용 입력"
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead data-required>구분</TableHead>
|
||||
<TableCell>{taskSeComCdLabel}</TableCell>
|
||||
<TableHead>신청 지자체</TableHead>
|
||||
<TableCell>{userInfo?.instSeNm}</TableCell>
|
||||
</TableRow>
|
||||
{taskSeComCd.includes("RE") && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead>시설종류</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="fnrsCnsltnMng.rtlztnFcltSeComCd"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<FieldSet>
|
||||
<RadioGroup
|
||||
name={field.name}
|
||||
value={field.value || ""}
|
||||
onValueChange={field.onChange}
|
||||
>
|
||||
{rtlztnFcltOptions?.map((option) => (
|
||||
<FieldLabel
|
||||
key={option.lwpoCd}
|
||||
htmlFor={`fnrs-rtlztn-fclt-${option.lwpoCd}`}
|
||||
className="!w-auto border-none"
|
||||
>
|
||||
<Field
|
||||
orientation="horizontal"
|
||||
data-invalid={fieldState.invalid}
|
||||
className="w-auto"
|
||||
>
|
||||
<RadioGroupItem
|
||||
value={option.lwpoCd}
|
||||
id={`fnrs-rtlztn-fclt-${option.lwpoCd}`}
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
<span className="font-normal">{option.lwpoCdNm}</span>
|
||||
</Field>
|
||||
</FieldLabel>
|
||||
))}
|
||||
</RadioGroup>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</FieldSet>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>재이용용도</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="fnrsCnsltnMng.rtlztnUsgSeComCd"
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<FieldSet>
|
||||
<FieldGroup data-slot="checkbox-group" className="flex-row">
|
||||
{rtlztnUsgOptions?.map((option) => (
|
||||
<Field
|
||||
key={option.lwpoCd}
|
||||
orientation="horizontal"
|
||||
data-invalid={fieldState.invalid}
|
||||
className="w-auto"
|
||||
>
|
||||
<Checkbox
|
||||
id={`fnrs-rtlztn-usg-${option.lwpoCd}`}
|
||||
name={field.name}
|
||||
aria-invalid={fieldState.invalid}
|
||||
checked={field.value?.includes(option.lwpoCd) ?? false}
|
||||
onCheckedChange={(checked) => {
|
||||
const currentValue = field.value || "";
|
||||
const values = currentValue ? currentValue.split(",") : [];
|
||||
const newValue = checked
|
||||
? [...values, option.lwpoCd]
|
||||
: values.filter((value) => value !== option.lwpoCd);
|
||||
field.onChange(newValue.join(","));
|
||||
}}
|
||||
/>
|
||||
<FieldLabel
|
||||
htmlFor={`fnrs-rtlztn-usg-${option.lwpoCd}`}
|
||||
className="font-normal"
|
||||
>
|
||||
{option.lwpoCdNm}
|
||||
</FieldLabel>
|
||||
</Field>
|
||||
))}
|
||||
</FieldGroup>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</FieldSet>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
)}
|
||||
</TableHeader>
|
||||
</Table>
|
||||
|
||||
<BnsPickerDialog
|
||||
open={isPickerOpen}
|
||||
onClose={() => setIsPickerOpen(false)}
|
||||
onSelect={handleBnsSelect}
|
||||
/>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { BasicInfoFormSection };
|
||||
@@ -0,0 +1,50 @@
|
||||
"use client";
|
||||
|
||||
import type { FnrsCnsltnMngResponseDto } from "@/entities/fnrs-cnsltn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
interface BasicInfoSectionProps {
|
||||
det: FnrsCnsltnMngResponseDto;
|
||||
}
|
||||
|
||||
function BasicInfoSection({ det }: BasicInfoSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="기본 정보">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>사업명</TableHead>
|
||||
<TableCell>{det.bizNm || "-"}</TableCell>
|
||||
<TableHead>사업기간</TableHead>
|
||||
<TableCell>{(det.bizBgngYr || "-") + " ~ " + (det.bizEndYr || "-")}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>사업내용</TableHead>
|
||||
<TableCell colSpan={3}>{det.bizCn || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>환경청구분</TableHead>
|
||||
<TableCell>{det.envoSeCdNm || "-"}</TableCell>
|
||||
<TableHead>구분</TableHead>
|
||||
<TableCell>{det.taskSeCdNm || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>신청지자체</TableHead>
|
||||
<TableCell>
|
||||
{det.sido || "-"} {det.gugun || "-"}
|
||||
</TableCell>
|
||||
<TableHead>확정예산사업번호</TableHead>
|
||||
<TableCell>{det.cfmtnBgtBizNo || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>예산신청연도</TableHead>
|
||||
<TableCell colSpan={3}>{det.bgtAplyYr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
</Table>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { BasicInfoSection };
|
||||
@@ -0,0 +1,93 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo } from "react";
|
||||
|
||||
import type { BizCstTreeDto } from "@/entities/fnrs-cnsltn";
|
||||
import { calcDiffPercent, fmtNumber, indentPx } from "@/widgets/pbadms-sprt";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
import { sortBizCstListByTreePath } from "../../lib/business-cost-utils";
|
||||
|
||||
interface BusinessCostSectionProps {
|
||||
bizCstList: BizCstTreeDto[];
|
||||
}
|
||||
|
||||
function BusinessCostSection({ bizCstList }: BusinessCostSectionProps) {
|
||||
const sortedBizCstList = useMemo(() => sortBizCstListByTreePath(bizCstList), [bizCstList]);
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="총사업비">
|
||||
<div className="overflow-x-auto">
|
||||
<p className="mb-2 text-right font-normal text-muted-foreground">(단위: 백만원)</p>
|
||||
<Table variant="secondary" className="table-fixed">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[30rem]" rowSpan={2}>
|
||||
구분
|
||||
</TableHead>
|
||||
<TableHead rowSpan={2}>예산반영(A)</TableHead>
|
||||
<TableHead rowSpan={2}>표준사업비(B)</TableHead>
|
||||
<TableHead rowSpan={2}>금회설계시(C)</TableHead>
|
||||
<TableHead colSpan={2}>증감</TableHead>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead className="w-[12rem]">(C-B)</TableHead>
|
||||
<TableHead className="w-[6rem]">%</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{sortedBizCstList.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={7} className="py-12 text-center text-muted-foreground">
|
||||
조회된 총사업비 항목이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
sortedBizCstList.map((node) => {
|
||||
const pl = indentPx(node.indAcntgSeCdNm);
|
||||
const bscPlanAmt = Number(node.bscPlanAmt) || 0;
|
||||
const budgetReflct = Number(node.bgtRfltAmt) || 0;
|
||||
const tstmDesignAmt = Number(node.tstmDesignAmt) || 0;
|
||||
const diff = tstmDesignAmt - budgetReflct;
|
||||
const showSubIcon = node.treeLevel >= 3;
|
||||
|
||||
return (
|
||||
<TableRow key={node.acntgSeCd}>
|
||||
{node.treeLevel <= 1 ? (
|
||||
<TableHead className="!px-[0.8rem] text-left">{node.acntgSeCdNm}</TableHead>
|
||||
) : (
|
||||
<TableHead className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
{showSubIcon && <span className="mr-1 text-gray-400">└</span>}
|
||||
{node.acntgSeCdNm}
|
||||
</TableHead>
|
||||
)}
|
||||
<TableCell>
|
||||
<div className="text-right">{fmtNumber(bscPlanAmt)}</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-right">{fmtNumber(budgetReflct)}</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-right">{fmtNumber(tstmDesignAmt)}</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-right">
|
||||
{diff > 0 ? `+${fmtNumber(diff)}` : fmtNumber(diff)}
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-right">{calcDiffPercent(diff, budgetReflct)}</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { BusinessCostSection };
|
||||
@@ -0,0 +1,71 @@
|
||||
"use client";
|
||||
|
||||
import type { BizSclTreeDto } from "@/entities/fnrs-cnsltn";
|
||||
import { fmtNumber, indentPx } from "@/widgets/pbadms-sprt";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
interface BusinessScaleSectionProps {
|
||||
bizSclList: BizSclTreeDto[];
|
||||
}
|
||||
|
||||
function BusinessScaleSection({ bizSclList }: BusinessScaleSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="사업규모">
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[30rem]">구분</TableHead>
|
||||
<TableHead>기본계획(A)</TableHead>
|
||||
<TableHead>예산반영(B)</TableHead>
|
||||
<TableHead>금회설계시(C)</TableHead>
|
||||
<TableHead>증감(C-B)</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{bizSclList.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={5} className="py-12 text-center text-muted-foreground">
|
||||
조회된 사업규모 항목이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
) : (
|
||||
bizSclList.map((node) => {
|
||||
const pl = indentPx(node.indCnstpSeCdNm);
|
||||
const bscPlanQty = Number(node.bscPlanQty) || 0;
|
||||
const budgetReflct = Number(node.bgtRfltQty) || 0;
|
||||
const tstmDesignQty = Number(node.tstmDesignQty) || 0;
|
||||
const diff = tstmDesignQty - budgetReflct;
|
||||
|
||||
return (
|
||||
<TableRow key={node.cnstpSeCd}>
|
||||
<TableHead className="text-left" style={{ paddingLeft: `${pl + 8}px` }}>
|
||||
{node.cnstpSeCdNm}
|
||||
</TableHead>
|
||||
<TableCell>
|
||||
<div className="text-right">{fmtNumber(bscPlanQty)}</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-right">{fmtNumber(budgetReflct)}</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-right">{fmtNumber(tstmDesignQty)}</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-right">
|
||||
{diff > 0 ? `+${fmtNumber(diff)}` : fmtNumber(diff)}
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { BusinessScaleSection };
|
||||
@@ -0,0 +1,137 @@
|
||||
"use client";
|
||||
|
||||
import { type Dispatch, type SetStateAction, useEffect, useMemo, useState } from "react";
|
||||
|
||||
import type { CklstRvwRsltTreeDto } from "@/entities/fnrs-cnsltn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@common/components";
|
||||
|
||||
import {
|
||||
computeReviewStepChecklistProgress,
|
||||
extractTaskCodes,
|
||||
getChecklistDisplayRows,
|
||||
} from "../../lib/checklist-utils";
|
||||
import { getVisibleReviewSteps } from "../../lib/review-step-utils";
|
||||
import type { ReviewStepCode } from "../../model/view-types";
|
||||
import {
|
||||
type ChecklistFormState,
|
||||
REVIEW_STEP_LABELS,
|
||||
ROLE_TO_REVIEW_STEP,
|
||||
TASK_CODE_LABELS,
|
||||
} from "../../model/view-types";
|
||||
import { ChecklistTaskPanel } from "../components/checklist-task-panel";
|
||||
|
||||
interface ChecklistSectionProps {
|
||||
cklstResultList: CklstRvwRsltTreeDto[];
|
||||
prgrsSttsComCd: string;
|
||||
userRoleCode?: string;
|
||||
formState: ChecklistFormState;
|
||||
setFormState: Dispatch<SetStateAction<ChecklistFormState>>;
|
||||
}
|
||||
|
||||
function ChecklistSection({
|
||||
cklstResultList,
|
||||
prgrsSttsComCd,
|
||||
userRoleCode,
|
||||
formState,
|
||||
setFormState,
|
||||
}: ChecklistSectionProps) {
|
||||
const visibleReviewSteps = useMemo(
|
||||
() => getVisibleReviewSteps(prgrsSttsComCd, userRoleCode),
|
||||
[prgrsSttsComCd, userRoleCode],
|
||||
);
|
||||
const taskCodes = useMemo(() => extractTaskCodes(cklstResultList), [cklstResultList]);
|
||||
|
||||
const defaultReviewStep = ROLE_TO_REVIEW_STEP[userRoleCode ?? ""] ?? "LOCAL";
|
||||
const [selectedReviewStep, setSelectedReviewStep] = useState<ReviewStepCode>(defaultReviewStep);
|
||||
const [selectedTaskCode, setSelectedTaskCode] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (visibleReviewSteps.length === 0) return;
|
||||
if (!visibleReviewSteps.includes(selectedReviewStep)) {
|
||||
setSelectedReviewStep(visibleReviewSteps[visibleReviewSteps.length - 1]);
|
||||
}
|
||||
}, [selectedReviewStep, visibleReviewSteps]);
|
||||
|
||||
useEffect(() => {
|
||||
if (taskCodes.length === 0) {
|
||||
setSelectedTaskCode(null);
|
||||
return;
|
||||
}
|
||||
if (!selectedTaskCode || !taskCodes.includes(selectedTaskCode)) {
|
||||
setSelectedTaskCode(taskCodes[0]);
|
||||
}
|
||||
}, [taskCodes, selectedTaskCode]);
|
||||
|
||||
const progress = useMemo(
|
||||
() =>
|
||||
computeReviewStepChecklistProgress(cklstResultList, formState.results, selectedReviewStep),
|
||||
[cklstResultList, formState.results, selectedReviewStep],
|
||||
);
|
||||
|
||||
const { total, completed, percent } = progress;
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="체크리스트">
|
||||
<div className="flex flex-col gap-4 p-2">
|
||||
{visibleReviewSteps.length > 0 ? (
|
||||
<Tabs
|
||||
value={selectedReviewStep}
|
||||
onValueChange={(value) => setSelectedReviewStep(value as ReviewStepCode)}
|
||||
className="w-full"
|
||||
>
|
||||
<TabsList>
|
||||
{visibleReviewSteps.map((stepCode) => (
|
||||
<TabsTrigger key={stepCode} value={stepCode} className="!px-6 !py-3 text-xl">
|
||||
{REVIEW_STEP_LABELS[stepCode]}
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
) : null}
|
||||
|
||||
{taskCodes.length > 0 ? (
|
||||
<Tabs
|
||||
value={selectedTaskCode ?? taskCodes[0]}
|
||||
onValueChange={setSelectedTaskCode}
|
||||
className="w-full"
|
||||
variant="outline"
|
||||
>
|
||||
<div className="flex items-end justify-between gap-4">
|
||||
<TabsList className="p-0">
|
||||
{taskCodes.map((code) => (
|
||||
<TabsTrigger
|
||||
key={code}
|
||||
value={code}
|
||||
className="!px-6 !py-3 text-xl [&:after]:hidden"
|
||||
>
|
||||
{TASK_CODE_LABELS[code] ?? code}
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
<div className="shrink-0 pb-1 text-lg text-muted-foreground">
|
||||
총합: <strong>{total}</strong> · 완료: <strong>{completed}</strong> · 진행률:{" "}
|
||||
<strong>{percent}%</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{taskCodes.map((code) => (
|
||||
<TabsContent key={code} value={code} className="mt-0 border-0 p-0 shadow-none ring-0">
|
||||
<ChecklistTaskPanel
|
||||
selectedReviewStep={selectedReviewStep}
|
||||
selectedRows={getChecklistDisplayRows(cklstResultList, code)}
|
||||
allRows={cklstResultList}
|
||||
formState={formState}
|
||||
setFormState={setFormState}
|
||||
userRoleCode={userRoleCode}
|
||||
/>
|
||||
</TabsContent>
|
||||
))}
|
||||
</Tabs>
|
||||
) : null}
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { ChecklistSection };
|
||||
@@ -0,0 +1,56 @@
|
||||
"use client";
|
||||
|
||||
import type { FnrsCnsltnMngResponseDto } from "@/entities/fnrs-cnsltn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
interface ContactInfoSectionProps {
|
||||
det: FnrsCnsltnMngResponseDto;
|
||||
}
|
||||
|
||||
function ContactInfoSection({ det }: ContactInfoSectionProps) {
|
||||
return (
|
||||
<SectionCollapsible title="담당자 정보">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
{det.aplcntNm && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead rowSpan={2}>신청자</TableHead>
|
||||
<TableHead>이름</TableHead>
|
||||
<TableCell>{det.aplcntNm || "-"}</TableCell>
|
||||
<TableHead>연락처</TableHead>
|
||||
<TableCell>{det.aplcntMblTelno || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>소속</TableHead>
|
||||
<TableCell>{det.aplcntOgdpNm || "-"}</TableCell>
|
||||
<TableHead>이메일</TableHead>
|
||||
<TableCell>{det.aplcntEmlAddr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
)}
|
||||
{det.dsgnrNm && (
|
||||
<>
|
||||
<TableRow>
|
||||
<TableHead rowSpan={2}>설계자</TableHead>
|
||||
<TableHead>이름</TableHead>
|
||||
<TableCell>{det.dsgnrNm || "-"}</TableCell>
|
||||
<TableHead>연락처</TableHead>
|
||||
<TableCell>{det.dsgnrTelno || "-"}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>소속</TableHead>
|
||||
<TableCell>{det.dsgnrOgdpNm || "-"}</TableCell>
|
||||
<TableHead>이메일</TableHead>
|
||||
<TableCell>{det.dsgnrEmlAddr || "-"}</TableCell>
|
||||
</TableRow>
|
||||
</>
|
||||
)}
|
||||
</TableHeader>
|
||||
</Table>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { ContactInfoSection };
|
||||
@@ -0,0 +1,57 @@
|
||||
"use client";
|
||||
|
||||
import { dayjs } from "@/shared/lib";
|
||||
import type { FnrsCnsltnSplmntDmndResponseDto } from "@/entities/fnrs-cnsltn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import {
|
||||
Badge,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
interface SupplementDemandSectionProps {
|
||||
splmntDmndList: FnrsCnsltnSplmntDmndResponseDto[];
|
||||
}
|
||||
|
||||
function SupplementDemandSection({ splmntDmndList }: SupplementDemandSectionProps) {
|
||||
if (splmntDmndList.length === 0) return null;
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="보완요청">
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[8rem]">항목</TableHead>
|
||||
<TableHead>보완요청 내용</TableHead>
|
||||
<TableHead>보완 내용</TableHead>
|
||||
<TableHead className="w-[8rem]">완료여부</TableHead>
|
||||
<TableHead className="w-[12rem]">요청일시</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{splmntDmndList.map((item) => (
|
||||
<TableRow key={item.splmntDmndSn}>
|
||||
<TableCell>{item.splmntArtclCdNm || "-"}</TableCell>
|
||||
<TableCell className="whitespace-pre-wrap">{item.splmntDmndCn || "-"}</TableCell>
|
||||
<TableCell className="whitespace-pre-wrap">{item.splmntCn || "-"}</TableCell>
|
||||
<TableCell>
|
||||
<Badge color={item.cmptnYn === "Y" ? "green" : "gray"}>
|
||||
{item.cmptnYn === "Y" ? "완료" : "미완료"}
|
||||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{item.splmntDmndDt ? dayjs(item.splmntDmndDt).format("YYYY-MM-DD HH:mm") : "-"}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
export { SupplementDemandSection };
|
||||
@@ -0,0 +1,338 @@
|
||||
"use client";
|
||||
|
||||
import { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
||||
|
||||
import { PROXY_HOST } from "@/shared/config";
|
||||
import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib";
|
||||
import { Field, FieldLabel, FieldSet } from "@/shared/ui/field";
|
||||
import { attachService } from "@/entities/attach";
|
||||
import type { FnrsCnsltnRvwOpnnResponseDto } from "@/entities/fnrs-cnsltn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import {
|
||||
Button,
|
||||
RadioGroup,
|
||||
RadioGroupItem,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
Textarea,
|
||||
} from "@common/components";
|
||||
|
||||
import type { ReviewOpinionFormData } from "../../lib/review-opinion-utils";
|
||||
import type { ReviewStepCode } from "../../model/view-types";
|
||||
import { REVIEW_STEP_LABELS } from "../../model/view-types";
|
||||
|
||||
const RVW_OPNN_FILE_KEY_PREFIX = "rvw-opnn::";
|
||||
|
||||
interface TechReviewOpinionSectionProps {
|
||||
rvwList: FnrsCnsltnRvwOpnnResponseDto[];
|
||||
editableReviewStep?: ReviewStepCode;
|
||||
}
|
||||
|
||||
export interface TechReviewOpinionSectionHandle {
|
||||
getFormData: () => ReviewOpinionFormData | null;
|
||||
resetForm: () => void;
|
||||
}
|
||||
|
||||
interface TechReviewOpinionTableProps {
|
||||
items: FnrsCnsltnRvwOpnnResponseDto[];
|
||||
}
|
||||
|
||||
interface UploadedOpinionFile {
|
||||
fileName: string;
|
||||
fileKey: string;
|
||||
atflId?: string;
|
||||
atflCd?: string;
|
||||
}
|
||||
|
||||
const EMPTY_FORM_DATA: ReviewOpinionFormData = {
|
||||
rvwRsltCn: "",
|
||||
rvwRsltAnmlyYn: "",
|
||||
atchFileGroupId: "",
|
||||
opnrSeComCd: "",
|
||||
};
|
||||
|
||||
function createRvwOpnnUploadKey(file: File) {
|
||||
return `${RVW_OPNN_FILE_KEY_PREFIX}${getDefaultFileKey(file)}`;
|
||||
}
|
||||
|
||||
function hasFormContent(formData: ReviewOpinionFormData) {
|
||||
return Boolean(formData.rvwRsltCn.trim() || formData.rvwRsltAnmlyYn || formData.atchFileGroupId);
|
||||
}
|
||||
|
||||
const TechReviewOpinionSection = forwardRef<
|
||||
TechReviewOpinionSectionHandle,
|
||||
TechReviewOpinionSectionProps
|
||||
>(function TechReviewOpinionSection({ rvwList, editableReviewStep }, ref) {
|
||||
const [formData, setFormData] = useState<ReviewOpinionFormData>({
|
||||
...EMPTY_FORM_DATA,
|
||||
opnrSeComCd: editableReviewStep ?? "",
|
||||
});
|
||||
const [uploadedFile, setUploadedFile] = useState<UploadedOpinionFile | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setFormData((prev) => ({
|
||||
...prev,
|
||||
opnrSeComCd: editableReviewStep ?? "",
|
||||
}));
|
||||
}, [editableReviewStep]);
|
||||
|
||||
const { uploadFileAsync, isUploading, uploads } = useTus({
|
||||
onSuccess: (atflCd, atflId, _file, fileKey) => {
|
||||
if (!atflCd || !atflId) return;
|
||||
|
||||
setFormData((prev) => ({ ...prev, atchFileGroupId: atflCd }));
|
||||
setUploadedFile((prev) => (prev?.fileKey === fileKey ? { ...prev, atflCd, atflId } : prev));
|
||||
},
|
||||
onError: (_error, _file, fileKey) => {
|
||||
setUploadedFile((prev) => (prev?.fileKey === fileKey ? null : prev));
|
||||
},
|
||||
});
|
||||
|
||||
useImperativeHandle(
|
||||
ref,
|
||||
() => ({
|
||||
getFormData: () => {
|
||||
if (!editableReviewStep || !hasFormContent(formData)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
...formData,
|
||||
opnrSeComCd: editableReviewStep,
|
||||
};
|
||||
},
|
||||
resetForm: () => {
|
||||
setFormData({
|
||||
...EMPTY_FORM_DATA,
|
||||
opnrSeComCd: editableReviewStep ?? "",
|
||||
});
|
||||
setUploadedFile(null);
|
||||
},
|
||||
}),
|
||||
[editableReviewStep, formData],
|
||||
);
|
||||
|
||||
const envRvwList = rvwList.filter((item) => item.opnrSeComCd === "ENV");
|
||||
const kecoRvwList = rvwList.filter((item) => item.opnrSeComCd === "KECO");
|
||||
|
||||
const hasEnvSection = envRvwList.length > 0 || editableReviewStep === "ENV";
|
||||
const hasKecoSection = kecoRvwList.length > 0 || editableReviewStep === "KECO";
|
||||
|
||||
if (!hasEnvSection && !hasKecoSection) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async function handleFileUpload(files: FileList | null) {
|
||||
if (!files || files.length === 0) return;
|
||||
|
||||
const file = files[0];
|
||||
const fileKey = createRvwOpnnUploadKey(file);
|
||||
const existingAtflCd = formData.atchFileGroupId;
|
||||
|
||||
setUploadedFile({ fileName: file.name, fileKey });
|
||||
|
||||
try {
|
||||
await uploadFileAsync(file, {
|
||||
fileKey,
|
||||
metadata: existingAtflCd ? { atflCd: existingAtflCd } : undefined,
|
||||
});
|
||||
} catch {
|
||||
// onError callback handles cleanup
|
||||
}
|
||||
}
|
||||
|
||||
async function handleFileRemove() {
|
||||
if (!uploadedFile) return;
|
||||
|
||||
uploads[uploadedFile.fileKey]?.abort();
|
||||
|
||||
if (uploadedFile.atflId) {
|
||||
try {
|
||||
await attachService.deleteAttachmentByAtflId(uploadedFile.atflId);
|
||||
} catch (error) {
|
||||
console.error("검토의견 첨부파일 삭제 실패:", error);
|
||||
}
|
||||
}
|
||||
|
||||
setUploadedFile(null);
|
||||
setFormData((prev) => ({ ...prev, atchFileGroupId: "" }));
|
||||
}
|
||||
|
||||
function renderOpinionForm(reviewStep: ReviewStepCode) {
|
||||
if (editableReviewStep !== reviewStep) return null;
|
||||
|
||||
const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false;
|
||||
|
||||
return (
|
||||
<div className="p-2">
|
||||
<h4 className="mb-4 text-xl font-semibold">검토의견 작성</h4>
|
||||
<Table variant="secondary">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="w-[12rem]">의견내용</TableHead>
|
||||
<TableCell>
|
||||
<Textarea
|
||||
value={formData.rvwRsltCn}
|
||||
onChange={(event) =>
|
||||
setFormData((prev) => ({ ...prev, rvwRsltCn: event.target.value }))
|
||||
}
|
||||
placeholder="의견내용을 입력하세요"
|
||||
rows={4}
|
||||
className="min-h-[8rem] !text-xl"
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>검토결과</TableHead>
|
||||
<TableCell>
|
||||
<FieldSet>
|
||||
<RadioGroup
|
||||
value={formData.rvwRsltAnmlyYn}
|
||||
onValueChange={(value) =>
|
||||
setFormData((prev) => ({
|
||||
...prev,
|
||||
rvwRsltAnmlyYn: value as ReviewOpinionFormData["rvwRsltAnmlyYn"],
|
||||
}))
|
||||
}
|
||||
>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<FieldLabel
|
||||
htmlFor={`rvw-opnn-normal-${reviewStep}`}
|
||||
className="!w-auto border-none"
|
||||
>
|
||||
<Field orientation="horizontal" className="w-auto">
|
||||
<RadioGroupItem value="N" id={`rvw-opnn-normal-${reviewStep}`} />
|
||||
<span className="font-normal">정상</span>
|
||||
</Field>
|
||||
</FieldLabel>
|
||||
<FieldLabel
|
||||
htmlFor={`rvw-opnn-abnormal-${reviewStep}`}
|
||||
className="!w-auto border-none"
|
||||
>
|
||||
<Field orientation="horizontal" className="w-auto">
|
||||
<RadioGroupItem value="Y" id={`rvw-opnn-abnormal-${reviewStep}`} />
|
||||
<span className="font-normal">이상</span>
|
||||
</Field>
|
||||
</FieldLabel>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
</FieldSet>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead>첨부파일</TableHead>
|
||||
<TableCell>
|
||||
{uploadedFile ? (
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-xl">{uploadedFile.fileName}</span>
|
||||
<Button
|
||||
size="icon"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
void handleFileRemove();
|
||||
}}
|
||||
disabled={uploading}
|
||||
className="size-8 !bg-destructive"
|
||||
>
|
||||
<i className="diveicon di-x text-xs" aria-label="삭제" />
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<label>
|
||||
<input
|
||||
type="file"
|
||||
className="hidden"
|
||||
onChange={(event) => {
|
||||
void handleFileUpload(event.target.files);
|
||||
event.target.value = "";
|
||||
}}
|
||||
/>
|
||||
<Button size="sm" variant="outline" type="button" asChild>
|
||||
<span>파일 선택</span>
|
||||
</Button>
|
||||
</label>
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
</Table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{hasEnvSection ? (
|
||||
<SectionCollapsible title={`${REVIEW_STEP_LABELS.ENV} 검토의견`}>
|
||||
{envRvwList.length > 0 ? <TechReviewOpinionTable items={envRvwList} /> : null}
|
||||
{renderOpinionForm("ENV")}
|
||||
</SectionCollapsible>
|
||||
) : null}
|
||||
{hasKecoSection ? (
|
||||
<SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}>
|
||||
{kecoRvwList.length > 0 ? <TechReviewOpinionTable items={kecoRvwList} /> : null}
|
||||
{renderOpinionForm("KECO")}
|
||||
</SectionCollapsible>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
function TechReviewOpinionTable({ items }: TechReviewOpinionTableProps) {
|
||||
return (
|
||||
<div className="overflow-x-auto">
|
||||
<Table variant="secondary">
|
||||
<colgroup>
|
||||
<col width="10%" />
|
||||
<col width="55%" />
|
||||
<col width="5%" />
|
||||
<col width="20%" />
|
||||
<col width="10%" />
|
||||
</colgroup>
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead>의견자명</TableHead>
|
||||
<TableHead>의견내용</TableHead>
|
||||
<TableHead>검토결과</TableHead>
|
||||
<TableHead>첨부파일</TableHead>
|
||||
<TableHead>등록일시</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{items.map((item) => (
|
||||
<TableRow key={`${item.fnrsCnsltnDocNo}_${item.rvwOpnnSn}`}>
|
||||
<TableCell align="center">{item.opnrNm}</TableCell>
|
||||
<TableCell align="left">{item.rvwRsltCn || "-"}</TableCell>
|
||||
<TableCell align="center">
|
||||
{item.rvwRsltAnmlyYn === "Y" ? "이상" : item.rvwRsltAnmlyYn === "N" ? "정상" : "-"}
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
{item.atchFileInfo?.atflCd ? (
|
||||
<a
|
||||
className="text-blue-600 hover:underline"
|
||||
href={`${PROXY_HOST}/attach-service/api/v1/atflcd/download/${item.atchFileInfo.atflCd}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{item.atchFileInfo.orgnlFileNm || "다운로드"}
|
||||
</a>
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
{item.regDt ? dayjs(item.regDt).format("YYYY-MM-DD HH:mm:ss") : "-"}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export { TechReviewOpinionSection };
|
||||
@@ -1,158 +0,0 @@
|
||||
import type { InstlSncnBizCstSaveRequestDto } from "@/entities/instl-sncn";
|
||||
|
||||
export interface CostItemDef {
|
||||
code: string;
|
||||
readonly?: boolean;
|
||||
children?: string[];
|
||||
}
|
||||
|
||||
function sumChildAmounts(list: InstlSncnBizCstSaveRequestDto[], childCodes: string[]) {
|
||||
let bscPlanAmt = 0;
|
||||
let bgtRfltAmt = 0;
|
||||
let tstmDesignAmt = 0;
|
||||
|
||||
childCodes.forEach((childCode) => {
|
||||
const child = list.find((c) => c.acntgSeCd === childCode);
|
||||
if (child) {
|
||||
bscPlanAmt += child.bscPlanAmt || 0;
|
||||
bgtRfltAmt += child.bgtRfltAmt || 0;
|
||||
tstmDesignAmt += child.tstmDesignAmt || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return { bscPlanAmt, bgtRfltAmt, tstmDesignAmt };
|
||||
}
|
||||
|
||||
export function recalculateBizCstTotals(
|
||||
list: InstlSncnBizCstSaveRequestDto[],
|
||||
items: CostItemDef[],
|
||||
): InstlSncnBizCstSaveRequestDto[] {
|
||||
const newList = [...list];
|
||||
let hasChanges = false;
|
||||
|
||||
for (let i = items.length - 1; i >= 0; i--) {
|
||||
const item = items[i];
|
||||
if (!item.readonly || !item.children) continue;
|
||||
|
||||
const idx = newList.findIndex((c) => c.acntgSeCd === item.code);
|
||||
if (idx < 0) continue;
|
||||
|
||||
const { bscPlanAmt, bgtRfltAmt, tstmDesignAmt } = sumChildAmounts(newList, item.children);
|
||||
const current = newList[idx];
|
||||
|
||||
if (
|
||||
(current.bscPlanAmt || 0) !== bscPlanAmt ||
|
||||
(current.bgtRfltAmt || 0) !== bgtRfltAmt ||
|
||||
(current.tstmDesignAmt || 0) !== tstmDesignAmt
|
||||
) {
|
||||
newList[idx] = { ...current, bscPlanAmt, bgtRfltAmt, tstmDesignAmt };
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges ? newList : list;
|
||||
}
|
||||
|
||||
export function calculateSewerPipeCost(
|
||||
bizCstList: InstlSncnBizCstSaveRequestDto[],
|
||||
newPipeCode: string,
|
||||
replaceCode: string,
|
||||
targetCode: string,
|
||||
): InstlSncnBizCstSaveRequestDto {
|
||||
const newPipe = bizCstList.find((item) => item.acntgSeCd === newPipeCode);
|
||||
const replace = bizCstList.find((item) => item.acntgSeCd === replaceCode);
|
||||
|
||||
const bscPlanAmt = (newPipe?.bscPlanAmt || 0) + (replace?.bscPlanAmt || 0);
|
||||
const bgtRfltAmt = (newPipe?.bgtRfltAmt || 0) + (replace?.bgtRfltAmt || 0);
|
||||
const tstmDesignAmt = (newPipe?.tstmDesignAmt || 0) + (replace?.tstmDesignAmt || 0);
|
||||
|
||||
return {
|
||||
acntgSeCd: targetCode,
|
||||
bscPlanAmt,
|
||||
bgtRfltAmt,
|
||||
tstmDesignAmt,
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateConstructionCost(
|
||||
bizCstList: InstlSncnBizCstSaveRequestDto[],
|
||||
codes: string[],
|
||||
targetCode: string,
|
||||
): InstlSncnBizCstSaveRequestDto {
|
||||
let bscPlanAmt = 0;
|
||||
let bgtRfltAmt = 0;
|
||||
let tstmDesignAmt = 0;
|
||||
|
||||
codes.forEach((code) => {
|
||||
const item = bizCstList.find((i) => i.acntgSeCd === code);
|
||||
if (item) {
|
||||
bscPlanAmt += item.bscPlanAmt || 0;
|
||||
bgtRfltAmt += item.bgtRfltAmt || 0;
|
||||
tstmDesignAmt += item.tstmDesignAmt || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
acntgSeCd: targetCode,
|
||||
bscPlanAmt,
|
||||
bgtRfltAmt,
|
||||
tstmDesignAmt,
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateIncidentalExpenses(
|
||||
bizCstList: InstlSncnBizCstSaveRequestDto[],
|
||||
codes: string[],
|
||||
targetCode: string,
|
||||
): InstlSncnBizCstSaveRequestDto {
|
||||
let bscPlanAmt = 0;
|
||||
let bgtRfltAmt = 0;
|
||||
let tstmDesignAmt = 0;
|
||||
|
||||
codes.forEach((code) => {
|
||||
const item = bizCstList.find((i) => i.acntgSeCd === code);
|
||||
if (item) {
|
||||
bscPlanAmt += item.bscPlanAmt || 0;
|
||||
bgtRfltAmt += item.bgtRfltAmt || 0;
|
||||
tstmDesignAmt += item.tstmDesignAmt || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
acntgSeCd: targetCode,
|
||||
bscPlanAmt,
|
||||
bgtRfltAmt,
|
||||
tstmDesignAmt,
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateTotalCost(
|
||||
bizCstList: InstlSncnBizCstSaveRequestDto[],
|
||||
codes: string[],
|
||||
targetCode: string,
|
||||
): InstlSncnBizCstSaveRequestDto {
|
||||
let bscPlanAmt = 0;
|
||||
let bgtRfltAmt = 0;
|
||||
let tstmDesignAmt = 0;
|
||||
|
||||
codes.forEach((code) => {
|
||||
const item = bizCstList.find((i) => i.acntgSeCd === code);
|
||||
if (item) {
|
||||
bscPlanAmt += item.bscPlanAmt || 0;
|
||||
bgtRfltAmt += item.bgtRfltAmt || 0;
|
||||
tstmDesignAmt += item.tstmDesignAmt || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
acntgSeCd: targetCode,
|
||||
bscPlanAmt,
|
||||
bgtRfltAmt,
|
||||
tstmDesignAmt,
|
||||
};
|
||||
}
|
||||
|
||||
export function calculateDiffPercent(diff: number, baseline: number): string {
|
||||
if (baseline === 0) return "-";
|
||||
return `${Math.round((diff / baseline) * 100)}%`;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { IUserInfo } from "@/shared/store/user-store";
|
||||
import type { InstlSncnMngDetResponse } from "@/entities/instl-sncn";
|
||||
|
||||
import type { CnfmRegistFormData } from "./cnfm-regist-schema";
|
||||
import { parseTaskSeComCdFromApi } from "./cnfm-regist-schema";
|
||||
import type { InstlSncnRegistFormData } from "./instl-sncn-regist-schema";
|
||||
import { parseTaskSeComCdFromApi } from "./instl-sncn-regist-schema";
|
||||
|
||||
function mapSelectedValue(value?: string | null): "Y" | "N" | null {
|
||||
if (value === "Y" || value === "N") return value;
|
||||
@@ -23,7 +23,7 @@ function mapEsntlAtchFileList(esntlFileList: InstlSncnMngDetResponse["esntlFileL
|
||||
}));
|
||||
}
|
||||
|
||||
export function mapDetailToFormData(data: InstlSncnMngDetResponse): CnfmRegistFormData {
|
||||
export function mapDetailToFormData(data: InstlSncnMngDetResponse): InstlSncnRegistFormData {
|
||||
const { detDto, bizSclList, bizCstList, cklstResultList, esntlFileList } = data;
|
||||
|
||||
return {
|
||||
@@ -92,7 +92,7 @@ export function mapDetailToFormData(data: InstlSncnMngDetResponse): CnfmRegistFo
|
||||
export function getCreateDefaultValues(
|
||||
userInfo: IUserInfo | null,
|
||||
taskSeComCd?: string[],
|
||||
): CnfmRegistFormData {
|
||||
): InstlSncnRegistFormData {
|
||||
return {
|
||||
instlSncnMng: {
|
||||
bizNm: "",
|
||||
|
||||
+2
-16
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const cnfmRegistSchema = z.object({
|
||||
export const instlSncnRegistSchema = z.object({
|
||||
instlSncnMng: z.object({
|
||||
bizNm: z.string().min(1, "사업명은 필수입니다"),
|
||||
bizBgngYr: z.string().min(1, "사업시작연도는 필수입니다"),
|
||||
@@ -77,7 +77,7 @@ export const cnfmRegistSchema = z.object({
|
||||
}),
|
||||
});
|
||||
|
||||
export type CnfmRegistFormData = z.infer<typeof cnfmRegistSchema>;
|
||||
export type InstlSncnRegistFormData = z.infer<typeof instlSncnRegistSchema>;
|
||||
|
||||
export function formatTaskSeComCdForApi(taskSeComCd: string[]): string {
|
||||
return taskSeComCd.join(",");
|
||||
@@ -87,17 +87,3 @@ export function parseTaskSeComCdFromApi(taskSeComCd?: string): string[] {
|
||||
if (!taskSeComCd) return [];
|
||||
return taskSeComCd.split(",").filter(Boolean);
|
||||
}
|
||||
|
||||
export const cnfmRegistSaveSchema = cnfmRegistSchema.pick({
|
||||
instlSncnMng: true,
|
||||
bzScaleList: true,
|
||||
bizCstList: true,
|
||||
});
|
||||
|
||||
export const cnfmRegistSubmitSchema = cnfmRegistSchema.refine(
|
||||
(data) => data.privacyConsent === "Y",
|
||||
{
|
||||
message: "개인정보 수집/이용에 동의해야 제출할 수 있습니다",
|
||||
path: ["privacyConsent"],
|
||||
},
|
||||
);
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
instlSncnService,
|
||||
} from "@/entities/instl-sncn";
|
||||
import { useRvwMnpwMngLoginUserList } from "@/entities/rvw-mnpw";
|
||||
import { TextInputDialog } from "@/widgets/pbadms-sprt";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import {
|
||||
@@ -32,7 +33,6 @@ import type { TechReviewOpinionSectionHandle } from "../sections/tech-review-opi
|
||||
|
||||
import { ElaprApprovalDialog } from "./elapr-approval-dialog";
|
||||
import { ElaprTmpltPickerDialog } from "./elapr-tmplt-picker-dialog";
|
||||
import { TextInputDialog } from "./text-input-dialog";
|
||||
|
||||
interface FloatingActionButtonsProps {
|
||||
data: InstlSncnMngDetResponse;
|
||||
|
||||
@@ -13,23 +13,24 @@ import {
|
||||
type InstlSncnMngDetResponse,
|
||||
instlSncnService,
|
||||
} from "@/entities/instl-sncn";
|
||||
import {
|
||||
AttachmentsFormSection,
|
||||
BusinessCostFormSection,
|
||||
BusinessScaleFormSection,
|
||||
ChecklistFormSection,
|
||||
ContactInfoFormSection,
|
||||
PrivacyConsentSection,
|
||||
} from "@/widgets/pbadms-sprt";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import {
|
||||
type CnfmRegistFormData,
|
||||
cnfmRegistSchema,
|
||||
formatTaskSeComCdForApi,
|
||||
} from "../lib/cnfm-regist-schema";
|
||||
import { getCreateDefaultValues, mapDetailToFormData } from "../lib/form-data-mapper";
|
||||
import {
|
||||
formatTaskSeComCdForApi,
|
||||
type InstlSncnRegistFormData,
|
||||
instlSncnRegistSchema,
|
||||
} from "../lib/instl-sncn-regist-schema";
|
||||
|
||||
import { AttachmentsFormSection } from "./sections/attachments-form-section";
|
||||
import { BasicInfoFormSection } from "./sections/basic-info-form-section";
|
||||
import { BusinessCostFormSection } from "./sections/business-cost-form-section";
|
||||
import { BusinessScaleFormSection } from "./sections/business-scale-form-section";
|
||||
import { ChecklistFormSection } from "./sections/checklist-form-section";
|
||||
import { ContactInfoFormSection } from "./sections/contact-info-form-section";
|
||||
import { PrivacyConsentSection } from "./sections/privacy-consent-section";
|
||||
|
||||
interface InstlFormPageProps {
|
||||
id?: string;
|
||||
mode: "create" | "edit";
|
||||
@@ -45,8 +46,8 @@ function InstlFormPage({ id, mode, initialData, taskSeComCd }: InstlFormPageProp
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const isEditMode = mode === "edit";
|
||||
|
||||
const form = useForm<CnfmRegistFormData>({
|
||||
resolver: zodResolver(cnfmRegistSchema),
|
||||
const form = useForm<InstlSncnRegistFormData>({
|
||||
resolver: zodResolver(instlSncnRegistSchema),
|
||||
mode: "onChange",
|
||||
defaultValues:
|
||||
isEditMode && initialData
|
||||
@@ -54,7 +55,7 @@ function InstlFormPage({ id, mode, initialData, taskSeComCd }: InstlFormPageProp
|
||||
: getCreateDefaultValues(userInfo, taskSeComCd),
|
||||
});
|
||||
|
||||
async function onSave(data: CnfmRegistFormData) {
|
||||
async function onSave(data: InstlSncnRegistFormData) {
|
||||
if (isSubmitting) return;
|
||||
|
||||
try {
|
||||
@@ -92,13 +93,14 @@ function InstlFormPage({ id, mode, initialData, taskSeComCd }: InstlFormPageProp
|
||||
<FormProvider {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSave)} className="mt-6 space-y-4">
|
||||
<BasicInfoFormSection />
|
||||
<ContactInfoFormSection />
|
||||
<ContactInfoFormSection fieldPrefix="instlSncnMng" />
|
||||
<PrivacyConsentSection />
|
||||
<BusinessScaleFormSection />
|
||||
<BusinessCostFormSection />
|
||||
<ChecklistFormSection docSeComCd="INSTL" />
|
||||
<ChecklistFormSection docSeComCd="INSTL" fieldPrefix="instlSncnMng" />
|
||||
<AttachmentsFormSection
|
||||
docSeComCd="INSTL"
|
||||
fieldPrefix="instlSncnMng"
|
||||
initialEsntlFiles={isEditMode ? initialData?.esntlFileList : undefined}
|
||||
initialEtcFiles={isEditMode ? initialData?.etcFileList : undefined}
|
||||
/>
|
||||
|
||||
@@ -7,12 +7,12 @@ import { getCoreRowModel, type PaginationState } from "@tanstack/react-table";
|
||||
|
||||
import { useDataTable } from "@/shared/lib";
|
||||
import { type InstlSncnMngSearchParams, useInstlSncnList } from "@/entities/instl-sncn";
|
||||
import { TaskSePickerDialog } from "@/widgets/pbadms-sprt";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import { formatTaskSeComCdForApi } from "../lib/instl-sncn-regist-schema";
|
||||
import { createInstlSncnColumns } from "../model/columns";
|
||||
|
||||
import { TaskSePickerDialog } from "./components/task-se-picker-dialog";
|
||||
|
||||
interface InstlListProps {
|
||||
searchParams: InstlSncnMngSearchParams;
|
||||
pagination: PaginationState;
|
||||
@@ -63,8 +63,7 @@ function InstlList({ searchParams, pagination, onPaginationChange }: InstlListPr
|
||||
|
||||
const handleConfirmTaskSe = (selectedCodes: string[]) => {
|
||||
setIsTaskSeDialogOpen(false);
|
||||
const query = selectedCodes.join(",");
|
||||
router.push(`/instl-sncn/regist?taskSeComCd=${query}`);
|
||||
router.push(`/instl-sncn/regist?taskSeComCd=${formatTaskSeComCdForApi(selectedCodes)}`);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -82,6 +81,8 @@ function InstlList({ searchParams, pagination, onPaginationChange }: InstlListPr
|
||||
open={isTaskSeDialogOpen}
|
||||
onOpenChange={setIsTaskSeDialogOpen}
|
||||
onConfirm={handleConfirmTaskSe}
|
||||
title="설치인가 신청"
|
||||
codeUpCd="INSTL"
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -6,10 +6,9 @@ import type {
|
||||
AtflMngClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
} from "@/entities/instl-sncn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
interface AttachmentsSectionProps {
|
||||
esntlFileList: EsntlAtchFileMngTreeResponseDto[];
|
||||
etcFileList: AtflMngClientResponseDto[];
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
import { useState } from "react";
|
||||
import { Controller, useFormContext } from "react-hook-form";
|
||||
|
||||
import { useUserStore } from "@/shared/lib";
|
||||
import { Field, FieldError, FieldGroup, FieldLabel, FieldSet } from "@/shared/ui/field";
|
||||
import { findCodeLabel, useCodeList } from "@/entities/code";
|
||||
import { type BnsApplyData, BnsPickerDialog } from "@/widgets/bns-picker";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
@@ -18,12 +21,11 @@ import {
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import type { CnfmRegistFormData } from "../../lib/cnfm-regist-schema";
|
||||
import { type BnsApplyData, BnsPickerDialog } from "../components/bns-picker-dialog";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
import type { InstlSncnRegistFormData } from "../../lib/instl-sncn-regist-schema";
|
||||
|
||||
function BasicInfoFormSection() {
|
||||
const { control, watch, setValue } = useFormContext<CnfmRegistFormData>();
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const { control, watch, setValue } = useFormContext<InstlSncnRegistFormData>();
|
||||
const [isPickerOpen, setIsPickerOpen] = useState(false);
|
||||
const taskSeComCd = watch("instlSncnMng.taskSeComCd");
|
||||
|
||||
@@ -141,22 +143,9 @@ function BasicInfoFormSection() {
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead data-required>구분</TableHead>
|
||||
<TableCell colSpan={3}>
|
||||
<Controller
|
||||
name="instlSncnMng.taskSeComCd"
|
||||
control={control}
|
||||
render={({ fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
<span>{taskSeComCdLabel}</span>
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell>{taskSeComCdLabel}</TableCell>
|
||||
<TableHead>신청 지자체</TableHead>
|
||||
<TableCell colSpan={3}>서울특별시 강남구</TableCell>
|
||||
<TableCell>{userInfo?.instSeNm}</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableHead data-required>사업구분</TableHead>
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import type { InstlSncnMngResponseDto } from "@/entities/instl-sncn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
interface BasicInfoSectionProps {
|
||||
det: InstlSncnMngResponseDto;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import type { BizCstTreeDto } from "@/entities/instl-sncn";
|
||||
import { calcDiffPercent, fmtNumber, indentPx } from "@/widgets/pbadms-sprt";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
import { sortBizCstListByTreePath } from "../../lib/business-cost-utils";
|
||||
import { calcDiffPercent, fmtNumber, indentPx } from "../../lib/format-utils";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
interface BusinessCostSectionProps {
|
||||
bizCstList: BizCstTreeDto[];
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import type { BizSclTreeDto } from "@/entities/instl-sncn";
|
||||
import { fmtNumber, indentPx } from "@/widgets/pbadms-sprt";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
import { fmtNumber, indentPx } from "../../lib/format-utils";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
interface BusinessScaleSectionProps {
|
||||
bizSclList: BizSclTreeDto[];
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { type Dispatch, type SetStateAction, useEffect, useMemo, useState } from "react";
|
||||
|
||||
import type { CklstRvwRsltTreeDto, ReviewStepCode } from "@/entities/instl-sncn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@common/components";
|
||||
|
||||
import {
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
TASK_CODE_LABELS,
|
||||
} from "../../model/view-types";
|
||||
import { ChecklistTaskPanel } from "../components/checklist-task-panel";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
interface ChecklistSectionProps {
|
||||
cklstResultList: CklstRvwRsltTreeDto[];
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import type { InstlSncnMngResponseDto } from "@/entities/instl-sncn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
interface ContactInfoSectionProps {
|
||||
det: InstlSncnMngResponseDto;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
import { dayjs } from "@/shared/lib";
|
||||
import type { InstlSncnMngResponseDto } from "@/entities/instl-sncn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Table, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
interface HistoryInfoSectionProps {
|
||||
det: InstlSncnMngResponseDto;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { dayjs, getDefaultFileKey, useTus } from "@/shared/lib";
|
||||
import { Field, FieldLabel, FieldSet } from "@/shared/ui/field";
|
||||
import { attachService } from "@/entities/attach";
|
||||
import type { InstlSncnRvwOpnnResponseDto, ReviewStepCode } from "@/entities/instl-sncn";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import {
|
||||
Button,
|
||||
RadioGroup,
|
||||
@@ -22,7 +23,6 @@ import {
|
||||
|
||||
import type { ReviewOpinionFormData } from "../../lib/review-opinion-utils";
|
||||
import { REVIEW_STEP_LABELS } from "../../model/view-types";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
|
||||
const RVW_OPNN_FILE_KEY_PREFIX = "rvw-opnn::";
|
||||
|
||||
|
||||
@@ -29,3 +29,22 @@ export interface ApiError {
|
||||
}
|
||||
|
||||
export type { PageableParams, PageResponse } from "./page";
|
||||
export type {
|
||||
AtflMngClientResponseDto,
|
||||
BizCstSaveBase,
|
||||
BizCstTreeDto,
|
||||
BizSclTreeDto,
|
||||
BzScaleSaveBase,
|
||||
CklstResultSaveBase,
|
||||
CklstRvwRsltTreeDto,
|
||||
DocPrgrsUpdateRequestDto,
|
||||
ElaprDocPrgrsClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
EsntlAtchFileSaveBase,
|
||||
PbadmsApplySaveHeader,
|
||||
PbadmsMngDetResponseBase,
|
||||
RvwOpnnResponseExtension,
|
||||
RvwOpnnSaveBase,
|
||||
SplmntDmndResponseExtension,
|
||||
SplmntDmndSaveBase,
|
||||
} from "./pbadms-sprt";
|
||||
|
||||
@@ -0,0 +1,245 @@
|
||||
/** 행정지원문서 진행상태 수정 DTO */
|
||||
export interface DocPrgrsUpdateRequestDto {
|
||||
/** 행정지원문서번호 */
|
||||
docNo: string;
|
||||
/** 문서구분코드 */
|
||||
docSeComCd: string;
|
||||
/** 진행상태공통코드 */
|
||||
prgrsSttsComCd: string;
|
||||
}
|
||||
|
||||
/** 공종 트리와 사업규모(수량) 조합 DTO */
|
||||
export interface BizSclTreeDto {
|
||||
/** 들여쓰기 적용된 공종명(시각적) */
|
||||
indCnstpSeCdNm: string;
|
||||
/** 공종 코드 */
|
||||
cnstpSeCd: string;
|
||||
/** 공종 코드명 */
|
||||
cnstpSeCdNm: string;
|
||||
/** 사용 여부(Y/N) */
|
||||
useYn: string;
|
||||
/** 트리 레벨(깊이) */
|
||||
treeLevel: number;
|
||||
/** 트리 경로 표시용 문자열 */
|
||||
treePath: string;
|
||||
/** 기본계획수량 */
|
||||
bscPlanQty: number;
|
||||
/** 예산반영수량 */
|
||||
bgtRfltQty: number;
|
||||
/** 금회설계수량 */
|
||||
tstmDesignQty: number;
|
||||
}
|
||||
|
||||
/** 회계구분 트리와 사업비용 조합 DTO */
|
||||
export interface BizCstTreeDto {
|
||||
/** 들여쓰기 적용된 회계구분명(시각적) */
|
||||
indAcntgSeCdNm: string;
|
||||
/** 회계구분 코드 */
|
||||
acntgSeCd: string;
|
||||
/** 회계구분 코드명 */
|
||||
acntgSeCdNm: string;
|
||||
/** 사용 여부(Y/N) */
|
||||
useYn: string;
|
||||
/** 트리 레벨(깊이) */
|
||||
treeLevel: number;
|
||||
/** 트리 경로 표시용 문자열 */
|
||||
treePath: string;
|
||||
/** 기본계획금액 */
|
||||
bscPlanAmt: number;
|
||||
/** 예산반영금액 */
|
||||
bgtRfltAmt: number;
|
||||
/** 금회설계금액 */
|
||||
tstmDesignAmt: number;
|
||||
}
|
||||
|
||||
/** 점검표 검토결과 트리 DTO */
|
||||
export interface CklstRvwRsltTreeDto {
|
||||
/** 점검표일련번호 */
|
||||
cklstSn: number;
|
||||
/** 점검표명 */
|
||||
cklstNm: string;
|
||||
/** 점검표항목일련번호 */
|
||||
cklstArtclSn: number;
|
||||
/** 점검표항목명 */
|
||||
cklstArtclNm: string;
|
||||
/** 검토일련번호 */
|
||||
cklstRvwSn: number;
|
||||
/** 상위검토일련번호 */
|
||||
upCklstRvwSn: number | null;
|
||||
/** 트리 레벨 */
|
||||
treeLevel: number;
|
||||
/** 검토내용 */
|
||||
rvwCn: string;
|
||||
/** 점검 사용 여부 */
|
||||
bchckUseYn: string;
|
||||
/** 정렬순서 */
|
||||
sortSeq: number;
|
||||
/** 업무구분코드 */
|
||||
taskSeComCd: string;
|
||||
/** 검토단계공통코드 */
|
||||
rvwStpComCd: string;
|
||||
/** 검토결과이상여부 */
|
||||
rvwRsltAnmlyYn: string;
|
||||
/** 검토담당자 UUID */
|
||||
rvwPicUuid: string | null;
|
||||
/** 담당자검토내용 */
|
||||
picRvwCn: string | null;
|
||||
/** 검토일시 */
|
||||
rvwDt: string | null;
|
||||
}
|
||||
|
||||
/** 필수첨부파일관리 트리 조회 응답 DTO */
|
||||
export interface EsntlAtchFileMngTreeResponseDto {
|
||||
/** 필수첨부파일아이디 */
|
||||
esntlAtchFileId: string;
|
||||
/** 문서구분공통코드 */
|
||||
docSeComCd: string;
|
||||
/** 필수첨부파일명 */
|
||||
esntlAtchFileNm: string;
|
||||
/** 필수첨부여부 */
|
||||
esntlAtchYn: string;
|
||||
/** 필수첨부파일비고 */
|
||||
esntlAtchFileRmrk: string | null;
|
||||
/** 첨부파일 코드 */
|
||||
atflCd?: string;
|
||||
/** 첨부파일 일련번호 */
|
||||
atflSn?: number;
|
||||
/** 첨부파일 ID */
|
||||
atflId?: string;
|
||||
/** 원본 파일명 */
|
||||
orgnlFileNm?: string;
|
||||
/** 첨부파일 크기 */
|
||||
atflFlieSz?: number;
|
||||
/** 첨부파일 타입 */
|
||||
atflType?: string;
|
||||
/** 다운로드 횟수 */
|
||||
dwnldNocs?: number;
|
||||
/** 등록일시 */
|
||||
regDt?: string;
|
||||
}
|
||||
|
||||
/** 첨부파일 응답 DTO (attach-service client) */
|
||||
export interface AtflMngClientResponseDto {
|
||||
atflCd: string;
|
||||
atflSn: number;
|
||||
atflId: string;
|
||||
physFileNm: string;
|
||||
orgnlFileNm: string;
|
||||
atflFlieSz: number;
|
||||
atflType: string;
|
||||
dwnldNocs: number;
|
||||
delYn: string;
|
||||
lnkgDmnId: string | null;
|
||||
lnkgDmnNm: string | null;
|
||||
regDt: string;
|
||||
}
|
||||
|
||||
/** 전자결재 진행상태 (클라이언트 응답용) */
|
||||
export interface ElaprDocPrgrsClientResponseDto {
|
||||
elaprDocNo?: string;
|
||||
elaprDmndId?: string;
|
||||
elaprPrgrsId?: string;
|
||||
atrzSeqNo?: number;
|
||||
atrzSeComCd?: string;
|
||||
atrzSeComNm?: string;
|
||||
aprvrUuid?: string;
|
||||
aprvrUuidNm?: string;
|
||||
atrzPrgrsSttsComCd?: string;
|
||||
atrzPrgrsSttsComNm?: string;
|
||||
rjctRsn?: string | null;
|
||||
atrzDt?: string | null;
|
||||
jbpsSeNm?: string;
|
||||
jbgdSeNm?: string;
|
||||
ognzNm?: string;
|
||||
}
|
||||
|
||||
/** 사업규모 저장 공통 필드 */
|
||||
export interface BzScaleSaveBase {
|
||||
cnstpSeCd?: string;
|
||||
bscPl?: number;
|
||||
budgetReflct?: number;
|
||||
thtiDsgn?: number;
|
||||
}
|
||||
|
||||
/** 총사업비 저장 공통 필드 */
|
||||
export interface BizCstSaveBase {
|
||||
acntgSeCd?: string;
|
||||
bscPlanAmt?: number;
|
||||
bgtRfltAmt?: number;
|
||||
tstmDesignAmt?: number;
|
||||
}
|
||||
|
||||
/** 체크리스트 결과 저장 공통 필드 */
|
||||
export interface CklstResultSaveBase {
|
||||
cklstRvwSn?: number;
|
||||
cklstArtclSn?: number;
|
||||
cklstSn?: number;
|
||||
rvwStpComCd: string;
|
||||
picRvwCn?: string | null;
|
||||
}
|
||||
|
||||
/** 필수첨부파일 저장 공통 필드 */
|
||||
export interface EsntlAtchFileSaveBase {
|
||||
esntlAtchFileId?: string;
|
||||
atchFileGroupId?: string;
|
||||
}
|
||||
|
||||
/** 보완요구 저장 공통 필드 */
|
||||
export interface SplmntDmndSaveBase {
|
||||
splmntDmndSn?: number;
|
||||
splmntArtclComCd?: string;
|
||||
splmntDmndCn?: string;
|
||||
splmntDmndDt?: string;
|
||||
splmntDmndAtchFileGroupId?: string;
|
||||
splmntCn?: string;
|
||||
splmntPicNm?: string;
|
||||
splmntCmptnDt?: string;
|
||||
splmntAtchFileGroupId?: string;
|
||||
cmptnYn?: string;
|
||||
}
|
||||
|
||||
/** 검토의견 저장 공통 필드 (문서번호 제외) */
|
||||
export interface RvwOpnnSaveBase {
|
||||
rvwOpnnSn?: number;
|
||||
opnrSeComCd?: string;
|
||||
opnrNm?: string;
|
||||
rvwRsltCn?: string;
|
||||
rvwRsltAnmlyYn?: string;
|
||||
atchFileGroupId?: string;
|
||||
}
|
||||
|
||||
/** 통합 신청 저장 공통 헤더 */
|
||||
export interface PbadmsApplySaveHeader {
|
||||
techReViewSaveCd?: string;
|
||||
rvwStpCd?: string;
|
||||
}
|
||||
|
||||
/** 검토의견 응답 공통 확장 필드 */
|
||||
export interface RvwOpnnResponseExtension {
|
||||
opnrSeCdNm?: string;
|
||||
atchFileInfo?: AtflMngClientResponseDto;
|
||||
regDt?: string;
|
||||
}
|
||||
|
||||
/** 보완요구 응답 공통 확장 필드 */
|
||||
export interface SplmntDmndResponseExtension {
|
||||
splmntArtclCdNm?: string;
|
||||
splmntDmndAtchFileInfo?: AtflMngClientResponseDto;
|
||||
splmntAtchFileInfo?: AtflMngClientResponseDto;
|
||||
regDt?: string;
|
||||
rgtr?: string;
|
||||
rgtrNm?: string;
|
||||
}
|
||||
|
||||
/** 행정지원 문서 상세 응답 공통 구조 */
|
||||
export interface PbadmsMngDetResponseBase<TDet, TRvwOpnn = never, TSplmntDmnd = never> {
|
||||
detDto?: TDet;
|
||||
bizSclList?: BizSclTreeDto[];
|
||||
bizCstList?: BizCstTreeDto[];
|
||||
cklstResultList?: CklstRvwRsltTreeDto[];
|
||||
esntlFileList?: EsntlAtchFileMngTreeResponseDto[];
|
||||
etcFileList?: AtflMngClientResponseDto[];
|
||||
rvwList?: TRvwOpnn[];
|
||||
splmntDmndList?: TSplmntDmnd[];
|
||||
elaprDocPrgrsList?: ElaprDocPrgrsClientResponseDto[] | null;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export type { BnsApplyData } from "./ui/bns-picker-dialog";
|
||||
export { BnsPickerDialog } from "./ui/bns-picker-dialog";
|
||||
+3
-4
@@ -17,6 +17,7 @@ import type { CmCdAdstDstrComboResponseDto } from "@/entities/adstdstr";
|
||||
import { useFindGugunCombo, useFindSidoCombo } from "@/entities/adstdstr";
|
||||
import type { BnsDetailResponseDto, BnsListResponseDto, BnsSearchDto } from "@/entities/bns-if";
|
||||
import { buildBnsSearchDto, useBnsDetail, useBnsList } from "@/entities/bns-if";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
@@ -38,10 +39,8 @@ import {
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import { BNS_LIST_PAGE_SIZE, toBnsListPageResponse } from "../../lib/to-bns-list-page-response";
|
||||
import { createBnsListColumns, getBnsListRowKey } from "../../model/bns-picker-columns";
|
||||
|
||||
import { SectionCollapsible } from "./section-collapsible";
|
||||
import { BNS_LIST_PAGE_SIZE, toBnsListPageResponse } from "../lib/to-bns-list-page-response";
|
||||
import { createBnsListColumns, getBnsListRowKey } from "../model/bns-picker-columns";
|
||||
|
||||
const EMPTY_ADST_LIST: CmCdAdstDstrComboResponseDto[] = [];
|
||||
const YEAR_START = 1995;
|
||||
@@ -1,3 +1,3 @@
|
||||
export { NumCell, ReadCell } from './cells';
|
||||
export { PrivacyConsent } from './privacy-consent';
|
||||
export { EtcAttachments } from './attachments';
|
||||
export { EtcAttachments } from "./attachments";
|
||||
export { NumCell, ReadCell } from "./cells";
|
||||
export { PrivacyConsent } from "./privacy-consent";
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
export {
|
||||
atchFileGroupIdPath,
|
||||
createEtcUploadKey,
|
||||
createUploadKey,
|
||||
isEtcFileKey,
|
||||
} from "./lib/attachments-form-utils";
|
||||
export { buildAcntgCostItems, recalculateBizCstTotals } from "./lib/business-cost-form-utils";
|
||||
export { buildCnstpScaleItems, recalculateBzScaleTotals } from "./lib/business-scale-form-utils";
|
||||
export {
|
||||
buildChecklistTabs,
|
||||
orderCklstTreeNodes,
|
||||
syncCklstResultListFromTree,
|
||||
} from "./lib/checklist-form-utils";
|
||||
export { calcDiffPercent, fmtNumber, indentPx } from "./lib/format-utils";
|
||||
export { AttachmentsFormSection } from "./ui/attachments-form-section";
|
||||
export { BusinessCostFormSection } from "./ui/business-cost-form-section";
|
||||
export { BusinessScaleFormSection } from "./ui/business-scale-form-section";
|
||||
export { ChecklistFormSection } from "./ui/checklist-form-section";
|
||||
export { ContactInfoFormSection } from "./ui/contact-info-form-section";
|
||||
export { PrivacyConsentSection } from "./ui/privacy-consent-section";
|
||||
export { SectionCollapsible } from "./ui/section-collapsible";
|
||||
export { TaskSePickerDialog } from "./ui/task-se-picker-dialog";
|
||||
export { TextInputDialog } from "./ui/text-input-dialog";
|
||||
@@ -0,0 +1,21 @@
|
||||
import { getDefaultFileKey } from "@/shared/lib";
|
||||
|
||||
export type FieldPrefix = "fnrsCnsltnMng" | "instlSncnMng";
|
||||
|
||||
export const ETC_FILE_KEY_PREFIX = "etc::";
|
||||
|
||||
export function atchFileGroupIdPath(fieldPrefix: FieldPrefix): string {
|
||||
return `${fieldPrefix}.atchFileGroupId`;
|
||||
}
|
||||
|
||||
export function createUploadKey(esntlAtchFileId: string, file: File): string {
|
||||
return `${esntlAtchFileId}::${getDefaultFileKey(file)}`;
|
||||
}
|
||||
|
||||
export function createEtcUploadKey(file: File): string {
|
||||
return `${ETC_FILE_KEY_PREFIX}${getDefaultFileKey(file)}`;
|
||||
}
|
||||
|
||||
export function isEtcFileKey(fileKey: string): boolean {
|
||||
return fileKey.startsWith(ETC_FILE_KEY_PREFIX);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import type { AcntgSeMngTreeDto } from "@/entities/acntg";
|
||||
|
||||
export interface CostItemDef {
|
||||
code: string;
|
||||
label: string;
|
||||
level: number;
|
||||
readonly?: boolean;
|
||||
children?: string[];
|
||||
}
|
||||
|
||||
export interface BizCstListItem {
|
||||
acntgSeCd: string;
|
||||
bscPlanAmt: number;
|
||||
bgtRfltAmt: number;
|
||||
tstmDesignAmt: number;
|
||||
}
|
||||
|
||||
function sumChildAmounts(list: BizCstListItem[], childCodes: string[]) {
|
||||
let bscPlanAmt = 0;
|
||||
let bgtRfltAmt = 0;
|
||||
let tstmDesignAmt = 0;
|
||||
|
||||
childCodes.forEach((childCode) => {
|
||||
const child = list.find((c) => c.acntgSeCd === childCode);
|
||||
if (child) {
|
||||
bscPlanAmt += child.bscPlanAmt || 0;
|
||||
bgtRfltAmt += child.bgtRfltAmt || 0;
|
||||
tstmDesignAmt += child.tstmDesignAmt || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return { bscPlanAmt, bgtRfltAmt, tstmDesignAmt };
|
||||
}
|
||||
|
||||
export function buildAcntgCostItems(tree: AcntgSeMngTreeDto[]): CostItemDef[] {
|
||||
if (tree.length === 0) return [];
|
||||
|
||||
const childrenMap = new Map<string, string[]>();
|
||||
tree.forEach((node) => {
|
||||
if (node.upAcntgSeCd) {
|
||||
const siblings = childrenMap.get(node.upAcntgSeCd) || [];
|
||||
siblings.push(node.acntgSeCd);
|
||||
childrenMap.set(node.upAcntgSeCd, siblings);
|
||||
}
|
||||
});
|
||||
|
||||
return tree
|
||||
.filter((node) => node.useYn === "Y")
|
||||
.map((node) => {
|
||||
const children = childrenMap.get(node.acntgSeCd);
|
||||
return {
|
||||
code: node.acntgSeCd,
|
||||
label: node.acntgSeCdNm,
|
||||
level: node.treeLevel,
|
||||
readonly: Boolean(children && children.length > 0),
|
||||
children,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export function recalculateBizCstTotals(
|
||||
list: BizCstListItem[],
|
||||
items: CostItemDef[],
|
||||
): BizCstListItem[] {
|
||||
const newList = [...list];
|
||||
let hasChanges = false;
|
||||
|
||||
for (let i = items.length - 1; i >= 0; i--) {
|
||||
const item = items[i];
|
||||
if (!item.readonly || !item.children) continue;
|
||||
|
||||
const idx = newList.findIndex((c) => c.acntgSeCd === item.code);
|
||||
if (idx < 0) continue;
|
||||
|
||||
const { bscPlanAmt, bgtRfltAmt, tstmDesignAmt } = sumChildAmounts(newList, item.children);
|
||||
const current = newList[idx];
|
||||
|
||||
if (
|
||||
(current.bscPlanAmt || 0) !== bscPlanAmt ||
|
||||
(current.bgtRfltAmt || 0) !== bgtRfltAmt ||
|
||||
(current.tstmDesignAmt || 0) !== tstmDesignAmt
|
||||
) {
|
||||
newList[idx] = { ...current, bscPlanAmt, bgtRfltAmt, tstmDesignAmt };
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges ? newList : list;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
import type { CnstpSeMngTreeDto } from "@/entities/cnstp";
|
||||
|
||||
export interface ScaleItemDef {
|
||||
code: string;
|
||||
label: string;
|
||||
level: number;
|
||||
readonly?: boolean;
|
||||
children?: string[];
|
||||
}
|
||||
|
||||
export interface BzScaleListItem {
|
||||
cnstpSeCd: string;
|
||||
bscPl: number;
|
||||
budgetReflct: number;
|
||||
thtiDsgn: number;
|
||||
diff?: number;
|
||||
}
|
||||
|
||||
function sumChildScale(list: BzScaleListItem[], childCodes: string[]) {
|
||||
let bscPl = 0;
|
||||
let budgetReflct = 0;
|
||||
let thtiDsgn = 0;
|
||||
|
||||
childCodes.forEach((childCode) => {
|
||||
const child = list.find((c) => c.cnstpSeCd === childCode);
|
||||
if (child) {
|
||||
bscPl += child.bscPl || 0;
|
||||
budgetReflct += child.budgetReflct || 0;
|
||||
thtiDsgn += child.thtiDsgn || 0;
|
||||
}
|
||||
});
|
||||
|
||||
return { bscPl, budgetReflct, thtiDsgn };
|
||||
}
|
||||
|
||||
function withDiff(item: BzScaleListItem): BzScaleListItem {
|
||||
const budgetReflct = item.budgetReflct || 0;
|
||||
const thtiDsgn = item.thtiDsgn || 0;
|
||||
return { ...item, diff: thtiDsgn - budgetReflct };
|
||||
}
|
||||
|
||||
export function buildCnstpScaleItems(tree: CnstpSeMngTreeDto[]): ScaleItemDef[] {
|
||||
if (tree.length === 0) return [];
|
||||
|
||||
const childrenMap = new Map<string, string[]>();
|
||||
tree.forEach((node) => {
|
||||
if (node.upCnstpCd) {
|
||||
const siblings = childrenMap.get(node.upCnstpCd) || [];
|
||||
siblings.push(node.cnstpSeCd);
|
||||
childrenMap.set(node.upCnstpCd, siblings);
|
||||
}
|
||||
});
|
||||
|
||||
return tree
|
||||
.filter((node) => node.useYn === "Y")
|
||||
.map((node) => {
|
||||
const children = childrenMap.get(node.cnstpSeCd);
|
||||
return {
|
||||
code: node.cnstpSeCd,
|
||||
label: node.cnstpSeCdNm,
|
||||
level: node.treeLevel,
|
||||
readonly: Boolean(children && children.length > 0),
|
||||
children,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export function recalculateBzScaleTotals(
|
||||
list: BzScaleListItem[],
|
||||
items: ScaleItemDef[],
|
||||
): BzScaleListItem[] {
|
||||
const newList = list.map(withDiff);
|
||||
let hasChanges = false;
|
||||
|
||||
for (let i = items.length - 1; i >= 0; i--) {
|
||||
const item = items[i];
|
||||
if (!item.readonly || !item.children) continue;
|
||||
|
||||
const idx = newList.findIndex((c) => c.cnstpSeCd === item.code);
|
||||
if (idx < 0) continue;
|
||||
|
||||
const { bscPl, budgetReflct, thtiDsgn } = sumChildScale(newList, item.children);
|
||||
const current = newList[idx];
|
||||
const next = withDiff({ ...current, bscPl, budgetReflct, thtiDsgn });
|
||||
|
||||
if (
|
||||
(current.bscPl || 0) !== bscPl ||
|
||||
(current.budgetReflct || 0) !== budgetReflct ||
|
||||
(current.thtiDsgn || 0) !== thtiDsgn ||
|
||||
(current.diff ?? 0) !== (next.diff ?? 0)
|
||||
) {
|
||||
newList[idx] = next;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges ? newList : list.map(withDiff);
|
||||
}
|
||||
+43
@@ -1,5 +1,22 @@
|
||||
import type { CklstTreeNode } from "@/entities/cklst";
|
||||
|
||||
export interface ChecklistItem {
|
||||
cklstSn: number;
|
||||
cklstArtclSn: number;
|
||||
cklstRvwSn: number;
|
||||
rvwStpComCd: string;
|
||||
title: string;
|
||||
content: string;
|
||||
bchckUseYn: "Y" | "N";
|
||||
treeLevel: number;
|
||||
}
|
||||
|
||||
export interface ChecklistTab {
|
||||
code: string;
|
||||
label: string;
|
||||
items: ChecklistItem[];
|
||||
}
|
||||
|
||||
interface CklstResultListItem {
|
||||
cklstSn: number;
|
||||
cklstArtclSn: number;
|
||||
@@ -68,6 +85,32 @@ function getOrderedSelectableNodes(
|
||||
);
|
||||
}
|
||||
|
||||
export function buildChecklistTabs(
|
||||
cklstTree: CklstTreeNode[],
|
||||
taskSeComCdArray: string[],
|
||||
taskCodeLabels: Record<string, string>,
|
||||
): ChecklistTab[] {
|
||||
if (cklstTree.length === 0) return [];
|
||||
|
||||
const grouped = groupCklstTreeByTaskSeComCd(cklstTree);
|
||||
const orderedCodes = taskSeComCdArray.filter((code) => grouped.has(code));
|
||||
|
||||
return orderedCodes.map((code) => ({
|
||||
code,
|
||||
label: taskCodeLabels[code] || code,
|
||||
items: orderCklstTreeNodes(grouped.get(code) ?? []).map((node) => ({
|
||||
cklstSn: node.cklstSn,
|
||||
cklstArtclSn: node.cklstArtclSn,
|
||||
cklstRvwSn: node.cklstRvwSn,
|
||||
rvwStpComCd: "LOCAL",
|
||||
title: node.cklstArtclNm,
|
||||
content: node.rvwCn,
|
||||
bchckUseYn: node.bchckUseYn,
|
||||
treeLevel: node.treeLevel,
|
||||
})),
|
||||
}));
|
||||
}
|
||||
|
||||
export function isSameCklstResultList(
|
||||
prev: CklstResultListItem[],
|
||||
next: CklstResultListItem[],
|
||||
+41
-28
@@ -6,13 +6,10 @@ import { Controller, useFormContext } from "react-hook-form";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { getDefaultFileKey, useTus } from "@/shared/lib";
|
||||
import { useTus } from "@/shared/lib";
|
||||
import type { AtflMngClientResponseDto, EsntlAtchFileMngTreeResponseDto } from "@/shared/model";
|
||||
import { attachService } from "@/entities/attach";
|
||||
import { useEsntlAtchFileMngTree } from "@/entities/esntl";
|
||||
import type {
|
||||
AtflMngClientResponseDto,
|
||||
EsntlAtchFileMngTreeResponseDto,
|
||||
} from "@/entities/instl-sncn";
|
||||
import {
|
||||
Button,
|
||||
Skeleton,
|
||||
@@ -24,11 +21,26 @@ import {
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import type { CnfmRegistFormData } from "../../lib/cnfm-regist-schema";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
import {
|
||||
atchFileGroupIdPath,
|
||||
createEtcUploadKey,
|
||||
createUploadKey,
|
||||
type FieldPrefix,
|
||||
isEtcFileKey,
|
||||
} from "../lib/attachments-form-utils";
|
||||
|
||||
import { SectionCollapsible } from "./section-collapsible";
|
||||
|
||||
interface AttachmentsFormData {
|
||||
esntlAtchFileList: Array<{
|
||||
esntlAtchFileId: string;
|
||||
atchFileGroupId: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
interface AttachmentsFormSectionProps {
|
||||
docSeComCd: string;
|
||||
fieldPrefix: FieldPrefix;
|
||||
initialEsntlFiles?: EsntlAtchFileMngTreeResponseDto[];
|
||||
initialEtcFiles?: AtflMngClientResponseDto[];
|
||||
}
|
||||
@@ -54,26 +66,13 @@ interface UploadMapping {
|
||||
file: File;
|
||||
}
|
||||
|
||||
const ETC_FILE_KEY_PREFIX = "etc::";
|
||||
|
||||
function createUploadKey(esntlAtchFileId: string, file: File) {
|
||||
return `${esntlAtchFileId}::${getDefaultFileKey(file)}`;
|
||||
}
|
||||
|
||||
function createEtcUploadKey(file: File) {
|
||||
return `${ETC_FILE_KEY_PREFIX}${getDefaultFileKey(file)}`;
|
||||
}
|
||||
|
||||
function isEtcFileKey(fileKey: string) {
|
||||
return fileKey.startsWith(ETC_FILE_KEY_PREFIX);
|
||||
}
|
||||
|
||||
function AttachmentsFormSection({
|
||||
docSeComCd,
|
||||
fieldPrefix,
|
||||
initialEsntlFiles,
|
||||
initialEtcFiles,
|
||||
}: AttachmentsFormSectionProps) {
|
||||
const { control, getValues, setValue } = useFormContext<CnfmRegistFormData>();
|
||||
const { control, getValues, setValue } = useFormContext<AttachmentsFormData>();
|
||||
const queryClient = useQueryClient();
|
||||
const [uploadedFiles, setUploadedFiles] = useState<Record<string, UploadedFileItem[]>>({});
|
||||
const [etcFiles, setEtcFiles] = useState<EtcFileItem[]>([]);
|
||||
@@ -82,6 +81,20 @@ function AttachmentsFormSection({
|
||||
const uploadMappingRef = useRef<Map<string, UploadMapping>>(new Map());
|
||||
const atflCdBySlotRef = useRef<Record<string, string>>({});
|
||||
|
||||
const atchGroupPath = atchFileGroupIdPath(fieldPrefix);
|
||||
|
||||
function getAtchFileGroupId(): string {
|
||||
return (getValues as (name: string) => string | undefined)(atchGroupPath) ?? "";
|
||||
}
|
||||
|
||||
function setAtchFileGroupId(value: string) {
|
||||
(setValue as (name: string, value: string, options?: { shouldDirty?: boolean }) => void)(
|
||||
atchGroupPath,
|
||||
value,
|
||||
{ shouldDirty: true },
|
||||
);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (initialFilesMappedRef.current) return;
|
||||
if (!initialEsntlFiles?.length && !initialEtcFiles?.length) return;
|
||||
@@ -129,8 +142,8 @@ function AttachmentsFormSection({
|
||||
if (!atflCd || !atflId) return;
|
||||
|
||||
if (isEtcFileKey(fileKey)) {
|
||||
if (!getValues("instlSncnMng.atchFileGroupId")) {
|
||||
setValue("instlSncnMng.atchFileGroupId", atflCd, { shouldDirty: true });
|
||||
if (!getAtchFileGroupId()) {
|
||||
setAtchFileGroupId(atflCd);
|
||||
}
|
||||
|
||||
setEtcFiles((prev) =>
|
||||
@@ -211,7 +224,7 @@ function AttachmentsFormSection({
|
||||
if (!files || files.length === 0) return;
|
||||
|
||||
const fileArray = Array.from(files);
|
||||
let etcAtflCd = getValues("instlSncnMng.atchFileGroupId") ?? "";
|
||||
let etcAtflCd = getAtchFileGroupId();
|
||||
|
||||
for (const file of fileArray) {
|
||||
const fileKey = createEtcUploadKey(file);
|
||||
@@ -226,7 +239,7 @@ function AttachmentsFormSection({
|
||||
|
||||
if (!etcAtflCd) {
|
||||
etcAtflCd = atflCd;
|
||||
setValue("instlSncnMng.atchFileGroupId", atflCd, { shouldDirty: true });
|
||||
setAtchFileGroupId(atflCd);
|
||||
}
|
||||
} catch {
|
||||
// onError callback handles cleanup
|
||||
@@ -253,7 +266,7 @@ function AttachmentsFormSection({
|
||||
setEtcFiles(nextFiles);
|
||||
|
||||
if (nextFiles.length === 0) {
|
||||
setValue("instlSncnMng.atchFileGroupId", "", { shouldDirty: true });
|
||||
setAtchFileGroupId("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,7 +387,7 @@ function AttachmentsFormSection({
|
||||
<TableBody>
|
||||
{essentialFiles.length === 0 ? (
|
||||
<TableRow>
|
||||
<TableCell colSpan={3} className="py-12 text-center text-muted-foreground">
|
||||
<TableCell colSpan={2} className="py-12 text-center text-muted-foreground">
|
||||
조회된 필수 첨부파일 항목이 없습니다.
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
+22
-43
@@ -16,52 +16,29 @@ import {
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import {
|
||||
calculateDiffPercent,
|
||||
type CostItemDef,
|
||||
recalculateBizCstTotals,
|
||||
} from "../../lib/business-cost-form-utils";
|
||||
import type { CnfmRegistFormData } from "../../lib/cnfm-regist-schema";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
import { buildAcntgCostItems, recalculateBizCstTotals } from "../lib/business-cost-form-utils";
|
||||
import { calcDiffPercent } from "../lib/format-utils";
|
||||
|
||||
interface BusinessCostItemDef extends CostItemDef {
|
||||
label: string;
|
||||
level: number;
|
||||
import { SectionCollapsible } from "./section-collapsible";
|
||||
|
||||
interface BusinessCostFormData {
|
||||
bizCstList: Array<{
|
||||
acntgSeCd: string;
|
||||
bscPlanAmt: number;
|
||||
bgtRfltAmt: number;
|
||||
tstmDesignAmt: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
type CostFieldKey = "bscPlanAmt" | "bgtRfltAmt" | "tstmDesignAmt";
|
||||
|
||||
function BusinessCostFormSection() {
|
||||
const { control, setValue, getValues } = useFormContext<CnfmRegistFormData>();
|
||||
const { control, setValue, getValues } = useFormContext<BusinessCostFormData>();
|
||||
const bizCstList = useWatch({ control, name: "bizCstList" }) ?? [];
|
||||
|
||||
const { data: acntgTree = [] } = useAcntgSeMngTree();
|
||||
|
||||
const costItems = useMemo<BusinessCostItemDef[]>(() => {
|
||||
if (acntgTree.length === 0) return [];
|
||||
|
||||
const childrenMap = new Map<string, string[]>();
|
||||
acntgTree.forEach((node) => {
|
||||
if (node.upAcntgSeCd) {
|
||||
const siblings = childrenMap.get(node.upAcntgSeCd) || [];
|
||||
siblings.push(node.acntgSeCd);
|
||||
childrenMap.set(node.upAcntgSeCd, siblings);
|
||||
}
|
||||
});
|
||||
|
||||
return acntgTree
|
||||
.filter((node) => node.useYn === "Y")
|
||||
.map((node) => {
|
||||
const children = childrenMap.get(node.acntgSeCd);
|
||||
return {
|
||||
code: node.acntgSeCd,
|
||||
label: node.acntgSeCdNm,
|
||||
level: node.treeLevel,
|
||||
readonly: Boolean(children && children.length > 0),
|
||||
children,
|
||||
};
|
||||
});
|
||||
}, [acntgTree]);
|
||||
const costItems = useMemo(() => buildAcntgCostItems(acntgTree), [acntgTree]);
|
||||
|
||||
useEffect(() => {
|
||||
if (costItems.length === 0) return;
|
||||
@@ -95,7 +72,7 @@ function BusinessCostFormSection() {
|
||||
if (costItems.length === 0) {
|
||||
return (
|
||||
<SectionCollapsible title="총사업비">
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-[8rem] rounded-xl" />
|
||||
<Skeleton className="h-[64rem] rounded-xl" />
|
||||
</div>
|
||||
@@ -130,13 +107,17 @@ function BusinessCostFormSection() {
|
||||
|
||||
const diff = (data.tstmDesignAmt || 0) - (data.bgtRfltAmt || 0);
|
||||
const paddingLeft = `${item.level * 1.6}rem`;
|
||||
const showSubIcon = item.level >= 3;
|
||||
const showSubIcon = item.level >= 2;
|
||||
|
||||
return (
|
||||
<TableRow key={item.code}>
|
||||
<TableHead className="text-left" style={{ paddingLeft }}>
|
||||
{showSubIcon && <span className="mr-1 text-gray-400">└</span>}
|
||||
{item.label}
|
||||
<div className="relative">
|
||||
{showSubIcon && (
|
||||
<span className="absolute -left-6 top-0 text-gray-400">└</span>
|
||||
)}
|
||||
{item.label}
|
||||
</div>
|
||||
</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
@@ -198,9 +179,7 @@ function BusinessCostFormSection() {
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-right">
|
||||
{calculateDiffPercent(diff, data.bgtRfltAmt || 0)}
|
||||
</div>
|
||||
<div className="text-right">{calcDiffPercent(diff, data.bgtRfltAmt || 0)}</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
+68
-44
@@ -1,12 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { Controller, useFormContext, useWatch } from "react-hook-form";
|
||||
|
||||
import { Field } from "@/shared/ui/field";
|
||||
import { useCnstpSeMngPage } from "@/entities/cnstp";
|
||||
import { useCnstpSeMngTree } from "@/entities/cnstp";
|
||||
import {
|
||||
Input,
|
||||
Skeleton,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
@@ -15,57 +16,68 @@ import {
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import type { CnfmRegistFormData } from "../../lib/cnfm-regist-schema";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
import { buildCnstpScaleItems, recalculateBzScaleTotals } from "../lib/business-scale-form-utils";
|
||||
|
||||
import { SectionCollapsible } from "./section-collapsible";
|
||||
|
||||
interface BusinessScaleFormData {
|
||||
bzScaleList: Array<{
|
||||
cnstpSeCd: string;
|
||||
bscPl: number;
|
||||
budgetReflct: number;
|
||||
thtiDsgn: number;
|
||||
diff?: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
type ScaleFieldKey = "bscPl" | "budgetReflct" | "thtiDsgn";
|
||||
|
||||
function BusinessScaleFormSection() {
|
||||
const { control, setValue, getValues } = useFormContext<CnfmRegistFormData>();
|
||||
const { control, setValue, getValues } = useFormContext<BusinessScaleFormData>();
|
||||
const bzScaleList = useWatch({ control, name: "bzScaleList" }) ?? [];
|
||||
|
||||
const { data: cnstpSeList } = useCnstpSeMngPage({ useYn: "Y" });
|
||||
const { data: cnstpTree = [] } = useCnstpSeMngTree();
|
||||
|
||||
const cnstpItems =
|
||||
cnstpSeList?.content?.map((item) => ({
|
||||
code: item.cnstpSeCd,
|
||||
label: item.cnstpSeCdNm,
|
||||
})) ?? [];
|
||||
const scaleItems = useMemo(() => buildCnstpScaleItems(cnstpTree), [cnstpTree]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!cnstpSeList?.content?.length) return;
|
||||
if (scaleItems.length === 0) return;
|
||||
|
||||
const existingMap = new Map(getValues("bzScaleList").map((item) => [item.cnstpSeCd, item]));
|
||||
|
||||
setValue(
|
||||
"bzScaleList",
|
||||
cnstpSeList.content.map((item) => {
|
||||
const existing = existingMap.get(item.cnstpSeCd);
|
||||
if (existing) return existing;
|
||||
const next = scaleItems.map((item) => {
|
||||
const existing = existingMap.get(item.code);
|
||||
if (existing) return existing;
|
||||
|
||||
return {
|
||||
cnstpSeCd: item.cnstpSeCd,
|
||||
bscPl: 0,
|
||||
budgetReflct: 0,
|
||||
thtiDsgn: 0,
|
||||
diff: 0,
|
||||
};
|
||||
}),
|
||||
);
|
||||
}, [cnstpSeList?.content, getValues, setValue]);
|
||||
return {
|
||||
cnstpSeCd: item.code,
|
||||
bscPl: 0,
|
||||
budgetReflct: 0,
|
||||
thtiDsgn: 0,
|
||||
diff: 0,
|
||||
};
|
||||
});
|
||||
|
||||
setValue("bzScaleList", recalculateBzScaleTotals(next, scaleItems));
|
||||
}, [scaleItems, getValues, setValue]);
|
||||
|
||||
function handleScaleChange(index: number, fieldKey: ScaleFieldKey, value: string) {
|
||||
const numValue = Number(value) || 0;
|
||||
const list = getValues("bzScaleList");
|
||||
const updated = { ...list[index], [fieldKey]: numValue };
|
||||
const draft = [...getValues("bzScaleList")];
|
||||
draft[index] = { ...draft[index], [fieldKey]: numValue };
|
||||
const next = recalculateBzScaleTotals(draft, scaleItems);
|
||||
setValue("bzScaleList", next, { shouldDirty: true });
|
||||
}
|
||||
|
||||
if (fieldKey === "budgetReflct" || fieldKey === "thtiDsgn") {
|
||||
updated.diff = updated.thtiDsgn - updated.budgetReflct;
|
||||
}
|
||||
|
||||
const newList = [...list];
|
||||
newList[index] = updated;
|
||||
setValue("bzScaleList", newList);
|
||||
if (scaleItems.length === 0) {
|
||||
return (
|
||||
<SectionCollapsible title="사업규모">
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-[8rem] rounded-xl" />
|
||||
<Skeleton className="h-[64rem] rounded-xl" />
|
||||
</div>
|
||||
</SectionCollapsible>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -82,13 +94,24 @@ function BusinessScaleFormSection() {
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{cnstpItems.map((item, idx) => {
|
||||
{scaleItems.map((item, idx) => {
|
||||
const data = bzScaleList[idx];
|
||||
if (!data) return null;
|
||||
|
||||
const diff = data.diff ?? 0;
|
||||
const paddingLeft = `${item.level * 1.6}rem`;
|
||||
const showSubIcon = item.level >= 2;
|
||||
|
||||
return (
|
||||
<TableRow key={item.code}>
|
||||
<TableHead className="text-left">{item.label}</TableHead>
|
||||
<TableHead className="text-left" style={{ paddingLeft }}>
|
||||
<div className="relative">
|
||||
{showSubIcon && (
|
||||
<span className="absolute -left-6 top-0 text-gray-400">└</span>
|
||||
)}
|
||||
{item.label}
|
||||
</div>
|
||||
</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name={`bzScaleList.${idx}.bscPl`}
|
||||
@@ -99,8 +122,9 @@ function BusinessScaleFormSection() {
|
||||
type="number"
|
||||
value={field.value || ""}
|
||||
onChange={(e) => handleScaleChange(idx, "bscPl", e.target.value)}
|
||||
readOnly={item.readonly}
|
||||
aria-invalid={fieldState.invalid}
|
||||
className="text-right"
|
||||
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
@@ -116,8 +140,9 @@ function BusinessScaleFormSection() {
|
||||
type="number"
|
||||
value={field.value || ""}
|
||||
onChange={(e) => handleScaleChange(idx, "budgetReflct", e.target.value)}
|
||||
readOnly={item.readonly}
|
||||
aria-invalid={fieldState.invalid}
|
||||
className="text-right"
|
||||
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
@@ -133,8 +158,9 @@ function BusinessScaleFormSection() {
|
||||
type="number"
|
||||
value={field.value || ""}
|
||||
onChange={(e) => handleScaleChange(idx, "thtiDsgn", e.target.value)}
|
||||
readOnly={item.readonly}
|
||||
aria-invalid={fieldState.invalid}
|
||||
className="text-right"
|
||||
className={`text-right ${item.readonly ? "bg-muted" : ""}`}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
@@ -142,9 +168,7 @@ function BusinessScaleFormSection() {
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<div className="text-right">
|
||||
{data.diff > 0
|
||||
? `+${data.diff.toLocaleString()}`
|
||||
: data.diff.toLocaleString()}
|
||||
{diff > 0 ? `+${diff.toLocaleString()}` : diff.toLocaleString()}
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
+26
-52
@@ -25,36 +25,33 @@ import {
|
||||
TabsTrigger,
|
||||
} from "@common/components";
|
||||
|
||||
import { orderCklstTreeNodes, syncCklstResultListFromTree } from "../../lib/checklist-form-utils";
|
||||
import type { CnfmRegistFormData } from "../../lib/cnfm-regist-schema";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
import { buildChecklistTabs, syncCklstResultListFromTree } from "../lib/checklist-form-utils";
|
||||
|
||||
interface ChecklistFormSectionProps {
|
||||
docSeComCd: string;
|
||||
}
|
||||
import { SectionCollapsible } from "./section-collapsible";
|
||||
|
||||
interface ChecklistItem {
|
||||
type FieldPrefix = "fnrsCnsltnMng" | "instlSncnMng";
|
||||
|
||||
interface CklstResultListItem {
|
||||
cklstSn: number;
|
||||
cklstArtclSn: number;
|
||||
cklstRvwSn: number;
|
||||
rvwStpComCd: string;
|
||||
title: string;
|
||||
content: string;
|
||||
bchckUseYn: "Y" | "N";
|
||||
treeLevel: number;
|
||||
selected: "Y" | "N" | null;
|
||||
picRvwCn?: string | null;
|
||||
}
|
||||
|
||||
interface ChecklistTab {
|
||||
code: string;
|
||||
label: string;
|
||||
items: ChecklistItem[];
|
||||
interface ChecklistFormSectionProps {
|
||||
docSeComCd: string;
|
||||
fieldPrefix: FieldPrefix;
|
||||
}
|
||||
|
||||
function ChecklistFormSection({ docSeComCd }: ChecklistFormSectionProps) {
|
||||
const { watch, setValue, control, getValues } = useFormContext<CnfmRegistFormData>();
|
||||
function ChecklistFormSection({ docSeComCd, fieldPrefix }: ChecklistFormSectionProps) {
|
||||
const { watch, setValue, control, getValues } = useFormContext();
|
||||
const [activeTab, setActiveTab] = useState("");
|
||||
const taskSeComCdArray = watch("instlSncnMng.taskSeComCd");
|
||||
const cklstResultList = useWatch({ control, name: "cklstResultList" }) ?? [];
|
||||
const taskSeComCd = watch(`${fieldPrefix}.taskSeComCd`) as string[] | undefined;
|
||||
const taskSeComCdArray = useMemo(() => taskSeComCd ?? [], [taskSeComCd]);
|
||||
const cklstResultList =
|
||||
(useWatch({ control, name: "cklstResultList" }) as CklstResultListItem[] | undefined) ?? [];
|
||||
|
||||
const cklstRvwSnIndexMap = useMemo(
|
||||
() => new Map(cklstResultList.map((item, index) => [item.cklstRvwSn, index])),
|
||||
@@ -74,7 +71,7 @@ function ChecklistFormSection({ docSeComCd }: ChecklistFormSectionProps) {
|
||||
const { data: cklstTree = [], isLoading: isLoadingCklstTree } = useQuery({
|
||||
queryKey: ["cklstTree", docSeComCd, taskSeComCdArray],
|
||||
queryFn: async () => {
|
||||
const codes = (taskSeComCdArray || []).filter(Boolean);
|
||||
const codes = (taskSeComCdArray || []).filter(Boolean) as string[];
|
||||
if (codes.length === 0) return [];
|
||||
|
||||
const results = await Promise.all(
|
||||
@@ -100,34 +97,10 @@ function ChecklistFormSection({ docSeComCd }: ChecklistFormSectionProps) {
|
||||
staleTime: Infinity,
|
||||
});
|
||||
|
||||
const checklistTabs = useMemo((): ChecklistTab[] => {
|
||||
if (cklstTree.length === 0) return [];
|
||||
|
||||
const grouped = new Map<string, CklstTreeNode[]>();
|
||||
cklstTree.forEach((node) => {
|
||||
const taskCode = node.taskSeComCd ?? "";
|
||||
if (!taskCode) return;
|
||||
if (!grouped.has(taskCode)) grouped.set(taskCode, []);
|
||||
grouped.get(taskCode)!.push(node);
|
||||
});
|
||||
|
||||
const orderedCodes = (taskSeComCdArray || []).filter((code) => grouped.has(code));
|
||||
|
||||
return orderedCodes.map((code) => ({
|
||||
code,
|
||||
label: taskCodeLabels[code] || code,
|
||||
items: orderCklstTreeNodes(grouped.get(code)!).map((node) => ({
|
||||
cklstSn: node.cklstSn,
|
||||
cklstArtclSn: node.cklstArtclSn,
|
||||
cklstRvwSn: node.cklstRvwSn,
|
||||
rvwStpComCd: "LOCAL",
|
||||
title: node.cklstArtclNm,
|
||||
content: node.rvwCn,
|
||||
bchckUseYn: node.bchckUseYn,
|
||||
treeLevel: node.treeLevel,
|
||||
})),
|
||||
}));
|
||||
}, [cklstTree, taskCodeLabels, taskSeComCdArray]);
|
||||
const checklistTabs = useMemo(
|
||||
() => buildChecklistTabs(cklstTree, taskSeComCdArray, taskCodeLabels),
|
||||
[cklstTree, taskCodeLabels, taskSeComCdArray],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (isLoadingCklstTree) return;
|
||||
@@ -263,12 +236,13 @@ function ChecklistFormSection({ docSeComCd }: ChecklistFormSectionProps) {
|
||||
style={{
|
||||
paddingLeft: `${Math.max(0, item.treeLevel - 1) * 16 + 8}px`,
|
||||
}}
|
||||
colSpan={showRadios ? 0 : 2}
|
||||
>
|
||||
{item.treeLevel > 1 ? "└ " : ""}
|
||||
{item.content}
|
||||
</TableCell>
|
||||
<TableCell className={showRadios ? undefined : "bg-muted"}>
|
||||
{showRadios && resultIdx >= 0 ? (
|
||||
{showRadios && resultIdx >= 0 ? (
|
||||
<TableCell>
|
||||
<Controller
|
||||
name={`cklstResultList.${resultIdx}.selected`}
|
||||
control={control}
|
||||
@@ -319,8 +293,8 @@ function ChecklistFormSection({ docSeComCd }: ChecklistFormSectionProps) {
|
||||
</FieldSet>
|
||||
)}
|
||||
/>
|
||||
) : null}
|
||||
</TableCell>
|
||||
</TableCell>
|
||||
) : null}
|
||||
</TableRow>
|
||||
);
|
||||
})}
|
||||
+12
-8
@@ -4,13 +4,17 @@ import { Controller, useFormContext } from "react-hook-form";
|
||||
|
||||
import { useUserStore } from "@/shared/lib";
|
||||
import { Field, FieldError } from "@/shared/ui/field";
|
||||
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
|
||||
import { Input, Table, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
|
||||
|
||||
import type { CnfmRegistFormData } from "../../lib/cnfm-regist-schema";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
type FieldPrefix = "fnrsCnsltnMng" | "instlSncnMng";
|
||||
|
||||
function ContactInfoFormSection() {
|
||||
const { control } = useFormContext<CnfmRegistFormData>();
|
||||
interface ContactInfoFormSectionProps {
|
||||
fieldPrefix: FieldPrefix;
|
||||
}
|
||||
|
||||
function ContactInfoFormSection({ fieldPrefix }: ContactInfoFormSectionProps) {
|
||||
const { control } = useFormContext();
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
|
||||
return (
|
||||
@@ -39,7 +43,7 @@ function ContactInfoFormSection() {
|
||||
<TableHead>이름</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="instlSncnMng.dsgnrNm"
|
||||
name={`${fieldPrefix}.dsgnrNm`}
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
@@ -57,7 +61,7 @@ function ContactInfoFormSection() {
|
||||
<TableHead>연락처</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="instlSncnMng.dsgnrTelno"
|
||||
name={`${fieldPrefix}.dsgnrTelno`}
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
@@ -77,7 +81,7 @@ function ContactInfoFormSection() {
|
||||
<TableHead>소속</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="instlSncnMng.dsgnrOgdpNm"
|
||||
name={`${fieldPrefix}.dsgnrOgdpNm`}
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
@@ -95,7 +99,7 @@ function ContactInfoFormSection() {
|
||||
<TableHead>이메일</TableHead>
|
||||
<TableCell>
|
||||
<Controller
|
||||
name="instlSncnMng.dsgnrEmlAddr"
|
||||
name={`${fieldPrefix}.dsgnrEmlAddr`}
|
||||
control={control}
|
||||
render={({ field, fieldState }) => (
|
||||
<Field data-invalid={fieldState.invalid}>
|
||||
+6
-3
@@ -13,11 +13,14 @@ import {
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
import type { CnfmRegistFormData } from "../../lib/cnfm-regist-schema";
|
||||
import { SectionCollapsible } from "../components/section-collapsible";
|
||||
import { SectionCollapsible } from "./section-collapsible";
|
||||
|
||||
interface PrivacyConsentFormData {
|
||||
privacyConsent: "Y" | "N";
|
||||
}
|
||||
|
||||
function PrivacyConsentSection() {
|
||||
const { control } = useFormContext<CnfmRegistFormData>();
|
||||
const { control } = useFormContext<PrivacyConsentFormData>();
|
||||
|
||||
return (
|
||||
<SectionCollapsible title="개인정보 수집/이용 동의">
|
||||
+11
-3
@@ -24,11 +24,19 @@ interface TaskSePickerDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onConfirm: (selectedCodes: string[]) => void;
|
||||
title: string;
|
||||
codeUpCd?: string;
|
||||
}
|
||||
|
||||
function TaskSePickerDialog({ open, onOpenChange, onConfirm }: TaskSePickerDialogProps) {
|
||||
function TaskSePickerDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
onConfirm,
|
||||
title,
|
||||
codeUpCd,
|
||||
}: TaskSePickerDialogProps) {
|
||||
const [selectedCodes, setSelectedCodes] = useState<string[]>([]);
|
||||
const { data: taskOptions, isPending } = useCodeList("INSTL");
|
||||
const { data: taskOptions, isPending } = useCodeList(codeUpCd);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
@@ -49,7 +57,7 @@ function TaskSePickerDialog({ open, onOpenChange, onConfirm }: TaskSePickerDialo
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-[60rem]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>설치인가 신청</DialogTitle>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
{isPending ? (
|
||||
Reference in New Issue
Block a user