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