diff --git a/app/Filament/Admin/Resources/QuoteResource.php b/app/Filament/Admin/Resources/QuoteResource.php
index 331fed4..a4fc037 100644
--- a/app/Filament/Admin/Resources/QuoteResource.php
+++ b/app/Filament/Admin/Resources/QuoteResource.php
@@ -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);
}
diff --git a/app/Filament/Admin/Resources/QuoteResource/Pages/EditQuote.php b/app/Filament/Admin/Resources/QuoteResource/Pages/EditQuote.php
index fd9dbd6..3df29e9 100644
--- a/app/Filament/Admin/Resources/QuoteResource/Pages/EditQuote.php
+++ b/app/Filament/Admin/Resources/QuoteResource/Pages/EditQuote.php
@@ -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(),
];
}
diff --git a/app/Http/Controllers/PdfController.php b/app/Http/Controllers/PdfController.php
index af9ec13..9a31319 100644
--- a/app/Http/Controllers/PdfController.php
+++ b/app/Http/Controllers/PdfController.php
@@ -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);
+ }
}
diff --git a/app/Models/EmbroideryEntry.php b/app/Models/EmbroideryEntry.php
index 52ea268..e2f14ea 100644
--- a/app/Models/EmbroideryEntry.php
+++ b/app/Models/EmbroideryEntry.php
@@ -14,7 +14,7 @@ class EmbroideryEntry extends Model
'width',
'height',
'placement',
- 'stitches',
+ 'stitch_count',
'digitizing_cost',
'run_charge',
];
diff --git a/app/Models/Quote.php b/app/Models/Quote.php
index 7671739..c0c927f 100644
--- a/app/Models/Quote.php
+++ b/app/Models/Quote.php
@@ -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);
+ }
}
diff --git a/database/migrations/020_create_embroidery_entries_table.php b/database/migrations/020_create_embroidery_entries_table.php
index ec7f424..d7ce890 100644
--- a/database/migrations/020_create_embroidery_entries_table.php
+++ b/database/migrations/020_create_embroidery_entries_table.php
@@ -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();
diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php
index 8bd5966..3c3f748 100644
--- a/database/seeders/DatabaseSeeder.php
+++ b/database/seeders/DatabaseSeeder.php
@@ -26,7 +26,7 @@ public function run(): void
ServiceTypeSeeder::class,
ProductServiceSeeder::class,
ServiceFileSeeder::class,
- QuoteSeeder::class,
+ // QuoteSeeder::class,
InvoiceSeeder::class,
InvoiceReportSeeder::class,
]);
diff --git a/resources/views/pdf/quote-footer.blade.php b/resources/views/pdf/quote-footer.blade.php
new file mode 100644
index 0000000..b4e24a6
--- /dev/null
+++ b/resources/views/pdf/quote-footer.blade.php
@@ -0,0 +1,10 @@
+
+
+'
\ No newline at end of file
diff --git a/routes/web.php b/routes/web.php
index 5d91c56..2b7c0b4 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -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');