const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BzAgBSsB.js","assets/index-9PRMimni.js","assets/index-CZ_CrH4_.css","assets/Table-0PViRYCf.js","assets/Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js","assets/vuedraggable.umd-Co2xEC3p.js","assets/Render.vue_vue_type_script_lang-DKUYY0Zw.js","assets/componentMap-CElCaWis.js","assets/propTypes-CebMRUpe.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/componentSetting-DVhNDBTO.js","assets/useTimeout-BxFilWvD.js","assets/usePageCache-DluHn7Yy.js","assets/tabsView-BXskTdVh.js","assets/Flex-CTSf12gq.js","assets/TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js","assets/helper-Ba6EWhr_.js","assets/requisitionOrder-D0IG9N7e.js","assets/index.vue_vue_type_script_setup_true_lang-jEFBIquH.js","assets/BasicForm-dL_oCSPM.js","assets/SingleImageUpload-CNx4b9eC.js","assets/ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js","assets/ImageUpload-2O79x_Q-.css","assets/ImageUpload-DUsnro3W.js","assets/BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js","assets/BasicUpload-q2aOClOy.css","assets/BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.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/isNumber-D5aBrEhN.js","assets/includes-DdMWPj0t.js","assets/toInteger-DQeH-nF-.js","assets/index-BMR18U5s.js","assets/index.vue_vue_type_script_setup_true_lang-C48sFSkz.js","assets/subtract-Dj32RAiL.js","assets/_createMathOperation-C_MUc_Og.js"])))=>i.map(i=>d[i]);
import { V as E, bk as G, d as $, e as z, f as H, a4 as U, r as h, hO as P, ec as k, br as w, aw as X, c as b, o as u, w as t, j as n, W as Z, H as J, D as K, i as C, aI as Q, p as g, A as S, l as a, B as Y, x as ee, ds as te, h as oe, F as ae, a9 as ne, y as se, hP as re, ca as le, X as ie, ac as T, c_ as ce, cZ as me, __tla as __tla_0 } from "./index-9PRMimni.js";
import { u as ue } from "./useTags-C1thGhjF.js";
import { B as pe } from "./BasicForm-dL_oCSPM.js";
import { u as de } from "./useForm-CKmgcynv.js";
import { v as _e, m as be, I as fe, u as De, l as ye, n as he, f as D, __tla as __tla_1 } from "./helper-Ba6EWhr_.js";
import { h as ge } from "./head-aneRfQQJ.js";
import { o as F } from "./omit-B2_8Y6O_.js";
import "./tabsView-BXskTdVh.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 "./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 "./usePageCache-DluHn7Yy.js";
import "./requisitionOrder-D0IG9N7e.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
let Qe;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    let I, s, Se, ve;
    I = G();
    ({ t: s } = E());
    Se = ()=>[
            {
                field: "shipId",
                component: "NSelect",
                label: s("bondStoreDetail.vessel"),
                componentProps: {
                    placeholder: s("bondStoreDetail.vessel"),
                    labelField: I.getLocale === "en" ? "labelEn" : "label",
                    options: _e
                }
            },
            {
                field: "month",
                component: "NSelect",
                label: s("bondStoreDetail.month"),
                componentProps: {
                    labelField: I.getLocale === "en" ? "labelEn" : "label",
                    placeholder: s("bondStoreDetail.month"),
                    options: be
                }
            },
            {
                field: "startDate",
                component: "NDatePicker",
                label: s("bondStoreDetail.startDate"),
                componentProps: {
                    type: "date",
                    valueFormat: "yyyy-MM-dd",
                    placeholder: s("bondStoreDetail.startDate")
                }
            },
            {
                field: "endDate",
                component: "NDatePicker",
                label: s("bondStoreDetail.endDate"),
                componentProps: {
                    type: "date",
                    valueFormat: "yyyy-MM-dd",
                    placeholder: s("bondStoreDetail.endDate")
                }
            },
            {
                field: "lastMonthBalance",
                component: "NInput",
                label: s("bondStoreDetail.balanceFromLastMonth"),
                componentProps: {
                    placeholder: s("bondStoreDetail.balanceFromLastMonth")
                }
            }
        ];
    ve = {
        class: "text-[18px]",
        style: {
            fontWeight: "var(--n-title-font-weight)"
        }
    };
    Qe = $({
        __name: "index",
        setup (Ne) {
            const { t: r } = E(), { closeCurrent: M } = ue(), v = me(), N = z(), l = H(), L = U(()=>l.query?.type !== "edit"), f = h({
                consumed: 0,
                lastMonthBalance: 0,
                purchased: 0,
                importLastMonthBalanceEnable: 0,
                availableBalance: 0
            }), B = h([
                {
                    name: "bondStoreDetails",
                    meta: {
                        title: "bondStoreDetail.bondStoreDetails.tabName"
                    },
                    refName: "detailsRef",
                    component: P(k(()=>w(()=>import("./index-BzAgBSsB.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,35,36,37,38,39,40,41,42,43,44,45,46,47,48]))))
                },
                {
                    name: "bondStoreInventory",
                    meta: {
                        title: "bondStoreDetail.bondStoreInventory.tabName"
                    },
                    refName: "inventoryRef",
                    component: P(k(()=>w(()=>import("./index-BMR18U5s.js").then(async (m)=>{
                                await m.__tla;
                                return m;
                            }), __vite__mapDeps([49,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,50,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,51,52]))))
                }
            ]), y = h(ge(B.value)?.name), [A, { setFieldsValue: q }] = de({
                gridProps: {
                    cols: 6
                },
                schemas: Se(),
                showAdvancedButton: !1
            });
            function R() {
                const e = l.query?.sourceRouteName || "bondStore";
                try {
                    M(), T(()=>{
                        N.replace({
                            name: e,
                            query: {
                                ...F(l.query, [
                                    "sourceRouteName"
                                ])
                            }
                        });
                    });
                } catch (o) {
                    console.warn("Error closing tab:", o), T(()=>{
                        N.replace({
                            name: e,
                            query: {
                                ...F(l.query, [
                                    "sourceRouteName"
                                ])
                            }
                        });
                    });
                }
            }
            function O() {
                ce().warning({
                    title: r("bondStoreDetail.submitTips.title"),
                    content: r("bondStoreDetail.submitTips.content"),
                    positiveText: r("bondStoreDetail.submitTips.confirmText"),
                    negativeText: r("bondStoreDetail.submitTips.cancelText"),
                    onPositiveClick: ()=>{
                        const { id: i } = l.query;
                        De({
                            id: i,
                            status: "Accounts Closed"
                        }).then((e)=>{
                            const o = ye.getLocale === "en" ? "tipNameEn" : "tipName";
                            e?.hasOwnProperty(o) && e[o] !== null ? v.warning(e[o]) : (v.success(r("bondStoreDetail.submitTips.closingAccountsSuccess")), R());
                        });
                    },
                    onNegativeClick: ()=>{}
                });
            }
            async function x() {
                const { shipId: i, year: e, month: o, startDate: p, endDate: d } = l.query;
                await he({
                    shipId: i,
                    year: e,
                    month: o,
                    startDate: D(p),
                    endDate: D(d)
                }).then((m)=>{
                    Object.keys(m).forEach((_)=>{
                        f.value?.hasOwnProperty(_) && (f.value[_] = m?.[_] || 0);
                    });
                });
            }
            async function V() {
                await x();
                const { shipId: i, month: e, startDate: o, endDate: p } = l.query;
                q({
                    shipId: Number(i),
                    month: e,
                    startDate: D(o),
                    endDate: D(p),
                    lastMonthBalance: f.value.lastMonthBalance
                });
            }
            return X(()=>{
                V();
            }), (i, e)=>{
                const o = Y, p = Q, d = J, m = Z, _ = se, W = ee, j = ie;
                return u(), b(j, null, {
                    default: t(()=>[
                            n(m, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: t(()=>[
                                        n(d, {
                                            justify: "space-between"
                                        }, {
                                            default: t(()=>[
                                                    n(d, null, {
                                                        default: t(()=>[
                                                                n(p, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: t(()=>[
                                                                            n(o, {
                                                                                type: "text",
                                                                                class: "size-8",
                                                                                onClick: R
                                                                            }, {
                                                                                icon: t(()=>e[1] || (e[1] = [
                                                                                        C("i", {
                                                                                            class: "iconfont icon-a-shangyibu2 text-[16px]"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: t(()=>[
                                                                            g(" " + S(a(r)("common.backToList")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }),
                                                                C("div", ve, S(a(r)("bondStoreDetail.title")), 1)
                                                            ]),
                                                        _: 1
                                                    }),
                                                    !a(L) && !a(fe) ? (u(), b(d, {
                                                        key: 0
                                                    }, {
                                                        default: t(()=>[
                                                                n(o, {
                                                                    type: "primary",
                                                                    onClick: O
                                                                }, {
                                                                    default: t(()=>[
                                                                            g(S(a(r)("bondStoreDetail.closingAccounts")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    })) : K("", !0)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }),
                            n(m, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: t(()=>[
                                        n(a(pe), {
                                            onRegister: a(A),
                                            disabled: "",
                                            showActionButtonGroup: !1,
                                            "show-feedback": !1
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            n(m, {
                                bordered: !1,
                                class: "proCard mt-2 pt-2"
                            }, {
                                default: t(()=>[
                                        n(W, {
                                            animated: "",
                                            "tab-class": "text-[16px]",
                                            "tab-style": {
                                                fontWeight: "var(--n-title-font-weight)"
                                            },
                                            value: a(y),
                                            "onUpdate:value": e[0] || (e[0] = (c)=>te(y) ? y.value = c : null)
                                        }, {
                                            default: t(()=>[
                                                    (u(!0), oe(ae, null, ne(a(B), (c)=>(u(), b(_, {
                                                            key: c.name,
                                                            name: c.name,
                                                            tab: a(r)(c.meta?.title)
                                                        }, {
                                                            default: t(()=>[
                                                                    (u(), b(re, null, {
                                                                        default: t(()=>[
                                                                                (u(), b(le(c.component), {
                                                                                    class: "mt-2",
                                                                                    ref_for: !0,
                                                                                    ref: c.refName,
                                                                                    summaryData: a(f),
                                                                                    onRefreshSummary: x
                                                                                }, null, 40, [
                                                                                    "summaryData"
                                                                                ]))
                                                                            ]),
                                                                        fallback: t(()=>e[2] || (e[2] = [
                                                                                g("loading...")
                                                                            ])),
                                                                        _: 2
                                                                    }, 1024))
                                                                ]),
                                                            _: 2
                                                        }, 1032, [
                                                            "name",
                                                            "tab"
                                                        ]))), 128))
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "value"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Qe as default, __tla };
