Compare commits

..

No commits in common. "03869664a4eb70e0fd24a133d3e34d40e63c2467" and "d2d52b8f1b59765090b855dcf64b0676459747fa" have entirely different histories.

5 changed files with 40 additions and 46 deletions

View File

@ -1,9 +1,4 @@
# Changelog # Changelog
**2025-04-20**
- Fixed #155 - Invoice internal ID should be 5 digits
- Fixed #154 - Logo name doesn't get replicated
- Fixed #153 - Improved product service form again
**2025-04-13** **2025-04-13**
- Fixed #132 - Inches / cm toggle for order page (and show unit on pdf) - 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 #148 - Change amount label to unit price on order form (also textarea)

View File

@ -219,11 +219,11 @@ public static function form(Form $form): Form
->label('Product Services') ->label('Product Services')
->addActionLabel('Add new product service') ->addActionLabel('Add new product service')
->schema([ ->schema([
Grid::make(9) Grid::make(19)
->schema([ ->schema([
Select::make('serviceType') Select::make('serviceType')
->columnSpan(2)
->options(ServiceType::all()->pluck('value', 'id')) ->options(ServiceType::all()->pluck('value', 'id'))
->columnSpan(4)
->placeholder('Select...') ->placeholder('Select...')
->searchable() ->searchable()
->createOptionForm([ ->createOptionForm([
@ -239,15 +239,17 @@ public static function form(Form $form): Form
->createOptionUsing(function (array $data): int { ->createOptionUsing(function (array $data): int {
return ServiceType::create($data)->getKey(); return ServiceType::create($data)->getKey();
}), }),
TextInput::make('serviceFileName') TextInput::make('serviceFileName')
->columnSpan(2)
->datalist(ServiceFile::all()->unique('name')->pluck('name')->toArray()) ->datalist(ServiceFile::all()->unique('name')->pluck('name')->toArray())
->columnSpan(3)
->label('Logo Name'), ->label('Logo Name'),
TextInput::make('placement') TextInput::make('placement')
->columnSpan(2) ->datalist(ProductService::all()->unique('placement')->pluck('placement')->toArray())
->datalist(ProductService::all()->unique('placement')->pluck('placement')->toArray()), ->columnSpan(3),
TextInput::make('serviceFileSetupNumber')
->label('Setup')
->columnSpan(1)
->rules('numeric'),
Cluster::make([ Cluster::make([
TextInput::make('serviceFileWidth') TextInput::make('serviceFileWidth')
@ -258,47 +260,43 @@ public static function form(Form $form): Form
->rules('numeric'), ->rules('numeric'),
]) ])
->label('Dimensions') ->label('Dimensions')
->columnSpan(2), ->columnSpan(4),
TextInput::make('amount')
->label('Quantity')
->prefix('#')
->columnSpan(2)
->rules('numeric'),
TextInput::make('amount_price')
->label('Unit price')
->prefix('$')
->columnSpan(2)
->rules('numeric'),
]),
Grid::make(19)
->schema([
TextInput::make('serviceFileCode')
->label('Code')
->datalist(ServiceFile::all()->unique('code')->pluck('code')->toArray())
->columnSpan(2)
->placeholder('A1234'),
Select::make('serviceFileSizeUnit') Select::make('serviceFileSizeUnit')
->columnSpan(1) ->columnSpan(2)
->selectablePlaceholder(false) ->selectablePlaceholder(false)
->label('Unit') ->label('Unit')
->options([ ->options([
'in' => 'Inches', 'in' => 'Inches',
'cm' => 'cm', 'cm' => 'cm',
]), ]),
]),
Grid::make(9)
->schema([
TextInput::make('serviceFileCode')
->columnSpan(1)
->label('Code')
->datalist(ServiceFile::all()->unique('code')->pluck('code')->toArray()),
TextInput::make('serviceFileSetupNumber')
->columnSpan(1)
->label('Setup Number')
->rules('numeric'),
TextInput::make('amount')
->columnSpan(1)
->label('Quantity')
->prefix('#')
->rules('numeric'),
TextInput::make('amount_price')
->columnSpan(1)
->label('Unit price')
->prefix('$')
->rules('numeric'),
Textarea::make('notes') Textarea::make('notes')
->columnSpan(5) ->placeholder('Thread colors... (press enter for new line)')
->placeholder('Thread colors (press enter for new line)')
->autosize() ->autosize()
->rows(1), ->rows(1)
->columnSpan(15),
]), ]),
]) ])
->reorderable() ->reorderable()

View File

@ -200,7 +200,6 @@ protected function getHeaderActions(): array
foreach ($this->record->productServices as $service) { foreach ($this->record->productServices as $service) {
/** @var ServiceFile $newServiceFile */ /** @var ServiceFile $newServiceFile */
$newServiceFile = $service->serviceFile->replicate(); $newServiceFile = $service->serviceFile->replicate();
$newServiceFile->save();
$newService = $service->replicate(); $newService = $service->replicate();
$newService->order_id = $replica->id; $newService->order_id = $replica->id;

View File

@ -22,7 +22,9 @@ public function creating(Invoice $invoice): void
*/ */
public function created(Invoice $invoice): void public function created(Invoice $invoice): void
{ {
$invoice->internal_id = 'TN'.$invoice->id + 40000;
// $invoice->internal_id = 'TN4'.str_pad($invoice->id, 4, '0', STR_PAD_LEFT);
$invoice->internal_id = 'TN'.$invoice->id + 4000;
$invoice->saveQuietly(); $invoice->saveQuietly();
$invoice->calculateTotals(); $invoice->calculateTotals();

View File

@ -54,7 +54,7 @@
->assertHasNoErrors(); ->assertHasNoErrors();
$this->assertDatabaseHas('invoices', [ $this->assertDatabaseHas('invoices', [
'internal_id' => 'TN40001', 'internal_id' => 'TN4001',
'customer_id' => $formData['customer_id'], 'customer_id' => $formData['customer_id'],
'status' => $formData['status'], 'status' => $formData['status'],
'has_gst' => $formData['has_gst'], 'has_gst' => $formData['has_gst'],
@ -65,7 +65,7 @@
'hst_rate' => $hst_rate, 'hst_rate' => $hst_rate,
]); ]);
$invoice = Invoice::where('internal_id', 'TN40001')->firstOrFail(); $invoice = Invoice::where('internal_id', 'TN4001')->firstOrFail();
$this->assertEquals($invoice->orders->isEmpty(), true); $this->assertEquals($invoice->orders->isEmpty(), true);
}); });