잠재수요처 권한 추가

This commit is contained in:
jyha00
2025-07-24 11:04:41 +09:00
parent bcdefaa828
commit 1daa925019
2 changed files with 59 additions and 26 deletions
+13 -9
View File
@@ -33,7 +33,7 @@ import toast, { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
export default function LdrmntCoSttn() {
const { code, ldrmnt, ldrmntInit, ldrmntSearch, ldrmntUpdate } = useWrStore(
const { auth, code, ldrmnt, ldrmntInit, ldrmntSearch, ldrmntUpdate } = useWrStore(
(state) => state
);
const { ldrmntRes, excelList, ldrmntResCount } = ldrmnt;
@@ -47,6 +47,7 @@ export default function LdrmntCoSttn() {
const [resetPage, isResetPage] = useState(false);
const [isDownloadClicked, setIsDownloadClicked] = useState(false);
const { t } = useTranslation('base');
const { regAuthrtYn, mdfcnAuthrtYn } = auth;
const excelClick = useCallback(() => {
excelDownload(
@@ -224,6 +225,7 @@ export default function LdrmntCoSttn() {
onClick={() => {
setIsExcelOpen({ isModal: true });
}}
disabled={regAuthrtYn === 'N'}
>
엑셀등록
</Button>
@@ -269,14 +271,16 @@ export default function LdrmntCoSttn() {
setDetailModal({ ...detailModal, isOpen: !detailModal.isOpen })
}}
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<CoDetailModal formObj={detailModal.data} onFormSubmit={async (value) => {
const handleConfirm = async () => {
await ldrmntUpdate(value);
setDetailModal({ ...detailModal, isOpen: false });
ldrmntSearch(false, pageNation, '20', computeCityNm(), searchTxt || "");
};
confirmToast(t('isUpdateMsg'), handleConfirm);
}} />}
body={<CoDetailModal formObj={detailModal.data}
readonly={mdfcnAuthrtYn === 'N'}
onFormSubmit={async (value) => {
const handleConfirm = async () => {
await ldrmntUpdate(value);
setDetailModal({ ...detailModal, isOpen: false });
ldrmntSearch(false, pageNation, '20', computeCityNm(), searchTxt || "");
};
confirmToast(t('isUpdateMsg'), handleConfirm);
}} />}
/>
<UiModal
@@ -12,10 +12,13 @@ import { useForm } from "react-hook-form";
import type { z } from "zod";
export default function CoDetailModal({
formObj,onFormSubmit
formObj,
onFormSubmit,
readonly
}: {
formObj: any;
onFormSubmit:(values:customLdrmnt)=>void;
onFormSubmit: (values: customLdrmnt) => void;
readonly?: boolean;
}) {
const defaultValues: z.infer<typeof ldrmntZod> = ldrmntZod.parse({});
const form = useForm<z.infer<typeof ldrmntZod>>({
@@ -52,7 +55,11 @@ export default function CoDetailModal({
<h1 className="text-2xl font-medium text-label col-span-10">
잠재수요처 상세정보
</h1>
<Button type="submit" className="col-start-12 col-span-1" size={"sm"}>
<Button type="submit"
className="col-start-12 col-span-1"
size={"sm"}
disabled={readonly}
>
저장
</Button>
</div>
@@ -71,7 +78,6 @@ export default function CoDetailModal({
</FormUi>
)}
/>
<div className="grid grid-cols-4 gap-2 mt-4">
<div className="col-span-2">
<FormField
@@ -86,8 +92,9 @@ export default function CoDetailModal({
onChange={(e) => {
field.onChange(e.target.value);
}}
value={field.value ?? ""}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -108,13 +115,13 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-4 gap-2 mt-4">
<div className="col-span-2">
<FormField
@@ -131,6 +138,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -151,6 +159,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -173,6 +182,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -193,6 +203,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -213,6 +224,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -235,12 +247,12 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-2">
<FormField
control={form.control}
@@ -256,6 +268,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -278,6 +291,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -298,6 +312,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -318,14 +333,13 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={13}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-5 gap-2 mt-4">
<div className="col-span-1">
<FormField
@@ -344,6 +358,7 @@ export default function CoDetailModal({
value={formatCommaNumber(field.value)}
min={0}
maxLength={8}
readOnly={readonly}
/>
</FormUi>
)}
@@ -365,6 +380,7 @@ export default function CoDetailModal({
value={formatCommaNumber(field.value)}
min={0}
maxLength={8}
readOnly={readonly}
/>
</FormUi>
)}
@@ -386,6 +402,7 @@ export default function CoDetailModal({
value={formatCommaNumber(field.value)}
min={0}
maxLength={8}
readOnly={readonly}
/>
</FormUi>
)}
@@ -407,6 +424,7 @@ export default function CoDetailModal({
value={formatCommaNumber(field.value)}
min={0}
maxLength={8}
readOnly={readonly}
/>
</FormUi>
)}
@@ -434,7 +452,6 @@ export default function CoDetailModal({
/>
</div>
</div>
<div className="grid grid-cols-12 gap-2 mt-4">
<div className="col-span-4">
<FormField
@@ -451,6 +468,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -471,6 +489,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -491,13 +510,13 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-12 gap-2 mt-4">
<div className="col-span-4">
<FormField
@@ -514,6 +533,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -534,6 +554,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -554,14 +575,13 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-12 gap-2 mt-4">
<div className="col-span-4">
<FormField
@@ -578,6 +598,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -598,6 +619,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -618,14 +640,13 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-12 gap-2 mt-4">
<div className="col-span-4">
<FormField
@@ -642,6 +663,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -662,6 +684,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -682,13 +705,13 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-12 gap-2 mt-4">
<div className="col-span-4">
<FormField
@@ -705,6 +728,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -725,6 +749,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -745,6 +770,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -767,6 +793,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
@@ -787,13 +814,13 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={txtSize}
readOnly={readonly}
/>
</FormUi>
)}
/>
</div>
</div>
<div className="grid grid-cols-4 gap-2 mt-4">
<div className="col-span-2">
<FormField
@@ -810,6 +837,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={50}
readOnly={readonly}
/>
</FormUi>
)}
@@ -830,6 +858,7 @@ export default function CoDetailModal({
}}
value={field.value ?? ""}
maxLength={50}
readOnly={readonly}
/>
</FormUi>
)}