Merge remote-tracking branch 'origin/iipbs/as/dev'

This commit is contained in:
2026-07-22 11:36:12 +09:00
51 changed files with 3720 additions and 39 deletions
@@ -0,0 +1,10 @@
import { DesignEditPage } from "@/pages/design-cnstn";
interface PageProps {
params: Promise<{ id: string }>;
}
export default async function Page({ params }: PageProps) {
const { id } = await params;
return <DesignEditPage id={id} />;
}
@@ -0,0 +1,10 @@
import { DesignViewPage } from "@/pages/design-cnstn";
interface PageProps {
params: Promise<{ id: string }>;
}
export default async function Page({ params }: PageProps) {
const { id } = await params;
return <DesignViewPage id={id} />;
}
@@ -0,0 +1,3 @@
import { DesignListPage } from "@/pages/design-cnstn";
export default DesignListPage;
@@ -0,0 +1,12 @@
import { DesignRegistPage } from "@/pages/design-cnstn";
import { parseTaskSeComCdFromApi } from "@/pages/design-cnstn/lib/design-cnstn-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 <DesignRegistPage taskSeComCd={taskSeComCd.length ? taskSeComCd : undefined} />;
}
+2 -8
View File
@@ -18,13 +18,7 @@ interface CodeSelectProps extends React.ComponentPropsWithoutRef<typeof Select>
className?: string;
}
function CodeSelect({
upCd,
useYn,
placeholder = "선택",
className,
...props
}: CodeSelectProps) {
function CodeSelect({ upCd, useYn, placeholder = "선택", className, ...props }: CodeSelectProps) {
const listQuery = useCodeList(useYn ? undefined : upCd);
const listByUseYnQuery = useCodeListByUseYn(useYn ? upCd : undefined, useYn ?? "");
@@ -34,7 +28,7 @@ function CodeSelect({
return (
<Select {...props} disabled={props.disabled || isLoading}>
<SelectTrigger className={cn("w-[12rem]", className)}>
<SelectValue placeholder={isLoading ? "로딩 중…" : placeholder} />
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>
{codes?.map((item) => (
@@ -0,0 +1,58 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageResponse } from "@/shared/model";
import type {
DesignCnstnBizCstId,
DesignCnstnBizCstResponseDto,
DesignCnstnBizCstSaveRequestDto,
DesignCnstnBizCstSearchDto,
DesignCnstnBizCstService,
DesignCnstnBizCstUpdateRequestDto,
} from "../model/design-cnstn-biz-cst-interface";
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_CST;
async function findPage(
searchDto: DesignCnstnBizCstSearchDto,
): Promise<PageResponse<DesignCnstnBizCstResponseDto>> {
const response = await client.get<PageResponse<DesignCnstnBizCstResponseDto>>(BASE, {
params: searchDto,
});
return response.data;
}
async function findById(
designCnstnDocNo: string,
acntgSeCd: string,
): Promise<DesignCnstnBizCstResponseDto> {
const response = await client.get<DesignCnstnBizCstResponseDto>(
`${BASE}/${designCnstnDocNo}/${acntgSeCd}`,
);
return response.data;
}
async function save(body: DesignCnstnBizCstSaveRequestDto): Promise<DesignCnstnBizCstId> {
const response = await client.post<DesignCnstnBizCstId>(BASE, body);
return response.data;
}
async function update(
designCnstnDocNo: string,
acntgSeCd: string,
body: DesignCnstnBizCstUpdateRequestDto,
): Promise<void> {
await client.put<void>(`${BASE}/${designCnstnDocNo}/${acntgSeCd}`, body);
}
async function deleteDesignCnstnBizCst(designCnstnDocNo: string, acntgSeCd: string): Promise<void> {
await client.delete<void>(`${BASE}/${designCnstnDocNo}/${acntgSeCd}`);
}
export const designCnstnBizCstService = {
findPage,
findById,
save,
update,
delete: deleteDesignCnstnBizCst,
} satisfies DesignCnstnBizCstService;
@@ -0,0 +1,58 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageResponse } from "@/shared/model";
import type {
DesignCnstnBizSclId,
DesignCnstnBizSclResponseDto,
DesignCnstnBizSclSaveRequestDto,
DesignCnstnBizSclSearchDto,
DesignCnstnBizSclService,
DesignCnstnBizSclUpdateRequestDto,
} from "../model/design-cnstn-biz-scl-interface";
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_SCL;
async function findPage(
searchDto: DesignCnstnBizSclSearchDto,
): Promise<PageResponse<DesignCnstnBizSclResponseDto>> {
const response = await client.get<PageResponse<DesignCnstnBizSclResponseDto>>(BASE, {
params: searchDto,
});
return response.data;
}
async function findById(
designCnstnDocNo: string,
cnstpSeCd: string,
): Promise<DesignCnstnBizSclResponseDto> {
const response = await client.get<DesignCnstnBizSclResponseDto>(
`${BASE}/${designCnstnDocNo}/${cnstpSeCd}`,
);
return response.data;
}
async function save(body: DesignCnstnBizSclSaveRequestDto): Promise<DesignCnstnBizSclId> {
const response = await client.post<DesignCnstnBizSclId>(BASE, body);
return response.data;
}
async function update(
designCnstnDocNo: string,
cnstpSeCd: string,
body: DesignCnstnBizSclUpdateRequestDto,
): Promise<void> {
await client.put<void>(`${BASE}/${designCnstnDocNo}/${cnstpSeCd}`, body);
}
async function deleteDesignCnstnBizScl(designCnstnDocNo: string, cnstpSeCd: string): Promise<void> {
await client.delete<void>(`${BASE}/${designCnstnDocNo}/${cnstpSeCd}`);
}
export const designCnstnBizSclService = {
findPage,
findById,
save,
update,
delete: deleteDesignCnstnBizScl,
} satisfies DesignCnstnBizSclService;
@@ -0,0 +1,63 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageResponse } from "@/shared/model";
import type {
DesignCnstnEsntlAtchFileId,
DesignCnstnEsntlAtchFileResponseDto,
DesignCnstnEsntlAtchFileSaveRequestDto,
DesignCnstnEsntlAtchFileSearchDto,
DesignCnstnEsntlAtchFileService,
DesignCnstnEsntlAtchFileUpdateRequestDto,
} from "../model/design-cnstn-esntl-atch-file-interface";
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN_ESNTL_ATCH_FILE;
async function findPage(
searchDto: DesignCnstnEsntlAtchFileSearchDto,
): Promise<PageResponse<DesignCnstnEsntlAtchFileResponseDto>> {
const response = await client.get<PageResponse<DesignCnstnEsntlAtchFileResponseDto>>(BASE, {
params: searchDto,
});
return response.data;
}
async function findById(
designCnstnDocNo: string,
esntlAtchFileId: string,
): Promise<DesignCnstnEsntlAtchFileResponseDto> {
const response = await client.get<DesignCnstnEsntlAtchFileResponseDto>(
`${BASE}/${designCnstnDocNo}/${esntlAtchFileId}`,
);
return response.data;
}
async function save(
body: DesignCnstnEsntlAtchFileSaveRequestDto,
): Promise<DesignCnstnEsntlAtchFileId> {
const response = await client.post<DesignCnstnEsntlAtchFileId>(BASE, body);
return response.data;
}
async function update(
designCnstnDocNo: string,
esntlAtchFileId: string,
body: DesignCnstnEsntlAtchFileUpdateRequestDto,
): Promise<void> {
await client.put<void>(`${BASE}/${designCnstnDocNo}/${esntlAtchFileId}`, body);
}
async function deleteDesignCnstnEsntlAtchFile(
designCnstnDocNo: string,
esntlAtchFileId: string,
): Promise<void> {
await client.delete<void>(`${BASE}/${designCnstnDocNo}/${esntlAtchFileId}`);
}
export const designCnstnEsntlAtchFileService = {
findPage,
findById,
save,
update,
delete: deleteDesignCnstnEsntlAtchFile,
} satisfies DesignCnstnEsntlAtchFileService;
@@ -0,0 +1,61 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageResponse } from "@/shared/model";
import type {
DesignCnstnApplySaveRequestDto,
DesignCnstnMngDetResponseDto,
DesignCnstnMngResponseDto,
DesignCnstnMngSaveRequestDto,
DesignCnstnMngSearchDto,
DesignCnstnMngService,
DesignCnstnMngUpdateRequestDto,
} from "../model/design-cnstn-mng-interface";
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN;
async function findPage(
searchDto: DesignCnstnMngSearchDto,
): Promise<PageResponse<DesignCnstnMngResponseDto>> {
const response = await client.get<PageResponse<DesignCnstnMngResponseDto>>(BASE, {
params: searchDto,
});
return response.data;
}
async function findById(id: string): Promise<DesignCnstnMngDetResponseDto> {
const response = await client.get<DesignCnstnMngDetResponseDto>(`${BASE}/${id}`);
return response.data;
}
async function save(body: DesignCnstnMngSaveRequestDto): Promise<string> {
const response = await client.post<string>(BASE, body);
return response.data;
}
async function saveApply(body: DesignCnstnApplySaveRequestDto): Promise<string> {
const response = await client.post<string>(`${BASE}/save-apply`, body);
return response.data;
}
async function update(id: string, body: DesignCnstnMngUpdateRequestDto): Promise<void> {
await client.put<void>(`${BASE}/${id}`, body);
}
async function techReview(id: string, body: DesignCnstnApplySaveRequestDto): Promise<void> {
await client.post<void>(`${BASE}/${id}/tech-review`, body);
}
async function deleteDesignCnstnMng(id: string): Promise<void> {
await client.delete<void>(`${BASE}/${id}`);
}
export const designCnstnMngService = {
findPage,
findById,
save,
saveApply,
update,
techReview,
delete: deleteDesignCnstnMng,
} satisfies DesignCnstnMngService;
@@ -0,0 +1,61 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type { PageResponse } from "@/shared/model";
import type {
DesignCnstnRvwOpnnId,
DesignCnstnRvwOpnnResponseDto,
DesignCnstnRvwOpnnSaveRequestDto,
DesignCnstnRvwOpnnSearchDto,
DesignCnstnRvwOpnnService,
DesignCnstnRvwOpnnUpdateRequestDto,
} from "../model/design-cnstn-rvw-opnn-interface";
const BASE = ENDPOINT.AS_SERVICE.DESIGN_CNSTN_RVW_OPNN;
async function findPage(
searchDto: DesignCnstnRvwOpnnSearchDto,
): Promise<PageResponse<DesignCnstnRvwOpnnResponseDto>> {
const response = await client.get<PageResponse<DesignCnstnRvwOpnnResponseDto>>(BASE, {
params: searchDto,
});
return response.data;
}
async function findById(
designCnstnDocNo: string,
rvwOpnnSn: number,
): Promise<DesignCnstnRvwOpnnResponseDto> {
const response = await client.get<DesignCnstnRvwOpnnResponseDto>(
`${BASE}/${designCnstnDocNo}/${rvwOpnnSn}`,
);
return response.data;
}
async function save(body: DesignCnstnRvwOpnnSaveRequestDto): Promise<DesignCnstnRvwOpnnId> {
const response = await client.post<DesignCnstnRvwOpnnId>(BASE, body);
return response.data;
}
async function update(
designCnstnDocNo: string,
rvwOpnnSn: number,
body: DesignCnstnRvwOpnnUpdateRequestDto,
): Promise<void> {
await client.put<void>(`${BASE}/${designCnstnDocNo}/${rvwOpnnSn}`, body);
}
async function deleteDesignCnstnRvwOpnn(
designCnstnDocNo: string,
rvwOpnnSn: number,
): Promise<void> {
await client.delete<void>(`${BASE}/${designCnstnDocNo}/${rvwOpnnSn}`);
}
export const designCnstnRvwOpnnService = {
findPage,
findById,
save,
update,
delete: deleteDesignCnstnRvwOpnn,
} satisfies DesignCnstnRvwOpnnService;
@@ -0,0 +1,411 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { ENDPOINT } from "@/shared/config";
import type {
DesignCnstnBizCstSaveRequestDto,
DesignCnstnBizCstSearchDto,
DesignCnstnBizCstUpdateRequestDto,
} from "../model/design-cnstn-biz-cst-interface";
import type {
DesignCnstnBizSclSaveRequestDto,
DesignCnstnBizSclSearchDto,
DesignCnstnBizSclUpdateRequestDto,
} from "../model/design-cnstn-biz-scl-interface";
import type {
DesignCnstnEsntlAtchFileSaveRequestDto,
DesignCnstnEsntlAtchFileSearchDto,
DesignCnstnEsntlAtchFileUpdateRequestDto,
} from "../model/design-cnstn-esntl-atch-file-interface";
import type {
DesignCnstnApplySaveRequestDto,
DesignCnstnMngSaveRequestDto,
DesignCnstnMngSearchDto,
DesignCnstnMngUpdateRequestDto,
} from "../model/design-cnstn-mng-interface";
import type {
DesignCnstnRvwOpnnSaveRequestDto,
DesignCnstnRvwOpnnSearchDto,
DesignCnstnRvwOpnnUpdateRequestDto,
} from "../model/design-cnstn-rvw-opnn-interface";
import { designCnstnBizCstService } from "./design-cnstn-biz-cst-service";
import { designCnstnBizSclService } from "./design-cnstn-biz-scl-service";
import { designCnstnEsntlAtchFileService } from "./design-cnstn-esntl-atch-file-service";
import { designCnstnMngService } from "./design-cnstn-mng-service";
import { designCnstnRvwOpnnService } from "./design-cnstn-rvw-opnn-service";
export const designCnstnMngBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN] as const;
export const designCnstnBizCstBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_CST] as const;
export const designCnstnBizSclBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN_BIZ_SCL] as const;
export const designCnstnEsntlAtchFileBaseKey = [
ENDPOINT.AS_SERVICE.DESIGN_CNSTN_ESNTL_ATCH_FILE,
] as const;
export const designCnstnRvwOpnnBaseKey = [ENDPOINT.AS_SERVICE.DESIGN_CNSTN_RVW_OPNN] as const;
/* ─── DesignCnstnMng ─── */
export function useDesignCnstnMngPage(params: DesignCnstnMngSearchDto) {
return useQuery({
queryKey: [...designCnstnMngBaseKey, "findPage", params],
queryFn: () => designCnstnMngService.findPage(params),
});
}
export function useDesignCnstnMng(id: string | null | undefined) {
return useQuery({
queryKey: [...designCnstnMngBaseKey, "findById", id],
queryFn: () => designCnstnMngService.findById(id!),
enabled: Boolean(id),
});
}
export function useSaveDesignCnstnMng() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (body: DesignCnstnMngSaveRequestDto) => designCnstnMngService.save(body),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useSaveApplyDesignCnstnMng() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (body: DesignCnstnApplySaveRequestDto) => designCnstnMngService.saveApply(body),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useUpdateDesignCnstnMng() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({ id, body }: { id: string; body: DesignCnstnMngUpdateRequestDto }) =>
designCnstnMngService.update(id, body),
onSuccess: (_data, { id }) => {
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
queryClient.invalidateQueries({
queryKey: [...designCnstnMngBaseKey, "findById", id],
});
},
});
}
export function useTechReviewDesignCnstnMng() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({ id, body }: { id: string; body: DesignCnstnApplySaveRequestDto }) =>
designCnstnMngService.techReview(id, body),
onSuccess: (_data, { id }) => {
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
queryClient.invalidateQueries({
queryKey: [...designCnstnMngBaseKey, "findById", id],
});
},
});
}
export function useDeleteDesignCnstnMng() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (id: string) => designCnstnMngService.delete(id),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
/* ─── DesignCnstnBizCst ─── */
export function useDesignCnstnBizCstPage(params: DesignCnstnBizCstSearchDto) {
return useQuery({
queryKey: [...designCnstnBizCstBaseKey, "findPage", params],
queryFn: () => designCnstnBizCstService.findPage(params),
});
}
export function useDesignCnstnBizCst(
designCnstnDocNo: string | null | undefined,
acntgSeCd: string | null | undefined,
) {
return useQuery({
queryKey: [...designCnstnBizCstBaseKey, "findById", designCnstnDocNo, acntgSeCd],
queryFn: () => designCnstnBizCstService.findById(designCnstnDocNo!, acntgSeCd!),
enabled: Boolean(designCnstnDocNo && acntgSeCd),
});
}
export function useSaveDesignCnstnBizCst() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (body: DesignCnstnBizCstSaveRequestDto) => designCnstnBizCstService.save(body),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnBizCstBaseKey });
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useUpdateDesignCnstnBizCst() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
designCnstnDocNo,
acntgSeCd,
body,
}: {
designCnstnDocNo: string;
acntgSeCd: string;
body: DesignCnstnBizCstUpdateRequestDto;
}) => designCnstnBizCstService.update(designCnstnDocNo, acntgSeCd, body),
onSuccess: (_data, { designCnstnDocNo, acntgSeCd }) => {
queryClient.invalidateQueries({ queryKey: designCnstnBizCstBaseKey });
queryClient.invalidateQueries({
queryKey: [...designCnstnBizCstBaseKey, "findById", designCnstnDocNo, acntgSeCd],
});
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useDeleteDesignCnstnBizCst() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
designCnstnDocNo,
acntgSeCd,
}: {
designCnstnDocNo: string;
acntgSeCd: string;
}) => designCnstnBizCstService.delete(designCnstnDocNo, acntgSeCd),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnBizCstBaseKey });
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
/* ─── DesignCnstnBizScl ─── */
export function useDesignCnstnBizSclPage(params: DesignCnstnBizSclSearchDto) {
return useQuery({
queryKey: [...designCnstnBizSclBaseKey, "findPage", params],
queryFn: () => designCnstnBizSclService.findPage(params),
});
}
export function useDesignCnstnBizScl(
designCnstnDocNo: string | null | undefined,
cnstpSeCd: string | null | undefined,
) {
return useQuery({
queryKey: [...designCnstnBizSclBaseKey, "findById", designCnstnDocNo, cnstpSeCd],
queryFn: () => designCnstnBizSclService.findById(designCnstnDocNo!, cnstpSeCd!),
enabled: Boolean(designCnstnDocNo && cnstpSeCd),
});
}
export function useSaveDesignCnstnBizScl() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (body: DesignCnstnBizSclSaveRequestDto) => designCnstnBizSclService.save(body),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnBizSclBaseKey });
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useUpdateDesignCnstnBizScl() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
designCnstnDocNo,
cnstpSeCd,
body,
}: {
designCnstnDocNo: string;
cnstpSeCd: string;
body: DesignCnstnBizSclUpdateRequestDto;
}) => designCnstnBizSclService.update(designCnstnDocNo, cnstpSeCd, body),
onSuccess: (_data, { designCnstnDocNo, cnstpSeCd }) => {
queryClient.invalidateQueries({ queryKey: designCnstnBizSclBaseKey });
queryClient.invalidateQueries({
queryKey: [...designCnstnBizSclBaseKey, "findById", designCnstnDocNo, cnstpSeCd],
});
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useDeleteDesignCnstnBizScl() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
designCnstnDocNo,
cnstpSeCd,
}: {
designCnstnDocNo: string;
cnstpSeCd: string;
}) => designCnstnBizSclService.delete(designCnstnDocNo, cnstpSeCd),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnBizSclBaseKey });
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
/* ─── DesignCnstnEsntlAtchFile ─── */
export function useDesignCnstnEsntlAtchFilePage(params: DesignCnstnEsntlAtchFileSearchDto) {
return useQuery({
queryKey: [...designCnstnEsntlAtchFileBaseKey, "findPage", params],
queryFn: () => designCnstnEsntlAtchFileService.findPage(params),
});
}
export function useDesignCnstnEsntlAtchFile(
designCnstnDocNo: string | null | undefined,
esntlAtchFileId: string | null | undefined,
) {
return useQuery({
queryKey: [
...designCnstnEsntlAtchFileBaseKey,
"findById",
designCnstnDocNo,
esntlAtchFileId,
],
queryFn: () =>
designCnstnEsntlAtchFileService.findById(designCnstnDocNo!, esntlAtchFileId!),
enabled: Boolean(designCnstnDocNo && esntlAtchFileId),
});
}
export function useSaveDesignCnstnEsntlAtchFile() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (body: DesignCnstnEsntlAtchFileSaveRequestDto) =>
designCnstnEsntlAtchFileService.save(body),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileBaseKey });
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useUpdateDesignCnstnEsntlAtchFile() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
designCnstnDocNo,
esntlAtchFileId,
body,
}: {
designCnstnDocNo: string;
esntlAtchFileId: string;
body: DesignCnstnEsntlAtchFileUpdateRequestDto;
}) => designCnstnEsntlAtchFileService.update(designCnstnDocNo, esntlAtchFileId, body),
onSuccess: (_data, { designCnstnDocNo, esntlAtchFileId }) => {
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileBaseKey });
queryClient.invalidateQueries({
queryKey: [
...designCnstnEsntlAtchFileBaseKey,
"findById",
designCnstnDocNo,
esntlAtchFileId,
],
});
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useDeleteDesignCnstnEsntlAtchFile() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
designCnstnDocNo,
esntlAtchFileId,
}: {
designCnstnDocNo: string;
esntlAtchFileId: string;
}) => designCnstnEsntlAtchFileService.delete(designCnstnDocNo, esntlAtchFileId),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnEsntlAtchFileBaseKey });
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
/* ─── DesignCnstnRvwOpnn ─── */
export function useDesignCnstnRvwOpnnPage(params: DesignCnstnRvwOpnnSearchDto) {
return useQuery({
queryKey: [...designCnstnRvwOpnnBaseKey, "findPage", params],
queryFn: () => designCnstnRvwOpnnService.findPage(params),
});
}
export function useDesignCnstnRvwOpnn(
designCnstnDocNo: string | null | undefined,
rvwOpnnSn: number | null | undefined,
) {
return useQuery({
queryKey: [...designCnstnRvwOpnnBaseKey, "findById", designCnstnDocNo, rvwOpnnSn],
queryFn: () => designCnstnRvwOpnnService.findById(designCnstnDocNo!, rvwOpnnSn!),
enabled: Boolean(designCnstnDocNo && rvwOpnnSn != null),
});
}
export function useSaveDesignCnstnRvwOpnn() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (body: DesignCnstnRvwOpnnSaveRequestDto) => designCnstnRvwOpnnService.save(body),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnBaseKey });
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useUpdateDesignCnstnRvwOpnn() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
designCnstnDocNo,
rvwOpnnSn,
body,
}: {
designCnstnDocNo: string;
rvwOpnnSn: number;
body: DesignCnstnRvwOpnnUpdateRequestDto;
}) => designCnstnRvwOpnnService.update(designCnstnDocNo, rvwOpnnSn, body),
onSuccess: (_data, { designCnstnDocNo, rvwOpnnSn }) => {
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnBaseKey });
queryClient.invalidateQueries({
queryKey: [...designCnstnRvwOpnnBaseKey, "findById", designCnstnDocNo, rvwOpnnSn],
});
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
export function useDeleteDesignCnstnRvwOpnn() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: ({
designCnstnDocNo,
rvwOpnnSn,
}: {
designCnstnDocNo: string;
rvwOpnnSn: number;
}) => designCnstnRvwOpnnService.delete(designCnstnDocNo, rvwOpnnSn),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: designCnstnRvwOpnnBaseKey });
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
},
});
}
@@ -0,0 +1,88 @@
export { designCnstnBizCstService } from "./api/design-cnstn-biz-cst-service";
export { designCnstnBizSclService } from "./api/design-cnstn-biz-scl-service";
export { designCnstnEsntlAtchFileService } from "./api/design-cnstn-esntl-atch-file-service";
export { designCnstnMngService } from "./api/design-cnstn-mng-service";
export { designCnstnRvwOpnnService } from "./api/design-cnstn-rvw-opnn-service";
export {
designCnstnBizCstBaseKey,
designCnstnBizSclBaseKey,
designCnstnEsntlAtchFileBaseKey,
designCnstnMngBaseKey,
designCnstnRvwOpnnBaseKey,
useDeleteDesignCnstnBizCst,
useDeleteDesignCnstnBizScl,
useDeleteDesignCnstnEsntlAtchFile,
useDeleteDesignCnstnMng,
useDeleteDesignCnstnRvwOpnn,
useDesignCnstnBizCst,
useDesignCnstnBizCstPage,
useDesignCnstnBizScl,
useDesignCnstnBizSclPage,
useDesignCnstnEsntlAtchFile,
useDesignCnstnEsntlAtchFilePage,
useDesignCnstnMng,
useDesignCnstnMngPage,
useDesignCnstnRvwOpnn,
useDesignCnstnRvwOpnnPage,
useSaveApplyDesignCnstnMng,
useSaveDesignCnstnBizCst,
useSaveDesignCnstnBizScl,
useSaveDesignCnstnEsntlAtchFile,
useSaveDesignCnstnMng,
useSaveDesignCnstnRvwOpnn,
useTechReviewDesignCnstnMng,
useUpdateDesignCnstnBizCst,
useUpdateDesignCnstnBizScl,
useUpdateDesignCnstnEsntlAtchFile,
useUpdateDesignCnstnMng,
useUpdateDesignCnstnRvwOpnn,
} from "./api/queries";
export type {
DesignCnstnBizCstId,
DesignCnstnBizCstResponseDto,
DesignCnstnBizCstSaveRequestDto,
DesignCnstnBizCstSearchDto,
DesignCnstnBizCstService,
DesignCnstnBizCstUpdateRequestDto,
} from "./model/design-cnstn-biz-cst-interface";
export type {
DesignCnstnBizSclId,
DesignCnstnBizSclResponseDto,
DesignCnstnBizSclSaveRequestDto,
DesignCnstnBizSclSearchDto,
DesignCnstnBizSclService,
DesignCnstnBizSclUpdateRequestDto,
} from "./model/design-cnstn-biz-scl-interface";
export type {
DesignCnstnEsntlAtchFileId,
DesignCnstnEsntlAtchFileResponseDto,
DesignCnstnEsntlAtchFileSaveRequestDto,
DesignCnstnEsntlAtchFileSearchDto,
DesignCnstnEsntlAtchFileService,
DesignCnstnEsntlAtchFileUpdateRequestDto,
} from "./model/design-cnstn-esntl-atch-file-interface";
export type {
AtflMngClientResponseDto,
BizCstItem,
BizCstTreeDto,
BizSclTreeDto,
BzScaleItem,
DesignCnstnApplySaveRequestDto,
DesignCnstnMngDetResponseDto,
DesignCnstnMngResponseDto,
DesignCnstnMngSaveRequestDto,
DesignCnstnMngSearchDto,
DesignCnstnMngService,
DesignCnstnMngUpdateRequestDto,
DesignCnstnRvwOpnnResponseDto,
DesignCnstnRvwOpnnSaveRequestDto,
ElaprDocPrgrsClientResponseDto,
EsntlAtchFileItem,
EsntlAtchFileMngTreeResponseDto,
} from "./model/design-cnstn-mng-interface";
export type {
DesignCnstnRvwOpnnId,
DesignCnstnRvwOpnnSearchDto,
DesignCnstnRvwOpnnService,
DesignCnstnRvwOpnnUpdateRequestDto,
} from "./model/design-cnstn-rvw-opnn-interface";
@@ -0,0 +1,54 @@
import type { PageableParams, PageResponse } from "@/shared/model";
/** 백엔드 DesignCnstnBizCstId */
export interface DesignCnstnBizCstId {
designCnstnMng: string;
acntgSeCd: string;
}
/** 백엔드 DesignCnstnBizCstSaveRequestDto */
export interface DesignCnstnBizCstSaveRequestDto {
designCnstnDocNo: string;
acntgSeCd: string;
bscPlanAmt?: number;
bgtRfltAmt?: number;
tstmDesignAmt?: number;
}
/** 백엔드 DesignCnstnBizCstUpdateRequestDto */
export interface DesignCnstnBizCstUpdateRequestDto {
bscPlanAmt?: number;
bgtRfltAmt?: number;
tstmDesignAmt?: number;
}
/** 백엔드 DesignCnstnBizCstSearchDto + Pageable */
export interface DesignCnstnBizCstSearchDto extends PageableParams {
designCnstnDocNo?: string;
acntgSeCd?: string;
}
/** 백엔드 DesignCnstnBizCstResponseDto */
export interface DesignCnstnBizCstResponseDto {
designCnstnDocNo: string;
acntgSeCd: string;
bscPlanAmt?: number;
bgtRfltAmt?: number;
tstmDesignAmt?: number;
regDt?: string;
}
/** Controller public 메서드명·시그니처와 동일 */
export interface DesignCnstnBizCstService {
findPage(
searchDto: DesignCnstnBizCstSearchDto,
): Promise<PageResponse<DesignCnstnBizCstResponseDto>>;
findById(designCnstnDocNo: string, acntgSeCd: string): Promise<DesignCnstnBizCstResponseDto>;
save(body: DesignCnstnBizCstSaveRequestDto): Promise<DesignCnstnBizCstId>;
update(
designCnstnDocNo: string,
acntgSeCd: string,
body: DesignCnstnBizCstUpdateRequestDto,
): Promise<void>;
delete(designCnstnDocNo: string, acntgSeCd: string): Promise<void>;
}
@@ -0,0 +1,54 @@
import type { PageableParams, PageResponse } from "@/shared/model";
/** 백엔드 DesignCnstnBizSclId */
export interface DesignCnstnBizSclId {
designCnstnMng: string;
cnstpSeCd: string;
}
/** 백엔드 DesignCnstnBizSclSaveRequestDto */
export interface DesignCnstnBizSclSaveRequestDto {
designCnstnDocNo: string;
cnstpSeCd: string;
bscPlanQty?: number;
bgtRfltQty?: number;
tstmDesignQty?: number;
}
/** 백엔드 DesignCnstnBizSclUpdateRequestDto */
export interface DesignCnstnBizSclUpdateRequestDto {
bscPlanQty?: number;
bgtRfltQty?: number;
tstmDesignQty?: number;
}
/** 백엔드 DesignCnstnBizSclSearchDto + Pageable */
export interface DesignCnstnBizSclSearchDto extends PageableParams {
designCnstnDocNo?: string;
cnstpSeCd?: string;
}
/** 백엔드 DesignCnstnBizSclResponseDto */
export interface DesignCnstnBizSclResponseDto {
designCnstnDocNo: string;
cnstpSeCd: string;
bscPlanQty?: number;
bgtRfltQty?: number;
tstmDesignQty?: number;
regDt?: string;
}
/** Controller public 메서드명·시그니처와 동일 */
export interface DesignCnstnBizSclService {
findPage(
searchDto: DesignCnstnBizSclSearchDto,
): Promise<PageResponse<DesignCnstnBizSclResponseDto>>;
findById(designCnstnDocNo: string, cnstpSeCd: string): Promise<DesignCnstnBizSclResponseDto>;
save(body: DesignCnstnBizSclSaveRequestDto): Promise<DesignCnstnBizSclId>;
update(
designCnstnDocNo: string,
cnstpSeCd: string,
body: DesignCnstnBizSclUpdateRequestDto,
): Promise<void>;
delete(designCnstnDocNo: string, cnstpSeCd: string): Promise<void>;
}
@@ -0,0 +1,51 @@
import type { PageableParams, PageResponse } from "@/shared/model";
/** 백엔드 DesignCnstnEsntlAtchFileId */
export interface DesignCnstnEsntlAtchFileId {
designCnstnMng: string;
esntlAtchFileId: string;
}
/** 백엔드 DesignCnstnEsntlAtchFileSaveRequestDto */
export interface DesignCnstnEsntlAtchFileSaveRequestDto {
designCnstnDocNo: string;
esntlAtchFileId: string;
atchFileGroupId?: string;
}
/** 백엔드 DesignCnstnEsntlAtchFileUpdateRequestDto */
export interface DesignCnstnEsntlAtchFileUpdateRequestDto {
atchFileGroupId?: string;
}
/** 백엔드 DesignCnstnEsntlAtchFileSearchDto + Pageable */
export interface DesignCnstnEsntlAtchFileSearchDto extends PageableParams {
designCnstnDocNo?: string;
esntlAtchFileId?: string;
}
/** 백엔드 DesignCnstnEsntlAtchFileResponseDto */
export interface DesignCnstnEsntlAtchFileResponseDto {
designCnstnDocNo: string;
esntlAtchFileId: string;
atchFileGroupId?: string;
regDt?: string;
}
/** Controller public 메서드명·시그니처와 동일 */
export interface DesignCnstnEsntlAtchFileService {
findPage(
searchDto: DesignCnstnEsntlAtchFileSearchDto,
): Promise<PageResponse<DesignCnstnEsntlAtchFileResponseDto>>;
findById(
designCnstnDocNo: string,
esntlAtchFileId: string,
): Promise<DesignCnstnEsntlAtchFileResponseDto>;
save(body: DesignCnstnEsntlAtchFileSaveRequestDto): Promise<DesignCnstnEsntlAtchFileId>;
update(
designCnstnDocNo: string,
esntlAtchFileId: string,
body: DesignCnstnEsntlAtchFileUpdateRequestDto,
): Promise<void>;
delete(designCnstnDocNo: string, esntlAtchFileId: string): Promise<void>;
}
@@ -0,0 +1,124 @@
import type {
BizCstSaveBase,
BzScaleSaveBase,
EsntlAtchFileSaveBase,
PageableParams,
PageResponse,
PbadmsApplySaveHeader,
PbadmsMngDetResponseBase,
} from "@/shared/model";
import type {
DesignCnstnRvwOpnnResponseDto,
DesignCnstnRvwOpnnSaveRequestDto,
} from "./design-cnstn-rvw-opnn-interface";
export type {
DesignCnstnRvwOpnnResponseDto,
DesignCnstnRvwOpnnSaveRequestDto,
} from "./design-cnstn-rvw-opnn-interface";
export type {
AtflMngClientResponseDto,
BizCstTreeDto,
BizSclTreeDto,
ElaprDocPrgrsClientResponseDto,
EsntlAtchFileMngTreeResponseDto,
} from "@/shared/model";
/** 백엔드 DesignCnstnMngSaveRequestDto */
export interface DesignCnstnMngSaveRequestDto {
designCnstnDocNo?: string;
admdstCd?: string;
envoSeComCd?: string;
taskSeComCd?: 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;
}
/** 백엔드 DesignCnstnMngUpdateRequestDto */
export type DesignCnstnMngUpdateRequestDto = Omit<DesignCnstnMngSaveRequestDto, "designCnstnDocNo">;
/** 백엔드 DesignCnstnMngSearchDto + Pageable */
export interface DesignCnstnMngSearchDto extends PageableParams {
designCnstnDocNo?: string;
admdstCd?: string;
envoSeComCd?: string;
taskSeComCd?: 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;
}
interface DesignCnstnMngResponseExtension {
designCnstnDocNo: string;
envoSeCdNm?: string;
taskSeCdNm?: string;
prgrsSttsCdNm?: string;
regDt?: string;
rgtr?: string;
rgtrNm?: string;
mdfcnDt?: string;
sido?: string;
gugun?: string;
}
/** 백엔드 DesignCnstnMngResponseDto */
export type DesignCnstnMngResponseDto = Omit<DesignCnstnMngSaveRequestDto, "designCnstnDocNo"> &
DesignCnstnMngResponseExtension;
/** 백엔드 DesignCnstnApplySaveRequestDto.BzScaleItem */
export type BzScaleItem = BzScaleSaveBase;
/** 백엔드 DesignCnstnApplySaveRequestDto.BizCstItem */
export type BizCstItem = BizCstSaveBase;
/** 백엔드 DesignCnstnApplySaveRequestDto.EsntlAtchFileItem */
export type EsntlAtchFileItem = EsntlAtchFileSaveBase;
/** 백엔드 DesignCnstnMngDetResponseDto */
export type DesignCnstnMngDetResponseDto = PbadmsMngDetResponseBase<
DesignCnstnMngResponseDto,
DesignCnstnRvwOpnnResponseDto
>;
/** 백엔드 DesignCnstnApplySaveRequestDto */
export interface DesignCnstnApplySaveRequestDto extends PbadmsApplySaveHeader {
designCnstnMng: DesignCnstnMngSaveRequestDto;
bzScaleList?: BzScaleItem[];
bizCstList?: BizCstItem[];
esntlAtchFileList?: EsntlAtchFileItem[];
rvwOpnnList?: DesignCnstnRvwOpnnSaveRequestDto[];
}
/** Controller public 메서드명·시그니처와 동일 */
export interface DesignCnstnMngService {
findPage(searchDto: DesignCnstnMngSearchDto): Promise<PageResponse<DesignCnstnMngResponseDto>>;
findById(id: string): Promise<DesignCnstnMngDetResponseDto>;
save(body: DesignCnstnMngSaveRequestDto): Promise<string>;
saveApply(body: DesignCnstnApplySaveRequestDto): Promise<string>;
update(id: string, body: DesignCnstnMngUpdateRequestDto): Promise<void>;
techReview(id: string, body: DesignCnstnApplySaveRequestDto): Promise<void>;
delete(id: string): Promise<void>;
}
@@ -0,0 +1,59 @@
import type { PageableParams, PageResponse, RvwOpnnResponseExtension } from "@/shared/model";
/** 백엔드 DesignCnstnRvwOpnnId */
export interface DesignCnstnRvwOpnnId {
designCnstnMng: string;
rvwOpnnSn: number;
}
/** 백엔드 DesignCnstnRvwOpnnSaveRequestDto */
export interface DesignCnstnRvwOpnnSaveRequestDto {
designCnstnDocNo: string;
rvwOpnnSn?: number;
opnrSeComCd?: string;
opnrNm?: string;
rvwRsltCn?: string;
rvwRsltAnmlyYn?: string;
atchFileGroupId?: string;
}
/** 백엔드 DesignCnstnRvwOpnnUpdateRequestDto */
export interface DesignCnstnRvwOpnnUpdateRequestDto {
opnrSeComCd?: string;
opnrNm?: string;
rvwRsltCn?: string;
rvwRsltAnmlyYn?: string;
atchFileGroupId?: string;
}
/** 백엔드 DesignCnstnRvwOpnnSearchDto + Pageable */
export interface DesignCnstnRvwOpnnSearchDto extends PageableParams {
designCnstnDocNo?: string;
opnrNm?: string;
opnrSeComCd?: string;
rvwRsltCn?: string;
rvwRsltAnmlyYn?: string;
atchFileGroupId?: string;
}
/** 백엔드 DesignCnstnRvwOpnnResponseDto */
export type DesignCnstnRvwOpnnResponseDto = Partial<
Pick<DesignCnstnRvwOpnnSaveRequestDto, "designCnstnDocNo" | "rvwOpnnSn">
> &
Omit<DesignCnstnRvwOpnnSaveRequestDto, "designCnstnDocNo" | "rvwOpnnSn"> &
RvwOpnnResponseExtension;
/** Controller public 메서드명·시그니처와 동일 */
export interface DesignCnstnRvwOpnnService {
findPage(
searchDto: DesignCnstnRvwOpnnSearchDto,
): Promise<PageResponse<DesignCnstnRvwOpnnResponseDto>>;
findById(designCnstnDocNo: string, rvwOpnnSn: number): Promise<DesignCnstnRvwOpnnResponseDto>;
save(body: DesignCnstnRvwOpnnSaveRequestDto): Promise<DesignCnstnRvwOpnnId>;
update(
designCnstnDocNo: string,
rvwOpnnSn: number,
body: DesignCnstnRvwOpnnUpdateRequestDto,
): Promise<void>;
delete(designCnstnDocNo: string, rvwOpnnSn: number): Promise<void>;
}
+5
View File
@@ -0,0 +1,5 @@
export { DesignEditPage } from "./ui/design-edit-page";
export { DesignFormPage } from "./ui/design-form-page";
export { DesignListPage } from "./ui/design-list-page";
export { DesignRegistPage } from "./ui/design-regist-page";
export { DesignViewPage } from "./ui/design-view-page";
@@ -0,0 +1,118 @@
export const DESIGN_CNSTN_VIEW_BUTTON_ACTION = {
strg: "strg",
aply: "aply",
del: "del",
rqstRvw: "rqstRvw",
rvwStrg: "rvwStrg",
rvwCmptn: "rvwCmptn",
atrzAprv: "atrzAprv",
atrzRply: "atrzRply",
} as const;
export type DesignCnstnViewButtonAction =
(typeof DESIGN_CNSTN_VIEW_BUTTON_ACTION)[keyof typeof DESIGN_CNSTN_VIEW_BUTTON_ACTION];
const ROLE_STATUS_BUTTON_ACTIONS: Record<string, Record<string, DesignCnstnViewButtonAction[]>> = {
ROLE_USER05: {
"": [
DESIGN_CNSTN_VIEW_BUTTON_ACTION.strg,
DESIGN_CNSTN_VIEW_BUTTON_ACTION.aply,
DESIGN_CNSTN_VIEW_BUTTON_ACTION.del,
],
CV: [
DESIGN_CNSTN_VIEW_BUTTON_ACTION.strg,
DESIGN_CNSTN_VIEW_BUTTON_ACTION.aply,
DESIGN_CNSTN_VIEW_BUTTON_ACTION.del,
],
},
};
const ROLE_USER01_ATRZ_STATUS_CODES = ["CT", "CS"] as const;
const ROLE_USER01_ATRZ_STATUS_ACTIONS: Record<
string,
Record<string, DesignCnstnViewButtonAction[]>
> = {
CT: {
ATRZ01: [DESIGN_CNSTN_VIEW_BUTTON_ACTION.rqstRvw],
},
CS: {
ATRZ02: [DESIGN_CNSTN_VIEW_BUTTON_ACTION.rvwStrg, DESIGN_CNSTN_VIEW_BUTTON_ACTION.rvwCmptn],
ATRZ03: [DESIGN_CNSTN_VIEW_BUTTON_ACTION.atrzAprv],
ATRZ99: [DESIGN_CNSTN_VIEW_BUTTON_ACTION.atrzRply],
},
};
function resolveButtonConfigs(
actions: DesignCnstnViewButtonAction[],
): DesignCnstnViewButtonAction[] {
return actions.map((action) => DESIGN_CNSTN_VIEW_BUTTON_ACTION[action]);
}
interface GetButtonConfigsOptions {
hasPendingApprovalRequest?: boolean;
}
function resolveRoleUser01AtrzButtonActions(
prgrsSttsComCd: string,
atrzSeComCdList: string[],
options?: GetButtonConfigsOptions,
): DesignCnstnViewButtonAction[] {
if (prgrsSttsComCd === "CS" && options?.hasPendingApprovalRequest === false) {
return [];
}
const atrzStatusMap = ROLE_USER01_ATRZ_STATUS_ACTIONS[prgrsSttsComCd];
if (!atrzStatusMap || atrzSeComCdList.length === 0) return [];
const seen = new Set<DesignCnstnViewButtonAction>();
const actions: DesignCnstnViewButtonAction[] = [];
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[],
options?: GetButtonConfigsOptions,
): DesignCnstnViewButtonAction[] {
if (!dtlInstCd) return [];
if (needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd)) {
return resolveButtonConfigs(
resolveRoleUser01AtrzButtonActions(prgrsSttsComCd, atrzSeComCdList ?? [], options),
);
}
const statusMap = ROLE_STATUS_BUTTON_ACTIONS[dtlInstCd];
if (!statusMap) return [];
const actions = statusMap[prgrsSttsComCd];
if (!actions) return [];
return resolveButtonConfigs(actions);
}
@@ -0,0 +1,68 @@
import { z } from "zod";
export const designCnstnRegistSchema = z.object({
designCnstnMng: 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, "구분은 필수입니다"),
dsgnrNm: z.string().min(1, "설계자 이름은 필수입니다"),
dsgnrTelno: z
.string()
.min(1, "설계자 전화번호는 필수입니다")
.regex(/^[0-9-]+$/, "숫자와 하이픈(-)만 입력 가능합니다"),
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(),
designCnstnDocNo: z.string().optional(),
admdstCd: z.string().optional(),
envoSeComCd: 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(),
}),
),
esntlAtchFileList: z.array(
z.object({
esntlAtchFileId: z.string(),
atchFileGroupId: z.string(),
}),
),
privacyConsent: z.enum(["Y", "N"], {
required_error: "개인정보 수집/이용 동의는 필수입니다",
}),
});
export type DesignCnstnRegistFormData = z.infer<typeof designCnstnRegistSchema>;
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,97 @@
import type { IUserInfo } from "@/shared/store";
import type { DesignCnstnMngDetResponseDto } from "@/entities/design-cnstn";
import type { DesignCnstnRegistFormData } from "./design-cnstn-regist-schema";
import { parseTaskSeComCdFromApi } from "./design-cnstn-regist-schema";
function mapEsntlAtchFileList(esntlFileList: DesignCnstnMngDetResponseDto["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: DesignCnstnMngDetResponseDto): DesignCnstnRegistFormData {
const detDto = data.detDto;
if (!detDto) {
throw new Error("상세 정보(detDto)가 없습니다.");
}
const bizSclList = data.bizSclList ?? [];
return {
designCnstnMng: {
designCnstnDocNo: detDto.designCnstnDocNo,
bizNm: detDto.bizNm ?? "",
bizBgngYr: detDto.bizBgngYr ?? "",
bizEndYr: detDto.bizEndYr ?? "",
bizCn: detDto.bizCn ?? "",
taskSeComCd: parseTaskSeComCdFromApi(detDto.taskSeComCd),
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,
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,
})),
esntlAtchFileList: mapEsntlAtchFileList(data.esntlFileList),
privacyConsent: "Y",
};
}
export function getCreateDefaultValues(
userInfo: IUserInfo | null,
taskSeComCd?: string[],
): DesignCnstnRegistFormData {
return {
designCnstnMng: {
bizNm: "",
bizBgngYr: "",
bizEndYr: "",
bizCn: "",
taskSeComCd: taskSeComCd ?? [],
dsgnrNm: "",
dsgnrTelno: "",
dsgnrOgdpNm: "",
dsgnrEmlAddr: "",
aplcntNm: userInfo?.userName ?? "",
aplcntMblTelno: userInfo?.mphn ?? "",
aplcntOgdpNm: userInfo?.ogdpSeNm ?? "",
aplcntEmlAddr: userInfo?.email ?? "",
prgrsSttsComCd: "CV",
atchFileGroupId: "",
},
bzScaleList: [],
esntlAtchFileList: [],
privacyConsent: "N",
};
}
@@ -0,0 +1,94 @@
import type {
DesignCnstnMngDetResponseDto,
DesignCnstnRvwOpnnResponseDto,
DesignCnstnRvwOpnnSaveRequestDto,
} from "@/entities/design-cnstn";
export interface ReviewOpinionFormData {
rvwRsltCn: string;
rvwRsltAnmlyYn: "Y" | "N" | "";
atchFileGroupId: string;
opnrSeComCd: string;
rvwOpnnSn?: number;
}
export interface ReviewOpinionGetFormDataResult {
formData: ReviewOpinionFormData;
rvwList: DesignCnstnRvwOpnnResponseDto[];
}
function hasReviewOpinionContent(formData: ReviewOpinionFormData) {
return Boolean(formData.rvwRsltCn.trim() || formData.rvwRsltAnmlyYn || formData.atchFileGroupId);
}
function mapServerItemToSaveDto(
item: DesignCnstnRvwOpnnResponseDto,
designCnstnDocNo: string,
): DesignCnstnRvwOpnnSaveRequestDto | null {
if (item.rvwOpnnSn == null) return null;
return {
designCnstnDocNo,
rvwOpnnSn: item.rvwOpnnSn,
opnrSeComCd: item.opnrSeComCd,
opnrNm: item.opnrNm,
rvwRsltCn: item.rvwRsltCn,
rvwRsltAnmlyYn: item.rvwRsltAnmlyYn || undefined,
atchFileGroupId: item.atchFileGroupId || undefined,
};
}
function mapFormDataToSaveDto(
formData: ReviewOpinionFormData,
designCnstnDocNo: string,
opnrNm?: string,
): DesignCnstnRvwOpnnSaveRequestDto {
const base = {
designCnstnDocNo,
opnrSeComCd: formData.opnrSeComCd,
opnrNm: opnrNm ?? "",
rvwRsltCn: formData.rvwRsltCn,
rvwRsltAnmlyYn: formData.rvwRsltAnmlyYn || undefined,
atchFileGroupId: formData.atchFileGroupId || undefined,
};
if (formData.rvwOpnnSn != null) {
return { ...base, rvwOpnnSn: formData.rvwOpnnSn };
}
return base as DesignCnstnRvwOpnnSaveRequestDto;
}
export function toRvwOpnnSaveDto(
data: DesignCnstnMngDetResponseDto,
result: ReviewOpinionGetFormDataResult | null | undefined,
opnrNm?: string,
): DesignCnstnRvwOpnnSaveRequestDto[] | undefined {
if (!result || !data.detDto) return undefined;
const { formData, rvwList } = result;
const designCnstnDocNo = data.detDto.designCnstnDocNo;
const list: DesignCnstnRvwOpnnSaveRequestDto[] = rvwList
.map((item) => mapServerItemToSaveDto(item, designCnstnDocNo))
.filter((item): item is DesignCnstnRvwOpnnSaveRequestDto => item != null);
if (!hasReviewOpinionContent(formData)) {
return list.length > 0 ? list : undefined;
}
const formDto = mapFormDataToSaveDto(formData, designCnstnDocNo, opnrNm);
if (formData.rvwOpnnSn != null) {
const existingIndex = list.findIndex((item) => item.rvwOpnnSn === formData.rvwOpnnSn);
if (existingIndex >= 0) {
list[existingIndex] = formDto;
} else {
list.push(formDto);
}
} else {
list.push(formDto);
}
return list.length > 0 ? list : undefined;
}
@@ -0,0 +1,12 @@
import type { ReviewStepCode } from "../model/view-types";
export function getEditableReviewStep(
dtlInstCd?: string,
prgrsSttsComCd?: string,
): ReviewStepCode | undefined {
if (dtlInstCd === "ROLE_USER01" && prgrsSttsComCd === "CS") {
return "KECO";
}
return undefined;
}
@@ -0,0 +1,71 @@
import type {
BizSclTreeDto,
BzScaleItem,
DesignCnstnApplySaveRequestDto,
DesignCnstnMngDetResponseDto,
EsntlAtchFileItem,
EsntlAtchFileMngTreeResponseDto,
} from "@/entities/design-cnstn";
import type { ReviewStepCode } from "../model/view-types";
import { type ReviewOpinionGetFormDataResult, 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 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: DesignCnstnMngDetResponseDto,
prgrsSttsComCd: string,
): DesignCnstnApplySaveRequestDto {
const detDto = data.detDto;
if (!detDto) {
throw new Error("상세 정보(detDto)가 없습니다.");
}
return {
designCnstnMng: { ...detDto, prgrsSttsComCd },
bzScaleList: toBzScaleSaveDto(data.bizSclList ?? []),
esntlAtchFileList: toEsntlAtchFileSaveDto(data.esntlFileList ?? []),
};
}
export function buildTechReviewPayload(
data: DesignCnstnMngDetResponseDto,
prgrsSttsComCd: string,
techReViewSaveCd: string,
reviewStep: ReviewStepCode,
reviewOpinionFormData?: ReviewOpinionGetFormDataResult | null,
opnrNm?: string,
): DesignCnstnApplySaveRequestDto {
return {
...buildSavePayload(data, prgrsSttsComCd),
techReViewSaveCd,
rvwStpCd: reviewStep,
rvwOpnnList: toRvwOpnnSaveDto(data, reviewOpinionFormData, opnrNm),
};
}
@@ -0,0 +1,161 @@
"use client";
import { Fragment } from "react";
import { createColumnHelper } from "@tanstack/react-table";
import { dayjs } from "@/shared/lib";
import type { DesignCnstnMngResponseDto } from "@/entities/design-cnstn";
import { Badge } from "@common/components";
const columnHelper = createColumnHelper<DesignCnstnMngResponseDto>();
const MAIN_STEP_LABELS = {
save: "저장",
apply: "신청완료",
review: "설계자문 검토",
reply: "설계검토 회신",
} as const;
const REVIEW_STATUS_CODES = new Set(["CS", "CR"]);
type BadgeState = "completed" | "current" | "pending" | "action";
interface ProgressBadge {
label: string;
state: BadgeState;
}
function buildProgressBadges(prgrsSttsComCd: string, prgrsSttsCdNm: string): ProgressBadge[] {
const reviewLabel = prgrsSttsCdNm || MAIN_STEP_LABELS.review;
const replyLabel = prgrsSttsCdNm || MAIN_STEP_LABELS.reply;
if (prgrsSttsComCd === "CV") {
return [
{ label: MAIN_STEP_LABELS.save, state: "current" },
{ label: MAIN_STEP_LABELS.apply, state: "pending" },
{ label: MAIN_STEP_LABELS.review, state: "pending" },
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
];
}
if (prgrsSttsComCd === "CT") {
return [
{ label: MAIN_STEP_LABELS.save, state: "completed" },
{ label: MAIN_STEP_LABELS.apply, state: "current" },
{ label: MAIN_STEP_LABELS.review, state: "pending" },
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
];
}
if (REVIEW_STATUS_CODES.has(prgrsSttsComCd)) {
return [
{ label: MAIN_STEP_LABELS.save, state: "completed" },
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
{ label: reviewLabel, state: "action" },
{ label: MAIN_STEP_LABELS.reply, state: "pending" },
];
}
if (prgrsSttsComCd === "CP" || prgrsSttsComCd === "EP") {
return [
{ label: MAIN_STEP_LABELS.save, state: "completed" },
{ label: MAIN_STEP_LABELS.apply, state: "completed" },
{ label: MAIN_STEP_LABELS.review, state: "completed" },
{ label: replyLabel, state: "action" },
];
}
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}`}>
{index > 0 && <span className="mx-2">&gt;</span>}
<Badge color={getBadgeColor(badge.state)}>{badge.label}</Badge>
</Fragment>
))}
</div>
);
}
export function createDesignCnstnColumns() {
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,15 @@
export type ReviewStepCode = "LOCAL" | "ENV" | "KECO";
export const REVIEW_STEP_LABELS: Record<ReviewStepCode, string> = {
LOCAL: "지자체",
ENV: "환경청",
KECO: "환경공단",
};
export const DESIGN_PROGRESS_ORDER = ["CV", "CT", "CS", "CR", "CP", "EP"] as const;
export const ROLE_TO_REVIEW_STEP: Record<string, ReviewStepCode> = {
ROLE_USER05: "LOCAL",
ROLE_USER03: "ENV",
ROLE_USER01: "KECO",
};
@@ -0,0 +1,391 @@
"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 { ENDPOINT } from "@/shared/config";
import { useAlertStore, useUserStore } from "@/shared/lib";
import {
type DesignCnstnApplySaveRequestDto,
designCnstnMngBaseKey,
type DesignCnstnMngDetResponseDto,
designCnstnMngService,
} from "@/entities/design-cnstn";
import {
buildElaprPrgrsSttsListFromAplnRows,
ElaprApprovalDialog,
type ElaprDmndSaveRequestDto,
elaprDmndService,
type ElaprTmpltPickerConfirmPayload,
ElaprTmpltPickerDialog,
hasCurrentUserPendingApprovalRequest,
useElaprDocPrgrsByDocNo,
} from "@/entities/elapr";
import { Button } from "@common/components";
import {
DESIGN_CNSTN_VIEW_BUTTON_ACTION,
type DesignCnstnViewButtonAction,
getButtonConfigs,
needsRoleUser01AtrzResolve,
} from "../../lib/button-config";
import { buildSavePayload, buildTechReviewPayload } from "../../lib/save-payload-utils";
import type { TechReviewOpinionSectionHandle } from "../sections/tech-review-opinion-section";
interface FloatingActionButtonsProps {
data: DesignCnstnMngDetResponseDto;
docSeComCd: string;
designCnstnDocNo: string;
prgrsSttsComCd: string;
dtlInstCd: string | undefined;
atrzSeComCdList: string[];
isRvwLoginUserLoading: boolean;
techReviewOpinionRef?: React.RefObject<TechReviewOpinionSectionHandle | null>;
opnrNm?: string;
}
type ActiveDialog = "elaprTmplt" | "elaprApproval" | null;
function FloatingActionButtons({
data,
docSeComCd,
designCnstnDocNo,
prgrsSttsComCd,
dtlInstCd,
atrzSeComCdList,
isRvwLoginUserLoading,
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?.designCnstnDocNo ?? designCnstnDocNo;
const isRegister = data.detDto?.rgtr === userInfo?.userUnqId;
const needsAtrzResolve = needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd);
const needsCsApprovalCheck = needsAtrzResolve && prgrsSttsComCd === "CS";
const { data: elaprDocPrgrsList = [], isLoading: isElaprDocPrgrsLoading } =
useElaprDocPrgrsByDocNo(needsCsApprovalCheck ? docNo : null);
const hasPendingApprovalRequest = hasCurrentUserPendingApprovalRequest(
elaprDocPrgrsList,
userInfo?.userUnqId,
);
const actionButtons = useMemo(() => {
if (needsAtrzResolve && isRvwLoginUserLoading) return [];
if (needsCsApprovalCheck && isElaprDocPrgrsLoading) return [];
return getButtonConfigs(dtlInstCd, prgrsSttsComCd, atrzSeComCdList, {
hasPendingApprovalRequest: needsCsApprovalCheck ? hasPendingApprovalRequest : undefined,
});
}, [
atrzSeComCdList,
dtlInstCd,
hasPendingApprovalRequest,
isElaprDocPrgrsLoading,
isRvwLoginUserLoading,
needsAtrzResolve,
needsCsApprovalCheck,
prgrsSttsComCd,
]);
const canEdit =
isRegister && actionButtons.some((button) => button === DESIGN_CNSTN_VIEW_BUTTON_ACTION.strg);
function handleGoToList() {
router.push("/design-cnstn");
}
function handleEdit() {
router.push(`/design-cnstn/${designCnstnDocNo}/edit`);
}
function shouldShowButton(action: DesignCnstnViewButtonAction) {
return actionButtons.some((button) => button === action);
}
async function executeAction({
action,
request,
successMessage,
}: {
action: DesignCnstnViewButtonAction;
request?: unknown;
successMessage?: string;
}) {
const handler = buttonActionHandlers[action];
if (!handler) return;
setIsProcessing(true);
try {
await handler({
request,
data,
onSuccess: () => {
if (successMessage) alert(successMessage);
queryClient.invalidateQueries({
queryKey: [...designCnstnMngBaseKey, "findById", designCnstnDocNo],
});
},
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: DesignCnstnApplySaveRequestDto = buildSavePayload(data, "CV");
await executeAction({
action: DESIGN_CNSTN_VIEW_BUTTON_ACTION.strg,
request: payload,
successMessage: "저장되었습니다.",
});
}
async function handleAplyClick() {
const payload: DesignCnstnApplySaveRequestDto = buildSavePayload(data, "CT");
await executeAction({
action: DESIGN_CNSTN_VIEW_BUTTON_ACTION.aply,
request: payload,
successMessage: "신청 완료되었습니다.",
});
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
}
async function handleDelClick() {
if (!(await confirm("삭제하시겠습니까?"))) return;
await executeAction({
action: DESIGN_CNSTN_VIEW_BUTTON_ACTION.del,
successMessage: "삭제되었습니다.",
});
router.push("/design-cnstn");
}
function getReviewOpinionFormData() {
return techReviewOpinionRef?.current?.getFormData() ?? null;
}
async function handleElaprTmpltConfirm({ aplnRows }: ElaprTmpltPickerConfirmPayload) {
const payload: ElaprDmndSaveRequestDto = {
elaprDocNo: docNo,
dmndTtl: data.detDto?.bizNm ?? "",
dmndCn: data.detDto?.bizCn ?? "",
elaprPrgrsSttsList: buildElaprPrgrsSttsListFromAplnRows(aplnRows),
};
await executeAction({
action: DESIGN_CNSTN_VIEW_BUTTON_ACTION.rqstRvw,
request: payload,
successMessage: "검토자지정이 완료되었습니다.",
});
await queryClient.invalidateQueries({
queryKey: [ENDPOINT.AS_ELAPR_SERVICE.ELAPR_DMND, "findDocPrgrsByDocNo", docNo],
});
}
async function handleRvwStrgClick() {
const payload = buildTechReviewPayload(
data,
"CS",
"SV",
"KECO",
getReviewOpinionFormData(),
opnrNm,
);
await executeAction({
action: DESIGN_CNSTN_VIEW_BUTTON_ACTION.rvwStrg,
request: payload,
successMessage: "저장되었습니다.",
});
techReviewOpinionRef?.current?.resetForm();
}
async function handleRvwCmptnClick() {
const payload = buildTechReviewPayload(
data,
"CS",
"CP",
"KECO",
getReviewOpinionFormData(),
opnrNm,
);
await executeAction({
action: DESIGN_CNSTN_VIEW_BUTTON_ACTION.rvwCmptn,
request: payload,
});
techReviewOpinionRef?.current?.resetForm();
setActiveDialog("elaprApproval");
}
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(DESIGN_CNSTN_VIEW_BUTTON_ACTION.strg) && (
<Button onClick={handleStrgClick} disabled={isProcessing}>
저장
</Button>
)}
{shouldShowButton(DESIGN_CNSTN_VIEW_BUTTON_ACTION.aply) && (
<Button color="green" onClick={handleAplyClick} disabled={isProcessing}>
신청완료
</Button>
)}
{shouldShowButton(DESIGN_CNSTN_VIEW_BUTTON_ACTION.del) && (
<Button color="red" onClick={handleDelClick} disabled={isProcessing}>
삭제
</Button>
)}
{shouldShowButton(DESIGN_CNSTN_VIEW_BUTTON_ACTION.rqstRvw) && (
<Button onClick={() => setActiveDialog("elaprTmplt")} disabled={isProcessing}>
검토자지정
</Button>
)}
{shouldShowButton(DESIGN_CNSTN_VIEW_BUTTON_ACTION.rvwStrg) && (
<Button onClick={handleRvwStrgClick} disabled={isProcessing}>
저장
</Button>
)}
{shouldShowButton(DESIGN_CNSTN_VIEW_BUTTON_ACTION.rvwCmptn) && (
<Button color="green" onClick={handleRvwCmptnClick} disabled={isProcessing}>
검토완료
</Button>
)}
{shouldShowButton(DESIGN_CNSTN_VIEW_BUTTON_ACTION.atrzAprv) && (
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isProcessing}>
결재(승인)
</Button>
)}
{shouldShowButton(DESIGN_CNSTN_VIEW_BUTTON_ACTION.atrzRply) && (
<Button onClick={() => setActiveDialog("elaprApproval")} disabled={isProcessing}>
결재(회신)
</Button>
)}
</div>
</div>
<ElaprTmpltPickerDialog
open={activeDialog === "elaprTmplt"}
onClose={() => setActiveDialog(null)}
docSeComCd={docSeComCd}
onConfirm={handleElaprTmpltConfirm}
/>
<ElaprApprovalDialog
open={activeDialog === "elaprApproval"}
onOpenChange={(open) => setActiveDialog(open ? "elaprApproval" : null)}
elaprDocNo={data.detDto?.designCnstnDocNo ?? designCnstnDocNo}
currentUserUuid={userInfo?.userUnqId ?? ""}
onSuccess={() => {
queryClient.invalidateQueries({
queryKey: [...designCnstnMngBaseKey, "findById", designCnstnDocNo],
});
}}
/>
</>
);
}
export { FloatingActionButtons };
async function handleSaveApply(
context: ActionHandlerContext<DesignCnstnApplySaveRequestDto>,
): Promise<void> {
try {
await designCnstnMngService.saveApply(context.request);
context.onSuccess?.();
} catch (error) {
context.onError?.(error as Error);
}
}
async function handleDel(context: ActionHandlerContext): Promise<void> {
try {
await designCnstnMngService.delete(context.data.detDto?.designCnstnDocNo ?? "");
context.onSuccess?.();
} catch (error) {
context.onError?.(error as Error);
}
}
async function handleTechReview(
context: ActionHandlerContext<DesignCnstnApplySaveRequestDto>,
): Promise<void> {
try {
await designCnstnMngService.techReview(
context.data.detDto?.designCnstnDocNo ?? "",
context.request,
);
context.onSuccess?.();
} catch (error) {
context.onError?.(error as Error);
}
}
async function handleRqstRvw(
context: ActionHandlerContext<ElaprDmndSaveRequestDto>,
): Promise<void> {
try {
await elaprDmndService.save(context.request);
context.onSuccess?.();
} catch (error) {
context.onError?.(error as Error);
}
}
async function handleAtrzAprv(context: ActionHandlerContext): Promise<void> {
context.onSuccess?.();
}
async function handleAtrzRply(context: ActionHandlerContext): Promise<void> {
context.onSuccess?.();
}
const buttonActionHandlers: Record<DesignCnstnViewButtonAction, ActionHandler> = {
strg: handleSaveApply,
aply: handleSaveApply,
del: handleDel,
rqstRvw: handleRqstRvw,
rvwStrg: handleTechReview,
rvwCmptn: handleTechReview,
atrzAprv: handleAtrzAprv,
atrzRply: handleAtrzRply,
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
interface ActionHandlerContext<T = any> {
request: T;
data: DesignCnstnMngDetResponseDto;
onSuccess?: () => void;
onError?: (error: Error) => void;
}
type ActionHandler = (context: ActionHandlerContext) => Promise<void>;
@@ -0,0 +1,41 @@
"use client";
import { useDesignCnstnMng } from "@/entities/design-cnstn";
import { Skeleton } from "@common/components";
import { DesignFormPage } from "./design-form-page";
interface DesignEditPageProps {
id: string;
}
function DesignEditPage({ id }: DesignEditPageProps) {
const { data, isLoading } = useDesignCnstnMng(id);
if (isLoading) {
return (
<div className="mt-6 space-y-6 px-4">
<div className="space-y-2">
<Skeleton className="h-[4rem] w-full" />
<Skeleton className="h-[20rem] w-full" />
</div>
<div className="space-y-2">
<Skeleton className="h-[4rem] w-full" />
<Skeleton className="h-[20rem] w-full" />
</div>
<div className="space-y-2">
<Skeleton className="h-[4rem] w-full" />
<Skeleton className="h-[20rem] w-full" />
</div>
</div>
);
}
if (!data?.detDto) {
return <div className="mt-6 text-[1.4rem]">상세 정보를 찾을 수 없습니다.</div>;
}
return <DesignFormPage id={id} mode="edit" initialData={data} />;
}
export { DesignEditPage };
@@ -0,0 +1,209 @@
"use client";
import { useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { useRouter } from "next/navigation";
import { useConfirm } from "@frontend-opensource/use-react-hooks";
import { zodResolver } from "@hookform/resolvers/zod";
import { useQueryClient } from "@tanstack/react-query";
import { useAlertStore, useUserStore } from "@/shared/lib";
import {
type DesignCnstnApplySaveRequestDto,
designCnstnMngBaseKey,
type DesignCnstnMngDetResponseDto,
designCnstnMngService,
} from "@/entities/design-cnstn";
import {
AttachmentsFormSection,
BusinessScaleFormSection,
ContactInfoFormSection,
PrivacyConsentSection,
} from "@/widgets/pbadms-sprt";
import { Button } from "@common/components";
import {
type DesignCnstnRegistFormData,
designCnstnRegistSchema,
formatTaskSeComCdForApi,
} from "../lib/design-cnstn-regist-schema";
import { getCreateDefaultValues, mapDetailToFormData } from "../lib/form-data-mapper";
import { BasicInfoFormSection } from "./sections/basic-info-form-section";
interface DesignFormPageProps {
id?: string;
mode: "create" | "edit";
initialData?: DesignCnstnMngDetResponseDto;
taskSeComCd?: string[];
}
function DesignFormPage({ id, mode, initialData, taskSeComCd }: DesignFormPageProps) {
const queryClient = useQueryClient();
const router = useRouter();
const { confirm } = useConfirm();
const userInfo = useUserStore((state) => state.userInfo);
const alert = useAlertStore((state) => state.setMessage);
const [isSubmitting, setIsSubmitting] = useState(false);
const isEditMode = mode === "edit";
const form = useForm<DesignCnstnRegistFormData>({
resolver: zodResolver(designCnstnRegistSchema),
mode: "onChange",
defaultValues:
isEditMode && initialData
? mapDetailToFormData(initialData)
: getCreateDefaultValues(userInfo, taskSeComCd),
});
function buildFormPayload(
data: DesignCnstnRegistFormData,
prgrsSttsComCd: "CV" | "CT",
): DesignCnstnApplySaveRequestDto {
const { taskSeComCd: formTaskSeComCd, ...designCnstnMngRest } = data.designCnstnMng;
return {
designCnstnMng: {
...designCnstnMngRest,
taskSeComCd: formatTaskSeComCdForApi(formTaskSeComCd),
designCnstnDocNo: isEditMode ? initialData?.detDto?.designCnstnDocNo : undefined,
prgrsSttsComCd,
},
bzScaleList: data.bzScaleList,
esntlAtchFileList: data.esntlAtchFileList,
};
}
async function submitForm(
data: DesignCnstnRegistFormData,
prgrsSttsComCd: "CV" | "CT",
): Promise<string | undefined> {
return designCnstnMngService.saveApply(buildFormPayload(data, prgrsSttsComCd));
}
async function onSave(data: DesignCnstnRegistFormData) {
if (isSubmitting) return;
try {
setIsSubmitting(true);
const designCnstnDocNo = await submitForm(data, "CV");
if (!designCnstnDocNo) return;
alert("저장되었습니다.");
router.push(`/design-cnstn/${designCnstnDocNo}/edit`);
if (isEditMode && id) {
queryClient.invalidateQueries({
queryKey: [...designCnstnMngBaseKey, "findById", id],
});
}
} catch (error) {
console.error("저장 실패:", error);
alert("저장 중 오류가 발생했습니다.");
} finally {
setIsSubmitting(false);
}
}
async function onApply(data: DesignCnstnRegistFormData) {
if (isSubmitting) return;
try {
setIsSubmitting(true);
const designCnstnDocNo = await submitForm(data, "CT");
if (!designCnstnDocNo) return;
alert("신청 완료되었습니다.");
router.push(`/design-cnstn/${designCnstnDocNo}`);
queryClient.invalidateQueries({ queryKey: designCnstnMngBaseKey });
if (id) {
queryClient.invalidateQueries({
queryKey: [...designCnstnMngBaseKey, "findById", id],
});
}
} catch (error) {
console.error("신청 실패:", error);
alert("신청 중 오류가 발생했습니다.");
} finally {
setIsSubmitting(false);
}
}
function handleApplyClick() {
form.handleSubmit(onApply)();
}
async function handleDelClick() {
if (isSubmitting) return;
const docNo = initialData?.detDto?.designCnstnDocNo;
if (!docNo) {
alert("문서번호가 없습니다.");
return;
}
if (!(await confirm("삭제하시겠습니까?"))) return;
try {
setIsSubmitting(true);
await designCnstnMngService.delete(docNo);
alert("삭제되었습니다.");
router.push("/design-cnstn");
} 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="designCnstnMng" />
<PrivacyConsentSection />
<BusinessScaleFormSection />
<AttachmentsFormSection
docSeComCd="CNFM"
fieldPrefix="designCnstnMng"
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"
type="button"
onClick={() => router.push("/design-cnstn")}
disabled={isSubmitting}
>
목록
</Button>
<Button type="submit" disabled={isSubmitting}>
저장
</Button>
{isEditMode && (
<>
<Button
color="green"
type="button"
onClick={handleApplyClick}
disabled={isSubmitting}
>
신청완료
</Button>
<Button color="red" type="button" onClick={handleDelClick} disabled={isSubmitting}>
삭제
</Button>
</>
)}
</div>
</div>
</form>
</FormProvider>
);
}
export { DesignFormPage };
@@ -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 { DesignCnstnMngSearchDto } from "@/entities/design-cnstn";
import {
Button,
Input,
Label,
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@common/components";
import { DesignList } from "./design-list";
const DEFAULT_PAGE_INDEX = 0;
const DEFAULT_PAGE_SIZE = 10;
const DEFAULT_SORT = "designCnstnDocNo,desc";
const EMPTY_ADST_LIST: CmCdAdstDstrComboResponseDto[] = [];
const DEFAULT_SEARCH_PARAMS: DesignCnstnMngSearchDto = {
bizNm: "",
taskSeComCd: "",
admdstCd: "",
page: DEFAULT_PAGE_INDEX,
size: DEFAULT_PAGE_SIZE,
sort: DEFAULT_SORT,
};
const ALL_SELECT_VALUE = "__ALL__";
function DesignListPage() {
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<DesignCnstnMngSearchDto>(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="CNFM" 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>
<DesignList
searchParams={searchParams}
pagination={pagination}
onPaginationChange={setPagination}
/>
</div>
);
}
export { DesignListPage };
@@ -0,0 +1,101 @@
"use client";
import { useMemo, useState } from "react";
import { useRouter } from "next/navigation";
import { getCoreRowModel, type PaginationState } from "@tanstack/react-table";
import { useDataTable, useUserStore } from "@/shared/lib";
import {
type DesignCnstnMngResponseDto,
type DesignCnstnMngSearchDto,
useDesignCnstnMngPage,
} from "@/entities/design-cnstn";
import { TaskSePickerDialog } from "@/widgets/pbadms-sprt";
import { Button } from "@common/components";
import { formatTaskSeComCdForApi } from "../lib/design-cnstn-regist-schema";
import { createDesignCnstnColumns } from "../model/columns";
interface DesignListProps {
searchParams: DesignCnstnMngSearchDto;
pagination: PaginationState;
onPaginationChange: (pagination: PaginationState) => void;
}
function DesignList({ searchParams, pagination, onPaginationChange }: DesignListProps) {
const userInfo = useUserStore((state) => state.userInfo);
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 ?? "designCnstnDocNo,desc",
}),
[searchParams, pagination],
);
const pageQuery = useDesignCnstnMngPage(queryParams);
const columns = useMemo(() => createDesignCnstnColumns(), []);
const handleRowClick = (row: DesignCnstnMngResponseDto) => {
const canEdit = row.prgrsSttsComCd === "CV" && row.rgtr === userInfo?.userUnqId;
router.push(
canEdit
? `/design-cnstn/${row.designCnstnDocNo}/edit`
: `/design-cnstn/${row.designCnstnDocNo}`,
);
};
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: handleRowClick,
},
});
const handleConfirmTaskSe = (selectedCodes: string[]) => {
setIsTaskSeDialogOpen(false);
router.push(`/design-cnstn/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="CNFM"
/>
</>
);
}
export { DesignList };
@@ -0,0 +1,11 @@
import { DesignFormPage } from "./design-form-page";
interface DesignRegistPageProps {
taskSeComCd?: string[];
}
function DesignRegistPage({ taskSeComCd }: DesignRegistPageProps) {
return <DesignFormPage mode="create" taskSeComCd={taskSeComCd} />;
}
export { DesignRegistPage };
@@ -0,0 +1,110 @@
"use client";
import { useMemo, useRef } from "react";
import { useUserStore } from "@/shared/lib";
import { useDesignCnstnMng } from "@/entities/design-cnstn";
import { ElaprDocPrgrsStatus } from "@/entities/elapr";
import { useRvwMnpwMngLoginUserList } from "@/entities/rvw-mnpw";
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
import { Skeleton } from "@common/components";
import { needsRoleUser01AtrzResolve } from "../lib/button-config";
import { getEditableReviewStep } from "../lib/review-step-utils";
import { FloatingActionButtons } from "./components/floating-action-buttons";
import { AttachmentsSection } from "./sections/attachments-section";
import { BasicInfoSection } from "./sections/basic-info-section";
import { BusinessScaleSection } from "./sections/business-scale-section";
import { ContactInfoSection } from "./sections/contact-info-section";
import {
TechReviewOpinionSection,
type TechReviewOpinionSectionHandle,
} from "./sections/tech-review-opinion-section";
interface DesignViewPageProps {
id: string;
}
function DesignViewPage({ id }: DesignViewPageProps) {
const userInfo = useUserStore((state) => state.userInfo);
const techReviewOpinionRef = useRef<TechReviewOpinionSectionHandle>(null);
const { data, isLoading, isError } = useDesignCnstnMng(id);
const prgrsSttsComCd = data?.detDto?.prgrsSttsComCd || "";
const needsAtrzResolve = needsRoleUser01AtrzResolve(userInfo?.dtlInstCd, prgrsSttsComCd);
const { data: rvwLoginUserData, isLoading: isRvwLoginUserLoading } = useRvwMnpwMngLoginUserList(
{},
{ enabled: needsAtrzResolve },
);
const atrzSeComCdList = useMemo(
() => rvwLoginUserData?.content?.map((item) => item.atrzSeComCd) ?? [],
[rvwLoginUserData],
);
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 esntlFileList = data.esntlFileList ?? [];
const etcFileList = data.etcFileList ?? [];
const rvwList = data.rvwList ?? [];
const editableReviewStep = getEditableReviewStep(
userInfo?.dtlInstCd,
detDto.prgrsSttsComCd || "",
);
return (
<div className="mt-6 space-y-4">
<BasicInfoSection det={detDto} />
<ContactInfoSection det={detDto} />
<SectionCollapsible title="결재현황">
<ElaprDocPrgrsStatus elaprDocNo={detDto.designCnstnDocNo} />
</SectionCollapsible>
<BusinessScaleSection bizSclList={bizSclList} />
<AttachmentsSection esntlFileList={esntlFileList} etcFileList={etcFileList} />
<TechReviewOpinionSection
ref={techReviewOpinionRef}
rvwList={rvwList}
editableReviewStep={editableReviewStep}
atrzSeComCdList={atrzSeComCdList}
isAtrzLoading={needsAtrzResolve && isRvwLoginUserLoading}
/>
<FloatingActionButtons
data={data}
docSeComCd="CNFM"
designCnstnDocNo={detDto.designCnstnDocNo}
prgrsSttsComCd={detDto.prgrsSttsComCd || ""}
dtlInstCd={userInfo?.dtlInstCd}
atrzSeComCdList={atrzSeComCdList}
isRvwLoginUserLoading={needsAtrzResolve && isRvwLoginUserLoading}
techReviewOpinionRef={techReviewOpinionRef}
opnrNm={userInfo?.userName}
/>
</div>
);
}
export { DesignViewPage };
@@ -0,0 +1,112 @@
"use client";
import { formatFileSize } from "@/shared/lib/file-utils";
import { useDownloadAttachmentByAtflCd } from "@/entities/attach";
import type {
AtflMngClientResponseDto,
EsntlAtchFileMngTreeResponseDto,
} from "@/entities/design-cnstn";
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 (
<>
{esntlFileList.length > 0 && (
<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.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,159 @@
"use client";
import { useState } from "react";
import { Controller, useFormContext } from "react-hook-form";
import { useUserStore } from "@/shared/lib";
import { Field, FieldError, FieldGroup } 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,
Input,
Table,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@common/components";
import type { DesignCnstnRegistFormData } from "../../lib/design-cnstn-regist-schema";
function BasicInfoFormSection() {
const userInfo = useUserStore((state) => state.userInfo);
const { control, watch, setValue } = useFormContext<DesignCnstnRegistFormData>();
const [isPickerOpen, setIsPickerOpen] = useState(false);
const taskSeComCd = watch("designCnstnMng.taskSeComCd");
const { data: taskOptions } = useCodeList("CNFM");
function handleBnsSelect(data: BnsApplyData) {
setValue("designCnstnMng.bizNm", data.bizNm);
setValue("designCnstnMng.bizBgngYr", data.bizBgngYr);
setValue("designCnstnMng.bizEndYr", data.bizEndYr);
setValue("designCnstnMng.bizCn", data.bizCn);
}
const taskSeComCdLabel =
taskSeComCd
.map((code) => findCodeLabel(taskOptions, code))
.filter(Boolean)
.join(", ") || "-";
return (
<SectionCollapsible title="기본 정보">
<Table variant="secondary">
<colgroup>
<col width="15%" />
<col width="35%" />
<col width="15%" />
<col width="35%" />
</colgroup>
<TableHeader>
<TableRow>
<TableHead className="w-[20rem]" data-required>
사업명
</TableHead>
<TableCell colSpan={3}>
<Controller
name="designCnstnMng.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="designCnstnMng.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="designCnstnMng.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="designCnstnMng.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>
</TableHeader>
</Table>
<BnsPickerDialog
open={isPickerOpen}
onClose={() => setIsPickerOpen(false)}
onSelect={handleBnsSelect}
/>
</SectionCollapsible>
);
}
export { BasicInfoFormSection };
@@ -0,0 +1,50 @@
"use client";
import type { DesignCnstnMngResponseDto } from "@/entities/design-cnstn";
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
import { Table, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
interface BasicInfoSectionProps {
det: DesignCnstnMngResponseDto;
}
function BasicInfoSection({ det }: BasicInfoSectionProps) {
return (
<SectionCollapsible title="기본 정보">
<Table variant="secondary">
<colgroup>
<col width="15%" />
<col width="35%" />
<col width="15%" />
<col width="35%" />
</colgroup>
<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 colSpan={3}>
{det.sido || "-"} {det.gugun || "-"}
</TableCell>
</TableRow>
</TableHeader>
</Table>
</SectionCollapsible>
);
}
export { BasicInfoSection };
@@ -0,0 +1,70 @@
"use client";
import type { BizSclTreeDto } from "@/entities/design-cnstn";
import { fmtNumber, indentPx, 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,56 @@
"use client";
import type { DesignCnstnMngResponseDto } from "@/entities/design-cnstn";
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
import { Table, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
interface ContactInfoSectionProps {
det: DesignCnstnMngResponseDto;
}
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,342 @@
"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 { DesignCnstnRvwOpnnResponseDto } from "@/entities/design-cnstn";
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
import {
Button,
RadioGroup,
RadioGroupItem,
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
Textarea,
} from "@common/components";
import type {
ReviewOpinionFormData,
ReviewOpinionGetFormDataResult,
} 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: DesignCnstnRvwOpnnResponseDto[];
editableReviewStep?: ReviewStepCode;
atrzSeComCdList?: string[];
isAtrzLoading?: boolean;
}
export interface TechReviewOpinionSectionHandle {
getFormData: () => ReviewOpinionGetFormDataResult | null;
resetForm: () => void;
}
interface TechReviewOpinionTableProps {
items: DesignCnstnRvwOpnnResponseDto[];
}
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,
atrzSeComCdList = [],
isAtrzLoading = false,
}, ref) {
const canWriteOpinion = !isAtrzLoading && atrzSeComCdList.includes("ATRZ02");
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 (!canWriteOpinion || !editableReviewStep || !hasFormContent(formData)) {
return null;
}
return {
formData: {
...formData,
opnrSeComCd: editableReviewStep,
},
rvwList,
};
},
resetForm: () => {
setFormData({
...EMPTY_FORM_DATA,
opnrSeComCd: editableReviewStep ?? "",
});
setUploadedFile(null);
},
}),
[canWriteOpinion, editableReviewStep, formData, rvwList],
);
const kecoRvwList = rvwList.filter((item) => item.opnrSeComCd === "KECO");
const hasKecoSection =
kecoRvwList.length > 0 || (editableReviewStep === "KECO" && canWriteOpinion);
if (!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 || !canWriteOpinion) return null;
const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false;
return (
<div className="space-y-2">
<h4 className="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 (
<SectionCollapsible title={`${REVIEW_STEP_LABELS.KECO} 검토의견`}>
<div className="space-y-6">
{kecoRvwList.length > 0 ? <TechReviewOpinionTable items={kecoRvwList} /> : null}
{renderOpinionForm("KECO")}
</div>
</SectionCollapsible>
);
});
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.designCnstnDocNo}_${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 };
@@ -26,7 +26,6 @@ import {
type FnrsCnsltnMngDetResponseDto,
fnrsCnsltnMngService,
} from "@/entities/fnrs-cnsltn";
import { useRvwMnpwMngLoginUserList } from "@/entities/rvw-mnpw";
import { SplmntDmndDialog, type SplmntDmndDialogConfirmPayload } from "@/widgets/pbadms-sprt";
import { Button } from "@common/components";
@@ -52,6 +51,8 @@ interface FloatingActionButtonsProps {
fnrsCnsltnDocNo: string;
prgrsSttsComCd: string;
dtlInstCd: string | undefined;
atrzSeComCdList: string[];
isRvwLoginUserLoading: boolean;
checklistFormState: ChecklistFormState;
techReviewOpinionRef?: React.RefObject<TechReviewOpinionSectionHandle | null>;
opnrNm?: string;
@@ -65,6 +66,8 @@ function FloatingActionButtons({
fnrsCnsltnDocNo,
prgrsSttsComCd,
dtlInstCd,
atrzSeComCdList,
isRvwLoginUserLoading,
checklistFormState,
techReviewOpinionRef,
opnrNm,
@@ -82,18 +85,9 @@ function FloatingActionButtons({
const needsAtrzResolve = needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd);
const needsTeApprovalCheck = needsAtrzResolve && prgrsSttsComCd === "TE";
const { data: rvwLoginUserData, isLoading: isRvwLoginUserLoading } = useRvwMnpwMngLoginUserList(
{},
{ enabled: needsAtrzResolve },
);
const { data: elaprDocPrgrsList = [], isLoading: isElaprDocPrgrsLoading } =
useElaprDocPrgrsByDocNo(needsTeApprovalCheck ? docNo : null);
const atrzSeComCdList = useMemo(
() => rvwLoginUserData?.content?.map((item) => item.atrzSeComCd) ?? [],
[rvwLoginUserData],
);
const hasPendingApprovalRequest = hasCurrentUserPendingApprovalRequest(
elaprDocPrgrsList,
userInfo?.userUnqId,
@@ -1,13 +1,15 @@
"use client";
import { useRef } from "react";
import { useMemo, useRef } from "react";
import { useUserStore } from "@/shared/lib";
import { ElaprDocPrgrsStatus } from "@/entities/elapr";
import { useFnrsCnsltnMng } from "@/entities/fnrs-cnsltn";
import { useRvwMnpwMngLoginUserList } from "@/entities/rvw-mnpw";
import { SectionCollapsible, SupplementDemandSection } from "@/widgets/pbadms-sprt";
import { Skeleton } from "@common/components";
import { needsRoleUser01AtrzResolve } from "../lib/button-config";
import { getEditableReviewStep } from "../lib/review-step-utils";
import { EMPTY_CKLST_RESULT_LIST, useChecklistFormState } from "../lib/use-checklist-form-state";
@@ -35,6 +37,17 @@ function FnrsViewPage({ id }: FnrsViewPageProps) {
const { formState: checklistFormState, setFormState: setChecklistFormState } =
useChecklistFormState(data?.cklstResultList ?? EMPTY_CKLST_RESULT_LIST);
const prgrsSttsComCd = data?.detDto?.prgrsSttsComCd || "";
const needsAtrzResolve = needsRoleUser01AtrzResolve(userInfo?.dtlInstCd, prgrsSttsComCd);
const { data: rvwLoginUserData, isLoading: isRvwLoginUserLoading } = useRvwMnpwMngLoginUserList(
{},
{ enabled: needsAtrzResolve },
);
const atrzSeComCdList = useMemo(
() => rvwLoginUserData?.content?.map((item) => item.atrzSeComCd) ?? [],
[rvwLoginUserData],
);
if (isLoading) {
return (
<div className="mt-6 flex flex-col gap-4 px-6">
@@ -96,6 +109,8 @@ function FnrsViewPage({ id }: FnrsViewPageProps) {
ref={techReviewOpinionRef}
rvwList={rvwList}
editableReviewStep={editableReviewStep}
atrzSeComCdList={atrzSeComCdList}
isAtrzLoading={needsAtrzResolve && isRvwLoginUserLoading}
/>
<FloatingActionButtons
data={data}
@@ -103,6 +118,8 @@ function FnrsViewPage({ id }: FnrsViewPageProps) {
fnrsCnsltnDocNo={detDto.fnrsCnsltnDocNo}
prgrsSttsComCd={detDto.prgrsSttsComCd || ""}
dtlInstCd={userInfo?.dtlInstCd}
atrzSeComCdList={atrzSeComCdList}
isRvwLoginUserLoading={needsAtrzResolve && isRvwLoginUserLoading}
checklistFormState={checklistFormState}
techReviewOpinionRef={techReviewOpinionRef}
opnrNm={userInfo?.userName}
@@ -12,6 +12,12 @@ function BasicInfoSection({ det }: BasicInfoSectionProps) {
return (
<SectionCollapsible title="기본 정보">
<Table variant="secondary">
<colgroup>
<col width="15%" />
<col width="35%" />
<col width="15%" />
<col width="35%" />
</colgroup>
<TableHeader>
<TableRow>
<TableHead>사업명</TableHead>
@@ -33,6 +33,8 @@ const RVW_OPNN_FILE_KEY_PREFIX = "rvw-opnn::";
interface TechReviewOpinionSectionProps {
rvwList: FnrsCnsltnRvwOpnnResponseDto[];
editableReviewStep?: ReviewStepCode;
atrzSeComCdList?: string[];
isAtrzLoading?: boolean;
}
export interface TechReviewOpinionSectionHandle {
@@ -69,7 +71,13 @@ function hasFormContent(formData: ReviewOpinionFormData) {
const TechReviewOpinionSection = forwardRef<
TechReviewOpinionSectionHandle,
TechReviewOpinionSectionProps
>(function TechReviewOpinionSection({ rvwList, editableReviewStep }, ref) {
>(function TechReviewOpinionSection({
rvwList,
editableReviewStep,
atrzSeComCdList = [],
isAtrzLoading = false,
}, ref) {
const canWriteKecoOpinion = !isAtrzLoading && atrzSeComCdList.includes("ATRZ02");
const [formData, setFormData] = useState<ReviewOpinionFormData>({
...EMPTY_FORM_DATA,
opnrSeComCd: editableReviewStep ?? "",
@@ -102,6 +110,9 @@ const TechReviewOpinionSection = forwardRef<
if (!editableReviewStep || !hasFormContent(formData)) {
return null;
}
if (editableReviewStep === "KECO" && !canWriteKecoOpinion) {
return null;
}
return {
formData: {
@@ -119,14 +130,15 @@ const TechReviewOpinionSection = forwardRef<
setUploadedFile(null);
},
}),
[editableReviewStep, formData, rvwList],
[canWriteKecoOpinion, editableReviewStep, formData, rvwList],
);
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";
const hasKecoSection =
kecoRvwList.length > 0 || (editableReviewStep === "KECO" && canWriteKecoOpinion);
if (!hasEnvSection && !hasKecoSection) {
return null;
@@ -170,6 +182,7 @@ const TechReviewOpinionSection = forwardRef<
function renderOpinionForm(reviewStep: ReviewStepCode) {
if (editableReviewStep !== reviewStep) return null;
if (reviewStep === "KECO" && !canWriteKecoOpinion) return null;
const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false;
@@ -26,7 +26,6 @@ import {
type InstlSncnMngDetResponse,
instlSncnService,
} from "@/entities/instl-sncn";
import { useRvwMnpwMngLoginUserList } from "@/entities/rvw-mnpw";
import { SplmntDmndDialog, type SplmntDmndDialogConfirmPayload } from "@/widgets/pbadms-sprt";
import { Button } from "@common/components";
@@ -52,6 +51,8 @@ interface FloatingActionButtonsProps {
instlSncnDocNo: string;
prgrsSttsComCd: string;
dtlInstCd: string | undefined;
atrzSeComCdList: string[];
isRvwLoginUserLoading: boolean;
checklistFormState: ChecklistFormState;
techReviewOpinionRef?: React.RefObject<TechReviewOpinionSectionHandle | null>;
opnrNm?: string;
@@ -65,6 +66,8 @@ function FloatingActionButtons({
instlSncnDocNo,
prgrsSttsComCd,
dtlInstCd,
atrzSeComCdList,
isRvwLoginUserLoading,
checklistFormState,
techReviewOpinionRef,
opnrNm,
@@ -82,18 +85,9 @@ function FloatingActionButtons({
const needsAtrzResolve = needsRoleUser01AtrzResolve(dtlInstCd, prgrsSttsComCd);
const needsTeApprovalCheck = needsAtrzResolve && prgrsSttsComCd === "TE";
const { data: rvwLoginUserData, isLoading: isRvwLoginUserLoading } = useRvwMnpwMngLoginUserList(
{},
{ enabled: needsAtrzResolve },
);
const { data: elaprDocPrgrsList = [], isLoading: isElaprDocPrgrsLoading } =
useElaprDocPrgrsByDocNo(needsTeApprovalCheck ? docNo : null);
const atrzSeComCdList = useMemo(
() => rvwLoginUserData?.content?.map((item) => item.atrzSeComCd) ?? [],
[rvwLoginUserData],
);
const hasPendingApprovalRequest = hasCurrentUserPendingApprovalRequest(
elaprDocPrgrsList,
userInfo?.userUnqId,
@@ -1,13 +1,15 @@
"use client";
import { useRef } from "react";
import { useMemo, useRef } from "react";
import { useUserStore } from "@/shared/lib";
import { ElaprDocPrgrsStatus } from "@/entities/elapr";
import { useInstlSncnDetail } from "@/entities/instl-sncn";
import { useRvwMnpwMngLoginUserList } from "@/entities/rvw-mnpw";
import { SectionCollapsible, SupplementDemandSection } from "@/widgets/pbadms-sprt";
import { Skeleton } from "@common/components";
import { needsRoleUser01AtrzResolve } from "../lib/button-config";
import { getEditableReviewStep } from "../lib/review-step-utils";
import { EMPTY_CKLST_RESULT_LIST, useChecklistFormState } from "../lib/use-checklist-form-state";
@@ -34,6 +36,17 @@ function InstlViewPage({ id }: InstlViewPageProps) {
const { formState: checklistFormState, setFormState: setChecklistFormState } =
useChecklistFormState(data?.cklstResultList ?? EMPTY_CKLST_RESULT_LIST);
const prgrsSttsComCd = data?.detDto?.prgrsSttsComCd || "";
const needsAtrzResolve = needsRoleUser01AtrzResolve(userInfo?.dtlInstCd, prgrsSttsComCd);
const { data: rvwLoginUserData, isLoading: isRvwLoginUserLoading } = useRvwMnpwMngLoginUserList(
{},
{ enabled: needsAtrzResolve },
);
const atrzSeComCdList = useMemo(
() => rvwLoginUserData?.content?.map((item) => item.atrzSeComCd) ?? [],
[rvwLoginUserData],
);
if (isLoading) {
return (
<div className="mt-6 flex flex-col gap-4 px-6">
@@ -94,6 +107,8 @@ function InstlViewPage({ id }: InstlViewPageProps) {
ref={techReviewOpinionRef}
rvwList={rvwList}
editableReviewStep={editableReviewStep}
atrzSeComCdList={atrzSeComCdList}
isAtrzLoading={needsAtrzResolve && isRvwLoginUserLoading}
/>
<SupplementDemandSection splmntDmndList={splmntDmndList} />
<FloatingActionButtons
@@ -102,6 +117,8 @@ function InstlViewPage({ id }: InstlViewPageProps) {
instlSncnDocNo={detDto.instlSncnDocNo}
prgrsSttsComCd={detDto.prgrsSttsComCd || ""}
dtlInstCd={userInfo?.dtlInstCd}
atrzSeComCdList={atrzSeComCdList}
isRvwLoginUserLoading={needsAtrzResolve && isRvwLoginUserLoading}
checklistFormState={checklistFormState}
techReviewOpinionRef={techReviewOpinionRef}
opnrNm={userInfo?.userName}
@@ -12,6 +12,12 @@ function BasicInfoSection({ det }: BasicInfoSectionProps) {
return (
<SectionCollapsible title="기본 정보">
<Table variant="secondary">
<colgroup>
<col width="15%" />
<col width="35%" />
<col width="15%" />
<col width="35%" />
</colgroup>
<TableHeader>
<TableRow>
<TableHead>사업명</TableHead>
@@ -29,6 +29,8 @@ const RVW_OPNN_FILE_KEY_PREFIX = "rvw-opnn::";
interface TechReviewOpinionSectionProps {
rvwList: InstlSncnRvwOpnnResponseDto[];
editableReviewStep?: ReviewStepCode;
atrzSeComCdList?: string[];
isAtrzLoading?: boolean;
}
export interface TechReviewOpinionSectionHandle {
@@ -65,7 +67,13 @@ function hasFormContent(formData: ReviewOpinionFormData) {
const TechReviewOpinionSection = forwardRef<
TechReviewOpinionSectionHandle,
TechReviewOpinionSectionProps
>(function TechReviewOpinionSection({ rvwList, editableReviewStep }, ref) {
>(function TechReviewOpinionSection({
rvwList,
editableReviewStep,
atrzSeComCdList = [],
isAtrzLoading = false,
}, ref) {
const canWriteKecoOpinion = !isAtrzLoading && atrzSeComCdList.includes("ATRZ02");
const [formData, setFormData] = useState<ReviewOpinionFormData>({
...EMPTY_FORM_DATA,
opnrSeComCd: editableReviewStep ?? "",
@@ -98,6 +106,9 @@ const TechReviewOpinionSection = forwardRef<
if (!editableReviewStep || !hasFormContent(formData)) {
return null;
}
if (editableReviewStep === "KECO" && !canWriteKecoOpinion) {
return null;
}
return {
...formData,
@@ -112,14 +123,15 @@ const TechReviewOpinionSection = forwardRef<
setUploadedFile(null);
},
}),
[editableReviewStep, formData],
[canWriteKecoOpinion, 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";
const hasKecoSection =
kecoRvwList.length > 0 || (editableReviewStep === "KECO" && canWriteKecoOpinion);
if (!hasEnvSection && !hasKecoSection) {
return null;
@@ -163,6 +175,7 @@ const TechReviewOpinionSection = forwardRef<
function renderOpinionForm(reviewStep: ReviewStepCode) {
if (editableReviewStep !== reviewStep) return null;
if (reviewStep === "KECO" && !canWriteKecoOpinion) return null;
const uploading = uploadedFile ? (isUploading[uploadedFile.fileKey] ?? false) : false;
+5
View File
@@ -17,6 +17,11 @@ export const ENDPOINT = {
ADSTDSTR: "/as-service/api/v1/adstdstr",
FNRS_CNSLTN_MNG: "/as-service/api/v1/fnrs-cnsltn-mng",
FNRS_SHAR_SE: "/as-service/api/v1/fnrs-shar-se-mng",
DESIGN_CNSTN: "/as-service/api/v1/design-cnstn",
DESIGN_CNSTN_BIZ_CST: "/as-service/api/v1/design-cnstn-biz-cst",
DESIGN_CNSTN_BIZ_SCL: "/as-service/api/v1/design-cnstn-biz-scl",
DESIGN_CNSTN_ESNTL_ATCH_FILE: "/as-service/api/v1/design-cnstn-esntl-atch-file",
DESIGN_CNSTN_RVW_OPNN: "/as-service/api/v1/design-cnstn-rvw-opnn",
},
USER_SERVICE: {
LOGIN: "/user-service/login",
@@ -1,6 +1,6 @@
import { getDefaultFileKey } from "@/shared/lib";
export type FieldPrefix = "fnrsCnsltnMng" | "instlSncnMng";
export type FieldPrefix = "fnrsCnsltnMng" | "instlSncnMng" | "designCnstnMng";
export const ETC_FILE_KEY_PREFIX = "etc::";
@@ -29,7 +29,7 @@ import { buildChecklistTabs, syncCklstResultListFromTree } from "../lib/checklis
import { SectionCollapsible } from "./section-collapsible";
type FieldPrefix = "fnrsCnsltnMng" | "instlSncnMng";
type FieldPrefix = "fnrsCnsltnMng" | "instlSncnMng" | "designCnstnMng";
interface CklstResultListItem {
cklstSn: number;
@@ -7,7 +7,7 @@ import { Field, FieldError } from "@/shared/ui/field";
import { SectionCollapsible } from "@/widgets/pbadms-sprt";
import { Input, Table, TableCell, TableHead, TableHeader, TableRow } from "@common/components";
type FieldPrefix = "fnrsCnsltnMng" | "instlSncnMng";
type FieldPrefix = "fnrsCnsltnMng" | "instlSncnMng" | "designCnstnMng";
interface ContactInfoFormSectionProps {
fieldPrefix: FieldPrefix;