Add receipt logo upload and redesign thermal receipt header.
Deploy Ladill POS / deploy (push) Successful in 1m32s
Deploy Ladill POS / deploy (push) Successful in 1m32s
Per-location logo in settings with remove/replace support; receipt template reserves space at the top when a logo is set. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Services\Import\MerchantCatalogImportService;
|
||||
use App\Services\Pos\PosLocationService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\View\View;
|
||||
use RuntimeException;
|
||||
|
||||
@@ -43,6 +44,8 @@ class SettingsController extends Controller
|
||||
'service_style' => ['required', 'in:retail,restaurant'],
|
||||
'receipt_footer' => ['nullable', 'string', 'max:1000'],
|
||||
'receipt_header' => ['nullable', 'string', 'max:500'],
|
||||
'receipt_logo' => ['nullable', 'image', 'mimes:jpeg,jpg,png,gif,webp', 'max:2048'],
|
||||
'remove_receipt_logo' => ['sometimes', 'boolean'],
|
||||
'printer_paper_mm' => ['required', 'in:58,80'],
|
||||
'printer_auto_print' => ['sometimes', 'boolean'],
|
||||
]);
|
||||
@@ -54,6 +57,22 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
$location = $this->locations->ensureDefault($this->ownerRef($request));
|
||||
|
||||
if ($request->boolean('remove_receipt_logo') && $location->receipt_logo_path) {
|
||||
Storage::disk('public')->delete($location->receipt_logo_path);
|
||||
$location->receipt_logo_path = null;
|
||||
}
|
||||
|
||||
if ($request->hasFile('receipt_logo')) {
|
||||
if ($location->receipt_logo_path) {
|
||||
Storage::disk('public')->delete($location->receipt_logo_path);
|
||||
}
|
||||
$location->receipt_logo_path = $request->file('receipt_logo')->store(
|
||||
'pos/receipt-logos/'.$this->ownerRef($request),
|
||||
'public'
|
||||
);
|
||||
}
|
||||
|
||||
$location->update([
|
||||
'name' => $data['name'],
|
||||
'currency' => strtoupper($data['currency']),
|
||||
@@ -62,6 +81,7 @@ class SettingsController extends Controller
|
||||
'receipt_header' => $data['receipt_header'] ?? null,
|
||||
'printer_paper_mm' => (int) $data['printer_paper_mm'],
|
||||
'printer_auto_print' => $request->boolean('printer_auto_print'),
|
||||
'receipt_logo_path' => $location->receipt_logo_path,
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Settings saved.');
|
||||
|
||||
Reference in New Issue
Block a user