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:
@@ -9,7 +9,9 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('order_items', function (Blueprint $table) {
|
||||
$table->boolean('is_sample')->default(false)->after('type');
|
||||
if (!Schema::hasColumn('order_items', 'is_sample')) {
|
||||
$table->boolean('is_sample')->default(false)->after('type');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,9 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->decimal('shipping_fee', 10, 2)->default(0)->nullable()->after('total');
|
||||
if (!Schema::hasColumn('orders', 'shipping_fee')) {
|
||||
$table->decimal('shipping_fee', 10, 2)->default(0)->nullable()->after('total');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@ return new class extends Migration
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->string('invoice_path')->nullable()->after('shipping_fee');
|
||||
if (!Schema::hasColumn('orders', 'invoice_path')) {
|
||||
$table->string('invoice_path')->nullable()->after('shipping_fee');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
// Add individual address fields if they don't exist
|
||||
if (!Schema::hasColumn('orders', 'shipping_street_address')) {
|
||||
$table->string('shipping_street_address')->nullable()->after('shipping_address');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('orders', 'shipping_unit_number')) {
|
||||
$table->string('shipping_unit_number')->nullable()->after('shipping_street_address');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('orders', 'shipping_local_area')) {
|
||||
$table->string('shipping_local_area')->nullable()->after('shipping_unit_number');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('orders', 'shipping_city')) {
|
||||
$table->string('shipping_city')->nullable()->after('shipping_local_area');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('orders', 'shipping_zone')) {
|
||||
$table->string('shipping_zone')->nullable()->after('shipping_city');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('orders', 'shipping_postcode')) {
|
||||
$table->string('shipping_postcode')->nullable()->after('shipping_zone');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('orders', 'shipping_country')) {
|
||||
$table->string('shipping_country')->default('ZA')->after('shipping_postcode');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('orders', 'shipping_type')) {
|
||||
$table->enum('shipping_type', ['residential', 'business'])->default('residential')->after('shipping_country');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->dropColumnIfExists([
|
||||
'shipping_street_address',
|
||||
'shipping_unit_number',
|
||||
'shipping_local_area',
|
||||
'shipping_city',
|
||||
'shipping_zone',
|
||||
'shipping_postcode',
|
||||
'shipping_country',
|
||||
'shipping_type'
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('orders', 'business_name')) {
|
||||
$table->string('business_name')->nullable()->after('shipping_type');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->dropColumnIfExists('business_name');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('orders', 'packing_height')) {
|
||||
$table->decimal('packing_height', 8, 2)->nullable()->comment('Height in cm')->after('packing_length');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('custom_orders', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('custom_orders', 'packing_height')) {
|
||||
$table->decimal('packing_height', 8, 2)->nullable()->comment('Height in cm')->after('packing_length');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->dropColumnIfExists('packing_height');
|
||||
});
|
||||
|
||||
Schema::table('custom_orders', function (Blueprint $table) {
|
||||
$table->dropColumnIfExists('packing_height');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
// Shipment rate and service level information
|
||||
$table->decimal('courier_rate', 10, 2)->nullable()->after('courier_status');
|
||||
$table->string('courier_service_level_code')->nullable()->after('courier_rate');
|
||||
$table->integer('courier_service_level_id')->nullable()->after('courier_service_level_code');
|
||||
|
||||
// Collection and delivery date information
|
||||
$table->datetime('courier_collection_min_date')->nullable()->after('courier_service_level_id');
|
||||
$table->datetime('courier_delivery_min_date')->nullable()->after('courier_collection_min_date');
|
||||
|
||||
// Shipment ID from Shiplogic API
|
||||
$table->string('courier_shipment_id')->nullable()->after('courier_delivery_min_date');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'courier_rate',
|
||||
'courier_service_level_code',
|
||||
'courier_service_level_id',
|
||||
'courier_collection_min_date',
|
||||
'courier_delivery_min_date',
|
||||
'courier_shipment_id',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user