import { d as S, V as W, r as y, e as Z, f as X, a4 as K, Z as D, aw as Q, c as f, o as l, w as o, j as n, W as Y, i as c, aI as ee, p as v, A as u, l as e, B as te, h as T, D as b, x as ae, ds as oe, F as se, a9 as re, y as ie, ca as ne, X as pe, cZ as ce, v as ue, __tla as __tla_0 } from "./index-9PRMimni.js";
import { _ as le, __tla as __tla_1 } from "./index.vue_vue_type_script_setup_true_lang-BrmIOv3H.js";
import { _ as me, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-CQM7h78K.js";
import { _ as de, __tla as __tla_3 } from "./index.vue_vue_type_script_setup_true_lang-CUy4Li3W.js";
import { _ as fe, __tla as __tla_4 } from "./index.vue_vue_type_script_setup_true_lang-BsoogZBw.js";
import { f as ye, g as ve, h as _e } from "./defectList-JLVZ8qtV.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";
import "./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";
import "./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./index-DkvzUEqh.js";
import { u as be } from "./useTags-C1thGhjF.js";
import { __tla as __tla_5 } from "./index.vue_vue_type_style_index_0_scoped_b974e5ec_lang-_0QwzFKM.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./print-CT_2hrjP.js";
import { H as ge, __tla as __tla_6 } from "./index-8tHZJCCW.js";
import "./schemas-BmKi-UM9.js";
import { N as qe } from "./template-rpthWlT9.js";
import "./props-CLtNejQT.js";
import { _ as xe, __tla as __tla_7 } from "./rejectModal.vue_vue_type_script_setup_true_lang-ymQGi6dQ.js";
import { _ as De } from "./ApprovalModal.vue_vue_type_script_setup_true_lang-BOFnKkUb.js";
import "./BasicForm-dL_oCSPM.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload-DUsnro3W.js";
import "./componentSetting-DVhNDBTO.js";
import "./tabsView-BXskTdVh.js";
import "./BasicSelect-C_uwzMkE.js";
import "./dictionary-BRse4lkf.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./vesselEquipmentDetails-CJeqdW1Z.js";
import "./useForm-CKmgcynv.js";
import "./usePageCache-DluHn7Yy.js";
import { __tla as __tla_8 } from "./NewSparePartsModal.vue_vue_type_script_setup_true_lang-B9o2yLPr.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./jobOrder-CGbsc7bp.js";
import "./useModal-CO65vga3.js";
import "./isEmpty-BUg1OsQj.js";
import "./isNumber-D5aBrEhN.js";
import { __tla as __tla_9 } from "./SparePartsRequiredController.vue_vue_type_script_setup_true_lang-DDxJK7Vg.js";
import "./Table-0PViRYCf.js";
import "./useTimeout-BxFilWvD.js";
import "./Flex-CTSf12gq.js";
import "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import "./AttachmentController-1vuzH_dH.js";
import "./equipmentMainLibrary-bJTzj5mC.js";
import "./useRole-C-Zpngq4.js";
import "./propTypes-CebMRUpe.js";
import "./index-kKnqLkWM.js";
import "./has-CjqcrIOV.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./TimelineItem-Bkds7ZW8.js";
let At;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_4;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_5;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_6;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_7;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_8;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_9;
        } catch  {}
    })()
]).then(async ()=>{
    let we, ke, Ne, he, Ce, Ie, Re, Fe;
    we = {
        class: "w-full flex flex-column items-center"
    };
    ke = {
        class: "text-[18px] font-bold"
    };
    Ne = {
        class: "flex flex-column gap-[10px] ml-8"
    };
    he = {
        class: "ml-4 text-[16px]"
    };
    Ce = {
        key: 0,
        class: "ml-4 defect-no text-[16px]"
    };
    Ie = {
        class: "flex items-center mr-4"
    };
    Re = S({
        name: "defectFromPage"
    });
    Fe = S({
        ...Re,
        setup (Le) {
            const { closeCurrent: w } = be(), k = ce(), { t: i } = W(), s = y({}), h = y([]), C = y(), q = Z(), t = X(), g = y("basicDetail"), _ = y(), I = y();
            function $() {
                w(), q.push({
                    path: "/maintenance/defect/defectList"
                });
            }
            function N() {
                try {
                    w(), q.push({
                        name: "defectList"
                    });
                } catch  {
                    w(), q.push({
                        name: "defectList"
                    });
                }
            }
            function A() {
                k.success(i("common.submitRejectText")), N();
            }
            const R = K(()=>[
                    {
                        name: "basicDetail",
                        tabName: i("pms.defectFromPage.basicDetail"),
                        component: D(le),
                        disabled: !1
                    },
                    {
                        name: "Comments",
                        tabName: i("pms.defectFromPage.comments"),
                        component: D(me),
                        disabled: !1
                    },
                    {
                        name: "Attachment",
                        tabName: i("pms.defectFromPage.attachment"),
                        component: D(fe),
                        disabled: !1
                    },
                    {
                        name: "Review",
                        tabName: i("pms.defectFromPage.review"),
                        component: D(de),
                        disabled: [
                            "add",
                            "edit"
                        ].includes(t.query.type)
                    }
                ]);
            async function F() {
                const r = await _.value[0]?.getFormData?.(), a = await _.value[1]?.getFormData?.(), m = await _.value[2]?.getFormData?.(), d = await _.value[3]?.getFormData?.(), x = {
                    ...r,
                    ...a,
                    ...m,
                    ...d,
                    id: t.query.id,
                    shipId: t.query.shipId ? t.query.shipId : r.shipId
                };
                await ye(x), await P(), k.success(t.query.type === "add" ? i("common.optionsAddSuccessText") : i("common.optionsEditSuccessText"));
            }
            const L = y();
            function j() {
                L.value.handleOpenModal({
                    busId: Number(t.query.id),
                    moduleCode: "voyageRepair",
                    subModuleCode: s.value.approveFlow || ""
                });
            }
            async function E() {
                await F();
                const r = await _.value[0]?.getFormData?.();
                await qe({
                    shipId: t.query.shipId ? t.query.shipId : r.shipId,
                    busId: Number(t.query.id),
                    moduleCode: "voyageRepair",
                    subModuleCode: s.value.approveFlow || "",
                    busNo: s.value ? s.value.defectNo : ""
                }), k.success(i("Submit successful")), N();
            }
            async function B() {
                C.value?.showModal();
            }
            async function z() {
                const r = {
                    comment: "pass",
                    busId: t.query.id,
                    subModuleCode: s.value.approveFlow || "",
                    moduleCode: "voyageRepair",
                    busNo: s.value ? s.value.defectNo : ""
                };
                I.value?.showModal(r);
            }
            function H(r) {
                s.value = {
                    ...s.value,
                    ...r
                };
            }
            function V() {
                q.push({
                    name: "unPlannedJob",
                    query: {
                        status: "view",
                        id: t.query.jobId,
                        shipId: s.value?.shipId || null
                    }
                });
            }
            async function M() {
                const r = {
                    defectId: t.query.id
                }, a = await ve(r);
                h.value = a.list || [], console.log(a);
            }
            async function P() {
                const r = await _e(Number(t.query.id));
                s.value = r, await M();
            }
            return Q(()=>{
                if (P(), t.query.activeTab) {
                    const r = Number(t.query.activeTab);
                    isNaN(r) ? g.value = t.query.activeTab || "basicDetail" : g.value = R[r]?.name || "basicDetail";
                }
            }), (r, a)=>{
                const m = te, d = ee, x = Y, G = ie, J = ae, O = pe;
                return l(), f(O, null, {
                    default: o(()=>[
                            n(x, {
                                class: "h-[60px]",
                                "content-class": "p-4 flex items-center"
                            }, {
                                default: o(()=>[
                                        c("div", we, [
                                            n(d, {
                                                trigger: "hover"
                                            }, {
                                                trigger: o(()=>[
                                                        n(m, {
                                                            quaternary: "",
                                                            class: "px-3 mr-2",
                                                            onClick: a[0] || (a[0] = (p)=>$())
                                                        }, {
                                                            default: o(()=>a[7] || (a[7] = [
                                                                    c("i", {
                                                                        class: "iconfont icon-a-shangyibu2 text-[16px]"
                                                                    }, null, -1)
                                                                ])),
                                                            _: 1
                                                        })
                                                    ]),
                                                default: o(()=>[
                                                        v(u(e(i)("common.back")), 1)
                                                    ]),
                                                _: 1
                                            }),
                                            c("span", ke, u(e(i)("pms.defectFromPage.defectDetail")), 1),
                                            c("div", Ne, [
                                                c("span", he, u(e(i)("pms.defectFromPage.defectNo")) + ": " + u(e(s) ? e(s).defectNo : ""), 1),
                                                e(t).query.type != "add" && e(t).query.jobId ? (l(), T("span", Ce, [
                                                    v(u(e(i)("pms.defectFromPage.unplannedJobNo")) + ": ", 1),
                                                    c("a", {
                                                        href: "javascript:;",
                                                        onClick: V
                                                    }, u(e(t).query.jobId), 1)
                                                ])) : b("", !0)
                                            ])
                                        ])
                                    ]),
                                _: 1
                            }),
                            n(x, {
                                class: "mt-2"
                            }, {
                                default: o(()=>[
                                        n(J, {
                                            "default-value": "basicDetail",
                                            value: e(g),
                                            "onUpdate:value": a[6] || (a[6] = (p)=>oe(g) ? g.value = p : null)
                                        }, {
                                            suffix: o(()=>[
                                                    c("section", Ie, [
                                                        e(t).query.type === "add" || e(t).query.canApprove === "false" && e(t).query.canEdit === "true" && e(t).query.type !== "view" ? (l(), f(d, {
                                                            key: 0,
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: o(()=>[
                                                                    n(m, {
                                                                        class: "size-7 ml-2",
                                                                        strong: "",
                                                                        secondary: "",
                                                                        type: "primary",
                                                                        bordered: "",
                                                                        onClick: a[1] || (a[1] = (p)=>E())
                                                                    }, {
                                                                        icon: o(()=>a[8] || (a[8] = [
                                                                                c("i", {
                                                                                    class: "iconfont icon-Submit"
                                                                                }, null, -1)
                                                                            ])),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: o(()=>[
                                                                    v(u(e(i)("pms.defectList.submitforapproval")), 1)
                                                                ]),
                                                            _: 1
                                                        })) : b("", !0),
                                                        e(t).query.canApprove === "true" && e(t).query.canEdit === "false" && (e(s)?.status === 2 || e(s)?.status === 3) ? (l(), f(d, {
                                                            key: 1,
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: o(()=>[
                                                                    n(m, {
                                                                        class: "size-7 ml-2",
                                                                        strong: "",
                                                                        secondary: "",
                                                                        type: "primary",
                                                                        bordered: "",
                                                                        onClick: a[2] || (a[2] = (p)=>z())
                                                                    }, {
                                                                        icon: o(()=>a[9] || (a[9] = [
                                                                                c("i", {
                                                                                    class: "iconfont icon-Approve"
                                                                                }, null, -1)
                                                                            ])),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: o(()=>[
                                                                    v(u(e(i)("pms.defectList.approve")), 1)
                                                                ]),
                                                            _: 1
                                                        })) : b("", !0),
                                                        e(t).query.canApprove === "true" && e(t).query.canEdit === "false" && (e(s)?.status === 2 || e(s)?.status === 3) ? (l(), f(d, {
                                                            key: 2,
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: o(()=>[
                                                                    n(m, {
                                                                        class: "size-7 ml-2",
                                                                        strong: "",
                                                                        secondary: "",
                                                                        type: "primary",
                                                                        bordered: "",
                                                                        onClick: a[3] || (a[3] = (p)=>B())
                                                                    }, {
                                                                        icon: o(()=>a[10] || (a[10] = [
                                                                                c("i", {
                                                                                    class: "iconfont icon-Returned"
                                                                                }, null, -1)
                                                                            ])),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: o(()=>[
                                                                    v(u(e(i)("pms.defectList.return")), 1)
                                                                ]),
                                                            _: 1
                                                        })) : b("", !0),
                                                        e(t).query.type === "add" || e(t).query.canApprove === "false" && e(t).query.canEdit === "true" && e(t).query.type !== "view" ? (l(), f(d, {
                                                            key: 3,
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: o(()=>[
                                                                    n(m, {
                                                                        class: "size-7 ml-2",
                                                                        strong: "",
                                                                        secondary: "",
                                                                        type: "primary",
                                                                        bordered: "",
                                                                        onClick: a[4] || (a[4] = (p)=>F())
                                                                    }, {
                                                                        icon: o(()=>a[11] || (a[11] = [
                                                                                c("i", {
                                                                                    class: "iconfont icon-Save"
                                                                                }, null, -1)
                                                                            ])),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: o(()=>[
                                                                    v(u(e(i)("pms.defectList.saveText")), 1)
                                                                ]),
                                                            _: 1
                                                        })) : b("", !0),
                                                        e(t).query.type !== "add" ? (l(), f(d, {
                                                            key: 4,
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: o(()=>[
                                                                    n(m, {
                                                                        class: "size-7 ml-2",
                                                                        strong: "",
                                                                        secondary: "",
                                                                        type: "primary",
                                                                        bordered: "",
                                                                        onClick: a[5] || (a[5] = (p)=>j())
                                                                    }, {
                                                                        icon: o(()=>a[12] || (a[12] = [
                                                                                c("i", {
                                                                                    class: "iconfont icon-Log"
                                                                                }, null, -1)
                                                                            ])),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: o(()=>[
                                                                    v(u(e(i)("pms.defectList.history")), 1)
                                                                ]),
                                                            _: 1
                                                        })) : b("", !0)
                                                    ])
                                                ]),
                                            default: o(()=>[
                                                    (l(!0), T(se, null, re(e(R), (p, U)=>(l(), f(G, {
                                                            key: U,
                                                            name: p.name,
                                                            tab: p.tabName,
                                                            disabled: p.disabled,
                                                            "display-directive": "show"
                                                        }, {
                                                            default: o(()=>[
                                                                    (l(), f(ne(p.component), {
                                                                        ref_for: !0,
                                                                        ref_key: "tabComponentRef",
                                                                        ref: _,
                                                                        id: e(t).query.id,
                                                                        defectDetail: e(s),
                                                                        sparePartsList: e(h),
                                                                        type: e(t).query.type,
                                                                        canEdit: e(t).query.canEdit,
                                                                        activeTab: e(t).query.activeTab,
                                                                        onUpdateDefectDetail: H,
                                                                        onGetSparePartsList: M
                                                                    }, null, 40, [
                                                                        "id",
                                                                        "defectDetail",
                                                                        "sparePartsList",
                                                                        "type",
                                                                        "canEdit",
                                                                        "activeTab"
                                                                    ]))
                                                                ]),
                                                            _: 2
                                                        }, 1032, [
                                                            "name",
                                                            "tab",
                                                            "disabled"
                                                        ]))), 128))
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "value"
                                        ])
                                    ]),
                                _: 1
                            }),
                            n(xe, {
                                ref_key: "rejectModalRef",
                                ref: C,
                                busId: e(t).query.id,
                                subModuleCode: e(s).approveFlow || "",
                                defectNo: e(s)?.defectNo,
                                onSuccess: A
                            }, null, 8, [
                                "busId",
                                "subModuleCode",
                                "defectNo"
                            ]),
                            n(e(ge), {
                                ref_key: "approvalHistoryModalRef",
                                ref: L
                            }, null, 512),
                            n(De, {
                                ref_key: "approvalModalRef",
                                ref: I,
                                onSuccess: N
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
    At = ue(Fe, [
        [
            "__scopeId",
            "data-v-0b6cbe56"
        ]
    ]);
});
export { At as default, __tla };
