import { V as A, gD as te, bk as q, Z as i, d as ne, e as ae, f as re, dW as ie, r as C, a4 as se, aw as oe, c as le, o as N, w as g, j as u, W as ue, l as h, H as ce, h as I, F as de, a9 as pe, i as P, aG as me, A as ge, X as he, cZ as fe, c_ as _e, __tla as __tla_0 } from "./index-9PRMimni.js";
import { B as Se } from "./BasicForm-dL_oCSPM.js";
import { j as be, a as ye, k as ve, l as ke } from "./planner-BebmniHR.js";
import { B as Ce } from "./Table-0PViRYCf.js";
import { C as Ne, U as T } from "./ColumnItem-BBLKNRc0.js";
import { _ as Ae, __tla as __tla_1 } from "./Modal.vue_vue_type_script_setup_true_lang-BM_y3sHX.js";
import { _ as qe } from "./ExtensionModal.vue_vue_type_script_setup_true_lang-GbjuUUTl.js";
import { u as xe } from "./useForm-CKmgcynv.js";
import "./Render.vue_vue_type_script_lang-DKUYY0Zw.js";
import "./SingleImageUpload-CNx4b9eC.js";
import "./ImageUpload.vue_vue_type_style_index_0_scoped_cb086928_lang-D-28kXvw.js";
import "./componentSetting-DVhNDBTO.js";
import "./ImageUpload-DUsnro3W.js";
import "./vuedraggable.umd-Co2xEC3p.js";
import "./BasicUpload.vue_vue_type_style_index_0_scoped_a4d0e930_lang-DxRbtP01.js";
import "./tabsView-BXskTdVh.js";
import "./BasicForm.vue_vue_type_style_index_0_scoped_b9e995ec_lang-CEvcLwxD.js";
import "./propTypes-CebMRUpe.js";
import "./BasicSelect-C_uwzMkE.js";
import "./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";
import "./dictionary-BRse4lkf.js";
import "./index-DkvzUEqh.js";
import "./index-kKnqLkWM.js";
import "./AutoComplete-Dv1Bqed4.js";
import "./TreeSelect-BZh2DeCh.js";
import "./Table.vue_vue_type_style_index_0_scoped_7b9e6ece_lang-BoW2DV_e.js";
import "./componentMap-CElCaWis.js";
import "./format-DgF6KtHk.js";
import "./omit-B2_8Y6O_.js";
import "./_flatRest-DBrd2CHT.js";
import "./flatten-DeoUZLdb.js";
import "./print-CT_2hrjP.js";
import "./basicModal.vue_vue_type_script_setup_true_lang-CsJydKhW.js";
import "./basicModal.vue_vue_type_style_index_0_lang-8QZP7ApW.js";
import "./useModal-CO65vga3.js";
import "./useTimeout-BxFilWvD.js";
import "./usePageCache-DluHn7Yy.js";
import "./Flex-CTSf12gq.js";
import "./TableSelect.vue_vue_type_script_setup_true_lang-BAU5mgvB.js";
import "./props-CLtNejQT.js";
let yt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })()
]).then(async ()=>{
    const { t: f } = A(), E = q(), Re = await ye(), Le = await be(), Ie = [
        {
            field: "planYear",
            label: f("hsqe.planner.formYear"),
            component: "NDatePicker",
            defaultValue: te().year().toString(),
            componentProps: {
                type: "year",
                valueFormat: "yyyy"
            },
            rules: [
                {
                    required: !0,
                    message: f("hsqe.planner.formYear"),
                    trigger: [
                        "blur",
                        "change"
                    ]
                }
            ]
        },
        {
            field: "docId",
            label: f("hsqe.planner.formDoc"),
            component: "NSelect",
            componentProps: {
                options: Le,
                "label-field": E.getLocale === "en" ? "companyNameEn" : "companyNameCn",
                "value-field": "id"
            }
        },
        {
            field: "shipId",
            label: f("hsqe.planner.formShip"),
            component: "NSelect",
            componentProps: {
                options: Re,
                "label-field": E.getLocale === "en" ? "shipNameEn" : "shipName",
                "value-field": "id"
            }
        }
    ], { t: s } = A(), Pe = q();
    function Te(_, S) {
        function r(t, n) {
            return t[n].map((c)=>i(Ne, {
                    data: c,
                    onClick: (d)=>{
                        _?.onClick(d, c);
                    },
                    onSelect: (d)=>{
                        _?.onSelect(d, c);
                    }
                }));
        }
        return {
            columns: [
                {
                    title: s("hsqe.planner.vessel"),
                    key: Pe.getLocale === "en" ? "shipNameEn" : "shipName",
                    fixed: "left",
                    align: "center",
                    width: 120,
                    cellProps: ()=>({
                            style: {
                                backgroundColor: S?.value?.hoverColor,
                                fontWeight: "bold",
                                color: "var(--text-color-base)"
                            }
                        })
                },
                {
                    title: s("hsqe.planner.jan"),
                    key: "january",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "january"))
                },
                {
                    title: s("hsqe.planner.feb"),
                    key: "february",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "february"))
                },
                {
                    title: s("hsqe.planner.mar"),
                    key: "march",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "march"))
                },
                {
                    title: s("hsqe.planner.apr"),
                    key: "april",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "april"))
                },
                {
                    title: s("hsqe.planner.may"),
                    key: "may",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "may"))
                },
                {
                    title: s("hsqe.planner.jun"),
                    key: "june",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "june"))
                },
                {
                    title: s("hsqe.planner.jul"),
                    key: "july",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "july"))
                },
                {
                    title: s("hsqe.planner.aug"),
                    key: "august",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "august"))
                },
                {
                    title: s("hsqe.planner.sep"),
                    key: "september",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "september"))
                },
                {
                    title: s("hsqe.planner.oct"),
                    key: "october",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "october"))
                },
                {
                    title: s("hsqe.planner.nov"),
                    key: "november",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "november"))
                },
                {
                    title: s("hsqe.planner.dec"),
                    key: "december",
                    align: "center",
                    width: 140,
                    render: (t, n)=>i("div", {}, r(t, "december"))
                }
            ]
        };
    }
    let Ee;
    Ee = {
        class: "mr-[5px]"
    };
    yt = ne({
        __name: "Vessel",
        setup (_) {
            const [S, { getFieldsValue: r }] = xe({
                gridProps: {
                    cols: 6,
                    xGap: 15
                },
                labelWidth: 80,
                schemas: Ie,
                showAdvancedButton: !1
            }), { t: o } = A(), t = ae(), n = re(), c = q(), d = _e(), l = fe(), j = ie(), { columns: D } = Te({
                onSelect: M,
                onClick: W
            }, j), b = C(), y = C(), x = C(), V = se(()=>T.plannerStates);
            function B(e) {
                return {
                    "background-color": T.getPlannerStateWithValue(e).backgroundColor
                };
            }
            function M(e, a) {
                console.log("onSelect key --- ", e);
                const m = {
                    assignedReport: F,
                    edit: U,
                    extension: G,
                    cancel: X,
                    auditLog: Z
                };
                m[e] && m[e](a);
            }
            function W(e, a) {
                y.value?.showModal(a.id, !0);
            }
            function v(e, a) {
                if (e.currentStatus == 2 || e.currentStatus == 4) a(e, null);
                else if (e.currentStatus == 0 || e.currentStatus == 5) a(e, "edit");
                else if (e.currentStatus == 6) a(e, "view");
                else if (e.currentStatus == 3) {
                    l.error("The planner is in pending approval for the extension!");
                    return;
                } else if (e.currentStatus == 7) {
                    l.error("The planner is overdue, it cannot be assigned report!");
                    return;
                } else if (e.currentStatus == 8) {
                    l.error("The planner is cancelled, it cannot be assigned report!");
                    return;
                }
            }
            function F(e) {
                console.log(e, e.subAuditCode, "rowwossjhimeimei"), e.subAuditCode == "gm_inspection" || e.subAuditCode == "management_inspection" ? v(e, $) : e.subAuditCode == "technical_superintendent_inspection" || e.subAuditCode == "marine_technical_inspection" ? v(e, Q) : (e.subAuditCode == "navigation_audit" || e.subAuditCode == "cargo_audit" || e.subAuditCode == "engineering_audit" || e.subAuditCode == "bunkering_audit" || e.subAuditCode == "mooring_audit") && v(e, Y);
            }
            function Y(e, a) {
                t.push({
                    name: "Add_HSQE_AuditInspection_ReportList_VesselInspection_AddNavigationAudit",
                    query: {
                        plannerId: e.id,
                        shipName: c.getLocale === "en" ? e.shipNameEn : e.shipName,
                        portName: e.portName,
                        planDate: e.planDate,
                        shipId: e.shipId,
                        portId: e.portId,
                        currentType: H(e.subAuditCode),
                        type: a,
                        sourcePath: String(n.name)
                    }
                });
            }
            function H(e) {
                switch(e){
                    case "navigation_audit":
                        return 1;
                    case "mooring_audit":
                        return 4;
                    case "cargo_audit":
                        return 0;
                    case "bunkering_audit":
                        return 3;
                    case "engineering_audit":
                        return 2;
                }
            }
            function $(e, a) {
                t.push({
                    name: "Add_HSQE_AuditInspection_ReportList_VesselInspection_AddManagement",
                    query: {
                        id: e.id,
                        currentStatus: e.currentStatus,
                        shipId: e.shipId,
                        shipName: e.shipName,
                        shipNameEn: e.shipNameEn,
                        portName: e.portName,
                        type: a,
                        sourcePath: String(n.name)
                    }
                });
            }
            function Q(e, a) {
                t.push({
                    name: "Add_HSQE_AuditInspection_ReportList_VesselInspection",
                    query: {
                        id: e.id,
                        currentStatus: e.currentStatus,
                        shipName: c.getLocale === "en" ? e.shipNameEn : e.shipName,
                        portName: e.portName,
                        type: a,
                        sourcePath: String(n.name)
                    }
                });
            }
            function U(e) {
                if (e.currentStatus == 3 || e.currentStatus == 5 || e.currentStatus == 7 || e.currentStatus == 8 || e.currentStatus == 6) {
                    l.error(o("hsqe.planner.cannotEdit"));
                    return;
                }
                y.value?.showModal(e.id);
            }
            function G(e) {
                if (console.log("handleExtension: ", e), e.currentStatus == 6 || e.currentStatus == 7 || e.currentStatus == 5 || e.currentStatus == 8 || e.currentStatus == 3) {
                    l.error(o("hsqe.planner.cannotExtension"));
                    return;
                }
                x.value?.showModal();
            }
            function X(e) {
                if (e.currentStatus == 3 || e.currentStatus == 7 || e.currentStatus == 5 || e.currentStatus == 6) {
                    l.error(o("hsqe.planner.cannotDel"));
                    return;
                }
                d.warning({
                    title: o("common.dialogTitleWarning"),
                    content: o("common.dialogContentDeleteText"),
                    positiveText: o("common.dialogPositiveText"),
                    negativeText: o("common.dialogNegativeText"),
                    onPositiveClick: async ()=>{
                        await ke(e.id), l.success(o("common.optionsSuccessText")), p();
                    },
                    onNegativeClick: ()=>{
                        console.log("cancel click");
                    }
                });
            }
            function Z(e) {
                console.log("handleAuditLog: ", e);
            }
            function z(e) {
                e.planYear && p();
            }
            function O(e) {
                e.planYear && p();
            }
            function p() {
                b.value?.reload();
            }
            async function J() {
                return {
                    list: await ve({
                        ...r()
                    })
                };
            }
            function R() {
                p();
            }
            function K() {
                b.value.setStriped(!1);
            }
            return oe(()=>{
                K();
            }), (e, a)=>{
                const m = Se, L = ue, w = ce, ee = he;
                return N(), le(ee, null, {
                    default: g(()=>[
                            u(L, {
                                bordered: !1,
                                class: "mb-3 proCard"
                            }, {
                                default: g(()=>[
                                        u(m, {
                                            onRegister: h(S),
                                            onSubmit: z,
                                            onReset: O
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            u(L, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: g(()=>[
                                        u(h(Ce), {
                                            ref_key: "tableRef",
                                            ref: b,
                                            columns: h(D),
                                            request: ()=>J(),
                                            pagination: !1,
                                            immediate: !0,
                                            showTableSetting: !1,
                                            autoScrollX: !0,
                                            striped: !1
                                        }, null, 8, [
                                            "columns",
                                            "request"
                                        ]),
                                        u(w, {
                                            class: "mt-3",
                                            justify: "center"
                                        }, {
                                            default: g(()=>[
                                                    (N(!0), I(de, null, pe(h(V), (k)=>(N(), I("div", {
                                                            key: k.value,
                                                            class: "flex flex-row items-center"
                                                        }, [
                                                            P("p", {
                                                                class: "mr-[3px] w-[10px] h-[10px] rounded",
                                                                style: me(B(Number(k.value)))
                                                            }, null, 4),
                                                            P("span", Ee, ge(k.label), 1)
                                                        ]))), 128))
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }),
                            u(Ae, {
                                ref_key: "modalRef",
                                ref: y,
                                onSuccess: R
                            }, null, 512),
                            u(qe, {
                                ref_key: "extensionModalRef",
                                ref: x,
                                onSuccess: R
                            }, null, 512)
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { yt as default, __tla };
