mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Merge branch 'development' into 'update-id-number'
# Conflicts: # resources/assets/vue/components/orders/sections/OrderProfileSectionComponent.vue
This commit is contained in:
@@ -51,3 +51,5 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
UNITY_APP_URL="https://unity.izyim.com"
|
||||
EXCHANGE_URL=https://dev.exchange.cief-malaysia.com/
|
||||
MIX_EXCHANGE_URL="${EXCHANGE_URL}"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class HasPendingDelivery implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $value ? $builder->whereHas('packingLists', function (Builder $query) use($value) {
|
||||
$query->whereDoesntHave('transports');
|
||||
}) : $builder->whereDoesntHave('packingLists', function (Builder $query) use($value) {
|
||||
$query->whereDoesntHave('transports');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class PackingListStatus implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('packing_lists.status', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class PackingListType implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('packing_lists.type', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class Reference implements Filter
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('Reference', '=', $value);
|
||||
return $builder->where('reference', '=', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class ReferenceLike implements Filter
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('Reference', 'LIKE', '%'.$value.'%');
|
||||
return $builder->where('reference', 'LIKE', '%'.$value.'%');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class WithArrivalDate implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->leftJoin('transport_arrangements', function ($join) {
|
||||
$join->on('packing_lists.id', '=', 'transport_arrangements.owner_id')->where('transport_arrangements.owner_type', 'App\Models\PackingList');
|
||||
})->addSelect(['packing_lists.*', DB::raw('transport_arrangements.drop_date as arrival_date')]);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
interface Packable
|
||||
{
|
||||
|
||||
public function packingLists(): morphMany;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Interfaces;
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
interface Remarkable
|
||||
{
|
||||
|
||||
public function remarks(): morphMany;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Accounts\Processors\CrossAuthenticationProcessor;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CrossAuthenticateUserLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Cross Authentication',
|
||||
'message' => 'You have successfully logged in to your account'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CrossAuthenticationProcessor */
|
||||
private $crossAuthenticationProcessor;
|
||||
|
||||
|
||||
/**
|
||||
* CrossAuthenticateUserLogic constructor.
|
||||
* @param CrossAuthenticationProcessor $authenticationProcessor
|
||||
*/
|
||||
public function __construct(CrossAuthenticationProcessor $crossAuthenticationProcessor)
|
||||
{
|
||||
$this->crossAuthenticationProcessor = $crossAuthenticationProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\AccessUnauthorisedException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
protected function logic(Request $request): JsonResponse {
|
||||
return $this->response($this->crossAuthenticationProcessor->execute($request));
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\DataTransferObjects;
|
||||
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
|
||||
class CrossAuthenticationCredentialsObject implements DataTransferObject
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
private $access_token;
|
||||
|
||||
/** @var string */
|
||||
private $platform;
|
||||
|
||||
/**
|
||||
* CrossAuthenticationCredentialsObject constructor.
|
||||
* @param string $access_token
|
||||
* @param string $platform
|
||||
*/
|
||||
public function __construct(string $access_token, int $platform)
|
||||
{
|
||||
$this->access_token = $access_token;
|
||||
$this->platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessToken(): string
|
||||
{
|
||||
return $this->access_token;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPlatform(): int
|
||||
{
|
||||
return $this->platform;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\DataTransferObjects;
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
use App\Models\User;
|
||||
|
||||
class UserSocialAccountObject implements DataTransferObject
|
||||
{
|
||||
/** @var String */
|
||||
private $app_id;
|
||||
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/** @var integer */
|
||||
private $platform;
|
||||
|
||||
/**
|
||||
* UserSocialAccountObject constructor.
|
||||
* @param String $token
|
||||
* @param String $app_id
|
||||
*/
|
||||
public function __construct(String $app_id, User $user, int $platform)
|
||||
{
|
||||
$this->app_id = $app_id;
|
||||
$this->user = $user;
|
||||
$this->platform = $platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAppId(): String
|
||||
{
|
||||
return $this->app_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return User
|
||||
*/
|
||||
public function getUser(): User
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPlatform(): int
|
||||
{
|
||||
return $this->platform;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Processors;
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\CrossAuthenticationCredentialsObject;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserSocialAccountObject;
|
||||
|
||||
use App\Classes\Modules\Accounts\Services\CrossAuthenticatesUser;
|
||||
use App\Classes\Modules\Accounts\Services\AuthenticationRedirect;
|
||||
use App\Classes\Modules\Accounts\Services\FetchesUser;
|
||||
use App\Classes\Modules\Accounts\Services\GeneratesAuthenticationToken;
|
||||
use App\Classes\Modules\Accounts\Standards\Rules\CanCrossAuthenticateUser;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
|
||||
use App\Classes\Modules\Accounts\Processors\CreateUserProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
|
||||
use App\Classes\General\Services\GeneratesInitials;
|
||||
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
|
||||
use App\Classes\Modules\Documents\Processors\UploadIdentityDocumentProcessor;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesUserSocialAccount;
|
||||
|
||||
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 Illuminate\Http\Request;
|
||||
use App\Models\UserSocialAccount;
|
||||
|
||||
class CrossAuthenticationProcessor
|
||||
{
|
||||
|
||||
/** @var CanCrossAuthenticateUser */
|
||||
private $canCrossAuthenticateUser;
|
||||
|
||||
/** @var CrossAuthenticatesUser */
|
||||
private $authenticatesUser;
|
||||
|
||||
/** @var GeneratesAuthenticationToken */
|
||||
private $generatesAuthenticationToken;
|
||||
|
||||
/** @var FetchesUser */
|
||||
private $fetchesUser;
|
||||
|
||||
/** @var AuthenticationRedirect */
|
||||
private $authenticationRedirect;
|
||||
|
||||
/** @var CreateUserProcessor */
|
||||
private $createUserProcessor;
|
||||
|
||||
/** @var CreateCompanyProcessor */
|
||||
private $createCompanyProcessor;
|
||||
|
||||
/** @var CreateContactProcessor */
|
||||
private $createContactProcessor;
|
||||
|
||||
/** @var CreateCompanyModuleProcessor */
|
||||
private $createCompanyModuleProcessor;
|
||||
|
||||
/** @var CreatesCompanyConnection */
|
||||
private $createsCompanyConnection;
|
||||
|
||||
/** @var ApprovesCompanyConnection */
|
||||
private $approvesCompanyConnection;
|
||||
|
||||
/** @var AssignEmployeeProcessor */
|
||||
private $assignEmployeeProcessor;
|
||||
|
||||
/** @var UploadIdentityDocumentProcessor */
|
||||
private $uploadIdentityDocumentProcessor;
|
||||
|
||||
/** @var CreatesUserSocialAccount */
|
||||
private $createsUserSocialAccount;
|
||||
|
||||
/**
|
||||
* CrossAuthenticationProcessor constructor.
|
||||
* @param CanCrossAuthenticateUser $canCrossAuthenticateUser
|
||||
* @param CrossAuthenticatesUser $crossAuthenticatesUser
|
||||
* @param GeneratesAuthenticationToken $generatesAuthenticationToken
|
||||
* @param FetchesUser $fetchesUser
|
||||
* @param AuthenticationRedirect $authenticationRedirect
|
||||
* @param CreateUserProcessor $createUserProcessor
|
||||
* @param CreateCompanyProcessor $createCompanyProcessor
|
||||
* @param CreateContactProcessor $createContactProcessor
|
||||
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
|
||||
* @param CreatesCompanyConnection $createsCompanyConnection
|
||||
* @param ApprovesCompanyConnection $approvesCompanyConnection
|
||||
* @param AssignEmployeeProcessor $assignEmployeeProcessor
|
||||
* @param UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor
|
||||
* @param CreatesUserSocialAccount $createsUserSocialAccount
|
||||
*/
|
||||
public function __construct(
|
||||
CanCrossAuthenticateUser $canCrossAuthenticateUser,
|
||||
CrossAuthenticatesUser $crossAuthenticatesUser,
|
||||
GeneratesAuthenticationToken $generatesAuthenticationToken,
|
||||
FetchesUser $fetchesUser,
|
||||
AuthenticationRedirect $authenticationRedirect,
|
||||
CreateUserProcessor $createUserProcessor,
|
||||
CreateCompanyProcessor $createCompanyProcessor,
|
||||
CreateContactProcessor $createContactProcessor,
|
||||
CreateCompanyModuleProcessor $createCompanyModuleProcessor,
|
||||
CreatesCompanyConnection $createsCompanyConnection,
|
||||
ApprovesCompanyConnection $approvesCompanyConnection,
|
||||
AssignEmployeeProcessor $assignEmployeeProcessor,
|
||||
UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor,
|
||||
CreatesUserSocialAccount $createsUserSocialAccount
|
||||
)
|
||||
{
|
||||
$this->canCrossAuthenticateUser = $canCrossAuthenticateUser;
|
||||
$this->crossAuthenticatesUser = $crossAuthenticatesUser;
|
||||
$this->generatesAuthenticationToken = $generatesAuthenticationToken;
|
||||
$this->fetchesUser = $fetchesUser;
|
||||
$this->authenticationRedirect = $authenticationRedirect;
|
||||
$this->createUserProcessor = $createUserProcessor;
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
$this->createContactProcessor = $createContactProcessor;
|
||||
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
|
||||
$this->createsCompanyConnection = $createsCompanyConnection;
|
||||
$this->createsCompanyConnection = $createsCompanyConnection;
|
||||
$this->approvesCompanyConnection = $approvesCompanyConnection;
|
||||
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
|
||||
$this->uploadIdentityDocumentProcessor = $uploadIdentityDocumentProcessor;
|
||||
$this->createsUserSocialAccount = $createsUserSocialAccount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return array
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\AccessUnauthorisedException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function execute(Request $request): array {
|
||||
|
||||
$object = new CrossAuthenticationCredentialsObject($request->input('access_token'), $request->input('platform'));
|
||||
|
||||
$this->canCrossAuthenticateUser->passes($object);
|
||||
|
||||
$cross = $this->crossAuthenticatesUser->execute($object);
|
||||
|
||||
$user_social_account = UserSocialAccount::where('app_id', $cross->token->user->id)->first();
|
||||
if (!$user_social_account) {
|
||||
|
||||
$request->request->add([
|
||||
'name' => $cross->token->user->name,
|
||||
'email' => $cross->token->user->email,
|
||||
'password' => 'pass123',
|
||||
'password_confirmation' => 'pass123',
|
||||
]);
|
||||
|
||||
$user = $this->createUserProcessor->execute(
|
||||
$request,
|
||||
RoleTypes::USER,
|
||||
env('APP_ENV') != 'production' ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_VERIFICATION
|
||||
);
|
||||
|
||||
$company = $this->createCompanyProcessor->execute(
|
||||
$cross->payload->data->name,
|
||||
CompanyType::COMPANY_BUSINESS,
|
||||
ApprovalStatus::PENDING_SUBMISSION
|
||||
);
|
||||
|
||||
$contactObject = new ContactObject(
|
||||
$cross->payload->data->contact->reference,
|
||||
$cross->payload->data->contact->phone,
|
||||
$cross->payload->data->contact->email,
|
||||
$cross->payload->data->contact->wechat_id
|
||||
);
|
||||
$contact = $this->createContactProcessor->execute($contactObject, $company);
|
||||
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::IMPORTER);
|
||||
|
||||
$connectionObject = new CompanyConnectionObject(
|
||||
$companyModule, 'CIEF',
|
||||
mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate()
|
||||
);
|
||||
$connection = $this->createsCompanyConnection->execute($connectionObject);
|
||||
|
||||
$this->approvesCompanyConnection->execute($connection);
|
||||
|
||||
$object = new EmploymentObject($companyModule, $user);
|
||||
$this->assignEmployeeProcessor->execute($object);
|
||||
|
||||
$request->request->add([
|
||||
'files' => [$cross->document->src],
|
||||
'identification_no' => $cross->payload->data->identification->reference,
|
||||
]);
|
||||
|
||||
$this->uploadIdentityDocumentProcessor->execute($request, $company);
|
||||
|
||||
$object = new UserSocialAccountObject(
|
||||
$cross->token->user->id,
|
||||
$user,
|
||||
$request->input('platform')
|
||||
);
|
||||
$this->createsUserSocialAccount->execute($object);
|
||||
}
|
||||
else {
|
||||
$user = $user_social_account->user()->first();
|
||||
}
|
||||
|
||||
return ['access_token' => $this->generatesAuthenticationToken->execute($user), 'redirect_url' => $this->authenticationRedirect->url($user)];
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -56,4 +56,4 @@ class GenerateEmailVerificationAttemptProcessor
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\UserSocialAccountObject;
|
||||
use App\Models\UserSocialAccount;
|
||||
|
||||
class CreatesUserSocialAccount extends AbstractUpdateRecord
|
||||
{
|
||||
/**
|
||||
* @param UserSocialAccountObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(UserSocialAccountObject $object) {
|
||||
$model = new UserSocialAccount();
|
||||
$model->user_id = $object->getUser()->id;
|
||||
$model->app_id = $object->getAppId();
|
||||
$model->platform = $object->getPlatform();
|
||||
return $this->handler($model);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Classes\Exceptions\AccessUnauthorisedException;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\CrossAuthenticationCredentialsObject;
|
||||
use App\Classes\ValueObjects\Constants\PlatformType;
|
||||
|
||||
class CrossAuthenticatesUser
|
||||
{
|
||||
|
||||
/**
|
||||
* @param CrossAuthenticationCredentialsObject $object
|
||||
* @return false|string
|
||||
* @throws AccessUnauthorisedException
|
||||
*/
|
||||
|
||||
public function execute(CrossAuthenticationCredentialsObject $object){
|
||||
|
||||
if ($object->getPlatform() == PlatformType::EXCHANGE) {
|
||||
|
||||
$token = $object->getAccessToken();
|
||||
|
||||
$tokenParts = explode(".", $token);
|
||||
$tokenPayload = base64_decode($tokenParts[1]);
|
||||
$jwtPayload = json_decode($tokenPayload);
|
||||
|
||||
$response = Http::withToken($object->getAccessToken())->get(env('EXCHANGE_URL') . 'api/v1/company/' . $jwtPayload->user->company_id . '/show')->object();
|
||||
|
||||
$response_document = Http::withToken($object->getAccessToken())->get(env('EXCHANGE_URL') . 'api/v1/storage/' . $response->payload->data->identification->files[0]->file->file_info[0]->original->file . '/fetch')->object();
|
||||
$response->token = $jwtPayload;
|
||||
$response->document = $response_document->payload;
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\UserSocialAccount;
|
||||
|
||||
class FetchesUserSocialAccount extends AbstractFetchRecord
|
||||
{
|
||||
|
||||
/** @var UserSocialAccount */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* FetchesUser constructor.
|
||||
* @param UserSocialAccount $repository
|
||||
*/
|
||||
public function __construct(UserSocialAccount $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Standards\Rules;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Exceptions\RequestValidationException;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\AuthenticationCredentialsObject;
|
||||
use App\Classes\Modules\Accounts\Standards\Validators\UserCrossAuthenticationValidation;
|
||||
|
||||
class CanCrossAuthenticateUser extends AbstractRule
|
||||
{
|
||||
|
||||
/** @var UserCrossAuthenticationValidation */
|
||||
private $userCrossAuthenticationValidation;
|
||||
|
||||
/**
|
||||
* CanCrossAuthenticateUser constructor.
|
||||
* @param UserCrossAuthenticationValidation $userCrossAuthenticationValidation
|
||||
*/
|
||||
public function __construct(UserCrossAuthenticationValidation $userCrossAuthenticationValidation)
|
||||
{
|
||||
$this->userCrossAuthenticationValidation = $userCrossAuthenticationValidation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param AuthenticationCredentialsObject $object
|
||||
* @return bool
|
||||
* @throws RequestValidationException
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return $this->userCrossAuthenticationValidation->validate($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AuthenticationCredentialsObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Standards\Validators;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractValidation;
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\CrossAuthenticationCredentialsObject;
|
||||
|
||||
class UserCrossAuthenticationValidation extends AbstractValidation
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @param CrossAuthenticationCredentialsObject $object
|
||||
* @return array
|
||||
*/
|
||||
protected function data($object): array {
|
||||
return [
|
||||
'access_token' => $object->getAccesstoken(),
|
||||
'platform' => $object->getPlatform()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function rules(): array {
|
||||
return [
|
||||
'access_token' => 'required',
|
||||
'platform' => 'required'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function messages(): array {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Processors\AssignConnectionSegmentProcessor;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyConnection;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AssignCompanyConnectionToConnectionSegmentLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Assign Company Connection To Connection Segment',
|
||||
'message' => 'You have successfully assigned Company Connection to Connection segment'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var FetchesCompanyConnection */
|
||||
private $fetchesCompanyConnection;
|
||||
|
||||
/** @var AssignConnectionSegmentProcessor */
|
||||
private $assignCompanyConnectionToConnectionSegmentProcessor;
|
||||
|
||||
/**
|
||||
* AssignCompanyToSegmentLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param FetchesCompanyConnection $fetchesCompanyConnection
|
||||
* @param AssignConnectionSegmentProcessor $assignCompanyConnectionToConnectionSegmentProcessor
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesCompanyConnection $fetchesCompanyConnection, AssignConnectionSegmentProcessor $assignCompanyConnectionToConnectionSegmentProcessor)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesCompanyConnection = $fetchesCompanyConnection;
|
||||
$this->assignCompanyConnectionToConnectionSegmentProcessor = $assignCompanyConnectionToConnectionSegmentProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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->route('id')]);
|
||||
|
||||
$companyConnection = $this->fetchesCompanyConnection->execute(['id' => $request->route('company_connection_id')]);
|
||||
|
||||
$this->assignCompanyConnectionToConnectionSegmentProcessor->execute($companyConnection, $request->input('segment_id'));
|
||||
|
||||
return $this->resourceResponse(new CompanyResource($company));
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\RemovesCompanyConnectionFromConnectionSegment;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RemoveCompanyConnectionFromConnectionSegmentLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Detach Company Connection From Connection Segment',
|
||||
'message' => 'You have successfully detached Company Connection from Connection segment'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var FetchesCompanyConnection */
|
||||
private $fetchesCompanyConnection;
|
||||
|
||||
/** @var FetchesSegment */
|
||||
private $fetchesSegment;
|
||||
|
||||
/** @var RemovesCompanyConnectionFromConnectionSegment */
|
||||
private $removesCompanyConnectionFromConnectionSegment;
|
||||
|
||||
/**
|
||||
* RemoveCompanyFromSegmentLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param FetchesCompanyConnection $fetchesCompanyConnection
|
||||
* @param FetchesSegment $fetchesSegment
|
||||
* @param RemovesCompanyConnectionFromConnectionSegment $removesCompanyConnectionFromConnectionSegment
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesCompanyConnection $fetchesCompanyConnection, FetchesSegment $fetchesSegment, RemovesCompanyConnectionFromConnectionSegment $removesCompanyConnectionFromConnectionSegment)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesCompanyConnection = $fetchesCompanyConnection;
|
||||
$this->fetchesSegment = $fetchesSegment;
|
||||
$this->removesCompanyConnectionFromConnectionSegment = $removesCompanyConnectionFromConnectionSegment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
|
||||
$companyConnection = $this->fetchesCompanyConnection->execute(['id' => $request->route('company_connection_id')]);
|
||||
|
||||
$segment = $this->fetchesSegment->execute(['id' => $request->route('segment_id')]);
|
||||
|
||||
$this->removesCompanyConnectionFromConnectionSegment->execute($companyConnection, $segment);
|
||||
|
||||
return $this->resourceResponse(new CompanyResource($company));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Processors;
|
||||
|
||||
use App\Classes\Modules\Companies\Services\AssignsCompanyConnectionToConnectionSegment;
|
||||
use App\Classes\Modules\Companies\Standards\Rules\CanAssignSegment;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Models\CompanyConnection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AssignConnectionSegmentProcessor
|
||||
{
|
||||
|
||||
/** @var CanAssignSegment */
|
||||
private $canAssignSegment;
|
||||
|
||||
/** @var AssignsCompanyConnectionToConnectionSegment */
|
||||
private $assignsCompanyConnectionToConnectionSegment;
|
||||
|
||||
/** @var FetchesSegment */
|
||||
private $fetchesSegment;
|
||||
|
||||
/**
|
||||
* AssignCompanyToSegmentProcessor constructor.
|
||||
* @param CanAssignSegment $canAssignSegment
|
||||
* @param AssignsCompanyConnectionToConnectionSegment $assignsCompanyConnectionToConnectionSegment
|
||||
* @param FetchesSegment $fetchesSegment
|
||||
*/
|
||||
public function __construct(CanAssignSegment $canAssignSegment, AssignsCompanyConnectionToConnectionSegment $assignsCompanyConnectionToConnectionSegment, FetchesSegment $fetchesSegment)
|
||||
{
|
||||
$this->canAssignSegment = $canAssignSegment;
|
||||
$this->assignsCompanyConnectionToConnectionSegment = $assignsCompanyConnectionToConnectionSegment;
|
||||
$this->fetchesSegment = $fetchesSegment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param CompanyConnection $companyConnection
|
||||
* @param int|null $segmentId
|
||||
* @return Model
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function execute(CompanyConnection $companyConnection, ?int $segmentId = SegmentConstants::STANDARD_SEGMENT): Model {
|
||||
|
||||
$segment = $this->fetchesSegment->execute(['id' => $segmentId]);
|
||||
|
||||
$this->canAssignSegment->passes();
|
||||
|
||||
return $this->assignsCompanyConnectionToConnectionSegment->execute($companyConnection, $segment);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\CompanyConnection;
|
||||
use App\Models\Segment;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class AssignsCompanyConnectionToConnectionSegment extends AbstractUpdateRecord
|
||||
{
|
||||
/**
|
||||
* @param CompanyConnection $companyConnection
|
||||
* @param Segment $segment
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(CompanyConnection $companyConnection, Segment $segment)
|
||||
{
|
||||
try {
|
||||
|
||||
$companyConnection->segments()->attach($segment);
|
||||
|
||||
return $companyConnection;
|
||||
|
||||
} catch (QueryException $exception){
|
||||
throw new MalformedRequestException($exception);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\CompanyConnection;
|
||||
|
||||
class FetchesCompanyConnection extends AbstractFetchRecord
|
||||
{
|
||||
|
||||
/** @var CompanyConnection */
|
||||
private $repository;
|
||||
|
||||
|
||||
/**
|
||||
* FetchesCompanyConnection constructor.
|
||||
* @param CompanyConnection $repository
|
||||
*/
|
||||
public function __construct(CompanyConnection $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\CompanyConnection;
|
||||
use App\Models\Segment;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class RemovesCompanyConnectionFromConnectionSegment extends AbstractUpdateRecord
|
||||
{
|
||||
/**
|
||||
* @param CompanyConnection $companyConnection
|
||||
* @param Segment $segment
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(CompanyConnection $companyConnection, Segment $segment)
|
||||
{
|
||||
try {
|
||||
|
||||
$companyConnection->segments()->detach($segment);
|
||||
|
||||
return $companyConnection;
|
||||
|
||||
} catch (QueryException $exception){
|
||||
throw new MalformedRequestException($exception);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
|
||||
use App\Classes\Modules\Orders\Processors\CreateOrderProcessor;
|
||||
use App\Classes\Modules\Orders\Services\GeneratesOrderNumber;
|
||||
use App\Classes\ValueObjects\Constants\WarehouseReferences;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -63,6 +64,13 @@ class CreateOrderLogic extends AbstractControllerLogic
|
||||
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $request->input('warehouse_id')]);
|
||||
|
||||
if($originWarehouse->reference === WarehouseReferences::VT_GUANG_ZHOU){
|
||||
$marking = $company->companyModules()->importers()->first()->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
|
||||
if(in_array($marking, ['2192KAA', '2353GFE', '6866DTR', '1905JYW', '6218MEN', '9274MEN'])){
|
||||
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::YD_GUANG_ZHOU]);
|
||||
}
|
||||
}
|
||||
|
||||
$order = $this->createOrderProcessor->execute($company, $originWarehouse, $address, $this->generatesOrderNumber->execute());
|
||||
|
||||
return $this->resourceResponse(new OrderResource($order));
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\FetchesOrder;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateOrderRemarkLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created Order',
|
||||
'message' => 'You have successfully created a new Order'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesOrder */
|
||||
private $fetchesOrder;
|
||||
|
||||
/** @var CreateRemarkProcessor */
|
||||
private $createRemarkProcessor;
|
||||
|
||||
/**
|
||||
* CreateOrderRemarkLogic constructor.
|
||||
* @param FetchesOrder $fetchesOrder
|
||||
* @param CreateRemarkProcessor $createRemarkProcessor
|
||||
*/
|
||||
public function __construct(FetchesOrder $fetchesOrder, CreateRemarkProcessor $createRemarkProcessor)
|
||||
{
|
||||
$this->fetchesOrder = $fetchesOrder;
|
||||
$this->createRemarkProcessor = $createRemarkProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
$order = $this->fetchesOrder->execute(['id' => $request->route('id')]);
|
||||
|
||||
$object = new RemarkObject($request->input('content'), auth()->user()->id);
|
||||
|
||||
$this->createRemarkProcessor->execute($order, $object);
|
||||
|
||||
return $this->resourceResponse(new OrderResource($order));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\CalculatesCBM;
|
||||
use App\Classes\Modules\Orders\Services\CalculatesBaseRate;
|
||||
use App\Classes\Modules\Orders\Services\CalculatesSegmentRate;
|
||||
use App\Classes\Modules\Orders\Services\CalculatesStateRate;
|
||||
use App\Classes\Modules\Orders\Services\CalculatesWarehouseRate;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateShippingCostTransactionProcessor;
|
||||
|
||||
use App\Classes\Modules\Orders\Services\FetchesOrder;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use App\Models\Order;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ShippingCostLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Order Shipping Cost',
|
||||
'message' => 'Order shipping cost calculation done'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CalculateCBM */
|
||||
private $calculateCBM;
|
||||
|
||||
/** @var CalculatesBaseRate */
|
||||
private $calculateBaseRate;
|
||||
|
||||
/** @var CalculatesSegmentRate */
|
||||
private $calculateSegmentRate;
|
||||
|
||||
/** @var CalculatesStateRate */
|
||||
private $calculateStateRate;
|
||||
|
||||
/** @var CalculatesWarehouse */
|
||||
private $calculateWarehouseRate;
|
||||
|
||||
/** @var FetchesOrder */
|
||||
private $fetchesOrder;
|
||||
|
||||
/** @var ShippingCostTransactionProcessor */
|
||||
private $shippingCostTransactionProcessor;
|
||||
|
||||
/**
|
||||
* ShippingCostLogic constructor.
|
||||
* @param CalculateCBM $calculateCBM
|
||||
* @param FetchesOrder $fetchesOrder
|
||||
*/
|
||||
public function __construct(FetchesOrder $fetchesOrder, CalculatesCBM $calculateCBM, CalculatesBaseRate $calculateBaseRate, CalculatesSegmentRate $calculateSegmentRate, CalculatesStateRate $calculateStateRate, CalculatesWarehouseRate $calculateWarehouseRate, CreateShippingCostTransactionProcessor $shippingCostTransactionProcessor)
|
||||
{
|
||||
$this->fetchesOrder = $fetchesOrder;
|
||||
$this->calculateCBM = $calculateCBM;
|
||||
$this->calculatesBaseRate = $calculateBaseRate;
|
||||
$this->calculatesSegmentRate = $calculateSegmentRate;
|
||||
$this->calculatesStateRate = $calculateStateRate;
|
||||
$this->calculateWarehouseRate = $calculateWarehouseRate;
|
||||
$this->shippingCostTransactionProcessor = $shippingCostTransactionProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$order = $this->fetchesOrder->getRepository()->where(['id' => $request->route('id')])->first();
|
||||
|
||||
$baseRate = $this->calculatesBaseRate->execute($order);
|
||||
$segmentRate = $this->calculatesSegmentRate->execute($order, SegmentConstants::STANDARD_SEGMENT) + $this->calculatesSegmentRate->execute($order, SegmentConstants::CUSTOM_SEGMENT);
|
||||
$stateRate = $this->calculatesStateRate->execute($order, false) + $this->calculatesStateRate->execute($order, true);
|
||||
$warehouseRate = $this->calculateWarehouseRate->execute($order);
|
||||
|
||||
$totalShippingCost = 0;
|
||||
$totalCBM = 0;
|
||||
$quantity = 0;
|
||||
foreach($order->parcels as $parcel){
|
||||
$cbm = $this->calculateCBM->execute($order, $parcel);
|
||||
|
||||
if($cbm > 0){
|
||||
$totalCBM += $cbm;
|
||||
$quantity ++;
|
||||
$totalShippingCost += (($segmentRate + $stateRate + $warehouseRate) * $cbm);
|
||||
}
|
||||
}
|
||||
|
||||
$this->shippingCostTransactionProcessor->execute($order, $quantity, round($totalCBM,2), round($totalShippingCost,2));
|
||||
return $this->resourceResponse(new OrderResource($order));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class CreateOrderRolesProcessor
|
||||
$importer = $order->companyModule;
|
||||
|
||||
/** @var CompanyModule $destinationWarehouse */
|
||||
$destinationWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::DESTINATION_WAREHOUSE[$address->state_id ]]);
|
||||
$destinationWarehouse = $this->fetchesCompanyModule->execute(['reference' => $originWarehouse->reference === WarehouseReferences::YD_GUANG_ZHOU ? WarehouseReferences::YD_DESTINATION_WAREHOUSE : WarehouseReferences::VT_DESTINATION_WAREHOUSE[$address->state_id]]);
|
||||
|
||||
/** @var CompanyModule $freightForwarder */
|
||||
$freightForwarder = $originWarehouse->company->companyModules()->freightForwarders()->first();
|
||||
@@ -84,28 +84,5 @@ class CreateOrderRolesProcessor
|
||||
$this->createsOrderRole->execute($roleObject);
|
||||
|
||||
return true;
|
||||
|
||||
$companies = $this->fetchesCompany->getRepository()->whereIn('id',[1, $request->get('warehouse_id')])->get();
|
||||
|
||||
$cief_company = $companies[0]->id == 1 ? $companies[0] : $companies[1];
|
||||
$warehouse_company = $companies[0]->id != 1 ? $companies[0] : $companies[1];
|
||||
|
||||
$cief_company_module = $cief_company->companyModule()->first();
|
||||
$contractEntities[] = $this->unityCreateContractEntity->execute( $contract_reference_no, [$cief_company_module->unity_hash_id]);
|
||||
$contractEntities[0]->{"company_module_id"} = $cief_company_module->id;
|
||||
|
||||
$warehouse_company_module = $warehouse_company->companyModule()->first();
|
||||
$contractEntities[] = $this->unityCreateContractEntity->execute( $contract_reference_no, [$warehouse_company_module->unity_hash_id]);
|
||||
$contractEntities[1]->{"company_module_id"} = $warehouse_company_module->id;
|
||||
|
||||
foreach($contractEntities as $entity){
|
||||
$order_role_object = new OrderRoleObject($orderId, $entity->company_module_id, $entity->hash_id, $entity->entity_signature_hash_id);
|
||||
|
||||
$this->canCreateOrderRole->passes($order_role_object);
|
||||
|
||||
$this->createsOrderRole->execute($order_role_object);
|
||||
}
|
||||
|
||||
return $contractEntities;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Services;
|
||||
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Order;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CalculatesBaseRate
|
||||
{
|
||||
|
||||
public function execute(Order $order){
|
||||
return 300;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Services;
|
||||
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Order;
|
||||
use App\Models\Package;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CalculatesCBM
|
||||
{
|
||||
|
||||
public function execute(Order $order, Package $parcel){
|
||||
return $parcel->length * $parcel->width * $parcel->height;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Services;
|
||||
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Models\Order;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CalculatesSegmentRate
|
||||
{
|
||||
|
||||
public function execute(Order $order, int $segmentRates){
|
||||
return ($segmentRates == SegmentConstants::STANDARD_SEGMENT) ? 300 : (
|
||||
(($segmentRates == SegmentConstants::CUSTOM_SEGMENT) ? -20 : 0)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Services;
|
||||
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Order;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CalculatesStateRate
|
||||
{
|
||||
|
||||
public function execute(Order $order, $isOutskirt=false){
|
||||
return ($isOutskirt) ? 20 : 40;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Services;
|
||||
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Order;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CalculatesWarehouseRate
|
||||
{
|
||||
|
||||
public function execute(Order $order){
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\ControllersLogic\Containers;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\Services\Containers\FetchesContainer;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Http\Resources\ContainerResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateContainerRemarkLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created Container',
|
||||
'message' => 'You have successfully created a new Container'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var FetchesContainer */
|
||||
private $fetchesContainer;
|
||||
|
||||
/** @var CreateRemarkProcessor */
|
||||
private $createRemarkProcessor;
|
||||
|
||||
/**
|
||||
* CreateContainerRemarkLogic constructor.
|
||||
* @param FetchesContainer $fetchesContainer
|
||||
* @param CreateRemarkProcessor $createRemarkProcessor
|
||||
*/
|
||||
public function __construct(FetchesContainer $fetchesContainer, CreateRemarkProcessor $createRemarkProcessor)
|
||||
{
|
||||
$this->fetchesContainer = $fetchesContainer;
|
||||
$this->createRemarkProcessor = $createRemarkProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->input('container_id')]);
|
||||
|
||||
$object = new RemarkObject($request->input('content'), 1);
|
||||
|
||||
$this->createRemarkProcessor->execute($container, $object);
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\PackingLists\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
|
||||
use App\Classes\Modules\PackingLists\Processors\CreatePackingListProcessor;
|
||||
use App\Classes\Modules\PackingLists\Services\GeneratesPackingListReferenceNumber;
|
||||
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
|
||||
use App\Http\Resources\DeliverPackingListResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateDeliverPackingListLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created Deliver PackingList',
|
||||
'message' => 'You have successfully created a new Deliver PackingList'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CreatePackingListProcessor */
|
||||
private $createPackingListProcessor;
|
||||
|
||||
/** @var FetchesCompanyModule */
|
||||
private $fetchesCompanyModule;
|
||||
|
||||
/** @var GeneratesPackingListReferenceNumber */
|
||||
private $generatesPackingListReferenceNumber;
|
||||
|
||||
/** @var FetchesPackingList */
|
||||
private $fetchesPackingList;
|
||||
|
||||
/**
|
||||
* CreateDeliverPackingListLogic constructor.
|
||||
* @param CreatePackingListProcessor $createPackingListProcessor
|
||||
* @param FetchesCompanyModule $fetchesCompanyModule
|
||||
*/
|
||||
public function __construct(CreatePackingListProcessor $createPackingListProcessor, FetchesCompanyModule $fetchesCompanyModule, GeneratesPackingListReferenceNumber $generatesPackingListReferenceNumber, FetchesPackingList $fetchesPackingList)
|
||||
{
|
||||
$this->createPackingListProcessor = $createPackingListProcessor;
|
||||
$this->fetchesCompanyModule = $fetchesCompanyModule;
|
||||
$this->generatesPackingListReferenceNumber = $generatesPackingListReferenceNumber;
|
||||
$this->fetchesPackingList = $fetchesPackingList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$company_module = $this->fetchesCompanyModule->execute(['id' => $request->input('company_module_id')]);
|
||||
$packing_list_id = $request->input('packing_list_id');
|
||||
|
||||
$reference_number = $this->generatesPackingListReferenceNumber->execute();
|
||||
|
||||
$packingListObject = new PackingListObject(
|
||||
$reference_number,
|
||||
null,
|
||||
PackingListType::DELIVERY_PACKING_LIST,
|
||||
ApprovalStatus::PENDING_SUBMISSION
|
||||
);
|
||||
|
||||
$deliverPackingList = $this->createPackingListProcessor->execute($packingListObject, $company_module);
|
||||
|
||||
foreach ($packing_list_id as $key => $row) {
|
||||
$this->fetchesPackingList->execute(['id' => $row]);
|
||||
}
|
||||
|
||||
$deliverPackingList->packing_list_owner()->sync($packing_list_id);
|
||||
|
||||
return $this->resourceResponse(new DeliverPackingListResource($deliverPackingList));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ class PackingListObject implements DataTransferObject
|
||||
* @param int $status
|
||||
* @param null|string $contractReference
|
||||
*/
|
||||
public function __construct(string $reference, int $claimantId, int $type, int $status, ?string $contractReference = null)
|
||||
public function __construct(string $reference, ?int $claimantId, int $type, int $status, ?string $contractReference = null)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$this->claimantId = $claimantId;
|
||||
@@ -50,7 +50,7 @@ class PackingListObject implements DataTransferObject
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getClaimantId(): int
|
||||
public function getClaimantId(): ?int
|
||||
{
|
||||
return $this->claimantId;
|
||||
}
|
||||
|
||||
@@ -51,11 +51,13 @@ class UpdateRemarkLogic extends AbstractControllerLogic
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$object = new RemarkObject($request->input('content'), $request->input('commenter_id'));
|
||||
$object = new RemarkObject($request->input('content'), auth()->user()->id);
|
||||
|
||||
$this->canUpdateRemark->passes($object);
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Remarks\Processors;
|
||||
|
||||
|
||||
use App\Classes\General\Interfaces\Remarkable;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Services\CreatesRemark;
|
||||
use App\Classes\Modules\Remarks\Standards\Rules\CanCreateRemark;
|
||||
|
||||
class CreateRemarkProcessor
|
||||
{
|
||||
|
||||
/** @var CreatesRemark */
|
||||
private $createsRemark;
|
||||
|
||||
/** @var CanCreateRemark */
|
||||
private $canCreateRemark;
|
||||
|
||||
/**
|
||||
* CreateRemarkProcessor constructor.
|
||||
* @param CreatesRemark $createsRemark
|
||||
* @param CanCreateRemark $canCreateRemark
|
||||
*/
|
||||
public function __construct(CreatesRemark $createsRemark, CanCreateRemark $canCreateRemark)
|
||||
{
|
||||
$this->createsRemark = $createsRemark;
|
||||
$this->canCreateRemark = $canCreateRemark;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Remarkable $remarkable
|
||||
* @param RemarkObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function execute(Remarkable $remarkable, RemarkObject $object){
|
||||
|
||||
$this->canCreateRemark->passes($object);
|
||||
return $this->createsRemark->execute($remarkable, $object);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,9 @@ namespace App\Classes\Modules\Remarks\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
|
||||
use App\Classes\General\Interfaces\Remarkable;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Models\Container;
|
||||
use App\Models\Remark;
|
||||
use App\Models\User;
|
||||
|
||||
@@ -12,18 +14,18 @@ class CreatesRemark extends AbstractUpdateRelationshipRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Company $company
|
||||
* @param Remarkable $remarkable
|
||||
* @param RemarkObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(User $user, RemarkObject $object) {
|
||||
public function execute(Remarkable $remarkable, RemarkObject $object) {
|
||||
$model = new Remark();
|
||||
|
||||
$model->commenter_id = $object->getCommenterId();
|
||||
$model->content = $object->getContent();
|
||||
|
||||
return $this->handler($user->remarks(), $model);
|
||||
return $this->handler($remarkable->remarks(), $model);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\Processors\CreateSegmentProcessor;
|
||||
use App\Http\Resources\SegmentResource;
|
||||
use App\Models\Segment;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateSegmentLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created Segment',
|
||||
'message' => 'You have successfully created a new Segment'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var CreateSegmentProcessor */
|
||||
private $createSegmentProcessor;
|
||||
|
||||
/**
|
||||
* CreateSegmentLogic constructor.
|
||||
* @param CreateSegmentProcessor $createSegmentProcessor
|
||||
*/
|
||||
public function __construct(CreateSegmentProcessor $createSegmentProcessor)
|
||||
{
|
||||
$this->createSegmentProcessor = $createSegmentProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
/** @var Segment $segment */
|
||||
$segment = $this->createSegmentProcessor->execute($request->input('name'));
|
||||
|
||||
return $this->resourceResponse(new SegmentResource($segment));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\Services\DeletesSegment;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanDeleteSegment;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteSegmentLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Deleted Segment',
|
||||
'message' => 'You have successfully deleted a Segment'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var CanDeleteSegment */
|
||||
private $canDeleteSegment;
|
||||
|
||||
/** @var DeletesSegment */
|
||||
private $deletesSegment;
|
||||
|
||||
/** @var FetchesSegment */
|
||||
private $fetchesSegment;
|
||||
|
||||
/**
|
||||
* DeleteSegmentLogic constructor.
|
||||
* @param CanDeleteSegment $canDeleteSegment
|
||||
* @param DeletesSegment $deletesSegment
|
||||
* @param FetchesSegment $fetchesSegment
|
||||
*/
|
||||
public function __construct(CanDeleteSegment $canDeleteSegment, DeletesSegment $deletesSegment, FetchesSegment $fetchesSegment)
|
||||
{
|
||||
$this->canDeleteSegment = $canDeleteSegment;
|
||||
$this->deletesSegment = $deletesSegment;
|
||||
$this->fetchesSegment = $fetchesSegment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$this->canDeleteSegment->passes();
|
||||
|
||||
$query = $this->fetchesSegment->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->deletesSegment->execute($query);
|
||||
|
||||
return $this->response([]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\DataTransferObjects;
|
||||
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
|
||||
class SegmentObject implements DataTransferObject
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
/** @var int */
|
||||
private $company_module_id;
|
||||
|
||||
/**
|
||||
* ConstantObject constructor.
|
||||
* @param string $name
|
||||
* @param string $reference
|
||||
* @param array $detail
|
||||
*/
|
||||
public function __construct(string $name, int $company_module_id)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->company_module_id = $company_module_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCompanyModuleId(): string
|
||||
{
|
||||
return $this->company_module_id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Processors;
|
||||
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
use App\Classes\Modules\Segments\Services\CreatesSegment;
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanCreateSegment;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CreateSegmentProcessor
|
||||
{
|
||||
|
||||
/** @var CanCreateSegment */
|
||||
private $canCreateSegment;
|
||||
|
||||
/** @var CreatesSegment */
|
||||
private $createsSegment;
|
||||
|
||||
/**
|
||||
* CreateSegmentProcessor constructor.
|
||||
* @param CanCreateSegment $canCreateSegment
|
||||
* @param CreatesSegment $createsSegment
|
||||
* @param GeneratesUniqueAccountNumber $generatesUniqueAccountNumber
|
||||
*/
|
||||
public function __construct(CanCreateSegment $canCreateSegment, CreatesSegment $createsSegment)
|
||||
{
|
||||
$this->canCreateSegment = $canCreateSegment;
|
||||
$this->createsSegment = $createsSegment;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param int $companyModuleId
|
||||
* @return Model
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function execute(string $name, int $companyModuleId =1): Model {
|
||||
|
||||
$segement_object = new SegmentObject($name, $companyModuleId);
|
||||
|
||||
$this->canCreateSegment->passes($segement_object);
|
||||
|
||||
return $this->createsSegment->execute($segement_object);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
use App\Models\Segment;
|
||||
|
||||
class CreatesSegment extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param SegmentObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(SegmentObject $object)
|
||||
{
|
||||
$model = new Segment();
|
||||
$model->name = $object->getName();
|
||||
$model->company_module_id = $object->getCompanyModuleId();
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractDeleteRecord;
|
||||
use App\Models\Segment;
|
||||
|
||||
class DeletesSegment extends AbstractDeleteRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Segment $model
|
||||
* @return mixed
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Segment $model) {
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Standards\Rules;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
use App\Classes\Modules\Segments\Standards\Validators\SegmentValidation;
|
||||
|
||||
class CanCreateSegment extends AbstractRule
|
||||
{
|
||||
/** @var SegmentValidation */
|
||||
private $segmentValidation;
|
||||
|
||||
|
||||
/**
|
||||
* CanCreateSegment constructor.
|
||||
* @param SegmentValidation $segmentValidation
|
||||
*/
|
||||
public function __construct(SegmentValidation $segmentValidation)
|
||||
{
|
||||
$this->segmentValidation = $segmentValidation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SegmentObject $object
|
||||
* @return bool
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return $this->segmentValidation->validate($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SegmentObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Standards\Rules;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
|
||||
class CanDeleteSegment extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorized(): bool
|
||||
{
|
||||
// TODO Set Authorization rules
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BankObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function validators($object): bool
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param BankObject $object
|
||||
* @return bool
|
||||
*/
|
||||
protected function criteria($object): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Standards\Validators;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractValidation;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
|
||||
class SegmentValidation extends AbstractValidation
|
||||
{
|
||||
/**
|
||||
* @param SegmentObject $object
|
||||
* @return array
|
||||
*/
|
||||
protected function data($object): array
|
||||
{
|
||||
return [
|
||||
'name' => $object->getName(),
|
||||
'company_module_id' => $object->getCompanyModuleId()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @return array
|
||||
*/
|
||||
protected function rules(?string $type = 'POST'): array
|
||||
{
|
||||
if ($type == 'POST') {
|
||||
return [
|
||||
'name' => 'required',
|
||||
'company_module_id' => 'required',
|
||||
];
|
||||
} elseif ($type == 'PUT') {
|
||||
return [
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function messages(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ use App\Classes\General\Interfaces\DataTransferObject;
|
||||
class TransactionDetailObject implements DataTransferObject
|
||||
{
|
||||
/** @var string|null */
|
||||
private $code;
|
||||
private $reference;
|
||||
|
||||
/** @var string|null */
|
||||
private $name;
|
||||
@@ -20,14 +20,14 @@ class TransactionDetailObject implements DataTransferObject
|
||||
|
||||
/**
|
||||
* TransactionDetailObject constructor.
|
||||
* @param string $code
|
||||
* @param string $reference
|
||||
* @param string $name
|
||||
* @param int $quantity
|
||||
* @param float $price
|
||||
*/
|
||||
public function __construct(?string $code, ?string $name , ?int $quantity, ?float $price)
|
||||
public function __construct(?string $reference, ?string $name , ?int $quantity, ?float $price)
|
||||
{
|
||||
$this->code = $code;
|
||||
$this->reference = $reference;
|
||||
$this->name = $name;
|
||||
$this->quantity = $quantity;
|
||||
$this->price = $price;
|
||||
@@ -36,9 +36,9 @@ class TransactionDetailObject implements DataTransferObject
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCode(): ?string
|
||||
public function getReference(): ?string
|
||||
{
|
||||
return $this->code;
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,4 +70,4 @@ class TransactionDetailObject implements DataTransferObject
|
||||
return $this->getQuantity() * $this->getPrice();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
use App\Classes\Modules\Transactions\Services\CreatesShippingCostTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionDetailObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Models\Order;
|
||||
|
||||
class CreateShippingCostTransactionProcessor
|
||||
{
|
||||
/** @var CreatesShippingCostTransaction */
|
||||
private $createsShippingCostTransaction;
|
||||
|
||||
/** @var GeneratesTransactionBillNumber */
|
||||
private $generatesTransactionBillNumber;
|
||||
|
||||
public function __construct(CreatesShippingCostTransaction $createsShippingCostTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber)
|
||||
{
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->createsShippingCostTransaction = $createsShippingCostTransaction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Order $order, int $quantity, float $totalCBM, float $totalShippingCost)
|
||||
{
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('SHP-');
|
||||
|
||||
$transactionObject = new TransactionObject(
|
||||
$billNumber,
|
||||
TransactionType::SHIPPING_COST,
|
||||
1,
|
||||
$order->companyModule->company_id,
|
||||
1,
|
||||
PaymentMethodType::BA,
|
||||
$totalShippingCost,
|
||||
$totalShippingCost,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
null,
|
||||
ApprovalStatus::PENDING_SUBMISSION
|
||||
);
|
||||
|
||||
$transactionDetailObject = new TransactionDetailObject(
|
||||
TransactionType::SHIPPING_COST,
|
||||
'Shipping Cost',
|
||||
$quantity,
|
||||
$totalShippingCost/$totalCBM
|
||||
);
|
||||
|
||||
$shippingCostTransaction = $this->createsShippingCostTransaction->execute($order, $transactionObject, $transactionDetailObject);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionDetailObject;
|
||||
use App\Models\Order;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\TransactionDetail;
|
||||
|
||||
class CreatesShippingCostTransaction extends AbstractUpdateRelationshipRecord
|
||||
{
|
||||
/**
|
||||
* @param TransactionObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Order $order, TransactionObject $object, TransactionDetailObject $transactionDetailObject) {
|
||||
$model = new Transaction();
|
||||
$model->bill_no = $object->getBillNo();
|
||||
$model->type = $object->getTransactionType();
|
||||
$model->issuer = $object->getIssuer();
|
||||
$model->receiver = $object->getReceiver();
|
||||
$model->recipient_bank_account_id = $object->getRecipientBankAccountId();
|
||||
$model->payment_method = $object->getPaymentMethod();
|
||||
$model->amount = $object->getAmount();
|
||||
$model->original_amount = $object->getOriginalAmount();
|
||||
$model->currency_id = $object->getCurrencyId();
|
||||
$model->original_currency_id = $object->getOriginalCurrencyId();
|
||||
$model->currency_rate = $object->getCurrencyRate();
|
||||
$model->tax = $object->getTax();
|
||||
$model->service_charge = $object->getServiceCharge();
|
||||
$model->expires_on = $object->getExpiresOn();
|
||||
$model->status = $object->getStatus();
|
||||
|
||||
$transaction = $this->handler($order->transactions(), $model);
|
||||
|
||||
|
||||
$model = new TransactionDetail();
|
||||
$model->reference = $transactionDetailObject->getReference();
|
||||
$model->name = $transactionDetailObject->getName();
|
||||
$model->quantity = $transactionDetailObject->getQuantity();
|
||||
$model->price = $transactionDetailObject->getPrice();
|
||||
$model->amount = $transactionDetailObject->getAmount();
|
||||
|
||||
return $this->handler($transaction->transactionDetails(), $model);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,6 @@ final class BusinessType {
|
||||
|
||||
public const DRIVER = 5;
|
||||
|
||||
public const CURRENCY_VENDOR = 5;
|
||||
public const CURRENCY_VENDOR = 6;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class PlatformType {
|
||||
|
||||
public const EXCHANGE = 1;
|
||||
|
||||
}
|
||||
@@ -22,4 +22,6 @@ final class TransactionType {
|
||||
|
||||
public const SUPPLIER_DELIVER = 8;
|
||||
|
||||
public const SHIPPING_COST = 9;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,34 +4,40 @@ namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class WarehouseReferences {
|
||||
|
||||
public const GUANG_ZHOU = 'GZ-V01';
|
||||
public const VT_GUANG_ZHOU = 'GZ-V01';
|
||||
|
||||
public const YIWU = 'YW-V01';
|
||||
public const YD_GUANG_ZHOU = 'GZ-V02';
|
||||
|
||||
public const KLANG = 'KL-V01';
|
||||
public const VT_YIWU = 'YW-V01';
|
||||
|
||||
public const SABAH = 'SB-V01';
|
||||
public const VT_KLANG = 'KL-V01';
|
||||
|
||||
public const SARAWAK = 'SRW-V01';
|
||||
public const YD_KLANG = 'KL-V02';
|
||||
|
||||
public const DESTINATION_WAREHOUSE = [
|
||||
1 => self::KLANG,
|
||||
2 => self::KLANG,
|
||||
3 => self::KLANG,
|
||||
4 => self::KLANG,
|
||||
5 => self::SABAH,
|
||||
6 => self::KLANG,
|
||||
7 => self::KLANG,
|
||||
8 => self::KLANG,
|
||||
9 => self::KLANG,
|
||||
10 => self::KLANG,
|
||||
11 => self::KLANG,
|
||||
12 => self::KLANG,
|
||||
13 => self::SABAH,
|
||||
14 => self::KLANG,
|
||||
15 => self::KLANG,
|
||||
16 => self::KLANG,
|
||||
public const VT_SABAH = 'SB-V01';
|
||||
|
||||
public const VT_SARAWAK = 'SRW-V01';
|
||||
|
||||
public const VT_DESTINATION_WAREHOUSE = [
|
||||
1 => self::VT_KLANG,
|
||||
2 => self::VT_KLANG,
|
||||
3 => self::VT_KLANG,
|
||||
4 => self::VT_KLANG,
|
||||
5 => self::VT_SABAH,
|
||||
6 => self::VT_KLANG,
|
||||
7 => self::VT_KLANG,
|
||||
8 => self::VT_KLANG,
|
||||
9 => self::VT_KLANG,
|
||||
10 => self::VT_KLANG,
|
||||
11 => self::VT_KLANG,
|
||||
12 => self::VT_KLANG,
|
||||
13 => self::VT_SABAH,
|
||||
14 => self::VT_KLANG,
|
||||
15 => self::VT_KLANG,
|
||||
16 => self::VT_KLANG,
|
||||
];
|
||||
|
||||
public const YD_DESTINATION_WAREHOUSE = self::YD_KLANG;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Accounts;
|
||||
|
||||
use App\Classes\Modules\Accounts\ControllersLogic\CrossAuthenticateUserLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserCrossAuthenticationController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CrossAuthenticateUserLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function authenticate(Request $request, CrossAuthenticateUserLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\AssignCompanyConnectionToConnectionSegmentLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AssignCompanyConnectionToConnectionSegmentController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param AssignCompanyToSegmentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function assign(Request $request, AssignCompanyConnectionToConnectionSegmentLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\RemoveCompanyConnectionFromConnectionSegmentLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RemoveCompanyConnectionFromConnectionSegmentController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param RemoveCompanyConnectionFromConnectionSegmentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function detach(Request $request, RemoveCompanyConnectionFromConnectionSegmentLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Orders;
|
||||
|
||||
use App\Classes\Modules\Orders\ControllersLogic\CreateOrderRemarkLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateOrderRemarkController
|
||||
{
|
||||
public function create(Request $request, CreateOrderRemarkLogic $logic): JsonResponse{
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Orders;
|
||||
|
||||
use App\Classes\Modules\Orders\ControllersLogic\ShippingCostLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ShippingCostController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ShippingCostLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function calculate(Request $request, ShippingCostLogic $logic): JsonResponse
|
||||
{
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\PackingLists\Containers;
|
||||
|
||||
use App\Classes\Modules\PackingLists\ControllersLogic\Containers\CreateContainerRemarkLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateContainerRemarkController
|
||||
{
|
||||
|
||||
public function create(Request $request, CreateContainerRemarkLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\PackingLists;
|
||||
|
||||
use App\Classes\Modules\PackingLists\ControllersLogic\CreateDeliverPackingListLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateDeliverPackingListController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateDeliverPackingListLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateDeliverPackingListLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,18 +5,15 @@ namespace App\Http\Controllers\Reports;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Response\ApiResponseObject;
|
||||
use App\Models\CompanyConnection;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\Container;
|
||||
use App\Models\Order;
|
||||
use App\Models\Package;
|
||||
use App\Models\PackingList;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class MonthlyReportController
|
||||
{
|
||||
@@ -77,6 +74,50 @@ class MonthlyReportController
|
||||
]]))->handler();
|
||||
}
|
||||
|
||||
public function profitModelReport(Request $request): JsonResponse {
|
||||
$from = $request->route('from') ? Carbon::parse($request->route('from')) : Carbon::now()->startOfMonth();
|
||||
$to = $request->route('to') ? Carbon::parse($request->route('to')) : Carbon::now()->endOfMonth();
|
||||
$model = (int) $request->route('model');
|
||||
$value = (float) $request->route('value');
|
||||
|
||||
|
||||
$containers = Container::whereBetween('loading_date', [$from, $to])->orderBy('loading_date')->get();
|
||||
|
||||
$packages = $containers->flatMap(function ($container) {
|
||||
return $container->packages;
|
||||
});
|
||||
|
||||
$totalCbm = $packages->sum(function($package){
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
$projectedCbm = $packages->sum(function($package) use ($value, $model) {
|
||||
|
||||
if($model === 2){
|
||||
return (( (float) ($package->width + ($package->width * ($value/100))) / 100) * ( (float) ($package->length + ($package->length * ($value/100))) / 100) * ( (float) ($package->height + ($package->height * ($value/100))) / 100)) * $package->quantity;
|
||||
}
|
||||
|
||||
if($model === 3){
|
||||
return ((( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) + $value) * $package->quantity;
|
||||
}
|
||||
|
||||
if($model === 4){
|
||||
$packageCbm = (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100));
|
||||
return ( $packageCbm + ($packageCbm * ($value/100))) * $package->quantity;
|
||||
}
|
||||
|
||||
return (( (float) ($package->width + $value) / 100) * ( (float) ($package->length + $value) / 100) * ( (float) ($package->height + $value) / 100)) * $package->quantity;
|
||||
|
||||
});
|
||||
|
||||
return (new ApiResponseObject('fetch monthly report Successful',
|
||||
'',
|
||||
HttpStatus::OK_WITH_MESSAGE, ['data' => [
|
||||
'total_cbm' => $totalCbm,
|
||||
'projected_cbm' => $projectedCbm,
|
||||
]]))->handler();
|
||||
}
|
||||
|
||||
public function customerReport(Request $request): JsonResponse {
|
||||
|
||||
$connection = CompanyConnection::where('invitee_reference', $request->route('marking'))->firstOrFail();
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Segments;
|
||||
|
||||
use App\Classes\Modules\Segments\ControllersLogic\CreateSegmentLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateSegmentController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateSegmentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateSegmentLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Segments;
|
||||
|
||||
use App\Classes\Modules\Segments\ControllersLogic\DeleteSegmentLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteSegmentController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeleteSegmentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy(Request $request, DeleteSegmentLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -35,6 +35,8 @@ class CompanyModuleResource extends JsonResource
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'name' => $this->name,
|
||||
'reference' => $this->reference,
|
||||
'address' => new AddressResource($defaultAddress),
|
||||
'company' => new CompanyResource($this->whenLoaded('company')),
|
||||
'marking' => $marking
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class DeliverPackingListResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'claimant_id' => $this->claimant_id,
|
||||
'reference' => $this->reference,
|
||||
'status' => $this->status,
|
||||
'transport' => new TransportResource($this->transports()->first()),
|
||||
'packing_list' => PackingListResource::collection($this->packing_list_owner),
|
||||
'company' => New CompanyModuleResource($this->owner)
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -29,27 +29,24 @@ class OrderResource extends JsonResource
|
||||
'warehouse' => new CompanyModuleResource($this->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_WAREHOUSE)->first()->appointee),
|
||||
'address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->first()),
|
||||
'address_change_request' => new AddressResource($this->addressesPendingVerification()->first()),
|
||||
'parcels' => $this->whenLoaded('packingLists', function(){
|
||||
'parcels' => $this->whenLoaded('packingLists', function() {
|
||||
return [
|
||||
'origin_warehouse_packages' => PackageResource::collection($this->parcels()->shippingList()->whereDoesntHave('shippingSchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->get()),
|
||||
'in_transit_packages' => PackageResource::collection($this->parcels()->shippingList()->Shipping()->whereHas('shippingSchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->whereDoesntHave('container', function($container){
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
})->get()),
|
||||
'destination_warehouse_packages' => PackageResource::collection($this->parcels()->shippingList()->whereHas('container', function($container){
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
})->whereDoesntHave('deliverySchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->get()),
|
||||
'delivered_packages' => PackageResource::collection($this->parcels()->shippingList()->whereHas('deliverySchedules', function($schedule){
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
})->get()),
|
||||
'origin_warehouse_packages' => PackageResource::collection(
|
||||
$this->originWarehousePackages()->get()
|
||||
),
|
||||
'in_transit_packages' => PackageResource::collection(
|
||||
$this->inTransitPackages()->get()
|
||||
),
|
||||
'destination_warehouse_packages' => PackageResource::collection(
|
||||
$this->destinationWarehousePackages()->get()
|
||||
),
|
||||
'delivered_packages' => PackageResource::collection(
|
||||
$this->deliveredPackages()->get()
|
||||
),
|
||||
'received_packages' => PackageResource::collection($this->parcels()->warehouseReceiveList()->get()),
|
||||
];
|
||||
}),
|
||||
'remarks' => RemarkResource::collection($this->remarks),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
];
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@ class SegmentResource extends JsonResource
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'time_limit' => $this->when($this->whereHas('constants', function($query){
|
||||
$query->where('reference', SegmentConstants::PAYMENT_ATTEMPT_DURATION_LIMIT);
|
||||
}), $this->constants->where('reference', SegmentConstants::PAYMENT_ATTEMPT_DURATION_LIMIT)->first()),
|
||||
'services' => CustomServiceTypeResource::collection($this->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE))
|
||||
// 'time_limit' => $this->when($this->whereHas('constants', function($query){
|
||||
// $query->where('reference', SegmentConstants::PAYMENT_ATTEMPT_DURATION_LIMIT);
|
||||
// }), $this->constants->where('reference', SegmentConstants::PAYMENT_ATTEMPT_DURATION_LIMIT)->first()),
|
||||
// 'services' => CustomServiceTypeResource::collection($this->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE))
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,18 +4,11 @@ namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Documentable;
|
||||
use App\Classes\General\Interfaces\Contactable;
|
||||
use App\Classes\Modules\ServiceTypes\DataTransferObjects\ServiceConfigurationsObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Collection;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
|
||||
@@ -60,4 +60,13 @@ class CompanyConnection extends AbstractModel
|
||||
return $query->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return belongsToMany
|
||||
*/
|
||||
public function segments(): belongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Segment::class, (new ConnectionSegment())->getTable(), 'company_connection_id', 'segment_id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ use App\Classes\General\Interfaces\Addressable;
|
||||
use App\Classes\General\Interfaces\Contactable;
|
||||
use App\Classes\General\Interfaces\ContainerOwner;
|
||||
use App\Classes\General\Interfaces\Documentable;
|
||||
use App\Classes\General\Interfaces\Packable;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -28,7 +30,7 @@ use PhpParser\Node\Expr\AssignOp\Mod;
|
||||
* @property integer type
|
||||
* @property integer status
|
||||
*/
|
||||
class CompanyModule extends AbstractModel implements Addressable, Documentable, Contactable, ContainerOwner
|
||||
class CompanyModule extends AbstractModel implements Addressable, Documentable, Contactable, ContainerOwner, Packable
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
@@ -60,6 +62,14 @@ class CompanyModule extends AbstractModel implements Addressable, Documentable,
|
||||
return $this->morphMany(Address::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function packingLists(): morphMany
|
||||
{
|
||||
return $this->morphMany(PackingList::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return belongsToMany
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Segment
|
||||
* @package App\Models
|
||||
*
|
||||
* @property string name
|
||||
* @property string reference
|
||||
*/
|
||||
class ConnectionSegment extends AbstractModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'connection_segments';
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function segments(): HasMany
|
||||
{
|
||||
return $this->HasMany(Segment::class, 'segment_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function companyConnections(): HasMany
|
||||
{
|
||||
return $this->HasMany(CompanyConnection::class, 'company_connection_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Remarkable;
|
||||
use App\Classes\General\Interfaces\Transportable;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
@@ -9,7 +10,7 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
|
||||
class Container extends AbstractModel implements Transportable
|
||||
class Container extends AbstractModel implements Transportable, Remarkable
|
||||
{
|
||||
use HasRelationships;
|
||||
use SoftDeletes;
|
||||
@@ -56,4 +57,13 @@ class Container extends AbstractModel implements Transportable
|
||||
{
|
||||
return $this->morphMany(Transport::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function remarks(): morphMany
|
||||
{
|
||||
return $this->morphMany(Remark::class, 'owner');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+69
-1
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use App\Classes\General\Interfaces\Addressable;
|
||||
use App\Classes\General\Interfaces\Contactable;
|
||||
use App\Classes\General\Interfaces\Packable;
|
||||
use App\Classes\General\Interfaces\Remarkable;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Scopes\CustomerOrdersScope;
|
||||
@@ -14,7 +15,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
class Order extends AbstractModel implements Addressable, Packable
|
||||
class Order extends AbstractModel implements Addressable, Packable, Remarkable
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
@@ -88,4 +89,71 @@ class Order extends AbstractModel implements Addressable, Packable
|
||||
{
|
||||
return $this->addresses()->where('status','=',ApprovalStatus::APPROVED);
|
||||
}
|
||||
|
||||
public function originWarehousePackages()
|
||||
{
|
||||
return $this->parcels()->shippingList()
|
||||
->whereDoesntHave('shippingSchedules',
|
||||
function($schedule) {
|
||||
return $schedule->dispatched()
|
||||
->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function inTransitPackages()
|
||||
{
|
||||
return $this->parcels()->shippingList()->Shipping()
|
||||
->whereHas('shippingSchedules',
|
||||
function($schedule) {
|
||||
return $schedule->dispatched()
|
||||
->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
}
|
||||
)
|
||||
->whereDoesntHave('container', function($container) {
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function destinationWarehousePackages()
|
||||
{
|
||||
return $this->parcels()->shippingList()
|
||||
->whereHas('container',
|
||||
function($container) {
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
}
|
||||
)
|
||||
->whereDoesntHave('deliverySchedules',
|
||||
function($schedule) {
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function deliveredPackages()
|
||||
{
|
||||
return $this->parcels()->shippingList()
|
||||
->whereHas('deliverySchedules',
|
||||
function($schedule) {
|
||||
return $schedule->dispatched()->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return morphMany
|
||||
*/
|
||||
public function transactions(): morphMany
|
||||
{
|
||||
return $this->morphMany(Transaction::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function remarks(): morphMany
|
||||
{
|
||||
return $this->morphMany(Remark::class, 'owner');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,4 +56,11 @@ class PackingList extends AbstractModel implements Transportable, Steppable
|
||||
return $this->morphMany(Transport::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return belongsToMany
|
||||
*/
|
||||
public function packing_list_owner()
|
||||
{
|
||||
return $this->BelongsToMany(PackingList::class, 'packing_list_owner', 'owner_packing_list_id', 'packing_list_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class PackingListOwner extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -27,4 +27,12 @@ class Segment extends AbstractModel
|
||||
{
|
||||
return $this->HasMany(SegmentConstant::class, 'segment_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return belongsToMany
|
||||
*/
|
||||
public function companyConnections(): belongsToMany
|
||||
{
|
||||
return $this->belongsToMany(CompanyConnection::class, (new ConnectionSegment())->getTable(), 'segment_id', 'company_connection_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,17 @@ class Transaction extends AbstractModel implements Documentable
|
||||
{
|
||||
protected $table = 'transactions';
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function booking(): BelongsTo
|
||||
public function owner(): morphTo
|
||||
{
|
||||
return $this->BelongsTo( Booking::class, 'booking_id', 'id');
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function order(): morphMany
|
||||
{
|
||||
return $this->morphMany(Order::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class TransactionDetail extends AbstractModel
|
||||
{
|
||||
protected $table = 'transaction_detail';
|
||||
protected $table = 'transaction_details';
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class District
|
||||
* @package App\Models
|
||||
*
|
||||
* @property \App\Models\User user_id
|
||||
* @property string app_id
|
||||
* @property int platform
|
||||
*/
|
||||
class UserSocialAccount extends AbstractModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'user_social_accounts';
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ class CreateSegmentsTable extends Migration
|
||||
$table->id();
|
||||
$table->foreignId('company_module_id');
|
||||
$table->string('name', '45');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ class CreateSegmentConstantsTable extends Migration
|
||||
$table->foreignId('segment_id');
|
||||
$table->string('reference','45');
|
||||
$table->json('value');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ class CreateConnectionSegmentsTable extends Migration
|
||||
$table->id();
|
||||
$table->foreignId('company_connection_id');
|
||||
$table->foreignId('segment_id');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUserSocialAccountsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_social_accounts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id');
|
||||
$table->string('app_id')->nullable();
|
||||
$table->integer('platform')->default(0);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('user_social_accounts');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePackingListOwnersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('packing_list_owners', function (Blueprint $table) {
|
||||
$table->foreignId('owner_packing_list_id');
|
||||
$table->foreignId('packing_list_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('packing_list_owners');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
|
||||
class CreateTransactionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transactions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('owner');
|
||||
$table->string('type')->default(TransactionType::PAYMENT);
|
||||
$table->foreignId('issuer')->unsigned();
|
||||
$table->foreignId('receiver')->unsigned();
|
||||
$table->foreignId('recipient_bank_account_id')->unsigned();
|
||||
$table->string('payment_method')->nullable();
|
||||
$table->string('payment_reference')->nullable();
|
||||
$table->string('bill_no')->unique();
|
||||
$table->decimal('amount', 25, 5)->default(0.00);
|
||||
$table->decimal('original_amount', 25, 5)->default(0.00);
|
||||
$table->foreignId('currency_id')->unsigned();
|
||||
$table->foreignId('original_currency_id')->unsigned();
|
||||
$table->decimal('currency_rate', 14, 5)->default(0.00);
|
||||
$table->decimal('tax', 14, 5)->default(0.00);
|
||||
$table->decimal('service_charge', 14, 5)->default(0.00);
|
||||
$table->timestamp('expires_on')->nullable();
|
||||
$table->integer('status')->default(ApprovalStatus::PENDING_SUBMISSION);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('currency_id')->references('id')->on('currencies');
|
||||
$table->foreign('issuer')->references('id')->on('companies');
|
||||
$table->foreign('receiver')->references('id')->on('companies');
|
||||
$table->foreign('original_currency_id')->references('id')->on('currencies');
|
||||
|
||||
});
|
||||
|
||||
//In-case the model name lengthy
|
||||
Schema::table('transactions', function (Blueprint $table) {
|
||||
$table->string('owner_type', 250)->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('transactions');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTransactionDetailsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transaction_details', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('transaction_id')->unsigned();
|
||||
$table->string('reference');
|
||||
$table->string('name');
|
||||
$table->integer('quantity')->default(0);
|
||||
$table->decimal('price', 25, 5)->default(0.00);
|
||||
$table->decimal('amount', 25, 5)->default(0.00);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('transaction_id')->references('id')->on('transactions');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('transaction_details');
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class DatabaseSeeder extends Seeder
|
||||
$this->call(CountriesTableSeeder::class);
|
||||
$this->call(CurrenciesTableSeeder::class);
|
||||
|
||||
$this->call(CompaniesTableSeeder::class);
|
||||
$this->call(OrdersTableSeeder::class);
|
||||
// $this->call(CompaniesTableSeeder::class);
|
||||
// $this->call(OrdersTableSeeder::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
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\CompanyConnectionObject;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
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\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\OldCompany;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Company;
|
||||
|
||||
class ModernWarehouseTableSeeder 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;
|
||||
|
||||
/**
|
||||
* CompaniesTableSeeder 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
|
||||
*/
|
||||
public function __construct(CreateCompanyProcessor $createCompanyProcessor, UpdatesCompanyStatus $updatesCompanyStatus, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor, CreatesAddress $createsAddress, CreatesCompany $createsCompany, CreatesContact $createsContact)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
/** @var Company $company */
|
||||
$company = $this->createsCompany->execute(new CompanyObject('Modern', 'MODERN', CompanyType::COMPANY_BUSINESS, ApprovalStatus::APPROVED));
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$this->createCompanyModuleProcessor->execute($company, BusinessType::FREIGHT_FORWARDER);
|
||||
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
|
||||
|
||||
$companyModule->update(['name' => 'Guangzhou', 'reference' => 'GZ-V02']);
|
||||
$address = new AddressObject('白云区 白云湖街道 大朗北路 大朗生活区 523A', '(公交车总站对面)', 2, 35, 633, 510000);
|
||||
|
||||
$contact = new ContactObject('郑学钟', '18665696389', '', '');
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
$this->createsContact->execute($companyModule, $contact);
|
||||
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
|
||||
$companyModule->update(['name' => 'Klang', 'reference' => 'KL-V02']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -231,7 +231,7 @@ hr{
|
||||
font-weight: normal;
|
||||
}
|
||||
.semi-bold {
|
||||
font-weight: 400 !important;
|
||||
font-weight: 600 !important;
|
||||
}
|
||||
.bold {
|
||||
font-weight: bold !important;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<div class="row h-100 parentContainer">
|
||||
<div class="col">
|
||||
<loading-component class="fixed-top h-100 bg-white" style="height: 200px; top: 0;" key="1" color="success" v-show="loading"></loading-component>
|
||||
<div class="row justify-content-center b-a b-thick h-100 pointer requestModal hide" data-type="crossLoginModal" style="border-color: #ffffff3d">
|
||||
<div class="col">
|
||||
<div class="btn btn-block btn-lg btn-primary b-rad-none no-border">Login As Exchange</div>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component styleType="fill-in" type="crossLoginModal">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<iframe style="width: 500px; height: 600px" :src="exchange_url + 'cross-login'"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-default btn-block b-rad-none" data-dismiss="modal">Close</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import authenticationHandler from '../../../general/mixins/accounts/authenticationHandler';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
access_token: this.email,
|
||||
platform: 1
|
||||
},
|
||||
exchange_url: process.env.MIX_EXCHANGE_URL,
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
iframeEvent(event) {
|
||||
// if(event.origin !== this.exchange_url) return;
|
||||
|
||||
if (event.data.data) {
|
||||
this.parameters.access_token = event.data.data.payload.access_token;
|
||||
this.submit(this.route('api.account.authentication.authenticate.cross.attempt'), 'post', this.section, false, false);
|
||||
}
|
||||
}
|
||||
},
|
||||
mixins: [authenticationHandler],
|
||||
mounted() {
|
||||
window.addEventListener("message", this.iframeEvent, false);
|
||||
},
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -5,12 +5,16 @@
|
||||
<div class="col-auto p-r-0">
|
||||
<i class="fa fs-20 p-t-5" :class="{'fa-circle-o': value !== item.id, 'fa-check-circle': value === item.id, 'text-primary': value === item.id}"></i>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<h6 class="no-margin bold fs-12">{{item.reference}}</h6>
|
||||
</div>
|
||||
<div class="col text-left">
|
||||
<h6 class="no-margin fs-12">{{item.street_one}} {{item.street_two}}, {{item.district.name}}, {{item.post_code}} {{item.state.name}}, {{item.country.name}}</h6>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-12 col-sm-3 pb-1 pb-sm-0">
|
||||
<h6 class="no-margin bold fs-12 text-left">{{item.reference}}</h6>
|
||||
</div>
|
||||
<div class="col-12 col-sm-9 text-left">
|
||||
<h6 class="no-margin fs-12">{{item.street_one}} {{item.street_two}}, {{item.district.name}}, {{item.post_code}} {{item.state.name}}, {{item.country.name}}</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-auto p-r-5">
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12 col-md p-r-5 pb-3 pb-md-0 ">
|
||||
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||
<validation-wrapper-component selecatable :validator="$v.parameters.district_id">
|
||||
<label>District</label>
|
||||
<selectable-component :endpoint="route('api.address.district.list')" section="districtListSection" valueColumn="id" :labelColumn="['city']" v-model="parameters.district_id"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md p-l-5">
|
||||
<div class="col-12 col-md pl-md-1">
|
||||
<validation-wrapper-component :validator="$v.parameters.post_code">
|
||||
<label>Post Code</label>
|
||||
<input class="form-control" name="post_code" v-model="parameters.post_code">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="row m-b-15 m-l-5 m-r-5">
|
||||
<div class="col b-a b-grey rounded">
|
||||
<div class="row bg-white m-b-15 m-l-5 m-r-5">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col padding-15">
|
||||
<div class="row align-items-center">
|
||||
@@ -26,6 +26,10 @@
|
||||
<p class="no-margin fs-10 all-caps">ETA</p>
|
||||
<p class="no-margin">{{item.transport ? item.transport.current_schedule.eta : 'n/a'}}</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="no-margin fs-10 all-caps">Packages</p>
|
||||
<p class="no-margin">{{ item.packing_lists.reduce((total, obj) => total + obj.packages.reduce((total, obj) => obj.quantity + total, 0), 0) }}</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="no-margin fs-10 all-caps">Loaded CBM</p>
|
||||
<p class="no-margin">{{ (Math.ceil((item.packing_lists.reduce((total, obj) => total + obj.packages.reduce((total, obj) => obj.cbm + total, 0), 0)) * 1000) / 1000).toFixed(3) }}</p>
|
||||
@@ -46,7 +50,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-show="expanded">
|
||||
<div class="col bg-master-lightest">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row align-items-center p-t-10 p-b-10 b-t b-grey muted all-caps fs-10">
|
||||
|
||||
+234
-105
@@ -150,7 +150,7 @@
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="row" v-if="container">
|
||||
<div class="col">
|
||||
<div class="row align-items-center m-t-10">
|
||||
<div class="col bg-master-lightest rounded padding-20 m-l-10 m-r-10">
|
||||
@@ -420,122 +420,238 @@
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="editContainer">
|
||||
<edit-container-form-component :section="section" :data="container"></edit-container-form-component>
|
||||
</modal-component>
|
||||
|
||||
<div class="row m-t-10">
|
||||
<div class="col">
|
||||
<h5 class="fs-20 bold">Create Delivery Packing List</h5>
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-12 col-md-8" v-show="!$store.getters.isShowing('createDeliveryPackingListFormSection')">
|
||||
<div class="row">
|
||||
<div class="col b-a b-grey rounded m-l-10 m-r-20">
|
||||
<div class="row">
|
||||
<div class="col b-b b-grey bg-master-lightest">
|
||||
<div class="row">
|
||||
<div class="col padding-20">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-auto pointer align-items-center" @click="chooseAllPackingList()">
|
||||
<i class="fa fs-30 fa-fw" :class="{'fa-square-o': !selectAllPackingList, 'fa-check-square': selectAllPackingList, 'text-primary':selectAllPackingList}" ></i>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="no-margin semi-bold">Order No</h5>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="no-margin semi-bold">Customer Marking</h5>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="no-margin semi-bold">No. Packgaes</h5>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="no-margin semi-bold">CBM</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-for="packingList in container.packing_lists">
|
||||
<div class="col">
|
||||
<list-packagelist-form-component :data="packingList" v-on:input="updateList($event)"></list-packagelist-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col"></div>
|
||||
<div class="col-atuo">
|
||||
<div class="btn rounded btn-primary btn-lg p-t-10 p-b-10 m-t-10 m-r-20" @click="$store.dispatch('toggleSection', {name: 'createDeliveryPackingListFormSection', status: true})">Next <i class="fa fa-arrow-right m-l-10"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-8" v-show="$store.getters.isShowing('createDeliveryPackingListFormSection')">
|
||||
<create-delivery-packinglist-form-component :section="'containerListSection'" :data="selectedPackageList"></create-delivery-packinglist-form-component>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-12 col-md-4 mt-2 mt-md-0">
|
||||
<div class="row align-items-center">
|
||||
<div class="col b-a b-grey rounded padding-25">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h6 class="semi-bold muted">Summary</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<h6 class="semi-bold text-primary">{{selectedPackageList.length}} Packing List Selected</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-show="selectedPackageList.length != 0">
|
||||
<div class="col">
|
||||
<div class="row" v-for="selectedPackageList in selectedPackageList">
|
||||
<div class="col">
|
||||
<h6 class="no-margin">{{selectedPackageList.order.reference}}</h6>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h6 class="no-margin">noPackages</h6>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<h6 class="no-margin">Total Cbm</h6>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h6 class="normal m-t-5 m-b-5">Total Packages</h6>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<h6 class="normal m-t-5 m-b-5">RM 212.15</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h6 class="normal m-t-5 m-b-5">Total Address</h6>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<h6 class="normal m-t-5 m-b-5">RM 41.25</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h6 class="normal m-t-5 m-b-5">Total Cbm</h6>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<h6 class="normal m-t-5 m-b-5">RM 0.00</h6>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h6 class="normal">Total Payments</h6>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<h6 class="text-primary bold">RM 3300.00</h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-t-10">
|
||||
<div class="col">
|
||||
<div class="row h-100">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto padding-5 m-l-15 m-r-15" :class="[{'text-primary': tabShowing === 'Timeline'}, {'b-b': tabShowing === 'Timeline'}]" @click="tabShowing = 'Timeline'">
|
||||
<h5 class="large-text bold l-20" :class="[{'text-primary': tabShowing === 'Timeline'}]" >Activity Timeline</h5>
|
||||
</div>
|
||||
<div class="col-auto padding-5 m-l-15 m-r-15" :class="[{'text-primary': tabShowing === 'Comments'}, {'b-b': tabShowing === 'Comments'}]" @click="tabShowing = 'Comments'">
|
||||
<h5 class="large-text bold l-20" :class="[{'text-primary': tabShowing === 'Comments'}]">Comments</h5>
|
||||
<div class="row">
|
||||
<div class="col-auto padding-5 m-l-15 m-r-15" :class="[{'text-primary': tabShowing === 'Timeline'}, {'b-b': tabShowing === 'Timeline'}]" @click="tabShowing = 'Timeline'">
|
||||
<h5 class="large-text bold l-20" :class="[{'text-primary': tabShowing === 'Timeline'}]" >Activity Timeline</h5>
|
||||
</div>
|
||||
<div class="col-auto padding-5 m-l-15 m-r-15" :class="[{'text-primary': tabShowing === 'Comments'}, {'b-b': tabShowing === 'Comments'}]" @click="tabShowing = 'Comments'">
|
||||
<h5 class="large-text bold l-20" :class="[{'text-primary': tabShowing === 'Comments'}]">Comments</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-l-10 p-r-10">
|
||||
<div class="col rounded padding-15">
|
||||
<div class="row" v-if="tabShowing === 'Timeline'">
|
||||
<div class="col">
|
||||
<ul class="timeline_ul">
|
||||
<li class="bg-purple">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Item Returned</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">5 September 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Item has been returned due to mismatch</p>
|
||||
</li>
|
||||
<li class="bg-orange">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Client Report</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">21 August 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Client report order number #012AS12W</p>
|
||||
</li>
|
||||
<li class="bg-blue">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Item Cancelled</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">8 May 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Item has been cancelled by clients number #012ASJ21</p>
|
||||
</li>
|
||||
<li class="bg-blue">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Item Cancelled</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">8 May 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Item has been cancelled by clients number #012ASJ21</p>
|
||||
</li>
|
||||
<li class="bg-orange">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Client Report</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">21 August 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Client report order number #012AS12W</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-l-10 p-r-10">
|
||||
<div class="col rounded padding-15">
|
||||
<div class="row" v-if="tabShowing === 'Timeline'">
|
||||
<div class="row" v-if="tabShowing === 'Comments'">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<ul class="timeline_ul">
|
||||
<li class="bg-purple">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Item Returned</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">5 September 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Item has been returned due to mismatch</p>
|
||||
</li>
|
||||
<li class="bg-orange">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Client Report</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">21 August 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Client report order number #012AS12W</p>
|
||||
</li>
|
||||
<li class="bg-blue">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Item Cancelled</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">8 May 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Item has been cancelled by clients number #012ASJ21</p>
|
||||
</li>
|
||||
<li class="bg-blue">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Item Cancelled</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">8 May 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Item has been cancelled by clients number #012ASJ21</p>
|
||||
</li>
|
||||
<li class="bg-orange">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">Client Report</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<p class="muted no-margin">21 August 2021</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Client report order number #012AS12W</p>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="row justify-content-center align-items-center m-l-5 m-b-15">
|
||||
<div class="col-auto b-a btn-rounded padding-10 p-l-15 p-r-15">
|
||||
<i class="fa fa-user"></i>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin muted bold fs-20">Jacob Arlington</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Adipisicing occaecat pariatur id sunt ullamco quis laborum irure ea excepteur enim dolore est. Deserunt do consectetur ex in dolor labore ad reprehenderit velit laboris officia ut.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="tabShowing === 'Comments'">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="row justify-content-center align-items-center m-l-5 m-b-15">
|
||||
<div class="col-auto b-a btn-rounded padding-10 p-l-15 p-r-15">
|
||||
<i class="fa fa-user"></i>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row justify-content-center align-items-center m-l-5 m-b-15">
|
||||
<div class="col-auto b-a btn-rounded padding-10 p-l-15 p-r-15">
|
||||
<i class="fa fa-user"></i>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin muted bold fs-20">Jacob Arlington</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Adipisicing occaecat pariatur id sunt ullamco quis laborum irure ea excepteur enim dolore est. Deserunt do consectetur ex in dolor labore ad reprehenderit velit laboris officia ut.</p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="no-margin muted bold fs-20">Jacob Arlington</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-20">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row justify-content-center align-items-center m-l-5 m-b-15">
|
||||
<div class="col-auto b-a btn-rounded padding-10 p-l-15 p-r-15">
|
||||
<i class="fa fa-user"></i>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin muted bold fs-20">Jacob Arlington</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p>Adipisicing occaecat pariatur id sunt ullamco quis laborum irure ea excepteur enim dolore est. Deserunt do consectetur ex in dolor labore ad reprehenderit velit laboris officia ut.</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>Adipisicing occaecat pariatur id sunt ullamco quis laborum irure ea excepteur enim dolore est. Deserunt do consectetur ex in dolor labore ad reprehenderit velit laboris officia ut.</p>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="b-a w-100 padding-10 rounded b-grey" placeholder="Write your comments...">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="b-a w-100 padding-10 rounded b-grey" placeholder="Write your comments...">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -545,9 +661,9 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import RescheduleDateFormComponent from './RescheduleDateFormComponent.vue';
|
||||
import RescheduleDateFormComponent from './RescheduleDateFormComponent.vue';
|
||||
export default {
|
||||
components: { RescheduleDateFormComponent },
|
||||
components: { RescheduleDateFormComponent },
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
@@ -562,15 +678,17 @@ import RescheduleDateFormComponent from './RescheduleDateFormComponent.vue';
|
||||
expanded: false,
|
||||
CBMcapacity: 30,
|
||||
tabShowing: 'Timeline',
|
||||
selectAllPackingList: false,
|
||||
selectedPackageList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pendingQueue () {
|
||||
return this.$store.getters.isInCompleteQueue(this.section);
|
||||
},
|
||||
loadedCBM() {
|
||||
loadedCBM () {
|
||||
return (Math.ceil((this.container.packing_lists.reduce((total, obj) => total + obj.packages.reduce((total, obj) => obj.cbm + total, 0), 0)) * 1000) / 1000).toFixed(3)
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
pendingQueue(inComplete){
|
||||
@@ -592,6 +710,17 @@ import RescheduleDateFormComponent from './RescheduleDateFormComponent.vue';
|
||||
this.isLoading = false;
|
||||
this.container = response.payload.data;
|
||||
},
|
||||
updateList(packageList){
|
||||
this.selectedPackageList.includes(packageList) ? this.selectedPackageList.splice(this.selectedPackageList.indexOf(packageList), 1) : this.selectedPackageList.push(packageList);
|
||||
this.selectedPackageList.length === this.container.packing_lists.length ? this.selectAllPackingList = true : this.selectAllPackingList = false;
|
||||
},
|
||||
chooseAllPackingList() {
|
||||
this.selectAllPackingList = !this.selectAllPackingList;
|
||||
this.selectedPackageList = [];
|
||||
if (this.selectAllPackingList) {
|
||||
this.selectedPackageList = this.container.packing_lists;
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
+244
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div class="row justify-content-center" @keyup.enter="submitForm">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="row m-b-0 text-primary">
|
||||
<div class="col">
|
||||
<label class="text-primary fs-11 all-caps">Select the delivery type</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-center justify-content-center">
|
||||
<div class="col p-r-5">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': parameters.company_module_id === 'driver', 'b-grey': parameters.company_module_id !== 'driver'}" @click="parameters.company_module_id = 'driver'">
|
||||
<div class="row m-b-15 justify-content-center">
|
||||
<div class="col-8">
|
||||
<img src="/images/guangzhou-map.png" class="w-100">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h5 class="no-margin" :class="{ 'text-primary': parameters.company_module_id === 'driver', 'semi-bold': parameters.company_module_id === 'driver'}">Driver</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': parameters.company_module_id === 'courierService', 'b-grey': parameters.company_module_id !== 'courierService' }" @click="parameters.company_module_id = 'courierService'">
|
||||
<div class="row m-b-15 justify-content-center">
|
||||
<div class="col-8">
|
||||
<img src="/images/yiwu-map.png" class="w-100">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h5 class="no-margin" :class="{ 'text-primary': parameters.company_module_id === 'courierService', 'semi-bold': parameters.company_module_id === 'courierService'}">Courier Service</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" v-show="parameters.company_module_id === 'courierService'">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="btn btn-xs btn-primary no-border btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="courierService.status = !courierService.status">
|
||||
<div class="row">
|
||||
<div class="col p-t-10 p-b-10">
|
||||
{{courierService.name ? courierService.name : 'Please Select'}}
|
||||
</div>
|
||||
<div class="col-auto bg-primary-light">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa" :class="[{'fa-angle-down': !courierService.status}, {'fa-angle-up': courierService.status}]"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="relative w-100">
|
||||
<div class="absolute w-100 b-l b-b b-r b-primary" :class="[{'hide': !courierService.status}]" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" :class="[{'bg-primary-light': courierService.name === 'Pos Laju'}, {'text-white': courierService.name === 'Pos Laju'}, {'hover-primary': courierService.name !== 'Pos Laju'}]" @click="updateCourierService({name: 'Pos Laju', id: 'pos_laju'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">Pos Laju</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin" :class="[{'bg-primary-light': courierService.name === 'GD Express'}, {'text-white': courierService.name === 'GD Express'}, {'hover-primary': courierService.name !== 'GD Express'}]" @click="updateCourierService({name: 'GD Express', id: 'gd_express'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">GD Express</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin" :class="[{'bg-primary-light': courierService.name === 'City-Link'}, {'text-white': courierService.name === 'City-Link'}, {'hover-primary': courierService.name !== 'City-Link'}]" @click="updateCourierService({name: 'City-Link', id: 'city_link'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">City-Link Express</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.container_reference">
|
||||
<label class="text-primary">Tracking Number</label>
|
||||
<input type="text" class="form-control fs-12" v-model.trim="parameters.container_reference">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" v-show="parameters.company_module_id === 'driver'">
|
||||
<div class="col m-b-10">
|
||||
<div class="btn btn-xs btn-primary no-border btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="driver.status = !driver.status">
|
||||
<div class="row">
|
||||
<div class="col p-t-10 p-b-10">
|
||||
{{driver.name ? driver.name : 'Please Select'}}
|
||||
</div>
|
||||
<div class="col-auto bg-primary-light">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa" :class="[{'fa-angle-down': !driver.status}, {'fa-angle-up': driver.status}]"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="relative w-100">
|
||||
<div class="absolute w-100 b-l b-b b-r b-primary" :class="[{'hide': !driver.status}]" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" :class="[{'bg-primary-light': driver.name === 'Driver1'}, {'text-white': driver.name === 'Driver1'}, {'hover-primary': driver.name !== 'Driver1'}]" @click="updateDriver({name: 'Driver1', id: 'driver1'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">Driver 1</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin" :class="[{'bg-primary-light': driver.name === 'Driver2'}, {'text-white': driver.name === 'Driver2'}, {'hover-primary': driver.name !== 'Driver2'}]" @click="updateDriver({name: 'Driver2', id: 'driver2'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">Driver 2</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin" :class="[{'bg-primary-light': driver.name === 'Driver 3'}, {'text-white': driver.name === 'Driver 3'}, {'hover-primary': driver.name !== 'Driver 3'}]" @click="updateDriver({name: 'Driver 3', id: 'driver3'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">Driver 3</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>{{item.length}}</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 pr-md-1">
|
||||
<validation-wrapper-component class="m-b-10" :validator="$v.parameters.etd">
|
||||
<label class="text-primary">ETD</label>
|
||||
<date-picker-component :parameters="parameters" :value="'etd'"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 pl-md-1">
|
||||
<validation-wrapper-component class="m-b-10" :validator="$v.parameters.eta">
|
||||
<label class="text-primary">ETA</label>
|
||||
<date-picker-component :parameters="parameters" :value="'eta'"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-t-15 align-items-center justify-content-end">
|
||||
<div class="col-auto">
|
||||
<div class="btn btn-default b-rad-none btn-lg" @click="$store.dispatch('toggleSection', {name: 'createDeliveryPackingListFormSection', status: false})">Cancel</div>
|
||||
<div class="btn rounded btn-primary btn-lg" @click="submitForm">Submit</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
company_module_id: this.company_module_id,
|
||||
packing_list_id: [160, 161],
|
||||
etd: this.etd,
|
||||
eta: this.eta,
|
||||
},
|
||||
courierService: {
|
||||
name: '',
|
||||
id: '',
|
||||
status: false
|
||||
},
|
||||
driver: {
|
||||
name: '',
|
||||
id: '',
|
||||
status: false
|
||||
},
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
etd: { required },
|
||||
eta: { required },
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateCourierService(courierService){
|
||||
this.courierService = {
|
||||
name: courierService.name,
|
||||
id: courierService.id,
|
||||
status: false,
|
||||
}
|
||||
},
|
||||
updateDriver(driver){
|
||||
this.driver = {
|
||||
name: driver.name,
|
||||
id: driver.id,
|
||||
status: false,
|
||||
}
|
||||
},
|
||||
submitForm(){
|
||||
this.submit(this.route('api.packing_list.create.deliver'), 'post', this.section, true, true)
|
||||
},
|
||||
},
|
||||
mixins: [componentHandler, modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col b-b b-grey" :class="{'b-gray': !selected, 'b-primary': selected, 'bg-primary-lighter': selected}">
|
||||
<div class="row">
|
||||
<div class="col padding-20">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-auto pointer align-items-center" @click="activate()">
|
||||
<i class="fa fs-30 fa-fw" :class="{'fa-square-o': !selected, 'fa-check-square': selected, 'text-primary':selected}" ></i>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="no-margin"><a :href="route('order.show', item.order.reference)">{{item.order.reference}}</a></h5>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="no-margin"><a :href="route('customer.profile', item.order.company_module.marking)">{{item.order.company_module.marking}}</a></h5>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="no-margin">{{noPackage}}</h5>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="no-margin">{{loadedCBM}}</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
selected: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
activate(){
|
||||
this.selected = !this.selected;
|
||||
this.$emit('input', this.item);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
loadedCBM() {
|
||||
return (Math.ceil( this.item.packages.reduce((total, obj) => obj.cbm + total, 0) * 1000) / 1000).toFixed(3);
|
||||
},
|
||||
noPackage() {
|
||||
return ( this.item.packages.reduce((total, obj) => 1 + total, 0));
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
}
|
||||
</script>
|
||||
+1
-1
@@ -81,7 +81,7 @@
|
||||
</div>
|
||||
|
||||
<div class="row m-t-15 align-items-center justify-content-center">
|
||||
<div class="col auto">
|
||||
<div class="col">
|
||||
<div class="btn btn-block btn-lg btn-default b-rad-none" @click="$store.dispatch('toggleSection', {name: 'createContainerFormSection', status: false})">Cancel</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user