import { r as u, V as B, bk as J, Z as x, ae as qe, d as Se, u as Ce, co as Ie, f as ke, e as Re, a as Te, gW as I, gX as k, gJ as we, aw as Ne, d9 as Pe, c as m, o as f, w as n, j as c, W as De, l as o, ds as Q, H as Ae, D as P, aI as Be, p as R, A as T, B as Le, ca as D, aE as W, i as G, X as Ee, c_ as Ve, v as Oe, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as Ue } from "./BasicForm-dL_oCSPM.js";
import { _ as He } from "./TableSelect.vue_vue_type_script_setup_true_lang-BAU5mgvB.js";
import { B as ze } from "./Table-0PViRYCf.js";
import { _ as Me } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { O as $e, s as X, u as Qe, c as We, N as Ge } from "./template-rpthWlT9.js";
import { g as Xe } from "./planner-BebmniHR.js";
import { _ as je, __tla as __tla_1 } from "./Modal.vue_vue_type_script_setup_true_lang-BPUcv_eQ.js";
import { f as Je } from "./hook-C9rOLWu_.js";
import { _ as Ke } from "./index.vue_vue_type_script_setup_true_lang-BUzew2LL.js";
import { u as Ze } 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 "./props-CLtNejQT.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./print-CT_2hrjP.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./useModal-CO65vga3.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./Flex-CTSf12gq.js";
let Wt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    const Ye = J(), { t: i } = B(), et = await $e();
    function tt() {
        const h = u(!1);
        return {
            addSchemas: [
                {
                    field: "reportNum",
                    label: i("hsqe.auditInspection.vesselInspection.reportNum"),
                    component: "NInput",
                    componentProps: ()=>({
                            disabled: !0
                        })
                },
                {
                    field: "shipId",
                    component: "NSelect",
                    label: i("hsqe.auditInspection.vesselInspection.formVessel"),
                    componentProps: {
                        disabled: h,
                        placeholder: i("hsqe.auditInspection.vesselInspection.formVesselHint"),
                        options: et,
                        "value-field": "id",
                        "label-field": Ye.getLocale === "en" ? "shipNameEn" : "shipName"
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (l, t)=>t != null && t !== "",
                            message: i("common.chooseText") + " " + i("hsqe.auditInspection.vesselInspection.formVessel"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "inspectionId",
                    label: i("hsqe.cdi.inspectionId"),
                    component: "NInput",
                    componentProps: {
                        disabled: h
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (l, t)=>t != null && t !== "",
                            message: i("common.inputText") + " " + i("hsqe.cdi.inspectionId"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "port",
                    label: i("hsqe.management.port"),
                    slot: "visitPlace",
                    rules: [
                        {
                            required: !0,
                            validator: (l, t)=>t != null && t !== "",
                            message: i("common.chooseText") + " " + i("hsqe.management.port"),
                            trigger: [
                                "blur"
                            ]
                        }
                    ]
                },
                {
                    field: "dateOfInspection",
                    label: i("hsqe.cdi.dateOfInspection"),
                    component: "NDatePicker",
                    componentProps: {
                        type: "date",
                        valueFormat: "yyyy-MM-dd",
                        disabled: h
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (l, t)=>t != null && t !== "",
                            message: i("common.chooseText") + " " + i("hsqe.cdi.dateOfInspection"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "raisedOn",
                    label: i("hsqe.cdi.raisedOn"),
                    component: "NDatePicker",
                    componentProps: {
                        type: "date",
                        valueFormat: "yyyy-MM-dd",
                        disabled: h
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (l, t)=>t != null && t !== "",
                            message: i("common.chooseText") + " " + i("hsqe.cdi.raisedOn"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "inspectorName",
                    label: i("hsqe.rs.inspectorName"),
                    component: "NInput",
                    componentProps: {
                        disabled: h
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (l, t)=>t != null && t !== "",
                            message: i("common.inputText") + " " + i("hsqe.rs.inspectorName"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "rightShipReport",
                    label: i("hsqe.rs.rightShipReport"),
                    slot: "rightShipReport"
                },
                {
                    field: "rightShipReportName",
                    hidden: !0
                },
                {
                    field: "rightShipFindingsReportName",
                    hidden: !0
                }
            ],
            methods: {
                setReadOnly: (l)=>{
                    h.value = l;
                }
            }
        };
    }
    const j = J(), { t: a } = B();
    function ot() {
        const h = [
            {
                key: "new",
                value: a("hsqe.rs.deficiencyStatus.new"),
                color: {
                    color: "#F0FFFB",
                    textColor: "#00C1A8",
                    borderColor: "#F0FFFB"
                }
            },
            {
                key: "un_rectified",
                value: a("hsqe.rs.deficiencyStatus.unrectified"),
                color: {
                    color: "#FFF0F0",
                    textColor: "#C10003",
                    borderColor: "#FFF0F0"
                }
            },
            {
                key: "pending_master_reviewed",
                value: a("hsqe.rs.deficiencyStatus.reviewed"),
                color: {
                    color: "#FFFCF0",
                    textColor: "#C18400",
                    borderColor: "#FFFCF0"
                }
            },
            {
                key: "un_verified",
                value: a("hsqe.rs.deficiencyStatus.unverified"),
                color: {
                    color: "#FFF0F0",
                    textColor: "#C10003",
                    borderColor: "#FFF0F0"
                }
            },
            {
                key: "closed",
                value: a("hsqe.rs.deficiencyStatus.closed"),
                color: {
                    color: "#F2F0FF",
                    textColor: "#BA4E9A",
                    borderColor: "#F2F0FF"
                }
            },
            {
                key: "master_return",
                value: a("hsqe.rs.deficiencyStatus.masterReturn"),
                color: {
                    color: "#F0FFFB",
                    textColor: "#00C1A8",
                    borderColor: "#F0FFFB"
                }
            },
            {
                key: "superintendent_return",
                value: a("hsqe.rs.deficiencyStatus.superintendentReturn"),
                color: {
                    color: "#F0F5FF",
                    textColor: "#0067C1",
                    borderColor: "#F0F5FF"
                }
            }
        ];
        return {
            columns: [
                {
                    title: a("hsqe.planner.no"),
                    key: "no"
                },
                {
                    title: a("hsqe.psc.deficiencyCode"),
                    key: "defectCode"
                },
                {
                    title: a("hsqe.auditInspection.vesselInspection.deficiency.description"),
                    key: "desc"
                },
                {
                    title: a("hsqe.psc.actionCode"),
                    key: "observation"
                },
                {
                    title: a("hsqe.auditInspection.vesselInspection.deficiency.dateRectify"),
                    key: "dueDate",
                    render: (d)=>Je(new Date(d.dueDate))
                },
                {
                    title: a("hsqe.auditInspection.vesselInspection.deficiency.pic"),
                    key: "owner",
                    render (d) {
                        return x("span", {}, {
                            default: ()=>j.getLocale === "en" ? d.vesselPositionNameEn : d.vesselPositionName
                        });
                    }
                },
                {
                    title: a("hsqe.auditInspection.vesselInspection.deficiency.confirmation"),
                    key: "confirmation",
                    render (d) {
                        return x("span", {}, {
                            default: ()=>j.getLocale === "en" ? d.officePositionNameEn : d.officePositionName
                        });
                    }
                },
                {
                    title: a("hsqe.cdi.status"),
                    key: "status",
                    render (d) {
                        return x(qe, {
                            bordered: !1,
                            color: h.find((l)=>l.key === d.status)?.color
                        }, {
                            default: ()=>h.find((l)=>l.key === d.status)?.value
                        });
                    }
                }
            ]
        };
    }
    let nt;
    nt = Se({
        __name: "addCDI",
        setup (h) {
            const b = Ce(), d = Ve(), l = Ie({
                storage: localStorage
            }), t = ke(), F = Re(), { t: s } = B(), _ = u(!1), { addSchemas: K, methods: Z } = tt(), { setReadOnly: Y } = Z, { columns: ee } = ot(), [te, { submit: oe, getFieldsValue: ne, setFieldsValue: se }] = Ze({
                schemas: K,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 4,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), ie = Te({
                width: 180,
                title: s("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return x(Me, {
                        style: "text",
                        actions: [
                            {
                                label: s("common.optionsViewText"),
                                labelShow: !1,
                                icon: x("i", {
                                    class: "iconfont icon-View text-[#3F7AE9] text-[20px]"
                                }),
                                onClick: ()=>{
                                    F.push({
                                        name: "Add_HSQE_AuditInspection_ReportList_VesselInspection_DeficiencyReport",
                                        query: {
                                            id: e.id,
                                            type: "view"
                                        }
                                    });
                                }
                            },
                            {
                                label: s("common.optionsEditText"),
                                labelShow: !1,
                                icon: x("i", {
                                    class: "iconfont icon-a-Frame28"
                                }),
                                onClick: ()=>{
                                    F.push({
                                        name: "Add_HSQE_AuditInspection_ReportList_VesselInspection_DeficiencyReport",
                                        query: {
                                            id: e.id,
                                            isEdit: 1
                                        }
                                    });
                                },
                                ifShow: e.editable && t.query.type !== "view"
                            },
                            {
                                label: s("common.exportText"),
                                labelShow: !1,
                                icon: I(k.export, "text-[20px]"),
                                onClick: ()=>{
                                    H(e);
                                }
                            }
                        ]
                    });
                }
            }), w = u({}), re = {
                gridProps: {
                    cols: "2"
                },
                labelWidth: 80,
                submitButtonText: s("common.searchText"),
                showAdvancedButton: !1,
                schemas: [
                    {
                        field: "namePrefix",
                        component: "NInput",
                        label: s("hsqe.planner.modal.planPort")
                    }
                ]
            }, ae = [
                {
                    title: s("hsqe.planner.modal.port"),
                    key: "port"
                },
                {
                    title: s("hsqe.planner.modal.country"),
                    key: "country"
                }
            ], g = u(), le = u(l.get(we, "")), ce = u(), L = u(), q = u(), E = u(!1), V = u(), O = u(0), N = u([]), de = u([]);
            async function U() {
                const e = await X({
                    templateCode: "cdiReport",
                    uuid: g.value
                });
                q.value = e, ce.value = e.reportNum, se(e), ue(e), pe(e), t.query.type == "view" && (_.value = !0), Y(_.value), z();
            }
            function H(e) {
                const { href: r } = F.resolve({
                    name: "Add_HSQE_AuditInspection_ReportList_exportDeficiencyPdf",
                    query: {
                        uuid: t.query.uuid,
                        id: e.id,
                        name: "CDI"
                    }
                });
                window.open(r, "_blank");
            }
            async function ue(e) {
                e.approveStatus == 1 || e.approveStatus == 2 || e.approveStatus == 4 ? E.value = !0 : E.value = !1;
            }
            function pe(e) {
                e.reportUrlName && (N.value = [
                    {
                        id: "rightShipReport",
                        name: e.reportUrlName || "",
                        url: e.reportUrl || "",
                        status: t.query.type == "view" ? void 0 : "finished"
                    }
                ]), de.value = [
                    {
                        id: "rightShipFindingsReport",
                        name: e.reportUrlName || "",
                        url: e.reportUrl || "",
                        status: t.query.type == "view" ? void 0 : "finished"
                    }
                ];
            }
            function me(e) {
                return Xe({
                    ...e,
                    ...o(w)
                });
            }
            async function fe() {
                const e = await X({
                    templateCode: "cdiReport",
                    uuid: g.value
                });
                return O.value = e.deficiencyList?.length || 0, {
                    list: e.deficiencyList || [],
                    total: e.deficiencyList?.length || 0
                };
            }
            function z() {
                V.value.reload();
            }
            function he() {
                if (!q.value) {
                    b.warning(s("hsqe.sire.cantAddHint"));
                    return;
                }
                L.value?.showModal(q.value, t.query.uuid || g.value);
            }
            async function ye() {
                if (!await oe()) return !1;
                const r = ne(), p = {
                    template_code: "cdiReport",
                    reportBy: le.value,
                    uuid: "",
                    ...r
                };
                g.value ? (p.uuid = g.value, await Qe(p), b.success(s("common.saveSuccessText"))) : (g.value = await We(p), b.success(s("common.saveSuccessText"))), U();
            }
            async function ge() {
                await Ge({
                    shipId: q.value.shipId,
                    busId: g.value,
                    moduleCode: "cdiReport"
                }), b.success(s("common.submitSuccessText")), F.push({
                    name: "HSQE_AuditInspection_ReportList",
                    query: {
                        asyncComponent: "cdi"
                    }
                });
            }
            function _e() {
                if (_.value) {
                    F.push({
                        name: "HSQE_AuditInspection_ReportList",
                        query: {
                            asyncComponent: "cdi"
                        }
                    });
                    return;
                }
                d.info({
                    title: s("hsqe.auditInspection.back.title"),
                    content: s("hsqe.auditInspection.back.cont"),
                    positiveText: s("common.okText"),
                    negativeText: s("common.cancelText"),
                    onPositiveClick: async ()=>{
                        F.push({
                            name: "HSQE_AuditInspection_ReportList",
                            query: {
                                asyncComponent: "cdi"
                            }
                        });
                    }
                });
            }
            function ve(e, r, p) {
                r[p] = e?.originalFileName, r.reportUrl = e?.url;
            }
            return Ne(async ()=>{
                g.value = t.query.uuid || null, g.value && !q.value && U();
            }), (e, r)=>{
                const p = Le, S = Be, A = Ae, be = He, Fe = Ue, M = De, xe = Ee, $ = Pe("debounce");
                return f(), m(xe, null, {
                    default: n(()=>[
                            c(M, {
                                bordered: !1,
                                class: "py-3 proCard",
                                size: "small",
                                segmented: {
                                    content: !0
                                },
                                "content-style": "padding: 20px 15px 0 15px;"
                            }, {
                                header: n(()=>[
                                        c(A, {
                                            align: "center"
                                        }, {
                                            default: n(()=>[
                                                    c(S, {
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                c(p, {
                                                                    type: "text",
                                                                    class: "size-8",
                                                                    onClick: _e
                                                                }, {
                                                                    icon: n(()=>[
                                                                            (f(), m(D(o(I)(o(k).back, "text-[16px]"))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: n(()=>[
                                                                R(" " + T(o(s)("common.backToList")), 1)
                                                            ]),
                                                        _: 1
                                                    }),
                                                    G("h1", null, T(o(s)("hsqe.basic.basicTitle")), 1)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                "header-extra": n(()=>[
                                        c(A, {
                                            align: "center"
                                        }, {
                                            default: n(()=>[
                                                    o(O) > 0 ? (f(), m(S, {
                                                        key: 0,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                c(p, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: H
                                                                }, {
                                                                    icon: n(()=>[
                                                                            (f(), m(D(o(I)(o(k).export, "text-[23px]"))))
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: n(()=>[
                                                                R(" " + T(o(s)("common.optionsExportListText")), 1)
                                                            ]),
                                                        _: 1
                                                    })) : P("", !0),
                                                    o(_) ? P("", !0) : (f(), m(S, {
                                                        key: 1,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                W((f(), m(p, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7"
                                                                }, {
                                                                    icon: n(()=>[
                                                                            (f(), m(D(o(I)(o(k).save))))
                                                                        ]),
                                                                    _: 1
                                                                })), [
                                                                    [
                                                                        $,
                                                                        ()=>ye(),
                                                                        "1000"
                                                                    ]
                                                                ])
                                                            ]),
                                                        default: n(()=>[
                                                                R(" " + T(o(s)("common.saveText")), 1)
                                                            ]),
                                                        _: 1
                                                    })),
                                                    o(_) ? P("", !0) : (f(), m(S, {
                                                        key: 2,
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: n(()=>[
                                                                W((f(), m(p, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7"
                                                                }, {
                                                                    icon: n(()=>[
                                                                            (f(), m(D(o(I)(o(k).send))))
                                                                        ]),
                                                                    _: 1
                                                                })), [
                                                                    [
                                                                        $,
                                                                        ()=>ge(),
                                                                        "1000"
                                                                    ]
                                                                ])
                                                            ]),
                                                        default: n(()=>[
                                                                R(" " + T(o(s)("common.submit")), 1)
                                                            ]),
                                                        _: 1
                                                    }))
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                default: n(()=>[
                                        c(Fe, {
                                            onRegister: o(te)
                                        }, {
                                            visitPlace: n(({ model: v, field: C })=>[
                                                    c(be, {
                                                        ref: "portTableSelectRef",
                                                        labelField: "port",
                                                        valueField: "id",
                                                        value: v[C],
                                                        "onUpdate:value": (y)=>v[C] = y,
                                                        formValues: o(w),
                                                        "onUpdate:formValues": r[0] || (r[0] = (y)=>Q(w) ? w.value = y : null),
                                                        multiple: !1,
                                                        formProps: re,
                                                        disabled: o(_),
                                                        selectTitle: o(s)("hsqe.planner.modal.selectPort"),
                                                        class: "w-full",
                                                        tableProps: {
                                                            rowKey: (y)=>y.id,
                                                            request: me,
                                                            columns: ae,
                                                            pagination: {
                                                                simple: !0
                                                            }
                                                        }
                                                    }, null, 8, [
                                                        "value",
                                                        "onUpdate:value",
                                                        "formValues",
                                                        "disabled",
                                                        "selectTitle",
                                                        "tableProps"
                                                    ])
                                                ]),
                                            rightShipReport: n(({ model: v, field: C })=>[
                                                    c(Ke, {
                                                        "file-list": o(N),
                                                        "onUpdate:fileList": r[1] || (r[1] = (y)=>Q(N) ? N.value = y : null),
                                                        disabled: o(_),
                                                        onFinish: (y)=>ve(y, v, C),
                                                        onRemove: (y)=>v[C] = null
                                                    }, null, 8, [
                                                        "file-list",
                                                        "disabled",
                                                        "onFinish",
                                                        "onRemove"
                                                    ])
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            c(M, {
                                bordered: !1,
                                class: "mt-3 py-3 proCard",
                                size: "small",
                                segmented: {
                                    content: !0
                                },
                                "content-style": "padding: 20px 15px 0 15px;"
                            }, {
                                default: n(()=>[
                                        c(o(ze), {
                                            ref_key: "basicTableRef",
                                            ref: V,
                                            columns: o(ee),
                                            request: fe,
                                            immediate: !1,
                                            "row-key": (v)=>v.id,
                                            actionColumn: o(ie),
                                            autoScrollX: !0,
                                            "virtual-scroll": "",
                                            pagination: !1
                                        }, {
                                            tableTitle: n(()=>[
                                                    c(A, null, {
                                                        default: n(()=>[
                                                                o(_) ? P("", !0) : (f(), m(S, {
                                                                    key: 0,
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: n(()=>[
                                                                            c(p, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                bordered: "",
                                                                                secondary: "",
                                                                                class: "size-7",
                                                                                onClick: he
                                                                            }, {
                                                                                icon: n(()=>r[2] || (r[2] = [
                                                                                        G("i", {
                                                                                            class: "iconfont icon-ADD"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: n(()=>[
                                                                            r[3] || (r[3] = R(" ADD "))
                                                                        ]),
                                                                    _: 1
                                                                }))
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "row-key",
                                            "actionColumn"
                                        ])
                                    ]),
                                _: 1
                            }),
                            c(je, {
                                ref_key: "modalRef",
                                ref: L,
                                onSuccess: z
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
    Wt = Oe(nt, [
        [
            "__scopeId",
            "data-v-5b823af3"
        ]
    ]);
});
export { Wt as default, __tla };
