import { V as w, bk as x, Z as c, d as U, e as X, f as A, bl as k, r as y, a as Q, aw as j, c as h, o as C, w as l, j as i, W as G, l as r, H as Z, D as J, aI as K, p as Y, A as ee, B as te, ca as oe, gW as ae, gX as re, X as ne, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as ie } from "./BasicForm-dL_oCSPM.js";
import { u as le } from "./useForm-CKmgcynv.js";
import { B as se } from "./Table-0PViRYCf.js";
import { _ as ce } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { m as me } from "./materialsStock-DZo3mecL.js";
import { _ as pe, __tla as __tla_1 } from "./index.vue_vue_type_script_setup_true_lang-DVVCk9Nn.js";
import { _ as ue, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-MXAH-eeY.js";
import { v as de, r as fe, f as E, c as T, C as V, _ as ke, a as ye, __tla as __tla_3 } from "./index.vue_vue_type_script_setup_true_lang-CUfCd99z.js";
import { i as be } 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 "./vuedraggable.umd-Co2xEC3p.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 "./usePageCache-DluHn7Yy.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./componentMap-CElCaWis.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 "./useTimeout-BxFilWvD.js";
import "./Flex-CTSf12gq.js";
import "./storageLocation-CpgPSQOH.js";
import "./material-Fe1jAspV.js";
import "./requisitionListPage-CxtdksCl.js";
import "./find-D_h_aJYR.js";
import "./findIndex-BgUIH3i1.js";
import "./toInteger-DQeH-nF-.js";
import "./some-vU4SVDLd.js";
import "./head-aneRfQQJ.js";
import "./pick-Cg3anC-c.js";
import "./equipmentMainLibrary-bJTzj5mC.js";
import "./requisitionOrder-D0IG9N7e.js";
let bt;
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 b, o, Se, S, n, _e;
    b = x();
    ({ t: o } = w());
    Se = ({ cascadeOptions: s })=>[
            {
                field: "shipId",
                component: "NSelect",
                label: o("materialsStock.vessel"),
                componentProps: {
                    style: {
                        width: "100%"
                    },
                    placeholder: o("materialsStock.vessel"),
                    labelField: b.getLocale === "en" ? "labelEn" : "label",
                    options: de
                }
            },
            {
                field: "codeOrName",
                component: "NInput",
                label: o("materialsStock.itemCodeName"),
                componentProps: {
                    placeholder: o("materialsStock.itemCodeName")
                }
            },
            {
                field: "category",
                component: "NSelect",
                label: o("materialsStock.category"),
                componentProps: ({ model: e })=>({
                        labelField: b.getLocale === "en" ? "labelEn" : "label",
                        placeholder: o("materialsStock.category"),
                        options: s.category.value,
                        onUpdateValue: async (t)=>{
                            e.subCategory = null, e.sectionCode = null, s.subCategory.value = t ? await E({
                                category: t
                            }) : [];
                        }
                    })
            },
            {
                field: "subCategory",
                component: "NSelect",
                label: o("materialsStock.subCategory"),
                componentProps: ({ model: e })=>({
                        labelField: b.getLocale === "en" ? "labelEn" : "label",
                        placeholder: o("materialsStock.subCategory"),
                        options: s.subCategory.value,
                        onUpdateValue: async (t)=>{
                            e.sectionCode = null, s.section.value = t ? await E({
                                category: e.category,
                                subCategory: t
                            }) : [];
                        }
                    })
            },
            {
                field: "sectionCode",
                component: "NSelect",
                label: o("materialsStock.section"),
                componentProps: {
                    labelField: b.getLocale === "en" ? "labelEn" : "label",
                    placeholder: o("materialsStock.section"),
                    options: s.section
                }
            },
            {
                field: "rob",
                component: "BasicSelect",
                label: o("materialsStock.rob"),
                componentProps: {
                    style: {
                        width: "100%"
                    },
                    placeholder: o("materialsStock.rob"),
                    options: fe
                }
            }
        ];
    S = x();
    ({ t: n } = w());
    _e = (s)=>[
            {
                title: "No.",
                key: "num",
                width: 60,
                render: (e, t)=>t + 1
            },
            {
                title: n("materialsStock.vessel"),
                key: "shipId",
                width: 160,
                render: (e)=>S.getLocale === "en" ? e.shipNameEn : e.shipName
            },
            {
                title: n("materialsStock.category"),
                key: "category",
                width: 180,
                render: (e)=>S.getLocale === "en" ? e.categoryLabelEn : e.categoryLabel
            },
            {
                title: n("materialsStock.itemCode"),
                key: "itemCode",
                width: 140
            },
            {
                title: n("materialsStock.itemDescription"),
                key: "description",
                width: 160
            },
            {
                title: n("materialsStock.uom"),
                key: "uom",
                width: 80
            },
            {
                title: n("materialsStock.rob"),
                key: "rob",
                width: 100,
                render: (e)=>{
                    const t = Number(e.rob), m = Number(e.minStock);
                    return m === 0 && t === 0 ? c("div", {
                        style: {
                            color: "red"
                        }
                    }, 0) : t < m ? c("div", {
                        style: {
                            color: "red"
                        }
                    }, e.rob) : t === m ? c("div", {
                        style: {
                            color: "yellow"
                        }
                    }, e.rob) : e.rob ? t : 0;
                }
            },
            {
                title: n("materialsStock.frozenStock"),
                key: "freezeQuantity",
                width: 120
            },
            {
                title: n("materialsStock.stockTakenDate"),
                key: "stockTakenDate",
                width: 160
            },
            {
                title: n("materialsStock.minStock"),
                key: "minStock",
                width: 100
            },
            {
                title: n("materialsStock.subCategory"),
                key: "subCategory",
                width: 180,
                render: (e)=>S.getLocale === "en" ? e?.subLabelEn : e?.subLabel
            },
            {
                title: n("materialsStock.section"),
                key: "sectionCode",
                width: 180,
                render: (e)=>S.getLocale === "en" ? e?.sectionLabelEn : e?.sectionLabel
            }
        ];
    bt = U({
        __name: "index",
        setup (s) {
            const { t: e } = w(), t = X(), m = A(), R = k("tableRef"), v = k("detailsRef"), L = k("inStockRef"), N = k("outStockRef"), _ = {
                category: y([]),
                subCategory: y([]),
                section: y([])
            }, I = y(!1), B = Q({
                width: 120,
                title: e("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (a) {
                    return c(ce, {
                        style: "text",
                        actions: [
                            {
                                label: e("materialsStock.outStock"),
                                labelShow: !1,
                                ifShow: T === V.VESSEL,
                                icon: c("i", {
                                    class: "iconfont icon-chuku"
                                }),
                                onClick: ()=>N.value?.handleOpenModal(a)
                            },
                            {
                                label: e("materialsStock.stockHistory"),
                                labelShow: !1,
                                icon: c("i", {
                                    class: "iconfont icon-a-Group893"
                                }),
                                onClick: ()=>t.push({
                                        name: "inventoryHistoryStores",
                                        query: {
                                            shipId: a.shipId,
                                            materialId: a.materialId
                                        }
                                    })
                            },
                            {
                                label: e("materialsStock.stockDetails"),
                                labelShow: !1,
                                icon: c("i", {
                                    class: "iconfont icon-kucunmingxi"
                                }),
                                onClick: ()=>v.value?.handleOpenModal(a)
                            }
                        ]
                    });
                }
            }), [D, { getFieldsValue: F, setFieldsValue: P }] = le({
                gridProps: {
                    cols: 6
                },
                schemas: Se({
                    cascadeOptions: _
                })
            });
            function O() {
                if (be(m.query) || I.value) return {};
                const { categoryId: a, shipId: u, sectionId: p } = m.query, f = {
                    shipId: u ? Number(u) : void 0,
                    category: a,
                    sectionCode: p
                };
                return P(f), I.value = !0, f;
            }
            async function $(a, u) {
                try {
                    return await me({
                        ...O(),
                        ...u,
                        ...a
                    });
                } catch  {
                    return {
                        list: [
                            {}
                        ],
                        total: 0
                    };
                }
            }
            function q() {
                L.value?.handleOpenModal();
            }
            function d() {
                R.value?.restReload();
            }
            async function M() {
                const a = await ye;
                _.category.value = a ?? [];
            }
            return j(()=>{
                M();
            }), (a, u)=>{
                const p = G, f = te, W = K, z = Z, H = ne;
                return C(), h(H, null, {
                    default: l(()=>[
                            i(p, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: l(()=>[
                                        i(r(ie), {
                                            onRegister: r(D),
                                            onSubmit: d,
                                            onReset: d
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            i(p, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: l(()=>[
                                        i(r(se), {
                                            ref_key: "tableRef",
                                            ref: R,
                                            columns: r(_e)(_),
                                            request: (g)=>$(g, r(F)()),
                                            "row-key": (g)=>g.id,
                                            autoScrollX: !0,
                                            actionColumn: r(B),
                                            "virtual-scroll": ""
                                        }, {
                                            toolbar: l(()=>[
                                                    i(z, null, {
                                                        default: l(()=>[
                                                                r(T) === r(V).VESSEL ? (C(), h(W, {
                                                                    key: 0,
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: l(()=>[
                                                                            i(f, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                bordered: "",
                                                                                secondary: "",
                                                                                class: "size-7",
                                                                                onClick: q
                                                                            }, {
                                                                                icon: l(()=>[
                                                                                        (C(), h(oe(r(ae)(r(re).inbound, "text-[#0ec06a]"))))
                                                                                    ]),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: l(()=>[
                                                                            Y(" " + ee(r(e)("materialsStock.inStock")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })) : J("", !0)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "request",
                                            "row-key",
                                            "actionColumn"
                                        ]),
                                        i(ke, {
                                            ref_key: "detailsRef",
                                            ref: v
                                        }, null, 512),
                                        i(pe, {
                                            ref_key: "inStockRef",
                                            ref: L,
                                            onRefresh: d
                                        }, null, 512),
                                        i(ue, {
                                            ref_key: "outStockRef",
                                            ref: N,
                                            onRefresh: d
                                        }, null, 512)
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { bt as default, __tla };
