Compare commits

..

1 Commits

Author SHA1 Message Date
d2c72a3f33 WIP #129 Product count sum 2025-04-11 17:31:13 -04:00
11 changed files with 45 additions and 71 deletions

View File

@ -1,10 +1,8 @@
# Changelog
**2025-04-13**
**2025-04-11**
- Fixed #132 - Inches / cm toggle for order page (and show unit on pdf)
- Fixed #148 - Change amount label to unit price on order form (also textarea)
- Fixed #147 - Resource lock sidebar settings
- Fixed #134 - Fix Dashboard 'last 30 days'
- Added #129 - Order product count sum
**2025-04-10**
- Fixed #145 - Default order sort is incorrect (newest will always show on top now)
- Fixed #142 - Packing Slip content field should be required

View File

@ -14,7 +14,6 @@
use App\Models\ServiceFile;
use App\Models\ServiceType;
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\Field;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Placeholder;
@ -177,41 +176,58 @@ public static function form(Form $form): Form
Cluster::make([
TextInput::make('xs')
->placeholder('xs')
->rules('numeric'),
->rules('numeric')
->reactive()
->afterStateUpdated(fn ($state, callable $set, callable $get) => recalculateRowTotal($set, $get)),
TextInput::make('s')
->placeholder('s')
->rules('numeric'),
->rules('numeric')
->reactive()
->afterStateUpdated(fn ($state, callable $set, callable $get) => recalculateRowTotal($set, $get)),
TextInput::make('m')
->placeholder('m')
->rules('numeric'),
->rules('numeric')
->reactive()
->afterStateUpdated(fn ($state, callable $set, callable $get) => recalculateRowTotal($set, $get)),
TextInput::make('l')
->placeholder('l')
->rules('numeric'),
->rules('numeric')
->reactive()
->afterStateUpdated(fn ($state, callable $set, callable $get) => recalculateRowTotal($set, $get)),
TextInput::make('xl')
->placeholder('xl')
->rules('numeric'),
->rules('numeric')
->reactive()
->afterStateUpdated(fn ($state, callable $set, callable $get) => recalculateRowTotal($set, $get)),
TextInput::make('2xl')
->placeholder('2xl')
->rules('numeric'),
->rules('numeric')
->reactive()
->afterStateUpdated(fn ($state, callable $set, callable $get) => recalculateRowTotal($set, $get)),
TextInput::make('3xl')
->placeholder('3xl')
->rules('numeric'),
->rules('numeric')
->reactive()
->afterStateUpdated(fn ($state, callable $set, callable $get) => recalculateRowTotal($set, $get)),
TextInput::make('osfa')
->placeholder('osfa')
->rules('numeric'),
->rules('numeric')
->reactive()
->afterStateUpdated(fn ($state, callable $set, callable $get) => recalculateRowTotal($set, $get)),
])->label('Sizes'),
Field::make('total_display')
TextInput::make('total')
->disabled()
->dehydrated(false)
->label('Total')
->view('forms.components.row-total'),
->afterStateHydrated(fn (callable $get, callable $set) => recalculateRowTotal($set, $get)),
]),
Repeater::make('services')
@ -235,7 +251,6 @@ public static function form(Form $form): Form
->placeholder('Full name here (example: \'Embroidery\'')
->required(),
])
->createOptionAction(fn ($action) => $action->modalWidth('sm'))
->createOptionUsing(function (array $data): int {
return ServiceType::create($data)->getKey();
}),

View File

@ -10,6 +10,7 @@
use Filament\Actions;
use Filament\Resources\Components\Tab;
use Filament\Resources\Pages\ListRecords;
use Filament\Support\Enums\MaxWidth;
class ListOrders extends ListRecords
{

View File

@ -11,7 +11,7 @@ class InvoiceController extends Controller
public function pdf(int $id)
{
$invoice = Invoice::find($id);
$url = strtolower($invoice->internal_id.'_'.$invoice->customer->company_name.'.pdf');
$url = strtolower('invoice-'.$invoice->internal_id.'.pdf');
Pdf::view('pdf.invoice', ['invoice' => $invoice])
->withBrowsershot(function (Browsershot $browsershot) {

View File

@ -26,6 +26,7 @@ class ProductService extends Model
'amount',
'amount_price',
'notes',
'size_unit',
];
protected $appends = [

View File

@ -25,7 +25,7 @@
| or any other location as required by the application or its packages.
*/
'version' => '20250413',
'version' => '20250411',
/*
|--------------------------------------------------------------------------

View File

@ -15,6 +15,7 @@ public function up(): void
$table->foreignId('service_file_id')->nullable();
$table->foreignId('service_type_id')->nullable();
// $table->string('service_type')->nullable();
$table->string('placement')->nullable();
$table->string('amount')->nullable();
$table->string('amount_price')->nullable();

View File

@ -16,6 +16,7 @@ public function up(): void
$table->decimal('height')->nullable();
$table->string('unit')->default('inch');
$table->integer('setup_number')->nullable();
// $table->string('notes')->nullable();
$table->softDeletes();
$table->timestamps();
});

View File

@ -217,7 +217,7 @@ class="absolute inset-0 rotate-180 transition"
<div
x-show="! isCollapsed"
class="fi-fo-repeater-item-content px-4 py-3"
class="fi-fo-repeater-item-content px-4 py-2"
>
{{ $item }}
</div>

View File

@ -1,43 +0,0 @@
@php
$statePath = $getStatePath(); // e.g., data.order_products.UUID.total_display
$rowPath = \Illuminate\Support\Str::beforeLast($statePath, '.total_display');
$xsPath = "{$rowPath}.xs";
$sPath = "{$rowPath}.s";
$mPath = "{$rowPath}.m";
$lPath = "{$rowPath}.l";
$xlPath = "{$rowPath}.xl";
$xxlPath = "{$rowPath}.2xl";
$xxxlPath = "{$rowPath}.3xl";
$osfaPath = "{$rowPath}.osfa";
@endphp
<div
x-data="{
xs: @entangle($xsPath),
s: @entangle($sPath),
m: @entangle($mPath),
l: @entangle($lPath),
xl: @entangle($xlPath),
_2xl: @entangle($xxlPath),
_3xl: @entangle($xxxlPath),
osfa: @entangle($osfaPath),
}"
>
<!-- Filament TextInput to show the computed total -->
<input
type="text"
x-bind:value="(
(parseFloat(xs || 0)) +
(parseFloat(s || 0)) +
(parseFloat(m || 0)) +
(parseFloat(l || 0)) +
(parseFloat(xl || 0)) +
(parseFloat(_2xl || 0)) +
(parseFloat(_3xl || 0)) +
(parseFloat(osfa || 0))
).toFixed(0)"
class="fi-input block w-full border-none py-1.5 text-base text-gray-950 transition duration-75 placeholder:text-gray-400 focus:ring-0 disabled:text-gray-500 disabled:[-webkit-text-fill-color:theme(colors.gray.500)] disabled:placeholder:[-webkit-text-fill-color:theme(colors.gray.400)] dark:text-white dark:placeholder:text-gray-500 dark:disabled:text-gray-400 dark:disabled:[-webkit-text-fill-color:theme(colors.gray.400)] dark:disabled:placeholder:[-webkit-text-fill-color:theme(colors.gray.500)] sm:text-sm sm:leading-6 bg-white/0 ps-3 pe-3"
readonly
/>
</div>

View File

@ -156,8 +156,8 @@
@foreach($order->orderProducts as $product)
<tr>
<td><code style="font-size: 0.9rem;">{{$product->sku}}</code></td>
<td class="text-uppercase">{{$product->product_name ?? ''}}</td>
<td class="text-uppercase">{{$product->color ?? ''}}</td>
<td class="text-uppercase">{{$product->product_name}}</td>
<td class="text-uppercase">{{$product->color}}</td>
<td style="width: 40px;">{{$product->productSizes()->get()->where('size', 'xs')->first()->amount ?? ''}}</td>
<td style="width: 40px;">{{$product->productSizes()->get()->where('size', 's')->first()->amount ?? ''}}</td>
<td style="width: 40px;">{{$product->productSizes()->get()->where('size', 'm')->first()->amount ?? ''}}</td>
@ -176,7 +176,7 @@
</div>
<div class="row mt-3 text-end" style="font-size: 12px">
<div class="col">
TOTAL QUANTITY: {{$order->totalProductQuantity ?? ''}}
TOTAL QUANTITY: {{$order->totalProductQuantity}}
</div>
</div>
@ -199,7 +199,7 @@
<tr>
<td>
<div class="text-uppercase fw-bold">
{{$service->placement ?? ''}}
{{$service->placement}}
</div>
<br>
<div class="text-uppercase">
@ -221,13 +221,13 @@
{{$service->serviceFile->width}}
</td>
<td>
{{$service->serviceFile->height ?? ''}}
{{$service->serviceFile->height}}
</td>
<td>
{{$service->serviceFile->size_unit ?? ''}}
{{$service->serviceFile->size_unit}}
</td>
<td>
{{$service->amount ?? ''}}
{{$service->amount}}
</td>
</tr>