Add route and logic to create a new invoice directly from the sidebar
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import NavFooter from '@/components/NavFooter.vue';
|
||||
import NavMain from '@/components/NavMain.vue';
|
||||
import { Sidebar, SidebarContent, SidebarFooter, SidebarHeader, SidebarTrigger } from '@/components/ui/sidebar';
|
||||
import { dashboard, crm, offers, invoices, timesheets, customers, leads, achievements } from '@/routes';
|
||||
import { dashboard, crm, offers, invoices, newInvoice, timesheets, customers, leads, achievements } from '@/routes';
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
||||
import { Kbd } from '@/components/ui/kbd'
|
||||
import { edit } from '@/routes/profile';
|
||||
@@ -59,7 +59,7 @@ const mainNavGroups: NavGroup[] = [
|
||||
title: "Neue Rechnung",
|
||||
icon: Plus,
|
||||
color: 'text-foreground',
|
||||
href: invoices()
|
||||
href: newInvoice()
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -92,7 +92,7 @@ const footerNavItems: NavItem[] = [
|
||||
|
||||
<TooltipProvider>
|
||||
<Tooltip :delay-duration="666">
|
||||
<TooltipTrigger class="w-fit absolute -right-0">
|
||||
<TooltipTrigger class="w-fit absolute right-3 group-data-[collapsible=icon]:right-5">
|
||||
<SidebarTrigger class="hidden md:flex text-primary-foreground" />
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
|
||||
@@ -39,6 +39,10 @@ onMounted(async () => {
|
||||
customersData.value = customerResponse.data as Customer[]
|
||||
|
||||
searchField.value = document.getElementById('search')
|
||||
|
||||
let queryString = window.location.search
|
||||
let params = new URLSearchParams(queryString)
|
||||
if (params.get('action') == 'new') showDetail(newInvoice())
|
||||
})
|
||||
|
||||
watch(invoicesData, () => {
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
return Inertia::render('Invoices');
|
||||
})->middleware(['auth', 'verified'])->name('invoices');
|
||||
|
||||
Route::get('invoices?action=new', function () {
|
||||
return Inertia::render('Invoices');
|
||||
})->middleware(['auth', 'verified'])->name('newInvoice');
|
||||
|
||||
Route::get('invoice/{id}', [InvoiceController::class, 'preview'])
|
||||
->middleware(['auth', 'verified'])
|
||||
->name('invoice.preview');
|
||||
|
||||
Reference in New Issue
Block a user