diff --git a/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php b/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php new file mode 100644 index 00000000..3568ac3b --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/DoesNotHaveTransactionType.php @@ -0,0 +1,20 @@ +whereDoesntHave('transactions', function (Builder $query) use($value) { + $query->where('type', $value); + }); + } +} \ No newline at end of file diff --git a/app/Classes/General/Eloquent/Filters/HasInvoiceStatusIn.php b/app/Classes/General/Eloquent/Filters/HasInvoiceStatusIn.php new file mode 100644 index 00000000..e02c5791 --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/HasInvoiceStatusIn.php @@ -0,0 +1,20 @@ +whereHas('transactions', function (Builder $query) use($value) { + $query->where('type', 1)->whereIn('status', $value); + }); + } +} \ No newline at end of file diff --git a/app/Classes/General/Eloquent/Filters/HasTransactionType.php b/app/Classes/General/Eloquent/Filters/HasTransactionType.php new file mode 100644 index 00000000..f2d20c2f --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/HasTransactionType.php @@ -0,0 +1,20 @@ +whereHas('transactions', function (Builder $query) use($value) { + $query->where('type', $value); + }); + } +} \ No newline at end of file diff --git a/app/Classes/General/Eloquent/Filters/TargetId.php b/app/Classes/General/Eloquent/Filters/TargetId.php new file mode 100644 index 00000000..2bd7045e --- /dev/null +++ b/app/Classes/General/Eloquent/Filters/TargetId.php @@ -0,0 +1,21 @@ +where('target_type', User::class)->where('target_id', $value); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Companies/ControllersLogic/ApproveIdentificationDocumentLogic.php b/app/Classes/Modules/Companies/ControllersLogic/ApproveIdentificationDocumentLogic.php index 0d3f007a..af42a35a 100644 --- a/app/Classes/Modules/Companies/ControllersLogic/ApproveIdentificationDocumentLogic.php +++ b/app/Classes/Modules/Companies/ControllersLogic/ApproveIdentificationDocumentLogic.php @@ -14,6 +14,8 @@ use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Documents\Services\FetchesDocument; use App\Classes\Modules\Documents\Services\ApprovesDocument; +use App\Classes\Modules\Notifications\DataTransferObjects\NotificationObject; +Use App\Classes\Modules\Notifications\Processors\CreateNotificationProcessor; use App\Models\Document; use Illuminate\Http\JsonResponse; @@ -50,6 +52,9 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic /** @var UpdatesOrdersStatus */ private $updatesOrdersStatus; + /** @var CreateNotificationProcessor */ + private $createNotificationProcessor; + /** * ApproveIdentificationDocumentLogic constructor. * @param CanApproveDocument $canApproveDocument @@ -58,8 +63,9 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic * @param FetchesDocument $fetchesDocument * @param UpdatesCompanyStatus $updatesCompanyStatus * @param UpdatesOrdersStatus $updatesOrdersStatus + * @param CreateNotificationProcessor $createNotificationProcessor */ - public function __construct(CanApproveDocument $canApproveDocument, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, UpdatesCompanyStatus $updatesCompanyStatus, UpdatesOrdersStatus $updatesOrdersStatus) + public function __construct(CanApproveDocument $canApproveDocument, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, UpdatesCompanyStatus $updatesCompanyStatus, UpdatesOrdersStatus $updatesOrdersStatus, CreateNotificationProcessor $createNotificationProcessor) { $this->canApproveDocument = $canApproveDocument; $this->approvesDocument = $approvesDocument; @@ -67,6 +73,7 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic $this->fetchesDocument = $fetchesDocument; $this->updatesCompanyStatus = $updatesCompanyStatus; $this->updatesOrdersStatus = $updatesOrdersStatus; + $this->createNotificationProcessor = $createNotificationProcessor; } /** @@ -90,6 +97,16 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic $this->updatesCompanyStatus->execute($document->owner, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED); + $object = new NotificationObject( + 'ID Verification ' . ( $status === 'approve' ? 'Approved' : 'Rejected' ), + ( $status === 'approve' ? 'Dear user, congratulations that your ' : 'Dear user, we are sorry to inform you that your ' ) . ( $document->type === 'IDENTITY_CARD' ? 'IC' : 'SSM' ) . ( $status === 'approve' ? ' has been approved. Start your first order now!' : ' has been rejected due to ' . ( $request->input('rejectRemark') ?? '' ) . ', please resubmit it for further action.' ), + $document->owner, + $document->owner->companyModules()->first()->employees()->first(), + $document, + ); + + $this->createNotificationProcessor->execute($object); + if($status === 'approve'){ $orders = $this->updatesOrdersStatus->execute($document->owner, ApprovalStatus::APPROVED); } diff --git a/app/Classes/Modules/Exports/Services/ExportsCompanyModuleSummary.php b/app/Classes/Modules/Exports/Services/ExportsCompanyModuleSummary.php new file mode 100644 index 00000000..9ee2459b --- /dev/null +++ b/app/Classes/Modules/Exports/Services/ExportsCompanyModuleSummary.php @@ -0,0 +1,91 @@ +companyModuleId = $companyModuleId; + $this->containerIds = $containerIds; + } + + /** + * @return \Illuminate\Support\Collection|mixed + */ + public function collection() + { + $packagesArray = collect(); + $containers = Container::whereIn('reference', explode(',', $this->containerIds))->get(); + foreach ($containers as $container){ + $company_module_id = $this->companyModuleId; + $packingLists = $container->packingLists()->get()->filter(function ($packingList) use ($company_module_id) { + return $packingList->owner->company_module_id == $company_module_id; + }); + foreach ($packingLists as $packingList){ + if($packingList->packingLists->first()){ + $packingList = $packingList->packingLists->first(); + } + $packages = $packingList->packages; + foreach ($packages as $package){ + $packagesArray->push($package); + } + } + } + + return $packagesArray; + } + + /** + * @param Package $package + * + * @return array + */ + public function map($package): array + { + $connection = $package->packingList->owner->companyModule->inviters()->withPivot('invitee_reference')->first(); + $marking = $connection ? $connection->pivot->invitee_reference:''; + + return [ + Carbon::parse($package->created_at)->format('d-m-Y'), + $marking, + $package->packingList->containers()->first()->reference, + $package->description, + $package->quantity, + $package->length, + $package->height, + $package->width, + ((($package->length / 100) * ($package->height / 100) * ($package->width / 100)) * $package->quantity) + ]; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Notifications/ControllersLogic/ListNotificationsLogic.php b/app/Classes/Modules/Notifications/ControllersLogic/ListNotificationsLogic.php new file mode 100644 index 00000000..0fdbf6f9 --- /dev/null +++ b/app/Classes/Modules/Notifications/ControllersLogic/ListNotificationsLogic.php @@ -0,0 +1,61 @@ + 'Retrieve Notifications', + 'message' => 'You have successfully retrieved a list of Notifications' + ]; + } + + /** @var ListsNotification */ + private $listsNotification; + + /** + * ListNotificationsLogic constructor. + * @param ListsNotification $listsNotification + */ + public function __construct( + ListsNotification $listsNotification + ) + { + $this->listsNotification = $listsNotification; + } + + + /** + * @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 + { + + $filters = [ + // 'target_id'=>auth()->user()->id, + // 'per_page'=>$request->route('per_page') + ]; + + $notifications = $this->listsNotification->execute($filters); + + return $this->collectionResponse(NotificationResource::collection($notifications)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Notifications/Services/ListsNotification.php b/app/Classes/Modules/Notifications/Services/ListsNotification.php new file mode 100644 index 00000000..707e7ae8 --- /dev/null +++ b/app/Classes/Modules/Notifications/Services/ListsNotification.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/PackingLists/ControllersLogic/ReschedulePackingListLogic.php b/app/Classes/Modules/PackingLists/ControllersLogic/ReschedulePackingListLogic.php index 097b7e1e..50371cc6 100644 --- a/app/Classes/Modules/PackingLists/ControllersLogic/ReschedulePackingListLogic.php +++ b/app/Classes/Modules/PackingLists/ControllersLogic/ReschedulePackingListLogic.php @@ -56,28 +56,23 @@ class ReschedulePackingListLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { - try { - $packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]); + $packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]); - $transport = $packing_list->transports()->first(); + $transport = $packing_list->transports()->first(); - $old_sechedule = $transport->schedules()->first(); + $old_sechedule = $transport->schedules()->first(); - $this->updatesScheduleStatus->execute($old_sechedule, ApprovalStatus::REJECTED); + $this->updatesScheduleStatus->execute($old_sechedule, ApprovalStatus::REJECTED); - $scheduleObject = new ScheduleObject( - Carbon::parse($request->input('eta')), - Carbon::parse($request->input('etd')), - ApprovalStatus::APPROVED - ); - $schedule = $this->createsSchedule->execute($transport, $scheduleObject); - - return $this->resourceResponse(new PackingListResource($packing_list)); - - } catch (\Exception $exception){ - throw new ErrorException($exception->getMessage(), $exception->getCode()); - } + $scheduleObject = new ScheduleObject( + Carbon::parse($request->input('eta')), + Carbon::parse($request->input('etd')), + ApprovalStatus::APPROVED + ); + + $schedule = $this->createsSchedule->execute($transport, $scheduleObject); + return $this->resourceResponse(new PackingListResource($packing_list)); } } diff --git a/app/Classes/Modules/Segments/ControllersLogic/CreateBasePriceLogic.php b/app/Classes/Modules/Segments/ControllersLogic/CreateBasePriceLogic.php new file mode 100644 index 00000000..a589995c --- /dev/null +++ b/app/Classes/Modules/Segments/ControllersLogic/CreateBasePriceLogic.php @@ -0,0 +1,121 @@ + 'Create Base Price', + 'message' => 'You have successfully created a Base Price' + ]; + } + + /** @var CanUpdateConstant */ + private $canUpdateConstant; + + /** @var UpdatesConstant */ + private $updatesConstant; + + /** @var FetchesSegment */ + private $fetchesSegment; + + /** @var FetchesConstant */ + private $fetchesConstant; + + /** @var CanCreateConstant */ + private $canCreateConstant; + + /** @var CreatesConstant */ + private $createsConstant; + + + /** @var UpdatesBasePriceConstantByDates */ + private $updatesBasePriceConstantByDates; + + /** + * UpdateConstantLogic constructor. + * @param CanUpdateConstant $canUpdateConstant + * @param UpdatesConstant $updatesConstant + * @param FetchesSegment $fetchesSegment + * @param FetchesConstant $fetchesConstant + * @param CanCreateConstant $canCreateConstant + * @param CreatesConstant $createsConstant + * @param UpdatesBasePriceConstantByDates $updatesBasePriceConstantByDates + */ + public function __construct( + CanUpdateConstant $canUpdateConstant, + UpdatesConstant $updatesConstant, + FetchesSegment $fetchesSegment, + FetchesConstant $fetchesConstant, + CanCreateConstant $canCreateConstant, + CreatesConstant $createsConstant, + UpdatesBasePriceConstantByDates $updatesBasePriceConstantByDates + ) + { + $this->canUpdateConstant = $canUpdateConstant; + $this->updatesConstant = $updatesConstant; + $this->fetchesSegment = $fetchesSegment; + $this->fetchesConstant = $fetchesConstant; + $this->canCreateConstant = $canCreateConstant; + $this->createsConstant = $createsConstant; + $this->updatesBasePriceConstantByDates = $updatesBasePriceConstantByDates; + } + /** + * @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 + { + $segment = $this->fetchesSegment->execute(['id' => $request->route('id')]); + + try { + + $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => SegmentConstants::BASE_PRICE]); + + } catch (ResourceNotFoundException $exception){ + + $constantObject = []; + + $object = new ConstantObject( + SegmentConstants::BASE_PRICE, + $constantObject + ); + + $constant = $this->createsConstant->execute($segment, $object); + } + + $constantValue = $this->updatesBasePriceConstantByDates->execute($constant->value, $request->input('dateFrom'), $request->input('dateTo'), $request->input('rate')); + + $object = new ConstantObject(SegmentConstants::BASE_PRICE, $constantValue); + + $this->canUpdateConstant->passes($object); + + $constant = $this->updatesConstant->execute($constant, $object); + + return $this->resourceResponse(new ConstantResource($constant)); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/ControllersLogic/FetchBasePriceLogic.php b/app/Classes/Modules/Segments/ControllersLogic/FetchBasePriceLogic.php new file mode 100644 index 00000000..49d24bd3 --- /dev/null +++ b/app/Classes/Modules/Segments/ControllersLogic/FetchBasePriceLogic.php @@ -0,0 +1,68 @@ + 'Retrieved Base Price', + 'message' => 'You have successfully retrieved the Base Price' + ]; + } + + + /** @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' => SegmentConstants::BASE_PRICE]); + + $constantObject = (array) $constant->value; + + if ($request->input('dateFrom') !== null && $request->input('dateTo') !== null) { + + $period = CarbonPeriod::create($request->input('dateFrom'), $request->input('dateTo')); + + $returnObject = []; + + foreach ($period as $date) { + array_key_exists($date->format('Y-m-d'), $constantObject) === true ? $returnObject[$date->format('Y-m-d')] = $constantObject[$date->format('Y-m-d')] : ''; + } + + $constant->value = json_encode($returnObject); + + } + + return $this->resourceResponse(new ConstantResource($constant)); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/ControllersLogic/ListAirShipmentPriceLogic.php b/app/Classes/Modules/Segments/ControllersLogic/ListAirShipmentPriceLogic.php new file mode 100644 index 00000000..c6265f65 --- /dev/null +++ b/app/Classes/Modules/Segments/ControllersLogic/ListAirShipmentPriceLogic.php @@ -0,0 +1,178 @@ + 'Retrieved Air Shipment Price List', + 'message' => 'You have successfully retrieved a list of Air Shipment Price' + ]; + } + + + /** @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'))); + + // category - Dimension / perKg + $price = array( + + [ + 'details' => json_encode([ + 'name' => 'Sound system speakers - MINI', + 'pricePerKg' => '', + 'pricePerPcs' => '', + 'isProhibited' => '', + 'hasGram' => '', + 'hasDimensionCharges' => '', + 'tax' => '50', + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'Sound system speakers - SMALL', + 'pricePerKg' => '', + 'pricePerPcs' => '', + 'isProhibited' => '', + 'hasGram' => '', + 'hasDimensionCharges' => '', + 'tax' => '200', + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'Sound system speakers - LARGE', + 'pricePerKg' => '', + 'pricePerPcs' => '', + 'isProhibited' => '', + 'hasGram' => '', + 'hasDimensionCharges' => '', + 'tax' => '400', + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'Washing Machine - Dimension', + 'pricePerKg' => '', + 'pricePerPcs' => '', + 'isProhibited' => '', + 'hasGram' => '', + 'hasDimensionCharges' => 'true', + 'tax' => '', + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'Oven, Balnder - perPcs', + 'pricePerKg' => '', + 'pricePerPcs' => '20', + 'isProhibited' => '', + 'hasGram' => '', + 'hasDimensionCharges' => '', + 'tax' => '', + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'Perfume - perKg', + 'pricePerKg' => '33', + 'pricePerPcs' => '', + 'isProhibited' => '', + 'hasGram' => '', + 'hasDimensionCharges' => '', + 'tax' => '', + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'Gold - Prohibited', + 'pricePerKg' => '', + 'pricePerPcs' => '', + 'isProhibited' => 'true', + 'hasGram' => '', + 'hasDimensionCharges' => '', + 'tax' => '', + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'Food - hasGram', + 'pricePerKg' => '', + 'pricePerPcs' => '', + 'isProhibited' => '', + 'hasGram' => 'true', + 'hasDimensionCharges' => '', + 'tax' => '', + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'TV 30" - 36"', + 'pricePerKg' => 28, + 'pricePerPcs' => '', + 'isProhibited' => '', + 'hasGram' => 'true', + 'hasDimensionCharges' => "true", + 'tax' => 500, + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'TV 37" - 42"', + 'pricePerKg' => 28, + 'pricePerPcs' => '', + 'isProhibited' => '', + 'hasGram' => 'true', + 'hasDimensionCharges' => "true", + 'tax' => 1000, + ]) + ], + [ + 'details' => json_encode([ + 'name' => 'TV 43"+"', + 'pricePerKg' => 28, + 'pricePerPcs' => '', + 'isProhibited' => '', + 'hasGram' => 'true', + 'hasDimensionCharges' => "true", + 'tax' => 1500, + ]) + ] + ); + + return $this->collectionResponse(AirShipmentItemPriceResource::collection($price)); + + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php index b7186064..13054a6c 100644 --- a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php +++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantLogic.php @@ -5,7 +5,9 @@ namespace App\Classes\Modules\Segments\ControllersLogic; use App\Classes\Exceptions\ResourceNotFoundException; use App\Classes\General\Abstracts\AbstractControllerLogic; use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject; +use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject; use App\Classes\Modules\Segments\Services\CreatesConstant; +use App\Classes\Modules\Segments\Services\CreatesSegment; use App\Classes\Modules\Segments\Services\FetchesConstant; use App\Classes\Modules\Segments\Services\FetchesSegment; use App\Classes\Modules\Segments\Standards\Rules\CanCreateConstant; @@ -15,6 +17,7 @@ use App\Http\Resources\ConstantResource; use App\Models\SegmentConstant; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use App\Classes\Modules\Segments\Services\UpdatesConstantValue; class UpdateConstantLogic extends AbstractControllerLogic { @@ -47,6 +50,11 @@ class UpdateConstantLogic extends AbstractControllerLogic /** @var CreatesConstant */ private $createsConstant; + /** @var CreatesSegment */ + private $createsSegment; + + /** @var UpdatesConstantValue */ + private $updatesConstantValue; /** * UpdateConstantLogic constructor. @@ -56,8 +64,19 @@ class UpdateConstantLogic extends AbstractControllerLogic * @param FetchesConstant $fetchesConstant * @param CanCreateConstant $canCreateConstant * @param CreatesConstant $createsConstant + * @param UpdatesConstantValueByState $updatesConstantValueByState + * @param CreatesSegment $createsSegment */ - public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant, CanCreateConstant $canCreateConstant, CreatesConstant $createsConstant) + public function __construct( + CanUpdateConstant $canUpdateConstant, + UpdatesConstant $updatesConstant, + FetchesSegment $fetchesSegment, + FetchesConstant $fetchesConstant, + CanCreateConstant $canCreateConstant, + CreatesConstant $createsConstant, + UpdatesConstantValue $updatesConstantValue, + CreatesSegment $createsSegment + ) { $this->canUpdateConstant = $canUpdateConstant; $this->updatesConstant = $updatesConstant; @@ -65,6 +84,8 @@ class UpdateConstantLogic extends AbstractControllerLogic $this->fetchesConstant = $fetchesConstant; $this->canCreateConstant = $canCreateConstant; $this->createsConstant = $createsConstant; + $this->updatesConstantValue = $updatesConstantValue; + $this->createsSegment = $createsSegment; } /** * @param Request $request @@ -75,28 +96,33 @@ class UpdateConstantLogic extends AbstractControllerLogic */ public function logic(Request $request) : JsonResponse { - - $object = new ConstantObject($request->input('reference'), $request->input('value')); - $segment = $this->fetchesSegment->execute(['id' => $request->route('id')]); try { - $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $object->getReference()]); - $this->canUpdateConstant->passes($object); + $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]); - /** @var SegmentConstant $constant */ - $constant = $this->updatesConstant->execute($constant, $object); + $constantValue = $this->updatesConstantValue->execute($constant->value, $request->input('id'), $request->input('rate')); + + $object = new ConstantObject($request->input('reference'), $constantValue); + + $this->canUpdateConstant->passes($object); } catch (ResourceNotFoundException $exception){ - $this->canCreateConstant->passes($object); + $constantObject = []; + + $constantObject[$request->input('id')] = $request->input('rate'); + + $object = new ConstantObject( + $request->input('reference'), + $constantObject + ); - /** @var SegmentConstant $constant */ $constant = $this->createsConstant->execute($segment, $object); - } - + + $constant = $this->updatesConstant->execute($constant, $object); return $this->resourceResponse(new ConstantResource($constant)); } diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php index 82edc1a2..f39fdb29 100644 --- a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php +++ b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantPostcodeLogic.php @@ -14,6 +14,8 @@ use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant; use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject; use App\Classes\Modules\Segments\Services\AddItemToConstantValueArray; use App\Classes\Modules\Segments\Services\RemoveItemFromConstantValueArray; +use App\Classes\Exceptions\ResourceNotFoundException; +use App\Classes\Modules\Segments\Services\CreatesConstant; class UpdateConstantPostcodeLogic extends AbstractControllerLogic { @@ -46,6 +48,8 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic /** @var RemoveItemFromConstantValueArray */ private $removeItemFromConstantValueArray; + /** @var CreatesConstant */ + private $createsConstant; /** * UpdateConstantLogic constructor. @@ -54,9 +58,18 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic * @param FetchesSegment $fetchesSegment * @param FetchesConstant $fetchesConstant * @param AddItemToConstantValueArray $addItemToConstantValueArray + * @param CreatesConstant $createsConstant * @param RemoveItemFromConstantValueArray $removeItemFromConstantValueArray */ - public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,AddItemToConstantValueArray $addItemToConstantValueArray, RemoveItemFromConstantValueArray $removeItemFromConstantValueArray) + public function __construct( + CanUpdateConstant $canUpdateConstant, + UpdatesConstant $updatesConstant, + FetchesSegment $fetchesSegment, + FetchesConstant $fetchesConstant, + AddItemToConstantValueArray $addItemToConstantValueArray, + RemoveItemFromConstantValueArray $removeItemFromConstantValueArray, + CreatesConstant $createsConstant + ) { $this->canUpdateConstant = $canUpdateConstant; $this->updatesConstant = $updatesConstant; @@ -64,6 +77,7 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic $this->fetchesConstant = $fetchesConstant; $this->addItemToConstantValueArray = $addItemToConstantValueArray; $this->removeItemFromConstantValueArray = $removeItemFromConstantValueArray; + $this->createsConstant = $createsConstant; } /** * @param Request $request @@ -76,24 +90,42 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic { $segment = $this->fetchesSegment->execute(['id' => $request->route('id')]); - $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]); + try { + $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]); - $object = new ConstantObject($constant->reference, $this->addItemToConstantValueArray->execute($constant->value, $request->input('postcode'))); - $this->canUpdateConstant->passes($object); + $constantValue = $this->addItemToConstantValueArray->execute($constant->value, $request->input('postcode')); + + $object = new ConstantObject($request->input('reference'), $constantValue); + + } catch (ResourceNotFoundException $exception){ + + $constantObject = [$request->input('postcode')]; + + $object = new ConstantObject( + $request->input('reference'), + $constantObject + ); + + $constant = $this->createsConstant->execute($segment, $object); + } + + try { + // check if postcode exist in the opposite constant, and delete it + $oppositeConstant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE]); + + $oppositeConstantValue = $this->removeItemFromConstantValueArray->execute($oppositeConstant->value, $request->input('postcode')); + + $oppositeObject = new ConstantObject($request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE, $oppositeConstantValue); + + $this->updatesConstant->execute($oppositeConstant, $oppositeObject); + + } catch (ResourceNotFoundException $exception){ + // if opposite constant does not exist, do nothing + } $constant = $this->updatesConstant->execute($constant, $object); - $oppositeConstant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE]); - - $oppositeObject = new ConstantObject($request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE, $this->removeItemFromConstantValueArray->execute($oppositeConstant->value, $request->input('postcode'))); - - $oppositeConstant = $this->updatesConstant->execute($oppositeConstant, $oppositeObject); - - - return $this->response([ - 'CENTER_POSTCODE' => $constant->reference == SegmentConstants::CENTER_POSTCODE ? new ConstantResource($constant) : New ConstantResource($oppositeConstant), - 'OUTSTATION_POSTCODE' => $constant->reference == SegmentConstants::OUTSTATION_POSTCODE ? new ConstantResource($constant) : New ConstantResource($oppositeConstant), - ]); + return $this->resourceResponse(new ConstantResource($constant)); } } \ No newline at end of file diff --git a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantStateLogic.php b/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantStateLogic.php deleted file mode 100644 index 6dca08a6..00000000 --- a/app/Classes/Modules/Segments/ControllersLogic/UpdateConstantStateLogic.php +++ /dev/null @@ -1,87 +0,0 @@ - '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 UpdatesConstantValueByState */ - private $updatesConstantValueByState; - - - /** - * UpdateConstantLogic constructor. - * @param CanUpdateConstant $canUpdateConstant - * @param UpdatesConstant $updatesConstant - * @param FetchesSegment $fetchesSegment - * @param FetchesConstant $fetchesConstant - * @param UpdatesConstantValueByState $updatesConstantValueByState - */ - public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,UpdatesConstantValueByState $updatesConstantValueByState) - { - $this->canUpdateConstant = $canUpdateConstant; - $this->updatesConstant = $updatesConstant; - $this->fetchesSegment = $fetchesSegment; - $this->fetchesConstant = $fetchesConstant; - $this->updatesConstantValueByState = $updatesConstantValueByState; - } - /** - * @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 - { - $segment = $this->fetchesSegment->execute(['id' => $request->route('id')]); - - $constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => SegmentConstants::STATE_RATE]); - - $constantValue = $this->updatesConstantValueByState->execute($constant->value, $request->input('status_id'), $request->input('rate')); - - $object = new ConstantObject(SegmentConstants::STATE_RATE, (array) $constantValue); - $this->canUpdateConstant->passes($object); - - $constant = $this->updatesConstant->execute($constant, $object); - - - return $this->resourceResponse(new ConstantResource($constant)); - } - -} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Services/UpdatesBasePriceConstantByDates.php b/app/Classes/Modules/Segments/Services/UpdatesBasePriceConstantByDates.php new file mode 100644 index 00000000..db49d2c8 --- /dev/null +++ b/app/Classes/Modules/Segments/Services/UpdatesBasePriceConstantByDates.php @@ -0,0 +1,29 @@ +format('Y-m-d')] = $rate; + } + + return $objectArray; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Segments/Services/UpdatesConstantValue.php b/app/Classes/Modules/Segments/Services/UpdatesConstantValue.php new file mode 100644 index 00000000..c8060940 --- /dev/null +++ b/app/Classes/Modules/Segments/Services/UpdatesConstantValue.php @@ -0,0 +1,23 @@ +config as $key => $object){ - if($object->status_id == $status_id){ - $newArray->config[$key] = (object) [ - 'rate' => $rate, - 'status_id' => $object->status_id, - 'outstation_rate' => $object->outstation_rate, - ]; - }else{ - $newArray->config[$key] = $object; - } - } - return $newArray; - - } - -} \ No newline at end of file diff --git a/app/Classes/Modules/Transactions/ControllersLogic/ApproveShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/ApproveShippingInvoiceTransactionLogic.php new file mode 100644 index 00000000..5bcb33ce --- /dev/null +++ b/app/Classes/Modules/Transactions/ControllersLogic/ApproveShippingInvoiceTransactionLogic.php @@ -0,0 +1,94 @@ + 'Shipping Invoice Status', + 'message' => 'You have successfully updated the shipping invoice status' + ]; + } + + /** @var FetchesPackingList */ + private $fetchesPackingList; + + /** @var UpdatesTransactionStatus */ + private $updatesTransactionStatus; + + /** @var CreatesDocument */ + private $createsDocument; + + /** @var CreatesFiles */ + private $createsFiles; + + /** + * ApprovePaymentVerificationLogic constructor. + * @param FetchesPackingList $fetchesPackingList + * @param UpdatesTransactionStatus $updatesTransactionStatus + * @param CreatesDocument $createsDocument + * @param CreatesFiles $createsFiles + * @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor + */ + public function __construct(FetchesPackingList $fetchesPackingList, UpdatesTransactionStatus $updatesTransactionStatus, CreatesDocument $createsDocument, CreatesFiles $createsFiles) + { + $this->fetchesPackingList = $fetchesPackingList; + $this->updatesTransactionStatus = $updatesTransactionStatus; + $this->createsDocument = $createsDocument; + $this->createsFiles = $createsFiles; + } + + /** + * @param Request $request + * @return JsonResponse + * @throws \App\Classes\Exceptions\MalformedRequestException + */ + public function logic(Request $request) : JsonResponse + { + $packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]); + + $invoice_transaction = $packing_list->transactions->where('type', TransactionType::SHIPPING_INVOICE)->first(); + + $this->updatesTransactionStatus->execute($invoice_transaction, ApprovalStatus::APPROVED); + + $transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]); + + $document_object = new DocumentObject( + DocumentType::SHIPPING_INVOICE, + [chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))], + '', + ApprovalStatus::COMPLETED, + 'shipping_invoice' + ); + + /** @var Document $document */ + $document = $this->createsDocument->execute($invoice_transaction, $document_object); + + $this->createsFiles->execute($document, $document_object); + + return $this->response([]); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentTransactionLogic.php index bd99d86d..04de4090 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/CreatePaymentTransactionLogic.php @@ -84,8 +84,11 @@ class CreatePaymentTransactionLogic extends AbstractControllerLogic $billPlzBill = $this->createsBillplzBill->execute( $company_module->name, $company_module->employees()->first()->email, - 'This payment is credit topup for company ref. ' . $company_module->reference, $amount, $billNumber, - $request->input('bank_code'), true + 'This payment is for the invoice number . ' . $invoice_transaction->bill_no, + $amount, + $billNumber, + $request->input('bank_code'), + true ); $payment_reference = $billPlzBill->id; diff --git a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php index a66e4137..50b6165f 100644 --- a/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php +++ b/app/Classes/Modules/Transactions/ControllersLogic/CreateShippingInvoiceTransactionLogic.php @@ -21,10 +21,12 @@ use App\Classes\ValueObjects\Constants\PaymentMethodType; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\DocumentType; use App\Classes\ValueObjects\Constants\PackageType; +use App\Classes\ValueObjects\Constants\SegmentConstants; use App\Classes\ValueObjects\Constants\TransactionDetailType; use App\Models\Document; use App\Models\Transaction; +use Carbon\Carbon; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; @@ -98,57 +100,35 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity); }); - $order = $packing_list->owner()->first(); + $order = $packing_list->owner; $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_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::BASE_PRICE]); + $warehouse_rate_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::WAREHOUSE_RATE]); + $state_rate_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::STATE_RATE]); + $center_postcode_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::CENTER_POSTCODE]); + $outstation_postcode_constant = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => SegmentConstants::OUTSTATION_POSTCODE]); $base_price = 0; $warehouse_rate = 0; $state_rate = 0; - $state_select = []; - $with_out = false; + $state_select = ''; - if ($base_price_constant) { - $base_price = $base_price_constant->value->price; - } + $base_price = $this->getConstantByKey($base_price_constant, date('Y-m-d')); - 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; - } - } - } + $warehouseId = $order->orderRoles()->where('role_id', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->company_module_id; + $selected_warehouse_rate = $this->getConstantByKey($warehouse_rate_constant, $warehouseId); + $warehouse_rate = is_object($selected_warehouse_rate) ? $selected_warehouse_rate->amount : 0; - 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; - } - } - } + $stateId = $address->state_id; + $state_rate_constant = $this->getConstantByKey($state_rate_constant, $stateId); - 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; - } - } + // get $state_rate + $postcode = $address->postcode; + $this->checkPostcodeExistInConstant($center_postcode_constant, $postcode) === true ? $state_select = 'center' : '' ; + $this->checkPostcodeExistInConstant($outstation_postcode_constant, $postcode) === true ? $state_select = 'outstation' : '' ; + $state_rate_constant = (array)$state_rate_constant; + $state_rate = $state_select == '' ? 0 : $state_rate_constant[$state_select]; $price_cbm = $base_price + $warehouse_rate + $state_rate; $total_cbm = $price_cbm * ($cbm + $over_weight_cbm); @@ -196,21 +176,24 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic $this->createsTransactionDetail->execute($invoice_transaction, $object_detail); } - $transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]); - - $document_object = new DocumentObject( - DocumentType::SHIPPING_INVOICE, - [chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))], - '', - ApprovalStatus::COMPLETED, - 'shipping_invoice' - ); - - /** @var Document $document */ - $document = $this->createsDocument->execute($invoice_transaction, $document_object); - - $this->createsFile->execute($document, $document_object); - return $this->response([]); } + + function getConstantByKey($segmentConstantObject, $key) { + if ($segmentConstantObject) { + $base_rate = (array) $segmentConstantObject->value; + $base_rate = array_key_exists($key, $base_rate) === true ? $base_rate[$key] : 0; + return $base_rate; + } + } + + function checkPostcodeExistInConstant($segmentConstantObject, $postcode) { + $segmentConstantObject = $segmentConstantObject->value; + if (!empty($segmentConstantObject)) { + return in_array($postcode, $segmentConstantObject); + } else { + return false; + } + } + } diff --git a/app/Classes/Modules/Transactions/ControllersLogic/ShippingEstimationCalculatorLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/ShippingEstimationCalculatorLogic.php new file mode 100644 index 00000000..753704a0 --- /dev/null +++ b/app/Classes/Modules/Transactions/ControllersLogic/ShippingEstimationCalculatorLogic.php @@ -0,0 +1,92 @@ + 'Shipping estimation', + 'message' => 'You have successfully calculate the Shipping Estimation' + ]; + } + + public function __construct( + FetchesSegmentConstant $fetchesSegmentConstant + ){ + $this->fetchesSegmentConstant = $fetchesSegmentConstant; + } + + public function logic(Request $request) : JsonResponse + { + $base_price = $warehouse_rate = $state_rate = 0; + + $width = $request->input('width') / 100; // metre + $length = $request->input('length') / 100; // metre + $height = $request->input('height') / 100; // metre + + $cbm = (float) ($width * $length * $height); + + // calculate base price + $base_prices = $this->getSegmentConstantData(SegmentConstants::BASE_PRICE); + $base_price = $this->getConstantDataUsingKey($base_prices, date('Y-m-d')); + + // calculate warehouse rate + $warehouse_prices = $this->getSegmentConstantData(SegmentConstants::WAREHOUSE_RATE); + $warehouse_rate = $this->getConstantDataUsingKey($warehouse_prices, $request->input('warehouse_id'), 'amount'); + + // calculate applied state rate + $state_prices = $this->getSegmentConstantData(SegmentConstants::STATE_RATE); + $outstation_postcodes = $this->getSegmentConstantData(SegmentConstants::OUTSTATION_POSTCODE); + + $district = District::where('postcode','LIKE','%'.$request->input('postcode').'%')->first(); + if(array_search($request->input('postcode'), $outstation_postcodes)!==false){ + $state_rate = $this->getConstantDataUsingKey($state_prices, $district->state_id, 'outstation'); + } + + $price_cbm = $base_price + $warehouse_rate + $state_rate; + $total_price_cbm = $price_cbm * $cbm; + + return $this->response([ + 'cbm' => $cbm, 'base_price' => $base_price, 'warehouse_rate' => $warehouse_rate, + 'state_rate' => $state_rate, 'total_price_cbm' => $total_price_cbm + ]); + } + + private function getConstantDataUsingKey($data, $search_key, $field='') + { + if(array_key_exists($search_key, $data) !== true) { + return 0; + } else { + if($field!=''){ + return $data[$search_key]->$field; + } else { + return $data[$search_key]; + } + } + } + + private function getSegmentConstantData($reference) + { + $data = $this->fetchesSegmentConstant->execute(['segment_id' => 1, 'reference' => $reference]); + return (array) $data->value; + } + +} diff --git a/app/Classes/Modules/Transactions/ControllersLogic/UpdateShippingInvoiceTransactionLogic.php b/app/Classes/Modules/Transactions/ControllersLogic/UpdateShippingInvoiceTransactionLogic.php new file mode 100644 index 00000000..f60130ac --- /dev/null +++ b/app/Classes/Modules/Transactions/ControllersLogic/UpdateShippingInvoiceTransactionLogic.php @@ -0,0 +1,149 @@ + 'Update Shipping Invoice Transaction', + 'message' => 'You have successfully update shipping invoice transaction' + ]; + } + + /** @var FetchesPackingList */ + private $fetchesPackingList; + + /** @var FetchesTransaction */ + private $fetchesTransaction; + + /** @var UpdatesTransaction */ + private $updatesTransaction; + + /** @var FetchesTransactionDetail */ + private $fetchesTransactionDetail; + + /** @var CreatesTransactionDetail */ + private $createsTransactionDetail; + + /** @var UpdatesTransactionDetail */ + private $updatesTransactionDetail; + + /** @var DeletesTransactionDetails */ + private $deletesTransactionDetails; + + public function __construct( + FetchesPackingList $fetchesPackingList, + FetchesTransaction $fetchesTransaction, + UpdatesTransaction $updatesTransaction, + FetchesTransactionDetail $fetchesTransactionDetail, + CreatesTransactionDetail $createsTransactionDetail, + UpdatesTransactionDetail $updatesTransactionDetail, + DeletesTransactionDetails $deletesTransactionDetails + ) + { + + $this->fetchesPackingList = $fetchesPackingList; + $this->fetchesTransaction = $fetchesTransaction; + $this->updatesTransaction = $updatesTransaction; + $this->fetchesTransactionDetail = $fetchesTransactionDetail; + $this->createsTransactionDetail = $createsTransactionDetail; + $this->updatesTransactionDetail = $updatesTransactionDetail; + $this->deletesTransactionDetails = $deletesTransactionDetails; + } + + public function logic(Request $request) : JsonResponse + { + $invoice_transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]); + + $old_transaction_details = $invoice_transaction->transactionDetails->whereNotIn('reference', ['SHIPPING_FEE', 'OVER_WEIGHT_CHARGES'])->pluck('id')->toArray(); + + $new_transaction_details = collect($request->input('transaction_details')); + + $total_cbm = $invoice_transaction->amount; + + foreach($old_transaction_details as $old_transaction_detail_id){ + $old_transaction_detail = $this->fetchesTransactionDetail->execute(['id' => $old_transaction_detail_id]); + + $total_cbm -= $old_transaction_detail->price; + + if(!$new_transaction_details->contains('id', $old_transaction_detail_id)){ + $this->deletesTransactionDetails->execute($old_transaction_detail); + } + } + + foreach($new_transaction_details as $transaction_detail){ + $transaction_detail = (object) $transaction_detail; + + if(!in_array($transaction_detail->reference, ['SHIPPING_FEE', 'OVER_WHEIGHT_CHARGES'])){ + $object_detail = new TransactionDetailObject( + 'CUSTOM_CHARGES', + isset($transaction_detail->name) ? $transaction_detail->name : TransactionDetailType::CUSTOM_CHARGES, + $transaction_detail->quantity, + $transaction_detail->price + ); + + if(isset($transaction_detail->id)){ + $new_transaction_detail = $this->updatesTransactionDetail->execute($this->fetchesTransactionDetail->execute(['id' => $transaction_detail->id]), $object_detail); + }else{ + $new_transaction_detail = $this->createsTransactionDetail->execute($invoice_transaction, $object_detail); + } + + $total_cbm += $new_transaction_detail->amount; + } + } + + $object = new TransactionObject( + $invoice_transaction->bill_no, + TransactionType::SHIPPING_INVOICE, + 1, + $invoice_transaction->issuer, + 1, + PaymentMethodType::CASH, + $total_cbm, + $total_cbm, + 1, + 1, + 0, + 0, + 0, + null, + ApprovalStatus::PENDING_VERIFICATION + ); + + /** @var Transaction $invoice_transaction */ + $invoice_transaction = $this->updatesTransaction->execute($invoice_transaction, $object); + + return $this->response([]); + } + +} diff --git a/app/Classes/Modules/Transactions/Services/DeletesTransactionDetails.php b/app/Classes/Modules/Transactions/Services/DeletesTransactionDetails.php index 42b16d77..72e92bf5 100644 --- a/app/Classes/Modules/Transactions/Services/DeletesTransactionDetails.php +++ b/app/Classes/Modules/Transactions/Services/DeletesTransactionDetails.php @@ -3,17 +3,17 @@ namespace App\Classes\Modules\Transactions\Services; use App\Classes\General\Eloquent\AbstractDeleteRecord; -use App\Models\Transaction; +use App\Models\TransactionDetail; class DeletesTransactionDetails extends AbstractDeleteRecord { /** - * @param Transaction $model + * @param TransactionDetail $model * @return mixed */ - public function execute(Transaction $model) { - return $model->transactionDetails()->delete(); + public function execute(TransactionDetail $model) { + return $model->delete(); } } \ No newline at end of file diff --git a/app/Classes/Modules/Transactions/Services/UpdatesTransactionDetail.php b/app/Classes/Modules/Transactions/Services/UpdatesTransactionDetail.php new file mode 100644 index 00000000..128214d4 --- /dev/null +++ b/app/Classes/Modules/Transactions/Services/UpdatesTransactionDetail.php @@ -0,0 +1,27 @@ +reference = $object->getReference(); + $transactionDetail->name = $object->getName(); + $transactionDetail->quantity = $object->getQuantity(); + $transactionDetail->price = $object->getPrice(); + $transactionDetail->amount = $object->getAmount(); + + return $this->handler($transactionDetail); + + } +} \ No newline at end of file diff --git a/app/Classes/ValueObjects/Constants/TransactionDetailType.php b/app/Classes/ValueObjects/Constants/TransactionDetailType.php index 186f662c..b3e1541c 100644 --- a/app/Classes/ValueObjects/Constants/TransactionDetailType.php +++ b/app/Classes/ValueObjects/Constants/TransactionDetailType.php @@ -7,4 +7,6 @@ final class TransactionDetailType { public const SHIPPING_FEE = 'Shipping Fee'; public const OVER_WEIGHT_CHARGES = 'Over weight charges'; + + public const CUSTOM_CHARGES = 'Custom charges'; } diff --git a/app/Http/Controllers/Exports/ExportCompanyModuleSummaryController.php b/app/Http/Controllers/Exports/ExportCompanyModuleSummaryController.php new file mode 100644 index 00000000..17ee64d8 --- /dev/null +++ b/app/Http/Controllers/Exports/ExportCompanyModuleSummaryController.php @@ -0,0 +1,30 @@ +headers->set('Authorization', 'Bearer '.$token); + } + + public function export(Request $request) { + $exportsCompanyModuleSummary = new ExportsCompanyModuleSummary($request); + $exportsCompanyModuleSummary->setParameters($request->route('company_module_id'), $request->input('containerNumber')); + $response = $exportsCompanyModuleSummary->download('customerid-markingno.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); + ob_end_clean(); + return $response; + } +} diff --git a/app/Http/Controllers/Notifications/ListNotificationsController.php b/app/Http/Controllers/Notifications/ListNotificationsController.php new file mode 100644 index 00000000..58455fc2 --- /dev/null +++ b/app/Http/Controllers/Notifications/ListNotificationsController.php @@ -0,0 +1,19 @@ +execute($request); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Segments/CreateBasePriceController.php b/app/Http/Controllers/Segments/CreateBasePriceController.php new file mode 100644 index 00000000..b8f63eeb --- /dev/null +++ b/app/Http/Controllers/Segments/CreateBasePriceController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Segments/FetchBasePriceController.php b/app/Http/Controllers/Segments/FetchBasePriceController.php new file mode 100644 index 00000000..9ef0b225 --- /dev/null +++ b/app/Http/Controllers/Segments/FetchBasePriceController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Segments/ListAirShipmentPriceController.php b/app/Http/Controllers/Segments/ListAirShipmentPriceController.php new file mode 100644 index 00000000..15c4ac2b --- /dev/null +++ b/app/Http/Controllers/Segments/ListAirShipmentPriceController.php @@ -0,0 +1,20 @@ +execute($request); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Segments/UpdateConstantStateController.php b/app/Http/Controllers/Segments/UpdateConstantStateController.php deleted file mode 100644 index 33e52100..00000000 --- a/app/Http/Controllers/Segments/UpdateConstantStateController.php +++ /dev/null @@ -1,20 +0,0 @@ -execute($request); - } - -} \ No newline at end of file diff --git a/app/Http/Controllers/Transactions/ApproveShippingInvoiceTransactionController.php b/app/Http/Controllers/Transactions/ApproveShippingInvoiceTransactionController.php new file mode 100644 index 00000000..3c0fe35a --- /dev/null +++ b/app/Http/Controllers/Transactions/ApproveShippingInvoiceTransactionController.php @@ -0,0 +1,15 @@ +execute($request); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Transactions/ShippingEstimationCalculatorController.php b/app/Http/Controllers/Transactions/ShippingEstimationCalculatorController.php new file mode 100644 index 00000000..d83a49b6 --- /dev/null +++ b/app/Http/Controllers/Transactions/ShippingEstimationCalculatorController.php @@ -0,0 +1,20 @@ +execute($request); + } +} diff --git a/app/Http/Controllers/Transactions/UpdateShippingInvoiceTransactionController.php b/app/Http/Controllers/Transactions/UpdateShippingInvoiceTransactionController.php new file mode 100644 index 00000000..a5d123a0 --- /dev/null +++ b/app/Http/Controllers/Transactions/UpdateShippingInvoiceTransactionController.php @@ -0,0 +1,21 @@ +execute($request); + } +} diff --git a/app/Http/Resources/AddressResource.php b/app/Http/Resources/AddressResource.php index 95a60b9f..f86d5c29 100644 --- a/app/Http/Resources/AddressResource.php +++ b/app/Http/Resources/AddressResource.php @@ -5,6 +5,8 @@ namespace App\Http\Resources; use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Models\Order; use Illuminate\Http\Resources\Json\JsonResource; +use App\Models\SegmentConstant; +use App\Classes\ValueObjects\Constants\SegmentConstants; class AddressResource extends JsonResource { @@ -17,6 +19,14 @@ class AddressResource extends JsonResource public function toArray($request) { + $centerPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::CENTER_POSTCODE)->get(); + $centerPostcodeConstant = $centerPostcodeConstantObject->isEmpty() ? [] : (array)$centerPostcodeConstantObject->first()->value; + $postcodeArea = in_array($this->postcode, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : ''; + + $outstationPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::OUTSTATION_POSTCODE)->get(); + $outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value; + in_array($this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : ''; + return [ 'id' => $this->id, 'reference' => $this->reference, @@ -25,6 +35,7 @@ class AddressResource extends JsonResource 'district' => $this->district, 'state' => $this->state, 'post_code' => $this->postcode, + 'post_code_area' => $postcodeArea, 'country' => $this->country, 'default' => (int) $this->default, 'status' => (int) $this->status, diff --git a/app/Http/Resources/AirShipmentItemPriceResource.php b/app/Http/Resources/AirShipmentItemPriceResource.php new file mode 100644 index 00000000..7210ba05 --- /dev/null +++ b/app/Http/Resources/AirShipmentItemPriceResource.php @@ -0,0 +1,25 @@ +resource; + $detailsArray = (array)json_decode($object['details']); + + return [ + 'name' => $detailsArray['name'], + 'details' => $object['details'], + ]; + } +} diff --git a/app/Http/Resources/CompanyModuleResource.php b/app/Http/Resources/CompanyModuleResource.php index 7af3ae8d..51c651f7 100644 --- a/app/Http/Resources/CompanyModuleResource.php +++ b/app/Http/Resources/CompanyModuleResource.php @@ -32,6 +32,9 @@ class CompanyModuleResource extends JsonResource $connection = $this->inviters()->withPivot('invitee_reference')->first(); $marking = $connection ? $connection->pivot->invitee_reference:''; + $segmentConstantObject = SegmentConstant::where('reference', SegmentConstants::WAREHOUSE_RATE)->get(); + $segmentConstant = $segmentConstantObject->isEmpty() ? [] : (array)$segmentConstantObject->first()->value; + return [ 'id' => $this->id, 'type' => $this->type, @@ -40,7 +43,8 @@ class CompanyModuleResource extends JsonResource 'address' => new AddressResource($defaultAddress), 'company' => new CompanyResource($this->whenLoaded('company')), 'remarks' => RemarkResource::collection($this->remarks), - 'marking' => $marking + 'marking' => $marking, + 'warehouseCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null, ]; } diff --git a/app/Http/Resources/DistrictResource.php b/app/Http/Resources/DistrictResource.php index 0f5a01dc..a922f2ed 100644 --- a/app/Http/Resources/DistrictResource.php +++ b/app/Http/Resources/DistrictResource.php @@ -20,6 +20,7 @@ class DistrictResource extends JsonResource 'state' => $this->state, 'country' => $this->country, 'postcode' => $this->postcode, + 'postcodeArray' => PostcodeResource::collection(json_decode($this->postcode)), ]; } } diff --git a/app/Http/Resources/NotificationResource.php b/app/Http/Resources/NotificationResource.php new file mode 100644 index 00000000..564b7b31 --- /dev/null +++ b/app/Http/Resources/NotificationResource.php @@ -0,0 +1,30 @@ + $this->id, + 'title' => $this->title, + 'description' => $this->description, + 'long_ago' => $this->created_at->diffForHumans(), + 'created_at' => $this->created_at->format('d-m-Y') + ]; + + } +} diff --git a/app/Http/Resources/PostcodeResource.php b/app/Http/Resources/PostcodeResource.php new file mode 100644 index 00000000..92c9abb0 --- /dev/null +++ b/app/Http/Resources/PostcodeResource.php @@ -0,0 +1,33 @@ +get(); + $centerPostcodeConstant = $centerPostcodeConstantObject->isEmpty() ? [] : (array)$centerPostcodeConstantObject->first()->value; + $postcodeArea = in_array($this->resource, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : ''; + + $outstationPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::OUTSTATION_POSTCODE)->get(); + $outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value; + in_array($this->resource, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : ''; + + return [ + 'postcode' => $this->resource, + 'postcodeArea' => $postcodeArea, + ]; + } +} diff --git a/app/Http/Resources/StateResource.php b/app/Http/Resources/StateResource.php index b9d71dae..9ccee3d3 100644 --- a/app/Http/Resources/StateResource.php +++ b/app/Http/Resources/StateResource.php @@ -1,8 +1,9 @@ get(); + $segmentConstant = $segmentConstantObject->isEmpty() ? [] : (array)$segmentConstantObject->first()->value; + return [ 'id' => $this->id, 'name' => $this->name, 'country' => $this->country, + 'stateCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null, ]; } } diff --git a/app/Http/Resources/TransactionDetailResource.php b/app/Http/Resources/TransactionDetailResource.php index 1b60cfce..69a00c42 100644 --- a/app/Http/Resources/TransactionDetailResource.php +++ b/app/Http/Resources/TransactionDetailResource.php @@ -16,11 +16,11 @@ class TransactionDetailResource extends JsonResource { return [ - 'stockCode' => $this->product_code, - 'description' => $this->product_name, + 'reference' => $this->reference, 'quantity' => $this->quantity, - 'unit_price' => (double) $this->price, - 'total' => (double) $this->amount + 'price' => (double) $this->price, + 'name' => $this->name, + 'amount' => (double) $this->amount ]; } } diff --git a/app/Http/Resources/TransactionResource.php b/app/Http/Resources/TransactionResource.php index 05c35038..27840ad8 100644 --- a/app/Http/Resources/TransactionResource.php +++ b/app/Http/Resources/TransactionResource.php @@ -2,6 +2,9 @@ namespace App\Http\Resources; +use App\Classes\ValueObjects\Constants\ApprovalStatus; +use App\Classes\ValueObjects\Constants\DocumentType; +use App\Classes\ValueObjects\Constants\TransactionType; use Carbon\Carbon; use Illuminate\Http\Resources\Json\JsonResource; @@ -19,18 +22,33 @@ class TransactionResource extends JsonResource return [ 'id' => $this->id, // 'booking' => new BookingResource($this->booking), + 'documents' => DocumentResource::collection($this->documents), 'type' => (int) $this->type, 'bill_no' => $this->bill_no, 'amount' => (double) $this->amount, + 'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')), + 'service_charge' => (double) $this->service_charge, + 'tax' => (double) $this->tax, 'original_amount' => (double) $this->original_amount, 'currency' => new CurrencyResource($this->currency), 'original_currency' => new CurrencyResource($this->original_currency), 'currency_rate' => (double) $this->currency_rate, 'status' => (int) $this->status, 'details' => TransactionDetailResource::collection($this->transactionDetails), - 'documents' => new DocumentResource($this->documents()->first()), + 'transactions' => TransactionResource::collection($this->transactions), + 'payment_attempts' => TransactionResource::collection( + $this->transactions() + ->payments()->where('status', ApprovalStatus::PENDING_SUBMISSION) + ->get() + ), + 'payment_history' => TransactionResource::collection( + $this->transactions() + ->payments() + ->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED]) + ->get() + ), 'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:s:i'), - 'updated_at' => Carbon::parse($this->update_at)->format('d-m-Y h:s:i') + 'updated_at' => Carbon::parse($this->update_at)->format('d-m-Y') ]; } } diff --git a/app/Models/SegmentCompany.php b/app/Models/SegmentCompany.php index 660057fc..3f5d37d5 100644 --- a/app/Models/SegmentCompany.php +++ b/app/Models/SegmentCompany.php @@ -1,8 +1,11 @@ foreignId('segment_id'); $table->foreignId('company_id'); + $table->softDeletes(); $table->timestamps(); $table->primary(['segment_id', 'company_id']); }); diff --git a/database/migrations/2022_03_14_133555_create_addons_table.php b/database/migrations/2022_03_14_133563_create_addons_table.php similarity index 94% rename from database/migrations/2022_03_14_133555_create_addons_table.php rename to database/migrations/2022_03_14_133563_create_addons_table.php index 4b58535c..42bc4ae6 100644 --- a/database/migrations/2022_03_14_133555_create_addons_table.php +++ b/database/migrations/2022_03_14_133563_create_addons_table.php @@ -32,6 +32,6 @@ class CreateAddonsTables extends Migration */ public function down() { - Schema::dropIfExists('order_addons'); + Schema::dropIfExists('addons'); } } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 474a16de..01625744 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -24,6 +24,11 @@ class DatabaseSeeder extends Seeder $this->call(CurrenciesTableSeeder::class); $this->call(CompaniesTableSeeder::class); + + $this->call(SegmentsTableSeeder::class); + + $this->call(SegmentConstantsTableSeeder::class); + // $this->call(OrdersTableSeeder::class); } } \ No newline at end of file diff --git a/database/seeders/SegmentConstantsTableSeeder.php b/database/seeders/SegmentConstantsTableSeeder.php index 2fc68bf0..ef47f580 100644 --- a/database/seeders/SegmentConstantsTableSeeder.php +++ b/database/seeders/SegmentConstantsTableSeeder.php @@ -9,154 +9,128 @@ use Illuminate\Support\Facades\DB; class SegmentConstantsTableSeeder extends Seeder { - public function run() + + private function insertData($segment_id=1, $reference, $array_data) { DB::beginTransaction(); - 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, - ]), - ], + 'segment_id' => $segment_id, + 'reference' => $reference, + 'value' => json_encode($array_data) ]); DB::commit(); } + + public function run() + { + // insert base prices + $n_days = 10; // for the 10 days ahead + $today = date("Y-m-d"); + $prices = []; + for($ii=0; $ii<$n_days;$ii++){ + $prices[] = [ + "date" => date('Y-m-d', strtotime($today. ' + '.$ii.' days')), + "price" => rand(10, 30) / 10 + ]; + } + $this->insertData(1, SegmentConstants::BASE_PRICE, $prices); + + // insert state prices + $prices = []; + for($ii=1; $ii<=16;$ii++){ + $prices[] = [ + 'state_id' => $ii, + 'center' => '10.00', + 'outstation'=> '2.00' + ]; + } + $this->insertData(1, SegmentConstants::STATE_RATE, $prices); + + // insert warehouse prices + $prices = []; + for($ii=1; $ii<=7;$ii++){ + $prices[] = [ + 'warehouse_id' => $ii, + 'amount' => '1.'.$ii + ]; + } + $this->insertData(1, SegmentConstants::WAREHOUSE_RATE, $prices); + + // insert center postcodes + $prices = [ + [ 'post_code' => '80050' ], + [ 'post_code' => '80100' ], + [ 'post_code' => '80150' ], + [ 'post_code' => '80200' ], + [ 'post_code' => '80250' ], + [ 'post_code' => '80300' ], + [ 'post_code' => '80350' ], + [ 'post_code' => '80400' ], + [ 'post_code' => '80500' ], + [ 'post_code' => '80506' ], + [ 'post_code' => '80508' ], + [ 'post_code' => '80516' ], + [ 'post_code' => '80519' ], + [ 'post_code' => '80534' ], + [ 'post_code' => '80536' ], + [ 'post_code' => '80542' ], + [ 'post_code' => '80546' ], + [ 'post_code' => '80558' ], + [ 'post_code' => '80560' ], + [ 'post_code' => '80564' ], + [ 'post_code' => '80568' ], + [ 'post_code' => '80578' ], + [ 'post_code' => '80584' ], + [ 'post_code' => '80586' ], + [ 'post_code' => '80590' ], + [ 'post_code' => '80592' ], + [ 'post_code' => '80594' ], + [ 'post_code' => '80596' ], + [ 'post_code' => '80600' ], + [ 'post_code' => '80604' ], + [ 'post_code' => '80608' ], + [ 'post_code' => '80620' ], + [ 'post_code' => '80622' ], + [ 'post_code' => '80628' ], + [ 'post_code' => '80644' ], + [ 'post_code' => '80648' ], + [ 'post_code' => '80662' ], + [ 'post_code' => '80664' ], + [ 'post_code' => '80668' ], + [ 'post_code' => '80670' ], + [ 'post_code' => '80672' ], + [ 'post_code' => '80673' ], + [ 'post_code' => '80676' ], + [ 'post_code' => '80700' ], + [ 'post_code' => '80710' ], + [ 'post_code' => '80720' ], + [ 'post_code' => '80730' ], + [ 'post_code' => '80900' ], + [ 'post_code' => '80902' ], + [ 'post_code' => '80904' ], + [ 'post_code' => '80906' ], + [ 'post_code' => '80908' ], + [ 'post_code' => '80988' ], + [ 'post_code' => '80990' ], + [ 'post_code' => '81000' ], + [ 'post_code' => '81100' ], + [ 'post_code' => '81200' ], + [ 'post_code' => '81300' ], + [ 'post_code' => '81310' ] + ]; + $this->insertData(1, SegmentConstants::CENTER_POSTCODE, $prices); + + // insert outstation prices + $prices = [ + ['post_code' => '80000' ] + ]; + $this->insertData(1, SegmentConstants::OUTSTATION_POSTCODE, $prices); + + // insert customer prices + $prices = [ + ['id'=> 1, 'price' => 15 ] + ]; + $this->insertData(2, SegmentConstants::CUSTOMER_RATE, $prices); + + } } diff --git a/resources/assets/sass/modules/_typography.scss b/resources/assets/sass/modules/_typography.scss index a22dc2fc..60817d2a 100644 --- a/resources/assets/sass/modules/_typography.scss +++ b/resources/assets/sass/modules/_typography.scss @@ -317,6 +317,12 @@ hr{ background-color: $color-primary-lighter !important; } +.bg-primary-lighter-hover { + &:hover { + background-color: $color-primary-lighter !important; + } +} + /* Complete ------------------------------------ */ diff --git a/resources/assets/vue/components/accounts/forms/DeliveryLoginFormComponent.vue b/resources/assets/vue/components/accounts/forms/DeliveryLoginFormComponent.vue new file mode 100644 index 00000000..8db903db --- /dev/null +++ b/resources/assets/vue/components/accounts/forms/DeliveryLoginFormComponent.vue @@ -0,0 +1,70 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/accounts/forms/LoginFormComponent.vue b/resources/assets/vue/components/accounts/forms/LoginFormComponent.vue index 8db903db..153cf90f 100644 --- a/resources/assets/vue/components/accounts/forms/LoginFormComponent.vue +++ b/resources/assets/vue/components/accounts/forms/LoginFormComponent.vue @@ -31,7 +31,7 @@
-

New Customer? Create Account

+

New Customer? Create Account

diff --git a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue index ed7656a4..7d6e5bef 100644 --- a/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue +++ b/resources/assets/vue/components/accounts/forms/RegistrationFormComponent.vue @@ -156,14 +156,14 @@
- +
-
+
-
-
- +
+
+
+
+ +
+
+ + + +
+
+
+
+ + + +
- - -
diff --git a/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue b/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue index 29edf834..7a9fe7a8 100644 --- a/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue +++ b/resources/assets/vue/components/companies/elements/IdentificationVerificationComponent.vue @@ -137,28 +137,7 @@
-
-
-
-
-
-
-
Reject Document
-
Are you sure you want to reject this customer's identification?
-
-
-
-
-
Cancel
-
-
-
Reject
-
-
-
-
-
-
+
diff --git a/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue b/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue index 318da08e..749e7ef8 100644 --- a/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue +++ b/resources/assets/vue/components/companies/sections/CustomerProfileSectionComponent.vue @@ -74,10 +74,6 @@ \ No newline at end of file diff --git a/resources/assets/vue/components/containers/sections/ContainerProfileSectionComponent.vue b/resources/assets/vue/components/containers/sections/ContainerProfileSectionComponent.vue index a9d22e9c..c2f89940 100644 --- a/resources/assets/vue/components/containers/sections/ContainerProfileSectionComponent.vue +++ b/resources/assets/vue/components/containers/sections/ContainerProfileSectionComponent.vue @@ -455,7 +455,7 @@
- +
diff --git a/resources/assets/vue/components/containers/sections/PackingListSectionComponent.vue b/resources/assets/vue/components/containers/sections/PackingListSectionComponent.vue index c015ceb2..ea78fb48 100644 --- a/resources/assets/vue/components/containers/sections/PackingListSectionComponent.vue +++ b/resources/assets/vue/components/containers/sections/PackingListSectionComponent.vue @@ -24,7 +24,7 @@
- +
@@ -42,6 +42,12 @@ import PackingListComponent from "../elements/PackingListComponent"; export default { components: {PackingListComponent, LoadingComponent}, + props: { + section:{ + type: String, + default: '' + } + }, data(){ return { isLoading: true, diff --git a/resources/assets/vue/components/general/elements/NotificationSectionComponent.vue b/resources/assets/vue/components/general/elements/NotificationSectionComponent.vue new file mode 100644 index 00000000..e0f6fb1c --- /dev/null +++ b/resources/assets/vue/components/general/elements/NotificationSectionComponent.vue @@ -0,0 +1,98 @@ + + \ 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 index b07fad9e..0f4e8360 100644 --- a/resources/assets/vue/components/orders/elements/UnclaimedPackinglistComponent.vue +++ b/resources/assets/vue/components/orders/elements/UnclaimedPackinglistComponent.vue @@ -10,10 +10,17 @@

Reference

{{data.reference ? data.reference : 'n/a'}}

-
+

Arrival Date

{{data.transport ? data.transport.drop_date : 'n/a'}}

+
+ + + + + +
diff --git a/resources/assets/vue/components/orders/forms/DeletePackinglistFormComponent.vue b/resources/assets/vue/components/orders/forms/DeletePackinglistFormComponent.vue new file mode 100644 index 00000000..ec52e362 --- /dev/null +++ b/resources/assets/vue/components/orders/forms/DeletePackinglistFormComponent.vue @@ -0,0 +1,28 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/orders/sections/DeliveryOrdersSectionComponent.vue b/resources/assets/vue/components/orders/sections/DeliveryOrdersSectionComponent.vue new file mode 100644 index 00000000..a2c8bba0 --- /dev/null +++ b/resources/assets/vue/components/orders/sections/DeliveryOrdersSectionComponent.vue @@ -0,0 +1,458 @@ + + diff --git a/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue b/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue index 44d30669..a0880e40 100644 --- a/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue +++ b/resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue @@ -274,7 +274,7 @@ style=" fill:#000000;">
-
+
Add Arrived Parcel
diff --git a/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue new file mode 100644 index 00000000..535ecfdc --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/elements/AdminPaymentsBillingComponent.vue @@ -0,0 +1,256 @@ + + diff --git a/resources/assets/vue/components/paymentsBilling/elements/PaymentHistoryComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/PaymentHistoryComponent.vue new file mode 100644 index 00000000..c76c9a07 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/elements/PaymentHistoryComponent.vue @@ -0,0 +1,137 @@ + + + diff --git a/resources/assets/vue/components/paymentsBilling/elements/PaymentVerificationComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/PaymentVerificationComponent.vue new file mode 100644 index 00000000..4c499bcd --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/elements/PaymentVerificationComponent.vue @@ -0,0 +1,159 @@ + + + diff --git a/resources/assets/vue/components/paymentsBilling/elements/ShippingTransactionComponent.vue b/resources/assets/vue/components/paymentsBilling/elements/ShippingTransactionComponent.vue new file mode 100644 index 00000000..0d7d29f0 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/elements/ShippingTransactionComponent.vue @@ -0,0 +1,70 @@ + + + diff --git a/resources/assets/vue/components/paymentsBilling/forms/ApproveShippingInvoiceFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/ApproveShippingInvoiceFormComponent.vue new file mode 100644 index 00000000..07d9f1cf --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/ApproveShippingInvoiceFormComponent.vue @@ -0,0 +1,31 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/paymentsBilling/forms/DeletePaymentAttemptFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/DeletePaymentAttemptFormComponent.vue new file mode 100644 index 00000000..ba371bd4 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/DeletePaymentAttemptFormComponent.vue @@ -0,0 +1,33 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemFormComponent.vue new file mode 100644 index 00000000..6243f19c --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemFormComponent.vue @@ -0,0 +1,171 @@ + + diff --git a/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemsFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemsFormComponent.vue new file mode 100644 index 00000000..e7e8f93d --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/InvoiceItemsFormComponent.vue @@ -0,0 +1,79 @@ + + diff --git a/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue new file mode 100644 index 00000000..72d56a03 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/PaymentFormComponent.vue @@ -0,0 +1,49 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/paymentsBilling/forms/PaymentVerificationFormComponent.vue b/resources/assets/vue/components/paymentsBilling/forms/PaymentVerificationFormComponent.vue new file mode 100644 index 00000000..bb1df036 --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/forms/PaymentVerificationFormComponent.vue @@ -0,0 +1,84 @@ + + + \ No newline at end of file diff --git a/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue new file mode 100644 index 00000000..8a759b4e --- /dev/null +++ b/resources/assets/vue/components/paymentsBilling/sections/AdminPaymentsBillingSectionComponent.vue @@ -0,0 +1,149 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/reports/forms/ExportCompanyModuleSummaryFormComponent.vue b/resources/assets/vue/components/reports/forms/ExportCompanyModuleSummaryFormComponent.vue new file mode 100644 index 00000000..3d3e65f5 --- /dev/null +++ b/resources/assets/vue/components/reports/forms/ExportCompanyModuleSummaryFormComponent.vue @@ -0,0 +1,63 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/elements/ListBasePriceSectionComponent.vue b/resources/assets/vue/components/settings/elements/ListBasePriceSectionComponent.vue new file mode 100644 index 00000000..cb31b4de --- /dev/null +++ b/resources/assets/vue/components/settings/elements/ListBasePriceSectionComponent.vue @@ -0,0 +1,195 @@ + + diff --git a/resources/assets/vue/components/settings/elements/ListPostcodeComponent.vue b/resources/assets/vue/components/settings/elements/ListPostcodeComponent.vue index a23f3a7c..fd9df462 100644 --- a/resources/assets/vue/components/settings/elements/ListPostcodeComponent.vue +++ b/resources/assets/vue/components/settings/elements/ListPostcodeComponent.vue @@ -15,7 +15,19 @@
-
{{data}}
+
{{data.postcode}}
+
+
+
+
+
+
+
Location
+
+
+
+
+
{{data.postcodeArea == '' ? '-' : data.postcodeArea.replaceAll('_', ' ') }}
@@ -24,7 +36,7 @@
Define Location
- +
@@ -40,7 +52,7 @@ export default { props: { data: { - type: String, + type: Object, required: false }, section: { diff --git a/resources/assets/vue/components/settings/elements/SegmentComponent.vue b/resources/assets/vue/components/settings/elements/SegmentComponent.vue new file mode 100644 index 00000000..cb43c64a --- /dev/null +++ b/resources/assets/vue/components/settings/elements/SegmentComponent.vue @@ -0,0 +1,67 @@ + + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/elements/StatesChargesComponent.vue b/resources/assets/vue/components/settings/elements/StatesChargesComponent.vue index 9e58b60d..62191046 100644 --- a/resources/assets/vue/components/settings/elements/StatesChargesComponent.vue +++ b/resources/assets/vue/components/settings/elements/StatesChargesComponent.vue @@ -27,7 +27,7 @@
-
MYR 0.00
+
MYR {{ data.stateCharges === null ? '0.00' : data.stateCharges.center }}
@@ -39,7 +39,7 @@
-
MYR 0.00
+
MYR {{ data.stateCharges === null ? '0.00' : data.stateCharges.outstation }}
@@ -48,7 +48,7 @@
Edit
- +
diff --git a/resources/assets/vue/components/settings/elements/WarehouseChargesComponent.vue b/resources/assets/vue/components/settings/elements/WarehouseChargesComponent.vue index 9deb1d48..b82479cc 100644 --- a/resources/assets/vue/components/settings/elements/WarehouseChargesComponent.vue +++ b/resources/assets/vue/components/settings/elements/WarehouseChargesComponent.vue @@ -27,9 +27,9 @@
-
MYR 0.00
+
MYR {{ data.warehouseCharges === null ? '0.00' : data.warehouseCharges.amount }}
- +
@@ -54,7 +54,7 @@ - + diff --git a/resources/assets/vue/components/settings/forms/BasePriceFormComponent.vue b/resources/assets/vue/components/settings/forms/BasePriceFormComponent.vue new file mode 100644 index 00000000..62d8deda --- /dev/null +++ b/resources/assets/vue/components/settings/forms/BasePriceFormComponent.vue @@ -0,0 +1,80 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/EditBasePriceFormComponent.vue b/resources/assets/vue/components/settings/forms/EditBasePriceFormComponent.vue new file mode 100644 index 00000000..742e95dc --- /dev/null +++ b/resources/assets/vue/components/settings/forms/EditBasePriceFormComponent.vue @@ -0,0 +1,60 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/EditSegmentPriceFormComponent.vue b/resources/assets/vue/components/settings/forms/EditSegmentPriceFormComponent.vue new file mode 100644 index 00000000..910ba2fe --- /dev/null +++ b/resources/assets/vue/components/settings/forms/EditSegmentPriceFormComponent.vue @@ -0,0 +1,60 @@ + + \ No newline at end of file diff --git a/resources/assets/vue/components/settings/forms/EditStateChargesFormComponent.vue b/resources/assets/vue/components/settings/forms/EditStateChargesFormComponent.vue index ac4052c6..e513a24c 100644 --- a/resources/assets/vue/components/settings/forms/EditStateChargesFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/EditStateChargesFormComponent.vue @@ -6,16 +6,16 @@

{{data.name}}

- +
- +
- +
- +
@@ -23,8 +23,7 @@
Cancel
- -
Confirm
+
Confirm
@@ -46,16 +45,31 @@ }, data() { return { - cityCenterCharges: '', - outskirtCharges : '', + cityCenterCharges: '', + outskirtCharges : '', + parameters: { + reference: 'STATE_RATE', + id: this.data.id, + rate: { + center: this.data.stateCharges == null ? 0 : this.data.stateCharges.center, + outstation: this.data.stateCharges == null ? 0 : this.data.stateCharges.outstation, + } + } }; }, validations: { parameters: { - cityCenterCharges: { required }, - outskirtCharges: { required }, + rate: { + center: { required }, + outstation: { required } + } } }, + methods: { + submitForm(){ + this.submit(this.route('api.segment.constant.update', 1), 'put', this.section, true, true) + }, + }, mixins: [modalFormHandler] } diff --git a/resources/assets/vue/components/settings/forms/EditWarehouseChargesFormComponent.vue b/resources/assets/vue/components/settings/forms/EditWarehouseChargesFormComponent.vue index a078576f..e72dacb4 100644 --- a/resources/assets/vue/components/settings/forms/EditWarehouseChargesFormComponent.vue +++ b/resources/assets/vue/components/settings/forms/EditWarehouseChargesFormComponent.vue @@ -6,10 +6,10 @@

{{data.name}}

- +
- +
@@ -17,8 +17,7 @@
Cancel
- -
Confirm
+
Confirm
@@ -40,14 +39,27 @@ }, data() { return { - extraCharges: '', + parameters: { + reference: 'WAREHOUSE_RATE', + id: this.data.id, + rate : { + amount: this.data.warehouseCharges == null ? 0 : this.data.warehouseCharges.amount, + } + } }; }, validations: { parameters: { - extraCharges: { required }, + rate: { + amount: { required } + } } }, + methods: { + submitForm(){ + this.submit(this.route('api.segment.constant.update', 1), 'put', this.section, true, true) + }, + }, mixins: [modalFormHandler] } diff --git a/resources/assets/vue/general/mixins/guards.js b/resources/assets/vue/general/mixins/guards.js index 64602155..168d7d56 100644 --- a/resources/assets/vue/general/mixins/guards.js +++ b/resources/assets/vue/general/mixins/guards.js @@ -5,7 +5,7 @@ export default { (this.$store.getters.isAuthenticated && !this.isProtectedRoute()&& this.isWithTokenRoute()) ? window.location.href = [7, 8].includes(this.$store.getters.getCompanyModuleType) ? this.route('last_mile_delivery.dashboard') : this.route('dashboard') : ''; }, isProtectedRoute(){ - const unprotectedRoutes = [this.route('login'), this.route('account.email.verification'), this.route('company.claim'), this.route('last_mile_delivery.login')]; + const unprotectedRoutes = [this.route('login'), this.route('signup'), this.route('account.email.verification'), this.route('company.claim'), this.route('last_mile_delivery.login')]; if(window.location.href.indexOf(this.route('company.claim')) === 0) { return false; } diff --git a/resources/views/pages/accounts/sign_up.blade.php b/resources/views/pages/accounts/sign_up.blade.php new file mode 100644 index 00000000..8bb3a1c8 --- /dev/null +++ b/resources/views/pages/accounts/sign_up.blade.php @@ -0,0 +1,24 @@ +{{-- seperate signup page form login page for marketing crm --}} +@extends('layouts.base_login') + +@section('inner_content') +
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/pages/accounts/signup.blade.php b/resources/views/pages/accounts/signup.blade.php index 1bf0db46..679e417f 100644 --- a/resources/views/pages/accounts/signup.blade.php +++ b/resources/views/pages/accounts/signup.blade.php @@ -59,7 +59,7 @@
- +
diff --git a/resources/views/pages/airShipment/quotation.blade.php b/resources/views/pages/airShipment/quotation.blade.php new file mode 100644 index 00000000..a38bb854 --- /dev/null +++ b/resources/views/pages/airShipment/quotation.blade.php @@ -0,0 +1,4 @@ +@extends('layouts.base_portal') +@section('inner_content') + +@endsection \ No newline at end of file diff --git a/resources/views/pages/containers.blade.php b/resources/views/pages/containers.blade.php index b4f2acb8..3aef1377 100644 --- a/resources/views/pages/containers.blade.php +++ b/resources/views/pages/containers.blade.php @@ -82,7 +82,7 @@
@@ -91,7 +91,7 @@
@@ -100,7 +100,7 @@
diff --git a/resources/views/pages/paymentAndBilling.blade.php b/resources/views/pages/paymentAndBilling.blade.php new file mode 100644 index 00000000..59acb35b --- /dev/null +++ b/resources/views/pages/paymentAndBilling.blade.php @@ -0,0 +1,100 @@ +@extends('layouts.base_portal') +@section('inner_content') +
+
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
Payments
+
+
+
+
+
+ {{--
+
+
+
+
+ +
+
+
+
+
Refunds
+
+
+
+
+
--}} + {{--
+
+
+
+
+ +
+
+
+
+
Supplier Bills
+
+
+
+
+
--}} +
+
+
+
+
+
+
+ + + +
+
+
+
+ {{--
+
+
+
+ + + +
+
+
+
--}} +
+
+
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/pages/settings.blade.php b/resources/views/pages/settings.blade.php index 51718eae..615f3eb3 100644 --- a/resources/views/pages/settings.blade.php +++ b/resources/views/pages/settings.blade.php @@ -52,13 +52,13 @@
-
+
-
Service Setup
+
Base Price
@@ -233,59 +233,28 @@
-
+
- -
+ +
- Service Configuration + Base Price
-
-
-
-
-
-
-
-
Payment Attempt Duration Limit
-
-
- -
-
-
-
-
-
-
-
-
- Exchange Services -
-
-
- - - - -
-
- - - +
+ + + +
+
@@ -308,16 +277,17 @@
- + +
@@ -378,7 +348,7 @@
@@ -403,7 +373,7 @@
@@ -428,7 +398,7 @@
diff --git a/resources/views/partials/header.blade.php b/resources/views/partials/header.blade.php index f1691bcb..5a37f886 100644 --- a/resources/views/partials/header.blade.php +++ b/resources/views/partials/header.blade.php @@ -10,6 +10,9 @@
+
+ +
diff --git a/resources/views/partials/menu.blade.php b/resources/views/partials/menu.blade.php index 837a7586..952060c7 100644 --- a/resources/views/partials/menu.blade.php +++ b/resources/views/partials/menu.blade.php @@ -147,6 +147,17 @@
Shipping Queue
+
+
+ +
+ +
diff --git a/routes/segment.php b/routes/segment.php index d4406d71..caf8ff82 100644 --- a/routes/segment.php +++ b/routes/segment.php @@ -9,11 +9,15 @@ Route::group(['prefix' => 'segment', 'as' => 'segment.', 'namespace' => 'Segment Route::put('/update/{id}', 'UpdateSegmentController@update')->name('update'); Route::get('/list', 'ListSegmentsController@list')->name('list'); + Route::get('/air-shipment/item-price/list', 'ListAirShipmentPriceController@list')->name('air_shipment.price.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'); - Route::put('/update/state', 'UpdateConstantStateController@update')->name('update.state'); Route::put('/update/postcode', 'UpdateConstantPostcodeController@update')->name('update.postcode'); + + Route::post('base-price/create', 'CreateBasePriceController@create')->name('basePrice.create'); + Route::get('base-price/show', 'FetchBasePriceController@fetch')->name('basePrice.show'); }); }); \ No newline at end of file diff --git a/routes/transaction.php b/routes/transaction.php index c3e1b2f2..89545b7c 100644 --- a/routes/transaction.php +++ b/routes/transaction.php @@ -5,14 +5,21 @@ 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('/payment/create', 'CreatePaymentTransactionController@create')->name('payment.create'); - Route::post('/payment/upload-verification-document/{transaction_id}', 'UploadPaymentVerificationDocumentController@upload')->name('verification.create'); - Route::put('/payment/approve/{transaction_id}/{status}', 'ApprovePaymentTransactionController@approve')->where('status', 'approve|reject')->name('approval'); + Route::group(['prefix' => 'payment', 'as' => 'payment.'], function () { + Route::post('/create', 'CreatePaymentTransactionController@create')->name('create'); + Route::post('/upload-verification-document/{transaction_id}', 'UploadPaymentVerificationDocumentController@upload')->name('verification.create'); + Route::put('/approve/{transaction_id}/{status}', 'ApprovePaymentTransactionController@approve')->where('status', 'approve|reject')->name('approval'); + }); + + Route::group(['prefix' => 'invoice', 'as' => 'invoice.'], function () { + route::post('/shipping-invoice/create', 'CreateShippingInvoiceTransactionController@create')->name('create'); + route::put('/shipping-invoice/{id}/update', 'UpdateShippingInvoiceTransactionController@update')->name('update'); + route::put('/shipping-invoice/{id}/approve', 'ApproveShippingInvoiceTransactionController@approve')->name('approve'); + }); - - route::post('/shipping-invoice/create', 'CreateShippingInvoiceTransactionController@create')->name('supplier.create'); + route::post('/shipping-invoice/calculator', 'ShippingEstimationCalculatorController@calculate')->name('shipping.estimation.calculator'); // Route::group(['prefix' => '{id}/payment', 'as' => 'payment.'], function () { // Route::post('quotation', 'FetchBookingPaymentQuotationController@fetch')->name('quotation'); diff --git a/routes/web.php b/routes/web.php index 7d9a46af..9407d990 100644 --- a/routes/web.php +++ b/routes/web.php @@ -56,10 +56,25 @@ Route::group(['prefix'=> '/last_mile_delivery', 'as' => 'last_mile_delivery.'], }); +Route::group(['prefix'=> '/air_shipment', 'as' => 'air_shipment.'], function () { + // Route::get('/', function () { + // return view('pages.accounts.signup'); + // })->name('login'); + + Route::get('/quotation', function () { + return view('pages.airShipment.quotation'); + })->name('quotation'); +}); + Route::get('', function () { return view('pages.accounts.login'); })->name('login'); +Route::get('/signup', function () { + return view('pages.accounts.sign_up'); +})->name('signup'); + + Route::group(['prefix' => 'swagger'], function () { Route::get('/', function () { return view('swagger.index'); @@ -300,6 +315,8 @@ Route::get('/settings', function () { return view('pages.settings'); })->name('settings'); +Route::get('/customer/{company_module_id}/summary', 'Exports\ExportCompanyModuleSummaryController@export')->name('customer.summary.export'); + Route::get('/customer/summary/monthly', function () { $containers = Container::whereMonth('loading_date', '>=', ((float)\Carbon\Carbon::now()->format('m') - 2))->whereYear('loading_date', (float)\Carbon\Carbon::now()->format('Y'))->get(); foreach ($containers as $container){ @@ -397,4 +414,9 @@ Route::get('/online_payment/redirect', 'Billplz\CallbackBillplzController@callba Route::get('/order/{id}', function ($id) { return view('pages.orders.profile', ['id' => $id]); -})->name('order.details'); \ No newline at end of file +})->name('order.details'); + +Route::get('/payment-and-billing', function () { + return view('pages.paymentAndBilling'); +})->name('admin.payment-and-billing'); +Route::get('/notifications/list', 'Notifications\ListNotificationsController@list')->name('notifications.list');