import { V as B, l as o, b as G, gD as y, d as K, gF as V, r as C, gG as D, f as Y, a4 as x, bl as $, ay as I, ac as S, aw as z, c as F, o as R, w as m, j as v, W as X, i as w, A as Z, ds as H, X as J, cZ as Q, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as ee } from "./BasicForm-dL_oCSPM.js";
import { u as te } from "./useForm-CKmgcynv.js";
import { _ as oe } from "./TableSelect.vue_vue_type_script_setup_true_lang-BAU5mgvB.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./print-CT_2hrjP.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import { h as re, s as ae, d as ie, c as se, p as le, e as E, C as M, P as d, r as ne, __tla as __tla_1 } from "./helper-CNwA55dE.js";
import { c as pe } from "./columns-Cv1qVJFZ.js";
import { g as de } from "./goodsReceiptNoteDetail-DWFnSNrx.js";
import { i as ue } from "./requisitionOrder-D0IG9N7e.js";
import { _ as ce, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-DLlbreDy.js";
import { i as me } from "./includes-DdMWPj0t.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 "./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 "./props-CLtNejQT.js";
import "./Table-0PViRYCf.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./useModal-CO65vga3.js";
import "./useTimeout-BxFilWvD.js";
import "./Flex-CTSf12gq.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./equipmentMainLibrary-bJTzj5mC.js";
import "./useRole-C-Zpngq4.js";
import "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { __tla as __tla_3 } from "./index.vue_vue_type_script_setup_true_lang-B_S9u-OV.js";
import { __tla as __tla_4 } from "./index.vue_vue_type_script_setup_true_lang-Cv5LP8XJ.js";
import "./isNumber-D5aBrEhN.js";
import "./find-D_h_aJYR.js";
import "./findIndex-BgUIH3i1.js";
import "./toInteger-DQeH-nF-.js";
import "./some-vU4SVDLd.js";
import "./startsWith-JzGQtvao.js";
import { __tla as __tla_5 } from "./index.vue_vue_type_script_setup_true_lang-CSVKsKYX.js";
import { __tla as __tla_6 } from "./index.vue_vue_type_script_setup_true_lang-D8OHpETW.js";
import { __tla as __tla_7 } from "./index.vue_vue_type_script_setup_true_lang-2_KRqSQd.js";
import "./requisitionListPage-CxtdksCl.js";
let Tt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_3;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_4;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_5;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_6;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_7;
        } catch  {}
    })()
]).then(async ()=>{
    let be, e, fe, ge, he;
    be = G();
    ({ t: e } = B());
    fe = await re();
    ge = ({ vesselValue: r, category: b, formDisabled: a })=>[
            {
                field: "reqNo",
                component: "NInput",
                label: e("requisitionOrder.detailsTab.requisitionNo"),
                componentProps: {
                    disabled: !0,
                    placeholder: e("common.autoPlaceholderText")
                }
            },
            {
                field: "title",
                component: "NInput",
                label: e("requisitionOrder.detailsTab.title"),
                componentProps: {
                    disabled: o(a),
                    placeholder: e("requisitionOrder.detailsTab.title")
                },
                rules: [
                    {
                        required: !0,
                        message: e("requisitionOrder.detailsTab.titleRequired"),
                        trigger: [
                            "blur"
                        ]
                    }
                ]
            },
            {
                field: "shipId",
                component: "BasicSelect",
                label: e("requisitionOrder.detailsTab.vesselName"),
                defaultValue: r,
                componentProps: {
                    style: {
                        width: "100%"
                    },
                    disabled: !0,
                    placeholder: e("common.autoPlaceholderText"),
                    options: fe
                }
            },
            {
                field: "source",
                component: "BasicSelect",
                label: e("requisitionOrder.detailsTab.applicationSource"),
                defaultValue: E === M.VESSEL ? 1 : E === M.OFFICE ? 2 : void 0,
                componentProps: {
                    disabled: !0,
                    placeholder: e("requisitionOrder.detailsTab.applicationSource"),
                    style: {
                        width: "100%"
                    },
                    options: ae
                },
                rules: [
                    {
                        required: !0,
                        message: e("requisitionOrder.detailsTab.applicationSourceRequired"),
                        trigger: [
                            "change",
                            "blur"
                        ],
                        type: "number"
                    }
                ]
            },
            {
                field: "department",
                component: "BasicSelect",
                label: e("requisitionOrder.detailsTab.department"),
                componentProps: {
                    disabled: o(a),
                    placeholder: e("requisitionOrder.detailsTab.department"),
                    style: {
                        width: "100%"
                    },
                    options: ie
                },
                rules: [
                    {
                        required: !0,
                        message: e("requisitionOrder.detailsTab.departmentRequired"),
                        trigger: [
                            "change",
                            "blur"
                        ],
                        type: "number"
                    }
                ]
            },
            {
                field: "applicant",
                component: "NInput",
                label: e("requisitionOrder.detailsTab.applicant"),
                defaultValue: be.getUserInfo.nickname,
                componentProps: {
                    disabled: !0,
                    placeholder: e("common.autoPlaceholderText")
                }
            },
            {
                field: "category",
                component: "BasicSelect",
                label: e("requisitionOrder.detailsTab.procurementCategory"),
                defaultValue: b,
                componentProps: {
                    style: {
                        width: "100%"
                    },
                    disabled: !0,
                    placeholder: e("common.autoPlaceholderText"),
                    options: se
                }
            },
            {
                field: "applyDate",
                component: "NDatePicker",
                label: e("requisitionOrder.detailsTab.dateOfApplication"),
                defaultValue: y().format("YYYY-MM-DD"),
                componentProps: {
                    disabled: !0,
                    placeholder: e("requisitionOrder.detailsTab.dateOfApplication"),
                    valueFormat: "yyyy-MM-dd"
                }
            },
            {
                field: "priority",
                component: "BasicSelect",
                label: e("requisitionOrder.detailsTab.priority"),
                componentProps: {
                    disabled: o(a),
                    placeholder: e("requisitionOrder.detailsTab.priority"),
                    style: {
                        width: "100%"
                    },
                    options: le
                },
                rules: [
                    {
                        required: !0,
                        message: e("requisitionOrder.detailsTab.priorityRequired"),
                        trigger: [
                            "change",
                            "blur"
                        ],
                        type: "number"
                    }
                ]
            },
            {
                field: "expectedPlace",
                label: e("requisitionOrder.detailsTab.expectedPlace"),
                slot: "receivePortSlot",
                componentProps: {
                    disabled: o(a),
                    placeholder: e("requisitionOrder.detailsTab.expectedPlace")
                }
            },
            {
                field: "expectedDate",
                component: "NDatePicker",
                label: e("requisitionOrder.detailsTab.expectedDate"),
                componentProps: {
                    disabled: o(a),
                    placeholder: e("requisitionOrder.detailsTab.expectedDate"),
                    valueFormat: "yyyy-MM-dd",
                    isDateDisabled: (u)=>y(u).isBefore(y(), "day")
                }
            },
            {
                field: "project",
                component: "NInput",
                label: e("requisitionOrder.detailsTab.project"),
                componentProps: {
                    disabled: o(a),
                    placeholder: e("requisitionOrder.detailsTab.project"),
                    options: []
                }
            },
            {
                field: "reason",
                component: "NInput",
                label: e("requisitionOrder.detailsTab.applicationReason"),
                giProps: {
                    span: 3
                },
                componentProps: {
                    disabled: o(a),
                    placeholder: e("requisitionOrder.detailsTab.applicationReason"),
                    type: "textarea",
                    showCount: !0,
                    maxlength: 500,
                    autosize: {
                        minRows: 3,
                        maxRows: 3
                    }
                },
                rules: [
                    {
                        required: !0,
                        message: e("requisitionOrder.detailsTab.applicationReasonRequired"),
                        trigger: [
                            "blur"
                        ]
                    }
                ]
            },
            {
                field: "itemDetails",
                giProps: {
                    span: 6
                },
                slot: "itemDetailsSlot"
            }
        ];
    he = {
        class: "font-medium text-lg text-[#42495c] text-left relative pl-3 before:content-[''] before:absolute before:top-1/2 before:left-0 before:-translate-y-1/2 before:block before:w-[3px] before:h-3 before:bg-[#0ec06a]"
    };
    Tt = K({
        __name: "index",
        props: V({
            vesselValue: {},
            procurementCategory: {},
            reqFormOtherInfo: {}
        }, {
            vesselValue: {},
            vesselValueModifiers: {},
            procurementCategory: {},
            procurementCategoryModifiers: {}
        }),
        emits: V([
            "changeKeyWordsDisabled",
            "resolveSubModuleCode",
            "tableListDataLengthChange"
        ], [
            "update:vesselValue",
            "update:procurementCategory"
        ]),
        setup (r, { expose: b, emit: a }) {
            const { t: u } = B(), i = r, c = C({}), N = C({}), q = D(r, "vesselValue"), T = D(r, "procurementCategory"), f = a, _ = Y(), P = x(()=>_.query.type ?? d.CREATE), O = x(()=>me([
                    d.VIEW,
                    d.APPROVE,
                    d.EDITED
                ], P.value));
            function A(t) {
                return de({
                    ...t,
                    ...o(c)
                });
            }
            function L(t) {
                N.value = t;
            }
            function k() {
                P.value !== d.CREATE && ue(i.reqFormOtherInfo.id).then((t)=>{
                    if (!t.shipId || !t.category) {
                        q.value = void 0, T.value = void 0, Q().error("Required fields shipId or category are missing.");
                        return;
                    }
                    q.value = t?.shipId ? t.shipId + "" : void 0, T.value = t?.category, f("resolveSubModuleCode", t.approveFlow), S(()=>{
                        s.setFieldsValue({
                            reqNo: t.reqNo,
                            title: t.title,
                            source: t.source,
                            department: t.department,
                            applicant: t.applicant,
                            applyDate: t.applyDate,
                            priority: t.priority,
                            expectedPlace: t.expectedPlace,
                            expectedDate: t.expectedDate,
                            project: t.project,
                            reason: t.reason
                        });
                    });
                });
            }
            const g = $("itemDetailsTableRef");
            I(()=>i.procurementCategory, ()=>{
                g.value && (s.resetFields(), s.clearValidate(), s.setFieldsValue({
                    category: i.procurementCategory,
                    shipId: i.vesselValue
                }), g.value.reloadTable());
            }), I(()=>i.vesselValue, ()=>{
                g.value && S(()=>{
                    s.setFieldsValue({
                        shipId: i.vesselValue
                    });
                });
            });
            const [W, s] = te({
                schemas: ge({
                    vesselValue: i.vesselValue,
                    category: i.procurementCategory,
                    formDisabled: O
                }),
                labelWidth: "60px",
                gridProps: {
                    cols: 6,
                    xGap: 15
                },
                showAdvancedButton: !1,
                showActionButtonGroup: !1
            });
            return z(()=>{
                k();
            }), b({
                ...s
            }), (t, l)=>{
                const j = X, U = J;
                return R(), F(U, null, {
                    default: m(()=>[
                            v(j, {
                                bordered: !1,
                                class: "proCard",
                                "content-class": "p-0"
                            }, {
                                default: m(()=>[
                                        w("h2", he, [
                                            w("div", null, Z(o(u)("requisitionOrder.detailsTab.basicDetails")), 1)
                                        ]),
                                        v(o(ee), {
                                            onRegister: o(W)
                                        }, {
                                            receivePortSlot: m(({ model: n, field: h })=>[
                                                    v(o(oe), {
                                                        class: "w-full",
                                                        labelField: "port",
                                                        valueField: "id",
                                                        value: n[h],
                                                        "onUpdate:value": (p)=>n[h] = p,
                                                        formValues: o(c),
                                                        "onUpdate:formValues": l[0] || (l[0] = (p)=>H(c) ? c.value = p : null),
                                                        onChange: L,
                                                        onClear: ()=>o(s).setFieldsValue({
                                                                [h]: void 0
                                                            }),
                                                        multiple: !1,
                                                        formProps: o(ne),
                                                        selectTitle: o(u)("common.selectPort"),
                                                        disabled: o(O),
                                                        tableProps: {
                                                            rowKey: (p)=>p.id,
                                                            request: A,
                                                            columns: o(pe)(),
                                                            pagination: {
                                                                simple: !0
                                                            }
                                                        }
                                                    }, null, 8, [
                                                        "value",
                                                        "onUpdate:value",
                                                        "formValues",
                                                        "onClear",
                                                        "formProps",
                                                        "selectTitle",
                                                        "disabled",
                                                        "tableProps"
                                                    ])
                                                ]),
                                            itemDetailsSlot: m(()=>[
                                                    (R(), F(ce, {
                                                        key: `${r.vesselValue}-${r.procurementCategory}`,
                                                        ref: "itemDetailsTableRef",
                                                        vesselValue: r.vesselValue,
                                                        procurementCategory: r.procurementCategory,
                                                        reqFormOtherInfo: t.reqFormOtherInfo,
                                                        onChangeKeyWordsDisabled: l[1] || (l[1] = (n)=>f("changeKeyWordsDisabled", n)),
                                                        onTableListDataLengthChange: l[2] || (l[2] = (n)=>f("tableListDataLengthChange", n))
                                                    }, null, 8, [
                                                        "vesselValue",
                                                        "procurementCategory",
                                                        "reqFormOtherInfo"
                                                    ]))
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Tt as default, __tla };
