From adc5ae960d340471463551093214c1afa170dc2c Mon Sep 17 00:00:00 2001 From: dandiAW Date: Wed, 19 Feb 2025 17:12:28 +0800 Subject: [PATCH 1/4] modal approve and direct customer --- .../Fulfilment/TableFulfilmentCustomers.vue | 34 ++++++-- .../Utils/ModalApproveConfirmation.vue | 81 +++++++++++++++++++ 2 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 resources/js/Components/Utils/ModalApproveConfirmation.vue diff --git a/resources/js/Components/Tables/Grp/Org/Fulfilment/TableFulfilmentCustomers.vue b/resources/js/Components/Tables/Grp/Org/Fulfilment/TableFulfilmentCustomers.vue index a6d32d3039..109b27a253 100644 --- a/resources/js/Components/Tables/Grp/Org/Fulfilment/TableFulfilmentCustomers.vue +++ b/resources/js/Components/Tables/Grp/Org/Fulfilment/TableFulfilmentCustomers.vue @@ -5,7 +5,7 @@ --> diff --git a/resources/js/Components/Utils/ModalApproveConfirmation.vue b/resources/js/Components/Utils/ModalApproveConfirmation.vue new file mode 100644 index 0000000000..ff4fff8ad9 --- /dev/null +++ b/resources/js/Components/Utils/ModalApproveConfirmation.vue @@ -0,0 +1,81 @@ + + + From ab27a824adcbfb2e6ca04bad9000e317e00e7c20 Mon Sep 17 00:00:00 2001 From: Raul Perusquia Date: Wed, 19 Feb 2025 17:20:55 +0800 Subject: [PATCH 2/4] maya api route for return stored items --- .../UI/IndexPalletStoredItemsInReturn.php | 155 ++++++++++++++++++ .../UI/IndexStoredItemsInReturn.php | 35 ---- ...alletStoredItemsInPalletReturnResource.php | 64 ++++++++ routes/maya/org/warehouses/dispatching.php | 4 +- 4 files changed, 221 insertions(+), 37 deletions(-) create mode 100644 app/Actions/Fulfilment/PalletReturnItem/UI/IndexPalletStoredItemsInReturn.php create mode 100644 app/Http/Resources/Fulfilment/PalletStoredItemsInPalletReturnResource.php diff --git a/app/Actions/Fulfilment/PalletReturnItem/UI/IndexPalletStoredItemsInReturn.php b/app/Actions/Fulfilment/PalletReturnItem/UI/IndexPalletStoredItemsInReturn.php new file mode 100644 index 0000000000..e4afce472a --- /dev/null +++ b/app/Actions/Fulfilment/PalletReturnItem/UI/IndexPalletStoredItemsInReturn.php @@ -0,0 +1,155 @@ + + * Created: Wed, 19 Feb 2025 17:18:03 Central Indonesia Time, Sanur, Bali, Indonesia + * Copyright (c) 2025, Raul A Perusquia Flores + */ + +namespace App\Actions\Fulfilment\PalletReturnItem\UI; + +use App\Actions\OrgAction; +use App\Actions\Traits\Authorisations\WithFulfilmentAuthorisation; +use App\Enums\Fulfilment\PalletReturn\PalletReturnStateEnum; +use App\Http\Resources\Fulfilment\PalletStoredItemsInPalletReturnResource; +use App\Models\Fulfilment\Fulfilment; +use App\Models\Fulfilment\FulfilmentCustomer; +use App\Models\Fulfilment\PalletReturn; +use App\Models\Fulfilment\PalletReturnItem; +use Closure; +use Illuminate\Contracts\Pagination\LengthAwarePaginator; +use App\InertiaTable\InertiaTable; +use App\Models\Inventory\Warehouse; +use App\Models\SysAdmin\Organisation; +use Lorisleiva\Actions\ActionRequest; +use Spatie\QueryBuilder\AllowedFilter; +use App\Services\QueryBuilder; +use Illuminate\Http\Resources\Json\AnonymousResourceCollection; + +class IndexPalletStoredItemsInReturn extends OrgAction +{ + use WithFulfilmentAuthorisation; + private Fulfilment|Warehouse $parent; + + public function handle(PalletReturn $palletReturn, $prefix = null): LengthAwarePaginator + { + $globalSearch = AllowedFilter::callback('global', function ($query, $value) { + $query->where(function ($query) use ($value) { + $query->whereAnyWordStartWith('stored_items.reference', $value); + }); + }); + + if ($prefix) { + InertiaTable::updateQueryBuilderParameters($prefix); + } + + $queryBuilder = QueryBuilder::for(PalletReturnItem::class) + ->leftJoin('pallet_stored_items', function ($join) { + $join->on('pallet_return_items.pallet_stored_item_id', '=', 'pallet_stored_items.id'); + }) + ->leftJoin('pallets', function ($join) { + $join->on('pallets.id', '=', 'pallet_return_items.pallet_id'); + }) + ->leftJoin('locations', function ($join) { + $join->on('locations.id', '=', 'pallet_return_items.picking_location_id'); + }) + ->leftJoin('stored_items', function ($join) { + $join->on('stored_items.id', '=', 'pallet_return_items.stored_item_id'); + }) + ->where('pallet_return_items.pallet_return_id', $palletReturn->id); + + + $queryBuilder + ->defaultSort('pallet_return_items.quantity_ordered') + ->select( + [ + 'pallet_return_items.id as id', + 'pallet_return_items.quantity_ordered', + 'pallet_return_items.quantity_dispatched', + 'pallet_return_items.quantity_fail', + 'pallet_return_items.quantity_cancelled', + 'pallet_return_items.state', + + 'locations.code as location_code', + 'locations.id as location_id', + 'locations.slug as location_slug', + + 'stored_items.reference as stored_items_reference', + 'stored_items.id as stored_items_id', + 'stored_items.slug as stored_items_slug', + 'stored_items.name as stored_items_name', + + + 'pallets.reference as pallets_reference', + 'pallets.customer_reference as pallets_customer_reference', + 'pallets.id as pallets_id', + 'pallets.slug as pallets_slug', + + ] + ); + + return $queryBuilder->allowedSorts(['pallet_return_items.quantity_ordered']) + ->allowedFilters([$globalSearch]) + ->withPaginator($prefix, tableName: request()->route()->getName()) + ->withQueryString(); + } + + public function tableStructure(PalletReturn $palletReturn, $request, $prefix = null, $modelOperations = []): Closure + { + return function (InertiaTable $table) use ($prefix, $modelOperations, $request, $palletReturn) { + if ($prefix) { + $table + ->name($prefix) + ->pageName($prefix.'Page'); + } + + $emptyStateData = [ + + ]; + + + if ($palletReturn instanceof Fulfilment) { + $emptyStateData['description'] = __("There is no stored items this fulfilment shop"); + } + if ($palletReturn instanceof FulfilmentCustomer) { + $emptyStateData['description'] = __("This customer don't have any pallets"); + } + + $table->withGlobalSearch(); + + + $table->withEmptyState($emptyStateData) + ->withModelOperations($modelOperations); + + + $table->column(key: 'state', label: ['fal', 'fa-yin-yang'], type: 'icon'); + + $table->column(key: 'reference', label: __('reference'), canBeHidden: false, sortable: true, searchable: true); + $table->column(key: 'total_quantity', label: __('Current stock'), canBeHidden: false, sortable: true, searchable: true); + $table->column(key: 'pallet_stored_items', label: __('Pallets [location]'), canBeHidden: false, sortable: true, searchable: true); + + $table->column(key: 'total_quantity_ordered', label: __('requested quantity'), canBeHidden: false, sortable: true, searchable: true); + if ($palletReturn->state === PalletReturnStateEnum::PICKING) { + $table->column(key: 'actions', label: __('action'), canBeHidden: false, sortable: true, searchable: true); + } + + + $table->defaultSort('pallet_return_items.quantity_ordered'); + }; + } + + + public function asController(Organisation $organisation, Warehouse $warehouse, PalletReturn $palletReturn, ActionRequest $request): LengthAwarePaginator + { + $this->parent = $warehouse; + $this->initialisationFromWarehouse($warehouse, $request); + + return $this->handle($palletReturn); + } + + public function jsonResponse(LengthAwarePaginator $storedItems): AnonymousResourceCollection + { + return PalletStoredItemsInPalletReturnResource::collection($storedItems); + } + +} diff --git a/app/Actions/Fulfilment/StoredItem/UI/IndexStoredItemsInReturn.php b/app/Actions/Fulfilment/StoredItem/UI/IndexStoredItemsInReturn.php index 5ff71c90cf..542f4cca70 100644 --- a/app/Actions/Fulfilment/StoredItem/UI/IndexStoredItemsInReturn.php +++ b/app/Actions/Fulfilment/StoredItem/UI/IndexStoredItemsInReturn.php @@ -9,33 +9,17 @@ namespace App\Actions\Fulfilment\StoredItem\UI; use App\Actions\OrgAction; -use App\Actions\Traits\Authorisations\WithFulfilmentAuthorisation; use App\Enums\Fulfilment\PalletReturn\PalletReturnStateEnum; -use App\Http\Resources\Fulfilment\PalletReturnStoredItemsResource; -use App\Models\Fulfilment\Fulfilment; -use App\Models\Fulfilment\FulfilmentCustomer; use App\Models\Fulfilment\PalletReturn; use App\Models\Fulfilment\StoredItem; use Closure; use Illuminate\Contracts\Pagination\LengthAwarePaginator; use App\InertiaTable\InertiaTable; -use App\Models\Inventory\Warehouse; -use App\Models\SysAdmin\Organisation; -use Lorisleiva\Actions\ActionRequest; use Spatie\QueryBuilder\AllowedFilter; use App\Services\QueryBuilder; -use Illuminate\Http\Resources\Json\AnonymousResourceCollection; class IndexStoredItemsInReturn extends OrgAction { - use WithFulfilmentAuthorisation; - - - private PalletReturn $palletReturn; - - private bool $selectStoredPallets = false; - - public function handle(PalletReturn $parent, $prefix = null): LengthAwarePaginator { $globalSearch = AllowedFilter::callback('global', function ($query, $value) { @@ -117,12 +101,6 @@ public function tableStructure(PalletReturn $palletReturn, $request, $prefix = n ]; - if ($palletReturn instanceof Fulfilment) { - $emptyStateData['description'] = __("There is no stored items this fulfilment shop"); - } - if ($palletReturn instanceof FulfilmentCustomer) { - $emptyStateData['description'] = __("This customer don't have any pallets"); - } $table->withGlobalSearch(); @@ -142,23 +120,10 @@ public function tableStructure(PalletReturn $palletReturn, $request, $prefix = n $table->column(key: 'actions', label: __('action'), canBeHidden: false, sortable: true, searchable: true); } - $table->defaultSort('reference'); }; } - public function asController(Organisation $organisation, Warehouse $warehouse, PalletReturn $palletReturn, ActionRequest $request): LengthAwarePaginator - { - $this->initialisationFromWarehouse($warehouse, $request); - - return $this->handle($palletReturn); - } - - public function jsonResponse(LengthAwarePaginator $storedItems): AnonymousResourceCollection - { - return PalletReturnStoredItemsResource::collection($storedItems); - } - } diff --git a/app/Http/Resources/Fulfilment/PalletStoredItemsInPalletReturnResource.php b/app/Http/Resources/Fulfilment/PalletStoredItemsInPalletReturnResource.php new file mode 100644 index 0000000000..85cb61a274 --- /dev/null +++ b/app/Http/Resources/Fulfilment/PalletStoredItemsInPalletReturnResource.php @@ -0,0 +1,64 @@ + + * Created: Wed, 19 Feb 2025 17:18:03 Central Indonesia Time, Sanur, Bali, Indonesia + * Copyright (c) 2025, Raul A Perusquia Flores + */ + +namespace App\Http\Resources\Fulfilment; + +use Illuminate\Http\Resources\Json\JsonResource; + +/** + * @property mixed $id + * *@property mixed $quantity_ordered + * @property mixed $quantity_dispatched + * @property mixed $quantity_fail + * @property mixed $quantity_cancelled + * @property mixed $state + * @property mixed $location_code + * @property mixed $location_id + * @property mixed $location_slug + * @property mixed $stored_items_reference + * @property mixed $stored_items_id + * @property mixed $stored_items_slug + * @property mixed $stored_items_name + * @property mixed $pallets_reference + * @property mixed $pallets_customer_reference + * @property mixed $pallets_id + * @property mixed $pallets_slug + */ +class PalletStoredItemsInPalletReturnResource extends JsonResource +{ + public function toArray($request): array + { + return [ + 'id' => $this->id, + 'quantity_ordered' => $this->quantity_ordered, + 'quantity_dispatched' => $this->quantity_dispatched, + 'quantity_fail' => $this->quantity_fail, + 'quantity_cancelled' => $this->quantity_cancelled, + + + 'state' => $this->state, + 'state_icon' => $this->state->stateIcon()[$this->state->value], + 'location_code' => $this->location_code, + 'location_id' => $this->location_id, + 'location_slug' => $this->location_slug, + + + 'stored_items_reference' => $this->stored_items_reference, + 'stored_items_id' => $this->stored_items_id, + 'stored_items_slug' => $this->stored_items_slug, + 'stored_items_name' => $this->stored_items_name, + + 'pallets_reference' => $this->pallets_reference, + 'pallets_customer_reference' => $this->pallets_customer_reference, + 'pallets_id' => $this->pallets_id, + 'pallets_slug' => $this->pallets_slug, + + + ]; + } +} diff --git a/routes/maya/org/warehouses/dispatching.php b/routes/maya/org/warehouses/dispatching.php index 001c581446..a15b15baf2 100644 --- a/routes/maya/org/warehouses/dispatching.php +++ b/routes/maya/org/warehouses/dispatching.php @@ -13,7 +13,7 @@ use App\Actions\Fulfilment\PalletReturn\UI\IndexPalletReturns; use App\Actions\Fulfilment\PalletReturn\UI\ShowPalletReturn; use App\Actions\Fulfilment\PalletReturn\UI\ShowStoredItemReturn; -use App\Actions\Fulfilment\StoredItem\UI\IndexStoredItemsInReturn; +use App\Actions\Fulfilment\PalletReturnItem\UI\IndexPalletStoredItemsInReturn; use App\Actions\UI\Dispatch\ShowDispatchHub; use Illuminate\Support\Facades\Route; @@ -29,4 +29,4 @@ Route::get('fulfilment-returns/{palletReturn:id}', [ShowPalletReturn::class, 'inWarehouse'])->name('pallet-returns.show')->withoutScopedBindings(); Route::get('fulfilment-return-stored-items/{palletReturn:id}', [ShowStoredItemReturn::class, 'inWarehouse'])->name('pallet-return-with-stored-items.show')->withoutScopedBindings(); Route::get('fulfilment-returns/{palletReturn:id}/pallets', IndexPalletsInReturn::class)->name('pallet-returns.pallets.index')->withoutScopedBindings(); -Route::get('fulfilment-returns/{palletReturn:id}/stored-items', IndexStoredItemsInReturn::class)->name('pallet-returns.stored-items.index')->withoutScopedBindings(); +Route::get('fulfilment-returns/{palletReturn:id}/stored-items', IndexPalletStoredItemsInReturn::class)->name('pallet-returns.stored-items.index')->withoutScopedBindings(); From 96c749eec2a4e01af1a98ce2643a45f453fc6ba0 Mon Sep 17 00:00:00 2001 From: Raul Perusquia Date: Wed, 19 Feb 2025 17:21:08 +0800 Subject: [PATCH 3/4] =?UTF-8?q?pint=20=F0=9F=8D=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Imports/SupplyChain/SupplierProductImport.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Imports/SupplyChain/SupplierProductImport.php b/app/Imports/SupplyChain/SupplierProductImport.php index f301f7b88e..7be5998ba1 100644 --- a/app/Imports/SupplyChain/SupplierProductImport.php +++ b/app/Imports/SupplyChain/SupplierProductImport.php @@ -14,7 +14,6 @@ use App\Models\Helpers\Upload; use App\Models\SupplyChain\Supplier; use Exception; -use Illuminate\Support\Arr; use Maatwebsite\Excel\Concerns\SkipsOnFailure; use Maatwebsite\Excel\Concerns\ToCollection; use Maatwebsite\Excel\Concerns\WithEvents; @@ -75,15 +74,15 @@ public function storeModel($row, $uploadRecord): void protected function processExcelData($data) { $mappedRow = []; - + foreach ($data as $row) { foreach ($row as $key => $value) { $mappedKey = str_replace([' ', ':', "'"], '_', strtolower($key)); $mappedRow[$mappedKey] = $value; } - break; + break; } - + return $mappedRow; } From aea922595442e276b049c45f31f71e13789f4b49 Mon Sep 17 00:00:00 2001 From: Raul Perusquia Date: Wed, 19 Feb 2025 18:58:48 +0800 Subject: [PATCH 4/4] increase pallets note size --- app/Actions/Fulfilment/Pallet/StorePallet.php | 2 +- app/Actions/Fulfilment/Pallet/UpdatePallet.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Actions/Fulfilment/Pallet/StorePallet.php b/app/Actions/Fulfilment/Pallet/StorePallet.php index 045fe77c5a..1dc20c89e3 100644 --- a/app/Actions/Fulfilment/Pallet/StorePallet.php +++ b/app/Actions/Fulfilment/Pallet/StorePallet.php @@ -132,7 +132,7 @@ public function rules(): array 'sometimes', Rule::enum(PalletTypeEnum::class) ], - 'notes' => ['sometimes', 'nullable', 'string', 'max:1024'], + 'notes' => ['sometimes', 'nullable', 'string', 'max:16384'], 'warehouse_id' => [ diff --git a/app/Actions/Fulfilment/Pallet/UpdatePallet.php b/app/Actions/Fulfilment/Pallet/UpdatePallet.php index 9ae8beeb9e..cd04374f77 100644 --- a/app/Actions/Fulfilment/Pallet/UpdatePallet.php +++ b/app/Actions/Fulfilment/Pallet/UpdatePallet.php @@ -137,7 +137,7 @@ public function rules(): array ], 'location_id' => ['sometimes', 'nullable', Rule::exists('locations', 'id')], - 'notes' => ['sometimes','nullable', 'string', 'max:1024'], + 'notes' => ['sometimes','nullable', 'string', 'max:16384'], 'received_at' => ['sometimes','nullable', 'date'], 'booked_in_at' => ['sometimes', 'nullable', 'date'], 'storing_at' => ['sometimes', 'nullable', 'date'],