import { d as U, V as _e, f as ye, r as c, a4 as he, cn as Ce, c_ as be, aw as we, d9 as E, c as l, o as s, w as a, aE as f, j as i, W as xe, h as R, D as y, i as F, T as Ie, l as e, aI as ke, p as v, A as g, B as Te, ca as h, gW as C, gX as b, F as j, iG as Me, iU as Re, aF as G, iV as Fe, X as Se, ac as Be, cZ as Oe, gT as De, gR as Ae, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as Le } from "./BasicForm-dL_oCSPM.js";
import { _ as Ve } from "./OnlyOffice.vue_vue_type_script_setup_true_lang-BH1_y9Dy.js";
import { u as Ne } from "./useTags-C1thGhjF.js";
import { a as ze, u as W, b as $, c as He, p as L, s as Pe } from "./smsFileHistory-3qnGgVom.js";
import { _ as qe, __tla as __tla_1 } from "./index.vue_vue_type_script_setup_true_lang-CJLhb5rA.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./print-CT_2hrjP.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import { __tla as __tla_2 } from "./index.vue_vue_type_style_index_0_scoped_b974e5ec_lang-_0QwzFKM.js";
import { u as Ee } from "./useForm-CKmgcynv.js";
import { H as je, __tla as __tla_3 } from "./index-8tHZJCCW.js";
import "./schemas-BmKi-UM9.js";
import "./props-CLtNejQT.js";
import { a as Ge } from "./schemas-B8iAcMwN.js";
import { h as We } from "./has-CjqcrIOV.js";
import { i as $e } from "./isEmpty-BUg1OsQj.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 "./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 "./event-CLiVQHeO.js";
import "./account-C850CBTF.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./useModal-CO65vga3.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./jobOrder-CGbsc7bp.js";
import "./usePageCache-DluHn7Yy.js";
import "./TimelineItem-Bkds7ZW8.js";
import "./Flex-CTSf12gq.js";
let Zo;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })()
]).then(async ()=>{
    let Ue, Xe, Ze, Je, Ke, Qe, Ye;
    Ue = {
        key: 0,
        class: "flex relative z-20 bg-white items-center"
    };
    Xe = {
        class: "flex-1"
    };
    Ze = {
        class: "flex-1 flex justify-end items-center gap-4"
    };
    Je = {
        key: 0,
        class: "border-t bg-white"
    };
    Ke = {
        class: "flex justify-center absolute w-[97%]"
    };
    Qe = {
        class: "relative z-10 bottom-4 z-0 hover:bottom-0 transition-all duration-200"
    };
    Ye = U({
        name: "smsDetail"
    });
    Zo = U({
        ...Ye,
        setup (eo) {
            const { closeCurrentTabToBack: X, closeCurrentAfterAction: Z } = Ne(), { t: n } = _e(), J = ye(), K = be(), w = Oe(), { schemas: Q } = Ge(), [Y, { setFieldsValue: S }] = Ee({
                gridProps: {
                    cols: 3
                },
                schemas: Q,
                showActionButtonGroup: !1
            }), { id: V, templateId: N, shipId: B, type: u, workPermitId: ee } = J.query, I = c(), z = c(), H = c(), _ = c(!1), p = c(!0), O = c(!0), D = c(!1), A = c(!1), k = c(!1), o = c(), T = c(!1), oe = he(()=>p.value ? "76vh" : "84vh");
            function P() {
                p.value = !p.value, p.value && Be(()=>{
                    o.value && S(o.value);
                });
            }
            async function te() {
                if (!o.value) return;
                const t = await $(V);
                await I.value?.handleInitOffice(t.fileCode, t.id);
            }
            Ce((t, d, r)=>{
                if (console.log("onBeforeRouteLeave", t, d), _.value || [
                    "view"
                ].includes(u)) return r();
                K.warning({
                    title: n("common.confirmText"),
                    content: n("sms.smsTemplate.confirmReturn"),
                    positiveText: n("common.confirmText"),
                    negativeText: n("common.closeText"),
                    draggable: !0,
                    onPositiveClick: ()=>{
                        Z(()=>{
                            r();
                        });
                    },
                    onNegativeClick: ()=>{
                        r(!1);
                    }
                });
            });
            async function ae() {
                try {
                    if (!o.value) return;
                    const t = await He(o.value?.id), d = {
                        templateId: t.templateId,
                        shipId: o.value.shipId,
                        id: o.value.id,
                        fileCode: t.fileCode
                    }, r = await W(d);
                    S(r), await I.value?.handleInitOffice(t.fileCode, r.id, "smsFile"), w.success(n("common.optionsCopySuccessText"));
                } catch (t) {
                    console.log(t);
                }
            }
            async function se() {
                try {
                    if (!o.value) return;
                    if (D.value = !0, _.value = !0, await L(o.value?.id), We(o.value, "subModuleCode") && !$e(o.value.subModuleCode)) {
                        const t = {
                            shipId: o.value.shipId || B,
                            busId: o.value.id,
                            moduleCode: o.value.moduleCode,
                            subModuleCode: o.value.subModuleCode
                        };
                        await De(t);
                    } else await Pe(o.value?.id);
                    w.success(n("common.optionsSuccessText")), x(), D.value = !1;
                } catch  {
                    D.value = !1;
                }
            }
            async function re() {
                try {
                    A.value = !0, w.success(n("common.saveSuccessText")), x(), A.value = !1;
                } catch  {
                    A.value = !1;
                }
            }
            async function ie() {
                try {
                    if (!o.value) return;
                    k.value = !0, _.value = !0;
                    const t = {
                        shipId: o.value.shipId,
                        busId: o.value.id,
                        moduleCode: o.value.moduleCode,
                        subModuleCode: o.value.subModuleCode,
                        comment: "pass"
                    };
                    await L(o.value?.id), await Ae(t), w.success(n("common.optionsSuccessText")), k.value = !1, x();
                } catch  {
                    k.value = !1;
                }
            }
            async function ne() {
                try {
                    if (!o.value) return;
                    _.value = !0;
                    const t = {
                        shipId: o.value.shipId,
                        busId: o.value.id,
                        moduleCode: o.value.moduleCode,
                        subModuleCode: o.value.subModuleCode,
                        comment: "return"
                    };
                    await L(o.value?.id), H.value?.showModal(t);
                } catch  {}
            }
            function le() {
                w.success(n("common.optionsSuccessText")), x();
            }
            function ce() {
                if (!o.value) return;
                const t = {
                    shipId: o.value.shipId,
                    busId: o.value.id,
                    moduleCode: o.value.moduleCode,
                    subModuleCode: o.value.subModuleCode
                };
                z.value?.handleOpenModal(t);
            }
            function ue(t) {
                console.log(t), O.value = !1;
            }
            async function q(t) {
                try {
                    o.value = await $(t), T.value = o.value?.canApprove;
                } catch  {}
            }
            function pe() {
                x();
            }
            we(async ()=>{
                try {
                    if (u === "add") {
                        const t = await ze(N), d = {
                            templateId: Number(N),
                            fileCode: t.fileCode,
                            shipId: B ? Number(B) : void 0,
                            id: ee
                        }, r = await W(d);
                        await q(r.id);
                    } else await q(V);
                    if (!o.value) return;
                    S(o.value), await I.value?.handleInitOffice(o.value.fileCode, o.value.id, "smsFile");
                } catch  {
                    O.value = !1;
                }
            });
            function de() {
                return o.value && o.value.id && o.value.moduleCode;
            }
            function x() {
                try {
                    _.value = !0, X();
                } catch (t) {
                    console.warn("Error closing tab:", t);
                }
            }
            return (t, d)=>{
                const r = Te, m = ke, me = Le, fe = xe, ve = Se, M = E("debounce"), ge = E("loading");
                return s(), l(ve, null, {
                    default: a(()=>[
                            f((s(), l(fe, null, {
                                default: a(()=>[
                                        i(Ie, {
                                            "enter-from-class": "transform -translate-y-5 opacity-0",
                                            "enter-active-class": "transition-all duration-200 ease-out",
                                            "enter-to-class": "transform translate-y-0 opacity-100",
                                            "leave-from-class": "transform translate-y-0 opacity-100",
                                            "leave-active-class": "transition-all duration-200 ease-[cubic-bezier(1,0.5,0.8,1)]",
                                            "leave-to-class": "transform -translate-y-5 opacity-0"
                                        }, {
                                            default: a(()=>[
                                                    e(p) ? (s(), R("div", Ue, [
                                                        i(m, {
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: a(()=>[
                                                                    i(r, {
                                                                        quaternary: "",
                                                                        class: "mr-2",
                                                                        onClick: pe
                                                                    }, {
                                                                        default: a(()=>[
                                                                                (s(), l(h(e(C)(e(b).back, "text-base"))))
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: a(()=>[
                                                                    v(g(e(n)("common.back")), 1)
                                                                ]),
                                                            _: 1
                                                        }),
                                                        F("div", Xe, [
                                                            i(me, {
                                                                onRegister: e(Y)
                                                            }, null, 8, [
                                                                "onRegister"
                                                            ])
                                                        ]),
                                                        F("div", Ze, [
                                                            (e(u) === "add" || e(u) === "edit") && !e(T) ? (s(), R(j, {
                                                                key: 0
                                                            }, [
                                                                i(m, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: a(()=>[
                                                                            f((s(), l(r, {
                                                                                strong: "",
                                                                                secondary: "",
                                                                                type: "primary",
                                                                                class: "pl-[8px] pr-[8px]"
                                                                            }, {
                                                                                icon: a(()=>[
                                                                                        (s(), l(h(e(C)(e(b).save))))
                                                                                    ]),
                                                                                _: 1
                                                                            })), [
                                                                                [
                                                                                    M,
                                                                                    re,
                                                                                    "1000"
                                                                                ]
                                                                            ])
                                                                        ]),
                                                                    default: a(()=>[
                                                                            v(g(e(n)("common.saveText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }),
                                                                i(m, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: a(()=>[
                                                                            f((s(), l(r, {
                                                                                strong: "",
                                                                                secondary: "",
                                                                                type: "primary",
                                                                                class: "pl-[8px] pr-[8px]"
                                                                            }, {
                                                                                icon: a(()=>[
                                                                                        (s(), l(h(e(C)(e(b).submit))))
                                                                                    ]),
                                                                                _: 1
                                                                            })), [
                                                                                [
                                                                                    M,
                                                                                    se,
                                                                                    "300"
                                                                                ]
                                                                            ])
                                                                        ]),
                                                                    default: a(()=>[
                                                                            v(g(e(n)("common.submit")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ], 64)) : e(u) === "approve" && e(T) ? (s(), R(j, {
                                                                key: 1
                                                            }, [
                                                                i(m, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: a(()=>[
                                                                            f((s(), l(r, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                secondary: "",
                                                                                loading: e(k),
                                                                                class: "pl-[8px] pr-[8px]"
                                                                            }, {
                                                                                icon: a(()=>[
                                                                                        (s(), l(h(e(C)(e(b).approve))))
                                                                                    ]),
                                                                                _: 1
                                                                            }, 8, [
                                                                                "loading"
                                                                            ])), [
                                                                                [
                                                                                    M,
                                                                                    ie,
                                                                                    "1000"
                                                                                ]
                                                                            ])
                                                                        ]),
                                                                    default: a(()=>[
                                                                            v(" " + g(e(n)("common.optionsApproveText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }),
                                                                i(m, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: a(()=>[
                                                                            i(r, {
                                                                                strong: "",
                                                                                secondary: "",
                                                                                type: "primary",
                                                                                class: "pl-[8px] pr-[8px]",
                                                                                onClick: ne
                                                                            }, {
                                                                                icon: a(()=>[
                                                                                        (s(), l(h(e(C)(e(b).returned))))
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: a(()=>[
                                                                            v(g(e(n)("common.optionsReturnText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ], 64)) : y("", !0),
                                                            de() ? (s(), l(m, {
                                                                key: 2,
                                                                trigger: "hover"
                                                            }, {
                                                                trigger: a(()=>[
                                                                        i(r, {
                                                                            strong: "",
                                                                            secondary: "",
                                                                            type: "primary",
                                                                            class: "pl-[8px] pr-[8px]",
                                                                            onClick: ce
                                                                        }, {
                                                                            icon: a(()=>[
                                                                                    (s(), l(h(e(C)(e(b).log))))
                                                                                ]),
                                                                            _: 1
                                                                        })
                                                                    ]),
                                                                default: a(()=>[
                                                                        v(g(e(n)("common.reviewHistory")), 1)
                                                                    ]),
                                                                _: 1
                                                            })) : y("", !0),
                                                            (e(u) === "add" || e(u) === "edit") && !e(T) ? (s(), l(m, {
                                                                key: 3,
                                                                trigger: "hover"
                                                            }, {
                                                                trigger: a(()=>[
                                                                        f((s(), l(r, {
                                                                            strong: "",
                                                                            secondary: "",
                                                                            type: "primary",
                                                                            class: "pl-[8px] pr-[8px]"
                                                                        }, {
                                                                            icon: a(()=>[
                                                                                    i(e(Me))
                                                                                ]),
                                                                            _: 1
                                                                        })), [
                                                                            [
                                                                                M,
                                                                                ae,
                                                                                "300"
                                                                            ]
                                                                        ])
                                                                    ]),
                                                                default: a(()=>[
                                                                        v(g(e(n)("sms.smsTemplate.copyLastForm")), 1)
                                                                    ]),
                                                                _: 1
                                                            })) : y("", !0)
                                                        ])
                                                    ])) : y("", !0)
                                                ]),
                                            _: 1
                                        }),
                                        e(p) ? (s(), R("div", Je)) : y("", !0),
                                        F("div", Ke, [
                                            F("div", Qe, [
                                                f(i(r, {
                                                    class: "relative w-10 h-10",
                                                    text: "",
                                                    onClick: P
                                                }, {
                                                    icon: a(()=>[
                                                            i(e(Re), {
                                                                class: "relative size-8 z-0"
                                                            })
                                                        ]),
                                                    _: 1
                                                }, 512), [
                                                    [
                                                        G,
                                                        !e(p)
                                                    ]
                                                ]),
                                                f(i(r, {
                                                    text: "",
                                                    class: "relative w-10 h-10",
                                                    onClick: P
                                                }, {
                                                    icon: a(()=>[
                                                            i(e(Fe))
                                                        ]),
                                                    _: 1
                                                }, 512), [
                                                    [
                                                        G,
                                                        e(p)
                                                    ]
                                                ])
                                            ])
                                        ]),
                                        e(_) ? y("", !0) : (s(), l(e(Ve), {
                                            key: 1,
                                            ref_key: "onlyOfficeRef",
                                            ref: I,
                                            height: e(oe),
                                            mode: e(u) !== "view" && e(o)?.status !== 4 ? "edit" : "view",
                                            onOnInfo: ue,
                                            onOnRequestRefreshFile: te
                                        }, null, 8, [
                                            "height",
                                            "mode"
                                        ]))
                                    ]),
                                _: 1
                            })), [
                                [
                                    ge,
                                    e(O)
                                ]
                            ]),
                            i(e(je), {
                                ref_key: "approvalHistoryModalRef",
                                ref: z
                            }, null, 512),
                            i(e(qe), {
                                ref_key: "returnModalRef",
                                ref: H,
                                onSuccess: le
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Zo as default, __tla };
