import { V as R, bk as L, d as W, f as $, a as g, bl as x, a4 as U, Z as h, l as o, cZ as X, aw as Z, c as C, o as y, w as i, j as l, D as z, H, aI as G, p as J, A as D, B as K, i as S, W as Y, h as B, F as tt, a9 as et, X as ot, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as nt } from "./Table-0PViRYCf.js";
import { _ as at } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { h as rt, j as it, f as _, I as T, k as st, __tla as __tla_1 } from "./helper-Ba6EWhr_.js";
import { _ as lt, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-C48sFSkz.js";
import { _ as mt } from "./Flex-CTSf12gq.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./componentMap-CElCaWis.js";
import "./propTypes-CebMRUpe.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./print-CT_2hrjP.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./useModal-CO65vga3.js";
import "./componentSetting-DVhNDBTO.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./tabsView-BXskTdVh.js";
import "./requisitionOrder-D0IG9N7e.js";
import "./BasicForm-dL_oCSPM.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./ImageUpload-DUsnro3W.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-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 "./useForm-CKmgcynv.js";
import "./isNumber-D5aBrEhN.js";
import "./subtract-Dj32RAiL.js";
import "./_createMathOperation-C_MUc_Og.js";
let te;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    L();
    let e, ct, dt, ut;
    ({ t: e } = R());
    ct = ()=>[
            {
                title: e("common.management.Num"),
                key: "num",
                width: 60,
                render: (M, v)=>v + 1
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.rcvdDate"),
                key: "rcvdDate",
                width: 120
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.expiryDate"),
                key: "expiryDate",
                width: 120
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.description"),
                key: "description",
                width: 200
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.unit"),
                key: "unit",
                width: 100
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.initialQtty"),
                key: "initialQuantity",
                width: 140
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.consumed"),
                key: "consumedQuantity",
                width: 140
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.qtty"),
                key: "remainingQuantity",
                width: 140
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.priceUsd"),
                key: "unitPrice",
                width: 140
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.ttlUsd"),
                key: "subtotal",
                width: 140
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.updateBy"),
                key: "updateBy",
                width: 120
            },
            {
                title: e("bondStoreDetail.bondStoreInventory.updateDate"),
                key: "updateTime",
                width: 120
            }
        ];
    dt = {
        class: "text-[16px] text-gray-600"
    };
    ut = {
        class: "text-[16px] font-medium text-[#0EC06A]"
    };
    te = W({
        __name: "index",
        props: {
            summaryData: {}
        },
        emits: [
            "refreshSummary"
        ],
        setup (M, { emit: v }) {
            const { t: a } = R(), N = X(), f = $(), u = g({
                newInventory: {
                    title: a("bondStoreDetail.summaryNewInventory"),
                    count: 0
                },
                consumed: {
                    title: a("bondStoreDetail.summaryConsumed"),
                    count: 0
                },
                sumCount: {
                    title: a("bondStoreDetail.totalName"),
                    count: 0
                }
            }), I = x("tableRef"), w = x("InventoryModal"), p = U(()=>f.query?.type !== "edit"), q = g({
                width: 140,
                title: a("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (t) {
                    return h(at, {
                        style: "text",
                        actions: [
                            {
                                label: a("common.optionsEditText"),
                                labelShow: !1,
                                ifShow: !o(p),
                                icon: h("i", {
                                    class: "iconfont icon-a-Frame28"
                                }),
                                onClick: E.bind(null, {
                                    type: "edit",
                                    record: t
                                })
                            },
                            {
                                label: a("common.delText"),
                                labelShow: !1,
                                ifShow: !o(p) && t.isLastMonthBalance !== 1,
                                icon: h("i", {
                                    class: "iconfont icon-Delete red"
                                }),
                                onPositiveClick: O.bind(null, t),
                                isConfirm: !0,
                                confirmContent: a("common.delPop.contRole")
                            }
                        ]
                    });
                }
            });
            function F() {
                const { shipId: t, year: n, month: r, startDate: m, endDate: c } = f.query;
                return {
                    shipId: t,
                    year: n,
                    month: r,
                    startDate: _(m),
                    endDate: _(c)
                };
            }
            async function V(t, n) {
                try {
                    return await st({
                        ...n,
                        ...t
                    });
                } catch  {
                    return {
                        list: [],
                        total: 0
                    };
                }
            }
            function k() {
                I.value?.restReload();
            }
            function A() {
                w.value?.handleOpenModal();
            }
            function E({ type: t, record: n }) {
                const r = {
                    ...n
                };
                w.value?.handleOpenModal(t, r);
            }
            function O({ id: t }) {
                rt(t).then(()=>{
                    N.success(a("common.optionsDelSuccessText")), k(), b();
                });
            }
            function b() {
                const { year: t, month: n, shipId: r, startDate: m, endDate: c } = f.query;
                it({
                    year: t,
                    month: n,
                    shipId: r,
                    startDate: _(m),
                    endDate: _(c)
                }).then((d)=>{
                    u.sumCount.count = d?.total ?? 0, u.newInventory.count = d?.newInventory ?? 0, u.consumed.count = d?.consumed ?? 0;
                });
            }
            return Z(()=>{
                b();
            }), (t, n)=>{
                const r = K, m = G, c = H, d = mt, P = Y, Q = ot;
                return y(), C(Q, null, {
                    default: i(()=>[
                            l(o(nt), {
                                ref_key: "tableRef",
                                ref: I,
                                columns: o(ct)(),
                                request: (s)=>V(s, F()),
                                "row-key": (s)=>s.id,
                                autoScrollX: !0,
                                actionColumn: !o(p) && !o(T) ? o(q) : void 0,
                                "virtual-scroll": ""
                            }, {
                                toolbar: i(()=>[
                                        !o(p) && !o(T) ? (y(), C(c, {
                                            key: 0
                                        }, {
                                            default: i(()=>[
                                                    l(m, {
                                                        trigger: "hover"
                                                    }, {
                                                        trigger: i(()=>[
                                                                l(r, {
                                                                    type: "primary",
                                                                    strong: "",
                                                                    bordered: "",
                                                                    secondary: "",
                                                                    class: "size-7",
                                                                    onClick: A
                                                                }, {
                                                                    icon: i(()=>n[0] || (n[0] = [
                                                                            S("i", {
                                                                                class: "iconfont icon-ADD"
                                                                            }, null, -1)
                                                                        ])),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        default: i(()=>[
                                                                J(" " + D(o(a)("bondStoreDetail.addBtn")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        })) : z("", !0)
                                    ]),
                                _: 1
                            }, 8, [
                                "columns",
                                "request",
                                "row-key",
                                "actionColumn"
                            ]),
                            l(P, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: i(()=>[
                                        l(d, {
                                            justify: "space-around"
                                        }, {
                                            default: i(()=>[
                                                    (y(!0), B(tt, null, et(o(u), (s, j)=>(y(), B("div", {
                                                            key: j,
                                                            class: "text-[16px]"
                                                        }, [
                                                            S("span", dt, D(s.title) + ": ", 1),
                                                            S("span", ut, D(s.count), 1)
                                                        ]))), 128))
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }),
                            l(lt, {
                                ref: "InventoryModal",
                                summaryData: t.summaryData,
                                onRefresh: k,
                                onRefreshSummary: b
                            }, null, 8, [
                                "summaryData"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { te as default, __tla };
