mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 12:34:18 +00:00
Compare commits
205 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 559de29acf | |||
| 87116d29c9 | |||
| d9eeaf4bef | |||
| 5dabc88fa9 | |||
| 8c29fcda1f | |||
| edd6b0d6ff | |||
| 6940290570 | |||
| 327bd75cc9 | |||
| 9f760d8694 | |||
| 4a1905abde | |||
| 5d1ff709eb | |||
| a50b475525 | |||
| 97ec65e292 | |||
| 5df226c153 | |||
| 3e87f320bf | |||
| 408a3a1211 | |||
| bed78c053a | |||
| c53ebf76b3 | |||
| 4085ac4829 | |||
| 778729b81d | |||
| 54c212e905 | |||
| 5b370a299c | |||
| e57dc231e6 | |||
| 5727801918 | |||
| bf325ff028 | |||
| 229e757663 | |||
| 10d62dd8d1 | |||
| 0fa0d8daab | |||
| bb59a444cf | |||
| 45c878a2ed | |||
| e871f4b287 | |||
| 6eaa810b67 | |||
| 68d961a681 | |||
| 2c29e5939e | |||
| 6910dce35f | |||
| a19db06b6b | |||
| 4e53e1b48a | |||
| aef9b82918 | |||
| f96fef94fe | |||
| ab141ae160 | |||
| bf4830ba7a | |||
| 5baf04c835 | |||
| 4917c54868 | |||
| 9c7d07f603 | |||
| 6f9320f3a4 | |||
| c69c043576 | |||
| 745655dbfa | |||
| b764ee0769 | |||
| ab1d92af86 | |||
| 2ff9a38114 | |||
| 0abdbd525e | |||
| f44aace3c5 | |||
| 0af84a9b7d | |||
| 1aff95b41c | |||
| 745f476f89 | |||
| e1d751b859 | |||
| 6077b1fbbb | |||
| 5fe8a7a59e | |||
| 8b38bcac8a | |||
| 5561442932 | |||
| f33efd373c | |||
| 53c325b36d | |||
| cd141bf988 | |||
| 908f3fc11b | |||
| 8e9f12b17e | |||
| 782bcc69f1 | |||
| 144464621e | |||
| b290f95426 | |||
| b7e6269aa9 | |||
| 7180f802b3 | |||
| 7159c1c11d | |||
| cce0cae57c | |||
| bebce6fbaa | |||
| 531ab699ba | |||
| 9f9c17977d | |||
| 24f5de8c2c | |||
| 3b8079785a | |||
| 627fb3aa96 | |||
| 2b4d3f1992 | |||
| 65daceb59c | |||
| d7457e7174 | |||
| 9753eb3a18 | |||
| e7df49a0d1 | |||
| cd4e7aab10 | |||
| 29350dbb86 | |||
| 7338ebc78a | |||
| 4eded7a742 | |||
| dc562f6554 | |||
| d96a35a49f | |||
| 8024fef2e8 | |||
| 2d965009ec | |||
| 7d84ddee95 | |||
| 92b31a9342 | |||
| 012dbfde09 | |||
| 0b651953ea | |||
| b34f50ae9d | |||
| 8f0d1e6fdf | |||
| e8990d96f7 | |||
| 69ee0eea2c | |||
| adcdf5909e | |||
| b9523fb567 | |||
| 79678d7b93 | |||
| 2bdfd2772a | |||
| 55513f5175 | |||
| 709534ce04 | |||
| 74d85eee60 | |||
| 63badc08f0 | |||
| 73010ed32b | |||
| 7a2a90545b | |||
| c0ee3a8e57 | |||
| 0c7e4d5785 | |||
| c3cd8ae3a0 | |||
| 0e7469f1cd | |||
| 32476afdd4 | |||
| 8b6db1fb68 | |||
| 43f3fbff07 | |||
| caf8624d4c | |||
| eb417cf389 | |||
| 276a87ff0d | |||
| 6d2f179025 | |||
| 8609c926f9 | |||
| 368a055bb4 | |||
| d617001412 | |||
| c932cb00cc | |||
| 1be62a5f77 | |||
| 445bcb3864 | |||
| d489775924 | |||
| fff428882d | |||
| 42205ddbc3 | |||
| 722e502b3b | |||
| 4f93569b4c | |||
| e1abebc66c | |||
| 2424882cfe | |||
| 23f50faa84 | |||
| edc510681e | |||
| db03836ef5 | |||
| 3a5f404294 | |||
| 9b79f16faa | |||
| 4ff4418f7f | |||
| 19c8f1e658 | |||
| e1c4d674b6 | |||
| 3326de9c4f | |||
| 54dd6d407d | |||
| 9ee81d9385 | |||
| aa1ba03415 | |||
| fb6b2173b5 | |||
| f18e4a882f | |||
| 8edc91bb61 | |||
| 6122c288df | |||
| 9650877819 | |||
| c65d875a3d | |||
| c1bc610549 | |||
| 82d406abfc | |||
| 701610978d | |||
| f7e1665a02 | |||
| d389b87609 | |||
| 987fdcfba2 | |||
| 6214a2b723 | |||
| fe00b1fab7 | |||
| 41df3e6ae7 | |||
| cf7d9ccca5 | |||
| 384d234b50 | |||
| 3fbfa44a04 | |||
| cbc294054e | |||
| 324556985a | |||
| 1b8c6ca317 | |||
| bbd09d300c | |||
| 47c97d6151 | |||
| 435e3a8f7a | |||
| 151032bb66 | |||
| f32335d57b | |||
| 2deddc4e03 | |||
| 32e665e4f7 | |||
| a987419040 | |||
| b0a65f870c | |||
| 33a75eca7d | |||
| deb68dc723 | |||
| 519408c2b5 | |||
| 53907e2463 | |||
| 10e6f6045e | |||
| c06cec5b41 | |||
| cfe611d05d | |||
| b9b79ca65a | |||
| 9a1562386f | |||
| 22700893a2 | |||
| 550c9480a4 | |||
| 48bab9998c | |||
| 3ff81d4f00 | |||
| cc7edfc784 | |||
| 72448d656c | |||
| c941f679b6 | |||
| 78f6c70cad | |||
| 1575d62e0f | |||
| 43f4bc533a | |||
| 9ae36dc400 | |||
| 02c55d97b7 | |||
| baeaa0f31a | |||
| dadc786f1f | |||
| bd9dab0029 | |||
| e2b795c872 | |||
| 9a79c6dd1d | |||
| d8e1c38429 | |||
| aa28afb9f0 | |||
| 7ec109eb3e | |||
| 7151616b04 |
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class TargetId implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('target_type', User::class)->where('target_id', $value);
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -4,7 +4,7 @@ namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class OwnerId implements Filter
|
||||
class TypeIn implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@ class OwnerId implements Filter
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('owner_id', $value);
|
||||
return $builder->whereIn('type', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,6 +15,7 @@ use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
|
||||
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Documents\Processors\UploadIdentityDocumentProcessor;
|
||||
@@ -76,6 +77,9 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
/** @var GenerateEmailVerificationAttemptProcessor */
|
||||
private $generateEmailVerificationAttemptProcessor;
|
||||
|
||||
/** @var FetchesCompanyModule */
|
||||
private $fetchesCompanyModule;
|
||||
|
||||
/**
|
||||
* CreateCustomerLogic constructor.
|
||||
* @param CreateUserProcessor $createUserProcessor
|
||||
@@ -88,8 +92,9 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
* @param UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor
|
||||
* @param AuthenticationProcessor $authenticationProcessor
|
||||
* @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor
|
||||
* @param FetchesCompanyModule $fetchesCompanyModule
|
||||
*/
|
||||
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor)
|
||||
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor, FetchesCompanyModule $fetchesCompanyModule)
|
||||
{
|
||||
$this->createUserProcessor = $createUserProcessor;
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
@@ -101,6 +106,7 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
$this->uploadIdentityDocumentProcessor = $uploadIdentityDocumentProcessor;
|
||||
$this->authenticationProcessor = $authenticationProcessor;
|
||||
$this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor;
|
||||
$this->fetchesCompanyModule = $fetchesCompanyModule;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,7 +132,9 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::IMPORTER);
|
||||
|
||||
$connectionObject = new CompanyConnectionObject($companyModule, 'CIEF', mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate());
|
||||
$inviter = $this->fetchesCompanyModule->execute(['reference'=>'CIEF']);
|
||||
|
||||
$connectionObject = new CompanyConnectionObject($companyModule, $inviter, mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate(), 'CIEF');
|
||||
|
||||
$connection = $this->createsCompanyConnection->execute($connectionObject);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Classes\Modules\Accounts\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Models\User;
|
||||
|
||||
@@ -11,6 +12,11 @@ class AuthenticationRedirect
|
||||
public function url(User $user){
|
||||
|
||||
if($user->type === RoleTypes::USER){
|
||||
|
||||
if (in_array($user->companyModule()->first()->type, [BusinessType::ONLINE_SELLER, BusinessType::LAST_MILE_DELIVERY_AGENT])) {
|
||||
return route('last_mile_delivery.dashboard');
|
||||
}
|
||||
|
||||
return route('dashboard');
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,9 @@ class GeneratesAuthenticationToken {
|
||||
$companyModule = $user->companyModule()->first();
|
||||
|
||||
$claims = array_merge($claims, [
|
||||
'company_id' => $companyModule->company_id
|
||||
'company_id' => $companyModule->company_id,
|
||||
'company_module_id' => $companyModule->id,
|
||||
'company_module_type' => $companyModule->type
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use ErrorException;
|
||||
@@ -82,7 +83,7 @@ class CreateAddressLogic extends AbstractControllerLogic
|
||||
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
|
||||
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), $request->input('reference'));
|
||||
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), $request->input('type'), ApprovalStatus::APPROVED, $request->input('reference'));
|
||||
|
||||
$this->canCreateAddress->passes($object);
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -79,7 +81,7 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
||||
{
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
|
||||
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), $request->input('reference'));
|
||||
$object = new AddressObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'), AddressType::DELIVERY, ApprovalStatus::APPROVED, $request->input('reference'));
|
||||
|
||||
$this->canUpdateAddress->passes($object);
|
||||
|
||||
|
||||
@@ -26,6 +26,12 @@ class AddressObject implements DataTransferObject
|
||||
/** @var int */
|
||||
private $postCode;
|
||||
|
||||
/** @var int */
|
||||
private $type;
|
||||
|
||||
/** @var int */
|
||||
private $status;
|
||||
|
||||
/** @var string|null */
|
||||
private $reference;
|
||||
|
||||
@@ -37,9 +43,11 @@ class AddressObject implements DataTransferObject
|
||||
* @param int $stateId
|
||||
* @param int $districtId
|
||||
* @param int $postCode
|
||||
* @param int $type
|
||||
* @param int $status
|
||||
* @param null|string $reference
|
||||
*/
|
||||
public function __construct(string $streetOne, ?string $streetTwo, int $countryId, int $stateId, int $districtId, int $postCode, ?string $reference = null, ?int $status = ApprovalStatus::APPROVED)
|
||||
public function __construct(string $streetOne, ?string $streetTwo, int $countryId, int $stateId, int $districtId, int $postCode, int $type, int $status, ?string $reference = null)
|
||||
{
|
||||
$this->streetOne = $streetOne;
|
||||
$this->streetTwo = $streetTwo;
|
||||
@@ -47,8 +55,9 @@ class AddressObject implements DataTransferObject
|
||||
$this->stateId = $stateId;
|
||||
$this->districtId = $districtId;
|
||||
$this->postCode = $postCode;
|
||||
$this->reference = $reference;
|
||||
$this->type = $type;
|
||||
$this->status = $status;
|
||||
$this->reference = $reference;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,11 +109,11 @@ class AddressObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
* @return int
|
||||
*/
|
||||
public function getReference(): ?string
|
||||
public function getType(): int
|
||||
{
|
||||
return $this->reference;
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,5 +124,13 @@ class AddressObject implements DataTransferObject
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getReference(): ?string
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,6 +10,8 @@ namespace App\Classes\Modules\Addresses\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\District;
|
||||
use App\Models\OldAddress;
|
||||
|
||||
@@ -31,7 +33,7 @@ class CleansOldAddress
|
||||
return null;
|
||||
}
|
||||
|
||||
return new AddressObject($this->cleanAddress($address->street_one, $district, $address->post_code), $this->cleanAddress($address->street_two, $district, $address->post_code), $district->country_id, $district->state_id, $district->id, $address->post_code, 'Delivery Address');
|
||||
return new AddressObject($this->cleanAddress($address->street_one, $district, $address->post_code), $this->cleanAddress($address->street_two, $district, $address->post_code), $district->country_id, $district->state_id, $district->id, $address->post_code, AddressType::DELIVERY, ApprovalStatus::APPROVED, 'Delivery Address');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ class CreatesAddress extends AbstractUpdateRelationshipRecord
|
||||
$model->district_id = $object->getDistrictId();
|
||||
$model->postcode = $object->getPostCode();
|
||||
$model->status = $object->getStatus();
|
||||
$model->type = $object->getType();
|
||||
|
||||
return $this->handler($addressable->addresses(), $model);
|
||||
|
||||
|
||||
@@ -26,8 +26,6 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CallbackBillplzLogic
|
||||
{
|
||||
|
||||
|
||||
/** @var GetBillplzBill */
|
||||
private $getBillplzBill;
|
||||
|
||||
@@ -47,12 +45,11 @@ class CallbackBillplzLogic
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param UpdatesWalletBalance $updatesWalletBalance
|
||||
*/
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdatesWalletBalance $updatesWalletBalance)
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus)
|
||||
{
|
||||
$this->getBillplzBill = $getBillplzBill;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updatesWalletBalance = $updatesWalletBalance;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,22 +81,11 @@ class CallbackBillplzLogic
|
||||
$status = $billplzXSignatureObject->getStatus() === 'failed' ? ApprovalStatus::REJECTED : ApprovalStatus::PENDING_VERIFICATION;
|
||||
}
|
||||
|
||||
if($transaction->status !== ApprovalStatus::COMPLETED){
|
||||
|
||||
if($transaction->owner instanceof Wallet && $transaction->status !== ApprovalStatus::APPROVED && $status === ApprovalStatus::APPROVED) {
|
||||
$this->updatesWalletBalance->execute($transaction->owner, $transaction->amount);
|
||||
}
|
||||
$this->updatesTransactionStatus->execute($transaction, $status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
|
||||
$marking = $transaction->owner instanceof Booking ? $transaction->booking->marking : $transaction->owner->owner->bookings()->orderBy('id', 'DESC')->first()->marking;
|
||||
|
||||
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $marking, 'transaction' => $transaction, 'status' => $status]);
|
||||
$marking = $transaction->owner()->first()->owner()->first();
|
||||
|
||||
return $request->method() === 'POST' ? true : view('pages.payments_redirect', ['marking' => $marking->reference, 'transaction' => $transaction, 'status' => $status]);
|
||||
}
|
||||
}
|
||||
+1
-18
@@ -14,8 +14,6 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Documents\Services\FetchesDocument;
|
||||
|
||||
use App\Classes\Modules\Documents\Services\ApprovesDocument;
|
||||
use App\Classes\Modules\Notifications\DataTransferObjects\NotificationObject;
|
||||
Use App\Classes\Modules\Notifications\Processors\CreateNotificationProcessor;
|
||||
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -52,9 +50,6 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
|
||||
/** @var UpdatesOrdersStatus */
|
||||
private $updatesOrdersStatus;
|
||||
|
||||
/** @var CreateNotificationProcessor */
|
||||
private $createNotificationProcessor;
|
||||
|
||||
/**
|
||||
* ApproveIdentificationDocumentLogic constructor.
|
||||
* @param CanApproveDocument $canApproveDocument
|
||||
@@ -63,9 +58,8 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
|
||||
* @param FetchesDocument $fetchesDocument
|
||||
* @param UpdatesCompanyStatus $updatesCompanyStatus
|
||||
* @param UpdatesOrdersStatus $updatesOrdersStatus
|
||||
* @param CreateNotificationProcessor $createNotificationProcessor
|
||||
*/
|
||||
public function __construct(CanApproveDocument $canApproveDocument, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, UpdatesCompanyStatus $updatesCompanyStatus, UpdatesOrdersStatus $updatesOrdersStatus, CreateNotificationProcessor $createNotificationProcessor)
|
||||
public function __construct(CanApproveDocument $canApproveDocument, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, UpdatesCompanyStatus $updatesCompanyStatus, UpdatesOrdersStatus $updatesOrdersStatus)
|
||||
{
|
||||
$this->canApproveDocument = $canApproveDocument;
|
||||
$this->approvesDocument = $approvesDocument;
|
||||
@@ -73,7 +67,6 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
|
||||
$this->fetchesDocument = $fetchesDocument;
|
||||
$this->updatesCompanyStatus = $updatesCompanyStatus;
|
||||
$this->updatesOrdersStatus = $updatesOrdersStatus;
|
||||
$this->createNotificationProcessor = $createNotificationProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,16 +90,6 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
|
||||
|
||||
$this->updatesCompanyStatus->execute($document->owner, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
|
||||
|
||||
$object = new NotificationObject(
|
||||
'ID Verification ' . ( $status === 'approve' ? 'Approved' : 'Rejected' ),
|
||||
( $status === 'approve' ? 'Dear user, congratulations that your ' : 'Dear user, we are sorry to inform you that your ' ) . ( $document->type === 'IDENTITY_CARD' ? 'IC' : 'SSM' ) . ( $status === 'approve' ? ' has been approved. Start your first order now!' : ' has been rejected due to ' . ( $request->input('rejectRemark') ?? '' ) . ', please resubmit it for further action.' ),
|
||||
$document->owner,
|
||||
$document->owner->companyModules()->first()->employees()->first(),
|
||||
$document,
|
||||
);
|
||||
|
||||
$this->createNotificationProcessor->execute($object);
|
||||
|
||||
if($status === 'approve'){
|
||||
$orders = $this->updatesOrdersStatus->execute($document->owner, ApprovalStatus::APPROVED);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ class CompanyConnectionObject implements DataTransferObject
|
||||
|
||||
/** @var CompanyModule */
|
||||
private $invitee;
|
||||
|
||||
/** @var CompanyModule */
|
||||
private $inviter;
|
||||
|
||||
/** @var string */
|
||||
private $inviterReference;
|
||||
@@ -20,12 +23,14 @@ class CompanyConnectionObject implements DataTransferObject
|
||||
/**
|
||||
* CompanyConnectionObject constructor.
|
||||
* @param CompanyModule $invitee
|
||||
* @param CompanyModule $inviter
|
||||
* @param string $inviterReference
|
||||
* @param string $inviteeReference
|
||||
*/
|
||||
public function __construct(CompanyModule $invitee, string $inviterReference, string $inviteeReference)
|
||||
public function __construct(CompanyModule $invitee, CompanyModule $inviter, string $inviteeReference, string $inviterReference)
|
||||
{
|
||||
$this->invitee = $invitee;
|
||||
$this->inviter = $inviter;
|
||||
$this->inviterReference = $inviterReference;
|
||||
$this->inviteeReference = $inviteeReference;
|
||||
}
|
||||
@@ -38,6 +43,14 @@ class CompanyConnectionObject implements DataTransferObject
|
||||
return $this->invitee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CompanyModule
|
||||
*/
|
||||
public function getInviter(): CompanyModule
|
||||
{
|
||||
return $this->inviter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -30,10 +30,8 @@ class CreatesCompanyConnection extends AbstractUpdateRecord
|
||||
public function execute(CompanyConnectionObject $object)
|
||||
{
|
||||
|
||||
$companyModule = $this->fetchesCompany->execute(['id', 1])->companyModules()->first();
|
||||
|
||||
$connection = new CompanyConnection();
|
||||
$connection->inviter_id = $companyModule->id;
|
||||
$connection->inviter_id = $object->getInviter()->id;
|
||||
$connection->invitee_id = $object->getInvitee()->id;
|
||||
$connection->inviter_reference = $object->getInviterReference();
|
||||
$connection->invitee_reference = $object->getInviteeReference();
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Delivery\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\CancelsOrder;
|
||||
use App\Classes\Modules\Orders\Services\FetchesOrder;
|
||||
use App\Http\Resources\DeliveryOrderResource;
|
||||
use App\Models\Order;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CancelDeliveryOrderLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Cancelled Order',
|
||||
'message' => 'You have successfully cancelled an order'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CancelsOrder */
|
||||
private $cancelsOrder;
|
||||
|
||||
/** @var FetchesOrder */
|
||||
private $fetchesOrder;
|
||||
|
||||
/**
|
||||
* CancelDeliveryOrderLogic constructor.
|
||||
* @param CancelsOrder $cancelsOrder
|
||||
* @param FetchesOrder $fetchesOrder
|
||||
*/
|
||||
public function __construct(CancelsOrder $cancelsOrder, FetchesOrder $fetchesOrder)
|
||||
{
|
||||
$this->cancelsOrder = $cancelsOrder;
|
||||
$this->fetchesOrder = $fetchesOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
/** @var Order $order */
|
||||
$order = $this->fetchesOrder->execute(['id' => $request->route('id')]);
|
||||
|
||||
return $this->resourceResponse(new DeliveryOrderResource($this->cancelsOrder->execute($order)));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Delivery\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\General\Services\GeneratesInitials;
|
||||
use App\Classes\Modules\Accounts\Processors\AuthenticationProcessor;
|
||||
use App\Classes\Modules\Accounts\Processors\CreateUserProcessor;
|
||||
use App\Classes\Modules\Accounts\Processors\GenerateEmailVerificationAttemptProcessor;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
|
||||
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
|
||||
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Documents\Processors\UploadIdentityDocumentProcessor;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\User;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompanyModule;
|
||||
|
||||
class CreateDeliveryCustomerLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created User',
|
||||
'message' => 'You have successfully created a new User'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CreateUserProcessor */
|
||||
private $createUserProcessor;
|
||||
|
||||
/** @var CreateCompanyProcessor */
|
||||
private $createCompanyProcessor;
|
||||
|
||||
/** @var CreateCompanyModuleProcessor */
|
||||
private $createCompanyModuleProcessor;
|
||||
|
||||
/** @var CreateContactProcessor */
|
||||
private $createContactProcessor;
|
||||
|
||||
/** @var CreatesCompanyConnection */
|
||||
private $createsCompanyConnection;
|
||||
|
||||
/** @var ApprovesCompanyConnection */
|
||||
private $approvesCompanyConnection;
|
||||
|
||||
/** @var AssignEmployeeProcessor */
|
||||
private $assignEmployeeProcessor;
|
||||
|
||||
/** @var UploadIdentityDocumentProcessor */
|
||||
private $uploadIdentityDocumentProcessor;
|
||||
|
||||
/** @var AuthenticationProcessor */
|
||||
private $authenticationProcessor;
|
||||
|
||||
/** @var GenerateEmailVerificationAttemptProcessor */
|
||||
private $generateEmailVerificationAttemptProcessor;
|
||||
|
||||
/** @var FetchesCompanyModule */
|
||||
private $fetchesCompanyModule;
|
||||
|
||||
/**
|
||||
* CreateDeliveryCustomerLogic constructor.
|
||||
* @param CreateUserProcessor $createUserProcessor
|
||||
* @param CreateCompanyProcessor $createCompanyProcessor
|
||||
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
|
||||
* @param CreateContactProcessor $createContactProcessor
|
||||
* @param CreatesCompanyConnection $createsCompanyConnection
|
||||
* @param ApprovesCompanyConnection $approvesCompanyConnection
|
||||
* @param AssignEmployeeProcessor $assignEmployeeProcessor
|
||||
* @param UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor
|
||||
* @param AuthenticationProcessor $authenticationProcessor
|
||||
* @param GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor
|
||||
* @param FetchesCompanyModule $fetchesCompanyModule
|
||||
*/
|
||||
public function __construct(CreateUserProcessor $createUserProcessor, CreateCompanyProcessor $createCompanyProcessor, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, AssignEmployeeProcessor $assignEmployeeProcessor, UploadIdentityDocumentProcessor $uploadIdentityDocumentProcessor, AuthenticationProcessor $authenticationProcessor, GenerateEmailVerificationAttemptProcessor $generateEmailVerificationAttemptProcessor, FetchesCompanyModule $fetchesCompanyModule)
|
||||
{
|
||||
$this->createUserProcessor = $createUserProcessor;
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
|
||||
$this->createContactProcessor = $createContactProcessor;
|
||||
$this->createsCompanyConnection = $createsCompanyConnection;
|
||||
$this->approvesCompanyConnection = $approvesCompanyConnection;
|
||||
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
|
||||
$this->uploadIdentityDocumentProcessor = $uploadIdentityDocumentProcessor;
|
||||
$this->authenticationProcessor = $authenticationProcessor;
|
||||
$this->generateEmailVerificationAttemptProcessor = $generateEmailVerificationAttemptProcessor;
|
||||
$this->fetchesCompanyModule = $fetchesCompanyModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\AccessUnauthorisedException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->createUserProcessor->execute($request, RoleTypes::USER, !App::environment(['production']) ? ApprovalStatus::APPROVED : ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
/** @var Company $company */
|
||||
$company = $this->createCompanyProcessor->execute($request->input('name'), CompanyType::PERSONAL_BUSINESS, ApprovalStatus::PENDING_SUBMISSION);
|
||||
|
||||
$contactObject = new ContactObject($request->input('name'), $request->input('phone'), $request->input('contact_email'), $request->input('wechat_id'));
|
||||
|
||||
$this->createContactProcessor->execute($contactObject, $company);
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::ONLINE_SELLER);
|
||||
|
||||
$inviter = $this->fetchesCompanyModule->execute(['reference'=>'LMD']);
|
||||
|
||||
$connectionObject = new CompanyConnectionObject($companyModule, $inviter, mt_rand(1000, 9999).(new GeneratesInitials())->name($company->name)->length(3)->generate(), 'LMD');
|
||||
|
||||
$connection = $this->createsCompanyConnection->execute($connectionObject);
|
||||
|
||||
$this->approvesCompanyConnection->execute($connection);
|
||||
|
||||
$Object = new EmploymentObject($companyModule, $user);
|
||||
|
||||
$this->assignEmployeeProcessor->execute($Object);
|
||||
|
||||
return $this->response($this->authenticationProcessor->execute($request));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Delivery\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
||||
use App\Classes\Modules\Orders\Services\CreatesOrder;
|
||||
use App\Classes\Modules\Orders\Services\GeneratesOrderNumber;
|
||||
use App\Classes\Modules\Orders\Standards\Rules\CanCreateOrder;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackageObject;
|
||||
use App\Classes\Modules\PackingLists\DataTransferObjects\PackingListObject;
|
||||
use App\Classes\Modules\PackingLists\Services\CreatesPackingList;
|
||||
use App\Classes\Modules\PackingLists\Services\Packages\CreatesPackage;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Http\Resources\DeliveryOrderResource;
|
||||
use App\Models\Address;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\Order;
|
||||
use App\Models\PackingList;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateDeliveryOrderLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Created Order',
|
||||
'message' => 'You have successfully created a new Order'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var fetchesAddress */
|
||||
private $fetchesAddress;
|
||||
|
||||
/** @var CanCreateOrder */
|
||||
private $canCreateOrder;
|
||||
|
||||
/** @var CreatesOrder */
|
||||
private $createsOrder;
|
||||
|
||||
/** @var CreatesAddress */
|
||||
private $createAddress;
|
||||
|
||||
/** @var CreateContactProcessor */
|
||||
private $createContactProcessor;
|
||||
|
||||
/** @var CreateRemarkProcessor */
|
||||
private $createRemarkProcessor;
|
||||
|
||||
/** @var GeneratesOrderNumber */
|
||||
private $generatesOrderNumber;
|
||||
|
||||
/** @var CreatesPackingList */
|
||||
private $createsPackingList;
|
||||
|
||||
/** @var CreatesPackage */
|
||||
private $createsPackage;
|
||||
|
||||
|
||||
/**
|
||||
* CreateDeliveryOrderLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param FetchesAddress $fetchesAddress
|
||||
* @param CanCreateOrder $canCreateOrder
|
||||
* @param CreatesOrder $createsOrder
|
||||
* @param CreatesAddress $createAddress
|
||||
* @param CreateContactProcessor $createContactProcessor
|
||||
* @param CreateRemarkProcessor $createRemarkProcessor
|
||||
* @param GeneratesOrderNumber $generatesOrderNumber
|
||||
* @param CreatesPackingList $createsPackingList
|
||||
* @param CreatesPackage $createPackage
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesAddress $fetchesAddress, CanCreateOrder $canCreateOrder, CreatesOrder $createsOrder, CreatesAddress $createAddress, CreateContactProcessor $createContactProcessor, CreateRemarkProcessor $createRemarkProcessor, GeneratesOrderNumber $generatesOrderNumber, CreatesPackingList $createsPackingList, CreatesPackage $createsPackage)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesAddress = $fetchesAddress;
|
||||
$this->canCreateOrder = $canCreateOrder;
|
||||
$this->createsOrder = $createsOrder;
|
||||
$this->createAddress = $createAddress;
|
||||
$this->createContactProcessor = $createContactProcessor;
|
||||
$this->createRemarkProcessor = $createRemarkProcessor;
|
||||
$this->generatesOrderNumber = $generatesOrderNumber;
|
||||
$this->createsPackingList = $createsPackingList;
|
||||
$this->createsPackage = $createsPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request): JsonResponse
|
||||
{
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->input('company_id')]);
|
||||
|
||||
$senderAddress = $this->fetchesAddress->execute(['id' => $request->input('sender_address_id')]);
|
||||
$deliveryAddress = $this->fetchesAddress->execute(['id' => $request->input('delivery_address_id')]);
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $company->companyModules()->where('type', BusinessType::ONLINE_SELLER)->first();
|
||||
|
||||
$orderObject = new OrderObject($this->generatesOrderNumber->execute('168M', 7), OrderType::LAST_MILE_DELIVERY, ApprovalStatus::APPROVED);
|
||||
|
||||
$this->canCreateOrder->passes($orderObject);
|
||||
|
||||
/** @var Order $order */
|
||||
$order = $this->createsOrder->execute($companyModule, $orderObject);
|
||||
|
||||
$senderAddressObject = new AddressObject($senderAddress->street_one, $senderAddress->street_two, $senderAddress->country_id, $senderAddress->state_id, $senderAddress->district_id, $senderAddress->postcode, $senderAddress->type, ApprovalStatus::APPROVED, $senderAddress->reference);
|
||||
$deliveryAddressObject = new AddressObject($deliveryAddress->street_one, $deliveryAddress->street_two, $deliveryAddress->country_id, $deliveryAddress->state_id, $deliveryAddress->district_id, $deliveryAddress->postcode, $deliveryAddress->type, ApprovalStatus::APPROVED, $senderAddress->reference);
|
||||
|
||||
/** @var Address $orderSenderAddress */
|
||||
$orderSenderAddress = $this->createAddress->execute($order, $senderAddressObject);
|
||||
/** @var Address $orderDeliveryAddress */
|
||||
$orderDeliveryAddress = $this->createAddress->execute($order, $deliveryAddressObject);
|
||||
|
||||
$senderContact = $senderAddress->contacts()->first();
|
||||
$deliveryContact = $deliveryAddress->contacts()->first();
|
||||
|
||||
$contactObject = new ContactObject($senderContact->reference, $senderContact->phone, '','');
|
||||
$this->createContactProcessor->execute($contactObject, $orderSenderAddress);
|
||||
|
||||
$contactObject = new ContactObject($deliveryContact->reference, $deliveryContact->phone, '','');
|
||||
$this->createContactProcessor->execute($contactObject, $orderDeliveryAddress);
|
||||
|
||||
$senderRemark = $senderAddress->remarks()->first();
|
||||
$deliveryRemark = $deliveryAddress->remarks()->first();
|
||||
|
||||
if ($senderRemark){
|
||||
$remarkObject = new RemarkObject($senderRemark->content, Auth()->user()->id);
|
||||
|
||||
if($remarkObject->getContent()){
|
||||
$this->createRemarkProcessor->execute($orderSenderAddress, $remarkObject);
|
||||
}
|
||||
}
|
||||
|
||||
if ($deliveryRemark){
|
||||
$remarkObject = new RemarkObject($deliveryRemark->content, Auth()->user()->id);
|
||||
|
||||
if($remarkObject->getContent()){
|
||||
$this->createRemarkProcessor->execute($orderDeliveryAddress, $remarkObject);
|
||||
}
|
||||
}
|
||||
|
||||
$packingListObject = new PackingListObject($order->reference, $companyModule->id, PackingListType::DELIVERY_PACKING_LIST, ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
/** @var PackingList $packingList */
|
||||
$packingList = $this->createsPackingList->execute($packingListObject, $order);
|
||||
|
||||
$packageObject = new PackageObject($request->input('packing_list.type'), $request->input('packing_list.description'), (float) 1, (float) 1, (float) 1, $request->input('packing_list.weight'), (float) $request->input('packing_list.quantity'), ApprovalStatus::APPROVED);
|
||||
$this->createsPackage->execute($packageObject, $packingList);
|
||||
|
||||
return $this->resourceResponse(new DeliveryOrderResource($order));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Delivery\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\ListsOrders;
|
||||
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Http\Resources\DeliveryOrderResource;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListOrdersLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Orders',
|
||||
'message' => 'You have successfully retrieved a list of Orders'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanListOrders */
|
||||
private $canListOrders;
|
||||
|
||||
/** @var ListsOrders */
|
||||
private $listsOrders;
|
||||
|
||||
/**
|
||||
* ListOrdersLogic constructor.
|
||||
* @param CanListOrders $canListOrders
|
||||
* @param ListsOrders $listsOrders
|
||||
*/
|
||||
public function __construct(CanListOrders $canListOrders, ListsOrders $listsOrders)
|
||||
{
|
||||
$this->canListOrders = $canListOrders;
|
||||
$this->listsOrders = $listsOrders;
|
||||
}
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$this->canListOrders->passes();
|
||||
|
||||
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::LAST_MILE_DELIVERY]]));
|
||||
|
||||
return $this->collectionResponse(DeliveryOrderResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Classes\ValueObjects\Constants\PackageType;
|
||||
use App\Models\Order;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ExportsDeliveryOrders implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, WithTitle
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Types_Of_Services',
|
||||
'Service_Type',
|
||||
'Sender_Name',
|
||||
'Sender_Company_Name',
|
||||
'Sender_Building_Unit',
|
||||
'Sender_Address',
|
||||
'Sender_Address_2',
|
||||
'Sender_Postal_Code',
|
||||
'Sender_Phone_Number',
|
||||
'Delivery_Name',
|
||||
'Delivery Company Name',
|
||||
'Delivery_Building_Unit',
|
||||
'Delivery_Address',
|
||||
'Delivery_Address_2',
|
||||
'Delivery_Postal_Code',
|
||||
'Delivery_Phone_Number',
|
||||
'Shipment_Type',
|
||||
'Mode',
|
||||
'Pickup_Address_Type',
|
||||
'Reference_Number',
|
||||
'Quantity',
|
||||
'Weight',
|
||||
'Length',
|
||||
'Width',
|
||||
'Height',
|
||||
'COD_Amount',
|
||||
'DO_Numbers'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$selectedIds = array_map(function($value){
|
||||
return ['id' => $value];
|
||||
}, json_decode($this->request->input('ids')));
|
||||
|
||||
return Order::where('type', OrderType::LAST_MILE_DELIVERY)->whereIn('id', $selectedIds);
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'bulk-shipment';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Order $order
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($order): array
|
||||
{
|
||||
$senderAddress = $order->addresses()->where('type', AddressType::PICK_UP)->first();
|
||||
$deliveryAddress = $order->addresses()->where('type', AddressType::DELIVERY)->first();
|
||||
$package = $order->packingLists()->first()->packages()->first();
|
||||
|
||||
return [
|
||||
'Domestic Shipment',
|
||||
'ST00000020',
|
||||
$senderAddress->contacts()->first()->reference,
|
||||
$order->companyModule->name,
|
||||
'*',
|
||||
$senderAddress->street_one.', '.$senderAddress->street_two.' '.$senderAddress->district->name.' '.$senderAddress->postcode.' '.$senderAddress->state->name.' '.$senderAddress->country->name,
|
||||
'',
|
||||
$senderAddress->postcode,
|
||||
$senderAddress->contacts()->first()->phone,
|
||||
$deliveryAddress->contacts()->first()->reference,
|
||||
'',
|
||||
'*',
|
||||
$deliveryAddress->street_one.', '.$deliveryAddress->street_two.' '.$deliveryAddress->district->name.' '.$deliveryAddress->postcode.' '.$deliveryAddress->state->name.' '.$deliveryAddress->country->name,
|
||||
'',
|
||||
$deliveryAddress->postcode,
|
||||
$deliveryAddress->contacts()->first()->phone,
|
||||
$package->type === PackageType::CARTON ? 'Package' : ($package->type === PackageType::PALLET ? 'Pallet' : 'Documents'),
|
||||
'Pick Up',
|
||||
'Default',
|
||||
$order->reference,
|
||||
$package->quantity,
|
||||
$package->weight * $package->quantity,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
'',
|
||||
''
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ExportsDeliveryValidValues implements WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, WithTitle, FromCollection
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* ExportsDeliveryValidValues constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Types_Of_Services',
|
||||
'Service_Type',
|
||||
'Mode',
|
||||
'Flag',
|
||||
'Pickup Address'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function collection()
|
||||
{
|
||||
$returnArray = collect();
|
||||
|
||||
$returnArray->push(['Domestic Shipment', 'Package', 'Pick Up', 'Yes', 'Default']);
|
||||
$returnArray->push(['', 'Documents', 'Lodge In / Walk In', 'No', 'Sender']);
|
||||
$returnArray->push(['', 'Pallet', '', '', '']);
|
||||
|
||||
return $returnArray;
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'valid-values';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ReturnArray $returnArray
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($returnArray): array
|
||||
{
|
||||
return [
|
||||
$returnArray[0],
|
||||
$returnArray[1],
|
||||
$returnArray[2],
|
||||
$returnArray[3],
|
||||
$returnArray[4],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsDeliveryOrders;
|
||||
use App\Classes\Modules\Exports\Services\ExportsDeliveryValidValues;
|
||||
use App\Models\Order;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
||||
class ExportsMultipleDeliveryOrders implements WithMultipleSheets
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* ExportsMultipleDeliveryOrders constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function sheets(): array
|
||||
{
|
||||
$sheets = [];
|
||||
$sheets[] = new ExportsDeliveryOrders($this->request);
|
||||
$sheets[] = new ExportsDeliveryValidValues($this->request);
|
||||
|
||||
return $sheets;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\PackingList;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ExportsPendingArrangementDeliveryList implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
|
||||
{
|
||||
|
||||
use Exportable;
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Container Ref.',
|
||||
'ETA',
|
||||
'Unstuffing',
|
||||
'Marking',
|
||||
'Order Number',
|
||||
'Delay Days',
|
||||
'Quantity',
|
||||
'State',
|
||||
'Postcode',
|
||||
'Address',
|
||||
'PIC',
|
||||
'Phone',
|
||||
'Remark'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
return PackingList::where('type', '=', 2)->whereHas('containers', function ($query){
|
||||
$query->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
})->whereDoesntHave('transports');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PackingList $packingList
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($packingList): array
|
||||
{
|
||||
$container = $packingList->containers()->first();
|
||||
$ContainerTransport = $container->transports()->first();
|
||||
$order = $packingList->owner;
|
||||
$marking = $order->companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference;
|
||||
$address = $order->addresses()->where('status', ApprovalStatus::APPROVED)->first();
|
||||
$contacts = $address->contacts->first() ? $address->contacts->first(): '';
|
||||
$originalPackingList = $packingList->owner instanceof PackingList ? $packingList->owner : $packingList;
|
||||
$transport = $originalPackingList->containers()->first()->transports()->first();
|
||||
|
||||
return [
|
||||
$container->reference,
|
||||
$ContainerTransport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->eta,
|
||||
$ContainerTransport->drop_date,
|
||||
$marking,
|
||||
$order->reference,
|
||||
$transport ? Carbon::now()->diffInDays($transport->drop_date, false) . ' Days' : '',
|
||||
$packingList->packages()->sum('quantity'),
|
||||
$address->state->name,
|
||||
$address->postcode,
|
||||
$address->street_one.', '.$address->street_two.' '.$address->district->name.' '.$address->postcode.' '.$address->state->name.' '.$address->country->name,
|
||||
$address->remarks->first() ? $address->remarks->first()->content: '',
|
||||
$contacts ? $contacts ->reference : '',
|
||||
$contacts ? $contacts ->phone : '',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Notifications\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Notifications\Services\ListsNotification;
|
||||
use App\Http\Resources\NotificationResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListNotificationsLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieve Notifications',
|
||||
'message' => 'You have successfully retrieved a list of Notifications'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var ListsNotification */
|
||||
private $listsNotification;
|
||||
|
||||
/**
|
||||
* ListNotificationsLogic constructor.
|
||||
* @param ListsNotification $listsNotification
|
||||
*/
|
||||
public function __construct(
|
||||
ListsNotification $listsNotification
|
||||
)
|
||||
{
|
||||
$this->listsNotification = $listsNotification;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$filters = [
|
||||
// 'target_id'=>auth()->user()->id,
|
||||
// 'per_page'=>$request->route('per_page')
|
||||
];
|
||||
|
||||
$notifications = $this->listsNotification->execute($filters);
|
||||
|
||||
return $this->collectionResponse(NotificationResource::collection($notifications));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Notifications\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractListRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\Notification;
|
||||
|
||||
class ListsNotification extends AbstractListRecord
|
||||
{
|
||||
|
||||
/** @var Bank */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsBank constructor.
|
||||
* @param Notification $repository
|
||||
*/
|
||||
public function __construct(Notification $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Orders\Services\ListsOrders;
|
||||
use App\Classes\Modules\Orders\Standards\Rules\CanListOrders;
|
||||
use App\Classes\ValueObjects\Constants\OrderType;
|
||||
use App\Http\Resources\OrderResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -44,7 +45,7 @@ class ListOrdersLogic extends AbstractControllerLogic
|
||||
{
|
||||
$this->canListOrders->passes();
|
||||
|
||||
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true]));
|
||||
$query = $this->listsOrders->execute(array_merge($this->listsOrders->deserializeFilters($request->input('filters')), ['with_parcels' => true, 'type_in' => [OrderType::SHARED_CONTAINER, OrderType::DEDICATED_CONTAINER]]));
|
||||
|
||||
return $this->collectionResponse(OrderResource::collection($query));
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
class OrderObject implements DataTransferObject
|
||||
{
|
||||
|
||||
/** @var int */
|
||||
/** @var string */
|
||||
private $reference;
|
||||
|
||||
/** @var int */
|
||||
@@ -20,11 +20,11 @@ class OrderObject implements DataTransferObject
|
||||
|
||||
/**
|
||||
* OrderObject constructor.
|
||||
* @param int $reference
|
||||
* @param string $reference
|
||||
* @param int $type
|
||||
* @param int|null $status
|
||||
*/
|
||||
public function __construct(int $reference, int $type, ?int $status = ApprovalStatus::PENDING_VERIFICATION)
|
||||
public function __construct(string $reference, int $type, ?int $status)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$this->type = $type;
|
||||
@@ -32,9 +32,9 @@ class OrderObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @return string
|
||||
*/
|
||||
public function getReference(): int
|
||||
public function getReference(): string
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
@@ -48,12 +48,13 @@ class OrderObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @return int|null
|
||||
*/
|
||||
public function getStatus(): int
|
||||
public function getStatus(): ?int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Classes\Modules\Orders\Standards\Rules\CanApproveChangeOrderAddress;
|
||||
use App\Classes\Modules\Orders\Services\UpdatesOrdersAddress;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ApproveChangeOrderAddressProcessor
|
||||
@@ -65,7 +66,11 @@ class ApproveChangeOrderAddressProcessor
|
||||
$address->owner->addresses()->update(['status' => ApprovalStatus::EXPIRED]);
|
||||
|
||||
$appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
|
||||
$appointee === 2 ? $this->updateDoFromVTPortalProcessor->execute($address) : $this->updateDoFromYDPortalProcessor->execute($address);
|
||||
if($appointee === 2) {
|
||||
foreach($address->owner->packingLists()->where('type', PackingListType::SHIPPING_PACKING_LIST) as $packingList){
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class CreateOrderProcessor
|
||||
/** @var Order $order */
|
||||
$order = $this->createsOrder->execute($importer, $orderObject);
|
||||
|
||||
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode,$address->reference);
|
||||
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, $address->type, ApprovalStatus::APPROVED, $address->reference);
|
||||
|
||||
/** @var Address $order_address */
|
||||
$order_address = $this->createAddress->execute($order, $addressObject);
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\Modules\Addresses\Services\DeletesAddress;
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
@@ -76,7 +77,7 @@ class RequestChangeOrderAddressProcessor
|
||||
}
|
||||
|
||||
$address = $this->fetchesAddress->execute(['id' => $request->get('address_id')]);
|
||||
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, $address->reference, ApprovalStatus::PENDING_VERIFICATION);
|
||||
$addressObject = new AddressObject($address->street_one, $address->street_two, $address->country_id, $address->state_id, $address->district_id, $address->postcode, AddressType::DELIVERY, ApprovalStatus::PENDING_VERIFICATION, $address->reference);
|
||||
$order_address = $this->createsAddress->execute($order, $addressObject);
|
||||
|
||||
$contact = $address->contacts()->first();
|
||||
|
||||
@@ -6,23 +6,9 @@ use App\Classes\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\Services\FetchesDataFromVTPortal;
|
||||
use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
|
||||
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
|
||||
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
|
||||
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
|
||||
use App\Classes\Modules\Transports\Services\CreatesTransport;
|
||||
use App\Classes\Modules\Unity\Services\UpdatesContractObligation;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\TransportType;
|
||||
use App\Models\PackingList;
|
||||
use App\Models\Transport;
|
||||
use Carbon\Carbon;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateDoFromVTPortalProcessor
|
||||
{
|
||||
/** @var FetchesDataFromVTPortal */
|
||||
@@ -43,19 +29,20 @@ class UpdateDoFromVTPortalProcessor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $address
|
||||
* @param PackingList $packing_list
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function execute($address) {
|
||||
public function execute(PackingList $packing_list) {
|
||||
|
||||
if(!app()->environment(['production'])){
|
||||
return [];
|
||||
}
|
||||
|
||||
try {
|
||||
$order = $address->owner()->orderBy('id', 'desc')->first();
|
||||
$packing_list = $order->packingLists()->orderBy('id', 'desc')->first();
|
||||
$address= $packing_list->owner->addresses()->where('status', ApprovalStatus::APPROVED)->first();
|
||||
$order = $packing_list->owner;
|
||||
|
||||
if ($packing_list) {
|
||||
$contact = $address->contacts()->first();
|
||||
@@ -67,7 +54,7 @@ class UpdateDoFromVTPortalProcessor
|
||||
|
||||
$status = 'On Hold';
|
||||
|
||||
if (in_array($packing_list->status, [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
if (in_array($packing_list->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
$status = 'Release';
|
||||
}
|
||||
|
||||
@@ -77,6 +64,7 @@ class UpdateDoFromVTPortalProcessor
|
||||
|
||||
if ($vt_do) {
|
||||
foreach ($vt_do->Rows as $key => $row) {
|
||||
if($row[4] !== $packing_list->containers()->first()->reference) continue;
|
||||
$vt_do_update = $this->fetchesDataFRomVTPortal->clientRequest(
|
||||
'http://portal.vtnation.com.my/Services/DataControllerService.asmx/Execute',
|
||||
'POST',
|
||||
@@ -141,7 +129,7 @@ class UpdateDoFromVTPortalProcessor
|
||||
}
|
||||
|
||||
} catch (\Exception $exception){
|
||||
return [];
|
||||
throw new InternalServerErrorException('failed to approve address due to an error related to VT portal: '.$exception->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Models\PackingList;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdateDoFromYDPortalProcessor
|
||||
@@ -30,36 +31,34 @@ class UpdateDoFromYDPortalProcessor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $address
|
||||
* @param PackingList $packingList
|
||||
* @return void
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function execute($address) {
|
||||
public function execute(PackingList $packingList) {
|
||||
if(!app()->environment(['production'])){
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$order = $address->owner()->orderBy('id', 'desc')->first();
|
||||
$packing_lists = $order->packingLists()
|
||||
->where('type', PackingListType::SHIPPING_PACKING_LIST)
|
||||
->where('status', '!=', ApprovalStatus::SUSPENDED)
|
||||
->orderBy('id', 'desc')->get();
|
||||
$address = $packingList->owner->addresses()->where('status', ApprovalStatus::APPROVED)->first();
|
||||
|
||||
if (!in_array($packingList->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($packing_lists as $key => $row) {
|
||||
if ($row->status === ApprovalStatus::SUSPENDED) {
|
||||
continue;
|
||||
}
|
||||
$contact = $address->contacts()->first();
|
||||
$remark = $address->remarks()->first();
|
||||
|
||||
$contact = $address->contacts()->first();
|
||||
$remark = $address->remarks()->first();
|
||||
$phone = $contact ? $contact->phone : null;
|
||||
$reference = $contact ? $contact->reference : null;
|
||||
$remark = $remark ? $remark->content : 'URGENT!!! PLEASE CALL BEFORE ONE DAY DELIVERY.';
|
||||
|
||||
$phone = $contact ? $contact->phone : null;
|
||||
$reference = $contact ? $contact->reference : null;
|
||||
$remark = $remark ? $remark->content : 'URGENT!!! PLEASE CALL BEFORE ONE DAY DELIVERY.';
|
||||
|
||||
$this->fetchesDataFRomYDPortal->clientRequest(
|
||||
'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
|
||||
'POST',
|
||||
$this->fetchesDataFRomYDPortal->clientRequest(
|
||||
'http://www.yd-wl.com/api/UpdateOrderAddress.ashx',
|
||||
'POST',
|
||||
[
|
||||
'expressno' => $row->reference,
|
||||
'expressno' => $packingList->reference,
|
||||
'customers_name' => $reference,
|
||||
'cellphone' => $phone,
|
||||
'postcode' => $address->postcode,
|
||||
@@ -68,8 +67,6 @@ class UpdateDoFromYDPortalProcessor
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new InternalServerErrorException('failed to approve address due to an error related to YD portal');
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class ChecksIfOrderNumberExists
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(int $orderNumber): bool {
|
||||
public function execute(string $orderNumber): bool {
|
||||
return $this->repository->where('reference', $orderNumber)->exists();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,13 @@ class GeneratesOrderNumber
|
||||
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @param null|string $prefix
|
||||
* @param int|null $length
|
||||
* @return string
|
||||
*/
|
||||
public function execute(): int {
|
||||
public function execute(?string $prefix = '', ?int $length = 9): string {
|
||||
|
||||
$reference = rand(100000001, 999999999);
|
||||
$reference = $prefix.rand((int)('1'.str_repeat(0, $length - 2).'1'), (int) str_repeat(9, $length));
|
||||
return !$this->checkIfOrderNumberExists->execute($reference) ? $reference : self::execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||
use App\Http\Resources\PackingListResource;
|
||||
use App\Models\PackingList;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -70,16 +71,16 @@ class UpdatePackingListStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
$packingList = $this->fetchesPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
$packing_list = $this->updatesPackingListStatus->execute($packingList, $request->route('status'));
|
||||
$address = $packing_list->owner()->first()->addresses()->where('status', ApprovalStatus::APPROVED)->first();
|
||||
/** @var PackingList $packingList */
|
||||
$packingList = $this->updatesPackingListStatus->execute($packingList, $request->route('status'));
|
||||
|
||||
|
||||
// $appointee = $address->owner->orderRoles()->where('role_id', '=', OrderRoleTypes::ORIGIN_FREIGHT_FORWARDER)->first()->appointee->id;
|
||||
|
||||
$this->updateDoFromVTPortalProcessor->execute($address);
|
||||
$this->updateDoFromYDPortalProcessor->execute($address);
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromYDPortalProcessor->execute($packingList);
|
||||
|
||||
return $this->resourceResponse(new PackingListResource($packing_list));
|
||||
return $this->resourceResponse(new PackingListResource($packingList));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-6
@@ -158,13 +158,9 @@ class FetchLoadedContainersFromVTPortalProcessor
|
||||
}
|
||||
|
||||
foreach($containerDetail->Rows as $packingList){
|
||||
$marking = explode('/', explode('CIEF/', $packingList[13])[1]);
|
||||
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $packingList[13]));
|
||||
|
||||
if(!array_key_exists(1, $marking)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$orderNumber = $marking[1];
|
||||
$orderNumber = $marking[array_key_last($marking)];
|
||||
|
||||
if(!$packingList[22]){
|
||||
continue;
|
||||
|
||||
+44
-10
@@ -36,6 +36,7 @@ use App\Models\Transport;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class FetchOrderListsFromYdPortalProcessor
|
||||
{
|
||||
@@ -153,7 +154,6 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($orderRequest);
|
||||
|
||||
foreach($rows->data as $row){
|
||||
|
||||
$containerReference = null;
|
||||
$loadingDate = null;
|
||||
$unstuffingDate = null;
|
||||
@@ -168,6 +168,11 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
|
||||
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
|
||||
|
||||
if(!$rows){
|
||||
Log::debug($row->expressno);
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (array_reverse($rows->data) as $trackingRow) {
|
||||
if ($trackingRow->tracking === '货物已送达仓库准备入库中') {
|
||||
$receiveDate = Carbon::parse($trackingRow->trackingtime);
|
||||
@@ -181,21 +186,43 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$eta = Carbon::parse($tracking[2]);
|
||||
}
|
||||
|
||||
if (strpos($trackingRow->tracking, '预计船时间为') !== false) {
|
||||
$tracking = explode('预计船时间为', $trackingRow->tracking);
|
||||
$delayDate = Carbon::parse(explode('日', $tracking[1])[0]);
|
||||
$rescheduleETD = strpos($trackingRow->remark, '开') || strpos($trackingRow->remark, '到港');
|
||||
$rescheduleETA = strpos($trackingRow->remark, '到港');
|
||||
if (($rescheduleETD !== false || $rescheduleETA !== false) && strpos($trackingRow->tracking, '货物装柜完成。') === false) {
|
||||
preg_match_all('/([0-9]+.{3})/', $trackingRow->remark, $matches);
|
||||
$dates = collect();
|
||||
|
||||
foreach($matches[0] as $date){
|
||||
try {
|
||||
$dates->push(Carbon::parse(str_replace('.', '/', $date).Carbon::now()->format('Y')));
|
||||
} catch (\Exception $exception) {
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$rescheduleDate = $dates->sortDesc()->first();
|
||||
if(!$delayDate || $rescheduleDate > $delayDate){
|
||||
/** @var Carbon $delayDate */
|
||||
$delayDate = $rescheduleDate;
|
||||
|
||||
if($rescheduleETA === false && $delayDate) {
|
||||
$delayDate = $delayDate->addDays('5');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (strpos($trackingRow->tracking, '预计开船为') !== false) {
|
||||
$tracking = explode('预计开船为', $trackingRow->tracking);
|
||||
$delayDate = Carbon::parse(explode('日', $tracking[1])[0]);
|
||||
if ($trackingRow->tracking === '已开船') {
|
||||
$delayDate = Carbon::parse($trackingRow->trackingtime)->addDays('5');
|
||||
}
|
||||
|
||||
|
||||
if ($trackingRow->tracking === '货物已进目的港仓库') {
|
||||
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
|
||||
}
|
||||
|
||||
if ($trackingRow->tracking === '货物已派送完成') {
|
||||
if (Str::contains($trackingRow->tracking, ['派送中'])) {
|
||||
$deliveryDate = Carbon::parse($trackingRow->trackingtime);
|
||||
}
|
||||
}
|
||||
@@ -288,6 +315,13 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
$this->createPackageProcessor->execute($packageObject, $packingList);
|
||||
}
|
||||
|
||||
if(!count($row->deliverysize)){
|
||||
$measurement = round(((float) $row->volume / (float) $row->goodcount) ** (1/3) * 100, 2);
|
||||
$packageObject = new PackageObject(PackageType::CARTON, $row->goodname, (float) $measurement, (float) $measurement, (float) $measurement, 0, (float) $row->goodcount, ApprovalStatus::APPROVED);
|
||||
$this->createPackageProcessor->execute($packageObject, $warehouseReceiveList);
|
||||
$this->createPackageProcessor->execute($packageObject, $packingList);
|
||||
}
|
||||
|
||||
$weightCbm = (float) $row->weight / 500;
|
||||
$overWeightCbm = $weightCbm - $packingList->packages()->sum(DB::raw('(width/100) * (height/100) * (length/100) * quantity'));
|
||||
|
||||
@@ -344,7 +378,7 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
|
||||
$transport = $container->transports()->first();
|
||||
|
||||
if(!$transport->schedules()->where('eta', '=', $delayDate)->first()) {
|
||||
if(!$transport->schedules()->whereDate('eta', '>=', $delayDate)->first()) {
|
||||
$etd = $transport->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()->etd;
|
||||
$transport->schedules()->update(['status' => ApprovalStatus::EXPIRED]);
|
||||
$this->createsSchedule->execute($transport, new ScheduleObject($etd, $delayDate, ApprovalStatus::APPROVED));
|
||||
@@ -373,7 +407,7 @@ class FetchOrderListsFromYdPortalProcessor
|
||||
}
|
||||
}
|
||||
|
||||
if($deliveryDate && !$packingList->transports){
|
||||
if($deliveryDate && !$packingList->transports()->exists()){
|
||||
$packingList->status = ApprovalStatus::COMPLETED;
|
||||
$packingList->save();
|
||||
|
||||
|
||||
+2
-8
@@ -134,19 +134,13 @@ class FetchWarehouseReceiveListFromVTPortalProcessor
|
||||
|
||||
foreach ($response->Rows as $parcel){
|
||||
|
||||
$marking = explode('/', explode('CIEF/', $parcel[5])[1]);
|
||||
|
||||
if(!array_key_exists(1, $marking)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$orderNumber = $marking[1];
|
||||
$marking = preg_split('(-|\(|\)|\/)', str_replace("/YW","", $parcel[5]));
|
||||
$orderNumber = $marking[array_key_last($marking)];
|
||||
|
||||
if(!$parcel[9]){
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
$order = $this->fetchesOrder->execute(['reference' => $orderNumber]);
|
||||
} catch (ResourceNotFoundException $exception) {
|
||||
|
||||
@@ -76,7 +76,7 @@ class UpdateConstantLogic extends AbstractControllerLogic
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$object = new ConstantObject($request->input('name'), $request->input('reference'), $request->input('detail'));
|
||||
$object = new ConstantObject($request->input('reference'), $request->input('value'));
|
||||
|
||||
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Resources\ConstantResource;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstant;
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
|
||||
use App\Classes\Modules\Segments\Services\AddItemToConstantValueArray;
|
||||
use App\Classes\Modules\Segments\Services\RemoveItemFromConstantValueArray;
|
||||
|
||||
class UpdateConstantPostcodeLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Segment Constant',
|
||||
'message' => 'You have successfully updated the Segment Constant'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateConstant */
|
||||
private $canUpdateConstant;
|
||||
|
||||
/** @var UpdatesConstant */
|
||||
private $updatesConstant;
|
||||
|
||||
/** @var FetchesSegment */
|
||||
private $fetchesSegment;
|
||||
|
||||
/** @var FetchesConstant */
|
||||
private $fetchesConstant;
|
||||
|
||||
/** @var AddItemToConstantValueArray */
|
||||
private $addItemToConstantValueArray;
|
||||
|
||||
/** @var RemoveItemFromConstantValueArray */
|
||||
private $removeItemFromConstantValueArray;
|
||||
|
||||
|
||||
/**
|
||||
* UpdateConstantLogic constructor.
|
||||
* @param CanUpdateConstant $canUpdateConstant
|
||||
* @param UpdatesConstant $updatesConstant
|
||||
* @param FetchesSegment $fetchesSegment
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
* @param AddItemToConstantValueArray $addItemToConstantValueArray
|
||||
* @param RemoveItemFromConstantValueArray $removeItemFromConstantValueArray
|
||||
*/
|
||||
public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,AddItemToConstantValueArray $addItemToConstantValueArray, RemoveItemFromConstantValueArray $removeItemFromConstantValueArray)
|
||||
{
|
||||
$this->canUpdateConstant = $canUpdateConstant;
|
||||
$this->updatesConstant = $updatesConstant;
|
||||
$this->fetchesSegment = $fetchesSegment;
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
$this->addItemToConstantValueArray = $addItemToConstantValueArray;
|
||||
$this->removeItemFromConstantValueArray = $removeItemFromConstantValueArray;
|
||||
}
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
|
||||
|
||||
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
|
||||
|
||||
$object = new ConstantObject($constant->reference, $this->addItemToConstantValueArray->execute($constant->value, $request->input('postcode')));
|
||||
$this->canUpdateConstant->passes($object);
|
||||
|
||||
$constant = $this->updatesConstant->execute($constant, $object);
|
||||
|
||||
$oppositeConstant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE]);
|
||||
|
||||
$oppositeObject = new ConstantObject($request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE, $this->removeItemFromConstantValueArray->execute($oppositeConstant->value, $request->input('postcode')));
|
||||
|
||||
$oppositeConstant = $this->updatesConstant->execute($oppositeConstant, $oppositeObject);
|
||||
|
||||
|
||||
return $this->response([
|
||||
'CENTER_POSTCODE' => $constant->reference == SegmentConstants::CENTER_POSTCODE ? new ConstantResource($constant) : New ConstantResource($oppositeConstant),
|
||||
'OUTSTATION_POSTCODE' => $constant->reference == SegmentConstants::OUTSTATION_POSTCODE ? new ConstantResource($constant) : New ConstantResource($oppositeConstant),
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\SegmentConstant;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Resources\ConstantResource;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstant;
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstantValueByState;
|
||||
|
||||
class UpdateConstantStateLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Segment Constant',
|
||||
'message' => 'You have successfully updated the Segment Constant'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateConstant */
|
||||
private $canUpdateConstant;
|
||||
|
||||
/** @var UpdatesConstant */
|
||||
private $updatesConstant;
|
||||
|
||||
/** @var FetchesSegment */
|
||||
private $fetchesSegment;
|
||||
|
||||
/** @var FetchesConstant */
|
||||
private $fetchesConstant;
|
||||
|
||||
/** @var UpdatesConstantValueByState */
|
||||
private $updatesConstantValueByState;
|
||||
|
||||
|
||||
/**
|
||||
* UpdateConstantLogic constructor.
|
||||
* @param CanUpdateConstant $canUpdateConstant
|
||||
* @param UpdatesConstant $updatesConstant
|
||||
* @param FetchesSegment $fetchesSegment
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
* @param UpdatesConstantValueByState $updatesConstantValueByState
|
||||
*/
|
||||
public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,UpdatesConstantValueByState $updatesConstantValueByState)
|
||||
{
|
||||
$this->canUpdateConstant = $canUpdateConstant;
|
||||
$this->updatesConstant = $updatesConstant;
|
||||
$this->fetchesSegment = $fetchesSegment;
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
$this->updatesConstantValueByState = $updatesConstantValueByState;
|
||||
}
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
|
||||
|
||||
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => SegmentConstants::STATE_RATE]);
|
||||
|
||||
$constantValue = $this->updatesConstantValueByState->execute($constant->value, $request->input('status_id'), $request->input('rate'));
|
||||
|
||||
$object = new ConstantObject(SegmentConstants::STATE_RATE, (array) $constantValue);
|
||||
$this->canUpdateConstant->passes($object);
|
||||
|
||||
$constant = $this->updatesConstant->execute($constant, $object);
|
||||
|
||||
|
||||
return $this->resourceResponse(new ConstantResource($constant));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,34 +7,22 @@ use App\Classes\General\Interfaces\DataTransferObject;
|
||||
class ConstantObject implements DataTransferObject
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
private $name;
|
||||
|
||||
/** @var string */
|
||||
private $reference;
|
||||
|
||||
/** @var array */
|
||||
private $detail;
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* ConstantObject constructor.
|
||||
* @param string $name
|
||||
* @param string $reference
|
||||
* @param array $detail
|
||||
* @param array $value
|
||||
*/
|
||||
public function __construct(string $name, string $reference, array $detail)
|
||||
public function __construct(string $reference, array $value)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->reference = $reference;
|
||||
$this->detail = $detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->name;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,9 +36,9 @@ class ConstantObject implements DataTransferObject
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDetail(): array
|
||||
public function getValue(): array
|
||||
{
|
||||
return $this->detail;
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
class AddItemToConstantValueArray
|
||||
{
|
||||
|
||||
/**
|
||||
* @param array $array
|
||||
* @param $item
|
||||
* @return array
|
||||
*/
|
||||
public function execute($array, $item): array {
|
||||
$array[] = $item;
|
||||
sort($array);
|
||||
return $array;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,11 +27,11 @@ class ConvertsConstantDetailsToResource
|
||||
|
||||
public function execute(SegmentConstant $constant){
|
||||
|
||||
if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) {
|
||||
return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : '';
|
||||
}
|
||||
// if($constant->reference === SegmentConstants::SUPPLIER_CURRENCIES) {
|
||||
// return property_exists($constant->detail, 'id') ? new CurrencyResource($this->fetchesCurrency->execute(['id' => $constant->detail->id])) : '';
|
||||
// }
|
||||
|
||||
return $constant->detail;
|
||||
return $constant->value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,8 @@ class CreatesConstant extends AbstractUpdateRelationshipRecord
|
||||
public function execute(Segment $segment, ConstantObject $object)
|
||||
{
|
||||
$model = new SegmentConstant();
|
||||
$model->name = $object->getName();
|
||||
$model->reference = $object->getReference();
|
||||
$model->detail = json_encode($object->getDetail());
|
||||
$model->value = json_encode($object->getValue());
|
||||
|
||||
return $this->handler($segment->constants(), $model);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
class RemoveItemFromConstantValueArray
|
||||
{
|
||||
|
||||
/**
|
||||
* @param array $array
|
||||
* @param $item
|
||||
* @return array
|
||||
*/
|
||||
public function execute($array, $item): array {
|
||||
foreach($array as $key => $value){
|
||||
if($array[$key] == $item){
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
return array_values($array);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,9 +17,8 @@ class UpdatesConstant extends AbstractUpdateRecord
|
||||
*/
|
||||
public function execute(SegmentConstant $model, ConstantObject $object)
|
||||
{
|
||||
$model->name = $object->getName();
|
||||
$model->reference = $object->getReference();
|
||||
$model->detail = json_encode($object->getDetail());
|
||||
$model->value = json_encode($object->getValue());
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
class UpdatesConstantValueByState
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $json
|
||||
* @param int $status_id
|
||||
* @param int $rate
|
||||
* @return string
|
||||
*/
|
||||
public function execute($json, int $status_id, int $rate) {
|
||||
|
||||
$newArray = $json;
|
||||
foreach($json->config as $key => $object){
|
||||
if($object->status_id == $status_id){
|
||||
$newArray->config[$key] = (object) [
|
||||
'rate' => $rate,
|
||||
'status_id' => $object->status_id,
|
||||
'outstation_rate' => $object->outstation_rate,
|
||||
];
|
||||
}else{
|
||||
$newArray->config[$key] = $object;
|
||||
}
|
||||
}
|
||||
return $newArray;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,9 +15,8 @@ class ConstantValidation extends AbstractValidation
|
||||
protected function data($object): array {
|
||||
|
||||
$data = [
|
||||
'name' => $object->getName(),
|
||||
'reference' => $object->getReference(),
|
||||
'detail' => $object->getDetail()
|
||||
'value' => $object->getValue()
|
||||
];
|
||||
|
||||
return $data;
|
||||
@@ -28,9 +27,8 @@ class ConstantValidation extends AbstractValidation
|
||||
*/
|
||||
protected function rules(): array {
|
||||
return [
|
||||
'name' => 'required',
|
||||
'reference' => 'required',
|
||||
'detail' => 'required'
|
||||
'value' => 'required'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+30
-9
@@ -20,7 +20,11 @@ use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\PackageType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionDetailType;
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@@ -86,7 +90,11 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
$packing_list = $this->fetchesPackingList->execute(['id' => $request->input('packing_list_id')]);
|
||||
|
||||
$cbm = $packing_list->packages->sum(function($package) {
|
||||
$cbm = $packing_list->packages->where('type', '!=', PackageType::OVER_WEIGHT)->sum(function($package) {
|
||||
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
|
||||
});
|
||||
|
||||
$over_weight_cbm = $packing_list->packages->where('type', PackageType::OVER_WEIGHT)->sum(function($package) {
|
||||
return ($package->width / 100) * ($package->height / 100) *($package->length / 100) * ($package->quantity);
|
||||
});
|
||||
|
||||
@@ -143,7 +151,7 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
}
|
||||
|
||||
$price_cbm = $base_price + $warehouse_rate + $state_rate;
|
||||
$total_cbm = $price_cbm * $cbm;
|
||||
$total_cbm = $price_cbm * ($cbm + $over_weight_cbm);
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('SHIP-');
|
||||
|
||||
@@ -165,16 +173,28 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
ApprovalStatus::PENDING_SUBMISSION
|
||||
);
|
||||
|
||||
/** @var Transaction $invoice_transaction */
|
||||
$invoice_transaction = $this->createsTransaction->execute($packing_list, $object);
|
||||
|
||||
$object_detail = new TransactionDetailObject(
|
||||
$invoice_transaction->bill_no,
|
||||
$invoice_transaction->bill_no,
|
||||
1,
|
||||
$invoice_transaction->amount,
|
||||
$invoice_transaction->amount
|
||||
'SHIPPING_FEE',
|
||||
TransactionDetailType::SHIPPING_FEE,
|
||||
$cbm,
|
||||
$price_cbm
|
||||
);
|
||||
$transaction_detail = $this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
|
||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
|
||||
if ($over_weight_cbm > 0) {
|
||||
$object_detail = new TransactionDetailObject(
|
||||
'OVER_WEIGHT_CHARGES',
|
||||
TransactionDetailType::OVER_WEIGHT_CHARGES,
|
||||
$over_weight_cbm,
|
||||
$price_cbm
|
||||
);
|
||||
|
||||
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
|
||||
}
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice_transaction]);
|
||||
|
||||
@@ -185,11 +205,12 @@ class CreateShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
ApprovalStatus::COMPLETED,
|
||||
'shipping_invoice'
|
||||
);
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($invoice_transaction, $document_object);
|
||||
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
|
||||
// dd('yess');
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class TransactionDetailObject implements DataTransferObject
|
||||
/** @var string|null */
|
||||
private $name;
|
||||
|
||||
/** @var int|null */
|
||||
/** @var float|null */
|
||||
private $quantity;
|
||||
|
||||
/** @var float|null */
|
||||
@@ -22,10 +22,10 @@ class TransactionDetailObject implements DataTransferObject
|
||||
* TransactionDetailObject constructor.
|
||||
* @param string $reference
|
||||
* @param string $name
|
||||
* @param int $quantity
|
||||
* @param float $quantity
|
||||
* @param float $price
|
||||
*/
|
||||
public function __construct(?string $reference, ?string $name , ?int $quantity, ?float $price)
|
||||
public function __construct(?string $reference, ?string $name , ?float $quantity, ?float $price)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
$this->name = $name;
|
||||
@@ -50,9 +50,9 @@ class TransactionDetailObject implements DataTransferObject
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @return float
|
||||
*/
|
||||
public function getQuantity(): ?int
|
||||
public function getQuantity(): ?float
|
||||
{
|
||||
return $this->quantity;
|
||||
}
|
||||
|
||||
@@ -8,4 +8,6 @@ final class AddressType {
|
||||
|
||||
public const DELIVERY = 2;
|
||||
|
||||
public const PICK_UP = 3;
|
||||
|
||||
}
|
||||
|
||||
@@ -18,4 +18,7 @@ final class BusinessType {
|
||||
|
||||
public const CURRENCY_VENDOR = 6;
|
||||
|
||||
public const ONLINE_SELLER = 7;
|
||||
|
||||
public const LAST_MILE_DELIVERY_AGENT = 8;
|
||||
}
|
||||
|
||||
@@ -8,4 +8,6 @@ final class OrderType {
|
||||
|
||||
public const DEDICATED_CONTAINER = 1;
|
||||
|
||||
public const LAST_MILE_DELIVERY = 2;
|
||||
|
||||
}
|
||||
|
||||
@@ -10,4 +10,6 @@ final class PackageType {
|
||||
|
||||
public const OVER_WEIGHT = 2;
|
||||
|
||||
public const DOCUMENT = 3;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class TransactionDetailType {
|
||||
|
||||
public const SHIPPING_FEE = 'Shipping Fee';
|
||||
|
||||
public const OVER_WEIGHT_CHARGES = 'Over weight charges';
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
use App\Classes\Modules\Delivery\ControllersLogic\CancelDeliveryOrderLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CancelDeliveryOrderController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CancelOrderLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function cancel(Request $request, CancelDeliveryOrderLogic $logic): JsonResponse
|
||||
{
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
use App\Classes\Modules\Delivery\ControllersLogic\CreateDeliveryCustomerLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateDeliveryCustomerController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateDeliveryCustomerLogic $createDeliveryCustomerLogic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateDeliveryCustomerLogic $createDeliveryCustomerLogic): JsonResponse
|
||||
{
|
||||
return $createDeliveryCustomerLogic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
use App\Classes\Modules\Delivery\ControllersLogic\CreateDeliveryOrderLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateDeliveryOrderController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateDeliveryOrderLogic $createDeliveryOrderLogic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateDeliveryOrderLogic $createDeliveryOrderLogic): JsonResponse
|
||||
{
|
||||
return $createDeliveryOrderLogic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsCustomers;
|
||||
use App\Classes\Modules\Exports\Services\ExportsMultipleDeliveryOrders;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
class ExportDeliveryOrdersToExcelController
|
||||
{
|
||||
|
||||
/**
|
||||
* ExportCustomersToExcelController constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
}
|
||||
|
||||
public function lineClear(Request $request){
|
||||
$exportsTransactions = new ExportsMultipleDeliveryOrders($request);
|
||||
$response = $exportsTransactions->download('line-clear-export.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Delivery;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Delivery\ControllersLogic\ListOrdersLogic;
|
||||
|
||||
|
||||
class ListOrdersController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListOrdersLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
|
||||
public function list(Request $request, ListOrdersLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Exports;
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsPendingArrangementDeliveryList;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
class ExportPendingArrangementPackingListController
|
||||
{
|
||||
/**
|
||||
* ExportPendingArrangementPackingListController constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
}
|
||||
|
||||
public function export(Request $request) {
|
||||
$exportsPendingArrangementDeliveryList = new ExportsPendingArrangementDeliveryList($request);
|
||||
$response = $exportsPendingArrangementDeliveryList->download('pending-arrangement-packing-list.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Notifications;
|
||||
|
||||
use App\Classes\Modules\Notifications\ControllersLogic\ListNotificationsLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListNotificationsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListNotificationsLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListNotificationsLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class DownloadOrderQrPdfController
|
||||
$warehousePrefix = '';
|
||||
$deliveryPrefix = '';
|
||||
$customerMarking = '';
|
||||
$remark = $warehouse->remarks()->first()->content;
|
||||
$remark = $warehouse->remarks()->first();
|
||||
|
||||
if($warehouse->reference === WarehouseReferences::VT_GUANG_ZHOU || $warehouse->reference === WarehouseReferences::VT_YIWU) {
|
||||
$customerMarking = $order->companyModule->connections()->first()->invitee_reference.'/';
|
||||
@@ -44,11 +44,11 @@ class DownloadOrderQrPdfController
|
||||
if($warehouse->reference === WarehouseReferences::YD_GUANG_ZHOU){
|
||||
$warehousePrefix = 'YD/';
|
||||
|
||||
if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan') {
|
||||
if(strtolower($deliveryAddress->state->name) === 'sabah' || strtolower($deliveryAddress->state->name) === 'labuan' || in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
|
||||
$warehousePrefix = 'KK/';
|
||||
}
|
||||
|
||||
if(strtolower($deliveryAddress->state->name) === 'sarawak') {
|
||||
if(strtolower($deliveryAddress->state->name) === 'sarawak' && !in_array(strtolower($deliveryAddress->district->name), ['limbang', 'lawas'])) {
|
||||
$warehousePrefix = 'KU/';
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class DownloadOrderQrPdfController
|
||||
'delivery_address' => $deliveryAddress,
|
||||
'warehouse_address' => $warehouseAddress,
|
||||
'warehouse_contacts' => $warehouseContacts,
|
||||
'remark' => $remark
|
||||
'remark' => $remark ? $remark->content : ''
|
||||
];
|
||||
|
||||
$pdf = LaravelMpdf::loadView('pdfs.qr', $data, [], [
|
||||
|
||||
@@ -200,4 +200,62 @@ class MonthlyReportController
|
||||
})->sum('quantity'),
|
||||
]]))->handler();
|
||||
}
|
||||
|
||||
public function customerActivityReport(Request $request): JsonResponse {
|
||||
|
||||
$active_start = $request->input('active_start');
|
||||
$active_end = $request->input('active_end');
|
||||
$inactive_start = $request->input('inactive_start');
|
||||
$inactive_end = $request->input('inactive_end');
|
||||
$minCbm = $request->input('cbm');
|
||||
$minOrders = $request->input('minOrders');
|
||||
|
||||
$activeCompanies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($inactive_start, $inactive_end) {
|
||||
return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($inactive_start, $inactive_end) {
|
||||
return $query->where('drop_date', '>=', \Carbon\Carbon::parse($inactive_start))->where('drop_date', '<=', \Carbon\Carbon::parse($inactive_end)->addDay());
|
||||
});
|
||||
})->pluck('id');
|
||||
|
||||
$companies = CompanyModule::where('type', \App\Classes\ValueObjects\Constants\BusinessType::IMPORTER)->whereHas('orderPackingLists', function($query) use($active_start, $active_end) {
|
||||
return $query->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->whereHas('transports', function ($query) use ($active_start, $active_end) {
|
||||
return $query->whereDate('drop_date', '>=', \Carbon\Carbon::parse($active_start))->whereDate('drop_date', '<=', \Carbon\Carbon::parse($active_end)->addDay());
|
||||
});
|
||||
})->whereNotIn('id', $activeCompanies)->get();
|
||||
|
||||
$customerActivityData = [];
|
||||
$counter = 1;
|
||||
|
||||
foreach ($companies as $key => $company){
|
||||
$connection = $company->inviters()->withPivot('invitee_reference')->first();
|
||||
$marking = $connection ? $connection->pivot->invitee_reference:'';
|
||||
$packingList = $company->orderPackingLists()->where('packing_lists.type', \App\Classes\ValueObjects\Constants\PackingListType::SHIPPING_PACKING_LIST)->get();
|
||||
$totalCbm = $packingList->flatMap(function ($packingList) {
|
||||
return $packingList->packages;
|
||||
})->sum(function($package){
|
||||
return (( (float) $package->width / 100) * ( (float) $package->length / 100) * ( (float) $package->height / 100)) * $package->quantity;
|
||||
});
|
||||
|
||||
if ($minCbm != 'null' && $totalCbm < $minCbm) { continue; }
|
||||
|
||||
if ($minOrders != 'null' && $packingList->count() < $minOrders) { continue; }
|
||||
|
||||
array_push($customerActivityData, array(
|
||||
'key' => $counter,
|
||||
'marking' => $marking,
|
||||
'packingListCount'=> $packingList->count(),
|
||||
'totalCbm'=> $totalCbm,
|
||||
));
|
||||
$counter ++;
|
||||
}
|
||||
|
||||
return (new ApiResponseObject('fetch service report Successful',
|
||||
'',
|
||||
HttpStatus::OK_WITH_MESSAGE, ['data' => [
|
||||
'active_start' => Carbon::parse($active_start)->format('d/m/Y'),
|
||||
'active_end' => Carbon::parse($active_end)->format('d/m/Y'),
|
||||
'inactive_start' => Carbon::parse($inactive_start)->format('d/m/Y'),
|
||||
'inactive_end' => Carbon::parse($inactive_end)->format('d/m/Y'),
|
||||
'customerActivityData' => $customerActivityData,
|
||||
]]))->handler();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Segments;
|
||||
|
||||
use App\Classes\Modules\Segments\ControllersLogic\UpdateConstantPostcodeLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateConstantPostcodeController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateConstantPostcodeLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateConstantPostcodeLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Segments;
|
||||
|
||||
use App\Classes\Modules\Segments\ControllersLogic\UpdateConstantStateLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateConstantStateController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateConstantStateLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateConstantStateLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class CompanyResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$companyModule = $this->companyModules()->where('type', '=', BusinessType::IMPORTER)->first();
|
||||
$companyModule = $this->companyModules()->first();
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'hash_id' => Crypt::encryptString($this->id),
|
||||
@@ -30,8 +30,8 @@ class CompanyResource extends JsonResource
|
||||
'contact' => new ContactResource ($this->when($this->has('contacts'), $this->contacts->first())),
|
||||
'employee' => new UserResource($companyModule->employees()->first()),
|
||||
'company_module' => new CompanyModuleResource($companyModule),
|
||||
'last_order' => new OrderResource($companyModule ? $companyModule->orders()->orderBy('id', 'DESC')->first(): null),
|
||||
'order_count' => $this->orders()->count(),
|
||||
'last_order' => $companyModule->type === 7 ? new DeliveryOrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()) : new OrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()),
|
||||
'order_count' => $companyModule->orders()->count(),
|
||||
'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])->first()),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
|
||||
|
||||
@@ -19,9 +19,8 @@ class ConstantResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'reference' => $this->reference,
|
||||
'detail' => (App()->make(ConvertsConstantDetailsToResource::class))->execute($this->resource)
|
||||
'value' => (App()->make(ConvertsConstantDetailsToResource::class))->execute($this->resource)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class DeliveryOrderResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'reference' => $this->reference,
|
||||
'type' => (int) $this->type,
|
||||
'status' => (int) $this->status,
|
||||
'company_module' => new CompanyModuleResource($this->companyModule),
|
||||
'sender_address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->where('type', AddressType::PICK_UP)->first()),
|
||||
'delivery_address' => new AddressResource($this->addresses()->where('status', '=', ApprovalStatus::APPROVED)->where('type', AddressType::DELIVERY)->first()),
|
||||
'packingList' => new DeliveryPackingListResource($this->packingLists()->first()),
|
||||
'remarks' => RemarkResource::collection($this->remarks),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Models\Order;
|
||||
use App\Models\PackingList;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class DeliveryPackingListResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$package = $this->packages()->first();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'claimant_id' => $this->claimant_id,
|
||||
'reference' => $this->reference,
|
||||
'status' => $this->status,
|
||||
'transport' => new TransportResource($this->transports()->first()),
|
||||
'type' => $package->type,
|
||||
'description' => $package->description,
|
||||
'weight' => (float) $package->weight,
|
||||
'quantity' => (float) $package->quantity,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
|
||||
class NotificationResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'long_ago' => $this->created_at->diffForHumans(),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class TransportResource extends JsonResource
|
||||
@@ -15,6 +16,7 @@ class TransportResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$currentSchedule = $this->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first();
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
@@ -23,8 +25,10 @@ class TransportResource extends JsonResource
|
||||
'dispatch_date' => $this->dispatch_date ? $this->dispatch_date->format('d-m-Y') : $this->dispatch_date,
|
||||
'drop_date' => $this->drop_date ? $this->drop_date->format('d-m-Y') : $this->drop_date,
|
||||
'status' => $this->status,
|
||||
'current_schedule' => new ScheduleResource($this->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()),
|
||||
'schedule_history' => ScheduleResource::collection($this->schedules()->where('status', '=', ApprovalStatus::EXPIRED)->get())
|
||||
'current_schedule' => new ScheduleResource($currentSchedule),
|
||||
'schedule_history' => ScheduleResource::collection($this->schedules()->where('status', '=', ApprovalStatus::EXPIRED)->get()),
|
||||
'dropped_days' => Carbon::now()->diffInDays($this->drop_date, false),
|
||||
'schedule_complete' => $currentSchedule ? $currentSchedule->eta <= Carbon::now() : false
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Steppable;
|
||||
use App\Classes\General\Interfaces\Transportable;
|
||||
use App\Classes\General\Interfaces\Packable;
|
||||
use App\Classes\General\Interfaces\Transactionable;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasManyDeep;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasRelationships;
|
||||
use Staudenmeir\EloquentHasManyDeep\HasTableAlias;
|
||||
|
||||
class Addon extends AbstractModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'addons';
|
||||
|
||||
protected $fillable = ['status'];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
||||
*/
|
||||
public function owner(): morphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,14 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable,
|
||||
return $this->morphMany(PackingList::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function addons(): morphMany
|
||||
{
|
||||
return $this->morphMany(Addon::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
|
||||
@@ -36,6 +36,14 @@ class PackingList extends AbstractModel implements Transportable, Steppable, Pac
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function addons(): morphMany
|
||||
{
|
||||
return $this->morphMany(Addon::class, 'owner');
|
||||
}
|
||||
|
||||
public function containers(): BelongsToMany
|
||||
{
|
||||
return $this->BelongsToMany(Container::class, ContainerPackingList::class);
|
||||
|
||||
+3
-1
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Tymon\JWTAuth\Contracts\JWTSubject;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
@@ -24,8 +25,9 @@ class User extends AbstractModel implements
|
||||
AuthorizableContract,
|
||||
CanResetPasswordContract
|
||||
{
|
||||
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail;
|
||||
use HasRoles, Notifiable, Authenticatable, Authorizable, CanResetPassword, MustVerifyEmail, SoftDeletes;
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
/**
|
||||
* Get the identifier that will be stored in the subject claim of the JWT.
|
||||
|
||||
@@ -18,7 +18,7 @@ class CreateTransactionDetailsTable extends Migration
|
||||
$table->foreignId('transaction_id')->unsigned();
|
||||
$table->string('reference');
|
||||
$table->string('name');
|
||||
$table->integer('quantity')->default(0);
|
||||
$table->decimal('quantity', 25, 5)->default(0.00);
|
||||
$table->decimal('price', 25, 5)->default(0.00);
|
||||
$table->decimal('amount', 25, 5)->default(0.00);
|
||||
$table->softDeletes();
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddDeletedAtToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAddonsTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('addons', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('owner');
|
||||
$table->string('reference',200);
|
||||
$table->integer('type')->default(0);
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->integer('status')->default(0);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('order_addons');
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
@@ -112,7 +113,7 @@ class CompaniesTableSeeder extends Seeder
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::FREIGHT_FORWARDER);
|
||||
|
||||
$address = new AddressObject('Malaysian Global Innovation & Creativity Center Level 1 CWS', 'Block 3730,Persiaran APEC', 1, 15, 402, 63000);
|
||||
$address = new AddressObject('Malaysian Global Innovation & Creativity Center Level 1 CWS', 'Block 3730,Persiaran APEC', 1, 15, 402, 63000, AddressType::BILLING, ApprovalStatus::APPROVED);
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
|
||||
$contact = new ContactObject('Office Number', '0182909252', '', '');
|
||||
@@ -131,22 +132,22 @@ class CompaniesTableSeeder extends Seeder
|
||||
|
||||
if ($name === 'Guangzhou'){
|
||||
$companyModule->update(['name' => $name, 'reference' => 'GZ-V01']);
|
||||
$address = new AddressObject('白云区,大朗南路 白云湖大道自编13号 7号仓库', '高德地图导航:广州市世通行', 2, 35, 633, 510450);
|
||||
$address = new AddressObject('白云区,大朗南路 白云湖大道自编13号 7号仓库', '高德地图导航:广州市世通行', 2, 35, 633, 510450, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$contact = new ContactObject('杨维民', '13600055019', '', '');
|
||||
} elseif ($name === 'Yiwu') {
|
||||
$companyModule->update(['name' => $name, 'reference' => 'YW-V01']);
|
||||
$address = new AddressObject('义乌市诚信大道义乌港A区2楼194号', '', 2, 27, 532, 322000);
|
||||
$address = new AddressObject('义乌市诚信大道义乌港A区2楼194号', '', 2, 27, 532, 322000, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$contact = new ContactObject('小曾', '13575982901', '', '');
|
||||
} elseif ($name === 'Klang') {
|
||||
$companyModule->update(['name' => $name, 'reference' => 'KL-V01']);
|
||||
$address = new AddressObject('LOT 1357 A, JALAN TANJUNG SHAWAL', 'KAMPUNG SUNGAI PINANG', 1, 15, 412, 41400);
|
||||
$address = new AddressObject('LOT 1357 A, JALAN TANJUNG SHAWAL', 'KAMPUNG SUNGAI PINANG', 1, 15, 412, 41400, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
$contact = new ContactObject('Mr. Yang', '0162237680', '', '');
|
||||
} elseif ($name === 'Sabah') {
|
||||
$companyModule->update(['name' => $name, 'reference' => 'SB-V01']);
|
||||
$address = new AddressObject('Warehouse A & B, No. 2, Lorong Kacang Tanah 1', 'Jalan Kolombong, Kolombong', 1, 13, 316, 88450);
|
||||
$address = new AddressObject('Warehouse A & B, No. 2, Lorong Kacang Tanah 1', 'Jalan Kolombong, Kolombong', 1, 13, 316, 88450, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
} elseif ($name === 'Sarawak') {
|
||||
$companyModule->update(['name' => $name, 'reference' => 'SRW-V01']);
|
||||
$address = new AddressObject('OPPOSITE HT POLE 51, LT 664 JALAN SUNGAI SALIM', '', 1, 14, 381, 96000);
|
||||
$address = new AddressObject('OPPOSITE HT POLE 51, LT 664 JALAN SUNGAI SALIM', '', 1, 14, 381, 96000, AddressType::DELIVERY, ApprovalStatus::APPROVED);
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +162,7 @@ class CompaniesTableSeeder extends Seeder
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, $businessType);
|
||||
|
||||
$address = new AddressObject('2, Jalan TSB 6, Taman Industri Sungai Buloh', '', 1, 15, 419, 47000);
|
||||
$address = new AddressObject('2, Jalan TSB 6, Taman Industri Sungai Buloh', '', 1, 15, 419, 47000, AddressType::BILLING, ApprovalStatus::APPROVED);
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
|
||||
$contact = new ContactObject('Office Number', '036148 8108', '', '');
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
|
||||
use App\Classes\Modules\Accounts\Services\CreatesUser;
|
||||
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
|
||||
use App\Classes\Modules\Addresses\Processors\CreateAddressFromOldAddressProcessor;
|
||||
use App\Classes\Modules\Addresses\Services\CreatesAddress;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
|
||||
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
|
||||
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
|
||||
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompany;
|
||||
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
|
||||
use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Company;
|
||||
|
||||
class LastMileDeliveryTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/** @var CreateCompanyProcessor */
|
||||
private $createCompanyProcessor;
|
||||
|
||||
/** @var UpdatesCompanyStatus*/
|
||||
private $updatesCompanyStatus;
|
||||
|
||||
/** @var CreateCompanyModuleProcessor */
|
||||
private $createCompanyModuleProcessor;
|
||||
|
||||
/** @var CreateContactProcessor */
|
||||
private $createContactProcessor;
|
||||
|
||||
/** @var CreatesCompanyConnection */
|
||||
private $createsCompanyConnection;
|
||||
|
||||
/** @var ApprovesCompanyConnection */
|
||||
private $approvesCompanyConnection;
|
||||
|
||||
/** @var CreateAddressFromOldAddressProcessor */
|
||||
private $createAddressFromOldAddressProcessor;
|
||||
|
||||
/** @var CreatesAddress */
|
||||
private $createsAddress;
|
||||
|
||||
/** @var CreatesCompany */
|
||||
private $createsCompany;
|
||||
|
||||
/** @var CreatesContact */
|
||||
private $createsContact;
|
||||
|
||||
/** @var CreatesUser */
|
||||
private $createsUser;
|
||||
|
||||
/** @var AssignEmployeeProcessor */
|
||||
private $assignEmployeeProcessor;
|
||||
|
||||
/**
|
||||
* LastMileDeliveryTableSeeder constructor.
|
||||
* @param CreateCompanyProcessor $createCompanyProcessor
|
||||
* @param UpdatesCompanyStatus $updatesCompanyStatus
|
||||
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
|
||||
* @param CreateContactProcessor $createContactProcessor
|
||||
* @param CreatesCompanyConnection $createsCompanyConnection
|
||||
* @param ApprovesCompanyConnection $approvesCompanyConnection
|
||||
* @param CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor
|
||||
* @param CreatesAddress $createsAddress
|
||||
* @param CreatesCompany $createsCompany
|
||||
* @param CreatesContact $createsContact
|
||||
* @param CreatesUser $createsUser
|
||||
* @param AssignEmployeeProcessor $assignEmployeeProcessor
|
||||
*/
|
||||
public function __construct(CreateCompanyProcessor $createCompanyProcessor, UpdatesCompanyStatus $updatesCompanyStatus, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor, CreatesAddress $createsAddress, CreatesCompany $createsCompany, CreatesContact $createsContact, CreatesUser $createsUser, AssignEmployeeProcessor $assignEmployeeProcessor)
|
||||
{
|
||||
$this->createCompanyProcessor = $createCompanyProcessor;
|
||||
$this->updatesCompanyStatus = $updatesCompanyStatus;
|
||||
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
|
||||
$this->createContactProcessor = $createContactProcessor;
|
||||
$this->createsCompanyConnection = $createsCompanyConnection;
|
||||
$this->approvesCompanyConnection = $approvesCompanyConnection;
|
||||
$this->createAddressFromOldAddressProcessor = $createAddressFromOldAddressProcessor;
|
||||
$this->createsAddress = $createsAddress;
|
||||
$this->createsCompany = $createsCompany;
|
||||
$this->createsContact = $createsContact;
|
||||
$this->createsUser = $createsUser;
|
||||
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
$companies = [
|
||||
new CompanyObject('Last Mile Delivery', 'LMD', CompanyType::COMPANY_BUSINESS, ApprovalStatus::APPROVED),
|
||||
];
|
||||
|
||||
|
||||
foreach ($companies as $companyObject) {
|
||||
|
||||
/** @var Company $company */
|
||||
$company = $this->createsCompany->execute($companyObject);
|
||||
|
||||
/** @var CompanyModule $companyModule */
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::LAST_MILE_DELIVERY_AGENT);
|
||||
|
||||
$address = new AddressObject('B-39-13, Menara Simfoni, Jalan Simfoni 2, Balakong', 'Block 3730,Persiaran APEC', 1, 15, 432, 43300, AddressType::BILLING, ApprovalStatus::APPROVED);
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
|
||||
$contact = new ContactObject('Office Number', '01155543194', '', '');
|
||||
$this->createsContact->execute($companyModule, $contact);
|
||||
|
||||
$user_object = new RegistrationObject('CQ', 'hywavetech168@gmail.com', 'FIzxqcZFFob7btVLEfWC', 'FIzxqcZFFob7btVLEfWC', RoleTypes::USER, ApprovalStatus::APPROVED);
|
||||
|
||||
/** @var User $user */
|
||||
$user = $this->createsUser->execute($user_object);
|
||||
|
||||
$Object = new EmploymentObject($companyModule, $user);
|
||||
$this->assignEmployeeProcessor->execute($Object);
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
@@ -106,7 +107,7 @@ class ModernWarehouseTableSeeder extends Seeder
|
||||
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
|
||||
$companyModule->update(['name' => 'Yiwu', 'reference' => 'YW-V02']);
|
||||
|
||||
$address = new AddressObject('义乌市 后宅街道 起航路233号百汇科创园园区里面', '(进口处进来第一个路口左转至出口处右手边国际物流仓库)', 2, 27, 532, 322000);
|
||||
$address = new AddressObject('义乌市 后宅街道 起航路233号百汇科创园园区里面', '(进口处进来第一个路口左转至出口处右手边国际物流仓库)', 2, 27, 532, 322000, AddressType::BILLING, ApprovalStatus::APPROVED);
|
||||
$contact = new ContactObject('韩成名', '18058489899 / 18058929899', '', '');
|
||||
|
||||
$this->createsAddress->execute($companyModule, $address);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 50 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
@@ -317,12 +317,6 @@ hr{
|
||||
background-color: $color-primary-lighter !important;
|
||||
}
|
||||
|
||||
.bg-primary-lighter-hover {
|
||||
&:hover {
|
||||
background-color: $color-primary-lighter !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Complete
|
||||
------------------------------------
|
||||
*/
|
||||
|
||||
@@ -67,11 +67,11 @@
|
||||
this.submit(this.route('api.account.authentication.logout'), 'get', this.section, false, false)
|
||||
},
|
||||
successHandler(){
|
||||
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: this.route('login')});
|
||||
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: [7, 8].includes(this.$store.getters.getCompanyModuleType) ? this.route('last_mile_delivery.login') : this.route('login') });
|
||||
this.$store.dispatch('updateIfCreateNewOrder','');
|
||||
},
|
||||
errorHandler(){
|
||||
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: this.route('login')});
|
||||
this.$store.dispatch('userAuthentication', {access_token: '', redirect_url: [7, 8].includes(this.$store.getters.getCompanyModuleType) ? this.route('last_mile_delivery.login') : this.route('login') });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
<div class="row m-t-15 align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="btn btn-block btn-lg btn-primary b-rad-none no-border" @click="submitForm">Sign In</div>
|
||||
<div class="btn btn-block btn-lg b-rad-none no-border" :class="[{'btn-primary': currentUrl.indexOf('last_mile_delivery') === -1 }, {'btn-info': currentUrl.indexOf('last_mile_delivery') > -1 }]" @click="submitForm">Sign In</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-15">
|
||||
@@ -55,7 +55,8 @@
|
||||
parameters: {
|
||||
email: this.email,
|
||||
password: ''
|
||||
}
|
||||
},
|
||||
currentUrl: window.location.href,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row text-left" @keyup.enter="submitForm">
|
||||
<div class="col">
|
||||
<error-message-component class="m-b-20" :error="error"></error-message-component>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-15">
|
||||
<div class="col p-r-5">
|
||||
<validation-wrapper-component :validator="$v.parameters.name">
|
||||
<label>Full Name</label>
|
||||
<input class="form-control" v-model="parameters.name">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<validation-wrapper-component :validator="$v.parameters.phone">
|
||||
<label>Phone</label>
|
||||
<input class="form-control" v-model="parameters.phone">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.email">
|
||||
<label>Email</label>
|
||||
<input class="form-control" v-model="parameters.email">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m-b-15">
|
||||
<div class="col p-r-5">
|
||||
<validation-wrapper-component :validator="$v.parameters.password">
|
||||
<label>Password</label>
|
||||
<input class="form-control" type="password" v-model="parameters.password">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<validation-wrapper-component :validator="$v.parameters.password_confirmation">
|
||||
<label>Password Confirmation</label>
|
||||
<input class="form-control" type="password" v-model="parameters.password_confirmation">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<button type="button" class="btn btn-sm p-t-10 p-b-10 btn-default bg-master-lighter b-rad-none" @click="$store.dispatch('toggleSection', {name: 'registrationForm', status: false})">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-auto p-r-10">
|
||||
<i class="fa fa-angle-left fs-16" style="margin-top: 1px;"></i>
|
||||
</div>
|
||||
<div class="col p-l-5">I already have an account</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<button type="button" class="btn btn-sm btn-block p-t-10 p-b-10 p-r-35 p-l-35 b-rad-none p-r-30" :class="[{'btn-primary': currentUrl.indexOf('last_mile_delivery') === -1 }, {'btn-info': currentUrl.indexOf('last_mile_delivery') > -1 }]" @click="submitForm()">
|
||||
<div class="row align-items-center">
|
||||
<div class="col p-r-5">Sign Up</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import registrationFormValidation from '../../../general/mixins/accounts/validation/newRegistrationFormValidation';
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
error: '',
|
||||
step: 1,
|
||||
parameters : {
|
||||
name: '',
|
||||
email: '',
|
||||
type: 1,
|
||||
phone: '',
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
},
|
||||
currentUrl: window.location.href,
|
||||
status:{
|
||||
direction:null,
|
||||
},
|
||||
watchCheckEmail:null
|
||||
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
submitForm(){
|
||||
this.submit(this.route('api.delivery.account.registration.register'), 'post', this.section, false, false);
|
||||
}
|
||||
},
|
||||
mixins: [registrationFormValidation]
|
||||
}
|
||||
</script>
|
||||
@@ -6,7 +6,7 @@
|
||||
<error-message-component class="m-b-20" :error="error"></error-message-component>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row" v-show="step === 1">
|
||||
<div class="row" v-show="step === 1">
|
||||
<div class="col">
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
@@ -304,4 +304,4 @@
|
||||
},
|
||||
mixins: [registrationFormValidation]
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
@@ -36,10 +36,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteAddress">
|
||||
<delete-address-form-component :data="item" section="addressList" class="text-center"></delete-address-form-component>
|
||||
<delete-address-form-component :data="item" :section="section" class="text-center"></delete-address-form-component>
|
||||
</modal-component>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="defaultAddress">
|
||||
<set-default-address-form-component :data="item" section="addressList" class="text-center"></set-default-address-form-component>
|
||||
<set-default-address-form-component :data="item" :section="section" class="text-center"></set-default-address-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,7 +51,11 @@
|
||||
props: {
|
||||
value: {
|
||||
required: false
|
||||
},
|
||||
'section': {
|
||||
type: String,
|
||||
}
|
||||
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||
<validation-wrapper-component selecatable :validator="$v.parameters.district_id">
|
||||
<validation-wrapper-component selectable :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>
|
||||
@@ -93,6 +93,10 @@
|
||||
id: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 2
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -104,6 +108,7 @@
|
||||
street_two: '',
|
||||
district_id: '',
|
||||
post_code: '',
|
||||
type: this.type,
|
||||
remark: '',
|
||||
phone: '',
|
||||
person_in_charge: '',
|
||||
@@ -118,6 +123,7 @@
|
||||
this.parameters.street_two = this.data.street_two;
|
||||
this.parameters.district_id = this.data.district.id;
|
||||
this.parameters.post_code = this.data.post_code;
|
||||
this.parameters.type = this.data.type;
|
||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : '';
|
||||
this.parameters.person_in_charge = this.data.contact ? this.data.contact.reference : '';
|
||||
this.parameters.remark = this.data.remark ? this.data.remark.content : '';
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin bold">{{item.contact.reference}}</p>
|
||||
<p class="no-margin">{{item.contact.phone}}</p>
|
||||
<p class="no-margin">{{item.street_one+' '+(item.street_two ? item.street_two : '')+', '+ item.district.name+', '+item.post_code+' '+item.state.name+', '+item.country.name}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
export default {
|
||||
mixins: [componentHandler]
|
||||
}
|
||||
</script>
|
||||
+22
-1
@@ -137,7 +137,28 @@
|
||||
</button>
|
||||
</div>
|
||||
<modal-component small type="rejectDocument">
|
||||
<reject-identification-verification-form-component :section="section" :data="item"></reject-identification-verification-form-component>
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Reject Document</h5>
|
||||
<div class="fs-11">Are you sure you want to reject this customer's identification?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-danger btn-block b-rad-none" @click="approveDocument('reject')">Reject</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
<div class="col no-padding ml-auto">
|
||||
<button class="btn btn-md btn-block btn-success b-rad-none p-t-10 p-b-10 requestModal" data-type="approveDocument">
|
||||
|
||||
-82
@@ -1,82 +0,0 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-auto text-center">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Reject Document</h5>
|
||||
<div class="fs-11">Are you sure you want to reject this customer's identification?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-left margin-auto m-t-10 m-b-10">
|
||||
<div class="col">
|
||||
<span class="text-danger fs-9">{{ error }}</span>
|
||||
<div class="fs-11">Reason: </div>
|
||||
<div class="row">
|
||||
<div class="col fs-11">
|
||||
<div class="b-a padding-5 w-100 m-b-5 pointer b-grey muted" :class="{'b-primary': parameters.rejectRemark === rejectRemarkItem, 'text-primary': parameters.rejectRemark === rejectRemarkItem}" v-for="rejectRemarkItem in rejectRemarkArray" @click="chooseRejectRemark(rejectRemarkItem)">{{ rejectRemarkItem }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-danger btn-block b-rad-none" @click="approveDocument('reject')">Reject</div>
|
||||
</div>
|
||||
</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: {
|
||||
rejectRemark: null,
|
||||
},
|
||||
rejectRemarkArray: null,
|
||||
documentType: this.data.document_type === 'IDENTITY_CARD' ? 'IC' : 'SSM',
|
||||
error: null,
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
rejectRemark: { required },
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.rejectRemarkArray = [
|
||||
this.documentType + ' not clear',
|
||||
this.documentType + ' name different with registration name',
|
||||
'Wrong Document uploaded',
|
||||
'Non-Malaysian ' + this.documentType + ' Uploaded',
|
||||
this.documentType + ' not Genuine'
|
||||
];
|
||||
},
|
||||
methods: {
|
||||
approveDocument(status){
|
||||
this.parameters.rejectRemark === null ? this.error = 'Please choose a remark.' : null;
|
||||
this.isLoading = true;
|
||||
this.submit(this.route('api.company.identification.approval', this.item.owner.id, this.item.id, status), 'put', 'identificationVerificationSection', true, true);
|
||||
},
|
||||
chooseRejectRemark(remark) {
|
||||
this.parameters.rejectRemark = remark;
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler, modalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
+2
@@ -11,6 +11,7 @@
|
||||
<on-boarding-section-component v-if="!company.last_order"></on-boarding-section-component>
|
||||
<div class="row" v-if="company.last_order">
|
||||
<div class="col">
|
||||
<!-- new swction -->
|
||||
<div class="row tabsContainer">
|
||||
<div class="col no-padding">
|
||||
<div class="row m-l-0 m-r-0">
|
||||
@@ -126,6 +127,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end new swction -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+3
-3
@@ -8,8 +8,8 @@
|
||||
</div>
|
||||
<div class="row" v-show="!$store.getters.isShowing('createOrderForm')">
|
||||
<div class="col">
|
||||
<on-boarding-section-component v-if="!company.last_order"></on-boarding-section-component>
|
||||
<div class="row" v-if="company.last_order">
|
||||
<on-boarding-section-component v-if="company.last_order && company.status === 0"></on-boarding-section-component>
|
||||
<div class="row" v-if="company.last_order && company.status !== 0">
|
||||
<div class="col">
|
||||
<div class="row m-b-30 relative">
|
||||
<div class="col">
|
||||
@@ -67,7 +67,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<order-form-component v-show="$store.getters.isShowing('createOrderForm')" :company="company" :section="section"></order-form-component>
|
||||
<order-form-component v-show="$store.getters.isShowing('createOrderForm') || (!company.last_order && company.status === 0)" :company="company" :section="section"></order-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
+106
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user