diff --git a/.gitignore b/.gitignore index 4e74114..169466d 100644 --- a/.gitignore +++ b/.gitignore @@ -103,3 +103,6 @@ fabric.properties .idea/caches/build_file_checksums.ser .idea +.directory +.directory +.directory diff --git a/app/Filament/Resources/InvoiceResource.php b/app/Filament/Resources/InvoiceResource.php index ec438de..4cb86f9 100644 --- a/app/Filament/Resources/InvoiceResource.php +++ b/app/Filament/Resources/InvoiceResource.php @@ -45,6 +45,7 @@ class InvoiceResource extends Resource ->options(Customer::all()->pluck('company_name', 'id')) ->reactive() ->searchable() + ->disabledOn('edit') ->columnSpan(2), Split::make([ @@ -56,6 +57,8 @@ class InvoiceResource extends Resource ->columnSpan(2), Select::make('status') ->options(InvoiceStatus::class) + ->searchable() + ->required() ->default(InvoiceStatus::UNPAID), ])->columnSpan(2), @@ -97,24 +100,31 @@ class InvoiceResource extends Resource ->searchable(), Tables\Columns\TextColumn::make('customer.company_name') ->sortable() + ->extraHeaderAttributes(['class' => 'w-full']) ->searchable(), + Tables\Columns\TextColumn::make('status') + ->badge(InvoiceStatus::class) + ->sortable(), Tables\Columns\TextColumn::make('created_at') + ->label('Created') ->date() ->sortable(), + Tables\Columns\TextColumn::make('subtotal') + ->money('USD') + ->alignRight(), Tables\Columns\TextColumn::make('gst_amount') ->label('GST') - ->prefix('$'), +// ->prefix('$') + ->money('USD') + ->alignRight(), Tables\Columns\TextColumn::make('pst_amount') ->label('PST') - ->prefix('$'), - Tables\Columns\TextColumn::make('subtotal') - ->prefix('$'), + ->money('USD') + ->alignRight(), Tables\Columns\TextColumn::make('total') - ->prefix('$') - ->weight('bold'), - Tables\Columns\TextColumn::make('status') - ->badge(InvoiceStatus::class) - ->sortable(), + ->money('USD') + ->weight('bold') + ->alignRight(), ]) ->filters([ diff --git a/app/Filament/Resources/InvoiceResource/RelationManagers/OrdersRelationManager.php b/app/Filament/Resources/InvoiceResource/RelationManagers/OrdersRelationManager.php index e9946d4..d36d1fc 100644 --- a/app/Filament/Resources/InvoiceResource/RelationManagers/OrdersRelationManager.php +++ b/app/Filament/Resources/InvoiceResource/RelationManagers/OrdersRelationManager.php @@ -30,10 +30,15 @@ class OrdersRelationManager extends RelationManager ->columns([ Tables\Columns\TextColumn::make('customer_po') ->color('code') - ->weight('bold'), - Tables\Columns\TextColumn::make('total_product_quantity'), + ->weight('bold') + ->extraHeaderAttributes(['class' => 'w-full']), + Tables\Columns\TextColumn::make('total_product_quantity') + ->label('Total QTY') + ->alignRight(), Tables\Columns\TextColumn::make('total_service_price') - ->prefix('$'), + ->alignRight() + ->label('Total price') + ->money('usd'), ]) ->filters([ // diff --git a/app/Filament/Resources/InvoiceResource/RelationManagers/ProductServicesRelationManager.php b/app/Filament/Resources/InvoiceResource/RelationManagers/ProductServicesRelationManager.php index 7206b05..9c24181 100644 --- a/app/Filament/Resources/InvoiceResource/RelationManagers/ProductServicesRelationManager.php +++ b/app/Filament/Resources/InvoiceResource/RelationManagers/ProductServicesRelationManager.php @@ -37,7 +37,7 @@ class ProductServicesRelationManager extends RelationManager ->color('code') ->weight('bold') ->sortable(), - Tables\Columns\TextColumn::make('service_type') + Tables\Columns\TextColumn::make('serviceType.name') ->label('Type') ->weight('bold') ->sortable(), diff --git a/app/Filament/Resources/OrderResource.php b/app/Filament/Resources/OrderResource.php index 0087666..13e307b 100644 --- a/app/Filament/Resources/OrderResource.php +++ b/app/Filament/Resources/OrderResource.php @@ -9,6 +9,7 @@ use App\Filament\Resources\OrderResource\Pages; use App\Models\Contact; use App\Models\Customer; use App\Models\Order; +use App\Models\ServiceType; use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\Grid; use Filament\Forms\Components\Repeater; @@ -146,15 +147,11 @@ class OrderResource extends Resource ->schema([ Grid::make(19) ->schema([ - TextInput::make('service_type') - ->datalist([ - 'Embroidery', - 'SCP', - 'Vinyl', - 'Editing', - 'Digitizing', - ]) - ->columnSpan(2), + Select::make('serviceType') + ->options(ServiceType::all()->pluck('name', 'id')) + ->columnSpan(2) + ->placeholder('Select...') + ->searchable(), TextInput::make('placement') ->columnSpan(3), TextInput::make('serviceFileName') @@ -243,7 +240,7 @@ class OrderResource extends Resource ->searchable() ->sortable() ->extraHeaderAttributes([ - 'class' => 'w-8', + 'class' => 'w-full', ]), TextColumn::make('order_date') ->searchable() diff --git a/app/Filament/Resources/ServiceTypeResource.php b/app/Filament/Resources/ServiceTypeResource.php index 8fdad42..3ea198f 100644 --- a/app/Filament/Resources/ServiceTypeResource.php +++ b/app/Filament/Resources/ServiceTypeResource.php @@ -42,8 +42,15 @@ class ServiceTypeResource extends Resource { return $table ->columns([ - Tables\Columns\TextColumn::make('name'), + Tables\Columns\TextColumn::make('name') + ->label('Code'), + + Tables\Columns\TextColumn::make('value') + ->label('Long Name') + ->extraHeaderAttributes(['class' => 'w-full']), + Tables\Columns\TextColumn::make('quantity') + ->alignRight() ->getStateUsing(function (Table $table, Model $record) { return $record->getQuantityAttribute( $table->getFilter('created_at')->getState()['created_at'], @@ -52,6 +59,7 @@ class ServiceTypeResource extends Resource }), Tables\Columns\TextColumn::make('amount') + ->alignRight() ->getStateUsing(function (Table $table, Model $record) { return $record->getAmountAttribute( $table->getFilter('created_at')->getState()['created_at'], @@ -61,6 +69,7 @@ class ServiceTypeResource extends Resource ->prefix('$'), Tables\Columns\TextColumn::make('salesPercentage') + ->alignRight() ->getStateUsing(function (Table $table, Model $record) { return $record->getSalesPercentageAttribute( $table->getFilter('created_at')->getState()['created_at'], @@ -68,7 +77,7 @@ class ServiceTypeResource extends Resource ); }) ->suffix('%') - ->label('Sales percentage'), + ->label('% sales'), Tables\Columns\TextColumn::make('averagePrice') ->getStateUsing(function (Table $table, Model $record) { @@ -77,6 +86,8 @@ class ServiceTypeResource extends Resource $table->getFilter('created_until')->getState()['created_until'] ); }) + ->alignRight() + ->label('Average') ->prefix('$'), ]) ->filters([ diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 1af56e2..6a570ab 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -81,7 +81,7 @@ class Invoice extends Model return number_format($this->subtotal * 0.05, 2); } - return 0; + return 0.00; } public function getPstAmountAttribute(): float @@ -90,7 +90,7 @@ class Invoice extends Model return number_format($this->subtotal * 0.07, 2); } - return 0; + return 0.00; } public function orders(): HasMany diff --git a/app/Models/ProductService.php b/app/Models/ProductService.php index b10c862..326596c 100644 --- a/app/Models/ProductService.php +++ b/app/Models/ProductService.php @@ -16,7 +16,6 @@ class ProductService extends Model protected $fillable = [ 'order_id', 'service_file_id', - // 'service_type', 'placement', 'setup_amount', 'amount', diff --git a/database/factories/OrderFactory.php b/database/factories/OrderFactory.php index 610f710..044245f 100644 --- a/database/factories/OrderFactory.php +++ b/database/factories/OrderFactory.php @@ -22,14 +22,19 @@ class OrderFactory extends Factory $this->faker->randomElement(OrderStatus::cases())->value; return [ - 'created_at' => $order_date, - 'updated_at' => Carbon::now(), - 'customer_po' => $this->faker->randomNumber(6, true), - 'order_type' => $this->faker->randomElement(OrderType::cases())->value, - 'order_date' => $order_date, - 'due_date' => $due_date, - 'status' => $status, - 'notes' => $this->faker->words(10, true), + 'created_at' => $order_date, + 'updated_at' => Carbon::now(), + + 'customer_po' => $this->faker->randomElement([ + $this->faker->randomNumber(6, true), + $this->faker->words(rand(2, 6), true), + ]), + + 'order_type' => $this->faker->randomElement(OrderType::cases())->value, + 'order_date' => $order_date, + 'due_date' => $due_date, + 'status' => $status, + 'notes' => $this->faker->words(10, true), 'rush' => $this->faker->boolean(20), 'repeat' => $this->faker->boolean(), @@ -39,7 +44,6 @@ class OrderFactory extends Factory 'garments' => $this->faker->boolean(), 'supplied_file' => $this->faker->boolean(), - // 'order_attributes' => ['New Art', 'Garments', 'Rush'], ]; } } diff --git a/package-lock.json b/package-lock.json index cb92f12..e798be0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "": { "dependencies": { "bootstrap-icons": "^1.11.3", - "puppeteer": "^23.7.1" + "puppeteer": "^23.8.0" }, "devDependencies": { "@popperjs/core": "^2.11.6", @@ -1546,9 +1546,9 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1354347", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1354347.tgz", - "integrity": "sha512-BlmkSqV0V84E2WnEnoPnwyix57rQxAM5SKJjf4TbYOCGLAWtz8CDH8RIaGOjPgPCXo2Mce3kxSY497OySidY3Q==", + "version": "0.0.1367902", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1367902.tgz", + "integrity": "sha512-XxtPuC3PGakY6PD7dG66/o8KwJ/LkH2/EKe19Dcw58w53dv4/vSQEkn/SzuyhHE2q4zPgCkxQBxus3VV4ql+Pg==", "license": "BSD-3-Clause" }, "node_modules/didyoumean": { @@ -2808,17 +2808,17 @@ } }, "node_modules/puppeteer": { - "version": "23.7.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.7.1.tgz", - "integrity": "sha512-jS6XehagMvxQ12etwY/4EOYZ0Sm8GAsrtGhdQn4AqpJAyHc3RYl7tGd4QYh/MmShDw8sF9FWYQqGidhoXaqokQ==", + "version": "23.8.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.8.0.tgz", + "integrity": "sha512-MFWDMWoCcOpwNwQIjA9gPKWrEUbj8bLCzkK56w5lZPMUT6wK4FfpgOEPxKffVmXEMYMZzgcjxzqy15b/Q1ibaw==", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@puppeteer/browsers": "2.4.1", "chromium-bidi": "0.8.0", "cosmiconfig": "^9.0.0", - "devtools-protocol": "0.0.1354347", - "puppeteer-core": "23.7.1", + "devtools-protocol": "0.0.1367902", + "puppeteer-core": "23.8.0", "typed-query-selector": "^2.12.0" }, "bin": { @@ -2829,15 +2829,15 @@ } }, "node_modules/puppeteer-core": { - "version": "23.7.1", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.7.1.tgz", - "integrity": "sha512-Om/qCZhd+HLoAr7GltrRAZpS3uOXwHu7tXAoDbNcJADHjG2zeAlDArgyIPXYGG4QB/EQUHk13Q6RklNxGM73Pg==", + "version": "23.8.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.8.0.tgz", + "integrity": "sha512-c2ymGN2M//We7pC+JhP2dE/g4+qnT89BO+EMSZyJmecN3DN6RNqErA7eH7DrWoNIcU75r2nP4VHa4pswAL6NVg==", "license": "Apache-2.0", "dependencies": { "@puppeteer/browsers": "2.4.1", "chromium-bidi": "0.8.0", "debug": "^4.3.7", - "devtools-protocol": "0.0.1354347", + "devtools-protocol": "0.0.1367902", "typed-query-selector": "^2.12.0", "ws": "^8.18.0" }, @@ -3133,9 +3133,9 @@ "license": "BSD-3-Clause" }, "node_modules/streamx": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.1.tgz", - "integrity": "sha512-uTa0mU6WUC65iUvzKH4X9hEdvSW7rbPxPtwfWiLMSj3qTdQbAiUboZTxauKfpFuGIGa1C2BYijZ7wgdUXICJhA==", + "version": "2.20.2", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.2.tgz", + "integrity": "sha512-aDGDLU+j9tJcUdPGOaHmVF1u/hhI+CsGkT02V3OKlHDV7IukOI+nTWAGkiZEKCO35rWN1wIr4tS7YFr1f4qSvA==", "license": "MIT", "dependencies": { "fast-fifo": "^1.3.2", diff --git a/package.json b/package.json index 73cb29f..ff6e1bc 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,6 @@ }, "dependencies": { "bootstrap-icons": "^1.11.3", - "puppeteer": "^23.7.1" + "puppeteer": "^23.8.0" } } diff --git a/public/invoice-tn-in-24-0004.pdf b/public/invoice-tn-in-24-0004.pdf index 9613252..8d1dcea 100644 Binary files a/public/invoice-tn-in-24-0004.pdf and b/public/invoice-tn-in-24-0004.pdf differ diff --git a/resources/views/pdf/invoice-footer.blade.php b/resources/views/pdf/invoice-footer.blade.php index e45c910..73f7965 100644 --- a/resources/views/pdf/invoice-footer.blade.php +++ b/resources/views/pdf/invoice-footer.blade.php @@ -1,10 +1,10 @@ ' \ No newline at end of file + \ No newline at end of file diff --git a/resources/views/pdf/invoice.blade.php b/resources/views/pdf/invoice.blade.php index c256d32..06805b6 100644 --- a/resources/views/pdf/invoice.blade.php +++ b/resources/views/pdf/invoice.blade.php @@ -1,6 +1,12 @@ @extends('layouts.pdf') -