준설관리 개발완료
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
"use client";
|
||||
|
||||
import DredgingDetailPopupPage from "@/app/(with-base-layout)/oper/dredging/components/DredgingDetailPopupPage";
|
||||
|
||||
import type { DredgingRecord } from "@/app/(with-base-layout)/oper/dredging/lib/types";
|
||||
import type { WindowPopupContentProps } from "../model/types";
|
||||
|
||||
const getParam = (value: string | string[] | undefined) =>
|
||||
Array.isArray(value) ? (value[0] ?? "") : (value ?? "");
|
||||
|
||||
const getNumber = (value: string | string[] | undefined) => {
|
||||
const parsed = Number(getParam(value));
|
||||
return Number.isFinite(parsed) ? parsed : 0;
|
||||
};
|
||||
|
||||
const getNullableNumber = (value: string | string[] | undefined) => {
|
||||
const raw = getParam(value);
|
||||
if (!raw) return null;
|
||||
const parsed = Number(raw);
|
||||
return Number.isFinite(parsed) ? parsed : null;
|
||||
};
|
||||
|
||||
/** 목록 행의 직렬화된 값을 준설 상세 화면 모델로 복원한다. */
|
||||
export const buildDredgingPopupRecord = (
|
||||
searchParams: WindowPopupContentProps["searchParams"],
|
||||
): DredgingRecord => ({
|
||||
id: getParam(searchParams.id),
|
||||
dredgingJobSn: getParam(searchParams.dredgingJobSn),
|
||||
pipeFid: getParam(searchParams.pipeFid),
|
||||
mngInstCd: getParam(searchParams.mngInstCd),
|
||||
ctpv: getParam(searchParams.ctpv),
|
||||
sgg: getParam(searchParams.sgg),
|
||||
treatmentZone: getParam(searchParams.treatmentZone),
|
||||
fcltMngNo: getParam(searchParams.fcltMngNo),
|
||||
pipeDiameterMm: getNumber(searchParams.pipeDiameterMm),
|
||||
pipeLengthM: getNumber(searchParams.pipeLengthM),
|
||||
pipeMaterial: getParam(searchParams.pipeMaterial),
|
||||
installationYear: getNullableNumber(searchParams.installationYear),
|
||||
dredgingDate: getParam(searchParams.dredgingDate),
|
||||
photoCount: getNumber(searchParams.photoCount),
|
||||
registeredDate: getParam(searchParams.registeredDate),
|
||||
longitude: getNumber(searchParams.longitude),
|
||||
latitude: getNumber(searchParams.latitude),
|
||||
snappedLongitude: getNumber(searchParams.snappedLongitude),
|
||||
snappedLatitude: getNumber(searchParams.snappedLatitude),
|
||||
registrationSource:
|
||||
getParam(searchParams.registrationSource) === "MANUAL" ? "MANUAL" : "EXIF",
|
||||
matchDistanceMeters: getNumber(searchParams.matchDistanceMeters),
|
||||
isMock: getParam(searchParams.isMock) === "true",
|
||||
});
|
||||
|
||||
export default function DredgingDetailPopupContent({
|
||||
searchParams,
|
||||
}: WindowPopupContentProps) {
|
||||
return (
|
||||
<DredgingDetailPopupPage record={buildDredgingPopupRecord(searchParams)} />
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import DredgingDetailPopupPage from "@/app/(with-base-layout)/oper/dredging/components/DredgingDetailPopupPage";
|
||||
|
||||
import { postPopupMessage } from "../lib/popupMessage";
|
||||
import { WINDOW_POPUP_MESSAGE_TYPE } from "../model/types";
|
||||
import type { WindowPopupContentProps } from "../model/types";
|
||||
import { buildDredgingPopupRecord } from "./DredgingDetailPopupContent";
|
||||
|
||||
/** 상세 화면과 같은 구조에서 선택 관로의 사진·위치·준설일자를 수정한다. */
|
||||
export default function DredgingEditPopupContent({
|
||||
searchParams,
|
||||
}: WindowPopupContentProps) {
|
||||
return (
|
||||
<DredgingDetailPopupPage
|
||||
mode="edit"
|
||||
record={buildDredgingPopupRecord(searchParams)}
|
||||
onUpdated={() => {
|
||||
postPopupMessage(WINDOW_POPUP_MESSAGE_TYPE.DREDGING_UPDATED, {
|
||||
dredgingJobSn: Array.isArray(searchParams.dredgingJobSn)
|
||||
? (searchParams.dredgingJobSn[0] ?? "")
|
||||
: (searchParams.dredgingJobSn ?? ""),
|
||||
});
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import DredgingRegisterPopupPage from "@/app/(with-base-layout)/oper/dredging/_components/DredgingRegisterPopupPage";
|
||||
import DredgingRegisterPopupPage from "@/app/(with-base-layout)/oper/dredging/components/DredgingRegisterPopupPage";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
/** 준설결과 등록 화면을 공통 WindowPopup 레이아웃에 연결한다. */
|
||||
|
||||
Reference in New Issue
Block a user