import { _ as w } 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 y } from "./BasicForm-dL_oCSPM.js";
import { c as x, __tla as __tla_0 } from "./schemas-Dz7LnyWK.js";
import { l as B } from "./vesselEquipmentDetails-CJeqdW1Z.js";
import { d as k, V as A, c as P, o as S, l as t, w as j, j as F, ac as N, cZ as O, __tla as __tla_1 } from "./index-9PRMimni.js";
import { u as V } from "./useModal-CO65vga3.js";
import { u as C } from "./useForm-CKmgcynv.js";
let $;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    $ = k({
        __name: "AddJobPlanModal",
        props: {
            selectedTreeItem: {}
        },
        emits: [
            "success"
        ],
        setup (a, { expose: c, emit: n }) {
            const e = a, r = n, m = O(), { t: i } = A(), [l, { openModal: d, closeModal: p, setSubLoading: s, setProps: u }] = V({
                title: "",
                width: 1200
            }), { jobDetailSchemas: f } = x({
                formType: "add"
            }), [b, { submit: T, setFieldsValue: _ }] = C({
                gridProps: {
                    cols: 12
                },
                layout: "horizontal",
                labelPlacement: "top",
                schemas: f,
                showActionButtonGroup: !1
            });
            async function g(o) {
                u({
                    title: o
                }), d(), await N(), _({
                    equipmentCode: e.selectedTreeItem?.code,
                    equipmentName: e.selectedTreeItem?.name,
                    ifActive: !0,
                    jobType: 1,
                    maintenanceType: 3,
                    jobAssignedTo: 4
                });
            }
            async function h() {
                const o = await T();
                if (!o) {
                    s(!1);
                    return;
                }
                try {
                    await B({
                        ...o,
                        model: e.selectedTreeItem?.model,
                        belongToModel: e.selectedTreeItem?.belongToModel,
                        serialNumber: e.selectedTreeItem?.serialNumber,
                        shipId: e.selectedTreeItem?.shipId
                    }), m.success(i("common.optionsAddSuccessText")), p(), s(!1), r("success");
                } catch  {
                    s(!1);
                }
            }
            return c({
                handleOpenModal: g
            }), (o, I)=>{
                const M = y, R = w;
                return S(), P(R, {
                    ref: "modalRef",
                    onRegister: t(l),
                    onOnOk: h
                }, {
                    default: j(()=>[
                            F(M, {
                                ref: "formRef",
                                onRegister: t(b)
                            }, null, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { $ as _, __tla };
