import { g as c } from "./equipmentMainLibrary-bJTzj5mC.js";
import { g as i } from "./requisitionOrder-D0IG9N7e.js";
import { u as A } from "./useRole-C-Zpngq4.js";
import { V as p, gI as r, gL as u, __tla as __tla_0 } from "./index-9PRMimni.js";
let E, g, M, n, e, I, L, S, v, d, m, D, O, _, b, h, f;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    let o, l, R;
    ({ hasRole: o } = A());
    ({ t: l } = p());
    E = {
        OFFICE: "office",
        VESSEL: "vessel"
    };
    S = E.VESSEL;
    R = await c("material_category").then((t)=>r(t, (s)=>({
                ...s,
                disabled: !1
            })));
    m = async function() {
        try {
            return await i().then((s)=>r(s, (a)=>({
                        label: a.shipName,
                        labelEn: a.shipNameEn,
                        value: a.id + ""
                    })));
        } catch (t) {
            return console.error("Error fetching vessel options:", t), [];
        }
    };
    e = {
        SPARES: "0",
        GENERAL_STORES: "1",
        MARINE_PAINT: "2",
        MARINE_CHEMICALS: "3",
        LUBRICANT: "5",
        TANK_CLEANING_CHEMICALS: "6",
        ROPE: "7",
        CHARTS_AND_PUBLICATIONS: "4",
        MEDICINE_AND_MEDICAL: "8",
        WIRE_ROPE: "9"
    };
    n = {
        SPARE_PARTS: "spareParts",
        MATERIALS: "materials",
        CHARTS_AND_PUBLICATIONS: "chartsAndPublications"
    };
    I = [
        {
            label: "备件",
            labelEn: "SPARES",
            value: e.SPARES,
            disabled: !1
        },
        ...R.filter((t)=>Object.values(e).includes(t.value))
    ];
    _ = {
        [n.SPARE_PARTS]: [
            e.SPARES
        ],
        [n.MATERIALS]: [
            e.GENERAL_STORES,
            e.MARINE_PAINT,
            e.MARINE_CHEMICALS,
            e.LUBRICANT,
            e.TANK_CLEANING_CHEMICALS,
            e.ROPE,
            e.MEDICINE_AND_MEDICAL,
            e.WIRE_ROPE
        ],
        [n.CHARTS_AND_PUBLICATIONS]: [
            e.CHARTS_AND_PUBLICATIONS
        ]
    };
    d = (t)=>{
        if (!t) return console.error("Value is required to determine procurement type"), null;
        for (const [s, a] of Object.entries(_))if (a.includes(t)) return s;
        return console.error(`No procurement type found for value: ${t}`), null;
    };
    O = function(t) {
        return r(I, (s)=>({
                ...s,
                disabled: t(s)
            }));
    };
    L = [
        {
            label: "甲板部",
            labelEn: "Deck Department",
            value: 1
        },
        {
            label: "机舱部",
            labelEn: "Engine Department",
            value: 2
        }
    ];
    b = [
        {
            label: "正常",
            labelEn: "Normal",
            value: 1
        },
        {
            label: "紧急",
            labelEn: "Emergency",
            value: 2
        }
    ];
    f = [
        {
            label: "船端",
            labelEn: "Vessel",
            value: 1
        },
        {
            label: "岸端",
            labelEn: "Office",
            value: 2
        }
    ];
    D = S === E.OFFICE ? o([
        "technical_superintendent"
    ]) ? e.SPARES : o([
        "marine_superintendent"
    ]) ? e.CHARTS_AND_PUBLICATIONS : null : e.SPARES;
    M = {
        CREATE: "create",
        CREATED: "created",
        EDIT: "edit",
        EDITED: "edited",
        APPROVE: "approve",
        VIEW: "view"
    };
    g = "orderReq";
    h = {
        gridProps: {
            cols: "2"
        },
        labelWidth: 80,
        submitButtonText: l("common.searchText"),
        showAdvancedButton: !1,
        schemas: [
            {
                field: "namePrefix",
                component: "NInput",
                label: l("common.portModal.port")
            }
        ]
    };
    v = await u("purchase_spare_quality");
});
export { E as C, g as M, M as P, n as a, e as b, I as c, L as d, S as e, v as f, d as g, m as h, D as i, O as j, _ as k, b as p, h as r, f as s, __tla };
