Add contract management and invoice settings pages
- Created a new Blade view for managing brand contracts with forms for adding and editing contracts, including client and category selection. - Implemented success message notifications for contract actions. - Added a new Blade view for invoice settings, allowing customization of invoice number format, header branding, and default values for new invoices. - Introduced a new PDF view for generating rate cards with customizable styles based on user profile settings. - Developed a profile management page for rate cards, enabling users to update their identity, appearance, and visibility settings.
This commit is contained in:
@@ -6,6 +6,7 @@ namespace App\Services;
|
||||
|
||||
use App\Models\Invoice;
|
||||
use App\Models\InvoiceItem;
|
||||
use App\Models\InvoiceSettings;
|
||||
use Barryvdh\DomPDF\Facade\Pdf;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
@@ -22,7 +23,8 @@ final class InvoiceService
|
||||
]);
|
||||
|
||||
foreach ($items as $item) {
|
||||
$item['total'] = $item['quantity'] * $item['unit_price'];
|
||||
$item['total'] = $item['quantity'] * $item['unit_price'];
|
||||
$item['is_taxable'] = isset($item['is_taxable']) && $item['is_taxable'] ? true : false;
|
||||
$invoice->items()->create($item);
|
||||
}
|
||||
|
||||
@@ -37,7 +39,8 @@ final class InvoiceService
|
||||
$invoice->items()->delete();
|
||||
|
||||
foreach ($items as $item) {
|
||||
$item['total'] = $item['quantity'] * $item['unit_price'];
|
||||
$item['total'] = $item['quantity'] * $item['unit_price'];
|
||||
$item['is_taxable'] = isset($item['is_taxable']) && $item['is_taxable'] ? true : false;
|
||||
$invoice->items()->create($item);
|
||||
}
|
||||
|
||||
@@ -49,8 +52,9 @@ final class InvoiceService
|
||||
public function generatePdf(Invoice $invoice): Response
|
||||
{
|
||||
$invoice->load('client', 'items');
|
||||
$invoiceSettings = InvoiceSettings::instance();
|
||||
|
||||
$pdf = Pdf::loadView('invoices.pdf', compact('invoice'));
|
||||
$pdf = Pdf::loadView('invoices.pdf', compact('invoice', 'invoiceSettings'));
|
||||
$pdf->setPaper('A4', 'portrait');
|
||||
|
||||
return $pdf->download("invoice-{$invoice->invoice_number}.pdf");
|
||||
|
||||
Reference in New Issue
Block a user