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
.directory
.directory
.directory

@ -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([

@ -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([
//

@ -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(),

@ -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()

@ -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([

@ -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

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

@ -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'],
];
}
}

32
package-lock.json generated

@ -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",

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

Binary file not shown.

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

@ -1,6 +1,12 @@
@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">
TOP NOTCH EMBROIDERY & DIGITIZING LTD.
</div>

Loading…
Cancel
Save