#132: Inches / cm toggle for order page

Also shows size unit on PDFs
This commit is contained in:
Nisse Lommerde 2025-04-11 16:17:51 -04:00
parent f02fb63bfd
commit 2d5688b66e
10 changed files with 55 additions and 11 deletions

View File

@ -1,4 +1,7 @@
# Changelog
**2025-04-11**
- Fixed #132 - Inches / cm toggle for order page (and show unit on pdf)
**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

@ -230,7 +230,7 @@ public static function form(Form $form): Form
->prefix('h')
->rules('numeric'),
])
->label('Dimensions (inches)')
->label('Dimensions')
->columnSpan(4),
TextInput::make('amount')
@ -247,17 +247,28 @@ public static function form(Form $form): Form
->rules('numeric'),
]),
Grid::make(9)
Grid::make(19)
->schema([
TextInput::make('serviceFileCode')
->label('Code')
->datalist(ServiceFile::all()->unique('code')->pluck('code')->toArray())
->columnSpan(1)
->columnSpan(2)
->placeholder('A1234'),
Select::make('serviceFileSizeUnit')
->columnSpan(2)
->selectablePlaceholder(false)
->label('Unit')
->options([
'in' => 'Inches',
'cm' => 'cm',
]),
Textarea::make('notes')
->placeholder('Thread colors...')
->columnSpan(8),
->placeholder('Thread colors... (press enter for new line)')
->autosize()
->rows(1)
->columnSpan(15),
]),
])
->reorderable()

View File

@ -63,6 +63,7 @@ protected function handleRecordCreation(array $data): Order
'width' => $service['serviceFileWidth'] ?? null,
'height' => $service['serviceFileHeight'] ?? null,
'setup_number' => $service['serviceFileSetupNumber'] ?? null,
'size_unit' => $service['serviceFileSizeUnit'] ?? 'inch',
]);
ProductService::create([

View File

@ -68,6 +68,7 @@ protected function mutateFormDataBeforeFill(array $data): array
'serviceFileHeight' => $service->serviceFile->height ?? '',
'serviceFileCode' => $service->serviceFile->code ?? '',
'serviceFileSetupNumber' => $service->serviceFile->setup_number ?? '',
'serviceFileSizeUnit' => $service->serviceFile->size_unit ?? 'inch',
];
}
@ -139,6 +140,7 @@ public function handleRecordUpdate(Model $record, array $data): Model
'width' => $service['serviceFileWidth'] ?? null,
'height' => $service['serviceFileHeight'] ?? null,
'setup_number' => $service['serviceFileSetupNumber'] ?? null,
'size_unit' => $service['serviceFileSizeUnit'] ?? 'inch',
]);
ProductService::create([

View File

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

View File

@ -19,6 +19,7 @@ class ServiceFile extends Model
'width',
'height',
'setup_number',
'size_unit',
];
/**

View File

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

View File

@ -19,7 +19,6 @@ public function definition(): array
'name' => $this->faker->word(),
'width' => round($this->faker->randomFloat(2, 0, 10), 1),
'height' => round($this->faker->randomFloat(2, 0, 10), 1),
'unit' => 'inch',
];
}
}

View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('service_files', function (Blueprint $table) {
$table->string('size_unit')->default('in');
});
}
public function down(): void
{
Schema::table('service_files', function (Blueprint $table) {
$table->dropColumn('size_unit');
});
}
};

View File

@ -155,7 +155,7 @@
<tbody>
@foreach($order->orderProducts as $product)
<tr>
<td><code>{{$product->sku}}</code></td>
<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 style="width: 40px;">{{$product->productSizes()->get()->where('size', 'xs')->first()->amount ?? ''}}</td>
@ -190,6 +190,7 @@
<th class="w-50">Logo Name & Instructions</th>
<th>Width</th>
<th>Height</th>
<th>Unit</th>
<th>QTY</th>
</thead>
@ -203,17 +204,17 @@
<br>
<div class="text-uppercase">
<code style="font-size: 14px">
{{$service->serviceFile->code}}
{{$service->serviceFile->code ?? ''}}
</code>
</div>
</td>
<td>
<div class="text-uppercase">
{{$service->serviceFile->name}}
{{$service->serviceFile->name ?? ''}}
</div>
<br>
<div class="text-uppercase" style="color: #d63384;">
{{$service->notes}}
{{$service->notes ?? ''}}
</div>
</td>
<td>
@ -222,6 +223,9 @@
<td>
{{$service->serviceFile->height}}
</td>
<td>
{{$service->serviceFile->size_unit}}
</td>
<td>
{{$service->amount}}
</td>