Optimise invoice data requests #56

This commit is contained in:
2025-11-18 10:27:49 +01:00
parent d3b6371105
commit 6d67d3d6cd
14 changed files with 308 additions and 972 deletions
+8 -5
View File
@@ -1,25 +1,26 @@
<?php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\CustomerController;
use App\Http\Controllers\InvoiceController;
use App\Http\Controllers\LineItemController;
use App\Mail\Reminder;
use App\Models\Invoice;
use App\Http\Controllers\PaymentTermsController;
use App\Http\Controllers\SettingController;
use App\Mail\OrderConfirmation;
use App\Support\ApiDataTransformer;
use Illuminate\Support\Facades\Mail;
Route::get('customers/{id}', [CustomerController::class, 'single']);
Route::get('customers', [CustomerController::class, 'index']);
Route::get('/customers/{id}', [CustomerController::class, 'single']);
Route::get('/customers', [CustomerController::class, 'index']);
// ->middleware('auth:sanctum');
// Route::apiResource('invoices', InvoiceController::class);
// ->middleware('auth:sanctum');
Route::get('/invoices/summary', [InvoiceController::class, 'summaryAll']);
Route::get('/invoices/summaryThisYear', [InvoiceController::class, 'summaryThisYear']);
Route::get('/invoices/summaryBeforeThisYear', [InvoiceController::class, 'summaryBeforeThisYear']);
Route::get('/invoices', [InvoiceController::class, 'index']);
Route::post('/invoices', [InvoiceController::class, 'store']);
Route::get('/invoices/{id}', [InvoiceController::class, 'single']);
@@ -38,6 +39,8 @@
// return new Reminder($invoice);
});
Route::get('/lineitems/{invoiceId}', [LineItemController::class, 'index']);
Route::get('/offers/{id}/confirm', function ($id) {
// $offer = offerController::single($id);
$offer = [
+38 -42
View File
@@ -3,59 +3,55 @@
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
use App\Http\Controllers\InvoiceController;
use Illuminate\Support\Facades\Log;
use App\Http\Controllers\CustomerController;
Route::get('/', function () {
return Inertia::render('Dashboard');
})->middleware(['auth', 'verified'])->name('home');
Route::middleware('auth')->group(function () {
Route::get('dashboard', function () {
return Inertia::render('Dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');
// Dashboard
Route::get('/', function () {
return Inertia::render('Dashboard');
})->name('home');
Route::get('crm', function () {
return Inertia::render('CRM');
})->middleware(['auth', 'verified'])->name('crm');
Route::get('dashboard', function () {
return Inertia::render('Dashboard');
})->name('dashboard');
Route::get('offers', function () {
return Inertia::render('Offers');
})->middleware(['auth', 'verified'])->name('offers');
// CRM
Route::get('crm', function () {
return Inertia::render('CRM');
})->name('crm');
Route::get('customers', function () {
return Inertia::render('Customers');
})->middleware(['auth', 'verified'])->name('customers');
// Offers
Route::get('offers', function () {
return Inertia::render('Offers');
})->name('offers');
Route::get('leads', function () {
return Inertia::render('Leads');
})->middleware(['auth', 'verified'])->name('leads');
// Customers
Route::get('customers', [CustomerController::class, 'show'])->name('customers');
Route::get('achievements', function () {
return Inertia::render('Achievements');
})->middleware(['auth', 'verified'])->name('achievements');
// Leads
Route::get('leads', function () {
return Inertia::render('Leads');
})->name('leads');
Route::get('invoices', function () {
return Inertia::render('Invoices');
})->middleware(['auth', 'verified'])->name('invoices');
// Achievements
Route::get('achievements', function () {
return Inertia::render('Achievements');
})->name('achievements');
Route::get('invoices?action=new', function () {
return Inertia::render('Invoices');
})->middleware(['auth', 'verified'])->name('newInvoice');
// Invoices
Route::get('invoices', [InvoiceController::class, 'show'])->name('invoices');
Route::get('invoices?action=new', [InvoiceController::class, 'show'])->name('newInvoice');
Route::get('invoice/{id}', [InvoiceController::class, 'preview'])->name('invoicePreview');
Route::get('invoice/{id}/pdf', [InvoiceController::class, 'exportPdf'])->name('invoiceExportPdf');
Route::get('invoice/{id}/xml', [InvoiceController::class, 'exportXml'])->name('invoiceExportXml');
Route::get('invoice/{id}', [InvoiceController::class, 'preview'])
->middleware(['auth', 'verified'])
->name('invoice.preview');
// Timesheets
Route::get('timesheets', function () {
return Inertia::render('Timesheets');
})->name('timesheets');
});
Route::get('invoice/{id}/pdf', [InvoiceController::class, 'exportPdf'])
->middleware(['auth', 'verified'])
->name('invoice.exportPdf');
Route::get('invoice/{id}/xml', [InvoiceController::class, 'exportXml'])
->middleware(['auth', 'verified'])
->name('invoice.exportXml');
Route::get('timesheets', function () {
return Inertia::render('Timesheets');
})->middleware(['auth', 'verified'])->name('timesheets');
require __DIR__ . '/settings.php';
require __DIR__ . '/auth.php';