import { V as L, bk as G, d as le, e as re, f as pe, r as V, bl as W, a as $, a4 as ue, Z as x, fc as me, l as a, cZ as he, aw as de, c as k, o as D, w as o, j as s, W as fe, H as ye, D as R, i as _, aI as Ce, p as h, A as u, B as ge, h as j, F as De, a9 as _e, X as be, ac as z, c_ as I, __tla as __tla_0 } from "./index-9PRMimni.js";
import { u as ve } from "./useTags-C1thGhjF.js";
import { B as Ae } from "./BasicForm-dL_oCSPM.js";
import { u as xe } from "./useForm-CKmgcynv.js";
import { v as ke, m as Te, T as U, I as T, __tla as __tla_1 } from "./helper-D3AT1ZPu.js";
import { i as S } from "./includes-DdMWPj0t.js";
import { B as we } from "./Table-0PViRYCf.js";
import { _ as Se } from "./TableAction.vue_vue_type_script_setup_true_lang-Bj_Y4LtN.js";
import { d as Ne, g as Ee, _ as Be, a as Me, u as Re, i as Ie, __tla as __tla_2 } from "./index.vue_vue_type_script_setup_true_lang-CgGOVhd5.js";
import { _ as Pe } from "./Flex-CTSf12gq.js";
import "./tabsView-BXskTdVh.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 "./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 "./usePageCache-DluHn7Yy.js";
import "./_createMathOperation-C_MUc_Og.js";
import "./requisitionOrder-D0IG9N7e.js";
import "./toInteger-DQeH-nF-.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 "./round-Cr-4vvHD.js";
import "./_createRound-MlkJBLNh.js";
import "./equipmentMainLibrary-bJTzj5mC.js";
import "./head-aneRfQQJ.js";
let Rt;
let __tla = Promise.all([
    (()=>{
        try {
            return __tla_0;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_1;
        } catch  {}
    })(),
    (()=>{
        try {
            return __tla_2;
        } catch  {}
    })()
]).then(async ()=>{
    let P, d, Le, w, r, Fe, Oe, qe, Ve;
    P = G();
    ({ t: d } = L());
    Le = ()=>[
            {
                field: "shipId",
                component: "NSelect",
                label: d("shipCashAccount.vessel"),
                componentProps: {
                    placeholder: d("shipCashAccount.vessel"),
                    labelField: P.getLocale === "en" ? "labelEn" : "label",
                    options: ke
                }
            },
            {
                field: "month",
                component: "NSelect",
                label: d("shipCashAccount.month"),
                componentProps: {
                    labelField: P.getLocale === "en" ? "labelEn" : "label",
                    placeholder: d("shipCashAccount.month"),
                    options: Te
                }
            },
            {
                field: "startDate",
                component: "NDatePicker",
                label: d("shipCashAccount.startDate"),
                componentProps: {
                    type: "date",
                    valueFormat: "yyyy-MM-dd",
                    placeholder: d("shipCashAccount.startDate")
                }
            },
            {
                field: "endDate",
                component: "NDatePicker",
                label: d("shipCashAccount.endDate"),
                componentProps: {
                    type: "date",
                    valueFormat: "yyyy-MM-dd",
                    placeholder: d("shipCashAccount.endDate")
                }
            }
        ];
    w = G();
    ({ t: r } = L());
    Fe = ()=>[
            {
                title: r("common.management.Num"),
                key: "num",
                width: 60,
                render: (c, e)=>e + 1
            },
            {
                title: r("shipCashAccountDetail.date"),
                key: "date",
                width: 120
            },
            {
                title: r("shipCashAccountDetail.type"),
                key: "type",
                width: 120,
                render: (c)=>w.getLocale === "en" ? c.typeNameEn : c.typeName
            },
            {
                title: r("shipCashAccountDetail.expenseType"),
                key: "expenseType",
                width: 200,
                render: (c)=>w.getLocale === "en" ? c.expenseTypeNameEn : c.expenseTypeName
            },
            {
                title: r("shipCashAccountDetail.expenseDetails"),
                key: "expenseDetails",
                width: 140
            },
            {
                title: r("shipCashAccountDetail.income"),
                key: "income",
                width: 100,
                render: (c)=>{
                    const { income: e } = c;
                    return S([
                        0,
                        "0",
                        "0.00"
                    ], e) ? "-" : e;
                }
            },
            {
                title: r("shipCashAccountDetail.payout"),
                key: "payout",
                width: 100,
                render: (c)=>{
                    const { payout: e } = c;
                    return S([
                        0,
                        "0",
                        "0.00"
                    ], e) ? "-" : e;
                }
            },
            {
                title: r("shipCashAccountDetail.approver"),
                key: "approverUserName",
                width: 120
            },
            {
                title: r("shipCashAccountDetail.approveDate"),
                key: "approveTime",
                width: 120
            },
            {
                title: r("shipCashAccountDetail.invoiceNo"),
                key: "invoiceNo",
                width: 120
            },
            {
                title: r("shipCashAccountDetail.toWhich"),
                key: "belong",
                width: 140,
                render: (c)=>w.getLocale === "en" ? c.belongNameEn : c.belongName
            },
            {
                title: r("shipCashAccountDetail.remark"),
                key: "remark",
                width: 140
            },
            {
                title: r("shipCashAccountDetail.status"),
                key: "approveStatus",
                width: 140,
                render: (c)=>w.getLocale === "en" ? c.approveStatusNameEn : c.approveStatusName
            },
            {
                title: r("shipCashAccountDetail.createBy"),
                key: "createBy",
                width: 120
            },
            {
                title: r("shipCashAccountDetail.createDate"),
                key: "createTime",
                width: 120
            }
        ];
    Oe = {
        class: "text-[18px]",
        style: {
            fontWeight: "var(--n-title-font-weight)"
        }
    };
    qe = {
        class: "text-[16px] text-gray-600"
    };
    Ve = {
        class: "text-[16px] font-medium text-[#0EC06A]"
    };
    Rt = le({
        __name: "index",
        setup (c) {
            const { t: e } = L(), { closeCurrent: X } = ve(), b = he(), C = re(), f = pe(), N = V(!1), F = W("tableRef"), E = W("addModalRef"), B = $({
                lastMonthBalance: {
                    title: e("shipCashAccountDetail.summary.cashBalanceFromLastMonth"),
                    count: 0
                },
                expenditure: {
                    title: e("shipCashAccountDetail.summary.cashPayoutInThisMonth"),
                    count: 0
                },
                income: {
                    title: e("shipCashAccountDetail.summary.cashIncomeInThisMonth"),
                    count: 0
                },
                availableBalance: {
                    title: e("shipCashAccountDetail.summary.cashAtEndOfThisMonth"),
                    count: 0
                }
            }), y = V({
                income: "",
                expenditure: "",
                availableBalance: "",
                thisMonthBalance: "",
                approvedExpenditureInProgress: "",
                importLastMonthBalanceEnable: 0,
                bondStoreExists: 0,
                victualingExists: 0
            }), v = ue(()=>f.query?.type !== "edit"), Z = $({
                width: 120,
                title: e("common.optionsText"),
                key: "action",
                fixed: "right",
                align: "center",
                render (i) {
                    const { approveStatus: n, isOffshoreApproval: t, type: l } = i;
                    return x(Se, {
                        style: "text",
                        actions: [
                            {
                                label: e("common.optionsViewText"),
                                labelShow: !1,
                                icon: x(me, {
                                    class: "text-[#2180F1] text-[14px]"
                                }),
                                onClick: q.bind(null, {
                                    type: "view",
                                    record: i
                                })
                            },
                            {
                                label: e("common.optionsEditText"),
                                labelShow: !1,
                                ifShow: !a(v) && l !== U.INCOME && (t === 1 && S([
                                    "Unsubmitted",
                                    "Returned"
                                ], n) || t === 0),
                                icon: x("i", {
                                    class: "iconfont icon-a-Frame28"
                                }),
                                onClick: q.bind(null, {
                                    type: "edit",
                                    record: i
                                })
                            },
                            {
                                label: e("common.delText"),
                                labelShow: !1,
                                ifShow: !a(v) && l !== U.INCOME && (t === 1 && S([
                                    "Unsubmitted",
                                    "Returned"
                                ], n) || t === 0),
                                icon: x("i", {
                                    class: "iconfont icon-Delete red"
                                }),
                                onPositiveClick: ae.bind(null, i),
                                isConfirm: !0,
                                confirmContent: e("common.delPop.contRole")
                            }
                        ]
                    });
                }
            }), [H, { getFieldsValue: Y, setFieldsValue: J }] = xe({
                gridProps: {
                    cols: 6
                },
                schemas: Le(),
                showAdvancedButton: !1
            });
            function O() {
                try {
                    X(), z(()=>{
                        C.replace({
                            name: "shipCashAccount"
                        });
                    });
                } catch (i) {
                    console.warn("Error closing tab:", i), z(()=>{
                        C.replace({
                            name: "shipCashAccount"
                        });
                    });
                }
            }
            async function K(i, n) {
                try {
                    return await Me({
                        ...n,
                        ...i
                    });
                } catch  {
                    return {
                        list: [],
                        total: 0
                    };
                }
            }
            function M() {
                F.value?.restReload();
            }
            function Q() {
                I().warning({
                    title: e("shipCashAccountDetail.submitTips.title"),
                    content: e("shipCashAccountDetail.submitTips.content"),
                    positiveText: e("shipCashAccountDetail.submitTips.confirmText"),
                    negativeText: e("shipCashAccountDetail.submitTips.cancelText"),
                    onPositiveClick: ()=>{
                        const { id: i } = f.query;
                        Re({
                            id: i,
                            status: "Submitted"
                        }).then((n)=>{
                            const t = P.getLocale === "en" ? "tipNameEn" : "tipName";
                            n?.hasOwnProperty(t) && n[t] !== null ? b.warning(n[t]) : (b.success(e("common.submitSuccessText")), O());
                        });
                    },
                    onNegativeClick: ()=>{}
                });
            }
            function ee() {
                N.value = !0;
                const { shipId: i, year: n, month: t } = f.query;
                Ie({
                    shipId: i,
                    year: n,
                    month: t
                }).then(()=>{
                    b.success(e("common.importSuccess"));
                }).finally(()=>{
                    N.value = !1, A(), M();
                });
            }
            function te() {
                E.value?.handleOpenModal();
            }
            function q({ type: i, record: n }) {
                const t = {
                    ...n
                };
                E.value?.handleOpenModal(i, t);
            }
            function ae({ id: i }) {
                Ne(i).then(()=>{
                    b.success(e("common.optionsDelSuccessText")), A(), M();
                });
            }
            function oe() {
                const { id: i, shipId: n, year: t, month: l, startDate: p, endDate: m } = f.query;
                if (a(y).bondStoreExists === 0) {
                    I().warning({
                        title: e("shipCashAccountDetail.navigationTips.title"),
                        content: e("shipCashAccountDetail.navigationTips.bondStoreContent"),
                        positiveText: e("shipCashAccountDetail.navigationTips.createData"),
                        negativeText: e("common.cancelText"),
                        onPositiveClick: ()=>{
                            C.push({
                                name: "bondStore"
                            });
                        },
                        onNegativeClick: ()=>{}
                    });
                    return;
                }
                if (a(y).bondStoreExists === 1 || T) {
                    C.push({
                        name: "bondStoreDetail",
                        query: {
                            id: i,
                            shipId: n,
                            year: t,
                            month: l,
                            startDate: p,
                            endDate: m,
                            type: "view",
                            sourceRouteName: "shipCashAccountDetail"
                        }
                    });
                    return;
                }
            }
            function ne() {
                const { id: i, shipId: n, year: t, month: l, startDate: p, endDate: m } = f.query;
                if (a(y).victualingExists === 0) {
                    I().warning({
                        title: e("shipCashAccountDetail.navigationTips.title"),
                        content: e("shipCashAccountDetail.navigationTips.victualingContent"),
                        positiveText: e("shipCashAccountDetail.navigationTips.createData"),
                        negativeText: e("common.cancelText"),
                        onPositiveClick: ()=>{
                            C.push({
                                name: "victualing"
                            });
                        },
                        onNegativeClick: ()=>{}
                    });
                    return;
                }
                if (a(y).victualingExists === 1 || T) {
                    C.push({
                        name: "victualingDetail",
                        query: {
                            id: i,
                            shipId: n,
                            year: t,
                            month: l,
                            startDate: p,
                            endDate: m,
                            type: "view",
                            sourceRouteName: "shipCashAccountDetail"
                        }
                    });
                    return;
                }
            }
            async function A() {
                const { shipId: i, startDate: n, endDate: t } = f.query;
                await Ee({
                    shipId: i,
                    startDate: n,
                    endDate: t
                }).then((l)=>{
                    y.value = l, Object.keys(l).forEach((p)=>{
                        B?.hasOwnProperty(p) && (B[p].count = l?.[p] || 0);
                    });
                });
            }
            return de(()=>{
                const { shipId: i, month: n, startDate: t, endDate: l } = f.query;
                J({
                    shipId: Number(i),
                    month: n,
                    startDate: t,
                    endDate: l
                }), A();
            }), (i, n)=>{
                const t = ge, l = Ce, p = ye, m = fe, ie = Pe, se = be;
                return D(), k(se, null, {
                    default: o(()=>[
                            s(m, {
                                bordered: !1,
                                class: "proCard"
                            }, {
                                default: o(()=>[
                                        s(p, {
                                            justify: "space-between"
                                        }, {
                                            default: o(()=>[
                                                    s(p, null, {
                                                        default: o(()=>[
                                                                s(l, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: o(()=>[
                                                                            s(t, {
                                                                                type: "text",
                                                                                class: "size-8",
                                                                                onClick: O
                                                                            }, {
                                                                                icon: o(()=>n[0] || (n[0] = [
                                                                                        _("i", {
                                                                                            class: "iconfont icon-a-shangyibu2 text-[16px]"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: o(()=>[
                                                                            h(" " + u(a(e)("common.backToList")), 1)
                                                                        ]),
                                                                    _: 1
                                                                }),
                                                                _("div", Oe, u(a(e)("shipCashAccountDetail.title")), 1)
                                                            ]),
                                                        _: 1
                                                    }),
                                                    !a(v) && !a(T) ? (D(), k(p, {
                                                        key: 0
                                                    }, {
                                                        default: o(()=>[
                                                                s(l, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: o(()=>[
                                                                            s(t, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                bordered: "",
                                                                                secondary: "",
                                                                                class: "size-7",
                                                                                onClick: Q
                                                                            }, {
                                                                                icon: o(()=>n[1] || (n[1] = [
                                                                                        _("i", {
                                                                                            class: "iconfont icon-Submit"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: o(()=>[
                                                                            h(" " + u(a(e)("common.submit")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    })) : R("", !0)
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }),
                            s(m, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: o(()=>[
                                        s(a(Ae), {
                                            onRegister: a(H),
                                            disabled: "",
                                            showActionButtonGroup: !1,
                                            "show-feedback": !1
                                        }, null, 8, [
                                            "onRegister"
                                        ])
                                    ]),
                                _: 1
                            }),
                            s(m, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                default: o(()=>[
                                        s(a(we), {
                                            ref_key: "tableRef",
                                            ref: F,
                                            columns: a(Fe)(),
                                            request: (g)=>K(g, a(Y)()),
                                            "row-key": (g)=>g.id,
                                            autoScrollX: !0,
                                            actionColumn: a(Z),
                                            "virtual-scroll": ""
                                        }, {
                                            toolbar: o(()=>[
                                                    a(v) ? R("", !0) : (D(), k(p, {
                                                        key: 0
                                                    }, {
                                                        default: o(()=>[
                                                                a(y).importLastMonthBalanceEnable === 1 && !a(T) ? (D(), k(l, {
                                                                    key: 0,
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: o(()=>[
                                                                            s(t, {
                                                                                type: "primary",
                                                                                size: "small",
                                                                                onClick: ee,
                                                                                loading: a(N)
                                                                            }, {
                                                                                default: o(()=>[
                                                                                        h(u(a(e)("shipCashAccountDetail.importBalance")), 1)
                                                                                    ]),
                                                                                _: 1
                                                                            }, 8, [
                                                                                "loading"
                                                                            ])
                                                                        ]),
                                                                    default: o(()=>[
                                                                            h(" " + u(a(e)("shipCashAccountDetail.importLastMonthCashBalance")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })) : R("", !0),
                                                                s(l, {
                                                                    trigger: "hover"
                                                                }, {
                                                                    trigger: o(()=>[
                                                                            s(t, {
                                                                                type: "primary",
                                                                                strong: "",
                                                                                bordered: "",
                                                                                secondary: "",
                                                                                class: "size-7",
                                                                                onClick: te
                                                                            }, {
                                                                                icon: o(()=>n[2] || (n[2] = [
                                                                                        _("i", {
                                                                                            class: "iconfont icon-ADD"
                                                                                        }, null, -1)
                                                                                    ])),
                                                                                _: 1
                                                                            })
                                                                        ]),
                                                                    default: o(()=>[
                                                                            h(" " + u(a(e)("shipCashAccountDetail.addBtn")), 1)
                                                                        ]),
                                                                    _: 1
                                                                })
                                                            ]),
                                                        _: 1
                                                    }))
                                                ]),
                                            _: 1
                                        }, 8, [
                                            "columns",
                                            "request",
                                            "row-key",
                                            "actionColumn"
                                        ]),
                                        s(m, {
                                            bordered: !1,
                                            class: "proCard mt-2"
                                        }, {
                                            default: o(()=>[
                                                    s(ie, {
                                                        justify: "space-around"
                                                    }, {
                                                        default: o(()=>[
                                                                (D(!0), j(De, null, _e(a(B), (g, ce)=>(D(), j("div", {
                                                                        key: ce,
                                                                        class: "text-[16px]"
                                                                    }, [
                                                                        _("span", qe, u(g.title) + ": ", 1),
                                                                        _("span", Ve, u(g.count), 1)
                                                                    ]))), 128))
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }),
                            s(m, {
                                bordered: !1,
                                class: "proCard mt-2"
                            }, {
                                header: o(()=>[
                                        h(u(a(e)("shipCashAccountDetail.expenseDetailsSection.title")), 1)
                                    ]),
                                default: o(()=>[
                                        s(p, null, {
                                            default: o(()=>[
                                                    s(t, {
                                                        secondary: "",
                                                        type: "primary",
                                                        onClick: oe
                                                    }, {
                                                        default: o(()=>[
                                                                h(u(a(e)("shipCashAccountDetail.expenseDetailsSection.bondStoreDetails")), 1)
                                                            ]),
                                                        _: 1
                                                    }),
                                                    s(t, {
                                                        secondary: "",
                                                        type: "primary",
                                                        onClick: ne
                                                    }, {
                                                        default: o(()=>[
                                                                h(u(a(e)("shipCashAccountDetail.expenseDetailsSection.victualingDetails")), 1)
                                                            ]),
                                                        _: 1
                                                    })
                                                ]),
                                            _: 1
                                        })
                                    ]),
                                _: 1
                            }),
                            s(Be, {
                                ref_key: "addModalRef",
                                ref: E,
                                onRefresh: M,
                                onRefreshSummary: A,
                                summaryData: a(y)
                            }, null, 8, [
                                "summaryData"
                            ])
                        ]),
                    _: 1
                });
            };
        }
    });
});
export { Rt as default, __tla };
