import { r as a, V as P, bk as v, l as r, cO as c, cq as d, fm as p, __tla as __tla_0 } from "./index-9PRMimni.js";
import { i as q, M as y, e as T, j as S } from "./template-rpthWlT9.js";
import { a as C, d as u, e as I, b as w } from "./helper-Czt-QYps.js";
let O;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const m = v(), { t: o } = P(), h = a([]), x = await q(), D = await y(), N = await T({
        roleType: 2,
        roleCategory: 1
    }), U = await S();
    O = function() {
        const s = a(!1), f = a(null), l = a(!1);
        return {
            schemasPsc: [
                {
                    field: "shipId",
                    hidden: !0
                },
                {
                    field: "reportNo",
                    component: "NInput",
                    label: o("hsqe.psc.relatedReportNo"),
                    componentProps: {
                        disabled: !0
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, e)=>e != null,
                            message: o("common.chooseText"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "severity",
                    component: "NSelect",
                    label: o("hsqe.psc.servity"),
                    componentProps: {
                        options: x,
                        disabled: s,
                        "label-field": m.getLocale === "en" ? "labelEn" : "label"
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, e)=>e != null,
                            message: o("common.chooseText"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "defectCode",
                    component: "NSelect",
                    label: o("hsqe.psc.mouDeficiencyCode"),
                    componentProps: {
                        options: h,
                        disabled: s,
                        filterable: !0,
                        "label-field": "item",
                        "value-field": "item"
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, e)=>e != null,
                            message: o("common.chooseText"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "actionCode",
                    component: "NSelect",
                    label: o("hsqe.psc.pSCActionCode"),
                    componentProps: {
                        options: D,
                        disabled: s,
                        "label-field": "label",
                        "value-field": "label"
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, e)=>e != null,
                            message: o("common.chooseText"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "equipmentId",
                    component: "NSelect",
                    label: o("hsqe.psc.equipment"),
                    componentProps: ({ model: t, formAction: e })=>{
                        const { shipId: i } = t, { setFieldsValue: g } = e;
                        return {
                            show: l,
                            remote: !0,
                            clearable: !0,
                            filterable: !0,
                            loading: r(w),
                            options: r(I),
                            disabled: r(s),
                            placeholder: o("common.inputTextToSearch"),
                            onClear: ()=>{
                                u({
                                    shipId: i
                                });
                            },
                            onBlur: ()=>{
                                l.value = !1;
                            },
                            onSearch: async (n)=>{
                                n.length > 0 ? l.value = !0 : l.value = !1, u({
                                    shipId: i,
                                    productName: n
                                });
                            },
                            onUpdateValue: async (n)=>{
                                const b = await C(n);
                                g({
                                    equipmentValue: b
                                }), l.value = !1;
                            }
                        };
                    }
                },
                {
                    field: "equipmentValue",
                    component: "NSelect",
                    label: o("hsqe.psc.criticalEquipment"),
                    componentProps: {
                        disabled: !0,
                        options: [
                            {
                                label: o("common.yes"),
                                value: "1"
                            },
                            {
                                label: o("common.no"),
                                value: "0"
                            }
                        ]
                    }
                },
                {
                    field: "expirationTime",
                    component: "NDatePicker",
                    label: o("hsqe.psc.dateToRectify"),
                    componentProps: {
                        type: "date",
                        valueFormat: "yyyy-MM-dd",
                        disabled: s,
                        isDateDisabled: (t)=>{
                            const e = new Date;
                            e.setHours(0, 0, 0, 0);
                            const i = new Date(t);
                            return i.setHours(0, 0, 0, 0), i < e;
                        }
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, e)=>e != null,
                            message: o("common.chooseText"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "vesselPositionCode",
                    component: "NSelect",
                    label: o("hsqe.psc.vesselResponsible"),
                    componentProps: {
                        options: N,
                        "label-field": m.getLocale === "en" ? "nameEn" : "name",
                        "value-field": "code",
                        disabled: s
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, e)=>e != null,
                            message: o("common.chooseText"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "officePositionCode",
                    component: "NSelect",
                    label: o("hsqe.psc.officeResponsible"),
                    componentProps: {
                        options: U,
                        "label-field": m.getLocale === "en" ? "nameEn" : "name",
                        "value-field": "code",
                        disabled: s
                    },
                    giProps: {
                        span: 24
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, e)=>e != null,
                            message: o("common.chooseText"),
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "basicDescription",
                    component: "NInput",
                    label: o("hsqe.cdi.description"),
                    componentProps: {
                        type: "textarea",
                        disabled: s,
                        maxlength: 300,
                        showCount: !0
                    },
                    giProps: {
                        span: 24
                    },
                    rules: [
                        {
                            required: !0,
                            validator: (t, e)=>e != null && e !== "",
                            message: `${o("hsqe.cdi.description")} ${o("common.required")}`,
                            trigger: [
                                "blur",
                                "change"
                            ]
                        }
                    ]
                },
                {
                    field: "deficiencyPhotoUrlPhoto",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.attachment"),
                    component: "SingleImageUpload",
                    componentProps: ({ model: t })=>({
                            disabled: s.value,
                            action: `${d().urlPrefix}/files`,
                            headers: {
                                timestamp: new Date().getTime(),
                                authorization: `${c.get(p)}`
                            },
                            onUploadChange: (e, i)=>{
                                t.deficiencyPhotoUrl = i;
                            }
                        }),
                    giProps: {
                        span: 1
                    }
                },
                {
                    field: "deficiencyPhotoUrlTwoPhoto",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.attachment"),
                    component: "SingleImageUpload",
                    componentProps: ({ model: t })=>({
                            disabled: s.value,
                            action: `${d().urlPrefix}/files`,
                            headers: {
                                timestamp: new Date().getTime(),
                                authorization: `${c.get(p)}`
                            },
                            onUploadChange: (e, i)=>{
                                t.deficiencyPhotoUrlTwo = i;
                            }
                        }),
                    giProps: {
                        span: 1
                    }
                },
                {
                    field: "deficiencyPhotoUrlThreePhoto",
                    label: o("hsqe.auditInspection.vesselInspection.shipVisitReport.attachment"),
                    component: "SingleImageUpload",
                    componentProps: ({ model: t })=>({
                            disabled: s.value,
                            action: `${d().urlPrefix}/files`,
                            headers: {
                                timestamp: new Date().getTime(),
                                authorization: `${c.get(p)}`
                            },
                            onUploadChange: (e, i)=>{
                                t.deficiencyPhotoUrlThree = i;
                            }
                        }),
                    giProps: {
                        span: 1
                    }
                },
                {
                    field: "deficiencyPhotoUrl",
                    hidden: !0
                }
            ],
            methodsPsc: {
                setPscReadOnly: (t)=>{
                    s.value = t;
                },
                setReportType: (t)=>{
                    f.value = t;
                },
                setDefectList: (t)=>{
                    h.value = t.list;
                }
            }
        };
    };
});
export { O as c, __tla };
