mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 12:34:18 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b3a296f2eb | |||
| 5a723c5fd1 | |||
| 6e9a27024b | |||
| e2e8f69f90 | |||
| e5c28faba7 | |||
| 4b81666cf2 | |||
| 4a2fb8e9e4 | |||
| ea772c3916 | |||
| f8d65d05da |
+2
-2
@@ -4,7 +4,7 @@ namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class TypeIn implements Filter
|
||||
class OwnerId implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@ class TypeIn implements Filter
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->whereIn('type', $value);
|
||||
return $builder->where('owner_id', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class TargetId implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('target_type', User::class)->where('target_id', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,6 @@ use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
|
||||
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Documents\Processors\UploadIdentityDocumentProcessor;
|
||||
@@ -77,9 +76,6 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
/** @var GenerateEmailVerificationAttemptProcessor */
|
||||
private $generateEmailVerificationAttemptProcessor;
|
||||
|
||||
/** @var FetchesCompanyModule */
|
||||
private $fetchesCompanyModule;
|
||||
|
||||
/**
|
||||
* CreateCustomerLogic constructor.
|
||||
* @param CreateUserProcessor $createUserProcessor
|
||||
@@ -92,9 +88,8 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
* @param UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor
|
||||
* @param AuthenticationProcessor $authenticationProcessor
|
||||
* @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor
|
||||
* @param FetchesCompanyModule $fetchesCompanyModule
|
||||
*/
|
||||
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor, FetchesCompanyModule $fetchesCompanyModule)
|
||||
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor)
|
||||
{
|
||||
$this->createUserProcessor = $createUserProcessor;
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
@@ -106,7 +101,6 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
$this->uploadIdentityDocumentProcessor = $uploadIdentityDocumentProcessor;
|
||||
$this->authenticationProcessor = $authenticationProcessor;
|
||||
$this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor;
|
||||
$this->fetchesCompanyModule = $fetchesCompanyModule;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,9 +126,7 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::IMPORTER);
|
||||
|
||||
$inviter = $this->fetchesCompanyModule->execute(['reference'=>'CIEF']);
|
||||
|
||||
$connectionObject = new CompanyConnectionObject($companyModule, $inviter, mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate(), 'CIEF');
|
||||
$connectionObject = new CompanyConnectionObject($companyModule, 'CIEF', mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate());
|
||||
|
||||
$connection = $this->createsCompanyConnection->execute($connectionObject);
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\ValueObjects\Constants\Notifications;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class GeneratePasswordResetLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Models\User;
|
||||
|
||||
@@ -12,11 +11,6 @@ class AuthenticationRedirect
|
||||
public function url(User $user){
|
||||
|
||||
if($user->type === RoleTypes::USER){
|
||||
|
||||
if (in_array($user->companyModule()->first()->type, [BusinessType::ONLINE_SELLER, BusinessType::LAST_MILE_DELIVERY_AGENT])) {
|
||||
return route('last_mile_delivery.dashboard');
|
||||
}
|
||||
|
||||
return route('dashboard');
|
||||
}
|
||||
|
||||
|
||||
@@ -68,11 +68,7 @@ class GeneratesAuthenticationToken {
|
||||
$companyModule = $user->companyModule()->first();
|
||||
|
||||
$claims = array_merge($claims, [
|
||||
'company_id' => $companyModule->company_id,
|
||||
'company_module_id' => $companyModule->id,
|
||||
'company_module_type' => $companyModule->type,
|
||||
'company_name' => $companyModule->name,
|
||||
'company_marking' => $companyModule->type !== 8 ? $companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference : 'HWT',
|
||||
'company_id' => $companyModule->company_id
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use ErrorException;
|
||||
@@ -83,7 +82,7 @@ class CreateAddressLogic extends AbstractControllerLogic
|
||||
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
|
||||
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), $request->input('type'), ApprovalStatus::APPROVED, $request->input('reference'));
|
||||
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), $request->input('reference'));
|
||||
|
||||
$this->canCreateAddress->passes($object);
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@ use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -81,7 +79,7 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
||||
{
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
|
||||
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), AddressType::DELIVERY, ApprovalStatus::APPROVED, $request->input('reference'));
|
||||
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), $request->input('reference'));
|
||||
|
||||
$this->canUpdateAddress->passes($object);
|
||||
|
||||
|
||||
@@ -26,12 +26,6 @@ class AddressObject implements DataTransferObject
|
||||
/** @var int */
|
||||
private $postCode;
|
||||
|
||||
/** @var int */
|
||||
private $type;
|
||||
|
||||
/** @var int */
|
||||
private $status;
|
||||
|
||||
/** @var string|null */
|
||||
private $reference;
|
||||
|
||||
@@ -43,11 +37,9 @@ class AddressObject implements DataTransferObject
|
||||
* @param int $stateId
|
||||
* @param int $districtId
|
||||
* @param int $postCode
|
||||
* @param int $type
|
||||
* @param int $status
|
||||
* @param null|string $reference
|
||||
*/
|
||||
public function __construct(string $streetOne, ?string $streetTwo, int $countryId, int $stateId, int $districtId, int $postCode, int $type, int $status, ?string $reference = null)
|
||||
public function __construct(string $streetOne, ?string $streetTwo, int $countryId, int $stateId, int $districtId, int $postCode, ?string $reference = null, ?int $status = ApprovalStatus::APPROVED)
|
||||
{
|
||||
$this->streetOne = $streetOne;
|
||||
$this->streetTwo = $streetTwo;
|
||||
@@ -55,9 +47,8 @@ class AddressObject implements DataTransferObject
|
||||
$this->stateId = $stateId;
|
||||
$this->districtId = $districtId;
|
||||
$this->postCode = $postCode;
|
||||
$this->type = $type;
|
||||
$this->status = $status;
|
||||
$this->reference = $reference;
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,11 +100,11 @@ class AddressObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @return null|string
|
||||
*/
|
||||
public function getType(): int
|
||||
public function getReference(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,13 +115,5 @@ class AddressObject implements DataTransferObject
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getReference(): ?string
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,8 +10,6 @@ namespace App\Classes\Modules\Addresses\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\District;
|
||||
use App\Models\OldAddress;
|
||||
|
||||
@@ -33,7 +31,7 @@ class CleansOldAddress
|
||||
return null;
|
||||
}
|
||||
|
||||
return new AddressObject($this->cleanAddress($address->street_one, $district, $address->post_code), $this->cleanAddress($address->street_two, $district, $address->post_code), $district->country_id, $district->state_id, $district->id, $address->post_code, AddressType::DELIVERY, ApprovalStatus::APPROVED, 'Delivery Address');
|
||||
return new AddressObject($this->cleanAddress($address->street_one, $district, $address->post_code), $this->cleanAddress($address->street_two, $district, $address->post_code), $district->country_id, $district->state_id, $district->id, $address->post_code, 'Delivery Address');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ class CreatesAddress extends AbstractUpdateRelationshipRecord
|
||||
$model->district_id = $object->getDistrictId();
|
||||
$model->postcode = $object->getPostCode();
|
||||
$model->status = $object->getStatus();
|
||||
$model->type = $object->getType();
|
||||
|
||||
return $this->handler($addressable->addresses(), $model);
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CallbackBillplzLogic
|
||||
{
|
||||
|
||||
|
||||
/** @var GetBillplzBill */
|
||||
private $getBillplzBill;
|
||||
|
||||
@@ -45,11 +47,12 @@ class CallbackBillplzLogic
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param UpdatesWalletBalance $updatesWalletBalance
|
||||
*/
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus)
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdatesWalletBalance $updatesWalletBalance)
|
||||
{
|
||||
$this->getBillplzBill = $getBillplzBill;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updatesWalletBalance = $updatesWalletBalance;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,11 +84,22 @@ class CallbackBillplzLogic
|
||||
$status = $billplzXSignatureObject->getStatus() === 'failed' ? ApprovalStatus::REJECTED : ApprovalStatus::PENDING_VERIFICATION;
|
||||
}
|
||||
|
||||
if($transaction->status !== ApprovalStatus::COMPLETED){
|
||||
|
||||
if($transaction->owner instanceof Wallet && $transaction->status !== ApprovalStatus::APPROVED && $status === ApprovalStatus::APPROVED) {
|
||||
$this->updatesWalletBalance->execute($transaction->owner, $transaction->amount);
|
||||
}
|
||||
$this->updatesTransactionStatus->execute($transaction, $status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
|
||||
$marking = $transaction->owner()->first()->owner()->first();
|
||||
$marking = $transaction->owner instanceof Booking ? $transaction->booking->marking : $transaction->owner->owner->bookings()->orderBy('id', 'DESC')->first()->marking;
|
||||
|
||||
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $marking, 'transaction' => $transaction, 'status' => $status]);
|
||||
|
||||
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $marking->reference, 'transaction' => $transaction, 'status' => $status]);
|
||||
}
|
||||
}
|
||||
+18
-1
@@ -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);
|
||||
}
|
||||
|
||||
@@ -10,9 +10,6 @@ class CompanyConnectionObject implements DataTransferObject
|
||||
|
||||
/** @var CompanyModule */
|
||||
private $invitee;
|
||||
|
||||
/** @var CompanyModule */
|
||||
private $inviter;
|
||||
|
||||
/** @var string */
|
||||
private $inviterReference;
|
||||
@@ -23,14 +20,12 @@ class CompanyConnectionObject implements DataTransferObject
|
||||
/**
|
||||
* CompanyConnectionObject constructor.
|
||||
* @param CompanyModule $invitee
|
||||
* @param CompanyModule $inviter
|
||||
* @param string $inviterReference
|
||||
* @param string $inviteeReference
|
||||
*/
|
||||
public function __construct(CompanyModule $invitee, CompanyModule $inviter, string $inviteeReference, string $inviterReference)
|
||||
public function __construct(CompanyModule $invitee, string $inviterReference, string $inviteeReference)
|
||||
{
|
||||
$this->invitee = $invitee;
|
||||
$this->inviter = $inviter;
|
||||
$this->inviterReference = $inviterReference;
|
||||
$this->inviteeReference = $inviteeReference;
|
||||
}
|
||||
@@ -43,14 +38,6 @@ class CompanyConnectionObject implements DataTransferObject
|
||||
return $this->invitee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CompanyModule
|
||||
*/
|
||||
public function getInviter(): CompanyModule
|
||||
{
|
||||
return $this->inviter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -30,8 +30,10 @@ class CreatesCompanyConnection extends AbstractUpdateRecord
|
||||
public function execute(CompanyConnectionObject $object)
|
||||
{
|
||||
|
||||
$companyModule = $this->fetchesCompany->execute(['id', 1])->companyModules()->first();
|
||||
|
||||
$connection = new CompanyConnection();
|
||||
$connection->inviter_id = $object->getInviter()->id;
|
||||
$connection->inviter_id = $companyModule->id;
|
||||
$connection->invitee_id = $object->getInvitee()->id;
|
||||
$connection->inviter_reference = $object->getInviterReference();
|
||||
$connection->invitee_reference = $object->getInviteeReference();
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Delivery\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\CancelsOrder;
|
||||
use App\Classes\Modules\Orders\Services\FetchesOrder;
|
||||
use App\Http\Resources\DeliveryOrderResource;
|
||||
use App\Models\Order;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CancelDeliveryOrderLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Cancelled Order',
|
||||
'message' => 'You have successfully cancelled an order'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CancelsOrder */
|
||||
private $cancelsOrder;
|
||||
|
||||
/** @var FetchesOrder */
|
||||
private $fetchesOrder;
|
||||
|
||||
/**
|
||||
* CancelDeliveryOrderLogic constructor.
|
||||
* @param CancelsOrder $cancelsOrder
|
||||
* @param FetchesOrder $fetchesOrder
|
||||
*/
|
||||
public function __construct(CancelsOrder $cancelsOrder, FetchesOrder $fetchesOrder)
|
||||
{
|
||||
$this->cancelsOrder = $cancelsOrder;
|
||||
$this->fetchesOrder = $fetchesOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
/** @var Order $order */
|
||||
$order = $this->fetchesOrder->execute(['id' => $request->route('id')]);
|
||||
|
||||
return $this->resourceResponse(new DeliveryOrderResource($this->cancelsOrder->execute($order)));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Delivery\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\General\Services\GeneratesInitials;
|
||||
use App\Classes\Modules\Accounts\Processors\AuthenticationProcessor;
|
||||
use App\Classes\Modules\Accounts\Processors\CreateUserProcessor;
|
||||
use App\Classes\Modules\Accounts\Processors\GenerateEmailVerificationAttemptProcessor;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
|
||||
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
|
||||
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Documents\Processors\UploadIdentityDocumentProcessor;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\User;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreateDeliveryCustomerLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created User',
|
||||
'message' => 'You have successfully created a new User'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CreateUserProcessor */
|
||||
private $createUserProcessor;
|
||||
|
||||
/** @var CreateCompanyProcessor */
|
||||
private $createCompanyProcessor;
|
||||
|
||||
/** @var CreateCompanyModuleProcessor */
|
||||
private $createCompanyModuleProcessor;
|
||||
|
||||
/** @var CreateContactProcessor */
|
||||
private $createContactProcessor;
|
||||
|
||||
/** @var CreatesCompanyConnection */
|
||||
private $createsCompanyConnection;
|
||||
|
||||
/** @var ApprovesCompanyConnection */
|
||||
private $approvesCompanyConnection;
|
||||
|
||||
/** @var AssignEmployeeProcessor */
|
||||
private $assignEmployeeProcessor;
|
||||
|
||||
/** @var UploadIdentityDocumentProcessor */
|
||||
private $uploadIdentityDocumentProcessor;
|
||||
|
||||
/** @var AuthenticationProcessor */
|
||||
private $authenticationProcessor;
|
||||
|
||||
/** @var GenerateEmailVerificationAttemptProcessor */
|
||||
private $generateEmailVerificationAttemptProcessor;
|
||||
|
||||
/** @var FetchesCompanyModule */
|
||||
private $fetchesCompanyModule;
|
||||
|
||||
/**
|
||||
* CreateDeliveryCustomerLogic constructor.
|
||||
* @param CreateUserProcessor $createUserProcessor
|
||||
* @param CreateCompanyProcessor $createCompanyProcessor
|
||||
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
|
||||
* @param CreateContactProcessor $createContactProcessor
|
||||
* @param CreatesCompanyConnection $createsCompanyConnection
|
||||
* @param ApprovesCompanyConnection $approvesCompanyConnection
|
||||
* @param AssignEmployeeProcessor $assignEmployeeProcessor
|
||||
* @param UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor
|
||||
* @param AuthenticationProcessor $authenticationProcessor
|
||||
* @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor
|
||||
* @param FetchesCompanyModule $fetchesCompanyModule
|
||||
*/
|
||||
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor, FetchesCompanyModule $fetchesCompanyModule)
|
||||
{
|
||||
$this->createUserProcessor = $createUserProcessor;
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
|
||||
$this->createContactProcessor = $createContactProcessor;
|
||||
$this->createsCompanyConnection = $createsCompanyConnection;
|
||||
$this->approvesCompanyConnection = $approvesCompanyConnection;
|
||||
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
|
||||
$this->uploadIdentityDocumentProcessor = $uploadIdentityDocumentProcessor;
|
||||
$this->authenticationProcessor = $authenticationProcessor;
|
||||
$this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor;
|
||||
$this->fetchesCompanyModule = $fetchesCompanyModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\AccessUnauthorisedException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->createUserProcessor->execute($request, RoleTypes::USER, !App::environment(['production']) ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
/** @var Company $company */
|
||||
$company = $this->createCompanyProcessor->execute($request->input('name'), CompanyType::PERSONAL_BUSINESS, ApprovalStatus::PENDING_SUBMISSION);
|
||||
|
||||
$contactObject = new ContactObject($request->input('name'), $request->input('phone'), $request->input('contact_email'), $request->input('wechat_id'));
|
||||
|
||||
$this->createContactProcessor->execute($contactObject, $company);
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::ONLINE_SELLER);
|
||||
|
||||
$inviter = $this->fetchesCompanyModule->execute(['reference'=>'HWT']);
|
||||
|
||||
$connectionObject = new CompanyConnectionObject($companyModule, $inviter, mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate(), 'HWT');
|
||||
|
||||
$connection = $this->createsCompanyConnection->execute($connectionObject);
|
||||
|
||||
$this->approvesCompanyConnection->execute($connection);
|
||||
|
||||
$Object = new EmploymentObject($companyModule, $user);
|
||||
|
||||
$this->assignEmployeeProcessor->execute($Object);
|
||||
|
||||
return $this->response($this->authenticationProcessor->execute($request));
|
||||
}
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Delivery\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
||||
use App\Classes\Modules\Orders\Services\CreatesOrder;
|
||||
use App\Classes\Modules\Orders\Services\GeneratesOrderNumber;
|
||||
use App\Classes\Modules\Orders\Standards\Rules\CanCreateOrder;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
use App\Classes\Modules\PackingLists\Services\CreatesPackingList;
|
||||
use App\Classes\Modules\PackingLists\Services\Packages\CreatesPackage;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Http\Resources\DeliveryOrderResource;
|
||||
use App\Models\Address;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\Order;
|
||||
use App\Models\PackingList;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateDeliveryOrderLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created Order',
|
||||
'message' => 'You have successfully created a new Order'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var fetchesAddress */
|
||||
private $fetchesAddress;
|
||||
|
||||
/** @var CanCreateOrder */
|
||||
private $canCreateOrder;
|
||||
|
||||
/** @var CreatesOrder */
|
||||
private $createsOrder;
|
||||
|
||||
/** @var CreatesAddress */
|
||||
private $createAddress;
|
||||
|
||||
/** @var CreateContactProcessor */
|
||||
private $createContactProcessor;
|
||||
|
||||
/** @var CreateRemarkProcessor */
|
||||
private $createRemarkProcessor;
|
||||
|
||||
/** @var GeneratesOrderNumber */
|
||||
private $generatesOrderNumber;
|
||||
|
||||
/** @var CreatesPackingList */
|
||||
private $createsPackingList;
|
||||
|
||||
/** @var CreatesPackage */
|
||||
private $createsPackage;
|
||||
|
||||
|
||||
/**
|
||||
* CreateDeliveryOrderLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param FetchesAddress $fetchesAddress
|
||||
* @param CanCreateOrder $canCreateOrder
|
||||
* @param CreatesOrder $createsOrder
|
||||
* @param CreatesAddress $createAddress
|
||||
* @param CreateContactProcessor $createContactProcessor
|
||||
* @param CreateRemarkProcessor $createRemarkProcessor
|
||||
* @param GeneratesOrderNumber $generatesOrderNumber
|
||||
* @param CreatesPackingList $createsPackingList
|
||||
* @param CreatesPackage $createPackage
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesAddress $fetchesAddress, CanCreateOrder $canCreateOrder, CreatesOrder $createsOrder, CreatesAddress $createAddress, CreateContactProcessor $createContactProcessor, CreateRemarkProcessor $createRemarkProcessor, GeneratesOrderNumber $generatesOrderNumber, CreatesPackingList $createsPackingList, CreatesPackage $createsPackage)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesAddress = $fetchesAddress;
|
||||
$this->canCreateOrder = $canCreateOrder;
|
||||
$this->createsOrder = $createsOrder;
|
||||
$this->createAddress = $createAddress;
|
||||
$this->createContactProcessor = $createContactProcessor;
|
||||
$this->createRemarkProcessor = $createRemarkProcessor;
|
||||
$this->generatesOrderNumber = $generatesOrderNumber;
|
||||
$this->createsPackingList = $createsPackingList;
|
||||
$this->createsPackage = $createsPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->input('company_id')]);
|
||||
|
||||
$senderAddress = $this->fetchesAddress->execute(['id' => $request->input('sender_address_id')]);
|
||||
$deliveryAddress = $this->fetchesAddress->execute(['id' => $request->input('delivery_address_id')]);
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $company->companyModules()->where('type', BusinessType::ONLINE_SELLER)->first();
|
||||
|
||||
$orderObject = new OrderObject($this->generatesOrderNumber->execute('168M', 7), OrderType::LAST_MILE_DELIVERY, ApprovalStatus::APPROVED);
|
||||
|
||||
$this->canCreateOrder->passes($orderObject);
|
||||
|
||||
/** @var Order $order */
|
||||
$order = $this->createsOrder->execute($companyModule, $orderObject);
|
||||
|
||||
$senderAddressObject = new AddressObject($senderAddress->street_one, $senderAddress->street_two, $senderAddress->country_id, $senderAddress->state_id, $senderAddress->district_id, $senderAddress->postcode, $senderAddress->type, ApprovalStatus::APPROVED, $senderAddress->reference);
|
||||
$deliveryAddressObject = new AddressObject($deliveryAddress->street_one, $deliveryAddress->street_two, $deliveryAddress->country_id, $deliveryAddress->state_id, $deliveryAddress->district_id, $deliveryAddress->postcode, $deliveryAddress->type, ApprovalStatus::APPROVED, $deliveryAddress->reference);
|
||||
|
||||
/** @var Address $orderSenderAddress */
|
||||
$orderSenderAddress = $this->createAddress->execute($order, $senderAddressObject);
|
||||
/** @var Address $orderDeliveryAddress */
|
||||
$orderDeliveryAddress = $this->createAddress->execute($order, $deliveryAddressObject);
|
||||
|
||||
$senderContact = $senderAddress->contacts()->first();
|
||||
$deliveryContact = $deliveryAddress->contacts()->first();
|
||||
|
||||
$contactObject = new ContactObject($senderContact->reference, $senderContact->phone, '','');
|
||||
$this->createContactProcessor->execute($contactObject, $orderSenderAddress);
|
||||
|
||||
$contactObject = new ContactObject($deliveryContact->reference, $deliveryContact->phone, '','');
|
||||
$this->createContactProcessor->execute($contactObject, $orderDeliveryAddress);
|
||||
|
||||
$senderRemark = $senderAddress->remarks()->first();
|
||||
$deliveryRemark = $deliveryAddress->remarks()->first();
|
||||
|
||||
if ($senderRemark){
|
||||
$remarkObject = new RemarkObject($senderRemark->content, Auth()->user()->id);
|
||||
|
||||
if($remarkObject->getContent()){
|
||||
$this->createRemarkProcessor->execute($orderSenderAddress, $remarkObject);
|
||||
}
|
||||
}
|
||||
|
||||
if ($deliveryRemark){
|
||||
$remarkObject = new RemarkObject($deliveryRemark->content, Auth()->user()->id);
|
||||
|
||||
if($remarkObject->getContent()){
|
||||
$this->createRemarkProcessor->execute($orderDeliveryAddress, $remarkObject);
|
||||
}
|
||||
}
|
||||
|
||||
$packingListObject = new PackingListObject($order->reference, $companyModule->id, PackingListType::DELIVERY_PACKING_LIST, ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
/** @var PackingList $packingList */
|
||||
$packingList = $this->createsPackingList->execute($packingListObject, $order);
|
||||
|
||||
$packageObject = new PackageObject($request->input('packing_list.type'), $request->input('packing_list.description'), (float) 1, (float) 1, (float) 1, $request->input('packing_list.weight'), (float) $request->input('packing_list.quantity'), ApprovalStatus::APPROVED);
|
||||
$this->createsPackage->execute($packageObject, $packingList);
|
||||
|
||||
return $this->resourceResponse(new DeliveryOrderResource($order));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Delivery\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\ListsOrders;
|
||||
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Http\Resources\DeliveryOrderResource;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListOrdersLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Orders',
|
||||
'message' => 'You have successfully retrieved a list of Orders'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanListOrders */
|
||||
private $canListOrders;
|
||||
|
||||
/** @var ListsOrders */
|
||||
private $listsOrders;
|
||||
|
||||
/**
|
||||
* ListOrdersLogic constructor.
|
||||
* @param CanListOrders $canListOrders
|
||||
* @param ListsOrders $listsOrders
|
||||
*/
|
||||
public function __construct(CanListOrders $canListOrders, ListsOrders $listsOrders)
|
||||
{
|
||||
$this->canListOrders = $canListOrders;
|
||||
$this->listsOrders = $listsOrders;
|
||||
}
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$this->canListOrders->passes();
|
||||
|
||||
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::LAST_MILE_DELIVERY]]));
|
||||
|
||||
return $this->collectionResponse(DeliveryOrderResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\PackingList;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Carbon\Carbon;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
|
||||
class ExportsArrivedParcel implements WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, FromCollection
|
||||
{
|
||||
|
||||
use Exportable;
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'ORDER NUMBER',
|
||||
'Marking',
|
||||
'Warehouse',
|
||||
'Cbm',
|
||||
'Description',
|
||||
'quantity',
|
||||
'Received Date',
|
||||
'Remarks'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
$returnArray = collect();
|
||||
|
||||
$packingLists = PackingList::where('type', '=', 1)->where('status', '=', 2)->get();
|
||||
$exceptionUsers = in_array(Auth()->user()->type, [RoleTypes::SHADOW_ADMIN, RoleTypes::SUPER_ADMIN]);
|
||||
|
||||
foreach($packingLists as $packingList){
|
||||
$packages = !$packingList->packingLists()->exists() || $exceptionUsers ? $packingList->packages : $packingList->packingLists->first()->packages;
|
||||
foreach ($packages as $package) {
|
||||
$returnArray->push($package);
|
||||
}
|
||||
}
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReturnArray $returnArray
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($package): array
|
||||
{
|
||||
$packingList = $package->packingList;
|
||||
$order = $packingList->owner;
|
||||
|
||||
$connection = $order->companyModule()->first()->inviters()->withPivot('invitee_reference')->first();
|
||||
$marking = $connection ? $connection->pivot->invitee_reference:'';
|
||||
|
||||
$warehouse = $order->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee;
|
||||
|
||||
$cbm = (($package->width / 100) * ($package->height / 100) * ($package->length / 100)) * $package->quantity;
|
||||
|
||||
$arrival_date = $packingList->transports()->first()->drop_date->format('d-m-Y');
|
||||
|
||||
return [
|
||||
$packingList->owner->reference,
|
||||
$marking,
|
||||
$warehouse->reference,
|
||||
$cbm,
|
||||
$package->description,
|
||||
$package->quantity,
|
||||
$arrival_date,
|
||||
''
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Classes\ValueObjects\Constants\PackageType;
|
||||
use App\Models\Order;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ExportsDeliveryOrders implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, WithTitle
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Types_Of_Services',
|
||||
'Service_Type',
|
||||
'Sender_Name',
|
||||
'Sender_Company_Name',
|
||||
'Sender_Building_Unit',
|
||||
'Sender_Address',
|
||||
'Sender_Address_2',
|
||||
'Sender_Postal_Code',
|
||||
'Sender_Phone_Number',
|
||||
'Delivery_Name',
|
||||
'Delivery Company Name',
|
||||
'Delivery_Building_Unit',
|
||||
'Delivery_Address',
|
||||
'Delivery_Address_2',
|
||||
'Delivery_Postal_Code',
|
||||
'Delivery_Phone_Number',
|
||||
'Shipment_Type',
|
||||
'Mode',
|
||||
'Pickup_Address_Type',
|
||||
'Reference_Number',
|
||||
'Quantity',
|
||||
'Weight',
|
||||
'Length',
|
||||
'Width',
|
||||
'Height',
|
||||
'COD_Amount',
|
||||
'DO_Numbers'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$selectedIds = array_map(function($value){
|
||||
return ['id' => $value];
|
||||
}, json_decode($this->request->input('ids')));
|
||||
|
||||
return Order::where('type', OrderType::LAST_MILE_DELIVERY)->whereIn('id', $selectedIds);
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'bulk-shipment';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($order): array
|
||||
{
|
||||
$senderAddress = $order->addresses()->where('type', AddressType::PICK_UP)->first();
|
||||
$deliveryAddress = $order->addresses()->where('type', AddressType::DELIVERY)->first();
|
||||
$package = $order->packingLists()->first()->packages()->first();
|
||||
|
||||
return [
|
||||
'Domestic Shipment',
|
||||
'ST00000020',
|
||||
$senderAddress->contacts()->first()->reference,
|
||||
$senderAddress->reference ? $senderAddress->reference : $order->companyModule->name,
|
||||
$senderAddress->street_one,
|
||||
$senderAddress->street_two.' '.$senderAddress->district->name.' '.$senderAddress->postcode.' '.$senderAddress->state->name.' '.$senderAddress->country->name,
|
||||
'',
|
||||
$senderAddress->postcode,
|
||||
$senderAddress->contacts()->first()->phone,
|
||||
$deliveryAddress->contacts()->first()->reference,
|
||||
$deliveryAddress->reference,
|
||||
$deliveryAddress->street_one,
|
||||
$deliveryAddress->street_two.' '.$deliveryAddress->district->name.' '.$deliveryAddress->postcode.' '.$deliveryAddress->state->name.' '.$deliveryAddress->country->name,
|
||||
'',
|
||||
$deliveryAddress->postcode,
|
||||
$deliveryAddress->contacts()->first()->phone,
|
||||
$package->type === PackageType::CARTON ? 'Package' : ($package->type === PackageType::PALLET ? 'Pallet' : 'Documents'),
|
||||
'Pick Up',
|
||||
'Default',
|
||||
$order->reference,
|
||||
$package->quantity,
|
||||
$package->weight * $package->quantity,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
'',
|
||||
''
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ExportsDeliveryValidValues implements WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, WithTitle, FromCollection
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* ExportsDeliveryValidValues constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Types_Of_Services',
|
||||
'Service_Type',
|
||||
'Mode',
|
||||
'Flag',
|
||||
'Pickup Address'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
$returnArray = collect();
|
||||
|
||||
$returnArray->push(['Domestic Shipment', 'Package', 'Pick Up', 'Yes', 'Default']);
|
||||
$returnArray->push(['', 'Documents', 'Lodge In / Walk In', 'No', 'Sender']);
|
||||
$returnArray->push(['', 'Pallet', '', '', '']);
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'valid-values';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReturnArray $returnArray
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($returnArray): array
|
||||
{
|
||||
return [
|
||||
$returnArray[0],
|
||||
$returnArray[1],
|
||||
$returnArray[2],
|
||||
$returnArray[3],
|
||||
$returnArray[4],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsDeliveryOrders;
|
||||
use App\Classes\Modules\Exports\Services\ExportsDeliveryValidValues;
|
||||
use App\Models\Order;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
||||
class ExportsMultipleDeliveryOrders implements WithMultipleSheets
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* ExportsMultipleDeliveryOrders constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function sheets(): array
|
||||
{
|
||||
$sheets = [];
|
||||
$sheets[] = new ExportsDeliveryOrders($this->request);
|
||||
$sheets[] = new ExportsDeliveryValidValues($this->request);
|
||||
|
||||
return $sheets;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\PackingList;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ExportsOnHoldPackingList implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
|
||||
{
|
||||
|
||||
use Exportable;
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Container Ref.',
|
||||
'ETA',
|
||||
'Unstuffing',
|
||||
'Marking',
|
||||
'Order Number'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
return PackingList::where('type', '=', 2)->whereIn('status', [4, 5])->whereHas('containers');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PackingList $packingList
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($packingList): array
|
||||
{
|
||||
$container = $packingList->containers()->first();
|
||||
$ContainerTransport = $container->transports()->first();
|
||||
$order = $packingList->owner;
|
||||
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
|
||||
|
||||
return [
|
||||
$container->reference,
|
||||
$ContainerTransport ? $ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->eta : 'n/a',
|
||||
$ContainerTransport ? $ContainerTransport->drop_date : 'n/a',
|
||||
$marking,
|
||||
$order->reference,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\PackingList;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
|
||||
{
|
||||
|
||||
use Exportable;
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Container Ref.',
|
||||
'ETA',
|
||||
'Unstuffing',
|
||||
'Marking',
|
||||
'Order Number',
|
||||
'status',
|
||||
'Delay Days / delivery date',
|
||||
'Quantity',
|
||||
'State',
|
||||
'Postcode',
|
||||
'Address',
|
||||
'PIC',
|
||||
'Phone',
|
||||
'Remark'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
return PackingList::where('type', '=', 2)->whereHas('containers', function ($query){
|
||||
$query->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PackingList $packingList
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($packingList): array
|
||||
{
|
||||
$container = $packingList->containers()->first();
|
||||
$ContainerTransport = $container->transports()->first();
|
||||
$order = $packingList->owner;
|
||||
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
|
||||
$address = $order->addresses()->where('status', ApprovalStatus::APPROVED)->first();
|
||||
$contacts = $address->contacts->first() ? $address->contacts->first(): '';
|
||||
$originalPackingList = $packingList->owner instanceof PackingList ? $packingList->owner : $packingList;
|
||||
$transport = $originalPackingList->containers()->first()->transports()->first();
|
||||
$deliveryTransport = $originalPackingList->transports()->first();
|
||||
|
||||
return [
|
||||
$container->reference,
|
||||
$ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->eta,
|
||||
$ContainerTransport->drop_date,
|
||||
$marking,
|
||||
$order->reference,
|
||||
$deliveryTransport ? (Carbon::parse($deliveryTransport->schedules()->first()->eta) < Carbon::now() ? 'Delivered' : 'Pending Delivery') : 'Pending Arrangement',
|
||||
$deliveryTransport ? $deliveryTransport->schedules()->first()->eta : ($transport ? Carbon::now()->diffInDays($transport->drop_date, false) . ' Days' : ''),
|
||||
$packingList->packages()->sum('quantity'),
|
||||
$address->state->name,
|
||||
$address->postcode,
|
||||
$address->street_one.', '.$address->street_two.' '.$address->district->name.' '.$address->postcode.' '.$address->state->name.' '.$address->country->name,
|
||||
$address->remarks->first() ? $address->remarks->first()->content: '',
|
||||
$contacts ? $contacts ->reference : '',
|
||||
$contacts ? $contacts ->phone : '',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Notifications\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Notifications\Services\ListsNotification;
|
||||
use App\Http\Resources\NotificationResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListNotificationsLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => '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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Notifications\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractListRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\Notification;
|
||||
|
||||
class ListsNotification extends AbstractListRecord
|
||||
{
|
||||
|
||||
/** @var Bank */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsBank constructor.
|
||||
* @param Notification $repository
|
||||
*/
|
||||
public function __construct(Notification $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ class CreateOrderLogic extends AbstractControllerLogic
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $request->input('warehouse_id')]);
|
||||
|
||||
if(!in_array($company->companyModules()->importers()->first()->id, WarehouseReferences::YD_EXEMPT_LIST)){
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => $originWarehouse->reference === WarehouseReferences::VT_GUANG_ZHOU ? WarehouseReferences::YD_GUANG_ZHOU_2 : WarehouseReferences::YD_YIWU]);
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => $originWarehouse->reference === WarehouseReferences::VT_GUANG_ZHOU ? WarehouseReferences::YD_GUANG_ZHOU : WarehouseReferences::YD_YIWU]);
|
||||
}
|
||||
|
||||
if($originWarehouse->reference === WarehouseReferences::YD_YIWU && in_array($address->state_id, [5, 13, 14])) {
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\ListsOrders;
|
||||
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -45,7 +44,7 @@ class ListOrdersLogic extends AbstractControllerLogic
|
||||
{
|
||||
$this->canListOrders->passes();
|
||||
|
||||
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::SHARED_CONTAINER, OrderType::DEDICATED_CONTAINER]]));
|
||||
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true]));
|
||||
|
||||
return $this->collectionResponse(OrderResource::collection($query));
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
class OrderObject implements DataTransferObject
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
/** @var int */
|
||||
private $reference;
|
||||
|
||||
/** @var int */
|
||||
@@ -20,11 +20,11 @@ class OrderObject implements DataTransferObject
|
||||
|
||||
/**
|
||||
* OrderObject constructor.
|
||||
* @param string $reference
|
||||
* @param int $reference
|
||||
* @param int $type
|
||||
* @param int|null $status
|
||||
*/
|
||||
public function __construct(string $reference, int $type, ?int $status)
|
||||
public function __construct(int $reference, int $type, ?int $status = ApprovalStatus::PENDING_VERIFICATION)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$this->type = $type;
|
||||
@@ -32,9 +32,9 @@ class OrderObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return int
|
||||
*/
|
||||
public function getReference(): string
|
||||
public function getReference(): int
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
@@ -48,13 +48,12 @@ class OrderObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
* @return int
|
||||
*/
|
||||
public function getStatus(): ?int
|
||||
public function getStatus(): int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use App\Classes\Modules\Orders\Standards\Rules\CanApproveChangeOrderAddress;
|
||||
use App\Classes\Modules\Orders\Services\UpdatesOrdersAddress;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ApproveChangeOrderAddressProcessor
|
||||
@@ -66,11 +65,7 @@ class ApproveChangeOrderAddressProcessor
|
||||
$address->owner->addresses()->update(['status' => ApprovalStatus::EXPIRED]);
|
||||
|
||||
$appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
|
||||
if($appointee === 2) {
|
||||
foreach($address->owner->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST) as $packingList){
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
}
|
||||
}
|
||||
$appointee === 2 ? $this->updateDoFromVTPortalProcessor->execute($address) : $this->updateDoFromYDPortalProcessor->execute($address);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class CreateOrderProcessor
|
||||
/** @var Order $order */
|
||||
$order = $this->createsOrder->execute($importer, $orderObject);
|
||||
|
||||
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, $address->type, ApprovalStatus::APPROVED, $address->reference);
|
||||
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode,$address->reference);
|
||||
|
||||
/** @var Address $order_address */
|
||||
$order_address = $this->createAddress->execute($order, $addressObject);
|
||||
|
||||
@@ -8,7 +8,6 @@ use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\DeletesAddress;
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
@@ -77,7 +76,7 @@ class RequestChangeOrderAddressProcessor
|
||||
}
|
||||
|
||||
$address = $this->fetchesAddress->execute(['id' => $request->get('address_id')]);
|
||||
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, AddressType::DELIVERY, ApprovalStatus::PENDING_VERIFICATION, $address->reference);
|
||||
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, $address->reference, ApprovalStatus::PENDING_VERIFICATION);
|
||||
$order_address = $this->createsAddress->execute($order, $addressObject);
|
||||
|
||||
$contact = $address->contacts()->first();
|
||||
|
||||
@@ -6,9 +6,23 @@ use App\Classes\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\Services\FetchesDataFromVTPortal;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
|
||||
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
|
||||
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
|
||||
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
||||
use App\Classes\Modules\Transports\Services\CreatesTransport;
|
||||
use App\Classes\Modules\Unity\Services\UpdatesContractObligation;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\TransportType;
|
||||
use App\Models\PackingList;
|
||||
use App\Models\Transport;
|
||||
use Carbon\Carbon;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateDoFromVTPortalProcessor
|
||||
{
|
||||
/** @var FetchesDataFromVTPortal */
|
||||
@@ -29,20 +43,19 @@ class UpdateDoFromVTPortalProcessor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PackingList $packing_list
|
||||
* @param $address
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function execute(PackingList $packing_list) {
|
||||
public function execute($address) {
|
||||
|
||||
if(!app()->environment(['production'])){
|
||||
return [];
|
||||
}
|
||||
|
||||
try {
|
||||
$address= $packing_list->owner->addresses()->where('status', ApprovalStatus::APPROVED)->first();
|
||||
$order = $packing_list->owner;
|
||||
$order = $address->owner()->orderBy('id', 'desc')->first();
|
||||
$packing_list = $order->packingLists()->orderBy('id', 'desc')->first();
|
||||
|
||||
if ($packing_list) {
|
||||
$contact = $address->contacts()->first();
|
||||
@@ -54,7 +67,7 @@ class UpdateDoFromVTPortalProcessor
|
||||
|
||||
$status = 'On Hold';
|
||||
|
||||
if (in_array($packing_list->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
if (in_array($packing_list->status, [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
$status = 'Release';
|
||||
}
|
||||
|
||||
@@ -64,7 +77,6 @@ class UpdateDoFromVTPortalProcessor
|
||||
|
||||
if ($vt_do) {
|
||||
foreach ($vt_do->Rows as $key => $row) {
|
||||
if($row[4] !== $packing_list->containers()->first()->reference) continue;
|
||||
$vt_do_update = $this->fetchesDataFRomVTPortal->clientRequest(
|
||||
'http://portal.vtnation.com.my/Services/DataControllerService.asmx/Execute',
|
||||
'POST',
|
||||
@@ -129,7 +141,7 @@ class UpdateDoFromVTPortalProcessor
|
||||
}
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new InternalServerErrorException('failed to approve address due to an error related to VT portal: '.$exception->getMessage());
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Models\PackingList;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdateDoFromYDPortalProcessor
|
||||
@@ -31,34 +30,36 @@ class UpdateDoFromYDPortalProcessor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PackingList $packingList
|
||||
* @param $address
|
||||
* @return void
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function execute(PackingList $packingList) {
|
||||
if(!app()->environment(['production'])){
|
||||
return;
|
||||
}
|
||||
|
||||
public function execute($address) {
|
||||
try {
|
||||
$address = $packingList->owner->addresses()->where('status', ApprovalStatus::APPROVED)->first();
|
||||
$order = $address->owner()->orderBy('id', 'desc')->first();
|
||||
$packing_lists = $order->packingLists()
|
||||
->where('type', PackingListType::SHIPPING_PACKING_LIST)
|
||||
->where('status', '!=', ApprovalStatus::SUSPENDED)
|
||||
->orderBy('id', 'desc')->get();
|
||||
|
||||
if (!in_array($packingList->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$contact = $address->contacts()->first();
|
||||
$remark = $address->remarks()->first();
|
||||
foreach ($packing_lists as $key => $row) {
|
||||
if ($row->status === ApprovalStatus::SUSPENDED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$phone = $contact ? $contact->phone : null;
|
||||
$reference = $contact ? $contact->reference : null;
|
||||
$remark = $remark ? $remark->content : 'URGENT!!! PLEASE CALL BEFORE ONE DAY DELIVERY.';
|
||||
$contact = $address->contacts()->first();
|
||||
$remark = $address->remarks()->first();
|
||||
|
||||
$this->fetchesDataFRomYDPortal->clientRequest(
|
||||
'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
|
||||
'POST',
|
||||
$phone = $contact ? $contact->phone : null;
|
||||
$reference = $contact ? $contact->reference : null;
|
||||
$remark = $remark ? $remark->content : 'URGENT!!! PLEASE CALL BEFORE ONE DAY DELIVERY.';
|
||||
|
||||
$this->fetchesDataFRomYDPortal->clientRequest(
|
||||
'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
|
||||
'POST',
|
||||
[
|
||||
'expressno' => $packingList->reference,
|
||||
'expressno' => $row->reference,
|
||||
'customers_name' => $reference,
|
||||
'cellphone' => $phone,
|
||||
'postcode' => $address->postcode,
|
||||
@@ -67,6 +68,8 @@ class UpdateDoFromYDPortalProcessor
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new InternalServerErrorException('failed to approve address due to an error related to YD portal');
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class ChecksIfOrderNumberExists
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(string $orderNumber): bool {
|
||||
public function execute(int $orderNumber): bool {
|
||||
return $this->repository->where('reference', $orderNumber)->exists();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,11 @@ class GeneratesOrderNumber
|
||||
|
||||
|
||||
/**
|
||||
* @param null|string $prefix
|
||||
* @param int|null $length
|
||||
* @return string
|
||||
* @return int
|
||||
*/
|
||||
public function execute(?string $prefix = '', ?int $length = 9): string {
|
||||
public function execute(): int {
|
||||
|
||||
$reference = $prefix.rand((int)('1'.str_repeat(0, $length - 2).'1'), (int) str_repeat(9, $length));
|
||||
$reference = rand(100000001, 999999999);
|
||||
return !$this->checkIfOrderNumberExists->execute($reference) ? $reference : self::execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,23 +56,28 @@ class ReschedulePackingListLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$packing_list = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
|
||||
try {
|
||||
$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);
|
||||
$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());
|
||||
}
|
||||
|
||||
return $this->resourceResponse(new PackingListResource($packing_list));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Http\Resources\PackingListResource;
|
||||
use App\Models\PackingList;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -71,16 +70,16 @@ class UpdatePackingListStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
$packingList = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
/** @var PackingList $packingList */
|
||||
$packingList = $this->updatesPackingListStatus->execute($packingList, $request->route('status'));
|
||||
$packing_list = $this->updatesPackingListStatus->execute($packingList, $request->route('status'));
|
||||
$address = $packing_list->owner()->first()->addresses()->where('status', ApprovalStatus::APPROVED)->first();
|
||||
|
||||
|
||||
// $appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
|
||||
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromYDPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromVTPortalProcessor->execute($address);
|
||||
$this->updateDoFromYDPortalProcessor->execute($address);
|
||||
|
||||
return $this->resourceResponse(new PackingListResource($packingList));
|
||||
return $this->resourceResponse(new PackingListResource($packing_list));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ namespace App\Classes\Modules\PackingLists\Processors;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
|
||||
use App\Classes\Modules\PackingLists\Services\Packages\CreatesPackage;
|
||||
use App\Classes\Modules\PackingLists\Standards\Rules\Packages\CanCreatePackage;
|
||||
use App\Classes\ValueObjects\Constants\WarehouseReferences;
|
||||
use App\Models\Order;
|
||||
use App\Models\PackingList;
|
||||
|
||||
class CreatePackageProcessor
|
||||
@@ -50,11 +48,6 @@ class CreatePackageProcessor
|
||||
|
||||
if($replica) {
|
||||
$modificationValue = 1;
|
||||
|
||||
if($replica->owner->owner instanceof Order){
|
||||
$modificationValue = in_array( $replica->owner->owner->companyModule->id, WarehouseReferences::REPLICA_WHITE_LIST) ? 0 : 1;
|
||||
}
|
||||
|
||||
$packageObject = new PackageObject($object->getType(), $object->getDescription(), $object->getWidth() + $modificationValue, $object->getHeight() + $modificationValue, $object->getLength() + $modificationValue, $object->getWeight(), $object->getQuantity(), $object->getStatus());
|
||||
$package = $this->createsPackage->execute($packageObject, $replica);
|
||||
}
|
||||
|
||||
@@ -10,10 +10,7 @@ use App\Classes\Modules\PackingLists\Standards\Rules\CanCreatePackingList;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\WarehouseReferences;
|
||||
use App\Models\Order;
|
||||
use App\Models\PackingList;
|
||||
use function PHPUnit\Framework\isInstanceOf;
|
||||
|
||||
class CreatePackingListProcessor
|
||||
{
|
||||
@@ -54,7 +51,6 @@ class CreatePackingListProcessor
|
||||
$appointee_id = $packingList->owner_id == 1 ? 2037 : $packingList->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
|
||||
|
||||
$type = $object->getType() === PackingListType::SHIPPING_PACKING_LIST ? PackingListType::SHIPPING_PACKING_LIST_REPLICA : PackingListType::WAREHOUSE_RECEIVE_LIST_REPLICA;
|
||||
|
||||
/** create packing list replica */
|
||||
$object = new PackingListObject($object->getReference().'_01', $appointee_id, $type, ApprovalStatus::PENDING_SUBMISSION);
|
||||
$this->createsPackingList->execute($object, $packingList);
|
||||
|
||||
+6
-2
@@ -158,9 +158,13 @@ class FetchLoadedContainersFromVTPortalProcessor
|
||||
}
|
||||
|
||||
foreach($containerDetail->Rows as $packingList){
|
||||
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $packingList[13]));
|
||||
$marking = explode('/', explode('CIEF/', $packingList[13])[1]);
|
||||
|
||||
$orderNumber = $marking[array_key_last($marking)];
|
||||
if(!array_key_exists(1, $marking)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$orderNumber = $marking[1];
|
||||
|
||||
if(!$packingList[22]){
|
||||
continue;
|
||||
|
||||
+10
-44
@@ -36,7 +36,6 @@ use App\Models\Transport;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class FetchOrderListsFromYdPortalProcessor
|
||||
{
|
||||
@@ -154,6 +153,7 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
|
||||
|
||||
foreach($rows->data as $row){
|
||||
|
||||
$containerReference = null;
|
||||
$loadingDate = null;
|
||||
$unstuffingDate = null;
|
||||
@@ -168,11 +168,6 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
|
||||
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
|
||||
|
||||
if(!$rows){
|
||||
Log::debug($row->expressno);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (array_reverse($rows->data) as $trackingRow) {
|
||||
if ($trackingRow->tracking === '货物已送达仓库准备入库中') {
|
||||
$receiveDate = Carbon::parse($trackingRow->trackingtime);
|
||||
@@ -186,43 +181,21 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$eta = Carbon::parse($tracking[2]);
|
||||
}
|
||||
|
||||
$rescheduleETD = strpos($trackingRow->remark, '开') || strpos($trackingRow->remark, '到港');
|
||||
$rescheduleETA = strpos($trackingRow->remark, '到港');
|
||||
if (($rescheduleETD !== false || $rescheduleETA !== false) && strpos($trackingRow->tracking, '货物装柜完成。') === false) {
|
||||
preg_match_all('/([0-9]+.{3})/', $trackingRow->remark, $matches);
|
||||
$dates = collect();
|
||||
|
||||
foreach($matches[0] as $date){
|
||||
try {
|
||||
$dates->push(Carbon::parse(str_replace('.', '/', $date).Carbon::now()->format('Y')));
|
||||
} catch (\Exception $exception) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$rescheduleDate = $dates->sortDesc()->first();
|
||||
if(!$delayDate || $rescheduleDate > $delayDate){
|
||||
/** @var Carbon $delayDate */
|
||||
$delayDate = $rescheduleDate;
|
||||
|
||||
if($rescheduleETA === false && $delayDate) {
|
||||
$delayDate = $delayDate->addDays('5');
|
||||
}
|
||||
}
|
||||
|
||||
if (strpos($trackingRow->tracking, '预计船时间为') !== false) {
|
||||
$tracking = explode('预计船时间为', $trackingRow->tracking);
|
||||
$delayDate = Carbon::parse(explode('日', $tracking[1])[0]);
|
||||
}
|
||||
|
||||
if ($trackingRow->tracking === '已开船') {
|
||||
$delayDate = Carbon::parse($trackingRow->trackingtime)->addDays('5');
|
||||
if (strpos($trackingRow->tracking, '预计开船为') !== false) {
|
||||
$tracking = explode('预计开船为', $trackingRow->tracking);
|
||||
$delayDate = Carbon::parse(explode('日', $tracking[1])[0]);
|
||||
}
|
||||
|
||||
|
||||
if ($trackingRow->tracking === '货物已进目的港仓库') {
|
||||
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
|
||||
}
|
||||
|
||||
if (Str::contains($trackingRow->tracking, ['派送中'])) {
|
||||
if ($trackingRow->tracking === '货物已派送完成') {
|
||||
$deliveryDate = Carbon::parse($trackingRow->trackingtime);
|
||||
}
|
||||
}
|
||||
@@ -315,13 +288,6 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$this->createPackageProcessor->execute($packageObject, $packingList);
|
||||
}
|
||||
|
||||
if(!count($row->deliverysize)){
|
||||
$measurement = round(((float) $row->volume / (float) $row->goodcount) ** (1/3) * 100, 2);
|
||||
$packageObject = new PackageObject(PackageType::CARTON, $row->goodname, (float) $measurement, (float) $measurement, (float) $measurement, 0, (float) $row->goodcount, ApprovalStatus::APPROVED);
|
||||
$this->createPackageProcessor->execute($packageObject, $warehouseReceiveList);
|
||||
$this->createPackageProcessor->execute($packageObject, $packingList);
|
||||
}
|
||||
|
||||
$weightCbm = (float) $row->weight / 500;
|
||||
$overWeightCbm = $weightCbm - $packingList->packages()->sum(DB::raw('(width/100) * (height/100) * (length/100) * quantity'));
|
||||
|
||||
@@ -378,7 +344,7 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
|
||||
$transport = $container->transports()->first();
|
||||
|
||||
if(!$transport->schedules()->whereDate('eta', '>=', $delayDate)->first()) {
|
||||
if(!$transport->schedules()->where('eta', '=', $delayDate)->first()) {
|
||||
$etd = $transport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->etd;
|
||||
$transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]);
|
||||
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $delayDate, ApprovalStatus::APPROVED));
|
||||
@@ -407,7 +373,7 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
}
|
||||
}
|
||||
|
||||
if($deliveryDate && !$packingList->transports()->exists()){
|
||||
if($deliveryDate && !$packingList->transports){
|
||||
$packingList->status = ApprovalStatus::COMPLETED;
|
||||
$packingList->save();
|
||||
|
||||
|
||||
+8
-2
@@ -134,13 +134,19 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
|
||||
|
||||
foreach ($response->Rows as $parcel){
|
||||
|
||||
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $parcel[5]));
|
||||
$orderNumber = $marking[array_key_last($marking)];
|
||||
$marking = explode('/', explode('CIEF/', $parcel[5])[1]);
|
||||
|
||||
if(!array_key_exists(1, $marking)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$orderNumber = $marking[1];
|
||||
|
||||
if(!$parcel[9]){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
|
||||
} catch (ResourceNotFoundException $exception) {
|
||||
|
||||
@@ -76,7 +76,7 @@ class UpdateConstantLogic extends AbstractControllerLogic
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$object = new ConstantObject($request->input('reference'), $request->input('value'));
|
||||
$object = new ConstantObject($request->input('name'), $request->input('reference'), $request->input('detail'));
|
||||
|
||||
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
|
||||
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Resources\ConstantResource;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstant;
|
||||
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;
|
||||
|
||||
class UpdateConstantPostcodeLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => '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 AddItemToConstantValueArray */
|
||||
private $addItemToConstantValueArray;
|
||||
|
||||
/** @var RemoveItemFromConstantValueArray */
|
||||
private $removeItemFromConstantValueArray;
|
||||
|
||||
|
||||
/**
|
||||
* UpdateConstantLogic constructor.
|
||||
* @param CanUpdateConstant $canUpdateConstant
|
||||
* @param UpdatesConstant $updatesConstant
|
||||
* @param FetchesSegment $fetchesSegment
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
* @param AddItemToConstantValueArray $addItemToConstantValueArray
|
||||
* @param RemoveItemFromConstantValueArray $removeItemFromConstantValueArray
|
||||
*/
|
||||
public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,AddItemToConstantValueArray $addItemToConstantValueArray, RemoveItemFromConstantValueArray $removeItemFromConstantValueArray)
|
||||
{
|
||||
$this->canUpdateConstant = $canUpdateConstant;
|
||||
$this->updatesConstant = $updatesConstant;
|
||||
$this->fetchesSegment = $fetchesSegment;
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
$this->addItemToConstantValueArray = $addItemToConstantValueArray;
|
||||
$this->removeItemFromConstantValueArray = $removeItemFromConstantValueArray;
|
||||
}
|
||||
/**
|
||||
* @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' => $request->input('reference')]);
|
||||
|
||||
$object = new ConstantObject($constant->reference, $this->addItemToConstantValueArray->execute($constant->value, $request->input('postcode')));
|
||||
$this->canUpdateConstant->passes($object);
|
||||
|
||||
$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),
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\SegmentConstant;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Resources\ConstantResource;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstant;
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstantValueByState;
|
||||
|
||||
class UpdateConstantStateLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => '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));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,22 +7,34 @@ use App\Classes\General\Interfaces\DataTransferObject;
|
||||
class ConstantObject implements DataTransferObject
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
/** @var string */
|
||||
private $reference;
|
||||
|
||||
/** @var array */
|
||||
private $value;
|
||||
private $detail;
|
||||
|
||||
/**
|
||||
* ConstantObject constructor.
|
||||
* @param string $name
|
||||
* @param string $reference
|
||||
* @param array $value
|
||||
* @param array $detail
|
||||
*/
|
||||
public function __construct(string $reference, array $value)
|
||||
public function __construct(string $name, string $reference, array $detail)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->reference = $reference;
|
||||
$this->value = $value;
|
||||
$this->detail = $detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,9 +48,9 @@ class ConstantObject implements DataTransferObject
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getValue(): array
|
||||
public function getDetail(): array
|
||||
{
|
||||
return $this->value;
|
||||
return $this->detail;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
class AddItemToConstantValueArray
|
||||
{
|
||||
|
||||
/**
|
||||
* @param array $array
|
||||
* @param $item
|
||||
* @return array
|
||||
*/
|
||||
public function execute($array, $item): array {
|
||||
$array[] = $item;
|
||||
sort($array);
|
||||
return $array;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,11 +27,11 @@ class ConvertsConstantDetailsToResource
|
||||
|
||||
public function execute(SegmentConstant $constant){
|
||||
|
||||
// if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) {
|
||||
// return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : '';
|
||||
// }
|
||||
if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) {
|
||||
return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : '';
|
||||
}
|
||||
|
||||
return $constant->value;
|
||||
return $constant->detail;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,9 @@ class CreatesConstant extends AbstractUpdateRelationshipRecord
|
||||
public function execute(Segment $segment, ConstantObject $object)
|
||||
{
|
||||
$model = new SegmentConstant();
|
||||
$model->name = $object->getName();
|
||||
$model->reference = $object->getReference();
|
||||
$model->value = json_encode($object->getValue());
|
||||
$model->detail = json_encode($object->getDetail());
|
||||
|
||||
return $this->handler($segment->constants(), $model);
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
class RemoveItemFromConstantValueArray
|
||||
{
|
||||
|
||||
/**
|
||||
* @param array $array
|
||||
* @param $item
|
||||
* @return array
|
||||
*/
|
||||
public function execute($array, $item): array {
|
||||
foreach($array as $key => $value){
|
||||
if($array[$key] == $item){
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
return array_values($array);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,8 +17,9 @@ class UpdatesConstant extends AbstractUpdateRecord
|
||||
*/
|
||||
public function execute(SegmentConstant $model, ConstantObject $object)
|
||||
{
|
||||
$model->name = $object->getName();
|
||||
$model->reference = $object->getReference();
|
||||
$model->value = json_encode($object->getValue());
|
||||
$model->detail = json_encode($object->getDetail());
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
class UpdatesConstantValueByState
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $json
|
||||
* @param int $status_id
|
||||
* @param int $rate
|
||||
* @return string
|
||||
*/
|
||||
public function execute($json, int $status_id, int $rate) {
|
||||
|
||||
$newArray = $json;
|
||||
foreach($json->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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,8 +15,9 @@ class ConstantValidation extends AbstractValidation
|
||||
protected function data($object): array {
|
||||
|
||||
$data = [
|
||||
'name' => $object->getName(),
|
||||
'reference' => $object->getReference(),
|
||||
'value' => $object->getValue()
|
||||
'detail' => $object->getDetail()
|
||||
];
|
||||
|
||||
return $data;
|
||||
@@ -27,8 +28,9 @@ class ConstantValidation extends AbstractValidation
|
||||
*/
|
||||
protected function rules(): array {
|
||||
return [
|
||||
'name' => 'required',
|
||||
'reference' => 'required',
|
||||
'value' => 'required'
|
||||
'detail' => 'required'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+9
-30
@@ -20,11 +20,7 @@ use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
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\TransactionDetailType;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@@ -90,11 +86,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
$packing_list = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]);
|
||||
|
||||
$cbm = $packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum(function($package) {
|
||||
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
|
||||
});
|
||||
|
||||
$over_weight_cbm = $packing_list->packages->where('type', PackageType::OVER_WEIGHT)->sum(function($package) {
|
||||
$cbm = $packing_list->packages->sum(function($package) {
|
||||
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
|
||||
});
|
||||
|
||||
@@ -151,7 +143,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
}
|
||||
|
||||
$price_cbm = $base_price + $warehouse_rate + $state_rate;
|
||||
$total_cbm = $price_cbm * ($cbm + $over_weight_cbm);
|
||||
$total_cbm = $price_cbm * $cbm;
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('SHIP-');
|
||||
|
||||
@@ -173,28 +165,16 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
ApprovalStatus::PENDING_SUBMISSION
|
||||
);
|
||||
|
||||
/** @var Transaction $invoice_transaction */
|
||||
$invoice_transaction = $this->createsTransaction->execute($packing_list, $object);
|
||||
|
||||
$object_detail = new TransactionDetailObject(
|
||||
'SHIPPING_FEE',
|
||||
TransactionDetailType::SHIPPING_FEE,
|
||||
$cbm,
|
||||
$price_cbm
|
||||
$invoice_transaction->bill_no,
|
||||
$invoice_transaction->bill_no,
|
||||
1,
|
||||
$invoice_transaction->amount,
|
||||
$invoice_transaction->amount
|
||||
);
|
||||
|
||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
|
||||
if ($over_weight_cbm > 0) {
|
||||
$object_detail = new TransactionDetailObject(
|
||||
'OVER_WEIGHT_CHARGES',
|
||||
TransactionDetailType::OVER_WEIGHT_CHARGES,
|
||||
$over_weight_cbm,
|
||||
$price_cbm
|
||||
);
|
||||
|
||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
}
|
||||
$transaction_detail = $this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]);
|
||||
|
||||
@@ -205,12 +185,11 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
ApprovalStatus::COMPLETED,
|
||||
'shipping_invoice'
|
||||
);
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($invoice_transaction, $document_object);
|
||||
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
|
||||
// dd('yess');
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class TransactionDetailObject implements DataTransferObject
|
||||
/** @var string|null */
|
||||
private $name;
|
||||
|
||||
/** @var float|null */
|
||||
/** @var int|null */
|
||||
private $quantity;
|
||||
|
||||
/** @var float|null */
|
||||
@@ -22,10 +22,10 @@ class TransactionDetailObject implements DataTransferObject
|
||||
* TransactionDetailObject constructor.
|
||||
* @param string $reference
|
||||
* @param string $name
|
||||
* @param float $quantity
|
||||
* @param int $quantity
|
||||
* @param float $price
|
||||
*/
|
||||
public function __construct(?string $reference, ?string $name , ?float $quantity, ?float $price)
|
||||
public function __construct(?string $reference, ?string $name , ?int $quantity, ?float $price)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$this->name = $name;
|
||||
@@ -50,9 +50,9 @@ class TransactionDetailObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
* @return int
|
||||
*/
|
||||
public function getQuantity(): ?float
|
||||
public function getQuantity(): ?int
|
||||
{
|
||||
return $this->quantity;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,4 @@ final class AddressType {
|
||||
|
||||
public const DELIVERY = 2;
|
||||
|
||||
public const PICK_UP = 3;
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,4 @@ final class BusinessType {
|
||||
|
||||
public const CURRENCY_VENDOR = 6;
|
||||
|
||||
public const ONLINE_SELLER = 7;
|
||||
|
||||
public const LAST_MILE_DELIVERY_AGENT = 8;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,4 @@ final class OrderType {
|
||||
|
||||
public const DEDICATED_CONTAINER = 1;
|
||||
|
||||
public const LAST_MILE_DELIVERY = 2;
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,4 @@ final class PackageType {
|
||||
|
||||
public const OVER_WEIGHT = 2;
|
||||
|
||||
public const DOCUMENT = 3;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class TransactionDetailType {
|
||||
|
||||
public const SHIPPING_FEE = 'Shipping Fee';
|
||||
|
||||
public const OVER_WEIGHT_CHARGES = 'Over weight charges';
|
||||
}
|
||||
@@ -8,8 +8,6 @@ final class WarehouseReferences {
|
||||
|
||||
public const YD_GUANG_ZHOU = 'GZ-V02';
|
||||
|
||||
public const YD_GUANG_ZHOU_2 = 'GZ-V03';
|
||||
|
||||
public const VT_YIWU = 'YW-V01';
|
||||
|
||||
public const YD_YIWU = 'YW-V02';
|
||||
@@ -45,8 +43,6 @@ final class WarehouseReferences {
|
||||
|
||||
public const YD_EXEMPT_LIST = [230, 294, 320, 652, 1248, 1726];
|
||||
|
||||
public const REPLICA_WHITE_LIST = [502];
|
||||
|
||||
//2376 qce
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
use App\Classes\Modules\Delivery\ControllersLogic\CancelDeliveryOrderLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CancelDeliveryOrderController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CancelOrderLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function cancel(Request $request, CancelDeliveryOrderLogic $logic): JsonResponse
|
||||
{
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
use App\Classes\Modules\Delivery\ControllersLogic\CreateDeliveryCustomerLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateDeliveryCustomerController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateDeliveryCustomerLogic $createDeliveryCustomerLogic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateDeliveryCustomerLogic $createDeliveryCustomerLogic): JsonResponse
|
||||
{
|
||||
return $createDeliveryCustomerLogic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
use App\Classes\Modules\Delivery\ControllersLogic\CreateDeliveryOrderLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateDeliveryOrderController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateDeliveryOrderLogic $createDeliveryOrderLogic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateDeliveryOrderLogic $createDeliveryOrderLogic): JsonResponse
|
||||
{
|
||||
return $createDeliveryOrderLogic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsCustomers;
|
||||
use App\Classes\Modules\Exports\Services\ExportsMultipleDeliveryOrders;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
class ExportDeliveryOrdersToExcelController
|
||||
{
|
||||
|
||||
/**
|
||||
* ExportCustomersToExcelController constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
}
|
||||
|
||||
public function lineClear(Request $request){
|
||||
$exportsTransactions = new ExportsMultipleDeliveryOrders($request);
|
||||
$response = $exportsTransactions->download('line-clear-export.xlsx', Excel::XLSX, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Delivery\ControllersLogic\ListOrdersLogic;
|
||||
|
||||
|
||||
class ListOrdersController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListOrdersLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
||||
public function list(Request $request, ListOrdersLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Exports;
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsArrivedParcel;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
class ExportArrivedParcelController
|
||||
{
|
||||
/**
|
||||
* ExportArrivedParcelController constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
}
|
||||
|
||||
public function export(Request $request) {
|
||||
$exportsPendingArrangementDeliveryList = new ExportsArrivedParcel($request);
|
||||
$response = $exportsPendingArrangementDeliveryList->download('arrived-parcel.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Exports;
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsOnHoldPackingList;
|
||||
use App\Classes\Modules\Exports\Services\ExportsPendingArrangementDeliveryList;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
class ExportPendingArrangementPackingListController
|
||||
{
|
||||
/**
|
||||
* ExportPendingArrangementPackingListController constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
}
|
||||
|
||||
public function export(Request $request) {
|
||||
$exportsPendingArrangementDeliveryList = new ExportsPendingArrangementDeliveryList($request);
|
||||
$response = $exportsPendingArrangementDeliveryList->download('packing-list-delivery.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function onHold(Request $request) {
|
||||
$exportsPendingArrangementDeliveryList = new ExportsOnHoldPackingList($request);
|
||||
$response = $exportsPendingArrangementDeliveryList->download('packing-list-on-hold.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Notifications;
|
||||
|
||||
use App\Classes\Modules\Notifications\ControllersLogic\ListNotificationsLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListNotificationsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListNotificationsLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListNotificationsLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class DownloadOrderQrPdfController
|
||||
$warehousePrefix = '';
|
||||
$deliveryPrefix = '';
|
||||
$customerMarking = '';
|
||||
$remark = $warehouse->remarks()->first();
|
||||
$remark = $warehouse->remarks()->first()->content;
|
||||
|
||||
if($warehouse->reference === WarehouseReferences::VT_GUANG_ZHOU || $warehouse->reference === WarehouseReferences::VT_YIWU) {
|
||||
$customerMarking = $order->companyModule->connections()->first()->invitee_reference.'/';
|
||||
@@ -41,14 +41,14 @@ class DownloadOrderQrPdfController
|
||||
$warehousePrefix = 'YW/';
|
||||
}
|
||||
|
||||
if(in_array($warehouse->reference,[WarehouseReferences::YD_GUANG_ZHOU, WarehouseReferences::YD_GUANG_ZHOU_2])){
|
||||
if($warehouse->reference === WarehouseReferences::YD_GUANG_ZHOU){
|
||||
$warehousePrefix = 'YD/';
|
||||
|
||||
if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan' || in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
|
||||
if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan') {
|
||||
$warehousePrefix = 'KK/';
|
||||
}
|
||||
|
||||
if(strtolower($deliveryAddress->state->name) === 'sarawak' && !in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
|
||||
if(strtolower($deliveryAddress->state->name) === 'sarawak') {
|
||||
$warehousePrefix = 'KU/';
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class DownloadOrderQrPdfController
|
||||
'delivery_address' => $deliveryAddress,
|
||||
'warehouse_address' => $warehouseAddress,
|
||||
'warehouse_contacts' => $warehouseContacts,
|
||||
'remark' => $remark ? $remark->content : ''
|
||||
'remark' => $remark
|
||||
];
|
||||
|
||||
$pdf = LaravelMpdf::loadView('pdfs.qr', $data, [], [
|
||||
|
||||
@@ -200,62 +200,4 @@ class MonthlyReportController
|
||||
})->sum('quantity'),
|
||||
]]))->handler();
|
||||
}
|
||||
|
||||
public function customerActivityReport(Request $request): JsonResponse {
|
||||
|
||||
$active_start = $request->input('active_start');
|
||||
$active_end = $request->input('active_end');
|
||||
$inactive_start = $request->input('inactive_start');
|
||||
$inactive_end = $request->input('inactive_end');
|
||||
$minCbm = $request->input('cbm');
|
||||
$minOrders = $request->input('minOrders');
|
||||
|
||||
$activeCompanies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($inactive_start, $inactive_end) {
|
||||
return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($inactive_start, $inactive_end) {
|
||||
return $query->where('drop_date', '>=', \Carbon\Carbon::parse($inactive_start))->where('drop_date', '<=', \Carbon\Carbon::parse($inactive_end)->addDay());
|
||||
});
|
||||
})->pluck('id');
|
||||
|
||||
$companies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($active_start, $active_end) {
|
||||
return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($active_start, $active_end) {
|
||||
return $query->whereDate('drop_date', '>=', \Carbon\Carbon::parse($active_start))->whereDate('drop_date', '<=', \Carbon\Carbon::parse($active_end)->addDay());
|
||||
});
|
||||
})->whereNotIn('id', $activeCompanies)->get();
|
||||
|
||||
$customerActivityData = [];
|
||||
$counter = 1;
|
||||
|
||||
foreach ($companies as $key => $company){
|
||||
$connection = $company->inviters()->withPivot('invitee_reference')->first();
|
||||
$marking = $connection ? $connection->pivot->invitee_reference:'';
|
||||
$packingList = $company->orderPackingLists()->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::SHIPPING_PACKING_LIST)->get();
|
||||
$totalCbm = $packingList->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
})->sum(function($package){
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
if ($minCbm != 'null' && $totalCbm < $minCbm) { continue; }
|
||||
|
||||
if ($minOrders != 'null' && $packingList->count() < $minOrders) { continue; }
|
||||
|
||||
array_push($customerActivityData, array(
|
||||
'key' => $counter,
|
||||
'marking' => $marking,
|
||||
'packingListCount'=> $packingList->count(),
|
||||
'totalCbm'=> $totalCbm,
|
||||
));
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
return (new ApiResponseObject('fetch service report Successful',
|
||||
'',
|
||||
HttpStatus::OK_WITH_MESSAGE, ['data' => [
|
||||
'active_start' => Carbon::parse($active_start)->format('d/m/Y'),
|
||||
'active_end' => Carbon::parse($active_end)->format('d/m/Y'),
|
||||
'inactive_start' => Carbon::parse($inactive_start)->format('d/m/Y'),
|
||||
'inactive_end' => Carbon::parse($inactive_end)->format('d/m/Y'),
|
||||
'customerActivityData' => $customerActivityData,
|
||||
]]))->handler();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Segments;
|
||||
|
||||
use App\Classes\Modules\Segments\ControllersLogic\UpdateConstantPostcodeLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateConstantPostcodeController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateConstantPostcodeLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateConstantPostcodeLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Segments;
|
||||
|
||||
use App\Classes\Modules\Segments\ControllersLogic\UpdateConstantStateLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateConstantStateController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateConstantStateLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateConstantStateLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class CompanyResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$companyModule = $this->companyModules()->first();
|
||||
$companyModule = $this->companyModules()->where('type', '=', BusinessType::IMPORTER)->first();
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'hash_id' => Crypt::encryptString($this->id),
|
||||
@@ -30,8 +30,8 @@ class CompanyResource extends JsonResource
|
||||
'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
|
||||
'employee' => new UserResource($companyModule->employees()->first()),
|
||||
'company_module' => new CompanyModuleResource($companyModule),
|
||||
'last_order' => $companyModule->type === 7 ? new DeliveryOrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()) : new OrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()),
|
||||
'order_count' => $companyModule->orders()->count(),
|
||||
'last_order' => new OrderResource($companyModule ? $companyModule->orders()->orderBy('id', 'DESC')->first(): null),
|
||||
'order_count' => $this->orders()->count(),
|
||||
'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])->first()),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
|
||||
|
||||
@@ -19,8 +19,9 @@ class ConstantResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'reference' => $this->reference,
|
||||
'value' => (App()->make(ConvertsConstantDetailsToResource::class))->execute($this->resource)
|
||||
'detail' => (App()->make(ConvertsConstantDetailsToResource::class))->execute($this->resource)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class DeliveryOrderResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'reference' => $this->reference,
|
||||
'type' => (int) $this->type,
|
||||
'status' => (int) $this->status,
|
||||
'company_module' => new CompanyModuleResource($this->companyModule),
|
||||
'sender_address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->where('type', AddressType::PICK_UP)->first()),
|
||||
'delivery_address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->where('type', AddressType::DELIVERY)->first()),
|
||||
'packingList' => new DeliveryPackingListResource($this->packingLists()->first()),
|
||||
'remarks' => RemarkResource::collection($this->remarks),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Models\Order;
|
||||
use App\Models\PackingList;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class DeliveryPackingListResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$package = $this->packages()->first();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'claimant_id' => $this->claimant_id,
|
||||
'reference' => $this->reference,
|
||||
'status' => $this->status,
|
||||
'transport' => new TransportResource($this->transports()->first()),
|
||||
'type' => $package->type,
|
||||
'description' => $package->description,
|
||||
'weight' => (float) $package->weight,
|
||||
'quantity' => (float) $package->quantity,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
|
||||
class NotificationResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'long_ago' => $this->created_at->diffForHumans(),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class TransportResource extends JsonResource
|
||||
@@ -16,7 +15,6 @@ class TransportResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$currentSchedule = $this->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first();
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
@@ -25,10 +23,8 @@ class TransportResource extends JsonResource
|
||||
'dispatch_date' => $this->dispatch_date ? $this->dispatch_date->format('d-m-Y') : $this->dispatch_date,
|
||||
'drop_date' => $this->drop_date ? $this->drop_date->format('d-m-Y') : $this->drop_date,
|
||||
'status' => $this->status,
|
||||
'current_schedule' => new ScheduleResource($currentSchedule),
|
||||
'schedule_history' => ScheduleResource::collection($this->schedules()->where('status', '=', ApprovalStatus::EXPIRED)->get()),
|
||||
'dropped_days' => Carbon::now()->diffInDays($this->drop_date, false),
|
||||
'schedule_complete' => $currentSchedule ? $currentSchedule->eta <= Carbon::now() : false
|
||||
'current_schedule' => new ScheduleResource($this->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()),
|
||||
'schedule_history' => ScheduleResource::collection($this->schedules()->where('status', '=', ApprovalStatus::EXPIRED)->get())
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Steppable;
|
||||
use App\Classes\General\Interfaces\Transportable;
|
||||
use App\Classes\General\Interfaces\Packable;
|
||||
use App\Classes\General\Interfaces\Transactionable;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasTableAlias;
|
||||
|
||||
class Addon extends AbstractModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'addons';
|
||||
|
||||
protected $fillable = ['status'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
*/
|
||||
public function owner(): morphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
||||
@@ -58,14 +58,6 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable,
|
||||
return $this->morphMany(PackingList::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function addons(): morphMany
|
||||
{
|
||||
return $this->morphMany(Addon::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
|
||||
@@ -36,14 +36,6 @@ class PackingList extends AbstractModel implements Transportable, Steppable, Pac
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function addons(): morphMany
|
||||
{
|
||||
return $this->morphMany(Addon::class, 'owner');
|
||||
}
|
||||
|
||||
public function containers(): BelongsToMany
|
||||
{
|
||||
return $this->BelongsToMany(Container::class, ContainerPackingList::class);
|
||||
|
||||
+1
-3
@@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
@@ -25,9 +24,8 @@ class User extends AbstractModel implements
|
||||
AuthorizableContract,
|
||||
CanResetPasswordContract
|
||||
{
|
||||
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail, SoftDeletes;
|
||||
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
/**
|
||||
* Get the identifier that will be stored in the subject claim of the JWT.
|
||||
|
||||
@@ -18,7 +18,7 @@ class CreateTransactionDetailsTable extends Migration
|
||||
$table->foreignId('transaction_id')->unsigned();
|
||||
$table->string('reference');
|
||||
$table->string('name');
|
||||
$table->decimal('quantity', 25, 5)->default(0.00);
|
||||
$table->integer('quantity')->default(0);
|
||||
$table->decimal('price', 25, 5)->default(0.00);
|
||||
$table->decimal('amount', 25, 5)->default(0.00);
|
||||
$table->softDeletes();
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddDeletedAtToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAddonsTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('addons', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('owner');
|
||||
$table->string('reference',200);
|
||||
$table->integer('type')->default(0);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->integer('status')->default(0);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order_addons');
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,6 @@ use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
@@ -113,7 +112,7 @@ class CompaniesTableSeeder extends Seeder
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::FREIGHT_FORWARDER);
|
||||
|
||||
$address = new AddressObject('Malaysian Global Innovation & Creativity Center Level 1 CWS', 'Block 3730,Persiaran APEC', 1, 15, 402, 63000, AddressType::BILLING, ApprovalStatus::APPROVED);
|
||||
$address = new AddressObject('Malaysian Global Innovation & Creativity Center Level 1 CWS', 'Block 3730,Persiaran APEC', 1, 15, 402, 63000);
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
|
||||
$contact = new ContactObject('Office Number', '0182909252', '', '');
|
||||
@@ -132,22 +131,22 @@ class CompaniesTableSeeder extends Seeder
|
||||
|
||||
if ($name === 'Guangzhou'){
|
||||
$companyModule->update(['name' => $name, 'reference' => 'GZ-V01']);
|
||||
$address = new AddressObject('白云区,大朗南路 白云湖大道自编13号 7号仓库', '高德地图导航:广州市世通行', 2, 35, 633, 510450, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$address = new AddressObject('白云区,大朗南路 白云湖大道自编13号 7号仓库', '高德地图导航:广州市世通行', 2, 35, 633, 510450);
|
||||
$contact = new ContactObject('杨维民', '13600055019', '', '');
|
||||
} elseif ($name === 'Yiwu') {
|
||||
$companyModule->update(['name' => $name, 'reference' => 'YW-V01']);
|
||||
$address = new AddressObject('义乌市诚信大道义乌港A区2楼194号', '', 2, 27, 532, 322000, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$address = new AddressObject('义乌市诚信大道义乌港A区2楼194号', '', 2, 27, 532, 322000);
|
||||
$contact = new ContactObject('小曾', '13575982901', '', '');
|
||||
} elseif ($name === 'Klang') {
|
||||
$companyModule->update(['name' => $name, 'reference' => 'KL-V01']);
|
||||
$address = new AddressObject('LOT 1357 A, JALAN TANJUNG SHAWAL', 'KAMPUNG SUNGAI PINANG', 1, 15, 412, 41400, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$address = new AddressObject('LOT 1357 A, JALAN TANJUNG SHAWAL', 'KAMPUNG SUNGAI PINANG', 1, 15, 412, 41400);
|
||||
$contact = new ContactObject('Mr. Yang', '0162237680', '', '');
|
||||
} elseif ($name === 'Sabah') {
|
||||
$companyModule->update(['name' => $name, 'reference' => 'SB-V01']);
|
||||
$address = new AddressObject('Warehouse A & B, No. 2, Lorong Kacang Tanah 1', 'Jalan Kolombong, Kolombong', 1, 13, 316, 88450, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$address = new AddressObject('Warehouse A & B, No. 2, Lorong Kacang Tanah 1', 'Jalan Kolombong, Kolombong', 1, 13, 316, 88450);
|
||||
} elseif ($name === 'Sarawak') {
|
||||
$companyModule->update(['name' => $name, 'reference' => 'SRW-V01']);
|
||||
$address = new AddressObject('OPPOSITE HT POLE 51, LT 664 JALAN SUNGAI SALIM', '', 1, 14, 381, 96000, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$address = new AddressObject('OPPOSITE HT POLE 51, LT 664 JALAN SUNGAI SALIM', '', 1, 14, 381, 96000);
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +161,7 @@ class CompaniesTableSeeder extends Seeder
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, $businessType);
|
||||
|
||||
$address = new AddressObject('2, Jalan TSB 6, Taman Industri Sungai Buloh', '', 1, 15, 419, 47000, AddressType::BILLING, ApprovalStatus::APPROVED);
|
||||
$address = new AddressObject('2, Jalan TSB 6, Taman Industri Sungai Buloh', '', 1, 15, 419, 47000);
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
|
||||
$contact = new ContactObject('Office Number', '036148 8108', '', '');
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesUser;
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\Modules\Addresses\Processors\CreateAddressFromOldAddressProcessor;
|
||||
use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
|
||||
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
|
||||
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompany;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Company;
|
||||
|
||||
class LastMileDeliveryTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/** @var CreateCompanyProcessor */
|
||||
private $createCompanyProcessor;
|
||||
|
||||
/** @var UpdatesCompanyStatus*/
|
||||
private $updatesCompanyStatus;
|
||||
|
||||
/** @var CreateCompanyModuleProcessor */
|
||||
private $createCompanyModuleProcessor;
|
||||
|
||||
/** @var CreateContactProcessor */
|
||||
private $createContactProcessor;
|
||||
|
||||
/** @var CreatesCompanyConnection */
|
||||
private $createsCompanyConnection;
|
||||
|
||||
/** @var ApprovesCompanyConnection */
|
||||
private $approvesCompanyConnection;
|
||||
|
||||
/** @var CreateAddressFromOldAddressProcessor */
|
||||
private $createAddressFromOldAddressProcessor;
|
||||
|
||||
/** @var CreatesAddress */
|
||||
private $createsAddress;
|
||||
|
||||
/** @var CreatesCompany */
|
||||
private $createsCompany;
|
||||
|
||||
/** @var CreatesContact */
|
||||
private $createsContact;
|
||||
|
||||
/** @var CreatesUser */
|
||||
private $createsUser;
|
||||
|
||||
/** @var AssignEmployeeProcessor */
|
||||
private $assignEmployeeProcessor;
|
||||
|
||||
/**
|
||||
* LastMileDeliveryTableSeeder constructor.
|
||||
* @param CreateCompanyProcessor $createCompanyProcessor
|
||||
* @param UpdatesCompanyStatus $updatesCompanyStatus
|
||||
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
|
||||
* @param CreateContactProcessor $createContactProcessor
|
||||
* @param CreatesCompanyConnection $createsCompanyConnection
|
||||
* @param ApprovesCompanyConnection $approvesCompanyConnection
|
||||
* @param CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor
|
||||
* @param CreatesAddress $createsAddress
|
||||
* @param CreatesCompany $createsCompany
|
||||
* @param CreatesContact $createsContact
|
||||
* @param CreatesUser $createsUser
|
||||
* @param AssignEmployeeProcessor $assignEmployeeProcessor
|
||||
*/
|
||||
public function __construct(CreateCompanyProcessor $createCompanyProcessor, UpdatesCompanyStatus $updatesCompanyStatus, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor, CreatesAddress $createsAddress, CreatesCompany $createsCompany, CreatesContact $createsContact, CreatesUser $createsUser, AssignEmployeeProcessor $assignEmployeeProcessor)
|
||||
{
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
$this->updatesCompanyStatus = $updatesCompanyStatus;
|
||||
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
|
||||
$this->createContactProcessor = $createContactProcessor;
|
||||
$this->createsCompanyConnection = $createsCompanyConnection;
|
||||
$this->approvesCompanyConnection = $approvesCompanyConnection;
|
||||
$this->createAddressFromOldAddressProcessor = $createAddressFromOldAddressProcessor;
|
||||
$this->createsAddress = $createsAddress;
|
||||
$this->createsCompany = $createsCompany;
|
||||
$this->createsContact = $createsContact;
|
||||
$this->createsUser = $createsUser;
|
||||
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
$companies = [
|
||||
new CompanyObject('Last Mile Delivery', 'HWT', CompanyType::COMPANY_BUSINESS, ApprovalStatus::APPROVED),
|
||||
];
|
||||
|
||||
|
||||
foreach ($companies as $companyObject) {
|
||||
|
||||
/** @var Company $company */
|
||||
$company = $this->createsCompany->execute($companyObject);
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::LAST_MILE_DELIVERY_AGENT);
|
||||
|
||||
$address = new AddressObject('B-39-13, Menara Simfoni, Jalan Simfoni 2, Balakong', 'Block 3730,Persiaran APEC', 1, 15, 432, 43300, AddressType::BILLING, ApprovalStatus::APPROVED);
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
|
||||
$contact = new ContactObject('Office Number', '01155543194', '', '');
|
||||
$this->createsContact->execute($companyModule, $contact);
|
||||
|
||||
$user_object = new RegistrationObject('CQ', 'hywavetech168@gmail.com', 'FIzxqcZFFob7btVLEfWC', 'FIzxqcZFFob7btVLEfWC', RoleTypes::USER, ApprovalStatus::APPROVED);
|
||||
|
||||
/** @var User $user */
|
||||
$user = $this->createsUser->execute($user_object);
|
||||
|
||||
$Object = new EmploymentObject($companyModule, $user);
|
||||
$this->assignEmployeeProcessor->execute($Object);
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
@@ -105,10 +104,10 @@ class ModernWarehouseTableSeeder extends Seeder
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
|
||||
$companyModule->update(['name' => 'Guangzhou', 'reference' => 'GZ-V02']);
|
||||
$companyModule->update(['name' => 'Yiwu', 'reference' => 'YW-V02']);
|
||||
|
||||
$address = new AddressObject('广东省 广州市 白云区 江高镇松岗街七横63号', '', 2, 35, 633, 510450, AddressType::BILLING, ApprovalStatus::APPROVED);
|
||||
$contact = new ContactObject('郑先生', '13719211997', '', '');
|
||||
$address = new AddressObject('义乌市 后宅街道 起航路233号百汇科创园园区里面', '(进口处进来第一个路口左转至出口处右手边国际物流仓库)', 2, 27, 532, 322000);
|
||||
$contact = new ContactObject('韩成名', '18058489899 / 18058929899', '', '');
|
||||
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
$this->createsContact->execute($companyModule, $contact);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 50 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB |
@@ -317,6 +317,12 @@ hr{
|
||||
background-color: $color-primary-lighter !important;
|
||||
}
|
||||
|
||||
.bg-primary-lighter-hover {
|
||||
&:hover {
|
||||
background-color: $color-primary-lighter !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Complete
|
||||
------------------------------------
|
||||
*/
|
||||
|
||||
@@ -67,11 +67,11 @@
|
||||
this.submit(this.route('api.account.authentication.logout'), 'get', this.section, false, false)
|
||||
},
|
||||
successHandler(){
|
||||
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: [7, 8].includes(this.$store.getters.getCompanyModuleType) ? this.route('last_mile_delivery.login') : this.route('login') });
|
||||
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: this.route('login')});
|
||||
this.$store.dispatch('updateIfCreateNewOrder','');
|
||||
},
|
||||
errorHandler(){
|
||||
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: [7, 8].includes(this.$store.getters.getCompanyModuleType) ? this.route('last_mile_delivery.login') : this.route('login') });
|
||||
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: this.route('login')});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
<div class="row m-t-15 align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="btn btn-block btn-lg b-rad-none no-border" :class="[{'btn-primary': currentUrl.indexOf('last_mile_delivery') === -1 }, {'btn-info': currentUrl.indexOf('last_mile_delivery') > -1 }]" @click="submitForm">Sign In</div>
|
||||
<div class="btn btn-block btn-lg btn-primary b-rad-none no-border" @click="submitForm">Sign In</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-15">
|
||||
@@ -55,8 +55,7 @@
|
||||
parameters: {
|
||||
email: this.email,
|
||||
password: ''
|
||||
},
|
||||
currentUrl: window.location.href,
|
||||
}
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row text-left" @keyup.enter="submitForm">
|
||||
<div class="col">
|
||||
<error-message-component class="m-b-20" :error="error"></error-message-component>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-15">
|
||||
<div class="col p-r-5">
|
||||
<validation-wrapper-component :validator="$v.parameters.name">
|
||||
<label>Full Name</label>
|
||||
<input class="form-control" v-model="parameters.name">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<validation-wrapper-component :validator="$v.parameters.phone">
|
||||
<label>Phone</label>
|
||||
<input class="form-control" v-model="parameters.phone">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.email">
|
||||
<label>Email</label>
|
||||
<input class="form-control" v-model="parameters.email">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-b-15">
|
||||
<div class="col p-r-5">
|
||||
<validation-wrapper-component :validator="$v.parameters.password">
|
||||
<label>Password</label>
|
||||
<input class="form-control" type="password" v-model="parameters.password">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<validation-wrapper-component :validator="$v.parameters.password_confirmation">
|
||||
<label>Password Confirmation</label>
|
||||
<input class="form-control" type="password" v-model="parameters.password_confirmation">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<button type="button" class="btn btn-sm p-t-10 p-b-10 btn-default bg-master-lighter b-rad-none" @click="$store.dispatch('toggleSection', {name: 'registrationForm', status: false})">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-auto p-r-10">
|
||||
<i class="fa fa-angle-left fs-16" style="margin-top: 1px;"></i>
|
||||
</div>
|
||||
<div class="col p-l-5">I already have an account</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<button type="button" class="btn btn-sm btn-block p-t-10 p-b-10 p-r-35 p-l-35 b-rad-none p-r-30" :class="[{'btn-primary': currentUrl.indexOf('last_mile_delivery') === -1 }, {'btn-info': currentUrl.indexOf('last_mile_delivery') > -1 }]" @click="submitForm()">
|
||||
<div class="row align-items-center">
|
||||
<div class="col p-r-5">Sign Up</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import registrationFormValidation from '../../../general/mixins/accounts/validation/newRegistrationFormValidation';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
error: '',
|
||||
step: 1,
|
||||
parameters : {
|
||||
name: '',
|
||||
email: '',
|
||||
type: 1,
|
||||
phone: '',
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
},
|
||||
currentUrl: window.location.href,
|
||||
status:{
|
||||
direction:null,
|
||||
},
|
||||
watchCheckEmail:null
|
||||
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
submitForm(){
|
||||
this.submit(this.route('api.delivery.account.registration.register'), 'post', this.section, false, false);
|
||||
}
|
||||
},
|
||||
mixins: [registrationFormValidation]
|
||||
}
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user