import { _ as f, __tla as __tla_0 } from "./index.vue_vue_type_script_setup_true_lang-B_S9u-OV.js";
import { g as r, a as n, __tla as __tla_1 } from "./helper-CNwA55dE.js";
import { i as m } from "./isNumber-D5aBrEhN.js";
import { d as h, bl as y, c as q, o as k, __tla as __tla_2 } from "./index-9PRMimni.js";
let P;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    function R({ props: i, record: e }) {
        if (!e) return {};
        const t = r(i.procurementCategory);
        if (!t) return console.warn("Invalid procurement category:", i.procurementCategory), {};
        switch(t){
            case n.SPARE_PARTS:
                return {
                    id: e.id,
                    partNumber: e.spareItem?.partNumber,
                    plateDrawingNumber: e.spareItem?.plateDrawingNumber,
                    equipmentName: e.spareItem?.productName,
                    equipmentModel: e.spareItem?.model,
                    serialNo: e.spareItem?.serialNumber,
                    maker: e.spareItem?.maker,
                    hullNo: e.spareItem?.hullNo,
                    itemDescription: e.spareItem?.itemDescription,
                    specification: e.specification,
                    reqQuantity: +e.reqQuantity,
                    reqQuality: e.reqQuality + "",
                    rob: e.spareItem?.ROB,
                    umo: m(e.umo) ? e.umo + "" : e.umo,
                    sdocRequired: e.sdocRequired,
                    mdRequired: e.mdRequired,
                    remarkToOffice: e.remarkToOffice,
                    remarkToVendor: e.remarkToVendor,
                    attachPath: e.attachUrl ? {
                        name: e.attachPath.split("/").pop() || "",
                        path: e.attachPath,
                        url: e.attachUrl,
                        status: "finished"
                    } : null
                };
            case n.MATERIALS:
                return {
                    id: e.id,
                    itemCode: e.item.code,
                    issaNo: e.item.issaNo,
                    itemCategory: e.item.category,
                    itemDescription: e.item.description,
                    specification: e.specification,
                    reqQuantity: +e.reqQuantity,
                    rob: e.rob,
                    umo: m(e.umo) ? e.umo + "" : e.umo,
                    brand: e.brand,
                    packingUmo: m(e.packingUmo) ? e.packingUmo + "" : e.packingUmo,
                    sdocRequired: e.sdocRequired,
                    mdRequired: e.mdRequired,
                    remarkToOffice: e.remarkToOffice,
                    remarkToVendor: e.remarkToVendor,
                    attachPath: e.attachUrl ? {
                        name: e.attachPath.split("/").pop() || "",
                        path: e.attachPath,
                        url: e.attachUrl,
                        status: "finished"
                    } : null
                };
            case n.CHARTS_AND_PUBLICATIONS:
                return {
                    id: e.id,
                    itemCode: e.item.code,
                    issaNo: e.item.issaNo,
                    itemCategory: e.item.category,
                    itemDescription: e.item.description,
                    specification: e.specification,
                    reqQuantity: +e.reqQuantity,
                    reqEdition: e.reqEdition,
                    rob: e.rob,
                    edition: e.item.edition,
                    umo: m(e.umo) ? e.umo + "" : e.umo,
                    remarkToOffice: e.remarkToOffice,
                    remarkToVendor: e.remarkToVendor,
                    attachPath: e.attachUrl ? {
                        name: e.attachPath.split("/").pop() || "",
                        path: e.attachPath,
                        url: e.attachUrl,
                        status: "finished"
                    } : null
                };
            default:
                return console.warn("Unsupported procurement type:", t), {};
        }
    }
    P = h({
        __name: "index",
        props: {
            vesselValue: {},
            procurementCategory: {},
            reqFormOtherInfo: {}
        },
        emits: [
            "refresh"
        ],
        setup (i, { expose: e, emit: t }) {
            const u = i, o = t, s = y("editDetailRef");
            function p() {
                o("refresh");
            }
            function l(a) {
                s.value?.handleOpenModal(R({
                    record: a,
                    props: u
                }));
            }
            return e({
                handleOpenModal: l
            }), (a, T)=>(k(), q(f, {
                    ref_key: "editDetailRef",
                    ref: s,
                    vesselValue: a.vesselValue,
                    procurementCategory: a.procurementCategory,
                    reqFormOtherInfo: a.reqFormOtherInfo,
                    onRefresh: p,
                    isEdit: !0
                }, null, 8, [
                    "vesselValue",
                    "procurementCategory",
                    "reqFormOtherInfo"
                ]));
        }
    });
});
export { P as _, __tla };
