mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 04:24:00 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\FreightForwarder\Services\DeletesServiceFees;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class DeleteServiceFeesLogic
|
||||
{
|
||||
/** @var DeletesServiceFees */
|
||||
private $deletesServiceFees;
|
||||
|
||||
/**
|
||||
* DeleteServiceFeesLogic constructor.
|
||||
* @param DeletesServiceFees $deletesServiceFees
|
||||
*/
|
||||
public function __construct(DeletesServiceFees $deletesServiceFees)
|
||||
{
|
||||
$this->deletesServiceFees = $deletesServiceFees;
|
||||
}
|
||||
|
||||
public function execute(String $serviceId){
|
||||
|
||||
try{
|
||||
return $this->deletesServiceFees->execute($serviceId);
|
||||
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
|
||||
throw new InternalServerErrorException("Failed to delete Customer Relation because{$exception->getMessage()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\FreightForwarder\DataTransferObjects\CustomerRelationObject;
|
||||
use App\Classes\Modules\FreightForwarder\Services\UpdatesCustomerRelation;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCustomerRelationLogic
|
||||
{
|
||||
/** @var UpdatesCustomerRelation */
|
||||
private $updatesCustomerRelation;
|
||||
|
||||
/**
|
||||
* UpdateCustomerRelationLogic constructor.
|
||||
* @param UpdatesCustomerRelation $updatesCustomerRelation
|
||||
*/
|
||||
public function __construct(UpdatesCustomerRelation $updatesCustomerRelation)
|
||||
{
|
||||
$this->updatesCustomerRelation = $updatesCustomerRelation;
|
||||
}
|
||||
|
||||
public function execute(Request $request){
|
||||
|
||||
try{
|
||||
|
||||
$object = new CustomerRelationObject($request->input('forwarder_id'), $request->input('company_id'), $request->input('customer_rate'), $request->input('wave'));
|
||||
return $this->updatesCustomerRelation->execute($object);
|
||||
return new JsonResponse([], HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to update Customer Relation because{$exception->getMessage()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\FreightForwarder\DataTransferObjects\FreightForwarderObject;
|
||||
use App\Classes\Modules\FreightForwarder\Services\UpdatesFreightForwarder;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateFreightForwarderLogic
|
||||
{
|
||||
/** @var UpdatesFreightForwarder */
|
||||
private $updatesFreightForwarder;
|
||||
|
||||
/**
|
||||
* UpdateFreightForwarderLogic constructor.
|
||||
* @param UpdatesFreightForwarder $updatesFreightForwarder
|
||||
*/
|
||||
public function __construct(UpdatesFreightForwarder $updatesFreightForwarder)
|
||||
{
|
||||
$this->updatesFreightForwarder = $updatesFreightForwarder;
|
||||
}
|
||||
|
||||
|
||||
public function execute(String $forwarderId, Request $request){
|
||||
|
||||
try{
|
||||
$object = new FreightForwarderObject(null, null, null, null, null, null,null, null, $request->input('shipping_rate'), $request->input('overdue_days'), $request->input('markup_percentage'), $request->input('minimum_cbm'));
|
||||
return $this->updatesFreightForwarder->execute($forwarderId, $object);
|
||||
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
|
||||
throw new InternalServerErrorException("Failed to update Freight Forwarder because{$exception->getMessage()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 18/07/2019
|
||||
* Time: 4:45 PM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\FreightForwarder\DataTransferObjects\ServiceObject;
|
||||
use App\Classes\Modules\FreightForwarder\Services\UpdatesServiceFees;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateServiceFeesLogic
|
||||
{
|
||||
/** @var UpdatesServiceFees */
|
||||
private $updatesServiceFees;
|
||||
|
||||
/**
|
||||
* UpdateServiceFeesLogic constructor.
|
||||
* @param UpdatesServiceFees $updatesServiceFees
|
||||
*/
|
||||
public function __construct(UpdatesServiceFees $updatesServiceFees)
|
||||
{
|
||||
$this->updatesServiceFees = $updatesServiceFees;
|
||||
}
|
||||
|
||||
|
||||
public function execute(Request $request){
|
||||
try{
|
||||
$object = new ServiceObject($request->input('type'), $request->input('forwarder_id'), $request->input('name'), $request->input('description'), $request->input('cost'));
|
||||
return $this->updatesServiceFees->execute($request->input('id'), $object);
|
||||
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
}catch (\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to update Service Fees because{$exception->getMessage()}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 18/06/2019
|
||||
* Time: 10:10 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Orders;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\Services\DeletesOrderSchedule;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class DeleteOrderScheduleLogic
|
||||
{
|
||||
/** @var DeletesOrderSchedule */
|
||||
private $deletesOrderSchedule;
|
||||
|
||||
/**
|
||||
* DeleteOrderScheduleLogic constructor.
|
||||
* @param DeletesOrderSchedule $deletesOrderSchedule
|
||||
*/
|
||||
public function __construct(DeletesOrderSchedule $deletesOrderSchedule)
|
||||
{
|
||||
$this->deletesOrderSchedule = $deletesOrderSchedule;
|
||||
}
|
||||
|
||||
|
||||
public function execute(String $scheduleId){
|
||||
|
||||
try{
|
||||
return $this->deletesOrderSchedule->execute($scheduleId);
|
||||
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to delete schedule because {$exception->getMessage()}");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 17/06/2019
|
||||
* Time: 10:18 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\ControllersLogic\Orders;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\ScheduleObject;
|
||||
use App\Classes\Modules\Orders\Services\UpdateOrderSchedule;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateOrderScheduleLogic
|
||||
{
|
||||
/** @var UpdateOrderSchedule */
|
||||
private $updateOrderSchedule;
|
||||
|
||||
/**
|
||||
* UpdateOrderScheduleLogic constructor.
|
||||
* @param UpdateOrderSchedule $updateOrderSchedule
|
||||
*/
|
||||
public function __construct(UpdateOrderSchedule $updateOrderSchedule)
|
||||
{
|
||||
$this->updateOrderSchedule = $updateOrderSchedule;
|
||||
}
|
||||
|
||||
public function execute(String $scheduleId, Request $request){
|
||||
|
||||
try{
|
||||
$scheduleObject = new ScheduleObject($request->input('ETA'), $request->input('ETD'),
|
||||
$request->input('type'), $request->input('issue_remark'));
|
||||
|
||||
return $this->updateOrderSchedule->execute($scheduleId,$scheduleObject);
|
||||
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to update schedule because {$exception->getMessage()}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\DataTransferObjects;
|
||||
|
||||
|
||||
class CustomerRelationObject
|
||||
{
|
||||
/** @var int|null */
|
||||
private $forwarderId;
|
||||
|
||||
/** @var int|null */
|
||||
private $companyId;
|
||||
|
||||
/** @var float|null */
|
||||
private $customer_rate;
|
||||
|
||||
/** @var boolean|null */
|
||||
private $wave;
|
||||
|
||||
/**
|
||||
* CustomerRelationObject constructor.
|
||||
* @param int|null $forwarderId
|
||||
* @param int|null $companyId
|
||||
* @param float|null $customer_rate
|
||||
* @param bool|null $wave
|
||||
*/
|
||||
public function __construct(?int $forwarderId = null, ?int $companyId = null, ?float $customer_rate = null, ?bool $wave = null)
|
||||
{
|
||||
$this->forwarderId = $forwarderId;
|
||||
$this->companyId = $companyId;
|
||||
$this->customer_rate = $customer_rate;
|
||||
$this->wave = $wave;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getForwarderId(): ?int
|
||||
{
|
||||
return $this->forwarderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getCompanyId(): ?int
|
||||
{
|
||||
return $this->companyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
public function getCustomerRate(): ?float
|
||||
{
|
||||
return $this->customer_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool|null
|
||||
*/
|
||||
public function getWave(): ?bool
|
||||
{
|
||||
return $this->wave;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\DataTransferObjects;
|
||||
|
||||
class FreightForwarderObject
|
||||
{
|
||||
/** @var string|null */
|
||||
private $name;
|
||||
|
||||
/** @var string|null */
|
||||
private $email;
|
||||
|
||||
/** @var string|null */
|
||||
private $street_one;
|
||||
|
||||
/** @var string|null */
|
||||
private $street_two;
|
||||
|
||||
/** @var string|null */
|
||||
private $city;
|
||||
|
||||
/** @var string|null */
|
||||
private $state;
|
||||
|
||||
/** @var string|null */
|
||||
private $post_code;
|
||||
|
||||
/** @var string|null */
|
||||
private $country;
|
||||
|
||||
/** @var float|null */
|
||||
private $shipping_rate;
|
||||
|
||||
/** @var int|null */
|
||||
private $overdue_days;
|
||||
|
||||
/** @var float|null */
|
||||
private $markup_percentage;
|
||||
|
||||
/** @var float|null */
|
||||
private $minimum_cbm;
|
||||
|
||||
/**
|
||||
* FreightForwarderObject constructor.
|
||||
* @param null|string $name
|
||||
* @param null|string $email
|
||||
* @param null|string $street_one
|
||||
* @param null|string $street_two
|
||||
* @param null|string $city
|
||||
* @param null|string $state
|
||||
* @param null|string $post_code
|
||||
* @param null|string $country
|
||||
* @param float|null $shipping_rate
|
||||
* @param int|null $overdue_days
|
||||
* @param float|null $markup_percentage
|
||||
* @param float|null $minimum_cbm
|
||||
*/
|
||||
public function __construct(?string $name = null, ?string $email = null, ?string $street_one = null, ?string $street_two = null, ?string $city = null, ?string $state = null, ?string $post_code = null, ?string $country = null, ?float $shipping_rate = null, ?int $overdue_days = null, ?float $markup_percentage = null, ?float $minimum_cbm = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->email = $email;
|
||||
$this->street_one = $street_one;
|
||||
$this->street_two = $street_two;
|
||||
$this->city = $city;
|
||||
$this->state = $state;
|
||||
$this->post_code = $post_code;
|
||||
$this->country = $country;
|
||||
$this->shipping_rate = $shipping_rate;
|
||||
$this->overdue_days = $overdue_days;
|
||||
$this->markup_percentage = $markup_percentage;
|
||||
$this->minimum_cbm = $minimum_cbm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getStreetOne(): ?string
|
||||
{
|
||||
return $this->street_one;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getStreetTwo(): ?string
|
||||
{
|
||||
return $this->street_two;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCity(): ?string
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getState(): ?string
|
||||
{
|
||||
return $this->state;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getPostCode(): ?string
|
||||
{
|
||||
return $this->post_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|string
|
||||
*/
|
||||
public function getCountry(): ?string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
public function getShippingRate(): ?float
|
||||
{
|
||||
return $this->shipping_rate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getOverdueDays(): ?int
|
||||
{
|
||||
return $this->overdue_days;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
public function getMarkupPercentage(): ?float
|
||||
{
|
||||
return $this->markup_percentage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
public function getMinimumCbm(): ?float
|
||||
{
|
||||
return $this->minimum_cbm;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 18/07/2019
|
||||
* Time: 12:19 PM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\DataTransferObjects;
|
||||
|
||||
|
||||
class ServiceObject
|
||||
{
|
||||
/** @var int|null */
|
||||
private $type;
|
||||
|
||||
/** @var int|null */
|
||||
private $forwarderId;
|
||||
|
||||
/** @var String|null */
|
||||
private $name;
|
||||
|
||||
/** @var String|null */
|
||||
private $description;
|
||||
|
||||
/** @var float|null */
|
||||
private $cost;
|
||||
|
||||
/**
|
||||
* ServiceObject constructor.
|
||||
* @param null|int $type
|
||||
* @param int|null $forwarderId
|
||||
* @param null|String $name
|
||||
* @param null|String $description
|
||||
* @param float|null $cost
|
||||
*/
|
||||
public function __construct(?int $type = null, ?int $forwarderId = null, ?string $name = null, ?string $description = null, ?float $cost = null)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->forwarderId = $forwarderId;
|
||||
$this->name = $name;
|
||||
$this->description = $description;
|
||||
$this->cost = $cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|int
|
||||
*/
|
||||
public function getType(): ?int
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getForwarderId(): ?int
|
||||
{
|
||||
return $this->forwarderId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|String
|
||||
*/
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|String
|
||||
*/
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float|null
|
||||
*/
|
||||
public function getCost(): ?float
|
||||
{
|
||||
return $this->cost;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Models\ServiceFees;
|
||||
|
||||
class DeletesServiceFees
|
||||
{
|
||||
/** @var ServiceFees */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* DeletesServiceFees constructor.
|
||||
* @param ServiceFees $repository
|
||||
*/
|
||||
public function __construct(ServiceFees $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(String $serviceId){
|
||||
try{
|
||||
|
||||
$repository = $this->repository->findOrFail($serviceId);
|
||||
$repository->delete();
|
||||
|
||||
}catch(\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to delete Customer Relation because{$exception->getMessage()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\Services;
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\FreightForwarder\DataTransferObjects\CustomerRelationObject;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Models\CustomerRelation;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class UpdatesCustomerRelation
|
||||
{
|
||||
/** @var CustomerRelation */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* UpdatesCustomerRelation constructor.
|
||||
* @param CustomerRelation $repository
|
||||
*/
|
||||
public function __construct(CustomerRelation $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(CustomerRelationObject $customerRelationObject){
|
||||
|
||||
try{
|
||||
$this->repository->updateOrCreate(
|
||||
[
|
||||
'forwarder_id' => $customerRelationObject->getForwarderId(),
|
||||
'company_id' => $customerRelationObject->getCompanyId(),
|
||||
],
|
||||
[
|
||||
'customer_rate' => $customerRelationObject->getCustomerRate(),
|
||||
'wave' => $customerRelationObject->getWave(),
|
||||
]);
|
||||
|
||||
return new JsonResponse([],HttpStatus::OK);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to update Customer Relation because {$exception->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\Services;
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\FreightForwarder\DataTransferObjects\FreightForwarderObject;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Models\Forwarder;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class UpdatesFreightForwarder
|
||||
{
|
||||
/** @var Forwarder */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* UpdatesFreightForwarder constructor.
|
||||
* @param Forwarder $repository
|
||||
*/
|
||||
public function __construct(Forwarder $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
public function execute(String $forwarderId, FreightForwarderObject $forwarderObject){
|
||||
|
||||
try{
|
||||
$repository = $this->repository->findOrFail($forwarderId);
|
||||
$repository->shipping_rate = $forwarderObject->getShippingRate();
|
||||
$repository->overdue_days = $forwarderObject->getOverdueDays();
|
||||
$repository->markup_percentage = $forwarderObject->getMarkupPercentage();
|
||||
$repository->minimum_cbm = $forwarderObject->getMinimumCbm();
|
||||
$repository->save();
|
||||
return new JsonResponse([],HttpStatus::OK);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to update Freight Forwarder because {$exception->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 18/07/2019
|
||||
* Time: 4:46 PM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\FreightForwarder\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\FreightForwarder\DataTransferObjects\ServiceObject;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Models\ServiceFees;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class UpdatesServiceFees
|
||||
{
|
||||
/** @var ServiceFees */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* UpdatesServiceFees constructor.
|
||||
* @param ServiceFees $repository
|
||||
*/
|
||||
public function __construct(ServiceFees $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
public function execute(?String $serviceId = null, ServiceObject $serviceObject){
|
||||
try{
|
||||
$this->repository->updateOrCreate(
|
||||
[
|
||||
'id' => $serviceId,
|
||||
],
|
||||
[
|
||||
'name' => $serviceObject->getName(),
|
||||
'type' => $serviceObject->getType(),
|
||||
'description' => $serviceObject->getDescription(),
|
||||
'cost' => $serviceObject->getCost(),
|
||||
'forwarder_id' => $serviceObject->getForwarderId(),
|
||||
]);
|
||||
|
||||
return new JsonResponse([],HttpStatus::OK);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
|
||||
throw new InternalServerErrorException("Failed to update Service Fees because {$exception->getMessage()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 18/06/2019
|
||||
* Time: 10:11 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\Orders\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Models\Schedule;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class DeletesOrderSchedule
|
||||
{
|
||||
/** @var Schedule */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* DeletesOrderSchedule constructor.
|
||||
* @param Schedule $repository
|
||||
*/
|
||||
public function __construct(Schedule $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(String $scheduleId){
|
||||
|
||||
try{
|
||||
$schedule = $this->repository->findOrfail($scheduleId);
|
||||
$schedule -> delete();
|
||||
return new JsonResponse([],HttpStatus::OK);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to delete schedule because {$exception->getMessage()}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 17/06/2019
|
||||
* Time: 10:28 AM
|
||||
*/
|
||||
|
||||
namespace App\Classes\Modules\Orders\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\ScheduleObject;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Models\Schedule;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateOrderSchedule
|
||||
{
|
||||
/** @var Schedule */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* UpdateOrderSchedule constructor.
|
||||
* @param Schedule $repository
|
||||
*/
|
||||
public function __construct(Schedule $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function execute(String $scheduleId, ScheduleObject $schedule){
|
||||
try{
|
||||
|
||||
$repository = $this->repository->findOrFail($scheduleId);
|
||||
$repository->ETD = $schedule->getETD();
|
||||
$repository->ETA = $schedule->getETA();
|
||||
$repository->issue_remark = $schedule->getIssue();
|
||||
$repository->save();
|
||||
return new JsonResponse([],HttpStatus::OK);
|
||||
|
||||
}catch(\Exception $exception){
|
||||
throw new InternalServerErrorException("Failed to update schedule because {$exception->getMessage()}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\FreightForwarder;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\FreightForwarder\DeleteServiceFeesLogic;
|
||||
|
||||
class DeleteServiceFeesController
|
||||
{
|
||||
public function delete(String $serviceId, DeleteServiceFeesLogic $logic){
|
||||
return $logic->execute($serviceId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\FreightForwarder;
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\FreightForwarder\UpdateCustomerRelationLogic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCustomerRelationController
|
||||
{
|
||||
public function update(Request $request, UpdateCustomerRelationLogic $logic){
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\FreightForwarder;
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\FreightForwarder\UpdateFreightForwarderLogic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateFreightForwarderController
|
||||
{
|
||||
public function update(String $forwarderId,Request $request, UpdateFreightForwarderLogic $logic){
|
||||
return $logic->execute($forwarderId, $request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 18/07/2019
|
||||
* Time: 4:43 PM
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\FreightForwarder;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\FreightForwarder\UpdateServiceFeesLogic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateServiceFeesController
|
||||
{
|
||||
public function update(Request $request, UpdateServiceFeesLogic $logic){
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 18/06/2019
|
||||
* Time: 10:09 AM
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Orders;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\Orders\DeleteOrderScheduleLogic;
|
||||
|
||||
class DeleteOrderScheduleController
|
||||
{
|
||||
public function delete(String $scheduleId, DeleteOrderScheduleLogic $logic){
|
||||
return $logic->execute($scheduleId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: mhmj
|
||||
* Date: 17/06/2019
|
||||
* Time: 10:17 AM
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Orders;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\Orders\UpdateOrderScheduleLogic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateOrderScheduleController
|
||||
{
|
||||
public function update(String $scheduleId, Request $request, UpdateOrderScheduleLogic $logic){
|
||||
return $logic->execute($scheduleId,$request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ class Schedule extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => (int)$this->id,
|
||||
'ETD' => carbon::parse($this->ETD)->format('d-m-Y'),
|
||||
'ETA' => carbon::parse($this->ETA)->format('d-m-Y'),
|
||||
'status' => (int)$this->status,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class CustomerRelation extends AbstractModel
|
||||
{
|
||||
protected $table = 'customer_relation';
|
||||
|
||||
protected $fillable = [
|
||||
'forwarder_id', 'company_id', 'customer_rate', 'wave'
|
||||
];
|
||||
|
||||
public function forwarder()
|
||||
{
|
||||
return $this->belongsTo(Forwarder::class, 'forwarder_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class Forwarder extends AbstractModel
|
||||
{
|
||||
protected $table = 'forwarder';
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'email', 'street_one', 'street_two', 'city', 'state', 'post_code', 'country', 'shipping_rate','overdue_days','markup_percentage','minimum_cbm'
|
||||
];
|
||||
|
||||
public function customerRelation()
|
||||
{
|
||||
return $this->hasMany(CustomerRelation::class, 'forwarder_id');
|
||||
}
|
||||
|
||||
public function locationFees()
|
||||
{
|
||||
return $this->hasMany(LocationFees::class, 'forwarder_id');
|
||||
}
|
||||
|
||||
public function serviceFees()
|
||||
{
|
||||
return $this->hasMany(ServiceFees::class, 'forwarder_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class LocationFees extends AbstractModel
|
||||
{
|
||||
protected $table = 'location_fees';
|
||||
|
||||
protected $fillable = [
|
||||
'forwarder_id', 'state', 'rate', 'outstation_rate'
|
||||
];
|
||||
|
||||
public function forwarder()
|
||||
{
|
||||
return $this->belongsTo(Forwarder::class, 'forwarder_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class ServiceFees extends AbstractModel
|
||||
{
|
||||
protected $table = 'service_fees';
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'type', 'description', 'cost', 'forwarder_id'
|
||||
];
|
||||
|
||||
public function forwarder()
|
||||
{
|
||||
return $this->belongsTo(Forwarder::class, 'forwarder_id');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class CreateForwarderTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('forwarder', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name', 50);
|
||||
$table->string('email', 80)->nullable();
|
||||
$table->string('street_one', 80)->nullable();
|
||||
$table->string('street_two', 80)->nullable();
|
||||
$table->string('city', 50)->nullable();
|
||||
$table->string('state', 50)->nullable();
|
||||
$table->string('post_code', 10)->nullable();
|
||||
$table->string('country')->nullable();
|
||||
$table->decimal('shipping_rate', 7, 2)->default(0);
|
||||
$table->integer('overdue_days')->default(0);
|
||||
$table->decimal('markup_percentage', 7, 2)->default(0);
|
||||
$table->decimal('minimum_cbm', 5, 2)->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
DB::table('forwarder')->insert(
|
||||
[
|
||||
'name' => 'CIEF Worldwide SDN BHD',
|
||||
'email' => 'infociefworldwide@gmail.com',
|
||||
'street_one' => 'Malaysian Global Innovation & Creativity Centre(MaGIC)',
|
||||
'street_two' => ' CWS Block, 3730, Persiaran Apec',
|
||||
'city' => 'Cyberjaya',
|
||||
'state' => 'Selangor',
|
||||
'post_code' => '63000',
|
||||
'country' => 'Malaysia',
|
||||
'shipping_rate' => '300',
|
||||
'overdue_days' => '0',
|
||||
'markup_percentage' => '0',
|
||||
'minimum_cbm' =>'0.3',
|
||||
'created_at' => \Carbon\Carbon::now(),
|
||||
'updated_at' => \Carbon\Carbon::now()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('forwarder');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateLocationFeesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('location_fees', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('forwarder_id')->unsigned()->nullable();
|
||||
$table->string('state')->nullable();
|
||||
$table->decimal('rate', 7, 2)->default(0);
|
||||
$table->decimal('outstation_rate', 7, 2)->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('location_fees');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateServiceFeesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('service_fees', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable();
|
||||
$table->integer('type')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->decimal('cost', 7, 2)->nullable();
|
||||
$table->integer('forwarder_id')->unsigned()->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('service_fees');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCustomerRelationTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('customer_relation', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('forwarder_id')->unsigned()->nullable();
|
||||
$table->integer('company_id')->unsigned()->nullable();
|
||||
$table->float('customer_rate')->default(0);
|
||||
$table->boolean('wave')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('customer_relation');
|
||||
}
|
||||
}
|
||||
+14
-2
@@ -138,12 +138,13 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
Route::post('/{orderId}/delivery-arrangement', 'UpdateDeliveryArrangementController@update')->name('delivery.update');
|
||||
});
|
||||
|
||||
|
||||
|
||||
Route::post('/{orderId}/address','UpdateOrderAddressController@update')->name('address.order.update');
|
||||
|
||||
Route::post('/{orderId}/update-receive-note', 'UpdateReceiveNoteController@update')->name('receive.update');
|
||||
|
||||
Route::post('/{scheduleId}/update-order-schedule','UpdateOrderScheduleController@update')->name('schedule.update');
|
||||
|
||||
Route::delete('/{scheduleId}/delete-order-schedule','DeleteOrderScheduleController@delete')->name('schedule.delete');
|
||||
});
|
||||
|
||||
// Service Routes
|
||||
@@ -160,4 +161,15 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
Route::get('/order/status', 'OrdersStatusReportController@index')->name('order.status');
|
||||
});
|
||||
|
||||
// Freight Forwarder Routes
|
||||
Route::group(['prefix' => 'forwarder', 'as' => 'forwarder.', 'namespace' => 'FreightForwarder'], function () {
|
||||
|
||||
// Update Freight Forwarder Settings
|
||||
Route::put('/{forwarderId}/update', 'UpdateFreightForwarderController@update')->name('update.freight.forwarder');
|
||||
Route::put('/update/customer-relation', 'UpdateCustomerRelationController@update')->name('update.customer.relation');
|
||||
Route::put('/update/services', 'UpdateServiceFeesController@update')->name('update.service.fees');
|
||||
Route::delete('/{serviceId}/delete/services', 'DeleteServiceFeesController@delete')->name('delete.service.fees');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user