import { a as k } from "./planner-BebmniHR.js";
import { V as w, bk as b, r as q, __tla as __tla_0 } from "./index-9PRMimni.js";
let P;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: e } = w(), l = b(), S = await k();
    P = function(s = {}) {
        const a = [
            {
                value: 0,
                label: e("hsqe.workpermit.methodOnline")
            },
            {
                value: 1,
                label: e("hsqe.workpermit.methodOffline")
            }
        ], o = [
            {
                value: 0,
                label: e("hsqe.workpermit.statusDraft")
            },
            {
                value: 1,
                label: e("hsqe.workpermit.statusPendingReview")
            },
            {
                value: 2,
                label: e("hsqe.workpermit.statusReturned")
            },
            {
                value: 3,
                label: e("hsqe.workpermit.statusCompleted")
            }
        ], p = [
            {
                value: 1,
                label: e("hsqe.workpermit.filling")
            },
            {
                value: 2,
                label: e("hsqe.workpermit.submitted")
            },
            {
                value: 3,
                label: e("hsqe.workpermit.pendingChief")
            },
            {
                value: 4,
                label: e("hsqe.workpermit.pendingMaster")
            },
            {
                value: 5,
                label: e("hsqe.workpermit.pendingTech")
            },
            {
                value: 6,
                label: e("hsqe.workpermit.pendingMarine")
            },
            {
                value: 7,
                label: e("hsqe.workpermit.pendingSenior")
            },
            {
                value: 8,
                label: e("hsqe.workpermit.returned")
            },
            {
                value: 9,
                label: e("hsqe.workpermit.completed")
            }
        ], m = [
            {
                field: "shipId",
                component: "NSelect",
                label: e("hsqe.workpermit.vessel"),
                componentProps: {
                    options: S,
                    "label-field": l.getLocale === "en" ? "shipNameEn" : "shipName",
                    "value-field": "id"
                }
            },
            {
                field: "workPermitsStatus",
                component: "NSelect",
                label: e("hsqe.workpermit.Status"),
                componentProps: {
                    options: s?.type == "application" ? p : o
                }
            },
            {
                field: "_validateTime_",
                component: "NDatePicker",
                label: e("hsqe.workpermit.validateTime"),
                componentProps ({ model: t }) {
                    return {
                        type: "datetimerange",
                        format: "yyyy-MM-dd HH:00",
                        valueFormat: "yyyy-MM-dd HH:00:00",
                        timePickerProps: {
                            format: "HH:00"
                        },
                        onUpdateValue: (i, r)=>{
                            t.validateTimeStart = r?.[0], t.validateTimeEnd = r?.[1];
                        }
                    };
                }
            }
        ], n = [
            {
                field: "permitsTypeName",
                component: "NInput",
                label: e("hsqe.workpermit.permit"),
                componentProps: {
                    disabled: !0
                },
                rules: [
                    {
                        required: !0,
                        message: `${e("common.inputText")} ${e("hsqe.workpermit.permit")}`,
                        trigger: [
                            "blur"
                        ]
                    }
                ]
            },
            {
                field: "processType",
                component: "NRadioGroup",
                label: e("hsqe.workpermit.applicationMethod"),
                componentProps: {
                    options: a
                },
                rules: [
                    {
                        type: "number",
                        required: !0,
                        message: `${e("common.chooseText")} ${e("hsqe.workpermit.applicationMethod")}`,
                        trigger: [
                            "change"
                        ]
                    }
                ]
            },
            {
                field: "_validateTime_",
                component: "NDatePicker",
                label: e("hsqe.workpermit.validateTime"),
                componentProps ({ model: t }) {
                    return {
                        type: "datetimerange",
                        format: "yyyy-MM-dd HH:00",
                        valueFormat: "yyyy-MM-dd HH:00:00",
                        timePickerProps: {
                            format: "HH:00"
                        },
                        isDateDisabled: (i)=>{
                            const r = new Date;
                            return r.setHours(0, 0, 0, 0), i < r;
                        },
                        onUpdateValue: (i, r)=>{
                            t.validateTimeStart = r?.[0], t.validateTimeEnd = r?.[1];
                        }
                    };
                },
                rules: [
                    {
                        required: !0,
                        type: "array",
                        message: `${e("common.chooseText")} ${e("hsqe.workpermit.validateTime")}`,
                        trigger: [
                            "change"
                        ]
                    }
                ],
                hidden: ({ model: t, field: i })=>{
                    const r = +t.processType != 1;
                    return r && (t[i] = void 0, t.validateTimeStart = "", t.validateTimeEnd = ""), r;
                }
            },
            {
                field: "uploadUrl",
                label: e("hsqe.workpermit.uploadFile"),
                slot: "fileSlot",
                giProps: {
                    span: 1
                },
                rules: [
                    {
                        key: "uploadUrl",
                        required: !0,
                        message: `${e("common.chooseText")} ${e("hsqe.workpermit.uploadFile")}`,
                        trigger: [
                            "change"
                        ]
                    }
                ],
                hidden: ({ model: t, field: i })=>{
                    const r = +t.processType != 1;
                    return r && (t[i] = void 0), r;
                }
            }
        ], c = q([
            {
                title: e("hsqe.workpermit.tableNum"),
                key: "workPermitsNo"
            },
            {
                title: e("hsqe.workpermit.Status"),
                key: "workPermitsStatus",
                width: 200,
                viewFunc (t) {
                    return o.find((r)=>r.value === t?.workPermitsStatus)?.label;
                }
            },
            {
                title: e("hsqe.workpermit.applicationMethod"),
                key: "processType",
                width: 200,
                viewFunc (t) {
                    return a.find((r)=>r.value === t?.processType)?.label;
                }
            },
            {
                title: e("hsqe.workpermit.requestBy"),
                key: "roleNameEn",
                viewFunc (t) {
                    return l.getLocale === "en" ? t?.roleNameEn : t?.roleName;
                }
            },
            {
                title: e("hsqe.workpermit.requestTime"),
                key: "submitTime"
            }
        ]), u = {
            SSC031802: {
                isRelatePermit: !0,
                permitSelectLabel: e("hsqe.workpermit.permitSelectLabelToEnclosedSpace")
            },
            "SQR-WP-04": {
                isRelatePermit: !0,
                permitSelectLabel: e("hsqe.workpermit.permitSelectLabelToOther")
            },
            "SQR-WP-05": {
                isRelatePermit: !0,
                isRelateSafetyReport: !0,
                isRelateRAReport: !0,
                permitSelectLabel: e("hsqe.workpermit.permitSelectLabelToOther"),
                safetyReportSelectLabel: e("hsqe.workpermit.safetyReportSelectLabel"),
                raReportSelectLabel: e("hsqe.workpermit.raReportSelectLabel")
            },
            "SQR-WP-03G": {
                noApprove: !0
            },
            "SQR-WP-08": {
                noApprove: !0
            },
            "SQR-WP-09": {
                noApprove: !0,
                isRelatePermit: !0,
                permitSelectLabel: e("hsqe.workpermit.permitSelectLabelToEnclosedSpace")
            }
        }, d = [
            {
                value: 0,
                label: e("hsqe.workpermit.optionYes")
            },
            {
                value: 1,
                label: e("hsqe.workpermit.optionNo")
            }
        ], h = [
            {
                field: "workPermitsType",
                component: "NSelect",
                label: e("hsqe.workpermit.permit"),
                componentProps: {
                    defaultValue: "SSC021801",
                    options: s.treeData,
                    valueField: "businessKey",
                    labelField: l.getLocale === "en" ? "nameEn" : "name"
                }
            }
        ];
        return {
            searchSchemas: m,
            modalSchemas: n,
            methodList: a,
            descriptionsList: c,
            statusList: o,
            businessKeyMap: u,
            yesOrNoOptions: d,
            selectPermitSearchSchemas: h
        };
    };
});
export { P as c, __tla };
