feat(19-ui-integration): przycisk Drukuj, bulk print, kolejka wydruku
- Przycisk "Drukuj" w prepare.php i show.php z AJAX + duplikat protection - Bulk print z listy zamówień (checkboxy + header action) - Kolejka wydruku w Ustawienia > Drukowanie (filtr statusu, retry) - POST /api/print/jobs/bulk endpoint (package_ids + order_ids) - ensureLabel() auto-download przez ShipmentProviderRegistry - Apaczka carrier_id = nazwa usługi, kolumna Przewoznik - Tab persistence (localStorage), label file_exists check - Fix use statement ApaczkaApiClient, redirect po utworzeniu przesyłki - Phase 17 (receipt duplicate guard) + Phase 18 (print queue backend) docs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -58,6 +58,11 @@ use App\Modules\Shipments\InpostShipmentService;
|
||||
use App\Modules\Shipments\ShipmentController;
|
||||
use App\Modules\Shipments\ShipmentPackageRepository;
|
||||
use App\Modules\Shipments\ShipmentProviderRegistry;
|
||||
use App\Modules\Printing\ApiKeyMiddleware;
|
||||
use App\Modules\Printing\PrintApiController;
|
||||
use App\Modules\Printing\PrintApiKeyRepository;
|
||||
use App\Modules\Printing\PrintJobRepository;
|
||||
use App\Modules\Settings\PrintSettingsController;
|
||||
use App\Modules\Users\UsersController;
|
||||
|
||||
return static function (Application $app): void {
|
||||
@@ -235,7 +240,8 @@ return static function (Application $app): void {
|
||||
new OrdersRepository($app->db()),
|
||||
$companySettingsRepository
|
||||
);
|
||||
$ordersController = new OrdersController($template, $translator, $auth, $app->orders(), $shipmentPackageRepositoryForOrders, $receiptRepository, $receiptConfigRepository, $emailSendingService, $emailTemplateRepository, $emailMailboxRepository);
|
||||
$printJobRepository = new PrintJobRepository($app->db());
|
||||
$ordersController = new OrdersController($template, $translator, $auth, $app->orders(), $shipmentPackageRepositoryForOrders, $receiptRepository, $receiptConfigRepository, $emailSendingService, $emailTemplateRepository, $emailMailboxRepository, $app->basePath('storage'), $printJobRepository);
|
||||
$receiptController = new ReceiptController(
|
||||
$template,
|
||||
$translator,
|
||||
@@ -289,7 +295,8 @@ return static function (Application $app): void {
|
||||
$shipmentProviderRegistry,
|
||||
$shipmentPackageRepository,
|
||||
$app->basePath('storage'),
|
||||
$carrierDeliveryMappings
|
||||
$carrierDeliveryMappings,
|
||||
$printJobRepository
|
||||
);
|
||||
$authMiddleware = new AuthMiddleware($auth);
|
||||
|
||||
@@ -391,4 +398,30 @@ return static function (Application $app): void {
|
||||
$router->post('/orders/{id}/shipment/create', [$shipmentController, 'create'], [$authMiddleware]);
|
||||
$router->get('/orders/{id}/shipment/{packageId}/status', [$shipmentController, 'checkStatus'], [$authMiddleware]);
|
||||
$router->post('/orders/{id}/shipment/{packageId}/label', [$shipmentController, 'label'], [$authMiddleware]);
|
||||
|
||||
// --- Printing module ---
|
||||
$printApiKeyRepository = new PrintApiKeyRepository($app->db());
|
||||
$apiKeyMiddleware = new ApiKeyMiddleware($printApiKeyRepository);
|
||||
$printApiController = new PrintApiController(
|
||||
$printJobRepository,
|
||||
$shipmentPackageRepository,
|
||||
$auth,
|
||||
$app->basePath('storage'),
|
||||
$shipmentProviderRegistry
|
||||
);
|
||||
$printSettingsController = new PrintSettingsController($template, $translator, $auth, $printApiKeyRepository, $printJobRepository);
|
||||
|
||||
// Print API — session auth (from orderPRO UI)
|
||||
$router->post('/api/print/jobs', [$printApiController, 'createJob'], [$authMiddleware]);
|
||||
$router->post('/api/print/jobs/bulk', [$printApiController, 'bulkCreateJobs'], [$authMiddleware]);
|
||||
|
||||
// Print API — API key auth (from Windows client)
|
||||
$router->get('/api/print/jobs/pending', [$printApiController, 'listPending'], [$apiKeyMiddleware]);
|
||||
$router->get('/api/print/jobs/{id}/download', [$printApiController, 'downloadLabel'], [$apiKeyMiddleware]);
|
||||
$router->post('/api/print/jobs/{id}/complete', [$printApiController, 'markComplete'], [$apiKeyMiddleware]);
|
||||
|
||||
// Print settings
|
||||
$router->get('/settings/printing', [$printSettingsController, 'index'], [$authMiddleware]);
|
||||
$router->post('/settings/printing/keys/create', [$printSettingsController, 'createKey'], [$authMiddleware]);
|
||||
$router->post('/settings/printing/keys/{id}/delete', [$printSettingsController, 'deleteKey'], [$authMiddleware]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user