import { d as y, V as w, r as n, ay as J, ac as C, d9 as x, c as D, o as c, w as R, D as T, aE as E, H as N, l, gE as S, h as F, j as V, X as j, cZ as I, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as L } from "./BasicForm-dL_oCSPM.js";
import { c as M, __tla as __tla_1 } from "./schemas-Dz7LnyWK.js";
import { u as G, v as $ } from "./vesselEquipmentDetails-CJeqdW1Z.js";
import { u as z } from "./useForm-CKmgcynv.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 "./vuedraggable.umd-Co2xEC3p.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 "./schemas-Cam1kIsU.js";
import "./template-rpthWlT9.js";
import "./usePageCache-DluHn7Yy.js";
let ve;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    let A;
    A = {
        "loading-background": "transparent"
    };
    ve = y({
        __name: "JobDetails",
        props: {
            selectedJobPlanParams: {},
            isEditable: {
                type: Boolean
            }
        },
        emits: [
            "success"
        ],
        setup (i, { emit: m }) {
            const o = i, p = m, { t: u } = w(), d = I(), t = n(), a = n(!0), s = n(!1), { jobDetailSchemas: _ } = M({
                readonly: a
            }), [f, { submit: b, setFieldsValue: g, resetFields: h }] = z({
                gridProps: {
                    cols: 12
                },
                layout: "horizontal",
                labelPlacement: "top",
                schemas: _,
                showActionButtonGroup: !1
            });
            J(()=>o.selectedJobPlanParams, (e)=>{
                e && r();
            }, {
                immediate: !0,
                deep: !0
            });
            async function r() {
                await h();
                try {
                    t.value = !0;
                    const e = await G(o.selectedJobPlanParams || {});
                    await C(), g(e || {}), a.value = !0, t.value = !1;
                } catch  {
                    t.value = !1;
                }
            }
            async function H() {
                const e = await b();
                if (e) {
                    s.value = !0;
                    try {
                        await $({
                            ...e,
                            model: o.selectedJobPlanParams?.model,
                            belongToModel: o.selectedJobPlanParams?.belongToModel,
                            serialNumber: o.selectedJobPlanParams?.serialNumber,
                            shipId: o.selectedJobPlanParams?.shipId
                        }), d.success(u("common.optionsEditSuccessText")), await r(), a.value = !0, s.value = !1, p("success");
                    } catch  {
                        s.value = !1;
                    }
                }
            }
            return (e, v)=>{
                const W = S, X = N, P = L, B = j, k = x("loading");
                return c(), D(B, null, {
                    default: R(()=>[
                            T("", !0),
                            E((c(), F("div", A, [
                                V(P, {
                                    ref: "formRef",
                                    class: "mt-2",
                                    onRegister: l(f)
                                }, null, 8, [
                                    "onRegister"
                                ])
                            ])), [
                                [
                                    k,
                                    l(t)
                                ]
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { ve as default, __tla };
