import { V as M, bk as X, bS as Ie, l as o, c_ as qe, cZ as Fe, gL as Be, d as Oe, f as Qe, e as Me, u as le, ar as $e, a4 as re, r as _, bl as je, is as Ue, bi as ze, a as Ae, Z as W, gI as I, aw as We, c as B, o as w, w as l, j as u, W as O, i as y, H as Ke, aI as He, p as G, A as P, B as Xe, h as q, F as Q, a9 as ne, D as K, aH as Ze, cO as Je, fm as Ye, cq as et, hK as tt, k as ot, N as it, f1 as at, ce as lt, E as rt, X as nt, bR as st, R as ct, __tla as __tla_0 } from "./index-9PRMimni.js";
import { u as dt } from "./useTags-C1thGhjF.js";
import { c as ut } from "./componentSetting-DVhNDBTO.js";
import { _ as pt } from "./TableSelect.vue_vue_type_script_setup_true_lang-BAU5mgvB.js";
import { B as mt } from "./Table-0PViRYCf.js";
import { _ as ft } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { B as gt } from "./BasicForm-dL_oCSPM.js";
import { u as vt } from "./useForm-CKmgcynv.js";
import { s as ce, e as ht, d as Pt, a as Rt, b as Nt, c as bt, g as yt, f as Lt } from "./goodsReceiptNoteDetail-DWFnSNrx.js";
import { g as H } from "./storageLocation-CpgPSQOH.js";
import { p as _t, __tla as __tla_1 } from "./helper-CNwA55dE.js";
import { g as wt } from "./requisitionOrder-D0IG9N7e.js";
import { s as St } from "./some-vU4SVDLd.js";
import { f as Gt } from "./find-D_h_aJYR.js";
import { t as Et } from "./toPairs-DMqubSQo.js";
import { _ as xt } from "./Flex-CTSf12gq.js";
import "./tabsView-BXskTdVh.js";
import "./props-CLtNejQT.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 "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.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 "./equipmentMainLibrary-bJTzj5mC.js";
import "./useRole-C-Zpngq4.js";
import "./findIndex-BgUIH3i1.js";
import "./toInteger-DQeH-nF-.js";
let Xo;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: F } = M(), kt = X(), Ct = 5;
    function de(e) {
        return e >= 1 && e < 3;
    }
    function ue(e) {
        return e >= 3 && e < 5;
    }
    function pe(e) {
        return e === 5;
    }
    function Dt(e) {
        if (de(e)) return "bg-red-500";
        if (ue(e)) return "bg-yellow-500";
        if (pe(e)) return "bg-green-500";
    }
    function Tt(e) {
        return de(e) ? F("GRNList.detailPage.poor") : ue(e) ? F("GRNList.detailPage.fair") : pe(e) ? F("GRNList.detailPage.good") : "";
    }
    function se(e) {
        return e ? {
            receiptNo: e.receiptNo,
            category: kt.getLocale === "en" ? e.categoryNameEn : e.categoryName,
            reqNo: e.reqNo,
            orderNo: e.orderNo
        } : {};
    }
    function Vt(e) {
        return e ? {
            id: e.id,
            shipId: e.shipId,
            title: e.title,
            priority: e.priority,
            receivePort: e.receivePort,
            receiveDate: e.receiveDate,
            agentName: e.agentName,
            partialReceive: e.partialReceive ?? 0,
            vendorName: e.vendorName,
            vendorPhone: e.vendorPhone,
            vendorEmail: e.vendorEmail,
            receiptPaperPath: e.receiptPaperPath ? {
                name: e.receiptPaperPath.split("/").pop(),
                path: e.receiptPaperPath,
                url: e.receiptPaperUrl,
                status: "finished"
            } : null,
            remark: e.remark
        } : {};
    }
    const It = {
        gridProps: {
            cols: "2"
        },
        labelWidth: 80,
        submitButtonText: F("common.searchText"),
        showAdvancedButton: !1,
        schemas: [
            {
                field: "namePrefix",
                component: "NInput",
                label: F("common.portModal.port")
            }
        ]
    };
    function qt({ fields: e, record: R }) {
        return St(e, (g)=>!!(Ie(R, g) ?? !1));
    }
    const m = {
        OFFICE: "office",
        VESSEL: "vessel"
    }, f = m.VESSEL, Ft = X(), Bt = await wt(), Ot = Bt.map((e)=>({
            label: e.shipName,
            labelEn: e.shipNameEn,
            value: e.id
        })), { t: n } = M(), Qt = Fe();
    async function Mt(e, R) {
        try {
            return await ce({
                id: R,
                partialReceive: e
            }), Qt.success(n("common.saveSuccessText")), Promise.resolve(!0);
        } catch (g) {
            return console.error("Error saving partial receive:", g), Promise.reject(!1);
        }
    }
    function $t({ isReadonly: e }) {
        return [
            {
                field: "id",
                hidden: !0
            },
            {
                field: "shipId",
                label: n("GRNList.detailPage.vessel"),
                component: "BasicSelect",
                componentProps: {
                    disabled: !0,
                    style: {
                        width: "100%"
                    },
                    options: Ot
                }
            },
            {
                field: "title",
                component: "NInput",
                label: n("GRNList.detailPage.title"),
                componentProps: {
                    placeholder: n("GRNList.detailPage.title"),
                    disabled: !0
                }
            },
            {
                field: "priority",
                component: "NSelect",
                label: n("GRNList.detailPage.priority"),
                componentProps: {
                    labelField: Ft.getLocale === "en" ? "labelEn" : "label",
                    placeholder: n("GRNList.detailPage.priority"),
                    options: _t,
                    disabled: !0
                }
            },
            {
                field: "receivePort",
                label: n("GRNList.detailPage.portofReceipt"),
                slot: "receivePortSlot",
                rules: [
                    {
                        required: !0,
                        message: n("GRNList.detailPage.portofReceiptRequired"),
                        trigger: [
                            "change",
                            "blur"
                        ]
                    }
                ]
            },
            {
                field: "receiveDate",
                component: "NDatePicker",
                label: n("GRNList.detailPage.receivedDate"),
                componentProps: {
                    placeholder: n("GRNList.detailPage.receivedDate"),
                    valueFormat: "yyyy-MM-dd"
                },
                rules: [
                    {
                        required: !0,
                        message: n("GRNList.detailPage.receivedDateRequired"),
                        trigger: [
                            "change",
                            "blur"
                        ]
                    }
                ]
            },
            {
                field: "vendorName",
                component: "NInput",
                label: n("GRNList.detailPage.vendor"),
                componentProps: {
                    placeholder: n("GRNList.detailPage.vendor"),
                    disabled: !0
                }
            },
            {
                field: "vendorPhone",
                component: "NInput",
                label: n("GRNList.detailPage.vendorPhone"),
                componentProps: {
                    placeholder: n("GRNList.detailPage.vendorPhone"),
                    disabled: !0
                }
            },
            {
                field: "vendorEmail",
                component: "NInput",
                label: n("GRNList.detailPage.vendorEmail"),
                componentProps: {
                    placeholder: n("GRNList.detailPage.vendorEmail"),
                    disabled: !0
                }
            },
            {
                field: "agentName",
                component: "NInput",
                label: n("GRNList.detailPage.agentWarehouseName"),
                componentProps: {
                    style: {
                        width: "100%"
                    },
                    placeholder: n("GRNList.detailPage.agentWarehouseName")
                }
            },
            {
                field: "partialReceive",
                component: "NSwitch",
                label: n("GRNList.detailPage.partialReceived"),
                componentProps: ({ model: R, formAction: { setFieldsValue: g } })=>({
                        placeholder: n("GRNList.detailPage.partialReceived"),
                        checkedValue: 1,
                        uncheckedValue: 0,
                        disabled: R?.partialReceive === 1 || f !== m.VESSEL || o(e),
                        onUpdateValue: (N)=>{
                            N === 1 && qe().warning({
                                title: n("GRNList.detailPage.partialReceiveConfirm.title"),
                                content: n("GRNList.detailPage.partialReceiveConfirm.content"),
                                positiveText: n("common.confirmText"),
                                negativeText: n("common.cancelText"),
                                maskClosable: !1,
                                closeOnEsc: !1,
                                closable: !1,
                                onPositiveClick: async ()=>{
                                    await Mt(N, R.id).then((v)=>{
                                        v || g({
                                            partialReceive: N === 1 ? 0 : 1
                                        });
                                    });
                                },
                                onNegativeClick: ()=>{
                                    g({
                                        partialReceive: N === 1 ? 0 : 1
                                    });
                                }
                            });
                        }
                    })
            },
            {
                field: "remark",
                component: "NInput",
                label: n("GRNList.detailPage.remarks"),
                giProps: {
                    span: 5
                },
                componentProps: {
                    placeholder: n("GRNList.detailPage.remarks"),
                    type: "textarea",
                    autosize: {
                        minRows: 3,
                        maxRows: 3
                    }
                }
            },
            {
                field: "receiptPaperPath",
                label: n("GRNList.detailPage.paperReceipt"),
                slot: "attachmentSlot",
                giProps: {
                    span: 5
                },
                rules: [
                    {
                        key: "receiptPaperPath",
                        required: !0,
                        message: n("GRNList.detailPage.paperReceiptRequired"),
                        trigger: [
                            "change",
                            "blur"
                        ],
                        type: "object"
                    }
                ]
            }
        ];
    }
    const { t: c } = M(), jt = X(), Ut = await Be("purchase_spare_quality");
    function zt({ isReadonly: e, partialReceive: R, storageLocationOptions: g }) {
        return [
            ...f === m.VESSEL && !e ? [
                {
                    type: "selection",
                    key: "selection",
                    fixed: "left",
                    width: 40
                }
            ] : [],
            {
                title: c("GRNList.detailPage.lineNo"),
                key: "indexNo",
                width: 80
            },
            {
                title: c("GRNList.detailPage.equipmentName"),
                key: "equipmentName",
                width: 180
            },
            {
                title: c("GRNList.detailPage.partNumberItemCode"),
                key: "itemCode",
                width: 180
            },
            {
                title: c("GRNList.detailPage.itemDescription"),
                key: "description",
                width: 180
            },
            {
                title: c("GRNList.detailPage.ROB"),
                key: "rob",
                width: 100
            },
            {
                title: c("GRNList.detailPage.price"),
                key: "unitPrice",
                width: 100
            },
            {
                title: c("GRNList.detailPage.POQty"),
                key: "orderQty",
                width: 140
            },
            {
                title: c("GRNList.detailPage.POUOM"),
                key: "orderUom",
                width: 140
            },
            {
                title: c("GRNList.detailPage.POQuality"),
                key: "quality",
                width: 140,
                render (N) {
                    const v = Gt(Ut, (a)=>a.value === N.quality);
                    return (jt.getLocale === "en" ? v?.labelEn : v?.label) ?? N.quality;
                }
            },
            {
                title: c("GRNList.detailPage.brandManufacturer"),
                key: "brandManufacturer",
                width: 180
            },
            {
                title: c("GRNList.detailPage.specification"),
                key: "specification",
                width: 180
            },
            {
                title: c("GRNList.detailPage.receivedQty"),
                key: "receiveQty",
                width: 240,
                edit: f === m.VESSEL && !e && R === 1,
                editRow: f === m.VESSEL && !e && R === 1,
                editRule: (N, v)=>{
                    const { orderQty: E } = v, { receiveQty: a } = v.editValueRefs, L = a ? a > (E ?? a) ? c("GRNList.detailPage.receivedQtyInvalid") : "" : c("GRNList.detailPage.receivedQtyRequired");
                    return Promise.resolve(L);
                },
                editComponent: "NInputNumber",
                editComponentProps: {
                    placeholder: c("GRNList.detailPage.receivedQty"),
                    min: .01,
                    precision: 2
                }
            },
            {
                title: c("GRNList.detailPage.storageLocationRoomNo"),
                key: "roomLocationId",
                width: 240,
                edit: f === m.VESSEL && !e,
                editRow: f === m.VESSEL && !e,
                editComponent: "NSelect",
                editComponentProps: {
                    clearable: !0,
                    style: {
                        width: "220px"
                    },
                    placeholder: c("GRNList.detailPage.reconditionedQty"),
                    options: g.roomNo
                }
            },
            {
                title: c("GRNList.detailPage.storageLocationShelfNo"),
                key: "shelfLocationId",
                width: 240,
                edit: f === m.VESSEL && !e,
                editRow: f === m.VESSEL && !e,
                editRule: (N, v)=>{
                    const E = qt({
                        fields: [
                            "roomLocationId",
                            "shelfLocationId",
                            "boxLocationId"
                        ],
                        record: v.editValueRefs
                    }) ? "" : c("GRNList.detailPage.storageLocationRequired");
                    return Promise.resolve(E);
                },
                editComponent: "NSelect",
                editComponentProps: {
                    clearable: !0,
                    style: {
                        width: "220px"
                    },
                    placeholder: c("GRNList.detailPage.reconditionedQty"),
                    options: g.shelfNo
                }
            },
            {
                title: c("GRNList.detailPage.storageLocationBoxNo"),
                key: "boxLocationId",
                width: 240,
                edit: f === m.VESSEL && !e,
                editRow: f === m.VESSEL && !e,
                editComponent: "NSelect",
                editComponentProps: {
                    clearable: !0,
                    style: {
                        width: "220px"
                    },
                    placeholder: c("GRNList.detailPage.reconditionedQty"),
                    options: g.boxNo
                }
            },
            {
                title: c("GRNList.detailPage.newStock"),
                key: "newStock",
                width: 180
            },
            {
                title: c("GRNList.detailPage.reconditionedQty"),
                key: "reconditionQty",
                width: 240,
                edit: f === m.VESSEL && !e,
                editRow: f === m.VESSEL && !e,
                editRule: !0,
                editComponent: "NInputNumber",
                editComponentProps: {
                    placeholder: c("GRNList.detailPage.reconditionedQty"),
                    min: 0,
                    precision: 2
                }
            },
            {
                title: c("GRNList.detailPage.remarks"),
                key: "remark",
                width: 180
            }
        ];
    }
    function At() {
        return [
            {
                title: c("common.portModal.port"),
                key: "port"
            },
            {
                title: c("common.portModal.country"),
                key: "country"
            }
        ];
    }
    let Wt, Kt, Ht, Xt, Zt, Jt, Yt;
    Wt = {
        class: "flex justify-between items-center gap-4"
    };
    Kt = {
        class: "text-[18px]",
        style: {
            fontWeight: "var(--n-title-font-weight)"
        }
    };
    Ht = {
        class: "font-semibold"
    };
    Xt = {
        key: 0
    };
    Zt = {
        class: "pl-[8px] text-[18px]",
        style: {
            fontWeight: "var(--n-title-font-weight)"
        }
    };
    Jt = {
        class: "text-red-500"
    };
    Yt = {
        class: "text-gray-800 mb-2"
    };
    Xo = Oe({
        __name: "index",
        setup (e) {
            const { closeCurrent: R } = dt(), g = Qe(), N = Me(), v = le(), E = $e(), { t: a } = M(), L = re(()=>g.query.type === "view"), $ = _({}), Z = _({}), D = je("itemDetailsTableRef"), x = _([]), j = _(0);
            function me(t) {
                j.value = t.partialReceive;
            }
            const U = Ue((t, i)=>{
                let r = "";
                const p = ze(()=>{
                    D.value?.restReload();
                }, 500);
                return {
                    get () {
                        return t(), r;
                    },
                    set (d) {
                        r = d, i(), p();
                    }
                };
            }), fe = re(()=>typeof window < "u" ? window.innerWidth < 768 ? "medium" : "large" : "medium"), z = _({
                receiptNo: {
                    label: a("GRNList.detailPage.GRNNo"),
                    value: null
                },
                category: {
                    label: a("GRNList.detailPage.purchaseCategory"),
                    value: null
                },
                reqNo: {
                    label: a("GRNList.detailPage.requisitionNo"),
                    value: null
                },
                orderNo: {
                    label: a("GRNList.detailPage.purchaseOrderNo"),
                    value: null
                }
            }), k = _({
                id: null,
                iteratorData: {
                    shippingPoint: {
                        name: "GRNList.detailPage.shippingAndPreservation",
                        value: 0
                    },
                    docPoint: {
                        name: "GRNList.detailPage.docAndService",
                        value: 0
                    },
                    qualityPoint: {
                        name: "GRNList.detailPage.overhaulQuality",
                        value: 0
                    }
                }
            }), [ge, { submit: J, getFieldsValue: ve, setFieldsValue: he }] = vt({
                gridProps: {
                    cols: 5
                },
                labelWidth: 80,
                layout: "horizontal",
                submitButtonText: "sure",
                showActionButtonGroup: !1,
                schemas: $t({
                    isReadonly: L
                })
            }), Pe = Ae({
                width: 120,
                title: a("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (t) {
                    return W(ft, {
                        style: "text",
                        actions: Re(t)
                    });
                }
            });
            function Re(t) {
                return t.editable ? [
                    {
                        label: a("common.saveText"),
                        onClick: be.bind(null, t)
                    },
                    {
                        label: a("common.cancelText"),
                        onClick: ye.bind(null, t)
                    }
                ] : [
                    {
                        label: a("common.optionsEditText"),
                        labelShow: !1,
                        disabled: !1,
                        icon: W("i", {
                            class: "iconfont icon-a-Frame28"
                        }),
                        onClick: Ne.bind(null, t)
                    },
                    {
                        label: a("common.delText"),
                        labelShow: !1,
                        disabled: !1,
                        icon: W("i", {
                            class: "iconfont icon-Delete red"
                        }),
                        onPositiveClick: we.bind(null, t.id),
                        isConfirm: !0,
                        confirmContent: a("common.delPop.contRole")
                    }
                ];
            }
            const Y = _({
                roomNo: [],
                shelfNo: [],
                boxNo: []
            });
            async function Ne(t) {
                const { shipId: i } = ve();
                if (!i) {
                    console.error("Ship ID is required to fetch storage locations");
                    return;
                }
                await ie(i), t.onEdit?.(!0);
            }
            async function be(t) {
                const i = await t.onEdit?.(!1, !0);
                if (i) try {
                    const { id: r, receiveQty: p, roomLocationId: d, shelfLocationId: h, boxLocationId: T, reconditionQty: V, remark: C } = t;
                    await ht({
                        id: r,
                        receiveQty: p,
                        roomLocationId: d,
                        shelfLocationId: h,
                        boxLocationId: T,
                        reconditionQty: V,
                        remark: C
                    }), v.success(a("common.optionsEditSuccessText")), D.value?.restReload(), te();
                } catch (r) {
                    console.error("Edit failed:", r);
                }
                else console.log("Edit cancelled or failed", i);
            }
            function ye(t) {
                t.onEdit?.(!1, !1);
            }
            function Le(t) {
                x.value = t;
            }
            function _e() {
                x.value.length !== 0 && E.warning({
                    title: a("GRNList.detailPage.deleteDialog.title"),
                    content: a("GRNList.detailPage.deleteDialog.content", {
                        count: x.value.length
                    }),
                    positiveText: a("GRNList.detailPage.deleteDialog.confirmText"),
                    negativeText: a("GRNList.detailPage.deleteDialog.cancelText"),
                    onPositiveClick: ()=>{
                        Rt({
                            ids: x.value
                        }).then(()=>{
                            v.success(a("common.optionsDelSuccessText")), x.value = [], D.value?.restReload();
                        });
                    },
                    onNegativeClick: ()=>{}
                });
            }
            function we(t) {
                Pt(t).then(()=>{
                    v.success(a("common.optionsDelSuccessText")), D.value?.restReload();
                });
            }
            const ee = _([]);
            async function Se(t, i) {
                if (!g.query.id) return {
                    total: 0,
                    list: []
                };
                try {
                    const r = await Nt({
                        ...t,
                        ...i,
                        receiptId: g.query.id
                    });
                    return ee.value = r.list, {
                        ...r,
                        list: I(r.list, (p)=>({
                                ...p,
                                receiveQty: p.receiveQty ? +p.receiveQty : 0,
                                reconditionQty: p.reconditionQty ? +p.reconditionQty : 0
                            }))
                    };
                } catch (r) {
                    return console.error("Error loading data table:", r), {
                        total: 0,
                        list: []
                    };
                }
            }
            function Ge() {
                const t = g.query.id;
                t && bt(+t).then((i)=>{
                    j.value = i.partialReceive ?? 0, ie(i.shipId), he(Vt(i)), Object.keys(se(i)).forEach((r)=>{
                        z.value.hasOwnProperty(r) && (z.value[r].value = se(i)[r]);
                    }), k.value.id = i.evaluation?.id, Object.keys(i.evaluation).forEach((r)=>{
                        k.value.iteratorData?.hasOwnProperty(r) && (k.value.iteratorData[r].value = i.evaluation?.[r] || 0);
                    });
                }).catch((i)=>{
                    console.error("Error fetching basic data:", i);
                });
            }
            function Ee(t) {
                return yt({
                    ...t,
                    ...o($)
                });
            }
            function xe(t) {
                Z.value = t;
            }
            function ke({ file: t, event: i }, r, p) {
                try {
                    const d = st("(" + i.target.response + ")"), { infoField: h } = ut.upload.apiSetting, { code: T } = d, V = d.msg || d.message || a("common.uploadFailText"), C = d[h];
                    T === ct.SUCCESS ? r[p] = {
                        name: t.name,
                        path: C.name,
                        url: C.url,
                        status: "finished"
                    } : le().error(V);
                } catch (d) {
                    console.error(d);
                }
            }
            function Ce(t) {
                console.warn("File upload error:", t), v.error(a("common.uploadFailText"));
            }
            const A = _("");
            function te() {
                const t = [
                    "roomLocationId",
                    "shelfLocationId",
                    "boxLocationId"
                ];
                for (const i of ee.value)if (!t.some((p)=>i[p])) return A.value = a("GRNList.detailPage.itemDetailsStorageLocationRequired", {
                    code: i.itemCode
                }), !1;
                return A.value = "", !0;
            }
            async function oe() {
                if (!g.query.id) return v.error("Missing required parameter: id"), Promise.reject("Missing required parameter: id");
                if (!te()) return Promise.reject("Submit failed: Missing required fields");
                const t = await J();
                if (t) return new Promise((i, r)=>{
                    ce({
                        ...t,
                        receiptPaperPath: t.receiptPaperPath?.path,
                        portId: Z.value?.id,
                        evaluation: Object.fromEntries([
                            [
                                "id",
                                k.value.id
                            ],
                            ...I(Et(k.value.iteratorData), ([p, { value: d }])=>[
                                    p,
                                    d
                                ])
                        ])
                    }).then((p)=>{
                        v.success(a("common.saveSuccessText")), i();
                    }).catch((p)=>{
                        r(p);
                    });
                });
            }
            async function De() {
                const t = await J();
                try {
                    await oe(), t && (g.query.id ? Lt(+g.query.id).then((i)=>{
                        v.success(a("common.submitSuccessText")), ae();
                    }) : v.error("Missing required parameter: id"));
                } catch (i) {
                    console.warn("Submit failed:", i);
                }
            }
            async function ie(t) {
                const i = await H({
                    shipId: t,
                    warehouseType: "0"
                }).then((d)=>I(d.list, (h)=>({
                            label: h.warehouseName,
                            value: h.id,
                            raw: h
                        })) ?? []).catch(()=>[]), r = await H({
                    shipId: t,
                    warehouseType: "1"
                }).then((d)=>I(d.list, (h)=>({
                            label: h.warehouseName,
                            value: h.id,
                            raw: h
                        })) ?? []).catch(()=>[]), p = await H({
                    shipId: t,
                    warehouseType: "2"
                }).then((d)=>I(d.list, (h)=>({
                            label: h.warehouseName,
                            value: h.id,
                            raw: h
                        })) ?? []).catch(()=>[]);
                Y.value = {
                    roomNo: i,
                    shelfNo: r,
                    boxNo: p
                };
            }
            function ae() {
                try {
                    R();
                } catch (t) {
                    console.warn("Error closing tab:", t);
                }
                N.push({
                    path: "/purchase/goodsReceiptNoteList"
                });
            }
            return We(()=>{
                Ge();
            }), (t, i)=>{
                const r = Xe, p = He, d = Ke, h = Ze, T = it, V = ot, C = xt, Te = nt;
                return w(), B(Te, null, {
                    default: l(()=>[
                            u(o(O), {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: l(()=>[
                                        y("div", Wt, [
                                            u(d, null, {
                                                default: l(()=>[
                                                        u(p, {
                                                            trigger: "hover"
                                                        }, {
                                                            trigger: l(()=>[
                                                                    u(r, {
                                                                        type: "text",
                                                                        class: "size-8",
                                                                        onClick: ae
                                                                    }, {
                                                                        icon: l(()=>i[2] || (i[2] = [
                                                                                y("i", {
                                                                                    class: "iconfont icon-a-shangyibu2 text-[16px]"
                                                                                }, null, -1)
                                                                            ])),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            default: l(()=>[
                                                                    G(" " + P(o(a)("GRNList.detailPage.back")), 1)
                                                                ]),
                                                            _: 1
                                                        }),
                                                        y("div", Kt, P(o(a)("GRNList.detailPage.goodsReceiptNote")), 1)
                                                    ]),
                                                _: 1
                                            }),
                                            u(d, {
                                                class: "flex-1 pt-2",
                                                justify: "space-around",
                                                size: 20
                                            }, {
                                                default: l(()=>[
                                                        (w(!0), q(Q, null, ne(z.value, (s)=>(w(), B(d, {
                                                                key: s.label,
                                                                justify: "space-between",
                                                                align: "center"
                                                            }, {
                                                                default: l(()=>[
                                                                        y("span", Ht, P(s.label) + ":", 1),
                                                                        s.value !== null && s.value !== void 0 ? (w(), q("span", Xt, P(s.value), 1)) : K("", !0)
                                                                    ]),
                                                                _: 2
                                                            }, 1024))), 128))
                                                    ]),
                                                _: 1
                                            }),
                                            u(d, null, {
                                                default: l(()=>[
                                                        o(f) === o(m).VESSEL && !L.value ? (w(), q(Q, {
                                                            key: 0
                                                        }, [
                                                            u(p, {
                                                                trigger: "hover"
                                                            }, {
                                                                trigger: l(()=>[
                                                                        u(r, {
                                                                            type: "primary",
                                                                            strong: "",
                                                                            bordered: "",
                                                                            secondary: "",
                                                                            class: "size-7",
                                                                            onClick: oe
                                                                        }, {
                                                                            icon: l(()=>i[3] || (i[3] = [
                                                                                    y("i", {
                                                                                        class: "iconfont icon-Save"
                                                                                    }, null, -1)
                                                                                ])),
                                                                            _: 1
                                                                        })
                                                                    ]),
                                                                default: l(()=>[
                                                                        G(" " + P(o(a)("GRNList.detailPage.save")), 1)
                                                                    ]),
                                                                _: 1
                                                            }),
                                                            u(p, {
                                                                trigger: "hover"
                                                            }, {
                                                                trigger: l(()=>[
                                                                        u(r, {
                                                                            type: "primary",
                                                                            strong: "",
                                                                            bordered: "",
                                                                            secondary: "",
                                                                            class: "size-7",
                                                                            onClick: De
                                                                        }, {
                                                                            icon: l(()=>i[4] || (i[4] = [
                                                                                    y("i", {
                                                                                        class: "iconfont icon-Submit"
                                                                                    }, null, -1)
                                                                                ])),
                                                                            _: 1
                                                                        })
                                                                    ]),
                                                                default: l(()=>[
                                                                        G(" " + P(o(a)("GRNList.detailPage.submit")), 1)
                                                                    ]),
                                                                _: 1
                                                            })
                                                        ], 64)) : K("", !0)
                                                    ]),
                                                _: 1
                                            })
                                        ])
                                    ]),
                                _: 1
                            }),
                            u(o(O), {
                                bordered: !1,
                                class: "mt-2 proCard"
                            }, {
                                header: l(()=>[
                                        G(P(o(a)("GRNList.detailPage.basicDetails")), 1)
                                    ]),
                                default: l(()=>[
                                        u(o(gt), {
                                            onRegister: o(ge),
                                            onChange: me,
                                            disabled: o(f) !== o(m).VESSEL || L.value
                                        }, {
                                            receivePortSlot: l(({ model: s, field: b })=>[
                                                    u(o(pt), {
                                                        class: "w-full",
                                                        labelField: "port",
                                                        valueField: "id",
                                                        value: s[b],
                                                        "onUpdate:value": (S)=>s[b] = S,
                                                        formValues: $.value,
                                                        "onUpdate:formValues": i[0] || (i[0] = (S)=>$.value = S),
                                                        onChange: xe,
                                                        multiple: !1,
                                                        formProps: o(It),
                                                        disabled: o(f) !== o(m).VESSEL || L.value,
                                                        selectTitle: o(a)("GRNList.detailPage.selectPort"),
                                                        tableProps: {
                                                            rowKey: (S)=>S.id,
                                                            request: Ee,
                                                            columns: o(At)(),
                                                            pagination: {
                                                                simple: !0
                                                            }
                                                        }
                                                    }, null, 8, [
                                                        "value",
                                                        "onUpdate:value",
                                                        "formValues",
                                                        "formProps",
                                                        "disabled",
                                                        "selectTitle",
                                                        "tableProps"
                                                    ])
                                                ]),
                                            attachmentSlot: l(({ model: s, field: b })=>[
                                                    (w(), B(h, {
                                                        key: s[b] ? s[b].url : "",
                                                        "default-file-list": s[b] ? [
                                                            s[b]
                                                        ] : [],
                                                        accept: ".pdf,.jpg,.png",
                                                        action: `${o(et)().urlPrefix}${o(f) === o(m).OFFICE ? "/system" : ""}/files`,
                                                        headers: {
                                                            timestamp: new Date().getTime(),
                                                            authorization: `${o(Je).get(o(Ye))}`
                                                        },
                                                        max: 1,
                                                        onRemove: (S)=>s[b] = null,
                                                        onError: Ce,
                                                        onFinish: ({ file: S, event: Ve })=>ke({
                                                                file: S,
                                                                event: Ve
                                                            }, s, b)
                                                    }, {
                                                        default: l(()=>[
                                                                u(r, null, {
                                                                    icon: l(()=>[
                                                                            u(o(tt))
                                                                        ]),
                                                                    default: l(()=>[
                                                                            G(" " + P(o(a)("common.uploadText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 2
                                                    }, 1032, [
                                                        "default-file-list",
                                                        "action",
                                                        "headers",
                                                        "onRemove",
                                                        "onFinish"
                                                    ]))
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister",
                                            "disabled"
                                        ])
                                    ]),
                                _: 1
                            }),
                            u(o(O), {
                                bordered: !1,
                                class: "mt-2 proCard"
                            }, {
                                default: l(()=>[
                                        u(C, {
                                            justify: "space-between",
                                            align: "center",
                                            class: "mb-2"
                                        }, {
                                            default: l(()=>[
                                                    u(d, null, {
                                                        default: l(()=>[
                                                                y("div", Zt, P(o(a)("GRNList.detailPage.itemDetails")), 1)
                                                            ]),
                                                        _: 1
                                                    }),
                                                    u(d, null, {
                                                        default: l(()=>[
                                                                u(V, {
                                                                    value: U.value,
                                                                    "onUpdate:value": i[1] || (i[1] = (s)=>U.value = s),
                                                                    placeholder: "Part Number/Item Code、Equipment、Description",
                                                                    clearable: "",
                                                                    class: "w-[400px]"
                                                                }, {
                                                                    prefix: l(()=>[
                                                                            u(T, {
                                                                                component: o(at)
                                                                            }, null, 8, [
                                                                                "component"
                                                                            ])
                                                                        ]),
                                                                    _: 1
                                                                }, 8, [
                                                                    "value"
                                                                ]),
                                                                o(f) === o(m).VESSEL && !L.value ? (w(), B(p, {
                                                                    key: 0,
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: l(()=>[
                                                                            u(r, {
                                                                                quaternary: "",
                                                                                type: "error",
                                                                                onClick: _e,
                                                                                disabled: x.value.length === 0
                                                                            }, {
                                                                                icon: l(()=>i[5] || (i[5] = [
                                                                                        y("i", {
                                                                                            class: "iconfont icon-Delete"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            }, 8, [
                                                                                "disabled"
                                                                            ])
                                                                        ]),
                                                                    default: l(()=>[
                                                                            G(" " + P(o(a)("common.delText")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })) : K("", !0)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        }),
                                        u(o(mt), {
                                            ref_key: "itemDetailsTableRef",
                                            ref: D,
                                            columns: o(zt)({
                                                isReadonly: L.value,
                                                partialReceive: j.value,
                                                storageLocationOptions: Y.value
                                            }),
                                            request: (s)=>Se(s, {
                                                    keyword: U.value
                                                }),
                                            "row-key": (s)=>s.id,
                                            "onUpdate:checkedRowKeys": Le,
                                            actionColumn: o(f) === o(m).VESSEL && !L.value ? o(Pe) : void 0,
                                            canResize: !1,
                                            autoScrollX: !0,
                                            showTableSetting: !1,
                                            "virtual-scroll": ""
                                        }, null, 8, [
                                            "columns",
                                            "request",
                                            "row-key",
                                            "actionColumn"
                                        ]),
                                        y("div", Jt, P(A.value), 1)
                                    ]),
                                _: 1
                            }),
                            u(o(O), {
                                bordered: !1,
                                class: "mt-2 proCard"
                            }, {
                                header: l(()=>[
                                        G(P(o(a)("GRNList.detailPage.serviceEvaluation")), 1)
                                    ]),
                                default: l(()=>[
                                        u(d, {
                                            vertical: ""
                                        }, {
                                            default: l(()=>[
                                                    (w(!0), q(Q, null, ne(k.value.iteratorData, (s)=>(w(), q(Q, {
                                                            key: s.name
                                                        }, [
                                                            y("div", Yt, P(o(a)(s.name)), 1),
                                                            u(d, {
                                                                align: "center",
                                                                class: "mb-4"
                                                            }, {
                                                                default: l(()=>[
                                                                        u(o(lt), {
                                                                            value: s.value,
                                                                            "onUpdate:value": (b)=>s.value = b,
                                                                            readonly: o(f) !== o(m).VESSEL || L.value,
                                                                            size: fe.value,
                                                                            count: o(Ct)
                                                                        }, null, 8, [
                                                                            "value",
                                                                            "onUpdate:value",
                                                                            "readonly",
                                                                            "size",
                                                                            "count"
                                                                        ]),
                                                                        y("div", {
                                                                            class: rt([
                                                                                o(Dt)(s.value),
                                                                                "w-[40px]",
                                                                                "p-1",
                                                                                "rounded",
                                                                                "text-white",
                                                                                "font-semibold",
                                                                                "text-xs",
                                                                                "text-center"
                                                                            ])
                                                                        }, P(o(Tt)(s.value)), 3)
                                                                    ]),
                                                                _: 2
                                                            }, 1024)
                                                        ], 64))), 128))
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Xo as default, __tla };
