WIP Work on new Quotes

This commit is contained in:
Nisse Lommerde 2025-02-01 09:57:57 -08:00
parent 0b8fd00f67
commit ba71d92f1f
9 changed files with 67 additions and 9 deletions

View File

@ -41,6 +41,7 @@ public static function form(Form $form): Form
->columnSpan(1),
DatePicker::make('date')
->default(today())
->required(),
TextArea::make('notes')
@ -65,7 +66,9 @@ public static function form(Form $form): Form
->prefix('$'),
TextInput::make('run_charge')
->prefix('$'),
]),
])
->addActionLabel('Add Embroidery Entry')
->defaultItems(0),
TableRepeater::make('screenPrintEntries')
->relationship('screenPrintEntries')
@ -87,8 +90,11 @@ public static function form(Form $form): Form
->prefix('$'),
TextInput::make('poly_ink')
->prefix('$'),
TextInput::make('other_charges'),
]),
TextInput::make('other_charges')
->prefix('$'),
])
->addActionLabel('Add Screen Print Entry')
->defaultItems(0),
TableRepeater::make('heatTransferEntries')
->relationship('heatTransferEntries')
@ -97,13 +103,15 @@ public static function form(Form $form): Form
->label('Logo name'),
TextInput::make('quantity')
->prefix('#'),
TextInput::make('Width')
TextInput::make('width')
->suffix('"'),
TextInput::make('Height')
TextInput::make('height')
->suffix('"'),
TextInput::make('price')
->prefix('$'),
]),
])
->addActionLabel('Add Heat Transfer Entry')
->defaultItems(0),
])->columns(1);
}

View File

@ -3,7 +3,9 @@
namespace App\Filament\Admin\Resources\QuoteResource\Pages;
use App\Filament\Admin\Resources\QuoteResource;
use App\Models\Quote;
use Filament\Actions;
use Filament\Actions\Action;
use Filament\Resources\Pages\EditRecord;
class EditQuote extends EditRecord
@ -13,6 +15,12 @@ class EditQuote extends EditRecord
protected function getHeaderActions(): array
{
return [
Action::make('print')
->icon('lucide-printer')
->url(fn (Quote $record) => route('pdf.quote', $record))
->openUrlInNewTab(),
Actions\DeleteAction::make(),
];
}

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Models\InvoiceReport;
use App\Models\Quote;
use Spatie\Browsershot\Browsershot;
use Spatie\LaravelPdf\Facades\Pdf;
@ -23,4 +24,18 @@ public function invoiceReport(int $id)
return redirect($url);
}
public function quote(int $id)
{
$quote = Quote::find($id);
$url = strtolower('quote-'.$quote->id.'.pdf');
Pdf::view('pdf.quote', ['quote' => $quote])
->withBrowsershot(function (Browsershot $browsershot) {
$browsershot->noSandbox();
})
->margins(8, 8, 15, 8)
->footerView('pdf.quote-footer', ['quote' => $quote])
->save($url);
}
}

View File

@ -14,7 +14,7 @@ class EmbroideryEntry extends Model
'width',
'height',
'placement',
'stitches',
'stitch_count',
'digitizing_cost',
'run_charge',
];

View File

@ -36,4 +36,19 @@ public function heatTransferEntries(): HasMany
{
return $this->hasMany(HeatTransferEntry::class);
}
public function embroideryEntries(): HasMany
{
return $this->hasMany(EmbroideryEntry::class);
}
public function screenPrintEntries(): HasMany
{
return $this->hasMany(ScreenPrintEntry::class);
}
public function heatTransferEntries(): HasMany
{
return $this->hasMany(HeatTransferEntry::class);
}
}

View File

@ -21,7 +21,7 @@ public function up(): void
$table->decimal('width', 6, 2)->nullable();
$table->decimal('height', 6, 2)->nullable();
$table->string('placement')->nullable();
$table->string('stitches')->nullable();
$table->string('stitch_count')->nullable();
$table->string('digitizing_cost')->nullable();
$table->string('run_charge')->nullable();
$table->text('notes')->nullable();

View File

@ -26,7 +26,7 @@ public function run(): void
ServiceTypeSeeder::class,
ProductServiceSeeder::class,
ServiceFileSeeder::class,
QuoteSeeder::class,
// QuoteSeeder::class,
InvoiceSeeder::class,
InvoiceReportSeeder::class,
]);

View File

@ -0,0 +1,10 @@
<style>
* {
font-size: 12px;
margin: 10px 5px;
}
</style>
<footer>
{{$quote->internal_id}}, page @pageNumber of @totalPages
</footer>'

View File

@ -19,6 +19,8 @@
// Auth::routes();
Route::get('/pdf/invoicereport/{id}', [PdfController::class, 'invoiceReport'])->name('pdf.invoice-report');
Route::get('/pdf/quote/{id}', [PdfController::class, 'quote'])->name('pdf.quote');
Route::get('orders/{order}/pdf', [OrderController::class, 'pdf'])->name('orders.pdf');
Route::get('invoices/{invoice}/pdf', [InvoiceController::class, 'pdf'])->name('invoice.pdf');
Route::get('customers/{customer}/pdf', [CustomerController::class, 'pdf'])->name('customer.pdf');