import { _ as E } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { B as L } from "./BasicForm-dL_oCSPM.js";
import { a5 as I, _ as T, a6 as W } from "./template-rpthWlT9.js";
import { V as g, bk as $, d as q, r as l, c as A, o as O, l as c, w as v, j as V, aj as j, ac as D, cZ as z, __tla as __tla_0 } from "./index-9PRMimni.js";
import { e as G, a as H } from "./configureForm-RWeNQ4IB.js";
import { u as Z } from "./useModal-CO65vga3.js";
import { u as J } from "./useForm-CKmgcynv.js";
let se, Q;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: e } = g(), n = $(), p = await I(), d = await T(), K = await W();
    Q = function() {
        const i = [
            {
                field: "module",
                component: "NSelect",
                label: e("configureForm.module"),
                componentProps: {
                    placeholder: e("configureForm.module"),
                    options: p,
                    labelField: n.getLocale === "en" ? "labelEn" : "label"
                }
            },
            {
                field: "rank",
                component: "NSelect",
                label: e("configureForm.rank"),
                componentProps: {
                    placeholder: e("configureForm.rank"),
                    options: d,
                    labelField: n.getLocale === "en" ? "shortNameEn" : "name",
                    valueField: "id"
                }
            }
        ], t = [
            {
                field: "module",
                component: "NSelect",
                label: e("configureForm.module"),
                labelWidth: 120,
                giProps: {
                    span: 2
                },
                componentProps: {
                    placeholder: e("configureForm.module"),
                    options: p,
                    labelField: n.getLocale === "en" ? "labelEn" : "label"
                },
                rules: [
                    {
                        required: !0,
                        message: `${e("common.inputText")} ${e("configureForm.module")}`,
                        trigger: [
                            "blur"
                        ]
                    }
                ]
            },
            {
                field: "contentCn",
                component: "NInput",
                label: e("configureForm.contentCn"),
                labelWidth: 120,
                giProps: {
                    span: 2
                },
                componentProps: {
                    placeholder: e("configureForm.contentCn")
                },
                rules: [
                    {
                        required: !0,
                        message: e("common.inputText") + " " + e("configureForm.contentCn"),
                        trigger: [
                            "blur",
                            "change"
                        ]
                    }
                ]
            },
            {
                field: "contentEn",
                component: "NInput",
                label: e("configureForm.contentEn"),
                labelWidth: 120,
                giProps: {
                    span: 2
                },
                componentProps: {
                    placeholder: e("configureForm.contentEn")
                },
                rules: [
                    {
                        required: !0,
                        message: e("common.inputText") + " " + e("configureForm.contentEn"),
                        trigger: [
                            "blur",
                            "change"
                        ]
                    }
                ]
            },
            {
                field: "rank",
                component: "NSelect",
                label: e("configureForm.rank"),
                labelWidth: 120,
                giProps: {
                    span: 2
                },
                componentProps: {
                    placeholder: e("configureForm.rank"),
                    options: d,
                    labelField: n.getLocale === "en" ? "shortNameEn" : "name"
                },
                rules: [
                    {
                        required: !0,
                        message: `${e("common.inputText")} ${e("configureForm.rank")}`,
                        trigger: [
                            "blur"
                        ]
                    }
                ]
            },
            {
                field: "shipCategory",
                component: "NSelect",
                label: e("configureForm.shipCategory"),
                labelWidth: 120,
                giProps: {
                    span: 2
                },
                componentProps: {
                    placeholder: e("configureForm.shipCategory"),
                    options: K,
                    labelField: n.getLocale === "en" ? "labelEn" : "label"
                },
                rules: [
                    {
                        required: !0,
                        message: `${e("common.inputText")} ${e("configureForm.shipCategory")}`,
                        trigger: [
                            "blur"
                        ]
                    }
                ]
            },
            {
                field: "sort",
                component: "NInputNumber",
                label: e("configureForm.sort"),
                labelWidth: 120,
                giProps: {
                    span: 2
                },
                componentProps: {
                    showButton: !1,
                    placeholder: e("configureForm.sort")
                },
                rules: [
                    {
                        type: "number",
                        required: !0,
                        message: e("common.inputText") + " " + e("configureForm.sort"),
                        trigger: [
                            "blur",
                            "change"
                        ]
                    }
                ]
            }
        ];
        return {
            schemas: i,
            formAddSchemas: t
        };
    };
    let U;
    U = {
        name: "AddModal"
    };
    se = q({
        ...U,
        emits: [
            "success"
        ],
        setup (i, { expose: t, emit: f }) {
            const { t: h } = g(), b = z(), F = f, _ = l(), k = l(), a = l(), [C, { openModal: P, closeModal: m, setSubLoading: s, setProps: w }] = Z({
                title: "",
                width: 500
            }), { formAddSchemas: u } = Q(), [y, { submit: x, setFieldsValue: N }] = J({
                gridProps: {
                    cols: 1
                },
                schemas: u,
                labelPlacement: "left",
                showActionButtonGroup: !1,
                layout: "horizontal"
            });
            function R(o, r) {
                w({
                    title: o
                }), P(), a.value = j(r || {}), D(()=>{
                    N(r);
                });
            }
            async function S() {
                const o = await x();
                if (!o) {
                    b.warning(h("configureForm.pleaseCheckIfTheContentHasBeenFilledInCompletely"));
                    return;
                }
                try {
                    a.value?.id ? await G({
                        ...o,
                        id: a.value?.id
                    }) : await H(o), m(), s(!1), F("success");
                } catch  {
                    s(!1);
                }
                s(!0), m();
            }
            return t({
                handleOpenModal: R
            }), (o, r)=>{
                const M = L, B = E;
                return O(), A(B, {
                    ref_key: "modalRef",
                    ref: _,
                    onRegister: c(C),
                    onOnOk: S
                }, {
                    default: v(()=>[
                            V(M, {
                                ref_key: "formAddFormRef",
                                ref: k,
                                onRegister: c(y),
                                schemas: c(u)
                            }, null, 8, [
                                "onRegister",
                                "schemas"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { se as _, Q as c, __tla };
