import { B as U } from "./BasicForm-dL_oCSPM.js";
import { V as B, l as r, r as w, d as X, bk as Y, dW as Z, dy as ee, a4 as S, ay as oe, h as te, o as m, j as l, w as n, ab as re, c as h, D as y, gE as ae, aI as ne, i as ce, A as k, N as se, dE as le, dF as ie, d4 as ue, H as de, B as pe, p as F, aa as me, W as be, E as he, ac as ye, __tla as __tla_0 } from "./index-9PRMimni.js";
import { g as fe, a as Se } from "./workbench-DEgqNpqd.js";
import { u as ke } from "./useForm-CKmgcynv.js";
import { _ as we } from "./Flex-CTSf12gq.js";
let Pe;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })()
]).then(async ()=>{
    const A = w([]);
    let _ = [];
    try {
        _ = await Se();
    } catch (c) {
        console.log(c);
    }
    const { t: e } = B();
    function _e(c = {}) {
        return {
            cardSearchSchemasObj: {
                CircularFeedbackStatus: [
                    {
                        field: "objectType",
                        component: "NSelect",
                        label: e("dashboard.workbench.circularType"),
                        isNumberArray: !0,
                        componentProps: {
                            multiple: !0,
                            disabled: c?.useSource === "myFleet",
                            options: [
                                {
                                    value: 0,
                                    label: e("dashboard.workbench.typeVesselCircular")
                                },
                                {
                                    value: 1,
                                    label: e("dashboard.workbench.typeDepartmentCircular")
                                }
                            ]
                        }
                    },
                    {
                        field: "noticeSubTypeCode",
                        component: "BasicSelect",
                        label: e("dashboard.workbench.circularSubType"),
                        isStringArray: !0,
                        componentProps: {
                            multiple: !0,
                            cacheKey: "notice_circular",
                            block: !0
                        }
                    }
                ],
                CircularList: [
                    {
                        field: "objectType",
                        component: "NSelect",
                        label: e("dashboard.workbench.circularType"),
                        isNumberArray: !0,
                        componentProps: {
                            disabled: c?.useSource === "myFleet",
                            multiple: !0,
                            options: [
                                {
                                    value: 0,
                                    label: e("dashboard.workbench.myVesselReceived")
                                },
                                {
                                    value: 1,
                                    label: e("dashboard.workbench.myReceived")
                                }
                            ]
                        }
                    },
                    {
                        field: "noticeSubTypeCode",
                        component: "BasicSelect",
                        label: e("dashboard.workbench.circularSubType"),
                        isStringArray: !0,
                        componentProps: {
                            multiple: !0,
                            cacheKey: "notice_circular",
                            block: !0
                        }
                    },
                    {
                        field: "feedbackNoticeStatus",
                        component: "NSelect",
                        label: e("dashboard.workbench.circularStatus"),
                        isNumberArray: !0,
                        componentProps: {
                            multiple: !0,
                            options: [
                                {
                                    value: 0,
                                    label: e("dashboard.workbench.pendingSubmitted")
                                },
                                {
                                    value: 1,
                                    label: e("dashboard.workbench.feedbackSubmitted")
                                }
                            ]
                        }
                    }
                ],
                NoticeFeedbackStatus: [
                    {
                        field: "objectType",
                        component: "NSelect",
                        label: e("dashboard.workbench.noticeType"),
                        isNumberArray: !0,
                        componentProps: {
                            disabled: c?.useSource === "myFleet",
                            multiple: !0,
                            options: [
                                {
                                    value: 0,
                                    label: e("dashboard.workbench.typeVesselNotice")
                                },
                                {
                                    value: 1,
                                    label: e("dashboard.workbench.typeDepartmentNotice")
                                }
                            ]
                        }
                    },
                    {
                        field: "noticeSubTypeCode",
                        component: "BasicSelect",
                        label: e("dashboard.workbench.noticeSubType"),
                        isStringArray: !0,
                        componentProps: {
                            multiple: !0,
                            cacheKey: "notice",
                            block: !0
                        }
                    }
                ],
                MyDispatchNotice: [
                    {
                        field: "objectType",
                        component: "NSelect",
                        label: e("dashboard.workbench.noticeType"),
                        isNumberArray: !0,
                        componentProps: {
                            disabled: c?.useSource === "myFleet",
                            multiple: !0,
                            options: [
                                {
                                    value: 0,
                                    label: e("dashboard.workbench.typeVesselNotice")
                                },
                                {
                                    value: 1,
                                    label: e("dashboard.workbench.typeDepartmentNotice")
                                }
                            ]
                        }
                    },
                    {
                        field: "noticeSubTypeCode",
                        component: "BasicSelect",
                        label: e("dashboard.workbench.noticeSubType"),
                        isStringArray: !0,
                        componentProps: {
                            multiple: !0,
                            cacheKey: "notice",
                            block: !0
                        }
                    }
                ],
                NoticeList: [
                    {
                        field: "objectType",
                        component: "NSelect",
                        label: e("dashboard.workbench.noticeType"),
                        isNumberArray: !0,
                        componentProps: {
                            disabled: c?.useSource === "myFleet",
                            multiple: !0,
                            options: [
                                {
                                    value: 0,
                                    label: e("dashboard.workbench.myVesselReceived")
                                },
                                {
                                    value: 1,
                                    label: e("dashboard.workbench.myReceived")
                                }
                            ]
                        }
                    },
                    {
                        field: "noticeSubTypeCode",
                        component: "BasicSelect",
                        label: e("dashboard.workbench.noticeSubType"),
                        isStringArray: !0,
                        componentProps: {
                            multiple: !0,
                            cacheKey: "notice",
                            block: !0
                        }
                    },
                    {
                        field: "feedbackNoticeStatus",
                        component: "NSelect",
                        label: e("dashboard.workbench.noticeStatus"),
                        isNumberArray: !0,
                        componentProps: {
                            multiple: !0,
                            options: [
                                {
                                    value: 0,
                                    label: e("dashboard.workbench.pendingSubmitted")
                                },
                                {
                                    value: 1,
                                    label: e("dashboard.workbench.feedbackSubmitted")
                                }
                            ]
                        }
                    }
                ],
                CrewChangeStatus: [
                    {
                        field: "day",
                        component: "NInputNumber",
                        label: e("dashboard.workbench.deadlineDays"),
                        componentProps: {
                            min: 0,
                            max: 999999999,
                            precision: 0
                        },
                        componentSlots: {
                            prefix: ()=>e("dashboard.workbench.distanceDays"),
                            suffix: ()=>e("dashboard.workbench.unitDay")
                        }
                    }
                ],
                DeficiencyStatus: [],
                MyPendingTaskList: [
                    {
                        field: "moduleCategory",
                        component: "BasicSelect",
                        label: e("dashboard.workbench.taskType"),
                        componentProps: {
                            block: !0,
                            cacheKey: "module_category"
                        }
                    }
                ],
                NonConformityStatus: [],
                PurchaseOrderStatus: [
                    {
                        field: "statusList",
                        label: e("dashboard.workbench.status"),
                        component: "BasicSelect",
                        isStringArray: !0,
                        componentProps: {
                            block: !0,
                            multiple: !0,
                            cacheKey: "purchase_order_state"
                        }
                    }
                ],
                PurchaseOrderTracking: [
                    {
                        field: "days",
                        component: "NInputNumber",
                        label: e("dashboard.workbench.expectedDelivery"),
                        componentProps: {
                            min: 0,
                            max: 999999999,
                            precision: 0
                        },
                        componentSlots: {
                            prefix: ()=>e("dashboard.workbench.deliveryDays"),
                            suffix: ()=>e("dashboard.workbench.unitDay")
                        }
                    }
                ],
                SparePartsStockStatus: [
                    {
                        field: "partIds",
                        component: "NSelect",
                        label: e("dashboard.workbench.equipType"),
                        isStringArray: !0,
                        componentProps: ()=>({
                                multiple: !0,
                                options: r(A),
                                valueField: "key",
                                labelField: "value"
                            })
                    }
                ],
                VesselCertificateStatus: [],
                VesselJobStatus: [
                    {
                        field: "equipBaseCodes",
                        component: "NSelect",
                        label: e("dashboard.workbench.equipmentType"),
                        isStringArray: !0,
                        componentProps: ()=>({
                                multiple: !0,
                                options: _,
                                valueField: "code",
                                labelField: "name"
                            })
                    }
                ],
                VesselManagementReportList: [],
                VesselCriticalEquipmentJobPlan: [
                    {
                        field: "equipBaseCodes",
                        component: "NSelect",
                        label: e("dashboard.workbench.equipmentType"),
                        isStringArray: !0,
                        componentProps: ()=>({
                                multiple: !0,
                                options: _,
                                valueField: "code",
                                labelField: "name"
                            })
                    },
                    {
                        field: "daysLeft",
                        component: "NInputNumber",
                        label: e("dashboard.workbench.daysLeft"),
                        componentProps: {
                            min: 0,
                            max: 999999999,
                            precision: 0
                        },
                        componentSlots: {
                            prefix: ()=>e("dashboard.workbench.finishJobDaysLeft"),
                            suffix: ()=>e("dashboard.workbench.unitDay")
                        }
                    }
                ],
                ShippingRiskWarningList: [
                    {
                        field: "beforeDay",
                        component: "NInputNumber",
                        label: e("dashboard.workbench.riskWarningFilter"),
                        componentProps: {
                            min: 0,
                            max: 999999999,
                            precision: 0
                        },
                        componentSlots: {
                            prefix: ()=>e("dashboard.workbench.riskWarningDaysLeft"),
                            suffix: ()=>e("dashboard.workbench.unitDay")
                        }
                    }
                ],
                MaterialsStockStatus: [
                    {
                        field: "category",
                        component: "BasicSelect",
                        label: e("dashboard.workbench.categoryName"),
                        componentProps: ()=>({
                                block: !0,
                                cacheKey: "material_category"
                            })
                    }
                ]
            },
            cardSearchDataMethods: {
                reloadSelectData: async (a)=>{
                    A.value = await fe(a);
                }
            }
        };
    }
    Pe = X({
        __name: "CustomCard",
        props: {
            componentItem: {},
            showAll: {
                type: Boolean,
                default: !0
            },
            showFullScreen: {
                type: Boolean,
                default: !0
            },
            showTransition: {
                type: Boolean,
                default: !0
            },
            showFilter: {
                type: Boolean,
                default: !0
            },
            currentComponent: {},
            cardParams: {},
            searchParams: {},
            useSource: {
                default: "workbench"
            }
        },
        emits: [
            "fullScreen",
            "showAll",
            "transition",
            "filter"
        ],
        setup (c, { emit: g }) {
            const u = g, a = c, { t: i } = B(), x = Y(), D = Z(), N = w(null), p = w(!1), { isFullscreen: b, toggle: V } = ee(N), { cardSearchSchemasObj: I, cardSearchDataMethods: L } = _e({
                useSource: a.useSource
            }), f = S(()=>a.componentItem?.componentName ? I[a.componentItem.componentName] || [] : []), [R, { getFieldsValue: j, setFieldsValue: q }] = ke({
                gridProps: {
                    cols: 1
                },
                layout: "horizontal",
                schemas: f,
                showActionButtonGroup: !1
            }), T = S(()=>r(f).filter((o)=>o.isStringArray).map((o)=>o.field)), v = S(()=>r(f).filter((o)=>o.isNumberArray).map((o)=>o.field));
            oe(()=>a.searchParams, (o)=>{
                o?.shipIds && a.componentItem?.componentName && [
                    "SparePartsStockStatus"
                ].includes(a.componentItem.componentName) && L?.reloadSelectData(a.searchParams);
            }, {
                immediate: !0
            });
            function E() {
                V(), u("fullScreen");
            }
            function K() {
                u("showAll");
            }
            function M() {
                a.currentComponent === "table" ? u("transition", "chart") : u("transition", "table");
            }
            function O() {
                p.value = !0, ye(()=>{
                    const o = a.cardParams || {}, s = {};
                    for(const t in o)v.value.includes(t) && o[t] ? s[t] = o[t].split(",").map((d)=>!isNaN(d) && d.trim() !== "" ? Number(d) : d) : T.value.includes(t) && o[t] ? s[t] = o[t].split(",") : s[t] = o[t];
                    q(s), p.value = !0;
                });
            }
            function C() {
                p.value = !1;
            }
            function W() {
                p.value = !1;
                const o = j(), s = {};
                for(const t in o)[
                    ...T.value,
                    ...v.value
                ].includes(t) ? o[t]?.length && (s[t] = o[t].join(",")) : s[t] = o[t];
                u("filter", s);
            }
            return (o, s)=>{
                const t = ae, d = se, z = ne, $ = U, P = pe, J = de, G = ue, H = we, Q = be;
                return m(), te("div", {
                    ref_key: "customCardRef",
                    ref: N,
                    class: he(r(b) ? `bg-[${r(D).bodyColor}]` : "")
                }, [
                    l(Q, me({
                        bordered: !1,
                        segmented: {
                            content: !0
                        },
                        title: r(x).getLocale === "en" ? o.componentItem?.modelNameEn : o.componentItem?.modelName,
                        class: [
                            r(b) ? "h-full" : "h-[450px]",
                            "ui-card-small"
                        ],
                        "content-class": "overflow-auto"
                    }, o.$attrs), {
                        "header-extra": n(()=>[
                                l(H, {
                                    class: "leading-[20px]"
                                }, {
                                    default: n(()=>[
                                            o.showAll ? (m(), h(t, {
                                                key: "more",
                                                tooltip: r(i)("dashboard.workbench.iconMore"),
                                                iconSize: 24,
                                                iconName: "more",
                                                iconType: "lineIcon",
                                                class: "cursor-pointer",
                                                onClick: K
                                            }, null, 8, [
                                                "tooltip"
                                            ])) : y("", !0),
                                            o.showFullScreen ? (m(), h(z, {
                                                key: 1,
                                                trigger: "hover"
                                            }, {
                                                trigger: n(()=>[
                                                        l(d, {
                                                            size: 20,
                                                            component: r(b) ? r(le) : r(ie),
                                                            class: "cursor-pointer",
                                                            onClick: E
                                                        }, null, 8, [
                                                            "component"
                                                        ])
                                                    ]),
                                                default: n(()=>[
                                                        ce("span", null, k(r(b) ? r(i)("common.restoreText") : r(i)("common.fullScreenText")), 1)
                                                    ]),
                                                _: 1
                                            })) : y("", !0),
                                            o.showTransition ? (m(), h(t, {
                                                key: "transition",
                                                tooltip: r(i)("dashboard.workbench.iconTransform"),
                                                iconName: "transition",
                                                iconType: "lineIcon",
                                                class: "cursor-pointer",
                                                onClick: M
                                            }, null, 8, [
                                                "tooltip"
                                            ])) : y("", !0),
                                            o.showFilter ? (m(), h(G, {
                                                key: 3,
                                                show: r(p),
                                                width: 500,
                                                "show-arrow": !1,
                                                "content-style": "min-height: 200px; padding: 20px 16px",
                                                placement: "bottom-end",
                                                trigger: "click",
                                                onClickoutside: C
                                            }, {
                                                trigger: n(()=>[
                                                        l(t, {
                                                            key: "filter",
                                                            tooltip: r(i)("dashboard.workbench.iconFilter"),
                                                            iconSize: 16,
                                                            iconName: "filter",
                                                            iconType: "lineIcon",
                                                            class: "cursor-pointer",
                                                            onClick: O
                                                        }, null, 8, [
                                                            "tooltip"
                                                        ])
                                                    ]),
                                                footer: n(()=>[
                                                        l(J, {
                                                            justify: "center"
                                                        }, {
                                                            default: n(()=>[
                                                                    l(P, {
                                                                        onClick: C
                                                                    }, {
                                                                        default: n(()=>[
                                                                                F(k(r(i)("common.cancelText")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    }),
                                                                    l(P, {
                                                                        onClick: W,
                                                                        type: "primary"
                                                                    }, {
                                                                        default: n(()=>[
                                                                                F(k(r(i)("common.confirmText")), 1)
                                                                            ]),
                                                                        _: 1
                                                                    })
                                                                ]),
                                                            _: 1
                                                        })
                                                    ]),
                                                default: n(()=>[
                                                        l($, {
                                                            ref: "formRef",
                                                            onRegister: r(R),
                                                            class: "mb-[50px]"
                                                        }, null, 8, [
                                                            "onRegister"
                                                        ])
                                                    ]),
                                                _: 1
                                            }, 8, [
                                                "show"
                                            ])) : y("", !0)
                                        ]),
                                    _: 1
                                })
                            ]),
                        default: n(()=>[
                                re(o.$slots, "default")
                            ]),
                        _: 3
                    }, 16, [
                        "title",
                        "class"
                    ])
                ], 2);
            };
        }
    });
});
export { Pe as _, __tla };
