# Conflicts:
#	resources/assets/vue/components/settings/forms/EditSegmentPriceFormComponent.vue
This commit is contained in:
edmondlang
2022-08-05 19:53:55 +08:00
13 changed files with 74 additions and 36 deletions
@@ -97,15 +97,15 @@ 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);
// $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);
@@ -7,9 +7,13 @@ use App\Classes\Modules\PackingLists\Services\FetchesPackingList;
use App\Classes\Modules\Schedules\Services\CreatesSchedule;
use App\Classes\Modules\Schedules\Services\UpdatesScheduleStatus;
use App\Classes\Modules\Schedules\DataTransferObjects\ScheduleObject;
use App\Classes\Modules\Transports\DataTransferObjects\TransportObject;
use App\Classes\Modules\Transports\Services\CreatesTransport;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransportType;
use App\Http\Resources\PackingListResource;
use App\Models\Transport;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -17,6 +21,8 @@ use Carbon\Carbon;
class ReschedulePackingListLogic extends AbstractControllerLogic
{
/**
* @return array
*/
@@ -33,26 +39,31 @@ class ReschedulePackingListLogic extends AbstractControllerLogic
/** @var UpdatesScheduleStatus */
private $updatesScheduleStatus;
/** @var CreatesTransport */
private $createsTransport;
/** @var CreatesSchedule */
private $createsSchedule;
/**
* DeleteContainerControllersLogic constructor.
* ReschedulePackingListLogic constructor.
* @param FetchesPackingList $fetchesPackingList
* @param UpdatesScheduleStatus $updatesScheduleStatus
* @param CreatesTransport $createsTransport
* @param CreatesSchedule $createsSchedule
*/
public function __construct(FetchesPackingList $fetchesPackingList, UpdatesScheduleStatus $updatesScheduleStatus, CreatesSchedule $createsSchedule)
public function __construct(FetchesPackingList $fetchesPackingList, UpdatesScheduleStatus $updatesScheduleStatus, CreatesTransport $createsTransport, CreatesSchedule $createsSchedule)
{
$this->fetchesPackingList = $fetchesPackingList;
$this->updatesScheduleStatus = $updatesScheduleStatus;
$this->createsTransport = $createsTransport;
$this->createsSchedule = $createsSchedule;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function logic(Request $request) : JsonResponse
{
@@ -60,9 +71,15 @@ class ReschedulePackingListLogic extends AbstractControllerLogic
$transport = $packing_list->transports()->first();
$old_sechedule = $transport->schedules()->first();
if(!$transport) {
$object = new TransportObject(TransportType::LAND, null, '', Carbon::parse($request->input('etd')), Carbon::parse($request->input('eta')),ApprovalStatus::APPROVED);
/** @var Transport $transport */
$transport = $this->createsTransport->execute($object, $packing_list);
}
$this->updatesScheduleStatus->execute($old_sechedule, ApprovalStatus::REJECTED);
$transport->schedules()->update([
'status' => ApprovalStatus::REJECTED
]);
$scheduleObject = new ScheduleObject(
Carbon::parse($request->input('eta')),
@@ -132,6 +132,7 @@ class FetchOrderListsFromYdPortalProcessor
* @param Carbon|null $start
* @param Carbon|null $end
* @return void
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function execute(?Carbon $start = null, ?Carbon $end = null)
{
@@ -170,7 +171,6 @@ class FetchOrderListsFromYdPortalProcessor
$rows = $this->fetchesDataFRomYDPortal->getResponseBody($trackingRequest);
if(!$rows){
Log::debug($row->expressno);
continue;
}
@@ -203,6 +203,7 @@ class FetchOrderListsFromYdPortalProcessor
}
$rescheduleDate = $dates->sortDesc()->first();
if(!$delayDate || $rescheduleDate > $delayDate){
/** @var Carbon $delayDate */
$delayDate = $rescheduleDate;
@@ -214,11 +215,14 @@ class FetchOrderListsFromYdPortalProcessor
}
if ($trackingRow->tracking === '到港') {
$delayDate = Carbon::parse($trackingRow->trackingtime);
}
if ($trackingRow->tracking === '已开船') {
$delayDate = Carbon::parse($trackingRow->trackingtime)->addDays('5');
}
if ($trackingRow->tracking === '货物已进目的港仓库') {
$unstuffingDate = Carbon::parse($trackingRow->trackingtime);
}
@@ -228,6 +232,21 @@ class FetchOrderListsFromYdPortalProcessor
}
}
$client = new \GuzzleHttp\Client(['cookies' => true, 'headers' => ['Cookie' => 'utc_offset=480']]);
$request = $client->request('get', 'https://main.universe.com.my/Tracking/User/Paging?sEcho=1&sTrackingNo='.$row->expressno.'&sOrgId=sti');
$deliveryTracking = json_decode($request->getBody()->getContents());
foreach (array_reverse($deliveryTracking->aaData) as $trackingRow) {
$trackingDate = Carbon::createFromFormat('d/m/y H:i', $trackingRow->LocalDateTime);
if (Str::contains($trackingRow->PublicDescription, ['accepted/picked'])){
$unstuffingDate = $trackingDate;
}
if (Str::contains($trackingRow->PublicDescription, ['delivered'])) {
$deliveryDate = $trackingDate;
}
}
$customerno = preg_split('(-|\(|\)|\/)', $row->customerno);
$orderNumber = $customerno[array_key_last($customerno)];
@@ -433,7 +452,6 @@ class FetchOrderListsFromYdPortalProcessor
}
} catch (\Exception $exception) {
dump($exception);
Log::debug($exception);
}
@@ -102,7 +102,7 @@ class UpdateConstantLogic extends AbstractControllerLogic
$constant = $this->fetchesConstant->execute(['segment_id' => $segment->id, 'reference' => $request->input('reference')]);
$constantValue = $this->updatesConstantValue->execute($constant->value, $request->input('id'), $request->input('rate'));
$constantValue = $this->updatesConstantValue->execute($constant->value, $request->input('id'), $request->input('value'));
$object = new ConstantObject($request->input('reference'), $constantValue);
@@ -112,7 +112,7 @@ class UpdateConstantLogic extends AbstractControllerLogic
$constantObject = [];
$constantObject[$request->input('id')] = $request->input('rate');
$constantObject[$request->input('id')] = $request->input('value');
$object = new ConstantObject(
$request->input('reference'),
@@ -7,9 +7,9 @@ class UpdatesConstantValue
/**
* @param $json
* @param int $status_id
* @param Array $rate
* @return Array
* @param int $state_id
* @param array $rate
* @return array
*/
public function execute($json, int $state_id, Array $rate) {
@@ -11,6 +11,8 @@ class SegmentConstants
public const BASE_PRICE = 'BASE_PRICE';
public const CUSTOM_PRICE = 'CUSTOM_PRICE';
public const WAREHOUSE_RATE = 'WAREHOUSE_RATE';
public const STATE_RATE = 'STATE_RATE';
+2 -4
View File
@@ -15,13 +15,11 @@ class SegmentResource extends JsonResource
*/
public function toArray($request)
{
$constant = $this->constants->where('reference', SegmentConstants::CUSTOM_PRICE)->first();
return [
'id' => $this->id,
'name' => $this->name,
// 'time_limit' => $this->when($this->whereHas('constants', function($query){
// $query->where('reference', SegmentConstants::PAYMENT_ATTEMPT_DURATION_LIMIT);
// }), $this->constants->where('reference', SegmentConstants::PAYMENT_ATTEMPT_DURATION_LIMIT)->first()),
// 'services' => CustomServiceTypeResource::collection($this->constants->where('reference', SegmentConstants::CUSTOM_SERVICE_TYPE))
'price' => $constant ? $constant->value : 0
];
}
}
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAddonsTables extends Migration
class CreateAddonsTable extends Migration
{
/**
* Run the migrations.
@@ -13,7 +13,7 @@ class CreateAddonsTables extends Migration
*/
public function up()
{
Schema::table('addons', function (Blueprint $table) {
Schema::create('addons', function (Blueprint $table) {
$table->id();
$table->morphs('owner');
$table->string('reference',200);
@@ -27,7 +27,8 @@
</div>
</div>
<div class="col col-md-3 p-l-5">
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': parameters.warehouse_id === 4, 'b-grey': parameters.warehouse_id !== 4 }" @click="parameters.warehouse_id = 4">
<!--@click="parameters.warehouse_id = 4"-->
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 bg-master-light" style="cursor: not-allowed" :class="{ 'b-primary': parameters.warehouse_id === 4, 'b-grey': parameters.warehouse_id !== 4 }">
<div class="row m-b-15 justify-content-center">
<div class="col-8">
<img src="/images/yiwu-map.png" class="w-100">
@@ -39,6 +40,7 @@
</div>
</div>
</div>
<p class="m-b-0 text-danger m-t-15" v-if="!parameters.warehouse_id">Due to pandemic prevention, we have decided to temporarily disable our Yiwu warehouse.</p>
</div>
</div>
<div class="row justify-content-center m-t-15 align-items-center" v-if="parameters.warehouse_id">
@@ -53,6 +55,7 @@
<div class="row text-center justify-content-center">
<div class="col-8">
<p class="m-b-0 text-danger m-t-15" v-if="parameters.warehouse_id === 3">近期由于船期的安排和马来西亚海关的运作等一些不可控因数导致船期延迟请大家提前做好采购安排若有不便之处敬请谅解 <br>Due to inevitable circumstances, shipping arrangements and Malaysia custom clearance may have delays. Kindly plan your purchases in advance, thank you for your cooperation.</p>
<p class="m-b-0 text-danger m-t-15" v-if="false">由于义乌船期不稳定建议发广州仓库<br>Due to unexpected shipping delays for Yiwu warehouse, you may select an alternative warehouse.</p>
<p class="m-b-0 text-danger m-t-15" v-if="parameters.warehouse_id === 4">由于义乌船期不稳定建议发广州仓库<br>Due to unexpected shipping delays for Yiwu warehouse, you may select an alternative warehouse.</p>
</div>
</div>
@@ -27,7 +27,7 @@
</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="editSegmentPrice"></i></div>
<div class="font-heading all-caps">MYR {{item.price[data.id].amount}} <i class="fa fa-edit pointer fa-fw m-l-5 requestModal text-primary" data-type="editSegmentPrice"></i></div>
<modal-component class="animate__animated animate__fast animate__fadeIn" type="editSegmentPrice">
<edit-segment-price-form-component :data="item" :section="section"></edit-segment-price-form-component>
</modal-component>
@@ -9,7 +9,7 @@
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.rate.amount">
<label class="text-primary">Segment Price (MYR)</label>
<div class="controls">
<input type="text" class="form-control fs-12" v-model.trim="parameters.rate.amount" v-money="money">
<input type="text" class="form-control fs-12" v-model.trim="parameters.price[data.id].amount" v-money="money">
</div>
</validation-wrapper-component>
<div class="row m-t-15">
@@ -33,8 +33,8 @@
parameters: {
reference: 'CUSTOM_PRICE',
id: this.data.id,
rate : {
amount: 0
value : {
amount: this.data.price[this.data.id].amount
}
}
};
+1 -1
View File
@@ -10,7 +10,7 @@
</div>
</div>
</div>
<div class="col-auto">
<div class="col-auto hide">
<notification-section-component section="section"></notification-section-component>
</div>
<div class="col-auto p-r-20 d-md-none">
+1 -1
View File
@@ -147,7 +147,7 @@
<a href="{{route('template.shipping-queue')}}"><h6 class="no-margin light fs-18 all-caps">Shipping Queue</h6></a>
</div>
</div>
<div class="row p-t-15 p-b-15 align-items-center justify-content-center">
<div class="row p-t-15 p-b-15 align-items-center justify-content-center hide">
<div class="col-auto p-r-0">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
width="25" height="25"