feat: Complete Shiplogic integration with mobile-optimized ops workflow

**Shiplogic API Integration:**
- Fixed API base URL configuration (removed /api suffix)
- Implemented comprehensive request/response logging for rates and shipments endpoints
- Fixed PDF fetching: API returns S3 URLs, now downloads actual PDFs from S3
- Added tests and mock API responses for local development (routes/shiplogic-mock.php)

**Courier Service Enhancements:**
- Added redownloadShipmentPdfs() public method for re-downloading corrupted PDFs
- Enhanced error logging with full request/response bodies for debugging
- Proper binary PDF storage using Laravel Storage facade
- URL and S3 download handling for Shiplogic API responses

**Workflow & Operations:**
- Changed to manual "Ready for Collection" button instead of automatic move
- Operators now: scan QR → apply labels → click "Ready for Collection" → moves to Awaiting Collection
- Removed duplicate PDF attachments to Trello (was adding twice from two listeners)
- Fixed NotifySlackOnShipmentCreated to only handle Slack notifications

**Mobile-Optimized Ops Page:**
- Removed QR code display from order detail page
- Implemented responsive single-column layout for mobile phones
- Large touch-friendly buttons (full width, increased padding)
- Bold typography for better readability on small screens
- Larger input fields and tracking number displays
- Clear step-by-step instructions for warehouse operators
- Re-download PDF button for damaged/corrupted labels

**New Features:**
- POST /ops/orders/{uuid}/ready-for-collection endpoint
- Re-download PDFs functionality accessible from awaiting_collection and in_transit states
- Full audit logging for all operations via ops interface
- Proper error handling and user feedback

**Testing:**
- Added ShipmentCreationTest with mock HTTP client
- Created comprehensive testing guide (SHIPLOGIC_TESTING.md)
- Mock API routes for local development without hitting live API
This commit is contained in:
twotalesanimation
2026-01-03 16:13:20 +02:00
parent b8cc8bd421
commit 2a10f9af38
90 changed files with 11794 additions and 381 deletions
+13 -28
View File
@@ -1,46 +1,31 @@
@extends('layouts.app')
@section('content')
<div class="container mx-auto px-4 py-8">
<!-- Header -->
<div class="w-full min-h-screen bg-gray-50 px-4 py-6 sm:px-6 lg:px-8">
<!-- Mobile-friendly Header -->
<div class="mb-8">
<h1 class="text-3xl font-bold mb-2">Order {{ $order->order_number }}</h1>
<p class="text-gray-600">{{ $order->uuid }}</p>
<h1 class="text-4xl font-bold mb-2 break-words">{{ $order->order_number }}</h1>
<p class="text-gray-600 text-sm break-all">{{ $order->uuid }}</p>
</div>
<!-- Order Summary Card -->
<div class="bg-white rounded-lg shadow-md p-6 mb-8">
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-6 mb-6">
<div>
<p class="text-sm text-gray-600">Status</p>
<p class="text-lg font-semibold capitalize">{{ str_replace('_', ' ', $order->status) }}</p>
<p class="text-sm text-gray-600 font-semibold">Status</p>
<p class="text-xl font-bold capitalize mt-2">{{ str_replace('_', ' ', $order->status) }}</p>
</div>
<div>
<p class="text-sm text-gray-600">Order Type</p>
<p class="text-lg font-semibold">{{ $order->is_custom_order ? 'Custom' : 'Standard' }}</p>
<p class="text-sm text-gray-600 font-semibold">Order Type</p>
<p class="text-xl font-bold mt-2">{{ $order->is_custom_order ? 'Custom' : 'Standard' }}</p>
</div>
<div>
<p class="text-sm text-gray-600">Customer</p>
<p class="text-lg font-semibold">{{ $order->user->name ?? 'N/A' }}</p>
<p class="text-sm text-gray-600 font-semibold">Customer</p>
<p class="text-xl font-bold mt-2">{{ $order->user->name ?? 'N/A' }}</p>
</div>
<div>
<p class="text-sm text-gray-600">Created</p>
<p class="text-lg font-semibold">{{ $order->created_at->format('M d, Y') }}</p>
</div>
</div>
<!-- QR Code -->
<div class="border-t pt-6">
<div class="flex items-start justify-between mb-3">
<div>
<p class="text-sm text-gray-600 mb-3">Scan to access this order:</p>
</div>
<a href="{{ route('ops.order.sticker.download', $order) }}" class="inline-flex items-center px-3 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 text-sm">
📥 Download Sticker (A6 PDF)
</a>
</div>
<div class="inline-block bg-gray-50 p-4 rounded border">
{!! file_get_contents(storage_path("app/public/qr-codes/{$order->uuid}.svg")) !!}
<p class="text-sm text-gray-600 font-semibold">Created</p>
<p class="text-xl font-bold mt-2">{{ $order->created_at->format('M d, Y') }}</p>
</div>
</div>
</div>