Compare commits

..

70 Commits

Author SHA1 Message Date
edmondlang b0454329df qrcode download ui 2021-11-25 12:59:36 +08:00
omair saleh f1cde19261 hide login as exchange 2021-11-20 10:47:03 +08:00
omair saleh b7e5475014 hide login as exchange 2021-11-20 10:42:18 +08:00
omair saleh a75c05fdae update container shortage announcement 2021-11-09 23:58:17 +08:00
omair saleh 3327b8a4f5 update container shortage announcement 2021-11-09 23:54:39 +08:00
omair saleh 604413d978 update container shortage announcement 2021-11-09 23:54:14 +08:00
omair saleh a25feacf53 categorise containers 2021-11-03 20:42:35 +08:00
omair saleh 1090de9060 categorise containers 2021-11-02 23:08:41 +08:00
omair saleh 1c721f7f10 categorise containers 2021-11-02 23:05:42 +08:00
omair saleh 4813c54e6d categorise containers 2021-11-02 23:03:45 +08:00
omair saleh b79ecdc6a9 categorise containers 2021-11-02 22:41:39 +08:00
omair saleh 7fa70becde categorise containers 2021-11-02 22:39:24 +08:00
omair saleh 57a0ea535a categorise containers 2021-11-02 22:38:41 +08:00
omair saleh f84415ce89 categorise containers 2021-11-02 22:37:32 +08:00
omair saleh 0b79ff5521 categorise containers 2021-11-02 22:29:46 +08:00
omair saleh d0f209b006 categorise containers 2021-11-02 22:28:23 +08:00
omair saleh 8cec7b436f categorise containers 2021-11-02 22:25:59 +08:00
omair saleh d2468769df categorise containers 2021-11-02 22:24:39 +08:00
omair saleh 884f4b33d1 categorise containers 2021-11-02 22:20:47 +08:00
omair saleh c15f67e304 order container by loading date 2021-11-02 21:40:35 +08:00
omair saleh f5ea06e3fe show packages quantity loaded into container 2021-11-02 21:32:20 +08:00
omair saleh 9977d516e1 fix order by arrival date 2021-10-30 12:49:22 +08:00
omair saleh c9131b3c3d order warehouse parcels by arrival date 2021-10-30 12:37:52 +08:00
omair saleh 2675fd8704 Merge branch 'create-new-filter-to-order-by-arrival-dates'
# Conflicts:
#	routes/api.php
2021-10-30 12:30:58 +08:00
omair saleh 02c6825c4a Merge branch 'create-new-filter-to-order-by-arrival-dates'
# Conflicts:
#	routes/api.php
2021-10-30 12:24:44 +08:00
omair saleh 908e0a49f9 Merge branch 'create-new-filter-to-order-by-arrival-dates'
# Conflicts:
#	routes/api.php
2021-10-30 12:23:58 +08:00
omair saleh cf03a032e5 create container remark 2021-10-27 21:20:01 +08:00
omair saleh 2cb8f9f407 show change ratio for profit model calculator 2021-10-26 10:51:06 +08:00
omair saleh ef1759379e disable customer order scope to temp fix pdf download issue 2021-10-25 14:54:46 +08:00
omair saleh ad9b983325 optimise order queries 2021-10-25 14:29:24 +08:00
omair saleh fc36a193e9 optimise order queries 2021-10-25 14:28:55 +08:00
omair saleh 86d26edb72 Merge branch 'improve-responsive-ui' into 'master'
improve responsive ui

See merge request CIEFWorldwideSdnBhd/shipping-portal!78
2021-10-25 05:56:44 +00:00
omair saleh 052218b621 Merge branch 'delivery-packing-list-ui' into 'master'
Delivery packing list ui

See merge request CIEFWorldwideSdnBhd/shipping-portal!76
2021-10-25 05:54:58 +00:00
omair saleh da52ddd3ac Merge branch 'cross-login' into 'master'
Cross login

See merge request CIEFWorldwideSdnBhd/shipping-portal!75
2021-10-25 05:54:01 +00:00
omair saleh 6cfed45ffe Merge branch 'create-deliver-packing-list-api' into 'master'
create deliver packing list api

See merge request CIEFWorldwideSdnBhd/shipping-portal!74
2021-10-25 05:53:33 +00:00
omair saleh a048a79ca8 Merge branch 'cbm_calc' into 'master'
Shipping Cost Calculations

See merge request CIEFWorldwideSdnBhd/shipping-portal!70
2021-10-25 05:49:04 +00:00
omair saleh e7afc0bc10 profit model calculator 2021-10-22 14:28:30 +08:00
omair saleh 999c29411f profit model calculator 2021-10-22 14:27:02 +08:00
omair saleh c5183ac0a7 create container remark 2021-10-21 21:25:13 +08:00
omair saleh 896a101fad fix createRemark service class 2021-10-21 21:21:26 +08:00
ahmedsophyudden 3f73848c18 Create new filter to order by arrival dates 2021-10-18 11:22:56 +08:00
Fairuz 63aae14b28 Shipping Cost Calculations 2021-10-18 10:04:33 +08:00
glovetleong aae9f160e6 simplify order resource 2021-10-17 17:55:16 +08:00
ahmedsophyudden ba61f7f3ab add & delete segment api 2021-10-15 19:18:09 +08:00
edmondlang 04117754db Merge branch 'master' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into improve-responsive-ui 2021-10-13 20:33:18 +08:00
edmondlang 821a39e5ff improve responsive ui 2021-10-13 20:23:59 +08:00
glovetleong 05cb3dd35e cross login 2021-10-13 14:10:32 +08:00
ahmedsophyudden 5b5bf1bb06 add & delete segment api 2021-10-12 11:29:09 +08:00
glovetleong 3d7090758d Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into cross-login 2021-10-12 08:53:57 +08:00
ahmedsophyudden e546825520 New add & delete company connection to connection segment api 2021-10-11 22:28:11 +08:00
edmondlang f6af7c5f4f code review remove d-flex 2021-10-10 15:42:26 +08:00
edmondlang 6ea51d56c1 improve responsive ui
fix order status bar width problem
2021-10-10 15:38:48 +08:00
edmondlang f2422ea45c improve responsive ui 2021-10-09 20:59:23 +08:00
edmondlang d26c90136b improve responsive 2021-10-09 20:43:40 +08:00
edmondlang c10e78ad51 imporve respnsive ui 2021-10-09 17:32:44 +08:00
edmondlang e4c8c021ec implement api from create-delivery-packing-list-api 2021-10-07 20:02:56 +08:00
edmondlang 46891669f1 Merge branch 'create-deliver-packing-list-api' of gitlab.com:CIEFWorldwideSdnBhd/shipping-portal into delivery-packing-list-ui 2021-10-07 10:58:09 +08:00
glovetleong c281beb87a create deliver packing list api 2021-10-07 09:20:04 +08:00
edmondlang 0d53a61f18 update select all packing list funtion 2021-10-05 20:40:48 +08:00
edmondlang 6d0e7dd51d delivery-packing-list-ui 2021-10-05 17:00:00 +08:00
glovetleong 592e8c489b env 2021-09-29 14:24:37 +08:00
glovetleong ee77fd236a cross login 2021-09-29 14:23:50 +08:00
glovetleong ee87443ca4 pull 2021-09-28 22:23:51 +08:00
glovetleong 31105cfcef Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into cross-login 2021-09-28 22:09:05 +08:00
glovetleong 5d34201579 pull 2021-09-28 22:07:19 +08:00
glovetleong f385407804 debug 2021-09-28 12:07:05 +08:00
glovetleong 0554cc895f checkout 2021-09-05 12:55:11 +08:00
glovetleong afcb1277f1 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into cross-login
# Conflicts:
#	routes/web.php
2021-09-01 20:30:08 +08:00
glovetleong 2d49f4aabf cross login 2021-08-25 10:01:32 +08:00
glovetleong 2095c18871 cross login 2021-08-22 13:55:51 +08:00
110 changed files with 3528 additions and 359 deletions
+2
View File
@@ -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);
}
}
@@ -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,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));
}
}
@@ -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)];
}
}
@@ -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;
}
}
@@ -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 [];
}
}
@@ -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));
}
}
@@ -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);
}
}
@@ -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();
}
}
@@ -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);
}
}
}
@@ -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));
}
}
@@ -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;
}
}
@@ -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));
}
}
@@ -1,53 +0,0 @@
<?php
namespace App\Classes\Modules\PackingLists\ControllersLogic\Packages;
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\Services\CreatesRemark;
use App\Http\Resources\ContactResource;
use App\Http\Resources\OrderResource;
use App\Models\Package;
use App\Models\Remark;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CreatePackageRemarkLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification():array {
return [
'title' => 'Created Package',
'message' => 'You have successfully created a new Package'
];
}
/** @var CreatesRemark */
private $createsRemark;
/**
* CreateContainerRemarkLogic constructor.
* @param CreatesRemark $createsRemark
*/
public function __construct(CreatesRemark $createsRemark, FetchesOrder $fetchesOrder)
{
$this->createsRemark = $createsRemark;
$this->fetchesOrder = $fetchesOrder;
}
public function logic(Request $request) : JsonResponse
{
$order = $this->fetchesOrder->execute(['id' => $request->route('id')]);
$object = new RemarkObject($request->input('content'), auth()->user()->id);
$remark = $this->createsRemark->execute($order ,$object);
return $this->resourceResponse(new OrderResource($order));
}
}
@@ -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;
}
@@ -9,7 +9,7 @@ use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
use App\Classes\Modules\Orders\Processors\CreateOrderProcessor;
use App\Classes\Modules\Orders\Services\FetchesDataFromVTPortal;
use App\Classes\Modules\Orders\Services\FetchesOrder;
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\CreatePackageRemarkLogic;
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\CreatePackageLogic;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
@@ -60,7 +60,7 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
/** @var CreatePackingListProcessor */
private $createPackingListProcessor;
/** @var CreatePackageRemarkLogic */
/** @var CreatePackageLogic */
private $createPackage;
/** @var CreatePackageProcessor */
@@ -82,12 +82,12 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
* @param CreateOrderProcessor $createOrderProcessor
* @param FetchesPackingList $fetchesPakcingList
* @param CreatePackingListProcessor $createPackingListProcessor
* @param CreatePackageRemarkLogic $createPackage
* @param CreatePackageLogic $createPackage
* @param CreatePackageProcessor $createPackageProcessor
* @param CreatesTransport $createsTransport
* @param CreatesSchedule $createsSchedule
*/
public function __construct(FetchesDataFromVTPortal $fetchesDataFRomVTPortal, CleansOldAddress $cleansOldAddress, CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor, FetchesCompanyModule $fetchesCompanyModule, FetchesOrder $fetchesOrder, CreateOrderProcessor $createOrderProcessor, FetchesPackingList $fetchesPakcingList, CreatePackingListProcessor $createPackingListProcessor, CreatePackageRemarkLogic $createPackage, CreatePackageProcessor $createPackageProcessor, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule)
public function __construct(FetchesDataFromVTPortal $fetchesDataFRomVTPortal, CleansOldAddress $cleansOldAddress, CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor, FetchesCompanyModule $fetchesCompanyModule, FetchesOrder $fetchesOrder, CreateOrderProcessor $createOrderProcessor, FetchesPackingList $fetchesPakcingList, CreatePackingListProcessor $createPackingListProcessor, CreatePackageLogic $createPackage, CreatePackageProcessor $createPackageProcessor, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule)
{
$this->fetchesDataFRomVTPortal = $fetchesDataFRomVTPortal;
$this->cleansOldAddress = $cleansOldAddress;
@@ -51,7 +51,9 @@ 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
{
@@ -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();
}
}
}
@@ -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);
}
}
@@ -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;
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -30,7 +30,7 @@ class DownloadOrderQrPdfController
$pdf = LaravelMpdf::loadView('pdfs.qr', $data, [], [
'title' => 'CIEF_ORDER_NO_'.$order->reference,
'format' => 'A4-L',
'format' => 'A6-L',
'orientation' => 'L',
'margin_top' => '40px',
]);
@@ -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);
}
}
@@ -2,7 +2,7 @@
namespace App\Http\Controllers\PackingLists\Packages;
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\CreatePackageRemarkLogic;
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\CreatePackageLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -10,10 +10,10 @@ class CreatePackageController
{
/**
* @param Request $request
* @param CreatePackageRemarkLogic $logic
* @param CreatePackageLogic $logic
* @return JsonResponse
*/
public function create(Request $request, CreatePackageRemarkLogic $logic): JsonResponse {
public function create(Request $request, CreatePackageLogic $logic): JsonResponse {
return $logic->execute($request);
}
@@ -1,14 +0,0 @@
<?php
namespace App\Http\Controllers\PackingLists\Packages;
use App\Classes\Modules\PackingLists\ControllersLogic\Packages\CreatePackageRemarkLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class CreatePackageRemarkController
{
public function create(Request $request, CreatePackageRemarkLogic $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);
}
}
@@ -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)
];
}
}
+13 -17
View File
@@ -29,24 +29,20 @@ 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()),
];
}),
+4 -4
View File
@@ -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))
];
}
}
+9
View File
@@ -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');
}
}
+11 -1
View File
@@ -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
*/
+38
View File
@@ -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');
}
}
+11 -1
View File
@@ -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');
}
}
+59
View File
@@ -88,4 +88,63 @@ 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');
}
}
+1 -11
View File
@@ -2,7 +2,6 @@
namespace App\Models;
use App\Classes\General\Interfaces\Remarkable;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PackingListType;
use Carbon\Carbon;
@@ -13,9 +12,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
use Staudenmeir\EloquentHasManyDeep\HasOneDeep;
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
use Illuminate\Database\Eloquent\Relations\MorphMany;
class Package extends AbstractModel implements Remarkable
class Package extends AbstractModel
{
use HasRelationships;
use SoftDeletes;
@@ -95,14 +93,6 @@ class Package extends AbstractModel implements Remarkable
return $this->hasOneDeep(Transport::class, [PackingList::class], ['id', ['owner_type', 'owner_id']], ['packing_list_id', null]);
}
/**
* @return MorphMany
*/
public function remarks(): morphMany
{
return $this->morphMany(Remark::class, 'owner');
}
/**
* @param $query
* @return mixed
+7
View File
@@ -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');
}
}
+11
View File
@@ -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;
}
+8
View File
@@ -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');
}
}
+10 -5
View File
@@ -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');
}
/**
+1 -1
View File
@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
class TransactionDetail extends AbstractModel
{
protected $table = 'transaction_detail';
protected $table = 'transaction_details';
/**
* @return BelongsTo
+32
View File
@@ -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');
}
}
+2 -2
View File
@@ -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);
}
}
+1 -1
View File
@@ -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">
@@ -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>
@@ -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>
@@ -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">
@@ -39,7 +39,7 @@
<div class="col no-padding">
<div class="row">
<div class="col"></div>
<div class="col-7">
<div class="col-12 col-sm-7">
<h6 class="text-right fs-12 text-danger m-b-15 text-right">**You delivery address change request will be approved after being reviewed, once it's approved your order delivery address will be updated.</h6>
</div>
</div>
File diff suppressed because one or more lines are too long
@@ -99,7 +99,7 @@
</div>
</div>
<div class="row no-margin">
<div class="col bg-master-lightest padding-30">
<div class="col bg-master-lightest p-1 p-sm-4">
<div class="row tabsContainer tabContent" :class="{'hide': item ? item.status === 2 : true, 'active': item ? item.status !== 2 : false}" tab-name="pending">
<div class="col">
<div class="row parentContainer" v-if="item ? item.status !== 2 && item.last_order : false">
@@ -0,0 +1,177 @@
<template>
<div class="row" >
<div class="col">
<loading-component v-if="isLoading"></loading-component>
<div class="row" v-if="!isLoading">
<div class="col">
<div class="row m-b-15">
<div class="col">
<div class="row">
<div class="col p-r-0">
<div class="form-group no-margin form-group-default b-rad-none">
<label class="text-primary">Start Date</label>
<date-picker-component v-model="from"></date-picker-component>
</div>
</div>
<div class="col p-l-0">
<div class="form-group no-margin form-group-default b-rad-none">
<label class="text-primary">End Date</label>
<date-picker-component v-model="to"></date-picker-component>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="row">
<div class="col p-r-0">
<validation-wrapper-component selecatable :validator="$v.model">
<label>Model</label>
<select-component :options="[{id: 1, text: 'Fixed Measurement'}, {id: 3, text: 'Fixed CBM'}, {id: 2, text: 'Ratio Measurement'}, {id: 4, text: 'Ratio CBM'}]" v-model="model"></select-component>
</validation-wrapper-component>
</div>
<div class="col p-l-0">
<div class="row">
<div class="col p-r-0">
<validation-wrapper-component :validator="$v.value">
<label>Value</label>
<input v-model="value" class="form-control">
</validation-wrapper-component>
</div>
<div class="col-auto p-l-0">
<div class="h-100 bg-master-lightest p-l-15 p-r-15">
<i class="fa fa-percent lh-50" v-if="parseInt(model) === 2 || parseInt(model) === 4"></i>
<span class="lh-50" v-if="parseInt(model) === 1">CM</span>
<span class="lh-50" v-if="parseInt(model) === 3">CBM</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row m-t-10 m-b-20">
<div class="col">
<div class="btn btn-block btn-primary b-rad-none" @click="fetchReport()">
Calculate
</div>
</div>
</div>
<div class="row" v-if="report">
<div class="col">
<div class="row">
<div class="col">
<div class="card no-border bg-master-lightest widget-loader-bar m-b-10">
<div class="container-xs-height full-height">
<div class="row-xs-height">
<div class="col-xs-height col-top">
<div class="card-header top-left top-right">
<div class="card-title">
<span class="font-montserrat fs-11 all-caps">Actual CBM</span>
</div>
</div>
</div>
</div>
<div class="row-xs-height">
<div class="col-xs-height col-top">
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
<h3 class="no-margin p-b-5">{{(Math.ceil(report.total_cbm * 1000) / 1000).toFixed(3)}}</h3>
<span class="small hint-text pull-left">{{((report.total_cbm / 800) * 100).toFixed(2)}}%</span>
<span class="pull-right small text-primary">Goal: 800 CBM </span>
</div>
</div>
</div>
<div class="row-xs-height">
<div class="col-xs-height col-bottom">
<div class="progress progress-small m-b-0">
<div class="progress-bar progress-bar-primary" :style="{'width': ((report.total_cbm / 800) * 100).toFixed(2)+'%'}"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="widget-9 card no-border no-margin widget-loader-bar" :class="[{'bg-success-light': ((report.projected_cbm - report.total_cbm) / report.total_cbm) >= 0}, {'bg-danger-light': ((report.projected_cbm - report.total_cbm) / report.total_cbm) < 0}]">
<div class="full-height d-flex flex-column">
<div class="card-header ">
<div class="card-title text-black">
<span class="font-montserrat fs-11 all-caps">Projected CBM</span>
</div>
</div>
<div class="p-l-20">
<h3 class="no-margin p-b-5 text-white">{{(Math.ceil(report.projected_cbm * 1000) / 1000).toFixed(3)}}</h3>
<span class="small hint-text pull-left">
<span class="label font-montserrat m-r-5"><i class="fa m-r-5" :class="[{'fa-angle-double-up': ((report.projected_cbm - report.total_cbm) / report.total_cbm) >= 0}, {'fa-angle-double-down': ((report.projected_cbm - report.total_cbm) / report.total_cbm) < 0}]"></i>{{(((report.projected_cbm - report.total_cbm) / report.total_cbm) * 100).toFixed(2)}}%</span>
</span>
</div>
<div class="mt-auto">
<div class="progress progress-small m-b-20">
<div class="progress-bar progress-bar-white" :style="{'width': ((report.projected_cbm / 800) * 100).toFixed(2)+'%'}"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import LoadingComponent from "../../general/elements/LoadingComponent";
export default {
components: {LoadingComponent},
data(){
return {
section: 'profitModelReportSection',
isLoading: true,
report: null,
from: '',
to: '',
model: 1,
value: 0
}
},
validations: {
from: {},
to: {},
model: {},
value: {}
},
computed: {
pendingQueue () {
return this.$store.getters.isInCompleteQueue(this.section);
}
},
watch: {
pendingQueue(inComplete){
if(inComplete){
this.fetchReport();
}
}
},
created(){
this.$store.dispatch('updateListQueue', {'name': this.section});
},
methods: {
fetchReport(){
this.isLoading = true;
this.submit(route('api.report.profit', this.model, this.value, this.from, this.to), 'get', this.section, false, false)
},
successHandler(response){
this.$store.dispatch('completeList', {'name': this.section, 'data': []});
this.isLoading = false;
this.report = response.payload.data;
}
}
}
</script>
@@ -26,6 +26,7 @@
<div class="row">
<div class="col">
<login-form-component section="loginSection"></login-form-component>
{{--<cross-platform-login-form-component section="crossPlatformLoginSection"></cross-platform-login-form-component>--}}
</div>
</div>
</div>
@@ -43,8 +43,8 @@
</div>
</div>
</div>
<div class="col"></div>
<div class="col-3">
<div class="col">
<profit-model-report-section-component></profit-model-report-section-component>
</div>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More