import { _ as I } from "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import { e as P, __tla as __tla_0 } from "./schemas-BqGurRC_.js";
import { z as T, A as V } from "./template-rpthWlT9.js";
import { B as D } from "./BasicForm-dL_oCSPM.js";
import { u as N } from "./useForm-CKmgcynv.js";
import { d as z, V as E, u as G, r, c as H, o as L, l as c, w as i, j as p, B as O, p as $, A as q, H as J, __tla as __tla_1 } from "./index-9PRMimni.js";
import { u as K } from "./useModal-CO65vga3.js";
let ae;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    let Q;
    Q = {
        name: "ExamineAndApproveForm"
    };
    ae = z({
        ...Q,
        emits: [
            "success"
        ],
        setup (U, { expose: v, emit: g }) {
            const { t: o } = E(), t = G(), h = r(), m = r(0), l = r(""), d = r(0), f = g, { examineAndApproveSchema: w, methods: A } = P(), [y, { getFieldsValue: _, setSchema: R, submit: b }] = N({
                gridProps: {
                    cols: 13
                },
                schemas: w,
                labelPlacement: "left",
                showActionButtonGroup: !1,
                showAdvancedButton: !1
            }), [x, { openModal: B, closeModal: a, setSubLoading: F }] = K({
                title: o("crewTraining.reviewComments"),
                width: 500
            });
            function C(e, s, n) {
                m.value = e, l.value = s, d.value = n;
                const u = A.updateType(n);
                R(u), B();
            }
            async function M() {
                d.value === 1 ? j() : k();
            }
            async function j() {
                try {
                    const e = await T({
                        comment: _().remark,
                        busId: m.value,
                        moduleCode: l.value
                    });
                    e.data.code === 200 ? (t.success(o("jobPlan.viewDetails.btnApprove")), a(), f("success")) : t.error(e.data.msg);
                } catch  {
                    a();
                }
            }
            async function k() {
                if (!await b()) return F(!1), !1;
                try {
                    const s = await V({
                        comment: _().remark,
                        busId: m.value,
                        moduleCode: l.value
                    });
                    if (s.data.code === 200) {
                        t.success(o("jobPlan.viewDetails.btnReturn")), f("success");
                        return;
                    } else t.error(s.data.msg);
                    a();
                } catch  {
                    a();
                }
            }
            return v({
                handleOpenModal: C
            }), (e, s)=>{
                const n = O, u = J, S = I;
                return L(), H(S, {
                    ref_key: "modalRef",
                    ref: h,
                    onRegister: c(x)
                }, {
                    default: i(()=>[
                            p(c(D), {
                                onRegister: c(y)
                            }, null, 8, [
                                "onRegister"
                            ])
                        ]),
                    action: i(()=>[
                            p(u, {
                                class: "flex-1",
                                justify: "center"
                            }, {
                                default: i(()=>[
                                        p(n, {
                                            type: "primary",
                                            onClick: M
                                        }, {
                                            default: i(()=>[
                                                    $(q(c(o)("crewTraining.confirm")), 1)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            })
                        ]),
                    _: 1
                }, 8, [
                    "onRegister"
                ]);
            };
        }
    });
});
export { ae as _, __tla };
