diff --git a/app/Classes/General/Eloquent/Filters/OwneId.php b/app/Classes/General/Eloquent/Filters/OwneId.php new file mode 100644 index 00000000..eac7e32d --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/OwneId.php @@ -0,0 +1,20 @@ +where('owner_id', $value); + } + +} \ No newline at end of file diff --git a/app/Classes/General/Interfaces/Transactionable.php b/app/Classes/General/Interfaces/Transactionable.php new file mode 100644 index 00000000..174cb48d --- /dev/null +++ b/app/Classes/General/Interfaces/Transactionable.php @@ -0,0 +1,13 @@ + 'Updated Email', + 'message' => 'Successfully updated email' + ]; + } + + /** + * @var AssignEmployeeProcessor + */ + private $assignEmployeeProcessor; + + /** + * @var GenerateEmailVerificationAttemptProcessor + */ + private $generateEmailVerificationAttemptProcessor; + + /** + * AddNewMemberLogic constructor. + * @param AssignEmployeeProcessor $assignEmployeeProcessor + * @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor + */ + public function __construct(AssignEmployeeProcessor $assignEmployeeProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor) + { + $this->assignEmployeeProcessor = $assignEmployeeProcessor; + $this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws ResourceConflictException + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request): JsonResponse + { + try { + $user = Auth::user()->replicate(); + $user->email = $request->input('email'); + $user->status = ApprovalStatus::PENDING_VERIFICATION; + $user->save(); + } catch (QueryException $exception){ + throw new ResourceConflictException('Unable to change your email address as it already exists'); + } + + if($company = Auth::user()->companyModule()->first()){ + $Object = new EmploymentObject($company, $user); + $this->assignEmployeeProcessor->execute($Object); + } + + $this->generateEmailVerificationAttemptProcessor->execute($user); + + return $this->resourceResponse(new UserResource($user)); + } +} diff --git a/app/Classes/Modules/Addresses/ControllersLogic/ListStatesLogic.php b/app/Classes/Modules/Addresses/ControllersLogic/ListStatesLogic.php new file mode 100644 index 00000000..3d6c484f --- /dev/null +++ b/app/Classes/Modules/Addresses/ControllersLogic/ListStatesLogic.php @@ -0,0 +1,54 @@ + 'Retrieved Addresses', + 'message' => 'You have successfully retrieved a list of Addresses' + ]; + } + + /** @var ListsStates */ + private $listStates; + + /** + * ListStatesLogic constructor. + * @param ListsStates $listStates + */ + public function __construct(ListsStates $listStates) + { + $this->listStates = $listStates; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function logic(Request $request) : JsonResponse + { + $query = $this->listStates->execute($this->listStates->deserializeFilters($request->input('filters'))); + + return $this->collectionResponse(StateResource::collection($query)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Addresses/Services/ListsStates.php b/app/Classes/Modules/Addresses/Services/ListsStates.php new file mode 100644 index 00000000..5591b823 --- /dev/null +++ b/app/Classes/Modules/Addresses/Services/ListsStates.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Announcements/DataTransferObjects/AnnouncementObject.php b/app/Classes/Modules/Announcements/DataTransferObjects/AnnouncementObject.php index 6493811d..8ce6d4a8 100644 --- a/app/Classes/Modules/Announcements/DataTransferObjects/AnnouncementObject.php +++ b/app/Classes/Modules/Announcements/DataTransferObjects/AnnouncementObject.php @@ -3,8 +3,6 @@ namespace App\Classes\Modules\Announcements\DataTransferObjects; use App\Classes\General\Interfaces\DataTransferObject; -use Carbon\Carbon; - class AnnouncementObject implements DataTransferObject { @@ -54,20 +52,18 @@ class AnnouncementObject implements DataTransferObject } /** - * @return Carbon + * @return string */ - public function getStartingOn(): Carbon + public function getStartingOn(): string { -// return $this->starting_on; - return Carbon::parse($this->starting_on); + return $this->starting_on; } /** - * @return Carbon + * @return string */ - public function getEndingOn(): Carbon + public function getEndingOn(): string { -// return $this->ending_on; - return Carbon::parse($this->ending_on); + return $this->ending_on; } } diff --git a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyLogic.php b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyLogic.php index c435dab4..45732c82 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/UpdateCompanyLogic.php @@ -5,6 +5,7 @@ namespace App\Classes\Modules\Companies\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Companies\Services\UpdatesCompany; +use App\Classes\Modules\Companies\Services\UpdatesCompanyModuleName; use App\Classes\Modules\Companies\Services\FetchesCompany; use App\Classes\Modules\Companies\Standards\Rules\CanUpdateCompany; use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject; @@ -35,17 +36,22 @@ class UpdateCompanyLogic extends AbstractControllerLogic /** @var FetchesCompany */ private $fetchesCompany; + /** @var UpdatesCompanyModuleName */ + private $updatesCompanyModuleName; + /** * UpdateCompanyControllersLogic constructor. * @param CanUpdateCompany $canUpdateCompany * @param UpdatesCompany $updatesCompany * @param FetchesCompany $fetchesCompany + * @param UpdatesCompanyModuleName $updatesCompanyModuleName */ - public function __construct(CanUpdateCompany $canUpdateCompany, UpdatesCompany $updatesCompany, FetchesCompany $fetchesCompany) + public function __construct(CanUpdateCompany $canUpdateCompany, UpdatesCompany $updatesCompany, FetchesCompany $fetchesCompany, UpdatesCompanyModuleName $updatesCompanyModuleName) { $this->canUpdateCompany = $canUpdateCompany; $this->updatesCompany = $updatesCompany; $this->fetchesCompany = $fetchesCompany; + $this->updatesCompanyModuleName = $updatesCompanyModuleName; } @@ -56,23 +62,17 @@ class UpdateCompanyLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { - try { + $object = new CompanyObject($request->input('name'), $request->input('reference'), $request->input('type')); - $object = new CompanyObject($request->input('reference_no'), $request->input('name'), $request->input('type')); + $this->canUpdateCompany->passes($object); - $this->canUpdateCompany->passes($object); + $query = $this->fetchesCompany->execute(['id' => $request->route('id')]); - $query = $this->fetchesCompany->execute(['id' => $request->route('id')]); + $query = $this->updatesCompany->execute($query, $object); - $query = $this->updatesCompany->execute($query, $object); - - return $this->resourceResponse(new CompanyResource($query)); - - - } catch (\Exception $exception){ - throw new ErrorException($exception->getMessage(), $exception->getCode()); - } + $this->updatesCompanyModuleName->execute($query->companyModules()->first(), $object->getName()); + return $this->resourceResponse(new CompanyResource($query)); } } \ No newline at end of file diff --git a/app/Classes/Modules/Companies/Services/UpdatesCompany.php b/app/Classes/Modules/Companies/Services/UpdatesCompany.php new file mode 100644 index 00000000..f89bbca8 --- /dev/null +++ b/app/Classes/Modules/Companies/Services/UpdatesCompany.php @@ -0,0 +1,26 @@ +name = $object->getName(); + $model->reference = $object->getReference(); + $model->type = $object->getType(); + + return $this->handler($model); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Companies/Services/UpdatesCompanyModuleName.php b/app/Classes/Modules/Companies/Services/UpdatesCompanyModuleName.php new file mode 100644 index 00000000..8dba5196 --- /dev/null +++ b/app/Classes/Modules/Companies/Services/UpdatesCompanyModuleName.php @@ -0,0 +1,24 @@ +name = $name; + + return $this->handler($model); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Companies/Standards/Rules/CanUpdateCompany.php b/app/Classes/Modules/Companies/Standards/Rules/CanUpdateCompany.php new file mode 100644 index 00000000..c7bd1f70 --- /dev/null +++ b/app/Classes/Modules/Companies/Standards/Rules/CanUpdateCompany.php @@ -0,0 +1,51 @@ +companyValidation = $companyValidation; + } + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + } + + /** + * @param CompanyObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->companyValidation->validate($object, 'PUT'); + } + + /** + * @param CompanyObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Companies/Standards/Validators/CompanyValidation.php b/app/Classes/Modules/Companies/Standards/Validators/CompanyValidation.php index e9809fff..4a69768a 100644 --- a/app/Classes/Modules/Companies/Standards/Validators/CompanyValidation.php +++ b/app/Classes/Modules/Companies/Standards/Validators/CompanyValidation.php @@ -15,7 +15,8 @@ class CompanyValidation extends AbstractValidation { return [ 'company_name' => $object->getName(), - 'company_reference' => $object->getReference() + 'company_reference' => $object->getReference(), + 'type' => $object->getType() ]; } diff --git a/app/Classes/Modules/Documents/ControllersLogic/UpdateDocumentReferenceLogic.php b/app/Classes/Modules/Documents/ControllersLogic/UpdateDocumentReferenceLogic.php new file mode 100644 index 00000000..e5d59101 --- /dev/null +++ b/app/Classes/Modules/Documents/ControllersLogic/UpdateDocumentReferenceLogic.php @@ -0,0 +1,68 @@ + 'Update Document Reference', + 'message' => 'You have successfully updated the Document Reference' + ]; + } + + /** @var CanUpdateDocumentReference*/ + private $canUpdateDocumentReference; + + /** @var UpdatesDocumentReference */ + private $updatesDocumentReference; + + /** @var FetchesDocument */ + private $fetchesDocument; + + + /** + * RejectDocumentLogic constructor. + * @param CanApproveDocument $canApproveDocument + * @param ApprovesDocument $approvesDocument + * @param FetchesDocument $fetchesDocument + */ + public function __construct(CanUpdateDocumentReference $canUpdateDocumentReference, UpdatesDocumentReference $updatesDocumentReference, FetchesDocument $fetchesDocument) + { + $this->canUpdateDocumentReference = $canUpdateDocumentReference; + $this->updatesDocumentReference = $updatesDocumentReference; + $this->fetchesDocument = $fetchesDocument; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + $document = $this->fetchesDocument->execute(['id' => $request->route('id')]); + + $this->canUpdateDocumentReference->passes(); + + $document_query = $this->updatesDocumentReference->execute($document, $request->input('identification_number')); + + return $this->resourceResponse(new DocumentResource($document_query)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Documents/Services/UpdatesDocumentReference.php b/app/Classes/Modules/Documents/Services/UpdatesDocumentReference.php new file mode 100644 index 00000000..23a16e02 --- /dev/null +++ b/app/Classes/Modules/Documents/Services/UpdatesDocumentReference.php @@ -0,0 +1,20 @@ +reference = $reference; + return $this->handler($model); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Documents/Standards/Rules/CanUpdateDocumentReference.php b/app/Classes/Modules/Documents/Standards/Rules/CanUpdateDocumentReference.php new file mode 100644 index 00000000..e6a29785 --- /dev/null +++ b/app/Classes/Modules/Documents/Standards/Rules/CanUpdateDocumentReference.php @@ -0,0 +1,39 @@ +id = $id; + } + + /** + * @return \Illuminate\Support\Collection|mixed + */ + public function query() + { + return Container::find($this->id)->packingLists(); + } + + /** + * @param Company $container + * + * @return array + */ + public function map($packing_list): array + { + $order = $packing_list->owner()->first(); + $address = $order->addresses()->first(); + $company = $order->companyModule()->first(); + $connection = $company->inviters()->withPivot('invitee_reference')->first(); + $marking = $connection ? $connection->pivot->invitee_reference:''; + + $quantity = 0; + $cbm = 0; + foreach ($packing_list->packages()->get() as $key => $row) { + $quantity += $row->quantity; + $cbm += (($row->width / 100) * ($row->height / 100) * ($row->length / 100)) * $row->quantity; + } + + $status = ''; + if ($packing_list->transports()->count() > 0) { + $status = 'Delivery'; + } + elseif ($packing_list->status == ApprovalStatus::SUSPENDED) { + $status = 'On Hold'; + } + elseif ($packing_list->status != ApprovalStatus::SUSPENDED) { + $status = 'Release'; + } + + return [ + $marking, + $order->reference, + $quantity, + $cbm, + $status, + $address->contacts()->first() ? $address->contacts()->first()->phone : 'n/a', + $address->contacts()->first() ? $address->contacts()->first()->reference : 'n/a', + $address->street_one . ' ' . $address->street_two . ' ' . $address->district->name . ' ' . $address->post_code . ' ' . $address->state->name . ' ' . $address->country->name, + $address->remarks()->first() ? $address->remarks()->first()->content : 'n/a', + $packing_list->transports()->first() ? $packing_list->transports()->current_schedule->eta : 'n/a' + ]; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Orders/Processors/ApproveChangeOrderAddressProcessor.php b/app/Classes/Modules/Orders/Processors/ApproveChangeOrderAddressProcessor.php index 28f9a116..4878b529 100644 --- a/app/Classes/Modules/Orders/Processors/ApproveChangeOrderAddressProcessor.php +++ b/app/Classes/Modules/Orders/Processors/ApproveChangeOrderAddressProcessor.php @@ -6,7 +6,9 @@ use App\Classes\Modules\Addresses\Services\FetchesAddress; use App\Classes\Modules\Orders\Standards\Rules\CanApproveChangeOrderAddress; use App\Classes\Modules\Orders\Services\UpdatesOrdersAddress; use App\Classes\ValueObjects\Constants\ApprovalStatus; +use App\Classes\ValueObjects\Constants\OrderRoleTypes; use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor; +use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor; use App\Classes\ValueObjects\Constants\OrderRoleTypes; use Illuminate\Http\Request; diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/AssignPackingListOrderLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/AssignPackingListOrderLogic.php new file mode 100644 index 00000000..45f32ad7 --- /dev/null +++ b/app/Classes/Modules/PackingLists/ControllersLogic/AssignPackingListOrderLogic.php @@ -0,0 +1,147 @@ + 'Assign Packing List Order', + 'message' => 'You have successfully created a Packing List Order' + ]; + } + + /** @var FetchesPackingList */ + private $fetchesPackingList; + + + /** @var FetchesOrder */ + private $fetchesOrder; + + /** @var UpdatesPackingListOwner */ + private $updatesPackingListOwner; + + /** @var UpdatesTransportStatus */ + private $updatesTransportStatus; + + /** @var CreatesContract */ + private $unityCreateContract; + + /** @var ActivateContractProcessor */ + private $unityActivateContract; + + /** @var CreateContractEntityProcessor */ + private $unityCreateContractEntity; + + /** @var AssignContractEntityProcessor */ + private $unityAssignContractEntity; + + /** @var UpdatesPackingListContractReference */ + private $updatesPackingListContractReference; + + /** @var CreatesStep */ + private $createsStep; + + /** + * CreateRemarkLogic constructor. + * @param CanCreateRemark $canCreateRemark + * @param CreatesPackingListRemark $createsPackingListRemark + */ + public function __construct(FetchesPackingList $fetchesPackingList, FetchesOrder $fetchesOrder, UpdatesPackingListOwner $updatesPackingListOwner, UpdatesTransportStatus $updatesTransportStatus, CreatesContract $unityCreateContract, ActivateContractProcessor $unityActivateContract, CreateContractEntityProcessor $unityCreateContractEntity, AssignContractEntityProcessor $unityAssignContractEntity, UpdatesPackingListContractReference $updatesPackingListContractReference, CreatesStep $createsStep) + { + $this->fetchesPackingList = $fetchesPackingList; + $this->fetchesOrder = $fetchesOrder; + $this->updatesPackingListOwner = $updatesPackingListOwner; + $this->updatesTransportStatus = $updatesTransportStatus; + + $this->unityCreateContract = $unityCreateContract; + $this->unityActivateContract = $unityActivateContract; + $this->unityCreateContractEntity = $unityCreateContractEntity; + $this->unityAssignContractEntity = $unityAssignContractEntity; + + $this->updatesPackingListContractReference = $updatesPackingListContractReference; + $this->createsStep = $createsStep; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function logic(Request $request) : JsonResponse + { + $warehouse_packing_list = $this->fetchesPackingList->execute([ + 'id' => $request->route('id'), + 'type' => PackingListType::WAREHOUSE_RECEIVE_LIST, + 'status' => ApprovalStatus::REJECTED + ]); + + $order = $this->fetchesOrder->execute(['reference' => $request->route('reference')]); + + $warehouse_packing_list = $this->updatesPackingListOwner->execute($warehouse_packing_list, $order); + + + $transport = $warehouse_packing_list->transports()->first(); + $transport = $this->updatesTransportStatus->execute($transport, ApprovalStatus::APPROVED); + + $contract = $this->unityCreateContract->execute(); + $contractReference = $contract->hash_id; + $contractObligations = $contract->contract_obligation_list; + + $this->unityActivateContract->execute($contractReference); + $supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id; + + $supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId); + $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->update(['entity_hash_id' => $supervisorContractEntity->hash_id, 'entity_signature' => $supervisorContractEntity->entity_signature_hash_id]); + + $importerContractEntity = $this->unityCreateContractEntity->execute($contractReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->appointee->unity_hash_id); + $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->update(['entity_hash_id' => $importerContractEntity->hash_id, 'entity_signature' => $importerContractEntity->entity_signature_hash_id]); + + $this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations); + + $packing_list = $this->fetchesPackingList->execute([ + 'reference' => $warehouse_packing_list->reference, + 'type' => PackingListType::SHIPPING_PACKING_LIST, + 'status' => ApprovalStatus::PENDING_VERIFICATION + ]); + + $warehouse_packing_list = $this->updatesPackingListOwner->execute($packing_list, $order); + + $this->updatesPackingListContractReference->execute($packing_list, $contractReference); + + foreach($contractObligations as $obligation) { + $stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id); + $this->createsStep->execute($packing_list, $stepObject); + } + + return $this->resourceResponse(new PackingListResource($warehouse_packing_list)); + } +} diff --git a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php index a1e485ce..b9e3142d 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/ListPackingListsLogic.php @@ -6,6 +6,7 @@ namespace App\Classes\Modules\PackingLists\ControllersLogic; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\PackingLists\Services\ListsPackingLists; use App\Classes\Modules\PackingLists\Standards\Rules\CanListPackingLists; +use App\Http\Resources\PackingListNullOrderResource; use App\Http\Resources\PackingListResource; use ErrorException; use Illuminate\Http\JsonResponse; @@ -49,18 +50,11 @@ class ListPackingListsLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { - try { + $this->canListPackingLists->passes(); - $this->canListPackingLists->passes(); - - $query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); - - return $this->collectionResponse(PackingListResource::collection($query)); - - } catch (\Exception $exception){ - throw new ErrorException($exception->getMessage(), $exception->getCode()); - } + $query = $this->listsPackingLists->execute($this->listsPackingLists->deserializeFilters($request->input('filters'))); + return $this->collectionResponse(PackingListResource::collection($query)); } } diff --git a/app/Classes/Modules/PackingLists/Processors/CreatePackageProcessor.php b/app/Classes/Modules/PackingLists/Processors/CreatePackageProcessor.php index 13e4a83b..e1d112ed 100644 --- a/app/Classes/Modules/PackingLists/Processors/CreatePackageProcessor.php +++ b/app/Classes/Modules/PackingLists/Processors/CreatePackageProcessor.php @@ -49,7 +49,7 @@ class CreatePackageProcessor if($replica) { $modificationValue = 1; $packageObject = new PackageObject($object->getType(), $object->getDescription(), $object->getWidth() + $modificationValue, $object->getHeight() + $modificationValue, $object->getLength() + $modificationValue, $object->getWeight(), $object->getQuantity(), $object->getStatus()); - $this->createsPackage->execute($packageObject, $replica); + $package = $this->createsPackage->execute($packageObject, $replica); } return ; diff --git a/app/Classes/Modules/PackingLists/Processors/CreatePackingListProcessor.php b/app/Classes/Modules/PackingLists/Processors/CreatePackingListProcessor.php index 3e2a861d..f0eda0cb 100644 --- a/app/Classes/Modules/PackingLists/Processors/CreatePackingListProcessor.php +++ b/app/Classes/Modules/PackingLists/Processors/CreatePackingListProcessor.php @@ -48,11 +48,13 @@ class CreatePackingListProcessor /** @var PackingList $packingList */ $packingList = $this->createsPackingList->execute($object, $packable); + $appointee_id = $packingList->owner_id == 1 ? 2037 : $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id; + $type = $object->getType() === PackingListType::SHIPPING_PACKING_LIST ? PackingListType::SHIPPING_PACKING_LIST_REPLICA : PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA; /** create packing list replica */ - $object = new PackingListObject($object->getReference().'_01', $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id, $type, ApprovalStatus::PENDING_SUBMISSION); + $object = new PackingListObject($object->getReference().'_01', $appointee_id, $type, ApprovalStatus::PENDING_SUBMISSION); $this->createsPackingList->execute($object, $packingList); - + return $packingList; } diff --git a/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php b/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php index 9417145e..7a81972f 100644 --- a/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php +++ b/app/Classes/Modules/PackingLists/Processors/FetchOrderListsFromYdPortalProcessor.php @@ -30,8 +30,8 @@ use App\Classes\ValueObjects\Constants\PackageType; use App\Classes\ValueObjects\Constants\PackingListType; use App\Classes\ValueObjects\Constants\TransportType; use App\Models\Container; +use App\Models\Order; use App\Models\PackingList; -use App\Models\Transaction; use App\Models\Transport; use Carbon\Carbon; use Illuminate\Support\Facades\DB; @@ -134,9 +134,7 @@ class FetchOrderListsFromYdPortalProcessor */ public function execute(?Carbon $start = null, ?Carbon $end = null) { - try { - $start = $start ? $start : Carbon::now()->subMonths(2); $startLimit = Carbon::parse('01-12-2021'); @@ -153,6 +151,7 @@ class FetchOrderListsFromYdPortalProcessor ]); $rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest); + foreach($rows->data as $row){ $containerReference = null; @@ -170,7 +169,7 @@ class FetchOrderListsFromYdPortalProcessor $rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest); foreach (array_reverse($rows->data) as $trackingRow) { - if($trackingRow->tracking === '货物已送达仓库准备入库中'){ + if ($trackingRow->tracking === '货物已送达仓库准备入库中') { $receiveDate = Carbon::parse($trackingRow->trackingtime); } @@ -182,29 +181,29 @@ class FetchOrderListsFromYdPortalProcessor $eta = Carbon::parse($tracking[2]); } - if(strpos($trackingRow->tracking, '预计船时间为') !== false){ + if (strpos($trackingRow->tracking, '预计船时间为') !== false) { $tracking = explode('预计船时间为', $trackingRow->tracking); $delayDate = Carbon::parse(explode('日', $tracking[1])[0]); } - if(strpos($trackingRow->tracking, '预计开船为') !== false){ + if (strpos($trackingRow->tracking, '预计开船为') !== false) { $tracking = explode('预计开船为', $trackingRow->tracking); $delayDate = Carbon::parse(explode('日', $tracking[1])[0]); } - if($trackingRow->tracking === '货物已进目的港仓库'){ + if ($trackingRow->tracking === '货物已进目的港仓库') { $unstuffingDate = Carbon::parse($trackingRow->trackingtime); } - if($trackingRow->tracking === '货物已派送完成'){ + if ($trackingRow->tracking === '货物已派送完成') { $deliveryDate = Carbon::parse($trackingRow->trackingtime); } - } $customerno = preg_split('(-|\(|\)|\/)', $row->customerno); $orderNumber = $customerno[array_key_last($customerno)]; + $allow_contract = true; try { $order = $this->fetchesOrder->execute(['reference' => $orderNumber]); @@ -212,8 +211,10 @@ class FetchOrderListsFromYdPortalProcessor try { $order = $this->fetchesOrder->execute(['reference' => substr($orderNumber, -9)]); } catch (ResourceNotFoundException $exception) { - continue; + $order = $this->fetchesCompanyModule->execute(['id' => 1]); + $allow_contract = false; } + } DB::beginTransaction(); @@ -232,40 +233,52 @@ class FetchOrderListsFromYdPortalProcessor $replica = $warehouseReceiveList->packingLists()->where('type', PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA)->first(); if($replica) $replica->packages()->delete(); - } catch (ResourceNotFoundException $exception){ - $warehouseReceiveObject = new PackingListObject($packingListReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id, PackingListType::WAREHOUSE_RECEIVE_LIST, ApprovalStatus::APPROVED); + } catch (ResourceNotFoundException $exception) { + + if (!$allow_contract) { + $appointee_id = 2037; + } else { + $appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id; + } + + $warehouseReceiveObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::WAREHOUSE_RECEIVE_LIST, $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED); + /** @var PackingList $warehouseReceiveList */ $warehouseReceiveList = $this->createPackingListProcessor->execute($warehouseReceiveObject, $order); - $transportObject = new TransportObject(TransportType::LAND, null, $row->kuaidilist, Carbon::parse($receiveDate), Carbon::parse($receiveDate), ApprovalStatus::APPROVED); - /** @var Transport $warehouseTransport */ - $warehouseTransport = $this->createsTransport->execute($transportObject, $warehouseReceiveList); - $this->createsSchedule->execute($warehouseTransport, new ScheduleObject(Carbon::parse($receiveDate), Carbon::parse($receiveDate), ApprovalStatus::APPROVED)); - $contract = $this->unityCreateContract->execute(); + $transportObject = new TransportObject(TransportType::LAND, null, $row->kuaidilist, Carbon::parse($receiveDate), Carbon::parse($receiveDate), $allow_contract ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED); + $transport = $this->createsTransport->execute($transportObject, $warehouseReceiveList); - $contractReference = $contract->hash_id; - $contractObligations = $contract->contract_obligation_list; + if ($allow_contract) { - $this->unityActivateContract->execute($contractReference); + $contract = $this->unityCreateContract->execute(); - $supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id; + $contractReference = $contract->hash_id; + $contractObligations = $contract->contract_obligation_list; - $supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId); - $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->update(['entity_hash_id' => $supervisorContractEntity->hash_id, 'entity_signature' => $supervisorContractEntity->entity_signature_hash_id]); + $this->unityActivateContract->execute($contractReference); - $importerContractEntity = $this->unityCreateContractEntity->execute($contractReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->appointee->unity_hash_id); - $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->update(['entity_hash_id' => $importerContractEntity->hash_id, 'entity_signature' => $importerContractEntity->entity_signature_hash_id]); + $supervisorHashId = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->unity_hash_id; - $this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations); + $supervisorContractEntity = $this->unityCreateContractEntity->execute($contractReference, $supervisorHashId); + $order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->update(['entity_hash_id' => $supervisorContractEntity->hash_id, 'entity_signature' => $supervisorContractEntity->entity_signature_hash_id]); - $packingListObject = new PackingListObject($packingListReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::SUSPENDED , $contractReference); + $importerContractEntity = $this->unityCreateContractEntity->execute($contractReference, $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->appointee->unity_hash_id); + $order->orderRoles()->where('role_id', '=', OrderRoleTypes::IMPORTER)->first()->update(['entity_hash_id' => $importerContractEntity->hash_id, 'entity_signature' => $importerContractEntity->entity_signature_hash_id]); + + $this->unityAssignContractEntity->execute($supervisorContractEntity->hash_id, $contractObligations); + } + + $packingListObject = new PackingListObject($packingListReference, $appointee_id, PackingListType::SHIPPING_PACKING_LIST, ApprovalStatus::PENDING_VERIFICATION, !$allow_contract ? null : $contractReference); /** @var PackingList $packingList */ $packingList = $this->createPackingListProcessor->execute($packingListObject, $order); - foreach($contractObligations as $obligation) { - $stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id); - $this->createsStep->execute($packingList, $stepObject); + if ($allow_contract) { + foreach ($contractObligations as $obligation) { + $stepObject = new StepsObject($order->orderRoles()->where('role_id', '=', OrderRoleTypes::SUPERVISOR)->first()->appointee->id, $obligation->reference, $obligation->sequence, $obligation->hash_id); + $this->createsStep->execute($packingList, $stepObject); + } } } @@ -284,50 +297,46 @@ class FetchOrderListsFromYdPortalProcessor $this->createPackageProcessor->execute($packageObject, $packingList); } - DB::commit(); - - $marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference; - if(!in_array($marking, ['2192KAA', '2353GFE', '6866DTR', '153DSR', '1291NSC', '8288MIB'])){ - $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/confirmsendorder.ashx', 'GET', [ - 'expressno' => $row->expressno - ]); + if($order instanceof Order){ + $marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference; + if(!in_array($marking, ['2192KAA', '2353GFE', '6866DTR', '153DSR', '1291NSC', '8288MIB'])){ + $this->fetchesDataFRomYDPortal->clientRequest('http://www.yd-wl.com/api/confirmsendorder.ashx', 'GET', [ + 'expressno' => $row->expressno + ]); + } } + if($containerReference) { try { $container = $this->fetchesContainer->execute(['reference' => $containerReference]); } catch (ResourceNotFoundException $exception){ - $originWarehouse = $this->fetchesCompanyModule->execute(['id' => $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id]); + + if (!$allow_contract) { + $appointee_id = 2037; + } + else { + $appointee_id = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->id; + } + + $originWarehouse = $this->fetchesCompanyModule->execute(['id' => $appointee_id]); + $containerObject = new ContainerObject($containerReference, '', '', ContainerTypes::FORTY_FEET_DRY_CONTAINER, $loadingDate, ApprovalStatus::PENDING_VERIFICATION); /** @var Container $container */ $container = $this->createContainerProcessor->execute($containerObject, $originWarehouse); - } - $container->packingLists()->detach($packingList); - $container->packingLists()->attach($packingList); - - $transport = $container->transports()->first(); - - if(!$transport){ - $transportObject = new TransportObject(TransportType::SEA, null, null, $etd, null, ApprovalStatus::APPROVED); - /** @var Transport $transport */ - $transport = $this->createsTransport->execute($transportObject, $container); - $this->createsSchedule->execute($transport, new ScheduleObject($etd, $eta, ApprovalStatus::APPROVED)); - } - - if($delayDate){ + $container->packingLists()->attach($packingList); $transport = $container->transports()->first(); - if(!$transport->schedules()->where('eta', '=', $delayDate)->first()) { - $etd = $transport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->etd; - $transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]); - $this->createsSchedule->execute($transport, new ScheduleObject($etd, $delayDate, ApprovalStatus::APPROVED)); + if(!$transport){ + $transportObject = new TransportObject(TransportType::SEA, null, null, $etd, null, ApprovalStatus::APPROVED); + /** @var Transport $transport */ + $transport = $this->createsTransport->execute($transportObject, $container); + $this->createsSchedule->execute($transport, new ScheduleObject($etd, $eta, ApprovalStatus::APPROVED)); } - } - if($unstuffingDate && $container->status !== ApprovalStatus::COMPLETED){ $container->update(['status' => ApprovalStatus::COMPLETED]); $container->transports()->first()->update(['drop_date' => $unstuffingDate, 'status' => ApprovalStatus::COMPLETED]); @@ -347,7 +356,6 @@ class FetchOrderListsFromYdPortalProcessor } } } - } if($deliveryDate){ @@ -371,6 +379,8 @@ class FetchOrderListsFromYdPortalProcessor $deliveryStep->update(['status' => ApprovalStatus::COMPLETED]); } + DB::commit(); + } } catch (\Exception $exception) { Log::debug($exception); diff --git a/app/Classes/Modules/PackingLists/Services/CreatesNullOrderPackingList.php b/app/Classes/Modules/PackingLists/Services/CreatesNullOrderPackingList.php new file mode 100644 index 00000000..fd955d44 --- /dev/null +++ b/app/Classes/Modules/PackingLists/Services/CreatesNullOrderPackingList.php @@ -0,0 +1,31 @@ +reference = $object->getReference(); + $model->claimant_id = $object->getClaimantId(); + $model->type = $object->getType(); + $model->status = $object->getStatus(); + $model->reference_contract = $object->getContractReference(); + $model->owner_type = 'App\Models\Order'; + $model->owner_id = 1; + + return $this->handler($model); + } +} diff --git a/app/Classes/Modules/PackingLists/Services/UpdatesPackingListContractReference.php b/app/Classes/Modules/PackingLists/Services/UpdatesPackingListContractReference.php new file mode 100644 index 00000000..dba4dfb3 --- /dev/null +++ b/app/Classes/Modules/PackingLists/Services/UpdatesPackingListContractReference.php @@ -0,0 +1,24 @@ +reference_contract = $reference_contract; + + return $this->handler($model); + + } +} diff --git a/app/Classes/Modules/PackingLists/Services/UpdatesPackingListOwner.php b/app/Classes/Modules/PackingLists/Services/UpdatesPackingListOwner.php new file mode 100644 index 00000000..4a6b6dfb --- /dev/null +++ b/app/Classes/Modules/PackingLists/Services/UpdatesPackingListOwner.php @@ -0,0 +1,26 @@ +status = ApprovalStatus::APPROVED; + + return $this->handler($packable->packingLists(), $model); + + } +} diff --git a/app/Classes/Modules/SegmentConstants/Services/FetchesSegmentConstant.php b/app/Classes/Modules/SegmentConstants/Services/FetchesSegmentConstant.php new file mode 100644 index 00000000..33aa445b --- /dev/null +++ b/app/Classes/Modules/SegmentConstants/Services/FetchesSegmentConstant.php @@ -0,0 +1,34 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/ControllersLogic/CreateSegmentLogic.php b/app/Classes/Modules/Segments/ControllersLogic/CreateSegmentLogic.php index 14860207..6dff8327 100644 --- a/app/Classes/Modules/Segments/ControllersLogic/CreateSegmentLogic.php +++ b/app/Classes/Modules/Segments/ControllersLogic/CreateSegmentLogic.php @@ -22,7 +22,6 @@ class CreateSegmentLogic extends AbstractControllerLogic ]; } - /** @var CreateSegmentProcessor */ private $createSegmentProcessor; diff --git a/app/Classes/Modules/Segments/ControllersLogic/DeleteSegmentLogic.php b/app/Classes/Modules/Segments/ControllersLogic/DeleteSegmentLogic.php index 5d2f6c3b..98844819 100644 --- a/app/Classes/Modules/Segments/ControllersLogic/DeleteSegmentLogic.php +++ b/app/Classes/Modules/Segments/ControllersLogic/DeleteSegmentLogic.php @@ -45,7 +45,6 @@ class DeleteSegmentLogic extends AbstractControllerLogic $this->fetchesSegment = $fetchesSegment; } - /** * @param Request $request * @return JsonResponse diff --git a/app/Classes/Modules/Segments/ControllersLogic/FetchConstantLogic.php b/app/Classes/Modules/Segments/ControllersLogic/FetchConstantLogic.php new file mode 100644 index 00000000..6c5c5b0f --- /dev/null +++ b/app/Classes/Modules/Segments/ControllersLogic/FetchConstantLogic.php @@ -0,0 +1,52 @@ + 'Fetch Segment Constant', + 'message' => 'You have successfully retrieved the Segment Constant' + ]; + } + + + /** @var FetchesConstant */ + private $fetchesConstant; + + /** + * FetchConstantLogic constructor. + * @param FetchesConstant $fetchesConstant + */ + public function __construct(FetchesConstant $fetchesConstant) + { + $this->fetchesConstant = $fetchesConstant; + } + + + /** + * @param Request $request + * @return JsonResponse + */ + public function logic(Request $request) : JsonResponse + { + + $constant = $this->fetchesConstant->execute(['segment_id' => $request->route('id'), 'reference' => $request->route('reference')]); + + return $this->resourceResponse(new ConstantResource($constant)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/ControllersLogic/FetchSegmentLogic.php b/app/Classes/Modules/Segments/ControllersLogic/FetchSegmentLogic.php new file mode 100644 index 00000000..d5c35fdc --- /dev/null +++ b/app/Classes/Modules/Segments/ControllersLogic/FetchSegmentLogic.php @@ -0,0 +1,59 @@ + 'Retrieved Segment', + 'message' => 'You have successfully retrieved a segment' + ]; + } + + /** @var CanFetchSegment */ + private $canFetchSegment; + + /** @var FetchesSegment */ + private $fetchesSegment; + + /** + * FetchSegmentLogic constructor. + * @param CanFetchSegment $canFetchSegment + * @param FetchesSegment $fetchesSegment + */ + public function __construct(CanFetchSegment $canFetchSegment, FetchesSegment $fetchesSegment) + { + $this->canFetchSegment = $canFetchSegment; + $this->fetchesSegment = $fetchesSegment; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + $this->canFetchSegment->passes(); + + $query = $this->fetchesSegment->execute(['id' => $request->route('id')]); + + return $this->resourceResponse(new SegmentResource($query)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/ControllersLogic/ListSegmentLogic.php b/app/Classes/Modules/Segments/ControllersLogic/ListSegmentLogic.php new file mode 100644 index 00000000..d8299424 --- /dev/null +++ b/app/Classes/Modules/Segments/ControllersLogic/ListSegmentLogic.php @@ -0,0 +1,52 @@ + 'Retrieved Segment', + 'message' => 'You have successfully retrieved a list of Segment' + ]; + } + + + /** @var ListsSegments */ + private $listsSegments; + + /** + * ListSegmentLogic constructor. + * @param ListsSegments $listsSegments + */ + public function __construct(ListsSegments $listsSegments) + { + $this->listsSegments = $listsSegments; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function logic(Request $request) : JsonResponse + { + + $query = $this->listsSegments->execute($this->listsSegments->deserializeFilters($request->input('filters'))); + + return $this->collectionResponse(SegmentResource::collection($query)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php new file mode 100644 index 00000000..dac04ec7 --- /dev/null +++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php @@ -0,0 +1,104 @@ + 'Updated Segment Constant', + 'message' => 'You have successfully updated the Segment Constant' + ]; + } + + /** @var CanUpdateConstant */ + private $canUpdateConstant; + + /** @var UpdatesConstant */ + private $updatesConstant; + + /** @var FetchesSegment */ + private $fetchesSegment; + + /** @var FetchesConstant */ + private $fetchesConstant; + + /** @var CanCreateConstant */ + private $canCreateConstant; + + /** @var CreatesConstant */ + private $createsConstant; + + + /** + * UpdateConstantLogic constructor. + * @param CanUpdateConstant $canUpdateConstant + * @param UpdatesConstant $updatesConstant + * @param FetchesSegment $fetchesSegment + * @param FetchesConstant $fetchesConstant + * @param CanCreateConstant $canCreateConstant + * @param CreatesConstant $createsConstant + */ + public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant, CanCreateConstant $canCreateConstant, CreatesConstant $createsConstant) + { + $this->canUpdateConstant = $canUpdateConstant; + $this->updatesConstant = $updatesConstant; + $this->fetchesSegment = $fetchesSegment; + $this->fetchesConstant = $fetchesConstant; + $this->canCreateConstant = $canCreateConstant; + $this->createsConstant = $createsConstant; + } + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + + $object = new ConstantObject($request->input('name'), $request->input('reference'), $request->input('detail')); + + $segment = $this->fetchesSegment->execute(['id' => $request->route('id')]); + + try { + + $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $object->getReference()]); + $this->canUpdateConstant->passes($object); + + /** @var SegmentConstant $constant */ + $constant = $this->updatesConstant->execute($constant, $object); + + } catch (ResourceNotFoundException $exception){ + + $this->canCreateConstant->passes($object); + + /** @var SegmentConstant $constant */ + $constant = $this->createsConstant->execute($segment, $object); + + } + + + return $this->resourceResponse(new ConstantResource($constant)); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentLogic.php new file mode 100644 index 00000000..43eaa54e --- /dev/null +++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentLogic.php @@ -0,0 +1,87 @@ + 'Updated Segment', + 'message' => 'You have successfully updated the Segment' + ]; + } + + /** @var CanUpdateSegment */ + private $canUpdateSegment; + + /** @var UpdatesSegment */ + private $updatesSegment; + + /** @var FetchesSegment */ + private $fetchesSegment; + + + /** + * UpdateSegmentLogic constructor. + * @param CanUpdateSegment $canUpdateSegment + * @param UpdatesSegment $updatesSegment + * @param FetchesSegment $fetchesSegment + */ + public function __construct( + CanUpdateSegment $canUpdateSegment, + UpdatesSegment $updatesSegment, + FetchesSegment $fetchesSegment + ) + { + $this->canUpdateSegment = $canUpdateSegment; + $this->updatesSegment = $updatesSegment; + $this->fetchesSegment = $fetchesSegment; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws ErrorException + */ + public function logic(Request $request) : JsonResponse + { + try { + DB::beginTransaction(); + + $segment_query = $this->fetchesSegment->execute(['id' => $request->route('id')]); + + $segment_object = new SegmentObject( + $request->input('name', $segment_query->name) + ); + $this->canUpdateSegment->passes($segment_object); + $segment_query = $this->updatesSegment->execute($segment_query, $segment_object); + + DB::commit(); + + return $this->resourceResponse(new SegmentResource($segment_query)); + + } catch (\Exception $exception){ + throw new ErrorException($exception->getMessage(), $exception->getCode()); + } + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Services/ConvertsConstantDetailsToResource.php b/app/Classes/Modules/Segments/Services/ConvertsConstantDetailsToResource.php new file mode 100644 index 00000000..4489da1f --- /dev/null +++ b/app/Classes/Modules/Segments/Services/ConvertsConstantDetailsToResource.php @@ -0,0 +1,38 @@ +fetchesCurrency = $fetchesCurrency; + } + + + public function execute(SegmentConstant $constant){ + + if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) { + return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : ''; + } + + return $constant->detail; + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Services/CreatesSegment.php b/app/Classes/Modules/Segments/Services/CreatesSegment.php index 4dff35a7..aea2d87f 100644 --- a/app/Classes/Modules/Segments/Services/CreatesSegment.php +++ b/app/Classes/Modules/Segments/Services/CreatesSegment.php @@ -8,7 +8,6 @@ use App\Models\Segment; class CreatesSegment extends AbstractUpdateRecord { - /** * @param SegmentObject $object * @return \Illuminate\Database\Eloquent\Model diff --git a/app/Classes/Modules/Segments/Services/FetchesConstant.php b/app/Classes/Modules/Segments/Services/FetchesConstant.php new file mode 100644 index 00000000..bfa1b2cb --- /dev/null +++ b/app/Classes/Modules/Segments/Services/FetchesConstant.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Services/ListsConstants.php b/app/Classes/Modules/Segments/Services/ListsConstants.php new file mode 100644 index 00000000..733a6db7 --- /dev/null +++ b/app/Classes/Modules/Segments/Services/ListsConstants.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Services/ListsSegments.php b/app/Classes/Modules/Segments/Services/ListsSegments.php new file mode 100644 index 00000000..af44820d --- /dev/null +++ b/app/Classes/Modules/Segments/Services/ListsSegments.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Services/UpdatesConstant.php b/app/Classes/Modules/Segments/Services/UpdatesConstant.php new file mode 100644 index 00000000..13fb22c1 --- /dev/null +++ b/app/Classes/Modules/Segments/Services/UpdatesConstant.php @@ -0,0 +1,26 @@ +name = $object->getName(); + $model->reference = $object->getReference(); + $model->detail = json_encode($object->getDetail()); + + return $this->handler($model); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Services/UpdatesSegment.php b/app/Classes/Modules/Segments/Services/UpdatesSegment.php new file mode 100644 index 00000000..17f13efb --- /dev/null +++ b/app/Classes/Modules/Segments/Services/UpdatesSegment.php @@ -0,0 +1,23 @@ +name = $object->getName(); + return $this->handler($model); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Standards/Rules/CanCreateConstant.php b/app/Classes/Modules/Segments/Standards/Rules/CanCreateConstant.php new file mode 100644 index 00000000..55f9c61a --- /dev/null +++ b/app/Classes/Modules/Segments/Standards/Rules/CanCreateConstant.php @@ -0,0 +1,54 @@ +constantValidation = $constantValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + + } + + /** + * @param ConstantObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->constantValidation->validate($object, 'POST'); + } + + /** + * @param ConstantObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Standards/Rules/CanFetchSegment.php b/app/Classes/Modules/Segments/Standards/Rules/CanFetchSegment.php new file mode 100644 index 00000000..e6756305 --- /dev/null +++ b/app/Classes/Modules/Segments/Standards/Rules/CanFetchSegment.php @@ -0,0 +1,43 @@ +ConstantValidation = $ConstantValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + } + + /** + * @param ConstantObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->ConstantValidation->validate($object, 'PUT'); + } + + /** + * @param ConstantObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php b/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php new file mode 100644 index 00000000..58a8c0ca --- /dev/null +++ b/app/Classes/Modules/Segments/Standards/Rules/CanUpdateSegment.php @@ -0,0 +1,59 @@ +segmentValidation = $segmentValidation; + } + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + + if (!\Auth::user()->can('edit segment')) { + return false; + } + + return true; + } + + /** + * @param SegmentObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->segmentValidation->validate($object); + } + + /** + * @param SegmentObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Standards/Validators/ConstantValidation.php b/app/Classes/Modules/Segments/Standards/Validators/ConstantValidation.php new file mode 100644 index 00000000..d5ac8819 --- /dev/null +++ b/app/Classes/Modules/Segments/Standards/Validators/ConstantValidation.php @@ -0,0 +1,44 @@ + $object->getName(), + 'reference' => $object->getReference(), + 'detail' => $object->getDetail() + ]; + + return $data; + } + + /** + * @return array + */ + protected function rules(): array { + return [ + 'name' => 'required', + 'reference' => 'required', + 'detail' => 'required' + ]; + } + + /** + * @return array + */ + protected function messages(): array { + return []; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/ControllersLogic/CreateServiceTypeLogic.php b/app/Classes/Modules/ServiceTypes/ControllersLogic/CreateServiceTypeLogic.php new file mode 100644 index 00000000..07672f85 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/ControllersLogic/CreateServiceTypeLogic.php @@ -0,0 +1,105 @@ + 'Created Service Type', + 'message' => 'You have successfully created a new Service Type' + ]; + } + + /** @var CanCreateServiceType */ + private $canCreateServiceType; + + /** @var CreatesServiceType */ + private $createsServiceType; + + /** @var CreatesServiceTypeConstantDetails */ + private $createsServiceTypeConstantDetails; + + /** @var UpdatesServiceCurrencyRates */ + private $updatesServiceCurrencyRates; + + /** @var FetchesSegment */ + private $fetchesSegment; + + /** @var CreatesConstant */ + private $createsConstant; + + + /** + * CreateServiceTypeLogic constructor. + * @param CanCreateServiceType $canCreateServiceType + * @param CreatesServiceType $createsServiceType + * @param CreatesServiceTypeConstantDetails $createsServiceTypeConstantDetails + * @param UpdatesServiceCurrencyRates $updatesServiceCurrencyRates + * @param FetchesSegment $fetchesSegment + * @param CreatesConstant $createsConstant + */ + public function __construct(CanCreateServiceType $canCreateServiceType, CreatesServiceType $createsServiceType, CreatesServiceTypeConstantDetails $createsServiceTypeConstantDetails, UpdatesServiceCurrencyRates $updatesServiceCurrencyRates, FetchesSegment $fetchesSegment, CreatesConstant $createsConstant) + { + $this->canCreateServiceType = $canCreateServiceType; + $this->createsServiceType = $createsServiceType; + $this->createsServiceTypeConstantDetails = $createsServiceTypeConstantDetails; + $this->updatesServiceCurrencyRates = $updatesServiceCurrencyRates; + $this->fetchesSegment = $fetchesSegment; + $this->createsConstant = $createsConstant; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + + $object = new ServiceTypeObject($request->input('name')); + + $this->canCreateServiceType->passes($object); + + /** @var ServiceType $service */ + $service = $this->createsServiceType->execute($object); + + $object = new ServiceDetailObject($service->id, (int) $request->input('configurations.bank_id'), + $request->input('configurations.service_charge'), $request->input('configurations.minimum_charge'), $request->input('configurations.tax'), + $request->input('configurations.po_limit'), $request->input('configurations.currencies'), false, $request->input('configurations.billable')); + + $this->updatesServiceCurrencyRates->execute($service, $object->getCurrencies()); + + $constantObject = new ConstantObject('Service Type', SegmentConstants::SERVICE_TYPE, $this->createsServiceTypeConstantDetails->execute($object)); + + $this->createsConstant->execute($this->fetchesSegment->execute(['type' => SegmentConstants::STANDARD_SEGMENT]), $constantObject); + + + return $this->resourceResponse(new ServiceTypeResource($service)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/ControllersLogic/DeleteServiceTypeLogic.php b/app/Classes/Modules/ServiceTypes/ControllersLogic/DeleteServiceTypeLogic.php new file mode 100644 index 00000000..c45c49d9 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/ControllersLogic/DeleteServiceTypeLogic.php @@ -0,0 +1,68 @@ + 'Deleted Service Type', + 'message' => 'You have successfully deleted a Service Type' + ]; + } + + + /** @var CanDeleteServiceType */ + private $canDeleteServiceType; + + /** @var DeletesServiceType */ + private $deletesServiceType; + + /** @var FetchesServiceType */ + private $fetchesServiceType; + + /** + * DeleteServiceTypeLogic constructor. + * @param CanDeleteServiceType $canDeleteServiceType + * @param DeletesServiceType $deletesServiceType + * @param FetchesServiceType $fetchesServiceType + */ + public function __construct(CanDeleteServiceType $canDeleteServiceType, DeletesServiceType $deletesServiceType, FetchesServiceType $fetchesServiceType) + { + $this->canDeleteServiceType = $canDeleteServiceType; + $this->deletesServiceType = $deletesServiceType; + $this->fetchesServiceType = $fetchesServiceType; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + + $this->canDeleteServiceType->passes(); + + $query = $this->fetchesServiceType->execute(['id' => $request->route('id')]); + + $this->deletesServiceType->execute($query); + + return $this->response([]); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/ControllersLogic/FetchServiceTypeLogic.php b/app/Classes/Modules/ServiceTypes/ControllersLogic/FetchServiceTypeLogic.php new file mode 100644 index 00000000..f7835d34 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/ControllersLogic/FetchServiceTypeLogic.php @@ -0,0 +1,62 @@ + 'Retrieved Service Type', + 'message' => 'You have successfully retrieved a Service Type' + ]; + } + + /** @var CanFetchServiceType */ + private $canFetchServiceType; + + /** @var FetchesServiceType */ + private $fetchesServiceType; + + /** + * FetchServiceTypeLogic constructor. + * @param CanFetchServiceType $canFetchServiceType + * @param FetchesServiceType $fetchesServiceType + */ + public function __construct(CanFetchServiceType $canFetchServiceType, FetchesServiceType $fetchesServiceType) + { + $this->canFetchServiceType = $canFetchServiceType; + $this->fetchesServiceType = $fetchesServiceType; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + $this->canFetchServiceType->passes(); + + $query = $this->fetchesServiceType->execute(['id' => $request->route('id')]); + + return $this->resourceResponse(new ServiceTypeResource($query)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/ControllersLogic/ListServiceTypesLogic.php b/app/Classes/Modules/ServiceTypes/ControllersLogic/ListServiceTypesLogic.php new file mode 100644 index 00000000..10b390ae --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/ControllersLogic/ListServiceTypesLogic.php @@ -0,0 +1,62 @@ + 'Retrieved Service Types', + 'message' => 'You have successfully retrieved a list of Service Types' + ]; + } + + /** @var CanListServiceTypes */ + private $canListServiceTypes; + + /** @var ListsServiceTypes */ + private $listsServiceTypes; + + /** + * ListServiceTypesControllerLogic constructor. + * @param CanListServiceTypes $canListServiceTypes + * @param ListsServiceTypes $listsServiceTypes + */ + public function __construct(CanListServiceTypes $canListServiceTypes, ListsServiceTypes $listsServiceTypes) + { + $this->canListServiceTypes = $canListServiceTypes; + $this->listsServiceTypes = $listsServiceTypes; + } + + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + $this->canListServiceTypes->passes(); + + $query = $this->listsServiceTypes->execute($this->listsServiceTypes->deserializeFilters($request->input('filters'))); + + return $this->collectionResponse(ServiceTypeResource::collection($query)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/ControllersLogic/UpdateCustomServiceConstantLogic.php b/app/Classes/Modules/ServiceTypes/ControllersLogic/UpdateCustomServiceConstantLogic.php new file mode 100644 index 00000000..e08ef598 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/ControllersLogic/UpdateCustomServiceConstantLogic.php @@ -0,0 +1,110 @@ + 'Update Segment Service', + 'message' => 'You have successfully update a segments service configuration' + ]; + } + + /** @var FetchesServiceType */ + private $fetchesServiceType; + + /** @var CreatesServiceTypeConstantDetails */ + private $createsServiceTypeConstantDetails; + + /** @var FetchesSegment */ + private $fetchesSegment; + + /** @var FetchesConstant */ + private $fetchesConstant; + + /** @var UpdatesConstant */ + private $updatesConstant; + + /** @var CreatesConstant */ + private $createsConstant; + + /** + * UpdateCustomServiceConstantLogic constructor. + * @param FetchesServiceType $fetchesServiceType + * @param CreatesServiceTypeConstantDetails $createsServiceTypeConstantDetails + * @param FetchesSegment $fetchesSegment + * @param FetchesConstant $fetchesConstant + * @param UpdatesConstant $updatesConstant + * @param CreatesConstant $createsConstant + */ + public function __construct(FetchesServiceType $fetchesServiceType, CreatesServiceTypeConstantDetails $createsServiceTypeConstantDetails, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant, UpdatesConstant $updatesConstant, CreatesConstant $createsConstant) + { + $this->fetchesServiceType = $fetchesServiceType; + $this->createsServiceTypeConstantDetails = $createsServiceTypeConstantDetails; + $this->fetchesSegment = $fetchesSegment; + $this->fetchesConstant = $fetchesConstant; + $this->updatesConstant = $updatesConstant; + $this->createsConstant = $createsConstant; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function logic(Request $request) : JsonResponse + { + + $service = $this->fetchesServiceType->execute(['id' => $request->input('id')]); + + $customFields = $request->input('custom_fields'); + + $object = new ServiceDetailObject($service->id, $customFields['bank_id'], $customFields['service_charge'], + $customFields['minimum_charge'], $customFields['tax'], $customFields['po_limit'], $request->input('configurations.currencies'), + $request->input('configurations.active'), true); + + $constantObject = new ConstantObject('Custom Service Type', SegmentConstants::CUSTOM_SERVICE_TYPE, $this->createsServiceTypeConstantDetails->execute($object, true)); + + /** @var Segment $segment */ + $segment = $this->fetchesSegment->execute(['id' => $request->route('id')]); + + try { + + $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'custom_service_type' => $object->getId()]); + + $this->updatesConstant->execute($constant, $constantObject); + + } catch (ResourceNotFoundException $exception){ + + $constant = $this->createsConstant->execute($segment, $constantObject); + } + + + return $this->resourceResponse(new CustomServiceTypeResource($constant)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/ControllersLogic/UpdateServiceTypeLogic.php b/app/Classes/Modules/ServiceTypes/ControllersLogic/UpdateServiceTypeLogic.php new file mode 100644 index 00000000..51b88051 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/ControllersLogic/UpdateServiceTypeLogic.php @@ -0,0 +1,112 @@ + 'Updated Service Type', + 'message' => 'You have successfully updated the Service Type' + ]; + } + + /** @var CanUpdateServiceType */ + private $canUpdateServiceType; + + /** @var UpdatesServiceType */ + private $updatesServiceType; + + /** @var FetchesServiceType */ + private $fetchesServiceType; + + /** @var CreatesServiceTypeConstantDetails */ + private $createsServiceTypeConstantDetails; + + /** @var UpdatesServiceCurrencyRates */ + private $updatesServiceCurrencyRates; + + /** @var UpdatesConstant */ + private $updatesConstant; + + /** @var FetchesConstant */ + private $fetchesConstant; + + + /** + * UpdateServiceTypeLogic constructor. + * @param CanUpdateServiceType $canUpdateServiceType + * @param UpdatesServiceType $updatesServiceType + * @param FetchesServiceType $fetchesServiceType + * @param CreatesServiceTypeConstantDetails $createsServiceTypeConstantDetails + * @param UpdatesServiceCurrencyRates $updatesServiceCurrencyRates + * @param UpdatesConstant $updatesConstant + * @param FetchesConstant $fetchesConstant + */ + public function __construct(CanUpdateServiceType $canUpdateServiceType, UpdatesServiceType $updatesServiceType, FetchesServiceType $fetchesServiceType, CreatesServiceTypeConstantDetails $createsServiceTypeConstantDetails, UpdatesServiceCurrencyRates $updatesServiceCurrencyRates, UpdatesConstant $updatesConstant, FetchesConstant $fetchesConstant) + { + $this->canUpdateServiceType = $canUpdateServiceType; + $this->updatesServiceType = $updatesServiceType; + $this->fetchesServiceType = $fetchesServiceType; + $this->createsServiceTypeConstantDetails = $createsServiceTypeConstantDetails; + $this->updatesServiceCurrencyRates = $updatesServiceCurrencyRates; + $this->updatesConstant = $updatesConstant; + $this->fetchesConstant = $fetchesConstant; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\AccessForbiddenException + * @throws \App\Classes\Exceptions\MalformedRequestException + * @throws \App\Classes\Exceptions\RequestValidationException + */ + public function logic(Request $request) : JsonResponse + { + $object = new ServiceTypeObject($request->input('name')); + + $this->canUpdateServiceType->passes($object); + + $service = $this->fetchesServiceType->execute(['id' => $request->route('id')]); + + /** @var ServiceType $service */ + $service = $this->updatesServiceType->execute($service, $object); + + $object = new ServiceDetailObject($service->id, (int) $request->input('configurations.bank_id'), + $request->input('configurations.service_charge'), $request->input('configurations.minimum_charge'), $request->input('configurations.tax'), + $request->input('configurations.po_limit'), $request->input('configurations.currencies'), $request->input('configurations.active'), $request->input('configurations.billable')); + + $this->updatesServiceCurrencyRates->execute($service, $object->getCurrencies()); + + $constantObject = new ConstantObject('Service Type', SegmentConstants::SERVICE_TYPE, $this->createsServiceTypeConstantDetails->execute($object)); + + $this->updatesConstant->execute($this->fetchesConstant->execute(['service_type' => $service->id]), $constantObject); + + return $this->resourceResponse(new ServiceTypeResource($service)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/ControllersLogic/UpdateServiceTypeStatusLogic.php b/app/Classes/Modules/ServiceTypes/ControllersLogic/UpdateServiceTypeStatusLogic.php new file mode 100644 index 00000000..f1d75665 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/ControllersLogic/UpdateServiceTypeStatusLogic.php @@ -0,0 +1,59 @@ + 'Update Service Type', + 'message' => 'You have successfully updated a Service Type status' + ]; + } + + /** @var FetchesServiceType */ + private $fetchesServiceType; + + /** @var UpdatesServiceTypeStatus */ + private $updatesServiceTypeStatus; + + /** + * UpdateServiceTypeStatusLogic constructor. + * @param FetchesServiceType $fetchesServiceType + * @param UpdatesServiceTypeStatus $updatesServiceTypeStatus + */ + public function __construct(FetchesServiceType $fetchesServiceType, UpdatesServiceTypeStatus $updatesServiceTypeStatus) + { + $this->fetchesServiceType = $fetchesServiceType; + $this->updatesServiceTypeStatus = $updatesServiceTypeStatus; + } + + /** + * @param Request $request + * @return JsonResponse + */ + public function logic(Request $request) : JsonResponse + { + + + $query = $this->fetchesServiceType->execute(['id' => $request->route('id')]); + + $this->updatesServiceTypeStatus->execute($query, $request->route('status') === 'active' ? ApprovalStatus::APPROVED : ApprovalStatus::SUSPENDED); + + return $this->response([]); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/DataTransferObjects/CustomConfigurationsObject.php b/app/Classes/Modules/ServiceTypes/DataTransferObjects/CustomConfigurationsObject.php new file mode 100644 index 00000000..b14caa8c --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/DataTransferObjects/CustomConfigurationsObject.php @@ -0,0 +1,75 @@ +configurations = $configurations; + $this->customOptions = $customOptions; + } + + /** + * @return SegmentConstant + */ + public function getConfigurations(): SegmentConstant + { + return $this->configurations; + } + + /** + * @return SegmentConstant + */ + public function getCustomOptions(): SegmentConstant + { + return $this->customOptions; + } + + + /** + * @param string $name + * @return mixed + */ + public function getConfigurationValue(string $name) { + return property_exists($this->getCustomOptions()->detail, $name) ? + $this->getCustomOptions()->detail->$name: $this->configurations->detail->$name; + } + + + /** + * @return mixed + */ + public function calculateServiceCharge(){ + return ($this->getConfigurationValue('service_charge')->value * 0.01) > $this->getConfigurationValue('minimum_charge')->value ? + $this->getConfigurationValue('service_charge')->value : $this->getConfigurationValue('minimum_charge')->value; + } + + /** + * @return float + */ + public function calculateTax(){ + return $this->getConfigurationValue('tax')->value * 0.01; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/DataTransferObjects/ServiceCurrenciesObject.php b/app/Classes/Modules/ServiceTypes/DataTransferObjects/ServiceCurrenciesObject.php new file mode 100644 index 00000000..fa32e5dd --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/DataTransferObjects/ServiceCurrenciesObject.php @@ -0,0 +1,90 @@ +id = $id; + $this->isActive = $isActive; + $this->maxLimit = $maxLimit; + $this->minLimit = $minLimit; + $this->rates = $rates; + } + + + /** + * @return int + */ + public function getId(): int + { + return $this->id; + } + + /** + * @return bool + */ + public function isActive(): bool + { + return $this->isActive; + } + + /** + * @return array + */ + public function getMaxLimit(): array + { + return $this->maxLimit; + } + + /** + * @return array + */ + public function getMinLimit(): array + { + return $this->minLimit; + } + + + /** + * @return array + */ + public function getRates(): array + { + return array_map(function($rate){ + return new RateObject($rate['selling'], $rate['payment_method']); + }, $this->rates); + } + + + + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/DataTransferObjects/ServiceDetailObject.php b/app/Classes/Modules/ServiceTypes/DataTransferObjects/ServiceDetailObject.php new file mode 100644 index 00000000..233d1fb3 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/DataTransferObjects/ServiceDetailObject.php @@ -0,0 +1,138 @@ +id = $id; + $this->bankId = $bankId; + $this->serviceCharge = $serviceCharge; + $this->minimumCharge = $minimumCharge; + $this->tax = $tax; + $this->poLimit = $poLimit; + $this->currencies = $currencies; + $this->isActive = $isActive; + $this->isBillable = $isBillable; + } + + /** + * @return int + */ + public function getId(): int + { + return $this->id; + } + + /** + * @return int|null + */ + public function getBankId(): ?int + { + return $this->bankId; + } + + /** + * @return array|null + */ + public function getServiceCharge(): ?array + { + return $this->serviceCharge; + } + + /** + * @return array|null + */ + public function getMinimumCharge(): ?array + { + return $this->minimumCharge; + } + + /** + * @return array|null + */ + public function getTax(): ?array + { + return $this->tax; + } + + /** + * @return array|null + */ + public function getPoLimit(): ?array + { + return $this->poLimit; + } + + /** + * @return bool + */ + public function isActive(): bool + { + return $this->isActive; + } + + /** + * @return bool + */ + public function isBillable(): bool + { + return $this->isBillable; + } + + + /** + * @return array|null + */ + public function getCurrencies(): ?array + { + return array_map(function($currency){ + return new ServiceCurrenciesObject($currency['id'], $currency['active'], $currency['maximum_limit'], $currency['minimum_limit'], $currency['rates']); + }, $this->currencies); + } + + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/DataTransferObjects/ServiceTypeObject.php b/app/Classes/Modules/ServiceTypes/DataTransferObjects/ServiceTypeObject.php new file mode 100644 index 00000000..f65b7262 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/DataTransferObjects/ServiceTypeObject.php @@ -0,0 +1,33 @@ +name = $name; + } + + /** + * @return string + */ + public function getName(): string + { + return $this->name; + } + + + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/CreatesServiceType.php b/app/Classes/Modules/ServiceTypes/Services/CreatesServiceType.php new file mode 100644 index 00000000..e9c05e94 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/CreatesServiceType.php @@ -0,0 +1,19 @@ +name = $object->getName(); + + return $this->handler($model); + + } +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/CreatesServiceTypeConstantDetails.php b/app/Classes/Modules/ServiceTypes/Services/CreatesServiceTypeConstantDetails.php new file mode 100644 index 00000000..aacf66f1 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/CreatesServiceTypeConstantDetails.php @@ -0,0 +1,141 @@ +mapCurrencies($object->$methodName(), $isCustomSegment); + + continue; + } + + $this->addToConstantDetails($methodName, $this->cleanValue($object->$methodName())); + + } + + return $this->ConstantDetails; + + } + + /** + * @param array $currencies + * @param bool $isCustomSegment + */ + private function mapCurrencies(array $currencies, bool $isCustomSegment){ + + $isEmpty = true; + foreach ($currencies as $currency){ + + if(!$currency->isActive()) { continue; } + + $currencyObject = []; + + + foreach (Helper::getClassMethodsArray(ServiceCurrenciesObject::class) as $methodName){ + + if($methodName === 'isActive') continue; + if($methodName === 'getRates') { + $currencyObject['rates'] = $this->mapRates($currency->$methodName(), $isCustomSegment); + continue; + } + + $value = $this->cleanValue($currency->$methodName()); + + if($this->isAddable($value)) { + $isEmpty = false; + $currencyObject[Helper::getPropertyName($methodName)] = $value; + } + + } + + $this->addToCurrencyDetails($currencyObject); + + } + + if($isEmpty) $this->ConstantDetails['currencies'] = []; + + } + + private function mapRates(array $rates, bool $isCustomSegment){ + + if(!$isCustomSegment) return []; + + $ratesObject = []; + + /** @var RateObject $rate */ + foreach ($rates as $rate){ + + $selling = $this->cleanValue($rate->getSelling()); + + if(!$selling['value']) continue; + + $ratesObject[] = [ + 'payment_type' => $rate->getPaymentMethodType(), + 'payment_method' => PaymentMethodType::PAYMENT_METHODS_ID[$rate->getPaymentMethodType()], + 'selling' => $rate->getSelling() + ]; + + } + return $ratesObject; + + } + + + /** + * @param string $methodName + * @param $value + */ + private function addToConstantDetails(string $methodName, $value){ + $this->isAddable($value) ? $this->ConstantDetails[Helper::getPropertyName($methodName)] = $value : null; + } + + /** + * @param $value + * @return bool + */ + private function isAddable($value){ + + return $value !== '' && $value !== null; + } + + private function cleanValue($value){ + + if(is_array($value)) { + if(array_key_exists('value', $value)) $value['value'] = floatval(str_replace(',', '', $value['value'])); + } + + return $value; + } + + /** + * @param array $value + */ + private function addToCurrencyDetails(array $value){ + $this->ConstantDetails['currencies'][] = $value; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/DeletesServiceType.php b/app/Classes/Modules/ServiceTypes/Services/DeletesServiceType.php new file mode 100644 index 00000000..3cc4d69d --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/DeletesServiceType.php @@ -0,0 +1,15 @@ +handler($model); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/FetchesServiceBankConfigurations.php b/app/Classes/Modules/ServiceTypes/Services/FetchesServiceBankConfigurations.php new file mode 100644 index 00000000..28843e4d --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/FetchesServiceBankConfigurations.php @@ -0,0 +1,27 @@ +fetchesBank = $fetchesBank; + } + + public function execute(SegmentConstant $constants) + { + return $this->fetchesBank->execute(['id' => $constants->detail->bank_id]); + } +} diff --git a/app/Classes/Modules/ServiceTypes/Services/FetchesServiceConfigurations.php b/app/Classes/Modules/ServiceTypes/Services/FetchesServiceConfigurations.php new file mode 100644 index 00000000..d641d641 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/FetchesServiceConfigurations.php @@ -0,0 +1,65 @@ +fetchesConstant = $fetchesConstant; + $this->fetchesServiceCurrenciesConfigurations = $fetchesServiceCurrenciesConfigurations; + $this->fetchesServiceBankConfigurations = $fetchesServiceBankConfigurations; + } + + + public function execute(SegmentConstant $constant, string $type){ + + return array_merge([ + 'active' => (int) $constant->detail->is_active ?? false, + 'billable' => (int) $constant->detail->is_billable ?? false, + 'bank_id' => property_exists($constant->detail, 'bank_id') ? $constant->detail->bank_id : '', + 'bank_info' => property_exists($constant->detail, 'bank_id') ? $this->fetchesServiceBankConfigurations->execute($constant) : '', + 'currencies' => $this->fetchesServiceCurrenciesConfigurations->execute($constant) + ], $this->addConfigurations($constant)->toArray()); + + } + + private function addConfigurations(SegmentConstant $constant) { + + $configurations = collect(['service_charge', 'minimum_charge', 'tax', 'po_limit']); + + return $configurations->flatMap(function($configuration) use($constant) { + if(!property_exists($constant->detail, $configuration)) return []; + + return [$configuration => [ + 'type' => $constant->detail->$configuration->type, + 'value' => $configuration !== 'po_limit' ? $this->covertToDecimal($constant->detail->$configuration->value) : $constant->detail->$configuration->value + ]]; + + }); + + } + + private function covertToDecimal($value){ + return number_format((float)$value, 2, '.', ''); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/FetchesServiceCurrenciesConfigurations.php b/app/Classes/Modules/ServiceTypes/Services/FetchesServiceCurrenciesConfigurations.php new file mode 100644 index 00000000..7d00225a --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/FetchesServiceCurrenciesConfigurations.php @@ -0,0 +1,69 @@ +fetchesCurrency = $fetchesCurrency; + } + + public function execute(SegmentConstant $constants){ + + $currencies = array_map(function($configuration) use($constants){ + + $currency = $this->fetchesCurrency->execute(['id' => $configuration->id]); + + if(! $currency->exists()) return []; + + return json_decode(json_encode([ + 'currency_object' => new CurrencyResource($currency), + 'id' => $configuration->id, + 'active' => true, + 'maximum_limit' => [ + 'type' => $configuration->max_limit->type, + 'value' => number_format((float)$configuration->max_limit->value, 2, '.', ',') + ], + 'minimum_limit' => [ + 'type' => $configuration->min_limit->type, + 'value' => number_format((float)$configuration->min_limit->value, 2, '.', ',') + ], + 'rates' => $constants->reference === SegmentConstants::SERVICE_TYPE ? $this->standardRates($currency->rates->where('service_id', $constants->detail->id)) : $configuration->rates + ])); + + }, $constants->detail->currencies); + + return array_filter($currencies); + + } + + private function standardRates(Collection $rates){ + return $rates->map(function($rate){ + return [ + 'payment_method' => PaymentMethodType::PAYMENT_METHODS_ID[$rate->payment_method_type], + 'selling' => [ + 'type' => 'rate', + 'value' => $rate->selling + ] + ]; + }); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/FetchesServiceType.php b/app/Classes/Modules/ServiceTypes/Services/FetchesServiceType.php new file mode 100644 index 00000000..7b5899fa --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/FetchesServiceType.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/ListsServiceTypes.php b/app/Classes/Modules/ServiceTypes/Services/ListsServiceTypes.php new file mode 100644 index 00000000..344d6c4d --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/ListsServiceTypes.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/UpdatesServiceCurrencyRates.php b/app/Classes/Modules/ServiceTypes/Services/UpdatesServiceCurrencyRates.php new file mode 100644 index 00000000..019d30b4 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/UpdatesServiceCurrencyRates.php @@ -0,0 +1,55 @@ +createsRateLog = $createsRateLog; + } + + + /** + * @param ServiceType $service + * @param array $currencies + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function execute(ServiceType $service, array $currencies){ + + /** @var ServiceCurrenciesObject $currency */ + foreach ($currencies as $currency) { + + /** @var RateObject $rate */ + foreach ($currency->getRates() as $rate){ + if($rate->getSelling()['value'] > 0){ + /** @var CurrencyRate $query */ + $query = $service->rates()->updateOrCreate([ + 'currency_id' => $currency->getId(), + 'payment_method_type' => $rate->getPaymentMethodType() + ], ['selling' => $rate->getSelling()['value']]); + + $this->createsRateLog->execute($query); + } + + } + + } + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/UpdatesServiceType.php b/app/Classes/Modules/ServiceTypes/Services/UpdatesServiceType.php new file mode 100644 index 00000000..06bd1e4f --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/UpdatesServiceType.php @@ -0,0 +1,19 @@ +name = $object->getName(); + + return $this->handler($model); + + } +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Services/UpdatesServiceTypeStatus.php b/app/Classes/Modules/ServiceTypes/Services/UpdatesServiceTypeStatus.php new file mode 100644 index 00000000..065b218e --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Services/UpdatesServiceTypeStatus.php @@ -0,0 +1,19 @@ +status = $status; + + return $this->handler($model); + + } +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Standards/Rules/CanCreateServiceType.php b/app/Classes/Modules/ServiceTypes/Standards/Rules/CanCreateServiceType.php new file mode 100644 index 00000000..0fb57c32 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Standards/Rules/CanCreateServiceType.php @@ -0,0 +1,57 @@ +serviceTypeValidation = $serviceTypeValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param ServiceTypeObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->serviceTypeValidation->validate($object); + + } + + + /** + * @param ServiceTypeObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Standards/Rules/CanDeleteServiceType.php b/app/Classes/Modules/ServiceTypes/Standards/Rules/CanDeleteServiceType.php new file mode 100644 index 00000000..1a832257 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Standards/Rules/CanDeleteServiceType.php @@ -0,0 +1,43 @@ +serviceTypeValidation = $serviceTypeValidation; + } + + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + + } + + /** + * @param ServiceTypeObject $object + * @return bool + * @throws \App\Classes\Exceptions\RequestValidationException + */ + protected function validators($object): bool + { + return $this->serviceTypeValidation->validate($object); + + } + + + /** + * @param ServiceTypeObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/ServiceTypes/Standards/Validators/ServiceTypeValidation.php b/app/Classes/Modules/ServiceTypes/Standards/Validators/ServiceTypeValidation.php new file mode 100644 index 00000000..86946a39 --- /dev/null +++ b/app/Classes/Modules/ServiceTypes/Standards/Validators/ServiceTypeValidation.php @@ -0,0 +1,39 @@ + $object->getName() + ]; + } + + /** + * @return array + */ + protected function rules(): array { + return [ + 'name' => 'required' + ]; + } + + /** + * @return array + */ + protected function messages(): array { + return []; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php new file mode 100644 index 00000000..b6edcc5f --- /dev/null +++ b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php @@ -0,0 +1,192 @@ + 'Create Supplier Transactions', + 'message' => 'You have successfully created currency supplier transactions' + ]; + } + + /** @var FetchesPackingList */ + private $fetchesPackingList; + + /** @var FetchesSegmentConstant */ + private $fetchesSegmentConstant; + + /** @var GeneratesTransactionBillNumber */ + private $generatesTransactionBillNumber; + + /** @var CreatesTransaction */ + private $createsTransaction; + + // /** @var FetchesTransaction */ + // private $fetchesTransaction; + // /** @var UpdatesTransactionStatus */ + // private $updatesTransactionStatus; + // /** @var CreatesDocument */ + // private $createsDocument; + // /** @var CreatesFiles */ + // private $createsFile; + // /** @var PDF */ + // private $pdf; + + /** + * CreateSupplierTransactionLogic constructor. + * @param FetchesPackingList $fetchesPackingList + * @param GeneratesTransactionBillNumber $generatesTransactionBillNumber + * @param CreatesTransaction $createsTransaction + * @param FetchesTransaction $fetchesTransaction + * @param UpdatesTransactionStatus $updatesTransactionStatus + * @param PDF $pdf + */ + public function __construct( + FetchesPackingList $fetchesPackingList, + FetchesSegmentConstant $fetchesSegmentConstant, + GeneratesTransactionBillNumber $generatesTransactionBillNumber, + CreatesTransaction $createsTransaction + + // UpdatesTransactionStatus $updatesTransactionStatus, + // CreatesDocument $createsDocument, + // CreatesFiles $createsFile, + // PDF $pdf + ) + { + + $this->fetchesPackingList = $fetchesPackingList; + $this->fetchesSegmentConstant = $fetchesSegmentConstant; + $this->generatesTransactionBillNumber = $generatesTransactionBillNumber; + $this->createsTransaction = $createsTransaction; + + // $this->updatesTransactionStatus = $updatesTransactionStatus; + // $this->createsDocument = $createsDocument; + // $this->createsFile = $createsFile; + // $this->pdf = $pdf; + } + + public function logic(Request $request) : JsonResponse + { + $packing_list = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]); + + $cbm = $packing_list->packages->sum(function($package) { + return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity); + }); + + $order = $packing_list->owner()->first(); + $address = $order->addresses()->first(); + + $base_price_constant = $this->fetchesSegmentConstant->execute(['id' => 1]); + $warehouse_rate_constant = $this->fetchesSegmentConstant->execute(['id' => 2]); + $state_rate_constant = $this->fetchesSegmentConstant->execute(['id' => 3]); + $center_postcode_constant = $this->fetchesSegmentConstant->execute(['id' => 4]); + $outstation_postcode_constant = $this->fetchesSegmentConstant->execute(['id' => 5]); + + $base_price = 0; + $warehouse_rate = 0; + $state_rate = 0; + $state_select = []; + $with_out = false; + + if ($base_price_constant) { + $base_price = $base_price_constant->value->price; + } + + if ($warehouse_rate_constant) { + $package_warehouse = $order->OrderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee->reference; + foreach ($warehouse_rate_constant->value->config as $key_warehouse => $row_warehouse) { + if ($row_warehouse->warehouse_name == $package_warehouse) { + $warehouse_rate = $row_warehouse->rate; + } + } + } + + if ($state_rate_constant) { + foreach ($state_rate_constant->value->config as $key_state => $row_state) { + if ($row_state->status_id == $address->state_id) { + $state_select = $row_state; + } + } + } + + if ($outstation_postcode_constant) { + foreach ($outstation_postcode_constant->value as $key_out => $row_out) { + + if($row_out == $address->postcode) { + $with_out = true; + } + } + } + + if (!empty($state_select)) { + $state_rate = $state_select->rate; + if ($with_out) { + $state_rate = $state_select->rate + $state_select->outstation_rate; + } + } + + $price_cbm = $base_price + $warehouse_rate + $state_rate; + $total_cbm = $price_cbm * $cbm; + + $billNumber = $this->generatesTransactionBillNumber->execute('SHIP-'); + + $object = new TransactionObject( + $billNumber, + TransactionType::SHIPPING_INVOICE, + 1, + $order->company_module_id, + 1, + PaymentMethodType::CASH, + $total_cbm, + $total_cbm, + 1, + 1, + 0, + 0, + 0, + null, + ApprovalStatus::PENDING_SUBMISSION + ); + + $transactions = $this->createsTransaction->execute($packing_list, $object); + + return $this->response([]); + } +} diff --git a/app/Classes/Modules/Transactions/DataTransferObjects/TransactionObject.php b/app/Classes/Modules/Transactions/DataTransferObjects/TransactionObject.php index 8fcf4ece..b4153751 100644 --- a/app/Classes/Modules/Transactions/DataTransferObjects/TransactionObject.php +++ b/app/Classes/Modules/Transactions/DataTransferObjects/TransactionObject.php @@ -76,7 +76,24 @@ class TransactionObject implements DataTransferObject * @param int|null $status * @param array|null $details */ - public function __construct(string $billNo, string $transactionType, int $issuer, int $receiver, int $recipientBankAccountId, int $paymentMethod, float $amount, float $originalAmount, int $currencyId, int $originalCurrencyId, float $currencyRate, float $tax, float $serviceCharge, ?Carbon $expiresOn, ?int $status = ApprovalStatus::PENDING_SUBMISSION, ?array $details = []) + public function __construct( + string $billNo, + string $transactionType, + int $issuer, + int $receiver, + int $recipientBankAccountId, + int $paymentMethod, + float $amount, + float $originalAmount, + int $currencyId, + int $originalCurrencyId, + float $currencyRate, + float $tax, + float $serviceCharge, + ?Carbon $expiresOn, + ?int $status = ApprovalStatus::PENDING_SUBMISSION, + ?array $details = [] + ) { $this->billNo = $billNo; $this->transactionType = $transactionType; diff --git a/app/Classes/Modules/Transactions/Services/CreatesTransaction.php b/app/Classes/Modules/Transactions/Services/CreatesTransaction.php index ddebf0d5..18d57727 100644 --- a/app/Classes/Modules/Transactions/Services/CreatesTransaction.php +++ b/app/Classes/Modules/Transactions/Services/CreatesTransaction.php @@ -5,7 +5,7 @@ namespace App\Classes\Modules\Transactions\Services; use App\Classes\General\Eloquent\AbstractUpdateRecord; use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord; use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject; -use App\Models\Booking; +use App\Models\PackingList; use App\Models\Transaction; class CreatesTransaction extends AbstractUpdateRelationshipRecord @@ -15,7 +15,7 @@ class CreatesTransaction extends AbstractUpdateRelationshipRecord * @return \Illuminate\Database\Eloquent\Model * @throws \App\Classes\Exceptions\MalformedRequestException */ - public function execute(Booking $booking, TransactionObject $object) { + public function execute(PackingList $packing_list, TransactionObject $object) { $model = new Transaction(); $model->bill_no = $object->getBillNo(); $model->type = $object->getTransactionType(); @@ -33,8 +33,6 @@ class CreatesTransaction extends AbstractUpdateRelationshipRecord $model->expires_on = $object->getExpiresOn(); $model->status = $object->getStatus(); - - return $this->handler($booking->transactions(), $model); - + return $this->handler($packing_list->transactions(), $model); } } \ No newline at end of file diff --git a/app/Classes/Modules/Transports/Services/UpdatesTransportStatus.php b/app/Classes/Modules/Transports/Services/UpdatesTransportStatus.php new file mode 100644 index 00000000..2898156a --- /dev/null +++ b/app/Classes/Modules/Transports/Services/UpdatesTransportStatus.php @@ -0,0 +1,24 @@ +status = $status; + + return $this->handler($model); + + } +} diff --git a/app/Classes/ValueObjects/Constants/SegmentConstants.php b/app/Classes/ValueObjects/Constants/SegmentConstants.php index 80e9cb71..88be0247 100644 --- a/app/Classes/ValueObjects/Constants/SegmentConstants.php +++ b/app/Classes/ValueObjects/Constants/SegmentConstants.php @@ -5,19 +5,19 @@ namespace App\Classes\ValueObjects\Constants; class SegmentConstants { - public const STANDARD_SEGMENT = 1; public const CUSTOM_SEGMENT = 2; - public const SYSTEM_PRIMARY_CURRENCY = 'SYSTEM_PRIMARY_CURRENCY'; + public const BASE_PRICE = 'BASE_PRICE'; - public const SUPPLIER_CURRENCIES = 'SUPPLIER_CURRENCIES'; + public const WAREHOUSE_RATE = 'WAREHOUSE_RATE'; - public const PAYMENT_ATTEMPT_DURATION_LIMIT = 'PAYMENT_ATTEMPT_DURATION_LIMIT'; + public const STATE_RATE = 'STATE_RATE'; - public const SERVICE_TYPE = 'SERVICE_TYPE'; + public const CENTER_POSTCODE = 'CENTER_POSTCODE'; - public const CUSTOM_SERVICE_TYPE = 'CUSTOM_SERVICE_TYPE'; + public const OUTSTATION_POSTCODE = 'OUTSTATION_POSTCODE'; + public const CUSTOMER_RATE = 'CUSTOMER_RATE'; } \ No newline at end of file diff --git a/app/Classes/ValueObjects/Constants/TransactionType.php b/app/Classes/ValueObjects/Constants/TransactionType.php index 8a5f1075..d61589fa 100644 --- a/app/Classes/ValueObjects/Constants/TransactionType.php +++ b/app/Classes/ValueObjects/Constants/TransactionType.php @@ -4,24 +4,26 @@ namespace App\Classes\ValueObjects\Constants; final class TransactionType { - public const PAYMENT_ATTEMPT = 0; + public const SHIPPING_INVOICE = 1; + + // public const PAYMENT_ATTEMPT = 0; - public const PAYMENT = 1; + // public const PAYMENT = 1; - public const INVOICE = 2; + // public const INVOICE = 2; - public const BILL = 3; + // public const BILL = 3; - public const PERFORMA = 4; + // public const PERFORMA = 4; - public const TOP_UP = 5; + // public const TOP_UP = 5; - public const REFUND = 6; + // public const REFUND = 6; - public const PURCHASE_ORDER = 7; + // public const PURCHASE_ORDER = 7; - public const SUPPLIER_DELIVER = 8; + // public const SUPPLIER_DELIVER = 8; - public const SHIPPING_COST = 9; + // public const SHIPPING_COST = 9; } diff --git a/app/Http/Controllers/Addresses/ListStatesController.php b/app/Http/Controllers/Addresses/ListStatesController.php new file mode 100644 index 00000000..dee2d1c6 --- /dev/null +++ b/app/Http/Controllers/Addresses/ListStatesController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Announcements/ListAnnouncementsController.php b/app/Http/Controllers/Announcements/ListAnnouncementsController.php index a69dff50..2dcee4d7 100644 --- a/app/Http/Controllers/Announcements/ListAnnouncementsController.php +++ b/app/Http/Controllers/Announcements/ListAnnouncementsController.php @@ -17,4 +17,4 @@ class ListAnnouncementsController { return $logic->execute($request); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/Announcements/UpdateAnnouncementController.php b/app/Http/Controllers/Announcements/UpdateAnnouncementController.php index 72431980..8d406632 100644 --- a/app/Http/Controllers/Announcements/UpdateAnnouncementController.php +++ b/app/Http/Controllers/Announcements/UpdateAnnouncementController.php @@ -18,4 +18,3 @@ class UpdateAnnouncementController return $logic->execute($request); } } - diff --git a/app/Http/Controllers/Companies/AddNewMemberController.php b/app/Http/Controllers/Companies/AddNewMemberController.php new file mode 100644 index 00000000..6307ac37 --- /dev/null +++ b/app/Http/Controllers/Companies/AddNewMemberController.php @@ -0,0 +1,22 @@ +execute($request); + } +} diff --git a/app/Http/Controllers/Documents/UpdateDocumentReferenceController.php b/app/Http/Controllers/Documents/UpdateDocumentReferenceController.php new file mode 100644 index 00000000..f14d1b8b --- /dev/null +++ b/app/Http/Controllers/Documents/UpdateDocumentReferenceController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Exports/ExportContainerPackingListController.php b/app/Http/Controllers/Exports/ExportContainerPackingListController.php new file mode 100644 index 00000000..6e5d845d --- /dev/null +++ b/app/Http/Controllers/Exports/ExportContainerPackingListController.php @@ -0,0 +1,19 @@ +headers->set('Authorization', 'Bearer '.$token); + $exportsContainerPackingList->setId($request->route('id')); + return $exportsContainerPackingList->download('customer-container-packing-list.csv', Excel::CSV, ['Content-Type' => 'text/csv']); + } +} diff --git a/app/Http/Controllers/PackingLists/AssignPackingListOrderController.php b/app/Http/Controllers/PackingLists/AssignPackingListOrderController.php new file mode 100644 index 00000000..7498d863 --- /dev/null +++ b/app/Http/Controllers/PackingLists/AssignPackingListOrderController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} diff --git a/app/Http/Controllers/Segments/CreateSegmentController.php b/app/Http/Controllers/Segments/CreateSegmentController.php index 4e748536..2950bdc3 100644 --- a/app/Http/Controllers/Segments/CreateSegmentController.php +++ b/app/Http/Controllers/Segments/CreateSegmentController.php @@ -16,5 +16,4 @@ class CreateSegmentController public function create(Request $request, CreateSegmentLogic $logic): JsonResponse { return $logic->execute($request); } - } \ No newline at end of file diff --git a/app/Http/Controllers/Segments/FetchConstantController.php b/app/Http/Controllers/Segments/FetchConstantController.php new file mode 100644 index 00000000..e3658802 --- /dev/null +++ b/app/Http/Controllers/Segments/FetchConstantController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Segments/FetchSegmentController.php b/app/Http/Controllers/Segments/FetchSegmentController.php new file mode 100644 index 00000000..91961689 --- /dev/null +++ b/app/Http/Controllers/Segments/FetchSegmentController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Segments/ListSegmentsController.php b/app/Http/Controllers/Segments/ListSegmentsController.php new file mode 100644 index 00000000..3dc14ebd --- /dev/null +++ b/app/Http/Controllers/Segments/ListSegmentsController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Segments/UpdateConstantController.php b/app/Http/Controllers/Segments/UpdateConstantController.php new file mode 100644 index 00000000..47def571 --- /dev/null +++ b/app/Http/Controllers/Segments/UpdateConstantController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Segments/UpdateCustomServiceConstantController.php b/app/Http/Controllers/Segments/UpdateCustomServiceConstantController.php new file mode 100644 index 00000000..29bb6655 --- /dev/null +++ b/app/Http/Controllers/Segments/UpdateCustomServiceConstantController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Segments/UpdateSegmentController.php b/app/Http/Controllers/Segments/UpdateSegmentController.php new file mode 100644 index 00000000..51dfe25e --- /dev/null +++ b/app/Http/Controllers/Segments/UpdateSegmentController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Transactions/CreateShippingInvoiceTransactionController.php b/app/Http/Controllers/Transactions/CreateShippingInvoiceTransactionController.php new file mode 100644 index 00000000..d9f35b7c --- /dev/null +++ b/app/Http/Controllers/Transactions/CreateShippingInvoiceTransactionController.php @@ -0,0 +1,21 @@ +execute($request); + } +} diff --git a/app/Http/Resources/ConstantResource.php b/app/Http/Resources/ConstantResource.php new file mode 100644 index 00000000..c6bcf344 --- /dev/null +++ b/app/Http/Resources/ConstantResource.php @@ -0,0 +1,27 @@ + $this->id, + 'name' => $this->name, + 'reference' => $this->reference, + 'detail' => (App()->make(ConvertsConstantDetailsToResource::class))->execute($this->resource) + ]; + } +} diff --git a/app/Http/Resources/CustomServiceTypeResource.php b/app/Http/Resources/CustomServiceTypeResource.php new file mode 100644 index 00000000..8ec26e47 --- /dev/null +++ b/app/Http/Resources/CustomServiceTypeResource.php @@ -0,0 +1,27 @@ + $this->detail->id, + 'name' => ServiceType::where('id', $this->detail->id)->first()->name, + 'detail' => $this->detail, + 'configurations' => (App()->make(FetchesServiceConfigurations::class))->execute($this->resource, SegmentConstants::CUSTOM_SERVICE_TYPE) + ]; + } +} diff --git a/app/Http/Resources/DistrictResource.php b/app/Http/Resources/DistrictResource.php index c0c24f73..0f5a01dc 100644 --- a/app/Http/Resources/DistrictResource.php +++ b/app/Http/Resources/DistrictResource.php @@ -18,7 +18,8 @@ class DistrictResource extends JsonResource 'id' => $this->id, 'city' => $this->name, 'state' => $this->state, - 'country' => $this->country + 'country' => $this->country, + 'postcode' => $this->postcode, ]; } } diff --git a/app/Http/Resources/PackageResource.php b/app/Http/Resources/PackageResource.php index 2cd76a1b..09880dc8 100644 --- a/app/Http/Resources/PackageResource.php +++ b/app/Http/Resources/PackageResource.php @@ -3,6 +3,7 @@ namespace App\Http\Resources; use App\Models\Order; +use App\Models\PackingList; use Illuminate\Http\Resources\Json\JsonResource; class PackageResource extends JsonResource @@ -16,6 +17,8 @@ class PackageResource extends JsonResource public function toArray($request) { + $originalPackingList = $this->packingList->owner instanceof PackingList ? $this->packingList->owner : $this->packingList; + return [ 'id' => $this->id, 'type' => $this->type, @@ -27,9 +30,11 @@ class PackageResource extends JsonResource 'quantity' => $this->quantity, 'cbm' => (($this->width / 100) * ($this->height / 100) * ($this->length / 100)) * $this->quantity, 'status' => $this->status, - 'order' => New OrderResource($this->packingList->owner instanceof Order ? $this->packingList->owner : $this->packingList->owner->owner), - 'container' => new ContainerResource($this->packingList->owner instanceof Order ? $this->container : $this->packingList->owner->containers()->first()), - 'transport' => new TransportResource($this->packingList->owner instanceof Order ? $this->transport : $this->packingList->owner->transports()->first()) + $this->mergeWhen($originalPackingList->owner instanceof Order, [ + 'order' => New OrderResource($originalPackingList->owner) + ]), + 'container' => new ContainerResource($originalPackingList->containers()->first()), + 'transport' => new TransportResource($originalPackingList->transports()->first()) ]; } } diff --git a/app/Http/Resources/PackingListNullOrderResource.php b/app/Http/Resources/PackingListNullOrderResource.php new file mode 100644 index 00000000..63af1466 --- /dev/null +++ b/app/Http/Resources/PackingListNullOrderResource.php @@ -0,0 +1,29 @@ +packingLists()->first(); + + return [ + 'id' => $this->id, + 'claimant_id' => $this->claimant_id, + 'reference' => $this->reference, + 'status' => $this->status, + 'type' => $this->type, + ]; + } +} diff --git a/app/Http/Resources/ScheduleResource.php b/app/Http/Resources/ScheduleResource.php index 64532420..d22386b4 100644 --- a/app/Http/Resources/ScheduleResource.php +++ b/app/Http/Resources/ScheduleResource.php @@ -3,6 +3,7 @@ namespace App\Http\Resources; use Illuminate\Http\Resources\Json\JsonResource; +use Carbon\Carbon; class ScheduleResource extends JsonResource { @@ -18,6 +19,10 @@ class ScheduleResource extends JsonResource 'id' => $this->id, 'etd' => $this->etd ? $this->etd->format('d-m-Y') : 'n/a', 'eta' => $this->eta ? $this->eta->format('d-m-Y') : 'n/a', + 'billing_days_left' => [ + 'value' => (Carbon::parse($this->eta)->subDays(7)->gt(Carbon::now())) ? '+' : '-' , + 'duration' => Carbon::parse($this->eta)->subDays(7)->diffInDays(Carbon::now()), + ], 'status' => $this->status, ]; } diff --git a/app/Http/Resources/StateResource.php b/app/Http/Resources/StateResource.php new file mode 100644 index 00000000..b9d71dae --- /dev/null +++ b/app/Http/Resources/StateResource.php @@ -0,0 +1,23 @@ + $this->id, + 'name' => $this->name, + 'country' => $this->country, + ]; + } +} diff --git a/app/Models/PackingList.php b/app/Models/PackingList.php index 7ef5910a..a6fd95e5 100644 --- a/app/Models/PackingList.php +++ b/app/Models/PackingList.php @@ -5,6 +5,8 @@ namespace App\Models; use App\Classes\General\Interfaces\Steppable; use App\Classes\General\Interfaces\Transportable; use App\Classes\General\Interfaces\Packable; +use App\Classes\General\Interfaces\Transactionable; + use App\Classes\ValueObjects\Constants\ApprovalStatus; use Carbon\Carbon; use Illuminate\Database\Eloquent\Relations\BelongsToMany; @@ -16,7 +18,7 @@ use Staudenmeir\EloquentHasManyDeep\HasManyDeep; use Staudenmeir\EloquentHasManyDeep\HasRelationships; use Staudenmeir\EloquentHasManyDeep\HasTableAlias; -class PackingList extends AbstractModel implements Transportable, Steppable, Packable +class PackingList extends AbstractModel implements Transportable, Steppable, Packable, Transactionable { use HasTableAlias; use HasRelationships; @@ -55,6 +57,14 @@ class PackingList extends AbstractModel implements Transportable, Steppable, Pac return $this->hasMany(Package::class, 'packing_list_id'); } + /** + * @return MorphMany + */ + public function transactions(): MorphMany + { + return $this->MorphMany(Transaction::class, 'owner'); + } + /** * @return HasManyDeep */ diff --git a/app/Models/SegmentConstant.php b/app/Models/SegmentConstant.php index 08c8b2af..42cadb7d 100644 --- a/app/Models/SegmentConstant.php +++ b/app/Models/SegmentConstant.php @@ -15,12 +15,8 @@ use Illuminate\Database\Eloquent\SoftDeletes; */ class SegmentConstant extends AbstractModel { - use SoftDeletes; - protected $table = 'segment_constants'; - protected $dates = ['deleted_at']; - public function getDetailAttribute($value) { return $value ? json_decode($value) : []; @@ -34,14 +30,9 @@ class SegmentConstant extends AbstractModel return $this->BelongsTo(Segment::class, 'segment_id', 'id'); } - /** - * @return mixed - */ - public function service(){ - return $this->hasOne(ServiceType::class, 'id', 'detail->id') - ->whereIn('reference', [SegmentConstants::SERVICE_TYPE, SegmentConstants::CUSTOM_SERVICE_TYPE]); + public function getValueAttribute($value) + { + $value = $value ? json_decode($value) : []; + return $value; } - - - } diff --git a/app/Models/State.php b/app/Models/State.php index fa920454..3f7036ac 100644 --- a/app/Models/State.php +++ b/app/Models/State.php @@ -2,7 +2,7 @@ namespace App\Models; -use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; /** @@ -21,10 +21,10 @@ class State extends AbstractModel protected $dates = ['deleted_at']; /** - * @return HasOne + * @return BelongsTo */ - public function country(): HasOne + public function country(): BelongsTo { - return $this->hasOne(Country::class, 'country_id', 'id'); + return $this->belongsTo(Country::class, 'country_id', 'id'); } } diff --git a/database/seeders/SegmentConstantsTableSeeder.php b/database/seeders/SegmentConstantsTableSeeder.php index 9eb5d50a..2fc68bf0 100644 --- a/database/seeders/SegmentConstantsTableSeeder.php +++ b/database/seeders/SegmentConstantsTableSeeder.php @@ -1,54 +1,162 @@ fetchesCurrency = $fetchesCurrency; - $this->fetchesSegment = $fetchesSegment; - $this->createsSegmentConstant = $createsSegmentConstant; - } - - - /** - * Run the database seeds. - * - * @return void - * @throws \App\Classes\Exceptions\MalformedRequestException - */ public function run() { + DB::beginTransaction(); - $object = new ConstantObject('System Primary Currency', - SegmentConstants::SYSTEM_PRIMARY_CURRENCY, - ['id' => $this->fetchesCurrency->execute(['name' => country('my')->getName()])->id]); - - $this->createsSegmentConstant->execute($this->fetchesSegment->execute(['Standard Segment']), $object); - + DB::table('segment_constants')->insert([ + [ + 'id' => 1, + 'segment_id' => 1, + 'reference' => SegmentConstants::BASE_PRICE, + 'value' => json_encode([ + 'id'=> 1, + 'price' => 500, + ]), + ], + [ + 'id' => 2, + 'segment_id' => 1, + 'reference' => SegmentConstants::WAREHOUSE_RATE, + 'value' => json_encode([ + 'id'=> 1, + 'config' => [ + [ + 'warehouse_name' => WarehouseReferences::VT_GUANG_ZHOU, + 'rate' => 10 + ], + [ + 'warehouse_name' => WarehouseReferences::YD_GUANG_ZHOU, + 'rate' => 10 + ], + [ + 'warehouse_name' => WarehouseReferences::VT_YIWU, + 'rate' => 10 + ], + ] + ]), + ], + [ + 'id' => 3, + 'segment_id' => 1, + 'reference' => SegmentConstants::STATE_RATE, + 'value' => json_encode([ + 'id'=> 1, + 'config' => [ + [ + 'status_id' => 1, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 2, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 3, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 4, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 5, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 6, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 7, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 8, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 9, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 10, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 11, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 12, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 13, + 'rate' => 20, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 14, + 'rate' => 20, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 15, + 'rate' => 10, + 'outstation_rate' => 2 + ], + [ + 'status_id' => 16, + 'rate' => 10, + 'outstation_rate' => 2 + ] + ] + ]), + ], + [ + 'id' => 4, + 'segment_id' => 1, + 'reference' => SegmentConstants::CENTER_POSTCODE, + 'value' => json_encode(['80050','80100','80150','80200','80250','80300','80350','80400','80500','80506','80508','80516','80519','80534','80536','80542','80546','80558','80560','80564','80568','80578','80584','80586','80590','80592','80594','80596','80600','80604','80608','80620','80622','80628','80644','80648','80662','80664','80668','80670','80672','80673','80676','80700','80710','80720','80730','80900','80902','80904','80906','80908','80988','80990','81000','81100','81200','81300','81310']), + ], + [ + 'id' => 5, + 'segment_id' => 1, + 'reference' => SegmentConstants::OUTSTATION_POSTCODE, + 'value' => json_encode(['80000']), + ], + [ + 'id' => 6, + 'segment_id' => 2, + 'reference' => SegmentConstants::CUSTOMER_RATE, + 'value' => json_encode([ + 'id'=> 1, + 'price' => 15, + ]), + ], + ]); + DB::commit(); } } diff --git a/database/seeders/SegmentsTableSeeder.php b/database/seeders/SegmentsTableSeeder.php index 4c9e19be..72545884 100644 --- a/database/seeders/SegmentsTableSeeder.php +++ b/database/seeders/SegmentsTableSeeder.php @@ -2,24 +2,26 @@ namespace Database\Seeders; -use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject; -use App\Classes\Modules\Segments\Services\CreatesSegment; -use App\Classes\ValueObjects\Constants\SegmentConstants; use Illuminate\Database\Seeder; use Illuminate\Support\Facades\DB; class SegmentsTableSeeder extends Seeder { - - - /** - */ public function run() { - - DB::table('segments')->insert([ - 'name' => 'Standard Segment', - 'type' => SegmentConstants::STANDARD_SEGMENT - ]); + DB::table('segments')->insert( + [ + [ + 'id' => 1, + 'company_module_id' => 1, + 'name' => 'Default Segment', + ], + [ + 'id' => 2, + 'company_module_id' => 2, + 'name' => 'Normal Member', + ], + ] + ); } } diff --git a/resources/assets/sass/modules/_typography.scss b/resources/assets/sass/modules/_typography.scss index dbc80e6f..a22dc2fc 100644 --- a/resources/assets/sass/modules/_typography.scss +++ b/resources/assets/sass/modules/_typography.scss @@ -643,6 +643,10 @@ hr{ cursor: pointer !important; } +.not-allowed { + cursor: not-allowed !important; +} + /* Labels ------------------------------------ */ diff --git a/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue b/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue index c5c26590..29edf834 100644 --- a/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue +++ b/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue @@ -63,9 +63,21 @@
Company Name
-
+
-
{{item.owner.name}}
+
{{item.owner.name}}
+
+
+
+
+ +
+
+
+
+ +
+
@@ -77,9 +89,21 @@
{{ item.owner.type === 0 ? 'IC' : 'SSM Registration' }} Number
-
+
-
{{item.reference}}
+
{{item.reference}}
+
+
+
+
+ +
+
+
+
+ +
+
@@ -182,7 +206,9 @@ export default { data() { return { - expanded: false + expanded: false, + isEditIdentificationNumber: false, + isEditCompanyName: false, } }, methods: { diff --git a/resources/assets/vue/components/companies/forms/UpdateCompanyNameFormComponent.vue b/resources/assets/vue/components/companies/forms/UpdateCompanyNameFormComponent.vue new file mode 100644 index 00000000..fb79da89 --- /dev/null +++ b/resources/assets/vue/components/companies/forms/UpdateCompanyNameFormComponent.vue @@ -0,0 +1,40 @@ + + diff --git a/resources/assets/vue/components/companies/forms/UpdateIdentificationNumberFormComponent.vue b/resources/assets/vue/components/companies/forms/UpdateIdentificationNumberFormComponent.vue new file mode 100644 index 00000000..7fe3a240 --- /dev/null +++ b/resources/assets/vue/components/companies/forms/UpdateIdentificationNumberFormComponent.vue @@ -0,0 +1,49 @@ + + diff --git a/resources/assets/vue/components/containers/elements/ContainerComponent.vue b/resources/assets/vue/components/containers/elements/ContainerComponent.vue index eecb8fa7..8230862a 100644 --- a/resources/assets/vue/components/containers/elements/ContainerComponent.vue +++ b/resources/assets/vue/components/containers/elements/ContainerComponent.vue @@ -22,10 +22,22 @@

ETD

{{item.transport ? item.transport.current_schedule.etd : 'n/a'}}

-
+

ETA

{{item.transport ? item.transport.current_schedule.eta : 'n/a'}}

+
+
+
+

Days Ago

+

+ {{item.transport.current_schedule.billing_days_left.value}} + {{item.transport.current_schedule.billing_days_left.duration}} + days +

+
+
+

Packages

{{ item.packages_count }}

diff --git a/resources/assets/vue/components/containers/elements/ContainerSearchComponent.vue b/resources/assets/vue/components/containers/elements/ContainerSearchComponent.vue new file mode 100644 index 00000000..ac674d56 --- /dev/null +++ b/resources/assets/vue/components/containers/elements/ContainerSearchComponent.vue @@ -0,0 +1,82 @@ + + + diff --git a/resources/assets/vue/components/containers/elements/PackingListComponent.vue b/resources/assets/vue/components/containers/elements/PackingListComponent.vue index 92c3541a..d1b37139 100644 --- a/resources/assets/vue/components/containers/elements/PackingListComponent.vue +++ b/resources/assets/vue/components/containers/elements/PackingListComponent.vue @@ -1,18 +1,35 @@ diff --git a/resources/assets/vue/components/containers/forms/DeclarePostcodeAreaFormComponent.vue b/resources/assets/vue/components/containers/forms/DeclarePostcodeAreaFormComponent.vue new file mode 100644 index 00000000..506d6472 --- /dev/null +++ b/resources/assets/vue/components/containers/forms/DeclarePostcodeAreaFormComponent.vue @@ -0,0 +1,68 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/orders/elements/UnclaimedPackinglistComponent.vue b/resources/assets/vue/components/orders/elements/UnclaimedPackinglistComponent.vue new file mode 100644 index 00000000..eef618d7 --- /dev/null +++ b/resources/assets/vue/components/orders/elements/UnclaimedPackinglistComponent.vue @@ -0,0 +1,44 @@ + + diff --git a/resources/assets/vue/components/orders/forms/ClaimPackinglistFormComponent.vue b/resources/assets/vue/components/orders/forms/ClaimPackinglistFormComponent.vue new file mode 100644 index 00000000..afa6384c --- /dev/null +++ b/resources/assets/vue/components/orders/forms/ClaimPackinglistFormComponent.vue @@ -0,0 +1,58 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/orders/sections/OrdersTableSectionComponent.vue b/resources/assets/vue/components/orders/sections/OrdersTableSectionComponent.vue new file mode 100644 index 00000000..d7766718 --- /dev/null +++ b/resources/assets/vue/components/orders/sections/OrdersTableSectionComponent.vue @@ -0,0 +1,290 @@ + + diff --git a/resources/assets/vue/components/settings/elements/CurrenciesListComponent.vue b/resources/assets/vue/components/settings/elements/CurrenciesListComponent.vue new file mode 100644 index 00000000..3554a8f2 --- /dev/null +++ b/resources/assets/vue/components/settings/elements/CurrenciesListComponent.vue @@ -0,0 +1,218 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/elements/ListPostcodeComponent.vue b/resources/assets/vue/components/settings/elements/ListPostcodeComponent.vue new file mode 100644 index 00000000..a23f3a7c --- /dev/null +++ b/resources/assets/vue/components/settings/elements/ListPostcodeComponent.vue @@ -0,0 +1,53 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/elements/PaymentAttemptComponent.vue b/resources/assets/vue/components/settings/elements/PaymentAttemptComponent.vue new file mode 100644 index 00000000..6266afbe --- /dev/null +++ b/resources/assets/vue/components/settings/elements/PaymentAttemptComponent.vue @@ -0,0 +1,151 @@ + + + + diff --git a/resources/assets/vue/components/settings/elements/StatesChargesComponent.vue b/resources/assets/vue/components/settings/elements/StatesChargesComponent.vue new file mode 100644 index 00000000..9e58b60d --- /dev/null +++ b/resources/assets/vue/components/settings/elements/StatesChargesComponent.vue @@ -0,0 +1,77 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/elements/UserProfileComponent.vue b/resources/assets/vue/components/settings/elements/UserProfileComponent.vue new file mode 100644 index 00000000..fd42e9b9 --- /dev/null +++ b/resources/assets/vue/components/settings/elements/UserProfileComponent.vue @@ -0,0 +1,67 @@ + + + diff --git a/resources/assets/vue/components/settings/elements/WarehouseChargesComponent.vue b/resources/assets/vue/components/settings/elements/WarehouseChargesComponent.vue new file mode 100644 index 00000000..59611841 --- /dev/null +++ b/resources/assets/vue/components/settings/elements/WarehouseChargesComponent.vue @@ -0,0 +1,65 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/AnnouncementFormComponent.vue b/resources/assets/vue/components/settings/forms/AnnouncementFormComponent.vue new file mode 100644 index 00000000..a29f7572 --- /dev/null +++ b/resources/assets/vue/components/settings/forms/AnnouncementFormComponent.vue @@ -0,0 +1,128 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/DeleteAnnouncementFormComponent.vue b/resources/assets/vue/components/settings/forms/DeleteAnnouncementFormComponent.vue new file mode 100644 index 00000000..5c59b264 --- /dev/null +++ b/resources/assets/vue/components/settings/forms/DeleteAnnouncementFormComponent.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue b/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue new file mode 100644 index 00000000..d44cd44f --- /dev/null +++ b/resources/assets/vue/components/settings/forms/EditEmailFormComponent.vue @@ -0,0 +1,58 @@ + + diff --git a/resources/assets/vue/components/settings/forms/EditStateChargesFormComponent.vue b/resources/assets/vue/components/settings/forms/EditStateChargesFormComponent.vue new file mode 100644 index 00000000..ac4052c6 --- /dev/null +++ b/resources/assets/vue/components/settings/forms/EditStateChargesFormComponent.vue @@ -0,0 +1,62 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/EditUserProfileFullnameFormComponent.vue b/resources/assets/vue/components/settings/forms/EditUserProfileFullnameFormComponent.vue new file mode 100644 index 00000000..95e79174 --- /dev/null +++ b/resources/assets/vue/components/settings/forms/EditUserProfileFullnameFormComponent.vue @@ -0,0 +1,51 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/EditWarehouseChargesFormComponent.vue b/resources/assets/vue/components/settings/forms/EditWarehouseChargesFormComponent.vue new file mode 100644 index 00000000..a078576f --- /dev/null +++ b/resources/assets/vue/components/settings/forms/EditWarehouseChargesFormComponent.vue @@ -0,0 +1,54 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/PaymentAttemptLimitFormComponent.vue b/resources/assets/vue/components/settings/forms/PaymentAttemptLimitFormComponent.vue new file mode 100644 index 00000000..63be0142 --- /dev/null +++ b/resources/assets/vue/components/settings/forms/PaymentAttemptLimitFormComponent.vue @@ -0,0 +1,111 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/ResetUserPasswordFormComponent.vue b/resources/assets/vue/components/settings/forms/ResetUserPasswordFormComponent.vue new file mode 100644 index 00000000..1a735522 --- /dev/null +++ b/resources/assets/vue/components/settings/forms/ResetUserPasswordFormComponent.vue @@ -0,0 +1,44 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/SegmentFormComponent.vue b/resources/assets/vue/components/settings/forms/SegmentFormComponent.vue new file mode 100644 index 00000000..c8f114cf --- /dev/null +++ b/resources/assets/vue/components/settings/forms/SegmentFormComponent.vue @@ -0,0 +1,59 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/SegmentServiceFormComponent.vue b/resources/assets/vue/components/settings/forms/SegmentServiceFormComponent.vue new file mode 100644 index 00000000..5405ae6e --- /dev/null +++ b/resources/assets/vue/components/settings/forms/SegmentServiceFormComponent.vue @@ -0,0 +1,293 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/ServiceFormComponent.vue b/resources/assets/vue/components/settings/forms/ServiceFormComponent.vue new file mode 100644 index 00000000..eac2a388 --- /dev/null +++ b/resources/assets/vue/components/settings/forms/ServiceFormComponent.vue @@ -0,0 +1,218 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/UpdateServiceStatusFormComponent.vue b/resources/assets/vue/components/settings/forms/UpdateServiceStatusFormComponent.vue new file mode 100644 index 00000000..aef5b89f --- /dev/null +++ b/resources/assets/vue/components/settings/forms/UpdateServiceStatusFormComponent.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/user/elements/UserComponent.vue b/resources/assets/vue/components/user/elements/UserComponent.vue new file mode 100644 index 00000000..601c0097 --- /dev/null +++ b/resources/assets/vue/components/user/elements/UserComponent.vue @@ -0,0 +1,61 @@ + + + \ No newline at end of file diff --git a/resources/assets/vue/components/user/form/DeleteUserFormComponent.vue b/resources/assets/vue/components/user/form/DeleteUserFormComponent.vue new file mode 100644 index 00000000..cb8af386 --- /dev/null +++ b/resources/assets/vue/components/user/form/DeleteUserFormComponent.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/user/form/UserFormComponent.vue b/resources/assets/vue/components/user/form/UserFormComponent.vue new file mode 100644 index 00000000..5d283733 --- /dev/null +++ b/resources/assets/vue/components/user/form/UserFormComponent.vue @@ -0,0 +1,117 @@ + + \ No newline at end of file diff --git a/resources/views/emails/layout/base.blade.php b/resources/views/emails/layout/base.blade.php index 0f58c396..ec9a6f85 100644 --- a/resources/views/emails/layout/base.blade.php +++ b/resources/views/emails/layout/base.blade.php @@ -82,6 +82,9 @@ .pointer { cursor: pointer; } + .not-allowed { + cursor: not-allowed; + } .text-complete { color: #009add; } diff --git a/resources/views/pages/containers.blade.php b/resources/views/pages/containers.blade.php index b8ab329b..b4f2acb8 100644 --- a/resources/views/pages/containers.blade.php +++ b/resources/views/pages/containers.blade.php @@ -1,13 +1,5 @@ @extends('layouts.base_portal') @section('inner_content') -
-
-
Search
-
-
-
Filter
-
-
@@ -15,8 +7,9 @@
+ -
+
diff --git a/resources/views/pages/orders/table.blade.php b/resources/views/pages/orders/table.blade.php new file mode 100644 index 00000000..9f42cef6 --- /dev/null +++ b/resources/views/pages/orders/table.blade.php @@ -0,0 +1,13 @@ + + +@extends('layouts.base_portal') +@section('inner_content') + {{--
--}} + {{--
--}} + {{--
--}} + {{--
Refresh Orders
--}} + {{--
--}} + {{--
--}} + {{----}} + +@endsection \ No newline at end of file diff --git a/resources/views/pages/settings.blade.php b/resources/views/pages/settings.blade.php new file mode 100644 index 00000000..b6d89f9f --- /dev/null +++ b/resources/views/pages/settings.blade.php @@ -0,0 +1,445 @@ +@extends('layouts.base_portal') +@section('inner_content') +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
User Profile
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ Account Settings +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/pages/unclaimed_packinglist.blade.php b/resources/views/pages/unclaimed_packinglist.blade.php new file mode 100644 index 00000000..451ea574 --- /dev/null +++ b/resources/views/pages/unclaimed_packinglist.blade.php @@ -0,0 +1,13 @@ +@extends('layouts.base_portal') +@section('inner_content') +
+
+ + + + +
+
+@endsection \ No newline at end of file diff --git a/resources/views/partials/header.blade.php b/resources/views/partials/header.blade.php index d3a15ad2..685d3f27 100644 --- a/resources/views/partials/header.blade.php +++ b/resources/views/partials/header.blade.php @@ -17,6 +17,15 @@
+
diff --git a/resources/views/partials/menu.blade.php b/resources/views/partials/menu.blade.php index c32eb3df..cf62bda3 100644 --- a/resources/views/partials/menu.blade.php +++ b/resources/views/partials/menu.blade.php @@ -129,6 +129,14 @@
Shipping Queue
+
+
+ +
+
+
Settings
+
+
diff --git a/routes/address.php b/routes/address.php index 5b3c6a1b..96cfe8ab 100644 --- a/routes/address.php +++ b/routes/address.php @@ -11,6 +11,8 @@ Route::group(['prefix' => 'address', 'as' => 'address.', 'namespace' => 'Address Route::get('district/list', 'ListDistrictsController@list')->name('district.list'); + Route::get('state/list', 'ListStatesController@list')->name('state.list'); + Route::post('/create', 'CreateAddressController@create')->name('create'); Route::put('/update/{id}', 'UpdateAddressController@update')->name('update'); diff --git a/routes/announcement.php b/routes/announcement.php index 6b460a01..b6016706 100644 --- a/routes/announcement.php +++ b/routes/announcement.php @@ -5,12 +5,11 @@ use Illuminate\Support\Facades\Route; Route::group(['prefix' => 'announcement', 'as' => 'announcement.', 'namespace' => 'Announcements'], function () { Route::get('/list', 'ListAnnouncementsController@list')->name('list'); Route::post('/create', 'CreateAnnouncementController@create')->name('create'); - Route::put('/update/{id}', 'UpdateAnnouncementController@update')->name('update'); + Route::put('/update/{id}', 'UpdateAnnouncementController@update')->name('update'); Route::delete('/delete/{id}', 'DeleteAnnouncementController@delete')->name('delete'); - - Route::group(['prefix' => '/{id}/segment', 'as' => 'segment.'], function () { + + Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () { Route::post('/assign', 'AssignAnnouncementToSegmentController@assign')->name('assign'); Route::delete('/detach/{segment_id}', 'RemoveSegmentFromAnnouncementController@detach')->name('detach'); }); - }); \ No newline at end of file diff --git a/routes/api.php b/routes/api.php index b53b1b95..c8f886e1 100644 --- a/routes/api.php +++ b/routes/api.php @@ -52,6 +52,8 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function require __DIR__ . '/segment.php'; + require __DIR__ . '/announcement.php'; + Route::get('/report/customer/{marking}/{from?}/{to?}', 'Reports\MonthlyReportController@customerReport')->name('report.customer'); Route::get('/report/sales/{from?}/{to?}', 'Reports\MonthlyReportController@salesReport')->name('report.sales'); Route::get('/report/profit/{model}/{value}/{from?}/{to?}', 'Reports\MonthlyReportController@profitModelReport')->name('report.profit'); diff --git a/routes/company.php b/routes/company.php index 7d898117..55c731b2 100644 --- a/routes/company.php +++ b/routes/company.php @@ -9,6 +9,8 @@ Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Compani Route::put('/update/{id}', 'UpdateCompanyController@update')->name('update'); Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete'); + Route::post('/team/create', 'AddNewMemberController@create')->name('team.create'); + Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () { Route::post('/assign', 'AssignCompanyToSegmentController@assign')->name('assign'); Route::delete('/detach/{segment_id}', 'RemoveCompanyFromSegmentController@detach')->name('detach'); diff --git a/routes/document.php b/routes/document.php index 12419c9e..06f6badc 100644 --- a/routes/document.php +++ b/routes/document.php @@ -6,4 +6,6 @@ Route::group(['prefix' => 'document', 'as' => 'document.', 'namespace' => 'Docum Route::get('/list', 'ListDocumentsController@list')->name('list'); Route::put('/{id}/approve', 'ApproveDocumentController@approve')->name('status.approve'); Route::put('/{id}/reject', 'RejectDocumentController@reject')->name('status.reject'); + + Route::put('/{id}/reference/update', 'UpdateDocumentReferenceController@update')->name('reference.update'); }); \ No newline at end of file diff --git a/routes/packing_list.php b/routes/packing_list.php index 6716ada9..fe889ddb 100644 --- a/routes/packing_list.php +++ b/routes/packing_list.php @@ -17,6 +17,8 @@ Route::group(['namespace' => 'PackingLists', 'as' => 'packing_list.', 'prefix' = Route::put('/update-drop-date/{id}', 'UpdateDropDatePackingListController@update')->name('update_drop_date'); Route::put('/complete/{id}', 'CompletePackingListController@complete')->name('complete'); Route::put('/assign-remark/{id}', 'AssignPackingListRemarkController@create')->name('assign.remark'); + Route::put('/assign-order/{id}/{reference}', 'AssignPackingListOrderController@assign')->name('assign.order'); + Route::group(['namespace' => 'Containers', 'prefix' => 'container', 'as' => 'container.'], function () { Route::get('/{id}/show', 'FetchContainerController@fetch')->name('show'); diff --git a/routes/segment.php b/routes/segment.php index edde7247..ada2b84d 100644 --- a/routes/segment.php +++ b/routes/segment.php @@ -5,4 +5,13 @@ use Illuminate\Support\Facades\Route; Route::group(['prefix' => 'segment', 'as' => 'segment.', 'namespace' => 'Segments'], function () { Route::post('/create', 'CreateSegmentController@create')->name('create'); Route::delete('/delete/{id}', 'DeleteSegmentController@destroy')->name('delete'); + Route::get('/{id}/show', 'FetchSegmentController@fetch')->name('show'); + Route::put('/update/{id}', 'UpdateSegmentController@update')->name('update'); + Route::get('/list', 'ListSegmentsController@list')->name('list'); + + Route::group(['prefix' => '{id}/constant', 'as' => 'constant.'], function () { + Route::put('/service/update', 'UpdateCustomServiceConstantController@update')->name('service.update'); + Route::put('/update', 'UpdateConstantController@update')->name('update'); + Route::get('/show/{reference}', 'FetchConstantController@fetch')->name('show'); + }); }); \ No newline at end of file diff --git a/routes/transaction.php b/routes/transaction.php index cab4d241..7b4f7fd0 100644 --- a/routes/transaction.php +++ b/routes/transaction.php @@ -5,11 +5,13 @@ use Illuminate\Support\Facades\Route; Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' => 'transaction.'], function () { Route::get('/list', 'ListTransactionsController@list')->name('list'); - Route::delete('/suspend/{id}', 'SuspendTransactionController@suspend')->name('suspend'); + // Route::delete('/suspend/{id}', 'SuspendTransactionController@suspend')->name('suspend'); - route::post('/supplier/{id}/bill/create', 'CreateSupplierTransactionController@create')->name('supplier.create'); - route::post('{id}/bill/verification', 'CreatePaymentProofDocumentController@verify')->name('bill.verification'); + route::post('/shipping-invoice/create', 'CreateShippingInvoiceTransactionController@create')->name('supplier.create'); - Route::post('booking/{id}/details/update', 'CreatePurchaseOrderTransactionController@create')->name('po.create'); + + // route::post('{id}/bill/verification', 'CreatePaymentProofDocumentController@verify')->name('bill.verification'); + + // Route::post('booking/{id}/details/update', 'CreatePurchaseOrderTransactionController@create')->name('po.create'); }); \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index fba7ac9f..e29f6333 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,7 +3,6 @@ use App\Classes\Jobs\FetchContainersStatusUpdateFromVTPortalJob; use App\Classes\Jobs\FetchDeliveryListFromVTPortalJob; use App\Classes\Jobs\FetchLoadedContainersFromVTPortalJob; -use App\Classes\Jobs\FetchOrdersFromYDPortalJob; use App\Classes\Jobs\FetchPackingListFromVTPortalJob; use App\Classes\Jobs\FetchWarehouseReceiveListFromVTPortalJob; use App\Classes\Modules\PackingLists\Processors\FetchOrderListsFromYdPortalProcessor; @@ -64,6 +63,10 @@ Route::get('/orders', function () { return view('pages.orders.index'); })->name('orders'); +Route::get('/orders-table', function () { + return view('pages.orders.table'); +})->name('ordersTable'); + Route::get('/order/show/{order_number}', function ($orderNumber) { return view('pages.orders.profile', ['id' => $orderNumber]); })->name('order.show'); @@ -76,6 +79,10 @@ Route::get('/warehouse-list', function () { return view('pages.warehouse_list'); })->name('warehouse.list'); +Route::get('/unclaimed-packinglist', function () { + return view('pages.unclaimed_packinglist'); +})->name('unclaimed-packinglist.list'); + Route::get('/containers', function () { return view('pages.containers'); })->name('containers'); @@ -186,3 +193,11 @@ Route::get('/yd', function (){ }); Route::get('/export/customer-latest-order-date/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export'); +Route::get('/export/packing-list/{id}', 'Exports\ExportContainerPackingListController@export')->name('container.packaging_list.export'); + +Route::get('/settings', function () { + return view('pages.settings'); +})->name('settings'); +Route::get('/settings', function () { + return view('pages.settings'); +})->name('settings');