import { V as _, bk as S, Z as s, ae as u, hc as O, r as f, d as j, e as F, u as W, a as X, c as z, o as G, w as l, j as c, W as H, l as p, H as Z, aI as J, p as K, A as Q, B as Y, i as ee, X as te, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as ae } from "./Table-0PViRYCf.js";
import { _ as ie } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { B as oe } from "./BasicForm-dL_oCSPM.js";
import { u as re } from "./useForm-CKmgcynv.js";
import { g as v, f as se, i as ne, e as le, a as C, j as ce, h as me } from "./material-Fe1jAspV.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 "./Flex-CTSf12gq.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";
let tt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    let b, t, ue, pe, de, fe, ye, d, m, ge, be, k, h, he;
    b = S();
    ({ t } = _());
    ue = await v();
    pe = await se();
    de = await ne();
    fe = await le({
        category: 2
    });
    ye = [
        {
            title: "No.",
            key: "num",
            width: 60,
            render: (e, a)=>a + 1
        },
        {
            title: t("pms.material.description"),
            key: "description",
            width: 180
        },
        {
            title: t("pms.material.specification"),
            key: "specification",
            width: 180
        },
        {
            title: t("pms.material.unitName"),
            key: "unitName",
            width: 120
        },
        {
            title: t("pms.material.category"),
            key: "category",
            width: 160,
            render (e) {
                if (e.category) {
                    const a = ue.filter((o)=>o.value == e.category);
                    return b.getLocale === "en" ? a[0]?.labelEn : a[0]?.label;
                } else return "";
            }
        },
        {
            title: t("pms.material.subCategory"),
            key: "subCategory",
            width: 180,
            render (e) {
                if (e.subCategory) {
                    const a = pe.filter((o)=>o.value == e.subCategory);
                    return b.getLocale === "en" ? a[0]?.labelEn : a[0]?.label;
                } else return "";
            }
        },
        {
            title: t("pms.material.section"),
            key: "section",
            width: 180,
            render (e) {
                if (e.section) {
                    const a = de.filter((o)=>o.value == e.section);
                    return b.getLocale === "en" ? a[0]?.labelEn : a[0]?.label;
                } else return "";
            }
        },
        {
            title: t("pms.material.isPerishable"),
            key: "isPerishable",
            width: 100,
            render (e) {
                return s(u, {
                    round: !0,
                    bordered: !1,
                    type: e.isPerishable === 1 ? "success" : "warning"
                }, {
                    default: ()=>e.isPerishable === 1 ? t("pms.material.yes") : t("pms.material.no")
                });
            }
        },
        {
            title: t("pms.material.isCritical"),
            key: "isCritical",
            width: 100,
            render (e) {
                return s(u, {
                    round: !0,
                    bordered: !1,
                    type: e.isCritical === 1 ? "success" : "warning"
                }, {
                    default: ()=>e.isCritical === 1 ? t("pms.material.yes") : t("pms.material.no")
                });
            }
        },
        {
            title: t("pms.material.attachRequired"),
            key: "attachRequired",
            width: 160,
            render (e) {
                return s(u, {
                    round: !0,
                    bordered: !1,
                    type: e.attachRequired === 1 ? "success" : "warning"
                }, {
                    default: ()=>e.attachRequired === 1 ? t("pms.material.yes") : t("pms.material.no")
                });
            }
        },
        {
            title: t("pms.material.mdRequired"),
            key: "mdRequired",
            width: 140,
            render (e) {
                return s(u, {
                    round: !0,
                    bordered: !1,
                    type: e.mdRequired === 1 ? "success" : "warning"
                }, {
                    default: ()=>e.mdRequired === 1 ? t("pms.material.yes") : t("pms.material.no")
                });
            }
        },
        {
            title: t("pms.material.sdocRequired"),
            key: "sdocRequired",
            width: 140,
            render (e) {
                return s(u, {
                    round: !0,
                    bordered: !1,
                    type: e.sdocRequired === 1 ? "success" : "warning"
                }, {
                    default: ()=>e.sdocRequired === 1 ? t("pms.material.yes") : t("pms.material.no")
                });
            }
        },
        {
            title: t("pms.material.PackingUOM"),
            key: "packingUmo",
            width: 140,
            render (e) {
                return (fe || []).find((o)=>o.id === e.packingUmo)?.name;
            }
        },
        {
            title: t("pms.material.weight"),
            key: "weight",
            width: 140
        },
        {
            title: t("pms.material.originCountry"),
            key: "originCountry",
            width: 140
        },
        {
            title: t("pms.material.active"),
            key: "isActive",
            width: 100,
            render (e) {
                return s(u, {
                    round: !0,
                    bordered: !1,
                    type: e.isActive === 1 ? "success" : "warning"
                }, {
                    default: ()=>e.isActive === 1 ? t("pms.material.active") : t("pms.material.inActive")
                });
            }
        }
    ];
    d = S();
    ({ t: m } = _());
    ge = await O();
    be = await v();
    k = f([]);
    h = f([]);
    he = [
        {
            field: "shipId",
            label: m("hsqe.planner.formShip"),
            component: "NSelect",
            componentProps: {
                options: ge,
                filterable: !0,
                "label-field": d.getLocale === "en" ? "shipNameEn" : "shipName",
                "value-field": "id"
            }
        },
        {
            field: "category",
            component: "NSelect",
            label: m("pms.material.category"),
            componentProps: ({ model: e })=>({
                    placeholder: m("pms.material.category"),
                    options: be,
                    filterable: !0,
                    "label-field": d.getLocale === "en" ? "labelEn" : "label",
                    onUpdateValue: async (a)=>{
                        k.value = await C({
                            category: a
                        }), h.value = [], e.subCategory = null, e.section = null;
                    }
                })
        },
        {
            field: "subCategory",
            component: "NSelect",
            label: m("pms.material.subCategory"),
            componentProps: ({ model: e })=>({
                    placeholder: m("pms.material.subCategory"),
                    options: k.value,
                    filterable: !0,
                    "label-field": d.getLocale === "en" ? "labelEn" : "label",
                    onUpdateValue: async (a)=>{
                        h.value = await C({
                            category: e.category,
                            subCategory: a
                        }), e.section = null;
                    }
                })
        },
        {
            field: "section",
            component: "NSelect",
            label: m("pms.material.section"),
            componentProps: ()=>({
                    placeholder: m("pms.material.section"),
                    options: h.value,
                    filterable: !0,
                    "label-field": d.getLocale === "en" ? "labelEn" : "label"
                })
        }
    ];
    tt = j({
        __name: "index",
        setup (e) {
            const a = F(), { t: o } = _(), L = W(), w = f(), R = f(), q = X({
                width: 160,
                title: o("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (i) {
                    return s(ie, {
                        style: "text",
                        actions: [
                            {
                                label: o("common.optionsViewText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-View blue"
                                }),
                                onClick: T.bind(null, i)
                            },
                            {
                                label: o("common.optionsEditText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-a-Frame28"
                                }),
                                onClick: N.bind(null, i),
                                ifShow: ()=>{
                                    const { subCategory: n, isSync: r } = i;
                                    return n !== "1" && r !== 1;
                                }
                            },
                            {
                                label: o("common.optionsDelText"),
                                labelShow: !1,
                                icon: s("i", {
                                    class: "iconfont icon-Delete red"
                                }),
                                onPositiveClick: ()=>{
                                    x(i);
                                },
                                onNegativeClick: ()=>{},
                                isConfirm: !0,
                                confirmContent: o("common.delPop.cont"),
                                ifShow: ()=>{
                                    const { subCategory: n, isSync: r } = i;
                                    return n !== "1" && r !== 1;
                                }
                            }
                        ]
                    });
                }
            }), P = async (i, n)=>{
                const r = await me({
                    ...i,
                    ...n
                });
                return r && (R.value = r.list), r;
            };
            function y() {
                w.value.reload();
            }
            function N(i) {
                a.push({
                    name: "Add_PMS_Material",
                    query: {
                        uuid: i.id,
                        type: "edit"
                    }
                });
            }
            function T(i) {
                a.push({
                    name: "Add_PMS_Material",
                    query: {
                        uuid: i.id,
                        type: "view"
                    }
                });
            }
            async function x(i) {
                await ce(i.id), L.success("Operation succesfully!"), y();
            }
            function M(i) {
                y();
            }
            function A(i) {
                y();
            }
            const [B, { getFieldsValue: V }] = re({
                gridProps: {
                    cols: "5",
                    xGap: "15"
                },
                labelWidth: 80,
                schemas: he,
                showAdvancedButton: !1
            });
            function D() {
                a.push({
                    name: "Add_PMS_Material",
                    query: {
                        uuid: "",
                        type: "add"
                    }
                });
            }
            return (i, n)=>{
                const r = H, E = Y, $ = J, U = Z, I = te;
                return G(), z(I, null, {
                    default: l(()=>[
                            c(r, {
                                bordered: !1,
                                class: "mb-3 proCard"
                            }, {
                                default: l(()=>[
                                        c(p(oe), {
                                            onRegister: p(B),
                                            onSubmit: M,
                                            onReset: A
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            c(r, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: l(()=>[
                                        c(p(ae), {
                                            columns: p(ye),
                                            request: (g)=>P(g, p(V)()),
                                            "row-key": (g)=>g.id,
                                            ref_key: "basicTableRef",
                                            ref: w,
                                            actionColumn: q,
                                            autoScrollX: !0,
                                            "virtual-scroll": ""
                                        }, {
                                            tableTitle: l(()=>[
                                                    c(U, null, {
                                                        default: l(()=>[
                                                                c($, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: l(()=>[
                                                                            c(E, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                bordered: "",
                                                                                secondary: "",
                                                                                class: "size-7",
                                                                                onClick: D
                                                                            }, {
                                                                                icon: l(()=>n[0] || (n[0] = [
                                                                                        ee("i", {
                                                                                            class: "iconfont icon-ADD"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: l(()=>[
                                                                            K(" " + Q(p(o)("pms.material.add")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "request",
                                            "row-key",
                                            "actionColumn"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { tt as default, __tla };
