2a10f9af38
**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
126 lines
7.1 KiB
PHP
126 lines
7.1 KiB
PHP
<!-- Read-Only State -->
|
|
<div class="bg-blue-50 border-2 border-blue-200 rounded-lg p-6 mb-8">
|
|
<div class="flex items-start">
|
|
<div class="flex-1">
|
|
<h2 class="text-2xl font-bold text-blue-900 mb-2">📋 Order Status: Read-Only</h2>
|
|
<p class="text-blue-800 mb-4">
|
|
This order is in the <strong><?php echo e(str_replace('_', ' ', ucfirst($order->status))); ?></strong> phase.
|
|
No actions are available at this stage.
|
|
</p>
|
|
|
|
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($order->status === 'ready_to_ship'): ?>
|
|
<div class="bg-white border-l-4 border-blue-500 p-4 rounded">
|
|
<p class="text-gray-700">
|
|
<strong>Next Step:</strong> Move Trello card to "Ready to Ship" to trigger automatic shipment creation.
|
|
</p>
|
|
</div>
|
|
<?php elseif($order->status === 'awaiting_collection'): ?>
|
|
<div class="bg-white border-l-4 border-blue-500 p-4 rounded">
|
|
<p class="text-gray-700">
|
|
<strong>Status:</strong> Parcel is awaiting collection from courier.
|
|
</p>
|
|
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($order->courier_waybill_id): ?>
|
|
<p class="text-gray-700 mt-2">
|
|
<strong>Waybill:</strong> <code class="bg-gray-100 px-2 py-1 rounded"><?php echo e($order->courier_waybill_id); ?></code>
|
|
</p>
|
|
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
|
|
|
<!-- Re-download PDFs Button -->
|
|
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($order->courier_shipment_id): ?>
|
|
<div class="mt-4">
|
|
<button
|
|
type="button"
|
|
onclick="redownloadPdfs('<?php echo e($order->uuid); ?>')"
|
|
class="bg-orange-500 hover:bg-orange-600 text-white font-bold py-2 px-4 rounded transition duration-200"
|
|
>
|
|
🔄 Re-download Shipment PDFs
|
|
</button>
|
|
<p class="text-gray-600 text-sm mt-2">If the shipment PDFs are corrupted, click this button to re-download them.</p>
|
|
</div>
|
|
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
|
</div>
|
|
<?php elseif($order->status === 'in_transit'): ?>
|
|
<div class="bg-white border-l-4 border-green-500 p-4 rounded">
|
|
<p class="text-gray-700">
|
|
<strong>Status:</strong> Parcel is in transit to the customer.
|
|
</p>
|
|
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($order->courier_tracking_number): ?>
|
|
<p class="text-gray-700 mt-2">
|
|
<strong>Tracking:</strong> <code class="bg-gray-100 px-2 py-1 rounded"><?php echo e($order->courier_tracking_number); ?></code>
|
|
</p>
|
|
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
|
|
|
<!-- Re-download PDFs Button -->
|
|
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($order->courier_shipment_id): ?>
|
|
<div class="mt-4">
|
|
<button
|
|
type="button"
|
|
onclick="redownloadPdfs('<?php echo e($order->uuid); ?>')"
|
|
class="bg-orange-500 hover:bg-orange-600 text-white font-bold py-2 px-4 rounded transition duration-200"
|
|
>
|
|
🔄 Re-download Shipment PDFs
|
|
</button>
|
|
<p class="text-gray-600 text-sm mt-2">If the shipment PDFs are corrupted, click this button to re-download them.</p>
|
|
</div>
|
|
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="bg-white border-l-4 border-gray-500 p-4 rounded">
|
|
<p class="text-gray-700">
|
|
The order is progressing through the fulfillment pipeline.
|
|
</p>
|
|
</div>
|
|
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
async function redownloadPdfs(orderUuid) {
|
|
if (!confirm('Re-download shipment PDFs from Shiplogic API?')) {
|
|
return;
|
|
}
|
|
|
|
const button = document.querySelector('[onclick*="redownloadPdfs"]');
|
|
button.disabled = true;
|
|
button.classList.add('opacity-50');
|
|
const originalText = button.innerText;
|
|
button.innerText = '⏳ Downloading...';
|
|
|
|
try {
|
|
// Get CSRF token from the page
|
|
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute('content') ||
|
|
document.querySelector('input[name="_token"]')?.value;
|
|
|
|
if (!csrfToken) {
|
|
throw new Error('CSRF token not found on page');
|
|
}
|
|
|
|
const response = await fetch(`/ops/orders/${orderUuid}/redownload-pdfs`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'X-CSRF-Token': csrfToken,
|
|
'Accept': 'application/json',
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({}),
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (data.success) {
|
|
alert('✓ PDFs re-downloaded successfully!\n\nSticker: ' + data.sticker_path + '\nLabel: ' + data.waybill_path);
|
|
location.reload();
|
|
} else {
|
|
alert('✗ Failed to re-download PDFs:\n' + data.message);
|
|
}
|
|
} catch (error) {
|
|
alert('✗ Error: ' + error.message);
|
|
} finally {
|
|
button.disabled = false;
|
|
button.classList.remove('opacity-50');
|
|
button.innerText = originalText;
|
|
}
|
|
}
|
|
</script>
|
|
<?php /**PATH /var/www/additional_design/resources/views/ops/actions/read-only.blade.php ENDPATH**/ ?>
|