20250423 #161

Merged
nisse merged 7 commits from development into main 2025-04-24 00:15:03 +02:00
8 changed files with 45 additions and 12 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
**2025-04-20** **2025-04-23**
- Fixed #128 - Implement a confirm leave dialog on unsaved changes
- Fixed #158 - Add customer PO of first order to invoice filename
- Fixed #159 - Product service line breaks should be preserved on PDFs
- Fixed #131 - Add Service Type background color on PDFs
- Fixed #155 - Invoice internal ID should be 5 digits - Fixed #155 - Invoice internal ID should be 5 digits
- Fixed #154 - Logo name doesn't get replicated - Fixed #154 - Logo name doesn't get replicated
- Fixed #153 - Improved product service form again - Fixed #153 - Improved product service form again

View File

@ -34,4 +34,15 @@ public function getColor(): string
self::MISC => 'misc', self::MISC => 'misc',
}; };
} }
public function getColorHex(): string
{
return match ($this) {
self::EMB => '#9900BB',
self::SCP => '#0088FF',
self::DTG => '#57cded',
self::VINYL => '#22AA22',
self::MISC => '#0000FF',
};
}
} }

View File

@ -347,6 +347,17 @@ public static function table(Table $table): Table
->sortable(), ->sortable(),
TextColumn::make('customer.company_name') TextColumn::make('customer.company_name')
->limit(25)
->tooltip(function (TextColumn $column): ?string {
$state = $column->getState();
if (strlen($state) <= $column->getCharacterLimit()) {
return null;
}
// Only render the tooltip if the column content exceeds the length limit.
return $state;
})
->searchable() ->searchable()
->sortable(), ->sortable(),

View File

@ -77,19 +77,20 @@ public static function table(Table $table): Table
TextColumn::make('date_received') TextColumn::make('date_received')
->sortable() ->sortable()
->searchable(), ->searchable(),
TextColumn::make('order.customer.company_name')
->sortable()
->searchable(),
TextColumn::make('order.customer_po') TextColumn::make('order.customer_po')
->url(fn ($record) => OrderResource::getUrl('edit', ['record' => $record->id])) ->url(fn ($record) => OrderResource::getUrl('edit', ['record' => $record->id]))
->weight('bold') ->weight('bold')
->color('code') ->color('code')
->sortable() ->sortable()
->searchable(), ->searchable(),
TextColumn::make('contents') TextColumn::make('contents')
->extraHeaderAttributes(['class' => 'w-full']), ->extraHeaderAttributes(['class' => 'w-full']),
// TextColumn::make('amount')
// ->label('Quantity'),
TextColumn::make('order.customer.company_name')
->sortable()
->searchable(),
]) ])
->defaultSort('date_received', 'desc') ->defaultSort('date_received', 'desc')
->filters([ ->filters([

View File

@ -11,7 +11,12 @@ class InvoiceController extends Controller
public function pdf(int $id) public function pdf(int $id)
{ {
$invoice = Invoice::find($id); $invoice = Invoice::find($id);
$url = strtolower($invoice->internal_id.'_'.$invoice->customer->company_name.'.pdf');
$firstOrderPo = $invoice->orders()->first()->customer_po ?? '';
$firstOrderPo = preg_replace('/[\\\\\/:*?"<>|]/', '', $firstOrderPo); // Remove invalid characters
$firstOrderPo = str_replace(' ', '-', $firstOrderPo);
$url = strtolower($invoice->internal_id.'-'.$invoice->customer->company_name.'-'.$firstOrderPo.'.pdf');
Pdf::view('pdf.invoice', ['invoice' => $invoice]) Pdf::view('pdf.invoice', ['invoice' => $invoice])
->withBrowsershot(function (Browsershot $browsershot) { ->withBrowsershot(function (Browsershot $browsershot) {

View File

@ -68,6 +68,7 @@ public function panel(Panel $panel): Panel
NavigationGroup::make('Reports'), NavigationGroup::make('Reports'),
NavigationGroup::make('Settings'), NavigationGroup::make('Settings'),
]) ])
->plugin(ResourceLockPlugin::make()); ->plugin(ResourceLockPlugin::make())
->unsavedChangesAlerts();
} }
} }

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{ {
"name": "order_system", "name": "topnotch_website",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@ -13,8 +13,8 @@
</div> </div>
<div class="col-4 text-center"> <div class="col-4 text-center">
<div class="bg-info text-white flex-nowrap"> <div class="text-white flex-nowrap" style="background-color: {{$order->order_type->getColorHex()}}">
<div class="fs-5 fw-bold">{{$order->order_type->getLabel()}}</div> <div class="fs-5 fw-bold">{{$order->order_type->name}}</div>
</div> </div>
</div> </div>
@ -214,7 +214,7 @@
</div> </div>
<br> <br>
<div class="text-uppercase" style="color: #d63384;"> <div class="text-uppercase" style="color: #d63384;">
{{$service->notes ?? ''}} {!! nl2br(e($service->notes)) !!}
</div> </div>
</td> </td>
<td> <td>