import { V as u, bk as y, gL as m, hc as f, __tla as __tla_0 } from "./index-9PRMimni.js";
import { a as j } from "./requisitionOrder-D0IG9N7e.js";
import { r as c } from "./dictUtils-D8jA3mBt.js";
import { h as O } from "./has-CjqcrIOV.js";
let L, I;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    let p, e, a, P, H, d;
    p = y();
    ({ t: e } = u());
    a = await f();
    P = await m("pms_frequency");
    H = await m("eq_location");
    d = a && a.length > 0 ? a[0].id : "";
    I = (t)=>{
        const o = async ({ shipId: r, code: l = "0", model: n = "0", serialNumber: b = "0" })=>(await j({
                shipId: r,
                code: l,
                model: n,
                serialNumber: b
            })).map((s)=>({
                    label: s.name,
                    value: s.code + "-" + s.model + "-" + s.serialNumber,
                    isLeaf: s.ifLeaf,
                    raw: s
                }));
        return {
            schemas: [
                {
                    field: "planId",
                    hidden: !0
                },
                {
                    field: "shipId",
                    component: "NSelect",
                    label: e("jobOrderHistory.vessel"),
                    componentProps: {
                        options: a,
                        defaultValue: d,
                        clearable: !1,
                        filterable: !0,
                        "label-field": p.getLocale === "en" ? "shipNameEn" : "shipName",
                        "value-field": "id",
                        onUpdateValue: (r)=>{
                            t.initCodePrefixOptions(r), t.shipId.value = r;
                        }
                    }
                },
                {
                    field: "equipmentType",
                    component: "NCascader",
                    label: e("jobOrderHistory.equipmentType"),
                    componentProps: ({ formAction: r })=>{
                        const { getFieldsValue: l } = r;
                        return {
                            checkStrategy: "parent",
                            showPath: !1,
                            allowCheckingNotLoaded: !0,
                            options: t.codePrefixOptions.value,
                            remote: !0,
                            onLoad: async (n)=>{
                                O(l(), "shipId") && (t.shipId.value = l().shipId), n.children = await o({
                                    shipId: t.shipId.value,
                                    code: n.raw.code,
                                    model: n.raw.model,
                                    serialNumber: n.raw.serialNumber
                                });
                            }
                        };
                    }
                },
                {
                    field: "equipmentName",
                    component: "NInput",
                    label: e("jobOrderHistory.equipmentName"),
                    componentProps: {}
                },
                {
                    field: "jobDoneDates",
                    component: "NDatePicker",
                    label: e("jobOrderHistory.jobDoneDate"),
                    componentProps: {
                        placeholder: e("jobOrderHistory.jobDoneDate"),
                        type: "daterange",
                        valueFormat: "yyyy-MM-dd"
                    }
                },
                {
                    field: "jobCodeOrTitle",
                    component: "NInput",
                    label: e("jobOrderHistory.jobLabelOrjobCode"),
                    componentProps: {}
                },
                {
                    label: e("jobOrderHistory.completedWork"),
                    component: "NInput",
                    field: "completeContent",
                    componentProps: {}
                },
                {
                    label: e("jobOrderHistory.department"),
                    field: "department",
                    component: "BasicSelect",
                    componentProps: {
                        block: !0,
                        cacheKey: "vessel_department"
                    }
                }
            ],
            initShipValue: d
        };
    };
    L = ()=>({
            schemas: [
                {
                    title: e("jobOrderHistory.vesselInfo"),
                    class: "bg-gray-100 py-4 px-6 mb-4 ",
                    column: 3,
                    componentProps: {},
                    descriptions: [
                        {
                            label: e("jobOrderHistory.vesselName"),
                            field: p.getLocale === "en" ? "shipNameEn" : "shipName",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.imo"),
                            field: "imo",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.managementCompany"),
                            field: p.getLocale === "en" ? "companyNameEn" : "companyName",
                            span: 1,
                            componentProps: {}
                        }
                    ]
                },
                {
                    title: e("jobOrderHistory.productInfo"),
                    class: "bg-gray-100 py-4 px-6 mb-4",
                    column: 3,
                    componentProps: {},
                    descriptions: [
                        {
                            label: e("jobOrderHistory.productLabel"),
                            field: "equipmentName",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.band"),
                            field: "maker",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.productType"),
                            field: "model",
                            span: 1,
                            componentProps: {},
                            customRender: (o)=>o.model ? o.model.includes("default") ? "" : o.model : ""
                        },
                        {
                            label: e("jobOrderHistory.serialNo"),
                            field: "serialNo",
                            span: 1,
                            componentProps: {},
                            customRender: (o)=>o.serialNo && o.serialNo.split("_")[0] !== "default" ? o.serialNo : ""
                        },
                        {
                            label: e("jobOrderHistory.builder"),
                            field: "manufacturer",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.location"),
                            field: "location",
                            span: 1,
                            componentProps: {},
                            customRender: (o)=>c(H, o.location)
                        },
                        {
                            label: e("jobOrderHistory.runningHours"),
                            field: "runningHours",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.timeSinceLastJob"),
                            field: "timeSinceLastJob",
                            span: 1,
                            componentProps: {}
                        }
                    ]
                },
                {
                    title: e("jobOrderHistory.activityInfo"),
                    class: "bg-gray-100 py-4 px-6 mb-4",
                    column: 4,
                    componentProps: {},
                    descriptions: [
                        {
                            label: e("jobOrderHistory.jobTitle"),
                            field: "jobTitle",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.jobCode"),
                            field: "jobCode",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.internal"),
                            field: "jobInterval",
                            span: 1,
                            componentProps: {},
                            customRender (o) {
                                return o.jobInterval ? `${o.jobInterval} ${o.frequencyNameEn}` : void 0;
                            }
                        },
                        {
                            label: e("jobOrderHistory.pic"),
                            field: "picNameEn",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.criticalToSafety"),
                            field: "criticalToSafety",
                            span: 4,
                            componentProps: {},
                            customRender (o) {
                                return o.criticalToSafety ? e("common.yes") : e("common.no");
                            }
                        },
                        {
                            label: e("jobOrderHistory.specialNote"),
                            field: "specialNote",
                            span: 4,
                            componentProps: {}
                        }
                    ]
                },
                {
                    title: e("jobOrderHistory.jobDescription"),
                    class: "bg-gray-100 py-4 px-6 mb-2",
                    column: 1,
                    componentProps: {},
                    descriptions: [
                        {
                            label: "",
                            span: 1,
                            field: "jobDescription",
                            componentProps: {}
                        }
                    ]
                },
                {
                    title: e("jobOrderHistory.jobDoneDetails"),
                    class: "bg-gray-100 py-4 px-6 mb-2 last:mb-0",
                    column: 4,
                    componentProps: {},
                    descriptions: [
                        {
                            label: e("jobOrderHistory.jobStartDate"),
                            field: "jobStartDate",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.jobEndDate"),
                            field: "jobEndDate",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.actualTime"),
                            field: "actualTime",
                            span: 1,
                            componentProps: {},
                            customRender (o) {
                                return o.actualTime ? `${o.actualTime} ${c(P, o.actualTimeUnit)}` : void 0;
                            }
                        },
                        {
                            label: e("jobOrderHistory.actualWorkforce"),
                            field: "actualWorkforce",
                            span: 1,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.jobDoneBy"),
                            field: "jobPlanOrderDoneByVoList",
                            span: 1,
                            componentProps: {
                                "content-class": "max-w-[150px]"
                            },
                            customRender (o) {
                                return o?.jobPlanOrderDoneByVoList?.map((i, r)=>`${i.shortNameEn}${r === o?.jobPlanOrderDoneByVoList.length - 1 ? "" : ","}`).join(";");
                            }
                        },
                        {
                            label: e("jobOrderHistory.isOverhualOrRenewal"),
                            field: "isOverhualOrRenewal",
                            span: 3,
                            componentProps: {}
                        },
                        {
                            label: e("jobOrderHistory.completedWork"),
                            field: "completedWork",
                            span: 4,
                            componentProps: {}
                        }
                    ]
                }
            ]
        });
});
export { L as D, I as c, __tla };
