import { V as T, bk as N, gI as h, d as w, ay as g, aw as _, c as y, o as I, X as x, w as m, j as p, ee as S, k as R, aA as A, l as c, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as E } from "./BasicForm-dL_oCSPM.js";
import { u as q } from "./useForm-CKmgcynv.js";
import { g as k } from "./equipmentMainLibrary-bJTzj5mC.js";
import { i as L } from "./isEmpty-BUg1OsQj.js";
let W, d;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: e } = T();
    d = function({ isCancelPendingApproval: o, isExtensionPendingApproval: l, cyclingPattern: n } = {
        isCancelPendingApproval: !1,
        isExtensionPendingApproval: !1,
        cyclingPattern: 1
    }) {
        return [
            {
                field: "jobTitle",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.jobTitle"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "jobCode",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.jobCode"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "equipmentCode",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.equipmentCode"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "equipmentName",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.equipmentName"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "jobType",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.jobType"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "department",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.department"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "pic",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.picDiscipline"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "jobPriority",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.jobPriority"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "jobInterval",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.interval"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "frequency",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.frequency"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "lastDoneDate",
                component: "NDatePicker",
                label: e("jobPlan.viewDetails.jobDetailsTab.lastDoneDate"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "nextDueDate",
                component: "NDatePicker",
                label: e("jobPlan.viewDetails.jobDetailsTab.nextDueDate"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "lastDoneHrs",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.lastDoneHours"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "nextDueHrs",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.nextDueHours"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "presentRHrs",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.presentHours"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "hoursRemain",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.hoursRemain"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "criticalToSafety",
                component: "NSelect",
                label: e("jobPlan.viewDetails.jobDetailsTab.criticalToSafety"),
                componentProps: {
                    placeholder: "",
                    options: [
                        {
                            label: e("common.yes"),
                            value: !0
                        },
                        {
                            label: e("common.no"),
                            value: !1
                        }
                    ]
                }
            },
            {
                field: "rARequired",
                component: "NSelect",
                label: e("jobPlan.viewDetails.jobDetailsTab.raRequired"),
                componentProps: {
                    placeholder: "",
                    options: [
                        {
                            label: e("common.yes"),
                            value: !0
                        },
                        {
                            label: e("common.no"),
                            value: !1
                        }
                    ]
                }
            },
            {
                field: "workPermit",
                component: "NSelect",
                label: e("jobPlan.viewDetails.jobDetailsTab.workPermit"),
                componentProps: {
                    placeholder: "",
                    options: [
                        {
                            label: e("common.yes"),
                            value: !0
                        },
                        {
                            label: e("common.no"),
                            value: !1
                        }
                    ]
                }
            },
            {
                field: "jobAssignedTo",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.jobAssignedTo"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "estimateTime",
                label: e("jobPlan.viewDetails.jobDetailsTab.estimatedTime"),
                slot: "estimateTime",
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "estimateTimeUnit",
                hidden: !0
            },
            {
                field: "estimateWorkforce",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.estimatedWorkforce"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "maintenanceType",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.maintenanceType"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "jobStatus",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.jobStatus"),
                giProps: {
                    span: 2
                },
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "jobDescription",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.jobDescription"),
                giProps: {
                    span: 3
                },
                componentProps: {
                    type: "textarea",
                    autosize: {
                        minRows: 6,
                        maxRows: 10
                    },
                    placeholder: ""
                }
            },
            {
                field: "specialNote",
                component: "NInput",
                label: e("jobPlan.viewDetails.jobDetailsTab.specialNote"),
                giProps: {
                    span: 2
                },
                componentProps: {
                    type: "textarea",
                    autosize: {
                        minRows: 6,
                        maxRows: 10
                    },
                    placeholder: ""
                }
            },
            {
                field: "extensionDate",
                component: "NDatePicker",
                hidden: !l || n !== 1,
                label: e("jobPlan.viewDetails.jobDetailsTab.jobExtensionDate"),
                componentProps: {
                    placeholder: ""
                }
            },
            {
                field: "extensionHrs",
                component: "NInputNumber",
                hidden: !l || n !== 2,
                label: e("jobPlan.viewDetails.jobDetailsTab.jobExtensionHours"),
                componentProps: {
                    min: 1,
                    precision: 0,
                    placeholder: ""
                }
            },
            {
                field: "extensionReason",
                component: "NInput",
                hidden: !l,
                label: e("jobPlan.viewDetails.jobDetailsTab.jobExtensionReason"),
                giProps: {
                    span: 4
                },
                componentProps: {
                    type: "textarea",
                    autosize: {
                        minRows: 1,
                        maxRows: 4
                    },
                    placeholder: ""
                }
            },
            {
                field: "cancellationReason",
                component: "NInput",
                hidden: !o,
                label: e("jobPlan.viewDetails.jobDetailsTab.jobCancellationReason"),
                giProps: {
                    span: 4
                },
                componentProps: {
                    type: "textarea",
                    autosize: {
                        minRows: 1,
                        maxRows: 4
                    },
                    placeholder: ""
                }
            }
        ];
    };
    const C = await k("pms_frequency"), a = N(), H = h(C, (o)=>({
            label: o.label,
            labelEn: o.labelEn,
            value: +o.value,
            raw: o
        }));
    function j(o) {
        if (!o) return {};
        const l = a.getLocale === "en" ? o.jobStatusNameEn : o.jobStatusName, n = a.getLocale === "en" ? o.jobApprovalStatusNameEn : o.jobApprovalStatusName, r = `${l} ${n ? ` , ${n}` : ""}`;
        return {
            ...o,
            jobType: a.getLocale === "en" ? o.jobTypeNameEn : o.jobTypeName,
            department: a.getLocale === "en" ? o.departmentNameEn : o.departmentName,
            pic: a.getLocale === "en" ? o.picNameEn : o.picName,
            jobPriority: a.getLocale === "en" ? o.jobPriorityNameEn : o.jobPriorityName,
            frequency: a.getLocale === "en" ? o.frequencyNameEn : o.frequencyName,
            jobAssignedTo: a.getLocale === "en" ? o.jobAssignedToNameEn : o.jobAssignedToName,
            maintenanceType: a.getLocale === "en" ? o.maintenanceTypeNameEn : o.maintenanceTypeName,
            jobStatus: r
        };
    }
    W = w({
        __name: "index",
        props: {
            data: {}
        },
        setup (o, { expose: l }) {
            const n = o, [r, i] = q({
                gridProps: {
                    cols: "5"
                },
                schemas: d({
                    isCancelPendingApproval: n.data?.jobStatus === 6,
                    isExtensionPendingApproval: n.data?.jobApprovalStatus === 2,
                    cyclingPattern: n.data?.cyclingPattern
                }),
                labelPlacement: "top",
                showAdvancedButton: !1,
                showActionButtonGroup: !1
            });
            return g(()=>n.data, (t)=>{
                L(t) || (i?.setFieldsValue(j(t)), i?.setSchema(d({
                    isCancelPendingApproval: t.jobStatus === 6,
                    isExtensionPendingApproval: t.jobApprovalStatus === 2,
                    cyclingPattern: t.cyclingPattern
                })));
            }), _(()=>{
                i?.setFieldsValue(j(n.data));
            }), l({
                methods: i
            }), (t, U)=>{
                const P = R, D = A, f = S, v = x;
                return I(), y(v, null, {
                    default: m(()=>[
                            p(c(E), {
                                onRegister: c(r),
                                disabled: !0
                            }, {
                                estimateTime: m(({ model: s, field: u })=>[
                                        p(f, null, {
                                            default: m(()=>[
                                                    p(P, {
                                                        value: s[u],
                                                        "onUpdate:value": (b)=>s[u] = b,
                                                        placeholder: ""
                                                    }, null, 8, [
                                                        "value",
                                                        "onUpdate:value"
                                                    ]),
                                                    p(D, {
                                                        value: s.estimateTimeUnit,
                                                        "onUpdate:value": (b)=>s.estimateTimeUnit = b,
                                                        options: c(H),
                                                        "label-field": c(a).getLocale === "en" ? "labelEn" : "label",
                                                        style: {
                                                            width: "140px"
                                                        },
                                                        placeholder: ""
                                                    }, null, 8, [
                                                        "value",
                                                        "onUpdate:value",
                                                        "options",
                                                        "label-field"
                                                    ])
                                                ]),
                                            _: 2
                                        }, 1024)
                                    ]),
                                _: 1
                            }, 8, [
                                "onRegister"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { W as _, d as c, __tla };
