import { V as D, d as pe, f as de, e as me, r as d, a as fe, Z as w, gE as f, cZ as ve, aw as ge, d9 as ye, c as _, o as q, w as u, j as c, W as he, l as i, ds as z, H as _e, aE as W, D as R, i as qe, A as be, X as Ie, c_ as Ae, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as Te } from "./BasicForm-dL_oCSPM.js";
import { _ as we } from "./TableSelect.vue_vue_type_script_setup_true_lang-BAU5mgvB.js";
import { _ as Re, __tla as __tla_1 } from "./Modal.vue_vue_type_script_setup_true_lang-DqgUCR20.js";
import { _ as ke } from "./index.vue_vue_type_script_setup_true_lang-BUzew2LL.js";
import { s as Se, d as Ne, e as xe, a as De } from "./navigationAudit-BE8ZxDH9.js";
import { r as Ce, s as Pe } from "./template-rpthWlT9.js";
import { g as Fe } from "./planner-BebmniHR.js";
import { B as He } from "./Table-0PViRYCf.js";
import { _ as Ve } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { u as Le } 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 "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { __tla as __tla_2 } from "./modalSchemas-DzYfMuRt.js";
import "./helper-Czt-QYps.js";
import "./memoize-C3Z21RQJ.js";
import "./useModal-CO65vga3.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 "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./Flex-CTSf12gq.js";
let Dt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: b } = D();
    function Be() {
        return {
            columns: [
                {
                    title: b("hsqe.auditInspection.vesselInspection.shipVisitReport.certificateSMS.no"),
                    key: "no",
                    width: 50,
                    render: (t, a)=>a + 1
                },
                {
                    title: b("hsqe.auditInspection.vesselInspection.deficiency.description"),
                    key: "desc",
                    width: 150
                },
                {
                    title: b("hsqe.auditInspection.vesselInspection.deficiency.pic"),
                    key: "pic",
                    width: 150
                },
                {
                    title: b("hsqe.auditInspection.vesselInspection.deficiency.dateRectify"),
                    key: "dueDate",
                    width: 150,
                    render: (t)=>t.dueDate.replace("T", " ")
                },
                {
                    title: b("hsqe.auditInspection.vesselInspection.deficiency.confirmation"),
                    key: "superintendantConfirmation",
                    width: 150
                }
            ]
        };
    }
    const { t: l } = D();
    function Me() {
        return {
            addSchemas: [
                {
                    field: "reportNo",
                    label: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.formReportNo"),
                    component: "NInput",
                    componentProps: {
                        disabled: !0,
                        placeholder: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.formReportNoHint")
                    }
                },
                {
                    field: "vessel",
                    label: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.formVessel"),
                    component: "NInput",
                    componentProps: {
                        disabled: !0
                    },
                    rules: [
                        {
                            required: !0,
                            message: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.vesselHint")
                        }
                    ]
                },
                {
                    field: "port",
                    label: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.formPort"),
                    component: "NInput",
                    slot: "visitPlace",
                    rules: [
                        {
                            required: !0,
                            message: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.placeOfListHint"),
                            trigger: [
                                "blur"
                            ]
                        }
                    ]
                },
                {
                    field: "inspectionDate",
                    label: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.formDateOfInspection"),
                    component: "NDatePicker",
                    componentProps: {
                        type: "date",
                        valueFormat: "yyyy-MM-dd"
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, a)=>a != null,
                            message: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.dateOfInspectionHint"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "raisedOn",
                    label: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.raisedOn"),
                    component: "NDatePicker",
                    defaultValue: new Date().toISOString().split("T")[0],
                    componentProps: {
                        type: "date",
                        valueFormat: "yyyy-MM-dd",
                        disabled: !0
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, a)=>a != null,
                            message: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.raisedOnHint"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "fileUrl",
                    label: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.report"),
                    slot: "rightShipReport",
                    rules: [
                        {
                            message: l("hsqe.auditInspection.navigationAudit.navigationAuditReport.reportHint"),
                            required: !0,
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ],
                    giProps: {
                        span: 2
                    }
                }
            ]
        };
    }
    Dt = pe({
        __name: "add",
        setup (C) {
            const { t } = D(), a = ve(), G = Ae(), o = de(), g = me(), P = d(), F = d(), I = d(), A = d([]), H = d([]), k = d(""), S = d(), n = d(), V = d(0), { columns: X } = Be(), [Z, { submit: L, getFieldsValue: N, setFieldsValue: B, validate: j }] = Le({
                schemas: H,
                labelWidth: "auto",
                layout: "horizontal",
                collapsed: !0,
                gridProps: {
                    cols: 5,
                    xGap: 15
                },
                showActionButtonGroup: !1
            }), T = d({}), K = {
                gridProps: {
                    cols: "2"
                },
                labelWidth: 80,
                submitButtonText: t("common.searchText"),
                showAdvancedButton: !1,
                schemas: [
                    {
                        field: "namePrefix",
                        component: "NInput",
                        label: t("hsqe.planner.modal.planPort")
                    }
                ]
            }, J = [
                {
                    title: t("hsqe.planner.modal.port"),
                    key: "port"
                },
                {
                    title: t("hsqe.planner.modal.country"),
                    key: "country"
                }
            ], Y = fe({
                width: 180,
                title: t("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (e) {
                    return w(Ve, {
                        style: "text",
                        actions: [
                            {
                                label: t("common.optionsViewText"),
                                labelShow: !1,
                                icon: w(f, {
                                    iconName: "view",
                                    iconType: "lineIcon"
                                }),
                                onClick: ()=>{
                                    +n.value?.status == 3 ? g.push({
                                        name: "Add_HSQE_AuditInspection_ReportList_VesselInspection_DeficiencyReport",
                                        query: {
                                            id: e.id
                                        }
                                    }) : I.value?.showModal(n.value, e, "view");
                                }
                            },
                            {
                                label: t("common.optionsEditText"),
                                labelShow: !1,
                                icon: w(f, {
                                    iconName: "edit",
                                    iconType: "lineIcon"
                                }),
                                onClick: ()=>{
                                    I.value?.showModal(n.value, e, "edit");
                                },
                                ifShow: ()=>o.query.type !== "view" && e.status !== "Close"
                            },
                            {
                                label: t("common.optionsDelText"),
                                labelShow: !1,
                                icon: w(f, {
                                    iconName: "delete",
                                    iconType: "lineIcon"
                                }),
                                onPositiveClick: ()=>{
                                    ae(e);
                                },
                                onNegativeClick: ()=>{},
                                isConfirm: !0,
                                confirmContent: t("common.delPop.cont"),
                                ifShow: ()=>o.query.type !== "view" && e.status !== "Close"
                            }
                        ]
                    });
                }
            });
            function ee(e, s, r) {
                s[r] = e?.name, s.fileName = e?.originalFileName;
            }
            function te(e) {
                return {
                    0: "cargoTankReport",
                    1: "companyNavigationalReport",
                    2: "checklistEngineeringReport",
                    3: "companyBunkeringReport",
                    4: "companyMooringReport"
                }[e];
            }
            async function ie() {
                const e = await Pe({
                    templateCode: te(o.query.currentType),
                    uuid: S.value
                });
                return V.value = e.deficiencyList?.length || 0, {
                    list: e?.deficiencyList || [],
                    total: e?.deficiencyList?.length || 0
                };
            }
            function x() {
                F.value.reload();
            }
            function ne(e) {
                return Fe({
                    ...e,
                    ...i(T)
                });
            }
            function oe(e) {
                return {
                    0: t("hsqe.auditInspection.navigationAudit.cargoTitle"),
                    1: t("hsqe.auditInspection.navigationAudit.navigationTitle"),
                    2: t("hsqe.auditInspection.navigationAudit.engineerTitle"),
                    3: t("hsqe.auditInspection.navigationAudit.bunkeringTitle"),
                    4: t("hsqe.auditInspection.navigationAudit.mooringTitle")
                }[e];
            }
            async function ae(e) {
                let s = {
                    id: e.id
                };
                await Ce(s), x(), a.success(t("common.delPop.success"));
            }
            async function M(e) {
                if (!await L()) return !1;
                const r = N();
                if (r.type = o.query.currentType, P.value.getDataSource().forEach((v)=>{
                    v.port === r.port && (r.portId = v.id);
                }), r.inspectionDate < r.raisedOn) {
                    a.error(t("hsqe.auditInspection.vesselInspection.shipVisitReport.dataRuleHint"));
                    return;
                }
                let y;
                return o.query.type == "edit" || n.value.uuid ? y = xe : y = (v)=>De({
                        ...v,
                        plannerId: k.value
                    }), delete n.value.createTime, delete n.value.updateTime, n.value = await y({
                    ...n.value,
                    ...r
                }), B(n.value), S.value = n.value.uuid, e || a.success(t("common.saveSuccessText")), !0;
            }
            function E() {
                o.query.source === "planner" ? g.push({
                    path: "/hsqe/auditInspection/planner"
                }) : g.push({
                    name: "HSQE_AuditInspection_ReportList",
                    query: {
                        asyncComponent: $(o.query.currentType)
                    }
                });
            }
            function O(e) {
                if (e) {
                    g.push({
                        name: "HSQE_AuditInspection_ReportList",
                        query: {
                            asyncComponent: "vesselInspection"
                        }
                    });
                    return;
                }
                o.query.type === "view" ? E() : G.info({
                    title: t("hsqe.auditInspection.back.title"),
                    content: t("hsqe.auditInspection.back.cont"),
                    positiveText: t("common.okText"),
                    negativeText: t("common.cancelText"),
                    onPositiveClick: async ()=>{
                        E();
                    }
                });
            }
            function $(e) {
                if (e == 1) return "navigationAudit";
                if (e == 2) return "engineeringAudit";
                if (e == 3) return "Bunkering";
                if (e == 4) return "mooringAudit";
                if (e == 0) return "cargoAudit";
            }
            async function se() {
                if (!N().reportNo) {
                    a.error(t("hsqe.auditInspection.navigationAudit.navigationAuditReport.noHint"));
                    return;
                }
                await L();
                const s = N();
                if (j().then(()=>{
                    I.value?.showModal(n.value, {}, "add");
                }).catch(()=>{
                    a.warning(t("hsqe.sire.cantAddHint"));
                }), !s) {
                    a.warning(t("hsqe.sire.cantAddHint"));
                    return;
                }
            }
            async function re() {
                await M(!0) && (await Se({
                    id: n.value.id
                }), a.success(t("common.submitSuccessText")), g.push({
                    name: "HSQE_AuditInspection_ReportList",
                    query: {
                        asyncComponent: "navigationAudit"
                    }
                }), O(!0));
            }
            function le() {
                const { href: e } = g.resolve({
                    name: "Add_HSQE_AuditInspection_ReportList_exportDeficiencyPdf",
                    query: {
                        uuid: n.value.id,
                        name: $(o.query.currentType)
                    }
                });
                window.open(e, "_blank");
            }
            async function ue() {
                S.value = o.query.uuid || null, k.value = o.query.plannerId, n.value = await Ne({
                    plannerId: k.value
                }), B(n.value), (n.value.fileName || n.value.fileUrl) && A.value.push({
                    name: n.value.fileName,
                    url: n.value.fileUrl,
                    status: o.query.type == "view" ? null : "finished"
                }), x();
                const e = Me();
                H.value = e.addSchemas;
            }
            return ge(()=>{
                ue();
            }), (e, s)=>{
                const r = _e, U = we, y = Te, v = he, ce = Ie, Q = ye("debounce");
                return q(), _(ce, null, {
                    default: u(()=>[
                            c(v, {
                                bordered: !1,
                                class: "proCard",
                                size: "small",
                                segmented: {
                                    content: !0
                                },
                                "content-style": "padding: 15px 15px 0 15px"
                            }, {
                                header: u(()=>[
                                        c(r, {
                                            align: "center"
                                        }, {
                                            default: u(()=>[
                                                    c(i(f), {
                                                        tooltip: i(t)("common.backToList"),
                                                        iconName: "back",
                                                        iconType: "lineIcon",
                                                        class: "cursor-pointer",
                                                        onClick: s[0] || (s[0] = (m)=>O(null))
                                                    }, null, 8, [
                                                        "tooltip"
                                                    ]),
                                                    qe("h1", null, be(oe(i(o).query.currentType)), 1)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                "header-extra": u(()=>[
                                        c(r, {
                                            align: "center"
                                        }, {
                                            default: u(()=>[
                                                    i(o).query.type !== "view" ? W((q(), _(i(f), {
                                                        key: "save",
                                                        tooltip: i(t)("common.saveText"),
                                                        iconName: "save",
                                                        class: "cursor-pointer"
                                                    }, null, 8, [
                                                        "tooltip"
                                                    ])), [
                                                        [
                                                            Q,
                                                            ()=>M(!1),
                                                            "1000"
                                                        ]
                                                    ]) : R("", !0),
                                                    i(n)?.reportNo && i(o).query.type !== "view" ? W((q(), _(i(f), {
                                                        key: "send",
                                                        tooltip: i(t)("common.optionsSendText"),
                                                        iconSize: 22,
                                                        iconName: "send",
                                                        class: "cursor-pointer"
                                                    }, null, 8, [
                                                        "tooltip"
                                                    ])), [
                                                        [
                                                            Q,
                                                            ()=>re(),
                                                            "1000"
                                                        ]
                                                    ]) : R("", !0)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                default: u(()=>[
                                        c(y, {
                                            onRegister: i(Z),
                                            ref: "basicFromRef",
                                            disabled: i(o).query.type == "view"
                                        }, {
                                            visitPlace: u(({ model: m, field: h })=>[
                                                    c(U, {
                                                        ref_key: "portTableSelectRef",
                                                        ref: P,
                                                        labelField: "port",
                                                        valueField: "id",
                                                        value: m[h],
                                                        "onUpdate:value": (p)=>m[h] = p,
                                                        formValues: i(T),
                                                        "onUpdate:formValues": s[1] || (s[1] = (p)=>z(T) ? T.value = p : null),
                                                        multiple: !1,
                                                        formProps: K,
                                                        selectTitle: i(t)("hsqe.planner.modal.selectPort"),
                                                        tableProps: {
                                                            rowKey: (p)=>p.id,
                                                            request: ne,
                                                            columns: J,
                                                            pagination: {
                                                                simple: !0
                                                            }
                                                        },
                                                        class: "w-full"
                                                    }, null, 8, [
                                                        "value",
                                                        "onUpdate:value",
                                                        "formValues",
                                                        "selectTitle",
                                                        "tableProps"
                                                    ])
                                                ]),
                                            rightShipReport: u(({ model: m, field: h })=>[
                                                    c(ke, {
                                                        "file-list": i(A),
                                                        "onUpdate:fileList": s[2] || (s[2] = (p)=>z(A) ? A.value = p : null),
                                                        disabled: i(o).query.type == "view",
                                                        onFinish: (p)=>ee(p, m, h),
                                                        onRemove: (p)=>m[h] = null
                                                    }, null, 8, [
                                                        "file-list",
                                                        "disabled",
                                                        "onFinish",
                                                        "onRemove"
                                                    ])
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister",
                                            "disabled"
                                        ])
                                    ]),
                                _: 1
                            }),
                            c(v, {
                                bordered: !1,
                                segmented: {
                                    content: !0
                                },
                                class: "mt-3 proCard"
                            }, {
                                default: u(()=>[
                                        c(i(He), {
                                            ref_key: "basicTableRef",
                                            ref: F,
                                            columns: i(X),
                                            request: ie,
                                            immediate: !1,
                                            "row-key": (m)=>m.id,
                                            actionColumn: i(Y),
                                            autoScrollX: !0,
                                            "virtual-scroll": "",
                                            pagination: !1
                                        }, {
                                            tableTitle: u(()=>[
                                                    c(r, {
                                                        align: "center"
                                                    }, {
                                                        default: u(()=>[
                                                                i(V) > 0 ? (q(), _(i(f), {
                                                                    key: "export",
                                                                    tooltip: i(t)("common.optionsExportListText"),
                                                                    iconSize: 23,
                                                                    iconName: "export",
                                                                    onClick: le
                                                                }, null, 8, [
                                                                    "tooltip"
                                                                ])) : R("", !0),
                                                                i(o).query.type !== "view" ? (q(), _(i(f), {
                                                                    key: "add",
                                                                    tooltip: i(t)("common.addText"),
                                                                    iconName: "add",
                                                                    onClick: se
                                                                }, null, 8, [
                                                                    "tooltip"
                                                                ])) : R("", !0)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "row-key",
                                            "actionColumn"
                                        ])
                                    ]),
                                _: 1
                            }),
                            c(Re, {
                                ref_key: "DefectModalRef",
                                ref: I,
                                currentType: Number(i(o).query.currentType),
                                onSuccess: x
                            }, null, 8, [
                                "currentType"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Dt as default, __tla };
