const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Bpj6JYQU.js","assets/index-9PRMimni.js","assets/index-CZ_CrH4_.css","assets/BasicForm-dL_oCSPM.js","assets/Render.vue_vue_type_script_lang-DKUYY0Zw.js","assets/SingleImageUpload-CNx4b9eC.js","assets/ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js","assets/componentSetting-DVhNDBTO.js","assets/ImageUpload-2O79x_Q-.css","assets/ImageUpload-DUsnro3W.js","assets/vuedraggable.umd-Co2xEC3p.js","assets/BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js","assets/BasicUpload-q2aOClOy.css","assets/tabsView-BXskTdVh.js","assets/BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js","assets/propTypes-CebMRUpe.js","assets/BasicForm-foIylFd_.css","assets/BasicSelect-C_uwzMkE.js","assets/BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js","assets/BasicSelect-DteQK1Vf.css","assets/dictionary-BRse4lkf.js","assets/index-DkvzUEqh.js","assets/index-kKnqLkWM.js","assets/AutoComplete-Dv1Bqed4.js","assets/TreeSelect-BZh2DeCh.js","assets/useForm-CKmgcynv.js","assets/usePageCache-DluHn7Yy.js","assets/helper-DaqlySQD.js","assets/memoize-C3Z21RQJ.js","assets/template-rpthWlT9.js","assets/equipmentMainLibrary-bJTzj5mC.js","assets/find-D_h_aJYR.js","assets/findIndex-BgUIH3i1.js","assets/toInteger-DQeH-nF-.js","assets/head-aneRfQQJ.js","assets/index-D1zCXVS9.js","assets/Table-0PViRYCf.js","assets/Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js","assets/componentMap-CElCaWis.js","assets/format-DgF6KtHk.js","assets/omit-B2_8Y6O_.js","assets/_flatRest-DBrd2CHT.js","assets/flatten-DeoUZLdb.js","assets/Table-Dcnz4X4a.css","assets/print-CT_2hrjP.js","assets/basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js","assets/basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js","assets/basicModal-DbyYhys_.css","assets/useModal-CO65vga3.js","assets/useTimeout-BxFilWvD.js","assets/Flex-CTSf12gq.js","assets/TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js","assets/jobPlanDetails-5wu16ZE_.js","assets/index.vue_vue_type_script_setup_true_lang-D9a4EZYr.js","assets/pick-Cg3anC-c.js","assets/index-DC_uNcqm.js","assets/index.vue_vue_type_script_setup_true_lang-DX4KqILq.js","assets/index.vue_vue_type_script_setup_true_lang-CY7gkyew.js","assets/index-C12gGJKx.js","assets/helper-CaePX3tj.js"])))=>i.map(i=>d[i]);
import { d as Z, eV as K, f as Q, e as ee, a4 as te, r as A, bl as I, a as ae, hO as h, ec as v, br as C, aw as oe, c as d, o as n, w as t, h as R, l as a, F as k, j as s, W as se, H as ne, i as re, aI as ie, p, A as b, B as le, ca as y, gW as w, gX as D, D as F, x as de, ds as me, a9 as ue, y as ce, hP as pe, cC as _e, X as be, cZ as fe, gT as ye, ac as O, __tla as __tla_0 } from "./index-9PRMimni.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 ge } from "./useTags-C1thGhjF.js";
import { __tla as __tla_1 } 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 Pe, __tla as __tla_2 } from "./index-8tHZJCCW.js";
import "./schemas-BmKi-UM9.js";
import "./props-CLtNejQT.js";
import { _ as he } from "./index.vue_vue_type_script_setup_true_lang-BQyS96s7.js";
import { P as ve, I as B } from "./helper-CaePX3tj.js";
import { q as Ce, s as we, r as De } from "./jobPlanDetails-5wu16ZE_.js";
import { h as je } from "./head-aneRfQQJ.js";
import { o as Ie } from "./omit-B2_8Y6O_.js";
import { p as Re } from "./pick-Cg3anC-c.js";
import "./componentSetting-DVhNDBTO.js";
import "./propTypes-CebMRUpe.js";
import "./index-kKnqLkWM.js";
import "./tabsView-BXskTdVh.js";
import "./jobOrder-CGbsc7bp.js";
import "./has-CjqcrIOV.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./useModal-CO65vga3.js";
import "./TimelineItem-Bkds7ZW8.js";
import "./Flex-CTSf12gq.js";
import "./BasicForm-dL_oCSPM.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload-DUsnro3W.js";
import "./BasicSelect-C_uwzMkE.js";
import "./dictionary-BRse4lkf.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./useForm-CKmgcynv.js";
import "./usePageCache-DluHn7Yy.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
let Ct;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    let ke;
    ke = {
        class: "text-[18px]",
        style: {
            fontWeight: "var(--n-title-font-weight)"
        }
    };
    Ct = Z({
        __name: "index",
        setup (Ne) {
            const { t: m } = K(), { closeCurrent: L } = ge(), f = Q(), N = ee(), x = fe(), M = te(()=>f.query?.type === ve.VIEW), c = A(!1), T = I("historyModal"), E = I("submitModal"), g = A("jobDetails"), z = I("jobDetailsRef"), l = ae({
                jobDetails: {
                    meta: {
                        title: "jobPlan.viewDetails.jobDetails"
                    },
                    data: {},
                    refName: "jobDetailsRef",
                    component: h(v(()=>C(()=>import("./index-Bpj6JYQU.js").then(async (m)=>{
                                await m.__tla;
                                return m;
                            }), __vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]))))
                },
                procedures: {
                    meta: {
                        title: "jobPlan.viewDetails.procedures"
                    },
                    data: {},
                    refName: "proceduresRef",
                    component: h(v(()=>C(()=>import("./index-D1zCXVS9.js"), __vite__mapDeps([35,1,2,36,37,10,4,38,15,39,40,41,42,43,44,45,46,47,48,7,49,26,13,50,51,52,53,3,5,6,8,9,11,12,14,16,17,18,19,20,21,22,23,24,25,54]))))
                },
                spareParts: {
                    meta: {
                        title: "jobPlan.viewDetails.spareParts"
                    },
                    data: {},
                    refName: "sparePartsRef",
                    component: h(v(()=>C(()=>import("./index-DC_uNcqm.js"), __vite__mapDeps([55,1,2,52,36,37,10,4,38,15,39,40,41,42,43,44,45,46,47,48,7,49,26,13,50,51,56,3,5,6,8,9,11,12,14,16,17,18,19,20,21,22,23,24,25,54,34,57]))))
                },
                attachment: {
                    meta: {
                        title: "jobPlan.viewDetails.attachment"
                    },
                    data: {},
                    refName: "attachmentRef",
                    component: h(v(()=>C(()=>import("./index-C12gGJKx.js"), __vite__mapDeps([58,1,2,7,52,59,54,41,42]))))
                }
            });
            function J() {
                T.value?.handleOpenModal();
            }
            async function q(e = !0) {
                try {
                    c.value = !0, g.value = "jobDetails";
                    const o = je(a(z)), { submit: r } = o?.methods, u = await r();
                    if (!u) return c.value = !1, Promise.reject("Form validation failed");
                    const i = l.jobDetails.data, P = Ie(i.newPlan, o?.getFields() || []), S = {
                        oldProductCode: i.newPlan?.equipmentCode,
                        oldSerialNumber: i.newPlan?.serialNumber,
                        oldModel: i.newPlan?.model
                    };
                    B || await Ce({
                        ...P,
                        ...u,
                        busId: i.busId
                    }), e !== !1 && x.success(m("common.saveSuccessText"));
                } catch (o) {
                    Promise.reject(o);
                } finally{
                    c.value = !1;
                }
            }
            async function W() {
                try {
                    await q(!1);
                } catch (e) {
                    console.error("Error during save before submit:", e);
                    return;
                }
                E.value?.handleOpenModal();
            }
            async function H({ adjustedContent: e } = {}, o) {
                c.value = !0;
                const r = l.jobDetails.data, u = Re(r, [
                    "shipId",
                    "busId",
                    "moduleCode",
                    "subModuleCode",
                    "busNo"
                ]);
                try {
                    await we({
                        planId: r?.newPlan?.planId,
                        adjustedContent: e
                    }), await ye({
                        ...u
                    }), x.success(m("common.submitSuccessText")), o?.(), j();
                } catch (i) {
                    console.error(i);
                } finally{
                    c.value = !1;
                }
            }
            function j() {
                const e = "PMS_jobPlan", o = f.query?.sourceRouteName;
                try {
                    L(), o && O(()=>{
                        N.replace({
                            name: o
                        });
                    });
                } catch (r) {
                    console.warn("Error closing tab:", r), O(()=>{
                        N.replace({
                            name: e
                        });
                    });
                }
            }
            async function $() {
                if (!f.query.id) return;
                const e = await De(f.query.id);
                l.jobDetails.data = e, l.procedures.data = {
                    shipId: e.shipId,
                    serialNumber: e.newPlan?.serialNumber,
                    jobCode: e.newPlan?.jobCode,
                    model: e.newPlan?.model,
                    productCode: e.newPlan?.equipmentCode
                }, l.spareParts.data = {
                    shipId: e.shipId,
                    serialNumber: e.newPlan?.serialNumber,
                    productCode: e.newPlan?.equipmentCode,
                    model: e.newPlan?.model,
                    jobCode: e.newPlan?.jobCode,
                    belongToModel: e.newPlan?.belongToModel
                }, l.attachment.data = {
                    shipId: e.shipId,
                    serialNumber: e.newPlan?.serialNumber,
                    productCode: e.newPlan?.equipmentCode,
                    model: e.newPlan?.model,
                    jobCode: e.newPlan?.jobCode
                };
            }
            return oe(()=>{
                $();
            }), (e, o)=>{
                const r = le, u = ie, i = ne, P = se, S = ce, G = de, X = _e, U = be;
                return n(), d(U, null, {
                    default: t(()=>[
                            a(f).query.id ? (n(), R(k, {
                                key: 0
                            }, [
                                s(P, {
                                    bordered: !1,
                                    class: "proCard"
                                }, {
                                    default: t(()=>[
                                            s(i, {
                                                justify: "space-between"
                                            }, {
                                                default: t(()=>[
                                                        s(i, null, {
                                                            default: t(()=>[
                                                                    s(u, {
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: t(()=>[
                                                                                s(r, {
                                                                                    type: "text",
                                                                                    class: "size-7",
                                                                                    onClick: j
                                                                                }, {
                                                                                    icon: t(()=>[
                                                                                            (n(), d(y(a(w)(a(D).back, "text-[14px]"))))
                                                                                        ]),
                                                                                    _: 1
                                                                                })
                                                                            ]),
                                                                        default: t(()=>[
                                                                                p(" " + b(a(m)("common.backText")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    }),
                                                                    re("h1", ke, b(a(m)("common.menu.jobPlanEdit")), 1)
                                                                ]),
                                                            _: 1
                                                        }),
                                                        s(i, null, {
                                                            default: t(()=>[
                                                                    a(M) ? F("", !0) : (n(), R(k, {
                                                                        key: 0
                                                                    }, [
                                                                        a(B) ? F("", !0) : (n(), d(u, {
                                                                            key: 0,
                                                                            trigger: "hover"
                                                                        }, {
                                                                            trigger: t(()=>[
                                                                                    s(r, {
                                                                                        type: "primary",
                                                                                        strong: "",
                                                                                        bordered: "",
                                                                                        secondary: "",
                                                                                        class: "size-7",
                                                                                        onClick: W,
                                                                                        disabled: a(c)
                                                                                    }, {
                                                                                        icon: t(()=>[
                                                                                                (n(), d(y(a(w)(a(D).submit, "text-[#0ec06a]"))))
                                                                                            ]),
                                                                                        _: 1
                                                                                    }, 8, [
                                                                                        "disabled"
                                                                                    ])
                                                                                ]),
                                                                            default: t(()=>[
                                                                                    p(" " + b(a(m)("common.submit")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        })),
                                                                        s(u, {
                                                                            trigger: "hover"
                                                                        }, {
                                                                            trigger: t(()=>[
                                                                                    s(r, {
                                                                                        type: "primary",
                                                                                        strong: "",
                                                                                        bordered: "",
                                                                                        secondary: "",
                                                                                        class: "size-7",
                                                                                        onClick: q,
                                                                                        disabled: a(c)
                                                                                    }, {
                                                                                        icon: t(()=>[
                                                                                                (n(), d(y(a(w)(a(D).save, "text-[#0ec06a]"))))
                                                                                            ]),
                                                                                        _: 1
                                                                                    }, 8, [
                                                                                        "disabled"
                                                                                    ])
                                                                                ]),
                                                                            default: t(()=>[
                                                                                    p(" " + b(a(m)("common.saveText")), 1)
                                                                                ]),
                                                                            _: 1
                                                                        })
                                                                    ], 64)),
                                                                    s(u, {
                                                                        trigger: "hover"
                                                                    }, {
                                                                        trigger: t(()=>[
                                                                                s(r, {
                                                                                    type: "primary",
                                                                                    strong: "",
                                                                                    bordered: "",
                                                                                    secondary: "",
                                                                                    class: "size-7",
                                                                                    onClick: J
                                                                                }, {
                                                                                    icon: t(()=>[
                                                                                            (n(), d(y(a(w)(a(D).log, "text-[#0ec06a]"))))
                                                                                        ]),
                                                                                    _: 1
                                                                                })
                                                                            ]),
                                                                        default: t(()=>[
                                                                                p(" " + b(a(m)("jobPlan.viewDetails.history")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                _: 1
                                            })
                                        ]),
                                    _: 1
                                }),
                                s(P, {
                                    bordered: !1,
                                    class: "proCard mt-2"
                                }, {
                                    default: t(()=>[
                                            s(G, {
                                                value: a(g),
                                                "onUpdate:value": o[0] || (o[0] = (_)=>me(g) ? g.value = _ : null),
                                                animated: ""
                                            }, {
                                                default: t(()=>[
                                                        (n(!0), R(k, null, ue(l, (_, V, Y)=>(n(), d(S, {
                                                                key: V,
                                                                name: V,
                                                                tab: a(m)(_.meta?.title),
                                                                "display-directive": Y === 0 ? "show" : "if"
                                                            }, {
                                                                default: t(()=>[
                                                                        (n(), d(pe, null, {
                                                                            default: t(()=>[
                                                                                    (n(), d(y(_.component), {
                                                                                        class: "mt-2",
                                                                                        ref_for: !0,
                                                                                        ref: _.refName,
                                                                                        data: _.data,
                                                                                        isReadonly: a(M)
                                                                                    }, null, 8, [
                                                                                        "data",
                                                                                        "isReadonly"
                                                                                    ]))
                                                                                ]),
                                                                            fallback: t(()=>o[1] || (o[1] = [
                                                                                    p(" loading... ")
                                                                                ])),
                                                                            _: 2
                                                                        }, 1024))
                                                                    ]),
                                                                _: 2
                                                            }, 1032, [
                                                                "name",
                                                                "tab",
                                                                "display-directive"
                                                            ]))), 128))
                                                    ]),
                                                _: 1
                                            }, 8, [
                                                "value"
                                            ]),
                                            s(a(Pe), {
                                                ref_key: "historyModal",
                                                ref: T,
                                                busId: l.jobDetails.data?.busId,
                                                moduleCode: l.jobDetails.data?.moduleCode,
                                                subModuleCode: l.jobDetails.data?.subModuleCode
                                            }, null, 8, [
                                                "busId",
                                                "moduleCode",
                                                "subModuleCode"
                                            ]),
                                            s(he, {
                                                ref_key: "submitModal",
                                                ref: E,
                                                onSubmit: H
                                            }, null, 512)
                                        ]),
                                    _: 1
                                })
                            ], 64)) : (n(), d(X, {
                                key: 1,
                                size: "huge"
                            }, {
                                extra: t(()=>[
                                        s(r, {
                                            type: "primary",
                                            onClick: j
                                        }, {
                                            default: t(()=>[
                                                    p(b(a(m)("common.back")), 1)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                default: t(()=>[
                                        o[2] || (o[2] = p(" Required parameters are missing. Please provide the necessary query parameters (e.g. id) and try again. "))
                                    ]),
                                _: 1
                            }))
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Ct as default, __tla };
