<script setup>
import {reactive, inject, onMounted} from 'vue';
import AppLayout from '../../../../resources/js/layouts/AppLayout.vue';
import { useAjax } from "../../../../resources/js/components/ajaxHandler.js";
import ShadowedBox from "../../../Views/Components/ShadowedBox.vue";
import TabbedPage from "../../../Views/Components/TabbedPage.vue";
import {toast} from "vue3-toastify";
import ListInvoices from "./Partials/myInvoiceDetails/ListInvoices.vue";

const props = defineProps({
    currentStatus: Number,
})

const initialCostUnitId = props.cost_unit_id
const initialInvoiceId = props.invoice_id

const tabs = [
    {
        title: 'Neue Abrechnungen',
        component: ListInvoices,
        endpoint: "/api/v1/invoice/my-invoices/new",
        deep_jump_id: initialCostUnitId,
        deep_jump_id_sub: initialInvoiceId,

    },
    {
        title: 'Freigegebene Abrechnungen',
        component: ListInvoices,
        endpoint: "/api/v1/invoice/my-invoices/approved",
        deep_jump_id: initialCostUnitId,
        deep_jump_id_sub: initialInvoiceId,
    },

    {
        title: 'Abgelehnte Abrechnungen',
        component: ListInvoices,
        endpoint: "/api/v1/invoice/my-invoices/denied",
        deep_jump_id: initialCostUnitId,
        deep_jump_id_sub: initialInvoiceId,
    },
]

onMounted(() => {
    if (undefined !== props.message) {
        toast.success(props.message)
    }
})
</script>

<template>
    <AppLayout title="Meine Abrechnungen">
        <shadowed-box style="width: 95%; margin: 20px auto; padding: 20px; overflow-x: hidden;">
            <tabbed-page :tabs="tabs" :subTabIndex=props.currentStatus />

        </shadowed-box>
    </AppLayout>
</template>
