import { B as K } from "./BasicForm-dL_oCSPM.js";
import { m as L, n as S, ak as Q, al as X, am as ee } from "./template-rpthWlT9.js";
import { V as g, Z as u, aA as O, cb as te, k as D, r as o, a4 as ie, bk as ne, d as se, f as oe, aw as ae, h as ce, o as k, j as C, w as h, i as R, A as P, l, H as re, c as le, D as pe, cZ as de, __tla as __tla_0 } from "./index-9PRMimni.js";
import { u as ue } from "./useForm-CKmgcynv.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./componentSetting-DVhNDBTO.js";
import "./ImageUpload-DUsnro3W.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";
import "./tabsView-BXskTdVh.js";
import "./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";
import "./propTypes-CebMRUpe.js";
import "./BasicSelect-C_uwzMkE.js";
import "./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./dictionary-BRse4lkf.js";
import "./index-DkvzUEqh.js";
import "./index-kKnqLkWM.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./usePageCache-DluHn7Yy.js";
let $e;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: m } = g(), me = await L();
    function B(i) {
        return {
            columns: [
                {
                    title: m("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.actionType"),
                    key: "correctActionType",
                    render: (t)=>u(O, {
                            style: {
                                width: "150px"
                            },
                            value: t.correctActionType,
                            disabled: i?.readOnly,
                            onUpdateValue: (e)=>t.correctActionType = e,
                            options: me
                        })
                },
                {
                    title: m("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.extensionRectifiedDate"),
                    key: "rectifyTime",
                    render: (t)=>u(te, {
                            value: t.rectifyTime,
                            disabled: i?.readOnly,
                            onUpdateValue: (e)=>t.rectifyTime = e
                        })
                },
                {
                    title: m("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.description"),
                    key: "correctActionDescription",
                    render: (t)=>u(D, {
                            style: {
                                width: "250px"
                            },
                            type: "textarea",
                            value: t.correctActionDescription,
                            disabled: i?.readOnly,
                            onUpdateValue: (e)=>t.correctActionDescription = e
                        })
                },
                {
                    title: m("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.verifiedClosedON"),
                    key: "correctActionReview",
                    render: (t)=>u(O, {
                            style: {
                                width: "150px"
                            },
                            value: t.correctActionReview,
                            disabled: i?.readOnly,
                            onUpdateValue: (e)=>t.correctActionReview = e,
                            options: [
                                {
                                    label: "YES",
                                    value: "yes"
                                },
                                {
                                    label: "NO",
                                    value: "no"
                                }
                            ]
                        })
                },
                {
                    title: m("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.comments"),
                    key: "correctActionComment",
                    render: (t)=>u(D, {
                            style: {
                                width: "250px"
                            },
                            type: "textarea",
                            value: t.correctActionComment,
                            disabled: i?.readOnly,
                            onUpdateValue: (e)=>t.correctActionComment = e
                        })
                }
            ]
        };
    }
    const E = ne(), { t: p } = g(), fe = await L(), ye = await S();
    function ve() {
        const i = o(!1), f = o(!1), t = o(""), e = ie(()=>t.value == "closed" ? p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.superintendent") : "");
        return {
            schemas: [
                {
                    label: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.actionType"),
                    field: "correctActionType",
                    component: "NSelect",
                    componentProps: ()=>({
                            options: fe,
                            disabled: i.value,
                            "label-field": E.getLocale === "en" ? "labelEn" : "label"
                        })
                },
                {
                    label: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.extensionRectifiedDate"),
                    field: "rectifyTime",
                    component: "NDatePicker",
                    componentProps: ()=>({
                            type: "date",
                            valueFormat: "yyyy-MM-dd",
                            disabled: i.value
                        })
                },
                {
                    field: "block"
                },
                {
                    label: p("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.description"),
                    field: "correctActionDescription",
                    component: "NInput",
                    componentProps: ()=>({
                            type: "textarea",
                            disabled: i.value
                        }),
                    giProps: {
                        span: 3
                    }
                },
                {
                    field: "preventiveLine",
                    slot: "preventiveLine",
                    giProps: {
                        span: 3
                    }
                },
                {
                    label: p(""),
                    field: "preventActionMethod",
                    component: "NSelect",
                    componentProps: ()=>({
                            options: ye,
                            disabled: i.value,
                            "label-field": E.getLocale === "en" ? "labelEn" : "label"
                        })
                },
                {
                    label: p(""),
                    field: "preventActionDescription",
                    component: "NInput",
                    componentProps: ()=>({
                            type: "textarea",
                            disabled: i.value
                        }),
                    giProps: {
                        span: 3
                    }
                },
                {
                    label: e.value,
                    field: "officeResponsibleName",
                    slot: "officeResponsibleName",
                    component: "NInput",
                    componentProps: ()=>({
                            disabled: !0
                        })
                }
            ],
            methods: {
                setReadOnly: (s)=>{
                    i.value = s;
                },
                setReviewReadOnly: (s)=>{
                    f.value = s;
                },
                setStatus: (s)=>{
                    t.value = s;
                }
            }
        };
    }
    let be, he, Re;
    be = {
        class: "text-[clamp(1.1rem,1.5vw,1.25rem)] font-medium text-slate-700 text-left"
    };
    he = {
        class: "border-b border-[#E2E8F0E6] w-full"
    };
    Re = {
        class: "text-[clamp(1.1rem,1.5vw,1.25rem)] font-medium text-slate-700 text-left"
    };
    $e = se({
        __name: "index",
        props: {
            btnsDisabled: {
                type: Object,
                default: ()=>({
                        hasCaptainReject: "0",
                        hasOfficerCommit: "0",
                        hasCaptainPass: "0",
                        hasDeficiencyCommit: "0",
                        hasBasicInfoEdit: "0"
                    })
            }
        },
        emits: [
            "getData",
            "saveCallBack"
        ],
        setup (i, { expose: f, emit: t }) {
            const e = oe(), _ = de(), { t: y } = g(), s = i, I = o(), F = o(), T = t, v = o(), U = o(!1), A = o(), M = B({
                readOnly: !1
            });
            A.value = M.columns;
            const { schemas: $, methods: j } = ve(), { setReadOnly: x, setStatus: G, setReviewReadOnly: W } = j, [Y, { setFieldsValue: w, getFieldsValue: V }] = ue({
                schemas: $,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 3,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), b = o();
            async function Z() {
                if (F.value = await S(), e.query.id) {
                    const n = await Q(Number(e.query.id));
                    n ? (v.value = n, I.value?.setTableData([
                        l(v)
                    ]), b.value = await X(Number(e.query.id)), G(b.value.status), w({
                        ...n,
                        rectifyTime: String(n.rectifyTime).split("T")[0],
                        ...b.value
                    })) : (v.value = [], I.value?.setTableData([
                        l(v)
                    ]), w({}));
                }
                if (x(!e.query.isEdit || s.btnsDisabled.hasCaptainPass == 1 && s.btnsDisabled.hasOfficerCommit == 0), W(!e.query.isEdit || s.btnsDisabled.hasOfficerCommit != "1"), !e.query.isEdit) {
                    U.value = !0;
                    const n = B({
                        readOnly: !0
                    });
                    A.value = n.columns;
                }
                x(!0);
            }
            T("getData", (n)=>n);
            function z() {
                return V();
            }
            async function H() {
                const n = V(), a = {
                    rectifyTime: "",
                    ...n,
                    reportId: e.query.reportId,
                    deficiencyId: e.query.id
                };
                if ("rectifyTime" in n && n.rectifyTime) {
                    let d = new Date(n.rectifyTime), c = d.getMonth() + 1;
                    c = c < 10 ? `0${c}` : c;
                    let r = d.getDate();
                    r = r < 10 ? `0${r}` : r, a.rectifyTime = d.getFullYear() + "-" + c + "-" + r + "T00:00:00";
                }
                "id" in a && delete a.id, await ee(a), _.success(y("hsqe.deficiency.operationSuccessful")), T("saveCallBack");
            }
            return ae(()=>{
                Z();
            }), f({
                getData: z,
                submit: H
            }), (n, a)=>{
                const d = re, c = D, r = K;
                return k(), ce("div", null, [
                    C(d, {
                        justify: "space-between",
                        align: "center",
                        class: "bg-slate-50 rounded-t-lg border-b border-slate-200/90 p-4"
                    }, {
                        default: h(()=>[
                                R("h2", be, P(l(y)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.correctiveAction")), 1)
                            ]),
                        _: 1
                    }),
                    C(r, {
                        onRegister: l(Y),
                        "label-placement": "top",
                        showTitleBorder: !0,
                        class: "bg-slate-50 rounded-b-lg p-4 mb-4 last:mb-0"
                    }, {
                        line: h(()=>a[0] || (a[0] = [
                                R("div", {
                                    class: "bg-slate-200 w-full h-[1px]"
                                }, null, -1)
                            ])),
                        preventiveLine: h(()=>[
                                R("div", he, [
                                    R("h2", Re, P(l(y)("hsqe.auditInspection.vesselInspection.shipVisitReport.deficiencyReport.action.preventiveAction")), 1)
                                ])
                            ]),
                        officeResponsibleName: h(({ model: q, field: N })=>[
                                l(b)?.status == "closed" ? (k(), le(c, {
                                    key: 0,
                                    value: q[N],
                                    "onUpdate:value": (J)=>q[N] = J,
                                    type: "text",
                                    disabled: "",
                                    label: "111"
                                }, null, 8, [
                                    "value",
                                    "onUpdate:value"
                                ])) : pe("", !0)
                            ]),
                        _: 1
                    }, 8, [
                        "onRegister"
                    ])
                ]);
            };
        }
    });
});
export { $e as default, __tla };
