mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 86893efe3d | |||
| 3dfec9fd6d | |||
| 0634fbf78e | |||
| 6375ac753e | |||
| 3899dd8416 | |||
| d0ee2473ac | |||
| 33124d6588 | |||
| 86e257106a | |||
| edb644eaeb | |||
| 98dc43d23a | |||
| cfd6757a84 | |||
| eb31291e25 | |||
| 7b88fd5c3c | |||
| 1814352780 | |||
| 5ba46a96a3 | |||
| 1c79d88d8d | |||
| 029f25a003 | |||
| 557881104c | |||
| d30dab61ea |
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesBasePriceConstantByDates;
|
||||
use App\Classes\Modules\Segments\Services\CreatesConstant;
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanCreateConstant;
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstant;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Http\Resources\ConstantResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateBasePriceLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Create Base Price',
|
||||
'message' => 'You have successfully created a Base Price'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateConstant */
|
||||
private $canUpdateConstant;
|
||||
|
||||
/** @var UpdatesConstant */
|
||||
private $updatesConstant;
|
||||
|
||||
/** @var FetchesSegment */
|
||||
private $fetchesSegment;
|
||||
|
||||
/** @var FetchesConstant */
|
||||
private $fetchesConstant;
|
||||
|
||||
/** @var CanCreateConstant */
|
||||
private $canCreateConstant;
|
||||
|
||||
/** @var CreatesConstant */
|
||||
private $createsConstant;
|
||||
|
||||
|
||||
/** @var UpdatesBasePriceConstantByDates */
|
||||
private $updatesBasePriceConstantByDates;
|
||||
|
||||
/**
|
||||
* UpdateConstantLogic constructor.
|
||||
* @param CanUpdateConstant $canUpdateConstant
|
||||
* @param UpdatesConstant $updatesConstant
|
||||
* @param FetchesSegment $fetchesSegment
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
* @param CanCreateConstant $canCreateConstant
|
||||
* @param CreatesConstant $createsConstant
|
||||
* @param UpdatesBasePriceConstantByDates $updatesBasePriceConstantByDates
|
||||
*/
|
||||
public function __construct(
|
||||
CanUpdateConstant $canUpdateConstant,
|
||||
UpdatesConstant $updatesConstant,
|
||||
FetchesSegment $fetchesSegment,
|
||||
FetchesConstant $fetchesConstant,
|
||||
CanCreateConstant $canCreateConstant,
|
||||
CreatesConstant $createsConstant,
|
||||
UpdatesBasePriceConstantByDates $updatesBasePriceConstantByDates
|
||||
)
|
||||
{
|
||||
$this->canUpdateConstant = $canUpdateConstant;
|
||||
$this->updatesConstant = $updatesConstant;
|
||||
$this->fetchesSegment = $fetchesSegment;
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
$this->canCreateConstant = $canCreateConstant;
|
||||
$this->createsConstant = $createsConstant;
|
||||
$this->updatesBasePriceConstantByDates = $updatesBasePriceConstantByDates;
|
||||
}
|
||||
/**
|
||||
* @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')]);
|
||||
|
||||
try {
|
||||
|
||||
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => SegmentConstants::BASE_PRICE]);
|
||||
|
||||
} catch (ResourceNotFoundException $exception){
|
||||
|
||||
$constantObject = [];
|
||||
|
||||
$object = new ConstantObject(
|
||||
SegmentConstants::BASE_PRICE,
|
||||
$constantObject
|
||||
);
|
||||
|
||||
$constant = $this->createsConstant->execute($segment, $object);
|
||||
}
|
||||
|
||||
$constantValue = $this->updatesBasePriceConstantByDates->execute($constant->value, $request->input('dateFrom'), $request->input('dateTo'), $request->input('rate'));
|
||||
|
||||
$object = new ConstantObject(SegmentConstants::BASE_PRICE, $constantValue);
|
||||
|
||||
$this->canUpdateConstant->passes($object);
|
||||
|
||||
$constant = $this->updatesConstant->execute($constant, $object);
|
||||
|
||||
return $this->resourceResponse(new ConstantResource($constant));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Http\Resources\ConstantResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\CarbonPeriod;
|
||||
|
||||
class FetchBasePriceLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Base Price',
|
||||
'message' => 'You have successfully retrieved the Base Price'
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @var FetchesConstant */
|
||||
private $fetchesConstant;
|
||||
|
||||
/**
|
||||
* FetchConstantLogic constructor.
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
*/
|
||||
public function __construct(FetchesConstant $fetchesConstant)
|
||||
{
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$constant = $this->fetchesConstant->execute(['segment_id' => $request->route('id'), 'reference' => SegmentConstants::BASE_PRICE]);
|
||||
|
||||
$constantObject = (array) $constant->value;
|
||||
|
||||
if ($request->input('dateFrom') !== null && $request->input('dateTo') !== null) {
|
||||
|
||||
$period = CarbonPeriod::create($request->input('dateFrom'), $request->input('dateTo'));
|
||||
|
||||
$returnObject = [];
|
||||
|
||||
foreach ($period as $date) {
|
||||
array_key_exists($date->format('Y-m-d'), $constantObject) === true ? $returnObject[$date->format('Y-m-d')] = $constantObject[$date->format('Y-m-d')] : '';
|
||||
}
|
||||
|
||||
$constant->value = json_encode($returnObject);
|
||||
|
||||
}
|
||||
|
||||
return $this->resourceResponse(new ConstantResource($constant));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,9 @@ namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
use App\Classes\Modules\Segments\Services\CreatesConstant;
|
||||
use App\Classes\Modules\Segments\Services\CreatesSegment;
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanCreateConstant;
|
||||
@@ -15,6 +17,7 @@ use App\Http\Resources\ConstantResource;
|
||||
use App\Models\SegmentConstant;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstantValue;
|
||||
|
||||
class UpdateConstantLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -47,6 +50,11 @@ class UpdateConstantLogic extends AbstractControllerLogic
|
||||
/** @var CreatesConstant */
|
||||
private $createsConstant;
|
||||
|
||||
/** @var CreatesSegment */
|
||||
private $createsSegment;
|
||||
|
||||
/** @var UpdatesConstantValue */
|
||||
private $updatesConstantValue;
|
||||
|
||||
/**
|
||||
* UpdateConstantLogic constructor.
|
||||
@@ -56,8 +64,19 @@ class UpdateConstantLogic extends AbstractControllerLogic
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
* @param CanCreateConstant $canCreateConstant
|
||||
* @param CreatesConstant $createsConstant
|
||||
* @param UpdatesConstantValueByState $updatesConstantValueByState
|
||||
* @param CreatesSegment $createsSegment
|
||||
*/
|
||||
public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant, CanCreateConstant $canCreateConstant, CreatesConstant $createsConstant)
|
||||
public function __construct(
|
||||
CanUpdateConstant $canUpdateConstant,
|
||||
UpdatesConstant $updatesConstant,
|
||||
FetchesSegment $fetchesSegment,
|
||||
FetchesConstant $fetchesConstant,
|
||||
CanCreateConstant $canCreateConstant,
|
||||
CreatesConstant $createsConstant,
|
||||
UpdatesConstantValue $updatesConstantValue,
|
||||
CreatesSegment $createsSegment
|
||||
)
|
||||
{
|
||||
$this->canUpdateConstant = $canUpdateConstant;
|
||||
$this->updatesConstant = $updatesConstant;
|
||||
@@ -65,6 +84,8 @@ class UpdateConstantLogic extends AbstractControllerLogic
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
$this->canCreateConstant = $canCreateConstant;
|
||||
$this->createsConstant = $createsConstant;
|
||||
$this->updatesConstantValue = $updatesConstantValue;
|
||||
$this->createsSegment = $createsSegment;
|
||||
}
|
||||
/**
|
||||
* @param Request $request
|
||||
@@ -75,28 +96,33 @@ class UpdateConstantLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$object = new ConstantObject($request->input('reference'), $request->input('value'));
|
||||
|
||||
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
|
||||
|
||||
try {
|
||||
|
||||
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $object->getReference()]);
|
||||
$this->canUpdateConstant->passes($object);
|
||||
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
|
||||
|
||||
/** @var SegmentConstant $constant */
|
||||
$constant = $this->updatesConstant->execute($constant, $object);
|
||||
$constantValue = $this->updatesConstantValue->execute($constant->value, $request->input('id'), $request->input('rate'));
|
||||
|
||||
$object = new ConstantObject($request->input('reference'), $constantValue);
|
||||
|
||||
$this->canUpdateConstant->passes($object);
|
||||
|
||||
} catch (ResourceNotFoundException $exception){
|
||||
|
||||
$this->canCreateConstant->passes($object);
|
||||
$constantObject = [];
|
||||
|
||||
$constantObject[$request->input('id')] = $request->input('rate');
|
||||
|
||||
$object = new ConstantObject(
|
||||
$request->input('reference'),
|
||||
$constantObject
|
||||
);
|
||||
|
||||
/** @var SegmentConstant $constant */
|
||||
$constant = $this->createsConstant->execute($segment, $object);
|
||||
|
||||
}
|
||||
|
||||
|
||||
$constant = $this->updatesConstant->execute($constant, $object);
|
||||
|
||||
return $this->resourceResponse(new ConstantResource($constant));
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ 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;
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\Modules\Segments\Services\CreatesConstant;
|
||||
|
||||
class UpdateConstantPostcodeLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -46,6 +48,8 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic
|
||||
/** @var RemoveItemFromConstantValueArray */
|
||||
private $removeItemFromConstantValueArray;
|
||||
|
||||
/** @var CreatesConstant */
|
||||
private $createsConstant;
|
||||
|
||||
/**
|
||||
* UpdateConstantLogic constructor.
|
||||
@@ -54,9 +58,18 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic
|
||||
* @param FetchesSegment $fetchesSegment
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
* @param AddItemToConstantValueArray $addItemToConstantValueArray
|
||||
* @param CreatesConstant $createsConstant
|
||||
* @param RemoveItemFromConstantValueArray $removeItemFromConstantValueArray
|
||||
*/
|
||||
public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,AddItemToConstantValueArray $addItemToConstantValueArray, RemoveItemFromConstantValueArray $removeItemFromConstantValueArray)
|
||||
public function __construct(
|
||||
CanUpdateConstant $canUpdateConstant,
|
||||
UpdatesConstant $updatesConstant,
|
||||
FetchesSegment $fetchesSegment,
|
||||
FetchesConstant $fetchesConstant,
|
||||
AddItemToConstantValueArray $addItemToConstantValueArray,
|
||||
RemoveItemFromConstantValueArray $removeItemFromConstantValueArray,
|
||||
CreatesConstant $createsConstant
|
||||
)
|
||||
{
|
||||
$this->canUpdateConstant = $canUpdateConstant;
|
||||
$this->updatesConstant = $updatesConstant;
|
||||
@@ -64,6 +77,7 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
$this->addItemToConstantValueArray = $addItemToConstantValueArray;
|
||||
$this->removeItemFromConstantValueArray = $removeItemFromConstantValueArray;
|
||||
$this->createsConstant = $createsConstant;
|
||||
}
|
||||
/**
|
||||
* @param Request $request
|
||||
@@ -76,24 +90,42 @@ class UpdateConstantPostcodeLogic extends AbstractControllerLogic
|
||||
{
|
||||
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
|
||||
|
||||
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
|
||||
try {
|
||||
$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);
|
||||
$constantValue = $this->addItemToConstantValueArray->execute($constant->value, $request->input('postcode'));
|
||||
|
||||
$object = new ConstantObject($request->input('reference'), $constantValue);
|
||||
|
||||
} catch (ResourceNotFoundException $exception){
|
||||
|
||||
$constantObject = [$request->input('postcode')];
|
||||
|
||||
$object = new ConstantObject(
|
||||
$request->input('reference'),
|
||||
$constantObject
|
||||
);
|
||||
|
||||
$constant = $this->createsConstant->execute($segment, $object);
|
||||
}
|
||||
|
||||
try {
|
||||
// check if postcode exist in the opposite constant, and delete it
|
||||
$oppositeConstant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE]);
|
||||
|
||||
$oppositeConstantValue = $this->removeItemFromConstantValueArray->execute($oppositeConstant->value, $request->input('postcode'));
|
||||
|
||||
$oppositeObject = new ConstantObject($request->input('reference') == SegmentConstants::CENTER_POSTCODE ? SegmentConstants::OUTSTATION_POSTCODE : SegmentConstants::CENTER_POSTCODE, $oppositeConstantValue);
|
||||
|
||||
$this->updatesConstant->execute($oppositeConstant, $oppositeObject);
|
||||
|
||||
} catch (ResourceNotFoundException $exception){
|
||||
// if opposite constant does not exist, do nothing
|
||||
}
|
||||
|
||||
$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),
|
||||
]);
|
||||
return $this->resourceResponse(new ConstantResource($constant));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\ControllersLogic;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\SegmentConstant;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Resources\ConstantResource;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstant;
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstantValueByState;
|
||||
|
||||
class UpdateConstantStateLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Segment Constant',
|
||||
'message' => 'You have successfully updated the Segment Constant'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateConstant */
|
||||
private $canUpdateConstant;
|
||||
|
||||
/** @var UpdatesConstant */
|
||||
private $updatesConstant;
|
||||
|
||||
/** @var FetchesSegment */
|
||||
private $fetchesSegment;
|
||||
|
||||
/** @var FetchesConstant */
|
||||
private $fetchesConstant;
|
||||
|
||||
/** @var UpdatesConstantValueByState */
|
||||
private $updatesConstantValueByState;
|
||||
|
||||
|
||||
/**
|
||||
* UpdateConstantLogic constructor.
|
||||
* @param CanUpdateConstant $canUpdateConstant
|
||||
* @param UpdatesConstant $updatesConstant
|
||||
* @param FetchesSegment $fetchesSegment
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
* @param UpdatesConstantValueByState $updatesConstantValueByState
|
||||
*/
|
||||
public function __construct(CanUpdateConstant $canUpdateConstant, UpdatesConstant $updatesConstant, FetchesSegment $fetchesSegment, FetchesConstant $fetchesConstant,UpdatesConstantValueByState $updatesConstantValueByState)
|
||||
{
|
||||
$this->canUpdateConstant = $canUpdateConstant;
|
||||
$this->updatesConstant = $updatesConstant;
|
||||
$this->fetchesSegment = $fetchesSegment;
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
$this->updatesConstantValueByState = $updatesConstantValueByState;
|
||||
}
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$segment = $this->fetchesSegment->execute(['id' => $request->route('id')]);
|
||||
|
||||
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => SegmentConstants::STATE_RATE]);
|
||||
|
||||
$constantValue = $this->updatesConstantValueByState->execute($constant->value, $request->input('status_id'), $request->input('rate'));
|
||||
|
||||
$object = new ConstantObject(SegmentConstants::STATE_RATE, (array) $constantValue);
|
||||
$this->canUpdateConstant->passes($object);
|
||||
|
||||
$constant = $this->updatesConstant->execute($constant, $object);
|
||||
|
||||
|
||||
return $this->resourceResponse(new ConstantResource($constant));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
use Carbon\CarbonPeriod;
|
||||
|
||||
class UpdatesBasePriceConstantByDates
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $json
|
||||
* @param int $status_id
|
||||
* @param Array $rate
|
||||
* @return Array
|
||||
*/
|
||||
public function execute($json, String $date_from, String $date_to, String $rate) {
|
||||
|
||||
$objectArray = (array) $json;
|
||||
|
||||
$period = CarbonPeriod::create($date_from, $date_to);
|
||||
|
||||
foreach ($period as $date) {
|
||||
$objectArray[$date->format('Y-m-d')] = $rate;
|
||||
}
|
||||
|
||||
return $objectArray;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
class UpdatesConstantValue
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $json
|
||||
* @param int $status_id
|
||||
* @param Array $rate
|
||||
* @return Array
|
||||
*/
|
||||
public function execute($json, int $state_id, Array $rate) {
|
||||
|
||||
$objectArray = (array) $json;
|
||||
|
||||
$objectArray[$state_id] = $rate;
|
||||
|
||||
return $objectArray;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Segments\Services;
|
||||
|
||||
class UpdatesConstantValueByState
|
||||
{
|
||||
|
||||
/**
|
||||
* @param $json
|
||||
* @param int $status_id
|
||||
* @param int $rate
|
||||
* @return string
|
||||
*/
|
||||
public function execute($json, int $status_id, int $rate) {
|
||||
|
||||
$newArray = $json;
|
||||
foreach($json->config as $key => $object){
|
||||
if($object->status_id == $status_id){
|
||||
$newArray->config[$key] = (object) [
|
||||
'rate' => $rate,
|
||||
'status_id' => $object->status_id,
|
||||
'outstation_rate' => $object->outstation_rate,
|
||||
];
|
||||
}else{
|
||||
$newArray->config[$key] = $object;
|
||||
}
|
||||
}
|
||||
return $newArray;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Segments;
|
||||
|
||||
use App\Classes\Modules\Segments\ControllersLogic\CreateBasePriceLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateBasePriceController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateBasePriceLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateBasePriceLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Segments;
|
||||
|
||||
use App\Classes\Modules\Segments\ControllersLogic\FetchBasePriceLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchBasePriceController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchSegmentLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchBasePriceLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Segments;
|
||||
|
||||
use App\Classes\Modules\Segments\ControllersLogic\UpdateConstantStateLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateConstantStateController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateConstantStateLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateConstantStateLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@ namespace App\Http\Resources;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\Order;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Models\SegmentConstant;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
|
||||
class AddressResource extends JsonResource
|
||||
{
|
||||
@@ -17,6 +19,14 @@ class AddressResource extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
$centerPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::CENTER_POSTCODE)->get();
|
||||
$centerPostcodeConstant = $centerPostcodeConstantObject->isEmpty() ? [] : (array)$centerPostcodeConstantObject->first()->value;
|
||||
$postcodeArea = in_array($this->postcode, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : '';
|
||||
|
||||
$outstationPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::OUTSTATION_POSTCODE)->get();
|
||||
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
||||
in_array($this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : '';
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'reference' => $this->reference,
|
||||
@@ -25,6 +35,7 @@ class AddressResource extends JsonResource
|
||||
'district' => $this->district,
|
||||
'state' => $this->state,
|
||||
'post_code' => $this->postcode,
|
||||
'post_code_area' => $postcodeArea,
|
||||
'country' => $this->country,
|
||||
'default' => (int) $this->default,
|
||||
'status' => (int) $this->status,
|
||||
|
||||
@@ -32,6 +32,9 @@ class CompanyModuleResource extends JsonResource
|
||||
$connection = $this->inviters()->withPivot('invitee_reference')->first();
|
||||
$marking = $connection ? $connection->pivot->invitee_reference:'';
|
||||
|
||||
$segmentConstantObject = SegmentConstant::where('reference', SegmentConstants::WAREHOUSE_RATE)->get();
|
||||
$segmentConstant = $segmentConstantObject->isEmpty() ? [] : (array)$segmentConstantObject->first()->value;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
@@ -40,7 +43,8 @@ class CompanyModuleResource extends JsonResource
|
||||
'address' => new AddressResource($defaultAddress),
|
||||
'company' => new CompanyResource($this->whenLoaded('company')),
|
||||
'remarks' => RemarkResource::collection($this->remarks),
|
||||
'marking' => $marking
|
||||
'marking' => $marking,
|
||||
'warehouseCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null,
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ class DistrictResource extends JsonResource
|
||||
'state' => $this->state,
|
||||
'country' => $this->country,
|
||||
'postcode' => $this->postcode,
|
||||
'postcodeArray' => PostcodeResource::collection(json_decode($this->postcode)),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Models\SegmentConstant;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
|
||||
|
||||
class PostcodeResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$centerPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::CENTER_POSTCODE)->get();
|
||||
$centerPostcodeConstant = $centerPostcodeConstantObject->isEmpty() ? [] : (array)$centerPostcodeConstantObject->first()->value;
|
||||
$postcodeArea = in_array($this->resource, $centerPostcodeConstant) ? 'CENTER_POSTCODE' : '';
|
||||
|
||||
$outstationPostcodeConstantObject = SegmentConstant::where('reference', SegmentConstants::OUTSTATION_POSTCODE)->get();
|
||||
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
||||
in_array($this->resource, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : '';
|
||||
|
||||
return [
|
||||
'postcode' => $this->resource,
|
||||
'postcodeArea' => $postcodeArea,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Models\SegmentConstant;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
|
||||
class StateResource extends JsonResource
|
||||
{
|
||||
@@ -14,10 +15,15 @@ class StateResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
$segmentConstantObject = SegmentConstant::where('reference', SegmentConstants::STATE_RATE)->get();
|
||||
$segmentConstant = $segmentConstantObject->isEmpty() ? [] : (array)$segmentConstantObject->first()->value;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'country' => $this->country,
|
||||
'stateCharges' => array_key_exists($this->id, $segmentConstant) ? $segmentConstant[$this->id] : null,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,13 +64,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<packing-list-section-component :data="item" v-if="expanded"></packing-list-section-component>
|
||||
<packing-list-section-component :section="section" :data="item" v-if="expanded"></packing-list-section-component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
export default {
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
expanded: false,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
{{item.order.address.street_one+' '+(item.order.address.street_two ? item.order.address.street_two : '')+', '+ item.order.address.district.name+', '+item.order.address.post_code+' '+item.order.address.state.name+', '+item.order.address.country.name}}<br>{{item.order.address.remark ? item.order.address.remark.content: ''}}
|
||||
<div class="btn btn-xs btn-primary pointer m-t-10 requestModal" data-type="defineLocation">Define Location</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="defineLocation">
|
||||
<declare-postcode-area-form-component :data="item.order.address.post_code"></declare-postcode-area-form-component>
|
||||
<declare-postcode-area-form-component :section="section" :data="{postcode: item.order.address.post_code, postcodeArea: item.order.address.post_code_area}"></declare-postcode-area-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,6 +59,12 @@
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
export default {
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
|
||||
+13
-15
@@ -1,27 +1,27 @@
|
||||
<template>
|
||||
<div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
|
||||
<div class="row" style="width: 450px; margin: auto;">
|
||||
<div class="col bg-white padding-40 b-rad-lg">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<h2 class="text-center text-complete bold">{{data}}</h2>
|
||||
<p class="text-center" v-show="postcodeArea=== ''">This postcode is yet to be declare. Plase choose the area.</p>
|
||||
<h2 class="text-center text-complete bold">{{data.postcode}}</h2>
|
||||
<p class="text-center" v-show="parameters.reference=== ''">This postcode is yet to be declare. Plase choose the area.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-center justify-content-center">
|
||||
<div class="col p-r-5">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': postcodeArea === 'city_center', 'b-grey': postcodeArea !== 'city_center' }" @click="postcodeArea = 'city_center'">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': parameters.reference === 'CENTER_POSTCODE', 'b-grey': parameters.reference !== 'CENTER_POSTCODE' }" @click="parameters.reference = 'CENTER_POSTCODE'">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h5 class="no-margin" :class="{ 'text-primary': postcodeArea === 'city_center', 'semi-bold': postcodeArea === 'city_center' }">City Center</h5>
|
||||
<h5 class="no-margin" :class="{ 'text-primary': parameters.reference === 'CENTER_POSTCODE', 'semi-bold': parameters.reference === 'CENTER_POSTCODE' }">City Center</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': postcodeArea === 'outskirt', 'b-grey': postcodeArea !== 'outskirt' }" @click="postcodeArea = 'outskirt'">
|
||||
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': parameters.reference === 'OUTSTATION_POSTCODE', 'b-grey': parameters.reference !== 'OUTSTATION_POSTCODE' }" @click="parameters.reference = 'OUTSTATION_POSTCODE'">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h5 class="no-margin" :class="{ 'text-primary': postcodeArea === 'outskirt', 'semi-bold': postcodeArea === 'outskirt'}">Outskirt</h5>
|
||||
<h5 class="no-margin" :class="{ 'text-primary': parameters.reference === 'OUTSTATION_POSTCODE', 'semi-bold': parameters.reference === 'OUTSTATION_POSTCODE'}">Outskirt</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -32,8 +32,7 @@
|
||||
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<!-- <div class="btn btn-primary w-100 btn-lg" @click="submit(route('api.packing_list.assign.order', data, orderNo), 'put', section, true, true)">Confirm</div> -->
|
||||
<div class="btn btn-primary w-100 btn-lg">Confirm</div>
|
||||
<div class="btn btn-primary w-100 btn-lg" @click="submit(route('api.segment.constant.update.postcode', 1), 'put', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -46,7 +45,7 @@
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
type: String,
|
||||
type: Object,
|
||||
required: false
|
||||
},
|
||||
section: {
|
||||
@@ -55,13 +54,12 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
postcodeArea: '',
|
||||
parameters: {
|
||||
reference: this.data.postcodeArea,
|
||||
postcode: this.data.postcode
|
||||
}
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
orderNo: '',
|
||||
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<div class="col">
|
||||
<div class="row align-items-center p-t-10 p-b-10 b-t b-grey" v-for="packingList in packingLists">
|
||||
<div class="col">
|
||||
<packing-list-component :data="packingList"></packing-list-component>
|
||||
<packing-list-component :section="section" :data="packingList"></packing-list-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,6 +42,12 @@
|
||||
import PackingListComponent from "../elements/PackingListComponent";
|
||||
export default {
|
||||
components: {PackingListComponent, LoadingComponent},
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
isLoading: true,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -15,7 +15,19 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps">{{data}}</div>
|
||||
<div class="font-heading all-caps">{{data.postcode}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto p-r-10">
|
||||
<div class="font-heading all-caps fs-8 muted">Location</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps">{{data.postcodeArea == '' ? '-' : data.postcodeArea.replaceAll('_', ' ') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -24,7 +36,7 @@
|
||||
<div class="col">
|
||||
<div class="btn btn-xs btn-primary pointer m-t-10 requestModal" data-type="defineLocation">Define Location</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="defineLocation">
|
||||
<declare-postcode-area-form-component :data="data"></declare-postcode-area-form-component>
|
||||
<declare-postcode-area-form-component :data="data" section="allPostcodesSection"></declare-postcode-area-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,7 +52,7 @@
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
type: String,
|
||||
type: Object,
|
||||
required: false
|
||||
},
|
||||
section: {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps">MYR 0.00</div>
|
||||
<div class="font-heading all-caps">MYR {{ data.stateCharges === null ? '0.00' : data.stateCharges.center }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,7 +39,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps">MYR 0.00</div>
|
||||
<div class="font-heading all-caps">MYR {{ data.stateCharges === null ? '0.00' : data.stateCharges.outstation }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -48,7 +48,7 @@
|
||||
<div class="col">
|
||||
<div class="btn btn-xs btn-primary pointer m-t-10 requestModal" data-type="editCharges">Edit</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="editCharges">
|
||||
<edit-state-charges-form-component :data="data"></edit-state-charges-form-component>
|
||||
<edit-state-charges-form-component :data="data" :section="section"></edit-state-charges-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps">MYR 0.00 <i class="fa fa-edit pointer fa-fw m-l-5 requestModal text-primary" data-type="editWarehouseCharges"></i></div>
|
||||
<div class="font-heading all-caps">MYR {{ data.warehouseCharges === null ? '0.00' : data.warehouseCharges.amount }} <i class="fa fa-edit pointer fa-fw m-l-5 requestModal text-primary" data-type="editWarehouseCharges"></i></div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="editWarehouseCharges">
|
||||
<edit-warehouse-charges-form-component :data="data"></edit-warehouse-charges-form-component>
|
||||
<edit-warehouse-charges-form-component :data="data" section="warhouseListSection"></edit-warehouse-charges-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
@@ -54,7 +54,7 @@
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" type="warehouseRemark">
|
||||
<remark-form-component module_type="CompanyModule" :data="data" section="warhouseListSection"></remark-form-component>
|
||||
</modal-component>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" type="deleteWarehouseRemark">
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" type="deleteWarehouseRemark">
|
||||
<delete-remark-form-component :section="section" :data="data.remarks[0]"></delete-remark-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
|
||||
<div class="col bg-white b-rad-lg">
|
||||
<div class="row m-b-10">
|
||||
<div class="col text-center">
|
||||
<p>Plese set the approximate of base price and dates of below.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-auto mt-10 mb-10">
|
||||
<div class="col p-l-0 p-r-10">
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.dateFrom">
|
||||
<label class="text-primary">Date From</label>
|
||||
<date-picker-component v-model="parameters.dateFrom"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-auto mt-10 mb-10">
|
||||
<div class="col p-l-0 p-r-10">
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.dateTo">
|
||||
<label class="text-primary">Date To</label>
|
||||
<date-picker-component v-model="parameters.dateTo"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.rate">
|
||||
<label class="text-primary">Extra Charges (MYR)</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12" v-model.trim="parameters.rate" v-money="money">
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-15">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-default b-rad-none w-100" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-primary w-100" @click="submitForm()">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
section: {
|
||||
default: ''
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
dateFrom: '',
|
||||
dateTo: '',
|
||||
rate: ''
|
||||
},
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
dateFrom: { required },
|
||||
dateTo: { required },
|
||||
rate: { required },
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(this.route('api.segment.constant.basePrice.create', 1), 'post', this.section, true, true)
|
||||
},
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<div class="row parentContainer padding-40 bg-white b-rad-lg" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<h2 class="text-center">Edit Base Price</h2>
|
||||
<p class="text-center">{{ parameters.dateFrom }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.rate">
|
||||
<label class="text-primary">Base Price (MYR)</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12" v-model.trim="parameters.rate" v-money="money">
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
<div class="row m-t-15">
|
||||
<div class="col-auto p-r-5">
|
||||
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-primary w-100 btn-lg" @click="submit(route('api.segment.constant.basePrice.create', 1), 'post', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
required: false
|
||||
},
|
||||
section: {
|
||||
default: ''
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
dateFrom: this.data.date,
|
||||
dateTo: this.data.date,
|
||||
rate: this.data.rate
|
||||
},
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
dateFrom: { required },
|
||||
dateTo: { required },
|
||||
rate: { required },
|
||||
}
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<div class="row" style="width: 450px; margin: auto;" @keyup.enter="submitForm">
|
||||
<div class="col bg-white b-rad-lg">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<h3 class="text-center">Edit {{data.name}} Price</h3>
|
||||
</div>
|
||||
</div>
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.value.amount">
|
||||
<label class="text-primary">Segment Price (MYR)</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12" v-model.trim="parameters.value.amount" v-money="money">
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
<div class="row m-t-15">
|
||||
<div class="col-auto p-r-5">
|
||||
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-primary w-100 btn-lg" @click="submit(route('api.segment.constant.update', data.id), 'put', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
required: false
|
||||
},
|
||||
section: {
|
||||
default: ''
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
reference: 'CUSTOM_PRICE',
|
||||
value : {
|
||||
amount: 0
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
value: {
|
||||
amount: { required }
|
||||
}
|
||||
}
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -6,16 +6,16 @@
|
||||
<h2 class="text-center bold">{{data.name}}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.cityCenterCharges">
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.rate.center">
|
||||
<label class="text-primary">City Center Charges (MYR)</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12" v-model="cityCenterCharges">
|
||||
<input type="text" class="form-control fs-12" v-model.trim="parameters.rate.center" v-money="money">
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.outskirtCharges">
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.rate.outstation">
|
||||
<label class="text-primary">Outskirt Charges (MYR)</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12" v-model="outskirtCharges">
|
||||
<input type="text" class="form-control fs-12" v-model.trim="parameters.rate.outstation" v-money="money">
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
<div class="row m-t-15">
|
||||
@@ -23,8 +23,7 @@
|
||||
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<!-- <div class="btn btn-primary w-100 btn-lg" @click="submit(route('api.packing_list.assign.order', data, orderNo), 'put', section, true, true)">Confirm</div> -->
|
||||
<div class="btn btn-primary w-100 btn-lg">Confirm</div>
|
||||
<div class="btn btn-primary w-100 btn-lg" @click="submitForm()">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -46,16 +45,31 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
cityCenterCharges: '',
|
||||
outskirtCharges : '',
|
||||
cityCenterCharges: '',
|
||||
outskirtCharges : '',
|
||||
parameters: {
|
||||
reference: 'STATE_RATE',
|
||||
id: this.data.id,
|
||||
rate: {
|
||||
center: this.data.stateCharges == null ? 0 : this.data.stateCharges.center,
|
||||
outstation: this.data.stateCharges == null ? 0 : this.data.stateCharges.outstation,
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
cityCenterCharges: { required },
|
||||
outskirtCharges: { required },
|
||||
rate: {
|
||||
center: { required },
|
||||
outstation: { required }
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(this.route('api.segment.constant.update', 1), 'put', this.section, true, true)
|
||||
},
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
|
||||
+18
-6
@@ -6,10 +6,10 @@
|
||||
<h2 class="text-center">{{data.name}}</h2>
|
||||
</div>
|
||||
</div>
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.extraCharges">
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.rate.amount">
|
||||
<label class="text-primary">Extra Charges (MYR)</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12" v-model="extraCharges">
|
||||
<input type="text" class="form-control fs-12" v-model.trim="parameters.rate.amount" v-money="money">
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
<div class="row m-t-15">
|
||||
@@ -17,8 +17,7 @@
|
||||
<div class="btn btn-lg btn-default b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<!-- <div class="btn btn-primary w-100 btn-lg" @click="submit(route('api.packing_list.assign.order', data, orderNo), 'put', section, true, true)">Confirm</div> -->
|
||||
<div class="btn btn-primary w-100 btn-lg">Confirm</div>
|
||||
<div class="btn btn-primary w-100 btn-lg" @click="submitForm()">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,14 +39,27 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
extraCharges: '',
|
||||
parameters: {
|
||||
reference: 'WAREHOUSE_RATE',
|
||||
id: this.data.id,
|
||||
rate : {
|
||||
amount: this.data.warehouseCharges == null ? 0 : this.data.warehouseCharges.amount,
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
extraCharges: { required },
|
||||
rate: {
|
||||
amount: { required }
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(this.route('api.segment.constant.update', 1), 'put', this.section, true, true)
|
||||
},
|
||||
},
|
||||
mixins: [modalFormHandler]
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
<div class="col">
|
||||
<list-component section="activeContainerListSection" :endpoint="route('api.packing_list.container.list')" :options="{'per_page': 5, 'status_in': [1], order_by: {column: 'loading_date', DESC: true}}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<container-component :data="data"></container-component>
|
||||
<container-component section="activeContainerListSection" :data="data"></container-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
@@ -91,7 +91,7 @@
|
||||
<div class="col">
|
||||
<list-component section="arrivedContainerListSection" :endpoint="route('api.packing_list.container.list')" :options="{'per_page': 5, 'status_in': [3], 'has_pending_delivery': true, order_by: {column: 'loading_date', DESC: true}}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<container-component :data="data"></container-component>
|
||||
<container-component section="arrivedContainerListSection" :data="data"></container-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
@@ -100,7 +100,7 @@
|
||||
<div class="col">
|
||||
<list-component section="completeContainerListSection" :endpoint="route('api.packing_list.container.list')" :options="{'per_page': 5, 'status_in': [3], 'has_pending_delivery': false, order_by: {column: 'loading_date', DESC: true}}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<container-component :data="data"></container-component>
|
||||
<container-component section="completeContainerListSection" :data="data"></container-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
+3
-1
@@ -13,7 +13,9 @@ Route::group(['prefix' => 'segment', 'as' => 'segment.', 'namespace' => 'Segment
|
||||
Route::put('/service/update', 'UpdateCustomServiceConstantController@update')->name('service.update');
|
||||
Route::put('/update', 'UpdateConstantController@update')->name('update');
|
||||
Route::get('/show/{reference}', 'FetchConstantController@fetch')->name('show');
|
||||
Route::put('/update/state', 'UpdateConstantStateController@update')->name('update.state');
|
||||
Route::put('/update/postcode', 'UpdateConstantPostcodeController@update')->name('update.postcode');
|
||||
|
||||
Route::post('base-price/create', 'CreateBasePriceController@create')->name('basePrice.create');
|
||||
Route::get('base-price/show', 'FetchBasePriceController@fetch')->name('basePrice.show');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user