feat: Add A6 PDF QR stickers with human-readable order info
Implement QrStickerService to generate both SVG (web) and PDF (print) stickers:
- Generate 32x32mm QR codes using SimpleSoftwareIO
- Create A6 (148mm 105mm) PDF stickers using DomPDF
- Include human-readable info: order number, customer, status, date, tracking
- Store order type (STOCK/CUSTOM) with visual badge
- Add generation timestamp to footer
Create stickers/qr-sticker.blade.php template:
- Two-column layout: info left, QR right
- Styled for A6 landscape printing
- Shows order number, customer, status, date, tracking info
- QR code positioned for easy scanning
- Print-optimized CSS
Update GenerateQrCodeOnOrderCreated listener:
- Now calls QrStickerService::generateSticker()
- Generates both SVG and PDF on OrderCreated event
- Logs paths to both formats
Add OpsController::downloadSticker() endpoint:
- GET /ops/orders/{id}/sticker/download
- Returns PDF with filename QR-{order_number}.pdf
- Requires ops access authorization
- Logs all downloads with user context
Update ops order-detail view:
- Add download button for A6 sticker PDF
- Position next to QR code display
- Link to new sticker download route
This commit is contained in:
@@ -200,4 +200,39 @@ class OpsController extends Controller
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download QR sticker PDF for printing
|
||||
*
|
||||
* GET /ops/orders/{id}/sticker/download
|
||||
*/
|
||||
public function downloadSticker(Order $order)
|
||||
{
|
||||
// Authorize
|
||||
if (! auth()->user()->can('access-ops')) {
|
||||
abort(403, 'Unauthorized to access ops interface');
|
||||
}
|
||||
|
||||
$stickerPath = "qr-stickers/{$order->uuid}.pdf";
|
||||
|
||||
if (! \Illuminate\Support\Facades\Storage::disk('public')->exists($stickerPath)) {
|
||||
Log::warning('QR sticker PDF not found', [
|
||||
'order_uuid' => $order->uuid,
|
||||
'path' => $stickerPath,
|
||||
]);
|
||||
|
||||
abort(404, 'QR sticker not found');
|
||||
}
|
||||
|
||||
Log::info('QR sticker downloaded', [
|
||||
'order_uuid' => $order->uuid,
|
||||
'user_id' => auth()->id(),
|
||||
'user_name' => auth()->user()->name,
|
||||
]);
|
||||
|
||||
return \Illuminate\Support\Facades\Storage::disk('public')->download(
|
||||
$stickerPath,
|
||||
"QR-{$order->order_number}.pdf"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user