Work on invoices and table spacing

orders
Nisse Lommerde 2 weeks ago
parent 1f1f783aa9
commit 1ffd38fd53

3
.gitignore vendored

@ -103,3 +103,6 @@ fabric.properties
.idea/caches/build_file_checksums.ser .idea/caches/build_file_checksums.ser
.idea .idea
.directory
.directory
.directory

@ -45,6 +45,7 @@ class InvoiceResource extends Resource
->options(Customer::all()->pluck('company_name', 'id')) ->options(Customer::all()->pluck('company_name', 'id'))
->reactive() ->reactive()
->searchable() ->searchable()
->disabledOn('edit')
->columnSpan(2), ->columnSpan(2),
Split::make([ Split::make([
@ -56,6 +57,8 @@ class InvoiceResource extends Resource
->columnSpan(2), ->columnSpan(2),
Select::make('status') Select::make('status')
->options(InvoiceStatus::class) ->options(InvoiceStatus::class)
->searchable()
->required()
->default(InvoiceStatus::UNPAID), ->default(InvoiceStatus::UNPAID),
])->columnSpan(2), ])->columnSpan(2),
@ -97,24 +100,31 @@ class InvoiceResource extends Resource
->searchable(), ->searchable(),
Tables\Columns\TextColumn::make('customer.company_name') Tables\Columns\TextColumn::make('customer.company_name')
->sortable() ->sortable()
->extraHeaderAttributes(['class' => 'w-full'])
->searchable(), ->searchable(),
Tables\Columns\TextColumn::make('status')
->badge(InvoiceStatus::class)
->sortable(),
Tables\Columns\TextColumn::make('created_at') Tables\Columns\TextColumn::make('created_at')
->label('Created')
->date() ->date()
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('subtotal')
->money('USD')
->alignRight(),
Tables\Columns\TextColumn::make('gst_amount') Tables\Columns\TextColumn::make('gst_amount')
->label('GST') ->label('GST')
->prefix('$'), // ->prefix('$')
->money('USD')
->alignRight(),
Tables\Columns\TextColumn::make('pst_amount') Tables\Columns\TextColumn::make('pst_amount')
->label('PST') ->label('PST')
->prefix('$'), ->money('USD')
Tables\Columns\TextColumn::make('subtotal') ->alignRight(),
->prefix('$'),
Tables\Columns\TextColumn::make('total') Tables\Columns\TextColumn::make('total')
->prefix('$') ->money('USD')
->weight('bold'), ->weight('bold')
Tables\Columns\TextColumn::make('status') ->alignRight(),
->badge(InvoiceStatus::class)
->sortable(),
]) ])
->filters([ ->filters([

@ -30,10 +30,15 @@ class OrdersRelationManager extends RelationManager
->columns([ ->columns([
Tables\Columns\TextColumn::make('customer_po') Tables\Columns\TextColumn::make('customer_po')
->color('code') ->color('code')
->weight('bold'), ->weight('bold')
Tables\Columns\TextColumn::make('total_product_quantity'), ->extraHeaderAttributes(['class' => 'w-full']),
Tables\Columns\TextColumn::make('total_product_quantity')
->label('Total QTY')
->alignRight(),
Tables\Columns\TextColumn::make('total_service_price') Tables\Columns\TextColumn::make('total_service_price')
->prefix('$'), ->alignRight()
->label('Total price')
->money('usd'),
]) ])
->filters([ ->filters([
// //

@ -37,7 +37,7 @@ class ProductServicesRelationManager extends RelationManager
->color('code') ->color('code')
->weight('bold') ->weight('bold')
->sortable(), ->sortable(),
Tables\Columns\TextColumn::make('service_type') Tables\Columns\TextColumn::make('serviceType.name')
->label('Type') ->label('Type')
->weight('bold') ->weight('bold')
->sortable(), ->sortable(),

@ -9,6 +9,7 @@ use App\Filament\Resources\OrderResource\Pages;
use App\Models\Contact; use App\Models\Contact;
use App\Models\Customer; use App\Models\Customer;
use App\Models\Order; use App\Models\Order;
use App\Models\ServiceType;
use Filament\Forms\Components\DatePicker; use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Grid; use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Repeater; use Filament\Forms\Components\Repeater;
@ -146,15 +147,11 @@ class OrderResource extends Resource
->schema([ ->schema([
Grid::make(19) Grid::make(19)
->schema([ ->schema([
TextInput::make('service_type') Select::make('serviceType')
->datalist([ ->options(ServiceType::all()->pluck('name', 'id'))
'Embroidery', ->columnSpan(2)
'SCP', ->placeholder('Select...')
'Vinyl', ->searchable(),
'Editing',
'Digitizing',
])
->columnSpan(2),
TextInput::make('placement') TextInput::make('placement')
->columnSpan(3), ->columnSpan(3),
TextInput::make('serviceFileName') TextInput::make('serviceFileName')
@ -243,7 +240,7 @@ class OrderResource extends Resource
->searchable() ->searchable()
->sortable() ->sortable()
->extraHeaderAttributes([ ->extraHeaderAttributes([
'class' => 'w-8', 'class' => 'w-full',
]), ]),
TextColumn::make('order_date') TextColumn::make('order_date')
->searchable() ->searchable()

@ -42,8 +42,15 @@ class ServiceTypeResource extends Resource
{ {
return $table return $table
->columns([ ->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') Tables\Columns\TextColumn::make('quantity')
->alignRight()
->getStateUsing(function (Table $table, Model $record) { ->getStateUsing(function (Table $table, Model $record) {
return $record->getQuantityAttribute( return $record->getQuantityAttribute(
$table->getFilter('created_at')->getState()['created_at'], $table->getFilter('created_at')->getState()['created_at'],
@ -52,6 +59,7 @@ class ServiceTypeResource extends Resource
}), }),
Tables\Columns\TextColumn::make('amount') Tables\Columns\TextColumn::make('amount')
->alignRight()
->getStateUsing(function (Table $table, Model $record) { ->getStateUsing(function (Table $table, Model $record) {
return $record->getAmountAttribute( return $record->getAmountAttribute(
$table->getFilter('created_at')->getState()['created_at'], $table->getFilter('created_at')->getState()['created_at'],
@ -61,6 +69,7 @@ class ServiceTypeResource extends Resource
->prefix('$'), ->prefix('$'),
Tables\Columns\TextColumn::make('salesPercentage') Tables\Columns\TextColumn::make('salesPercentage')
->alignRight()
->getStateUsing(function (Table $table, Model $record) { ->getStateUsing(function (Table $table, Model $record) {
return $record->getSalesPercentageAttribute( return $record->getSalesPercentageAttribute(
$table->getFilter('created_at')->getState()['created_at'], $table->getFilter('created_at')->getState()['created_at'],
@ -68,7 +77,7 @@ class ServiceTypeResource extends Resource
); );
}) })
->suffix('%') ->suffix('%')
->label('Sales percentage'), ->label('% sales'),
Tables\Columns\TextColumn::make('averagePrice') Tables\Columns\TextColumn::make('averagePrice')
->getStateUsing(function (Table $table, Model $record) { ->getStateUsing(function (Table $table, Model $record) {
@ -77,6 +86,8 @@ class ServiceTypeResource extends Resource
$table->getFilter('created_until')->getState()['created_until'] $table->getFilter('created_until')->getState()['created_until']
); );
}) })
->alignRight()
->label('Average')
->prefix('$'), ->prefix('$'),
]) ])
->filters([ ->filters([

@ -81,7 +81,7 @@ class Invoice extends Model
return number_format($this->subtotal * 0.05, 2); return number_format($this->subtotal * 0.05, 2);
} }
return 0; return 0.00;
} }
public function getPstAmountAttribute(): float public function getPstAmountAttribute(): float
@ -90,7 +90,7 @@ class Invoice extends Model
return number_format($this->subtotal * 0.07, 2); return number_format($this->subtotal * 0.07, 2);
} }
return 0; return 0.00;
} }
public function orders(): HasMany public function orders(): HasMany

@ -16,7 +16,6 @@ class ProductService extends Model
protected $fillable = [ protected $fillable = [
'order_id', 'order_id',
'service_file_id', 'service_file_id',
// 'service_type',
'placement', 'placement',
'setup_amount', 'setup_amount',
'amount', 'amount',

@ -22,14 +22,19 @@ class OrderFactory extends Factory
$this->faker->randomElement(OrderStatus::cases())->value; $this->faker->randomElement(OrderStatus::cases())->value;
return [ return [
'created_at' => $order_date, 'created_at' => $order_date,
'updated_at' => Carbon::now(), 'updated_at' => Carbon::now(),
'customer_po' => $this->faker->randomNumber(6, true),
'order_type' => $this->faker->randomElement(OrderType::cases())->value, 'customer_po' => $this->faker->randomElement([
'order_date' => $order_date, $this->faker->randomNumber(6, true),
'due_date' => $due_date, $this->faker->words(rand(2, 6), true),
'status' => $status, ]),
'notes' => $this->faker->words(10, 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), 'rush' => $this->faker->boolean(20),
'repeat' => $this->faker->boolean(), 'repeat' => $this->faker->boolean(),
@ -39,7 +44,6 @@ class OrderFactory extends Factory
'garments' => $this->faker->boolean(), 'garments' => $this->faker->boolean(),
'supplied_file' => $this->faker->boolean(), 'supplied_file' => $this->faker->boolean(),
// 'order_attributes' => ['New Art', 'Garments', 'Rush'],
]; ];
} }
} }

32
package-lock.json generated

@ -6,7 +6,7 @@
"": { "": {
"dependencies": { "dependencies": {
"bootstrap-icons": "^1.11.3", "bootstrap-icons": "^1.11.3",
"puppeteer": "^23.7.1" "puppeteer": "^23.8.0"
}, },
"devDependencies": { "devDependencies": {
"@popperjs/core": "^2.11.6", "@popperjs/core": "^2.11.6",
@ -1546,9 +1546,9 @@
} }
}, },
"node_modules/devtools-protocol": { "node_modules/devtools-protocol": {
"version": "0.0.1354347", "version": "0.0.1367902",
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1354347.tgz", "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1367902.tgz",
"integrity": "sha512-BlmkSqV0V84E2WnEnoPnwyix57rQxAM5SKJjf4TbYOCGLAWtz8CDH8RIaGOjPgPCXo2Mce3kxSY497OySidY3Q==", "integrity": "sha512-XxtPuC3PGakY6PD7dG66/o8KwJ/LkH2/EKe19Dcw58w53dv4/vSQEkn/SzuyhHE2q4zPgCkxQBxus3VV4ql+Pg==",
"license": "BSD-3-Clause" "license": "BSD-3-Clause"
}, },
"node_modules/didyoumean": { "node_modules/didyoumean": {
@ -2808,17 +2808,17 @@
} }
}, },
"node_modules/puppeteer": { "node_modules/puppeteer": {
"version": "23.7.1", "version": "23.8.0",
"resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.7.1.tgz", "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.8.0.tgz",
"integrity": "sha512-jS6XehagMvxQ12etwY/4EOYZ0Sm8GAsrtGhdQn4AqpJAyHc3RYl7tGd4QYh/MmShDw8sF9FWYQqGidhoXaqokQ==", "integrity": "sha512-MFWDMWoCcOpwNwQIjA9gPKWrEUbj8bLCzkK56w5lZPMUT6wK4FfpgOEPxKffVmXEMYMZzgcjxzqy15b/Q1ibaw==",
"hasInstallScript": true, "hasInstallScript": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@puppeteer/browsers": "2.4.1", "@puppeteer/browsers": "2.4.1",
"chromium-bidi": "0.8.0", "chromium-bidi": "0.8.0",
"cosmiconfig": "^9.0.0", "cosmiconfig": "^9.0.0",
"devtools-protocol": "0.0.1354347", "devtools-protocol": "0.0.1367902",
"puppeteer-core": "23.7.1", "puppeteer-core": "23.8.0",
"typed-query-selector": "^2.12.0" "typed-query-selector": "^2.12.0"
}, },
"bin": { "bin": {
@ -2829,15 +2829,15 @@
} }
}, },
"node_modules/puppeteer-core": { "node_modules/puppeteer-core": {
"version": "23.7.1", "version": "23.8.0",
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.7.1.tgz", "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.8.0.tgz",
"integrity": "sha512-Om/qCZhd+HLoAr7GltrRAZpS3uOXwHu7tXAoDbNcJADHjG2zeAlDArgyIPXYGG4QB/EQUHk13Q6RklNxGM73Pg==", "integrity": "sha512-c2ymGN2M//We7pC+JhP2dE/g4+qnT89BO+EMSZyJmecN3DN6RNqErA7eH7DrWoNIcU75r2nP4VHa4pswAL6NVg==",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@puppeteer/browsers": "2.4.1", "@puppeteer/browsers": "2.4.1",
"chromium-bidi": "0.8.0", "chromium-bidi": "0.8.0",
"debug": "^4.3.7", "debug": "^4.3.7",
"devtools-protocol": "0.0.1354347", "devtools-protocol": "0.0.1367902",
"typed-query-selector": "^2.12.0", "typed-query-selector": "^2.12.0",
"ws": "^8.18.0" "ws": "^8.18.0"
}, },
@ -3133,9 +3133,9 @@
"license": "BSD-3-Clause" "license": "BSD-3-Clause"
}, },
"node_modules/streamx": { "node_modules/streamx": {
"version": "2.20.1", "version": "2.20.2",
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.1.tgz", "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.2.tgz",
"integrity": "sha512-uTa0mU6WUC65iUvzKH4X9hEdvSW7rbPxPtwfWiLMSj3qTdQbAiUboZTxauKfpFuGIGa1C2BYijZ7wgdUXICJhA==", "integrity": "sha512-aDGDLU+j9tJcUdPGOaHmVF1u/hhI+CsGkT02V3OKlHDV7IukOI+nTWAGkiZEKCO35rWN1wIr4tS7YFr1f4qSvA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fast-fifo": "^1.3.2", "fast-fifo": "^1.3.2",

@ -18,6 +18,6 @@
}, },
"dependencies": { "dependencies": {
"bootstrap-icons": "^1.11.3", "bootstrap-icons": "^1.11.3",
"puppeteer": "^23.7.1" "puppeteer": "^23.8.0"
} }
} }

Binary file not shown.

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

@ -1,6 +1,12 @@
@extends('layouts.pdf') @extends('layouts.pdf')
<div class="container-fluid pt-4 font-serif" style="font-size: 0.9rem"> <style>
* {
font-size: 0.9rem;
}
</style>
<div class="container-fluid pt-4 font-serif" style="">
<div class="fw-bold"> <div class="fw-bold">
TOP NOTCH EMBROIDERY & DIGITIZING LTD. TOP NOTCH EMBROIDERY & DIGITIZING LTD.
</div> </div>

Loading…
Cancel
Save