import { r as g, V as x, bk as L, d as O, f as k, aw as E, c as q, o as R, X as M, w as u, i as f, j as I, l as y, D as W, k as j, A as z, W as G, cZ as U, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as X } from "./BasicForm-dL_oCSPM.js";
import { m as Y, n as Z } from "./template-rpthWlT9.js";
import { u as H } from "./useForm-CKmgcynv.js";
let re;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const w = L(), { t } = x(), J = await Y(), K = await Z();
    function Q() {
        const n = g(!1), h = g(!1);
        return {
            schemas: [
                {
                    label: t("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.actionType"),
                    field: "correctActionType",
                    component: "NSelect",
                    componentProps: ()=>({
                            options: J,
                            disabled: n.value,
                            "label-field": w.getLocale === "en" ? "labelEn" : "label"
                        }),
                    rules: [
                        {
                            required: !0,
                            validator: (i, e)=>e != null,
                            message: `${t("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.description")} ${t("common.required")}`,
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    label: t("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.extensionRectifiedDate"),
                    field: "rectifyTime",
                    component: "NDatePicker",
                    componentProps: ()=>({
                            type: "date",
                            valueFormat: "yyyy-MM-dd",
                            disabled: n.value
                        }),
                    rules: [
                        {
                            required: !0,
                            validator: (i, e)=>e != null,
                            message: `${t("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.description")} ${t("common.required")}`,
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "block"
                },
                {
                    label: t("hsqe.nc.correctiveAction"),
                    field: "correctActionDescription",
                    component: "NInput",
                    componentProps: ()=>({
                            type: "textarea",
                            disabled: n.value,
                            maxlength: 100,
                            showCount: !0
                        }),
                    giProps: {
                        span: 3
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (i, e)=>e != null,
                            message: `${t("hsqe.nc.correctiveAction")} ${t("common.required")}`,
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    label: t("hsqe.nc.disposalSituation"),
                    field: "disposalSituation",
                    component: "NInput",
                    componentProps: ()=>({
                            type: "textarea",
                            disabled: n.value,
                            maxlength: 300,
                            showCount: !0
                        }),
                    giProps: {
                        span: 3
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (i, e)=>e != null,
                            message: `${t("hsqe.nc.disposalSituation")} ${t("common.required")}`,
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "preventiveLine",
                    slot: "preventiveLine",
                    giProps: {
                        span: 3
                    }
                },
                {
                    label: t("hsqe.nc.type"),
                    field: "preventActionMethod",
                    component: "NSelect",
                    componentProps: ()=>({
                            options: K,
                            disabled: n.value,
                            "label-field": w.getLocale === "en" ? "labelEn" : "label"
                        }),
                    rules: [
                        {
                            required: !0,
                            validator: (i, e)=>e != null,
                            message: `${t("hsqe.nc.type")} ${t("common.required")}`,
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    label: t("hsqe.auditInspection.vesselInspection.deficiency.description"),
                    field: "preventActionDescription",
                    component: "NInput",
                    componentProps: ()=>({
                            type: "textarea",
                            disabled: n.value,
                            maxlength: 300,
                            showCount: !0
                        }),
                    rules: [
                        {
                            required: !0,
                            validator: (i, e)=>e != null,
                            message: `${t("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.description")} ${t("common.required")}`,
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ],
                    giProps: {
                        span: 3
                    }
                },
                {
                    field: "id",
                    component: "NInput",
                    hidden: !0
                }
            ],
            methods: {
                setReadOnly: (i)=>{
                    n.value = i;
                },
                setReviewReadOnly: (i)=>{
                    h.value = i;
                }
            }
        };
    }
    let ee, te;
    ee = {
        class: "border-b border-[#E2E8F0E6] w-full"
    };
    te = {
        class: "text-[clamp(1.1rem,1.5vw,1.25rem)] font-medium text-slate-700 text-left pb-[12px]"
    };
    re = O({
        __name: "index",
        props: {
            btnsDisabled: {
                type: Object,
                default: ()=>({
                        export: !1,
                        formApproval: !1,
                        formReject: !1,
                        formSave: !1,
                        formSubmit: !0,
                        submit: !1
                    })
            }
        },
        emits: [
            "getComData"
        ],
        setup (n, { expose: h }) {
            const d = k(), { t: m } = x(), i = U(), e = g(!1), { schemas: T, methods: D } = Q(), { setReadOnly: v, setReviewReadOnly: P } = D, [V, { setFieldsValue: $, getFieldsValue: A, submit: S }] = H({
                schemas: T,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 3,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), N = g(), F = n;
            async function b(s) {
                s && (s.rectifyTime = s.rectifyTime ? String(s.rectifyTime).split("T")[0] : void 0, $(s)), d.query.type === "view" || F.btnsDisabled.formApproval ? v(!0) : v(!1), P(!0), d.query.isEdit || (e.value = !0);
            }
            async function B(s) {
                const o = A(), c = {
                    rectifyTime: "",
                    ...o,
                    deficiencyId: d.query.id
                };
                if ("rectifyTime" in o && o.rectifyTime) {
                    let p = new Date(o.rectifyTime), r = p.getMonth() + 1;
                    r = r < 10 ? `0${r}` : r;
                    let a = p.getDate();
                    a = a < 10 ? `0${a}` : a, o.rectifyTime === "undefined" ? c.rectifyTime = "" : c.rectifyTime = p.getFullYear() + "-" + r + "-" + a + "T00:00:00";
                }
                let l = !0;
                return !await S() && s ? (l = !1, i.warning(m("hsqe.nc.actionVerification")), !1) : (l = !0, {
                    params: c,
                    res: l
                });
            }
            return E(()=>{
                b();
            }), h({
                getData: B,
                initData: b
            }), (s, o)=>{
                const c = j, l = X, _ = G, p = M;
                return R(), q(p, null, {
                    default: u(()=>[
                            f("div", null, [
                                I(_, {
                                    bordered: !1,
                                    class: "proCard",
                                    size: "small",
                                    segmented: {
                                        content: !0
                                    },
                                    "header-class": "pt-0 pl-0",
                                    "content-class": "pl-0",
                                    title: y(m)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.correctiveAction")
                                }, {
                                    default: u(()=>[
                                            I(l, {
                                                onRegister: y(V),
                                                "label-placement": "top",
                                                showTitleBorder: !0,
                                                class: "rounded-b-lg mb-4 last:mb-0"
                                            }, {
                                                line: u(()=>o[0] || (o[0] = [
                                                        f("div", {
                                                            class: "w-full h-[1px]"
                                                        }, null, -1)
                                                    ])),
                                                preventiveLine: u(()=>[
                                                        f("div", ee, [
                                                            f("h2", te, z(y(m)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.preventiveAction")), 1)
                                                        ])
                                                    ]),
                                                officeResponsibleName: u(({ model: r, field: a })=>[
                                                        y(N)?.status == "closed" ? (R(), q(c, {
                                                            key: 0,
                                                            value: r[a],
                                                            "onUpdate:value": (C)=>r[a] = C,
                                                            type: "text",
                                                            disabled: "",
                                                            label: "111"
                                                        }, null, 8, [
                                                            "value",
                                                            "onUpdate:value"
                                                        ])) : W("", !0)
                                                    ]),
                                                _: 1
                                            }, 8, [
                                                "onRegister"
                                            ])
                                        ]),
                                    _: 1
                                }, 8, [
                                    "title"
                                ])
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { re as _, __tla };
