Move user menu to sidebar, fixes #35
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import AppLayout from '@/layouts/AppLayout.vue'
|
||||
import { invoices } from '@/routes'
|
||||
import { computed, ref, onMounted, watch, defineProps, HTMLAttributes } from 'vue'
|
||||
import { type Invoice, type Customer, type Address } from '@/types'
|
||||
import { newInvoice } from '@/types/index.d'
|
||||
import { Head } from '@inertiajs/vue3'
|
||||
import { computed, ref, onMounted, watch } from 'vue'
|
||||
import axios, { Axios, AxiosError, AxiosResponse } from 'axios'
|
||||
import axios from 'axios'
|
||||
import AppLayout from '@/layouts/AppLayout.vue'
|
||||
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, } from '@/components/ui/select'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import DocumentTable from '@/components/documents/DocumentTable.vue'
|
||||
@@ -15,11 +13,11 @@ import InvoiceDialog from '@/components/documents/InvoiceDialog.vue'
|
||||
import Fuse from 'fuse.js';
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { toast } from 'vue-sonner'
|
||||
import { testToast } from '@/lib/utils'
|
||||
import SelectSeparator from '@/components/ui/select/SelectSeparator.vue'
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
||||
import { Kbd, KbdGroup } from '@/components/ui/kbd'
|
||||
import { statusBadgeLabels } from '@/components/ui/status-badge'
|
||||
import AppHeader from '@/components/AppHeader.vue'
|
||||
|
||||
const invoicesData = ref([] as Invoice[])
|
||||
const activeInvoice = ref<Invoice | null>(null)
|
||||
@@ -191,62 +189,54 @@ const deleteInvoice = async (id: number) => {
|
||||
|
||||
<template>
|
||||
|
||||
<Head title="Rechnungen" />
|
||||
|
||||
|
||||
<!-- Function Header -->
|
||||
<AppLayout>
|
||||
<AppLayout title="Rechnungen">
|
||||
|
||||
<div
|
||||
class="flex h-full flex-1 flex-col gap-4 overflow-x-auto p-4 lg:p-8 lg:pl-4 print:bg-transparent print:p-0 print:m-0">
|
||||
<AppHeader>
|
||||
<!-- Year select -->
|
||||
<template #left>
|
||||
<Button variant="ghost" :disabled="selectedYearIndex >= (years.length - 1)"
|
||||
@click="selectedYearIndex++">
|
||||
<ChevronLeft />
|
||||
</Button>
|
||||
<Select size="sm" v-model="selectedYearIndex" v-if="years.length > 1">
|
||||
<SelectTrigger class=" hover:bg-accent">
|
||||
<SelectValue placeholder="Jahr" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem :value="null">
|
||||
<SelectLabel>Alle</SelectLabel>
|
||||
</SelectItem>
|
||||
<SelectSeparator />
|
||||
<SelectItem v-for="(year, index) in years" :value="index">
|
||||
<SelectLabel>{{ year }}</SelectLabel>
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button variant="ghost" @click="selectedYearIndex--" :disabled="selectedYearIndex <= 0">
|
||||
<ChevronRight />
|
||||
</Button>
|
||||
</template>
|
||||
|
||||
<div id="function-header" class="flex row justify-between items-center mb-4 gap-4">
|
||||
|
||||
<!-- Year select -->
|
||||
<div class="flex row items-center">
|
||||
<Button :variant="'ghost'" :disabled="selectedYearIndex >= (years.length - 1)"
|
||||
@click="selectedYearIndex++">
|
||||
<ChevronLeft />
|
||||
<!-- Search field -->
|
||||
<template #middle>
|
||||
<Input ref="search-field" id="search" type="text" placeholder="Filtern" class="px-8 bg-background"
|
||||
v-model="searchQuery" />
|
||||
<span class="absolute start-0 inset-y-0 flex items-center justify-center px-2">
|
||||
<Search class="size-4 text-muted-foreground" :stroke-width="1.5" />
|
||||
</span>
|
||||
<span class="absolute end-0 inset-y-0 flex items-center justify-center px-0 mr-1">
|
||||
<Button :size="'sm'" :variant="'ghost'" @click="searchQuery = ''; searchField.focus()">
|
||||
<Delete class="size-4 text-muted-foreground" :stroke-width="1.5" />
|
||||
</Button>
|
||||
<Select :size="'sm'" v-model="selectedYearIndex" v-if="years.length > 1">
|
||||
<SelectTrigger class=" hover:bg-accent">
|
||||
<SelectValue placeholder="Jahr" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectGroup>
|
||||
<SelectItem :value="null">
|
||||
<SelectLabel>Alle</SelectLabel>
|
||||
</SelectItem>
|
||||
<SelectSeparator />
|
||||
<SelectItem v-for="(year, index) in years" :value="index">
|
||||
<SelectLabel>{{ year }}</SelectLabel>
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button :variant="'ghost'" @click="selectedYearIndex--" :disabled="selectedYearIndex <= 0">
|
||||
<ChevronRight />
|
||||
</Button>
|
||||
</div>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<!-- Search field -->
|
||||
<div class="relative w-full max-w-sm items-center">
|
||||
<Input ref="search-field" id="search" type="text" placeholder="Filtern" class="px-8 bg-background"
|
||||
v-model="searchQuery" />
|
||||
<span class="absolute start-0 inset-y-0 flex items-center justify-center px-2">
|
||||
<Search class="size-4 text-muted-foreground" :stroke-width="1.5" />
|
||||
</span>
|
||||
<span class="absolute end-0 inset-y-0 flex items-center justify-center px-0 mr-1">
|
||||
<Button :size="'sm'" :variant="'ghost'" @click="searchQuery = ''; searchField.focus()">
|
||||
<Delete class="size-4 text-muted-foreground" :stroke-width="1.5" />
|
||||
</Button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- <Button size="sm" @click="testToast" class="mr-2">
|
||||
Toast
|
||||
</Button> -->
|
||||
|
||||
<!-- New button -->
|
||||
<!-- New button -->
|
||||
<template #right>
|
||||
<TooltipProvider>
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
@@ -265,18 +255,17 @@ const deleteInvoice = async (id: number) => {
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
</template>
|
||||
|
||||
</div>
|
||||
</AppHeader>
|
||||
|
||||
<!-- Invoice Table -->
|
||||
<DocumentTable :invoices="filteredInvoices" :onItemClicked="showDetail" />
|
||||
|
||||
<!-- Invoice Table -->
|
||||
<DocumentTable :invoices="filteredInvoices" :onItemClicked="showDetail" />
|
||||
<!-- Invoice detail dialog -->
|
||||
<InvoiceDialog :invoiceData="activeInvoice" :customers="customersData" v-model="detailDialogOpen"
|
||||
@save="saveInvoice" @delete="deleteInvoice" />
|
||||
|
||||
<!-- Invoice detail dialog -->
|
||||
<InvoiceDialog :invoiceData="activeInvoice" :customers="customersData" v-model="detailDialogOpen"
|
||||
@save="saveInvoice" @delete="deleteInvoice" />
|
||||
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user