Compare commits

...

8 Commits

Author SHA1 Message Date
edmondlang 3f31d2d578 add foshan map 2023-04-19 00:32:22 +08:00
edmondlang 8d8c468b09 foshan-warehouse 2023-04-18 23:42:49 +08:00
Dillon Ngo 557ab483f8 Merge branch 'dillon/improvement-1' into 'master'
Reduce flooding of logs from Perfex CRM

See merge request CIEFWorldwideSdnBhd/shipping-portal!162
2023-04-15 14:02:03 +00:00
Dillon 4b0b88b5d8 Reduce flooding of logs from Perfex CRM 2023-04-15 21:46:26 +08:00
edmondlang 1960cff426 create a cron job to fix all billplz failed callback for all the success payments. 2023-04-14 11:39:24 +08:00
edmondlang 0402fc67e2 update package loading animation 2023-04-13 22:57:46 +08:00
edmondlang 4089683ab7 remove all css comments 2023-04-13 22:53:12 +08:00
edmondlang 3fdd2a2b56 update package loading animation 2023-04-13 22:46:41 +08:00
14 changed files with 255 additions and 52 deletions
+19 -2
View File
@@ -2,8 +2,8 @@
namespace App\Classes\General;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Log;
class Helper
{
@@ -24,4 +24,21 @@ class Helper
return array_slice(get_class_methods($className), 1);
}
}
/**
* @param $log
* @return none
*/
static function debugLoggerForPerfexCRM($log){
if($log){
$message = $log['message'];
$substring = 'No data were found';
if (isset($message)) {
if (strpos($message, $substring) !== false) {
// Log::info('Message exist');
} else {
Log::info($log['message']);
}
}
}
}
}
+7 -2
View File
@@ -19,7 +19,7 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Carbon\Carbon;
use Illuminate\Support\Facades\Log;
use App\Classes\General\Helper;
class UpdatePerfexCRMInvoice implements ShouldQueue
{
@@ -51,7 +51,12 @@ class UpdatePerfexCRMInvoice implements ShouldQueue
if(is_null($invoice)){
$result = (App()->make(CreatePerfexCRMInvoiceProcessor::class))->execute($transaction->owner, $this->updatePerfexCRMInvoiceObject->getIsPaid());
$invoiceId = $result->payload['id'];
if ($result) {
$invoiceId = $result->payload['id'];
} else {
// Log::error(json_encode('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed'));
Helper::debugLoggerForPerfexCRM('UpdatePerfexCRMInvoice CreatePerfexCRMInvoiceProcessor failed');
}
}
else{
$invoiceId = $invoice->id;
@@ -18,7 +18,8 @@ use Illuminate\Http\JsonResponse;
class CreateOrderLogic extends AbstractControllerLogic
{
protected function notification():array {
protected function notification(): array
{
return [
'title' => 'Created Order',
'message' => 'You have successfully created a new Order'
@@ -62,19 +63,31 @@ class CreateOrderLogic extends AbstractControllerLogic
}
public function logic(Request $request) : JsonResponse {
public function logic(Request $request): JsonResponse
{
$company = $this->fetchesCompany->execute(['id' => $request->input('company_id')]);
$address = $this->fetchesAddress->execute(['id' => $request->input('address_id')]);
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $request->input('warehouse_id')]);
// todo-new: fix this
// if select warehouse foshan
if ($request->input('warehouse_id') === 'foshan') {
// 13 - sabah, 14 - sarawak
if (in_array($address->state->id, [13, 14])) {
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::YD_FS_WEST_MALAYSIA]);
} else {
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => WarehouseReferences::YD_FS_WEST_MALAYSIA]);
}
} else {
$originWarehouse = $this->fetchesCompanyModule->execute(['id' => $request->input('warehouse_id')]);
if(!in_array($company->companyModules()->importers()->first()->id, WarehouseReferences::YD_EXEMPT_LIST)){
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => $originWarehouse->reference === WarehouseReferences::VT_GUANG_ZHOU ? WarehouseReferences::YD_GUANG_ZHOU : WarehouseReferences::YD_YIWU]);
if (!in_array($company->companyModules()->importers()->first()->id, WarehouseReferences::YD_EXEMPT_LIST)) {
$originWarehouse = $this->fetchesCompanyModule->execute(['reference' => $originWarehouse->reference === WarehouseReferences::VT_GUANG_ZHOU ? WarehouseReferences::YD_GUANG_ZHOU : WarehouseReferences::YD_YIWU]);
}
}
if($originWarehouse->reference === WarehouseReferences::YD_YIWU && in_array($address->state_id, [5, 13, 14])) {
throw new RequestValidationException('Our Yiwu warehouse is unable to ship goods to Sabah & Sarawak at the moment. you can select our Guangzhou warehouse as an alternative.');
}
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\PerfexCRM\Services;
use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Log;
use App\Classes\General\Helper;
class FetchesPerfexCRMTask
{
@@ -38,7 +39,7 @@ class FetchesPerfexCRMTask
return (object) $data;
}else{
Log::error($response);
Helper::debugLoggerForPerfexCRM($response);
return null;
}
}catch(\Exception $exception){
@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Http;
use App\Classes\Exceptions\MalformedRequestException;
use Illuminate\Support\Facades\Log;
use App\Classes\ValueObjects\Constants\PerfexCRMCustomFields;
use App\Classes\General\Helper;
class UpdatesPerfexCRMCustomer
{
@@ -37,7 +38,7 @@ class UpdatesPerfexCRMCustomer
$data = $response->json();
return (object) $data;
}else{
Log::error($response);
Helper::debugLoggerForPerfexCRM($response);
return null;
}
}catch(\Exception $exception){
@@ -22,6 +22,10 @@ final class WarehouseReferences {
public const VT_SARAWAK = 'SRW-V01';
public const YD_FS_WEST_MALAYSIA = 'FS-V01';
public const YD_FS_EAST_MALAYSIA = 'FS-V02';
public const VT_DESTINATION_WAREHOUSE = [
1 => self::VT_KLANG,
2 => self::VT_KLANG,
@@ -32,7 +32,7 @@ class FixBillplzFailedCallbackPayment extends Command
*
* @var string
*/
protected $description = 'Check all failled callback from billplz';
protected $description = 'Fix all failled callback from billplz';
protected $output = null;
@@ -77,7 +77,7 @@ class FixBillplzFailedCallbackPayment extends Command
{
ini_set('memory_limit', '-1');
$this->info(Carbon::now() . ' : Billplz Failled Callback cron started.');
$this->info(Carbon::now() . ' : Fix failled callback from billplz cron started.');
$this->outputArray = [];
$start = new Carbon();
+5
View File
@@ -47,6 +47,11 @@ class Kernel extends ConsoleKernel
->hourly()
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/auto_generate_invoice.log');
$schedule->command('billplz-failed-callback:fix')
->dailyAt('00:00')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/dix_failed_callback_from_billplz.log');
}
/**
@@ -57,6 +57,10 @@ class DownloadOrderQrPdfController
}
}
if(in_array($warehouse->reference,[WarehouseReferences::YD_FS_EAST_MALAYSIA, WarehouseReferences::YD_FS_WEST_MALAYSIA])){
$warehousePrefix = 'FS/';
}
$data = [
'order' => $order,
'marking' => $warehousePrefix.$deliveryPrefix.'CIEF/'.$customerMarking,
@@ -0,0 +1,127 @@
<?php
namespace Database\Seeders;
use App\Classes\Modules\Addresses\DataTransferObjects\AddressObject;
use App\Classes\Modules\Addresses\Processors\CreateAddressFromOldAddressProcessor;
use App\Classes\Modules\Addresses\Services\CreatesAddress;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyConnectionObject;
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
use App\Classes\Modules\Companies\Processors\CreateCompanyModuleProcessor;
use App\Classes\Modules\Companies\Processors\CreateCompanyProcessor;
use App\Classes\Modules\Companies\Services\ApprovesCompanyConnection;
use App\Classes\Modules\Companies\Services\CreatesCompany;
use App\Classes\Modules\Companies\Services\CreatesCompanyConnection;
use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Classes\Modules\Contacts\Services\CreatesContact;
use App\Classes\ValueObjects\Constants\AddressType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\CompanyType;
use App\Classes\ValueObjects\Constants\BusinessType;
use App\Classes\ValueObjects\Constants\WarehouseReferences;
use App\Models\CompanyModule;
use App\Models\OldCompany;
use Illuminate\Database\Seeder;
use App\Models\Company;
class FoshanWarehouseTableSeeder extends Seeder
{
/** @var CreateCompanyProcessor */
private $createCompanyProcessor;
/** @var UpdatesCompanyStatus*/
private $updatesCompanyStatus;
/** @var CreateCompanyModuleProcessor */
private $createCompanyModuleProcessor;
/** @var CreateContactProcessor */
private $createContactProcessor;
/** @var CreatesCompanyConnection */
private $createsCompanyConnection;
/** @var ApprovesCompanyConnection */
private $approvesCompanyConnection;
/** @var CreateAddressFromOldAddressProcessor */
private $createAddressFromOldAddressProcessor;
/** @var CreatesAddress */
private $createsAddress;
/** @var FetchesCompany */
private $fetchesCompany;
/** @var CreatesContact */
private $createsContact;
/**
* ModernWarehouseTableSeeder constructor.
* @param CreateCompanyProcessor $createCompanyProcessor
* @param UpdatesCompanyStatus $updatesCompanyStatus
* @param CreateCompanyModuleProcessor $createCompanyModuleProcessor
* @param CreateContactProcessor $createContactProcessor
* @param CreatesCompanyConnection $createsCompanyConnection
* @param ApprovesCompanyConnection $approvesCompanyConnection
* @param CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor
* @param CreatesAddress $createsAddress
* @param FetchesCompany $fetchesCompany
* @param CreatesContact $createsContact
*/
public function __construct(CreateCompanyProcessor $createCompanyProcessor, UpdatesCompanyStatus $updatesCompanyStatus, CreateCompanyModuleProcessor $createCompanyModuleProcessor, CreateContactProcessor $createContactProcessor, CreatesCompanyConnection $createsCompanyConnection, ApprovesCompanyConnection $approvesCompanyConnection, CreateAddressFromOldAddressProcessor $createAddressFromOldAddressProcessor, CreatesAddress $createsAddress, FetchesCompany $fetchesCompany, CreatesContact $createsContact)
{
$this->createCompanyProcessor = $createCompanyProcessor;
$this->updatesCompanyStatus = $updatesCompanyStatus;
$this->createCompanyModuleProcessor = $createCompanyModuleProcessor;
$this->createContactProcessor = $createContactProcessor;
$this->createsCompanyConnection = $createsCompanyConnection;
$this->approvesCompanyConnection = $approvesCompanyConnection;
$this->createAddressFromOldAddressProcessor = $createAddressFromOldAddressProcessor;
$this->createsAddress = $createsAddress;
$this->fetchesCompany = $fetchesCompany;
$this->createsContact = $createsContact;
}
/**
* Run the database seeds.
*
* @return void
* @throws \App\Classes\Exceptions\AccessForbiddenException
* @throws \App\Classes\Exceptions\MalformedRequestException
* @throws \App\Classes\Exceptions\RequestValidationException
*/
public function run()
{
/** @var Company $company */
$company = $this->fetchesCompany->execute(['reference' => 'MODERN']);
// YD_FS_WEST_MALAYSIA - FS-V01
/** @var CompanyModule $companyModule */
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
$companyModule->update(['name' => 'Foshan', 'reference' => WarehouseReferences::YD_FS_WEST_MALAYSIA]);
$address = new AddressObject('广东省 佛山市 南海区 狮山镇北园东路6号D幢1楼', '', 2, 35, 638, 528225, AddressType::DELIVERY, ApprovalStatus::APPROVED);
$contact = new ContactObject('郑佳鹏', '18520607573', '', '');
$this->createsAddress->execute($companyModule, $address);
$this->createsContact->execute($companyModule, $contact);
// FS_EAST_MALAYSIA - FS-V02
/** @var CompanyModule $companyModule */
$companyModule = $this->createCompanyModuleProcessor->execute($company, BusinessType::WAREHOUSE);
$companyModule->update(['name' => 'Foshan', 'reference' => WarehouseReferences::YD_FS_EAST_MALAYSIA]);
$address = new AddressObject('广东省 佛山市 南海区 狮山镇北园东路6号C幢1楼', '', 2, 35, 638, 528225, AddressType::DELIVERY, ApprovalStatus::APPROVED);
$contact = new ContactObject('游万彬', '18520607573', '', '');
$this->createsAddress->execute($companyModule, $address);
$this->createsContact->execute($companyModule, $contact);
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

@@ -1,16 +1,55 @@
<template>
<div class="row align-items-center justify-content-center w-100">
<div class="row" style="margin-top: 100px; margin-bottom: 100px;">
<div class="col">
<div class='tetrominos'>
<div class='tetromino box1'></div>
<div class='tetromino box2'></div>
<div class='tetromino box3'></div>
<div class='tetromino box4'></div>
<div class="row align-items-center justify-content-center w-100" style="height: 200px; top: 0;">
<div class="col">
<div class='tetrominos'>
<div class='tetromino box1'></div>
<div class='tetromino box2'></div>
<div class='tetromino box3'></div>
<div class='tetromino box4'></div>
</div>
</div>
</div>
<div class="row align-items-center justify-content-center">
<div class="col">
<p class="text-center fs-15 muted all-caps font-lato" style="letter-spacing: 2px">
Loading Packages Data
<span class="loading-text"></span>
</p>
</div>
</div>
</div>
</div>
</template>
<style>
.loading-text::after {
content: ".";
animation: loading 2s infinite;
}
@keyframes loading {
0% {
content: ". ";
}
25% {
content: ". . ";
}
50% {
content: ". . . ";
}
75% {
content: ". . . . ";
}
100% {
content: ". . . . . ";
}
}
.tetrominos {
position: absolute;
top: 50%;
@@ -45,31 +84,23 @@
@keyframes tetromino1 {
/* compose logo */
/* 1 on 3 */
/* L-shape */
0%,
40% {
transform: translate(0, 0);
}
50% {
/* pre-box */
transform: translate(48px, -27px);
}
60%,
100% {
/* box */
/* compose logo */
transform: translate(96px, 0);
}
}
@keyframes tetromino2 {
/* compose logo */
/* 1 on 3 */
0%,
20% {
transform: translate(96px, 0px);
@@ -77,41 +108,29 @@
40%,
100% {
/* L-shape */
/* box */
/* compose logo */
transform: translate(144px, 27px);
}
}
@keyframes tetromino3 {
/* compose logo */
0% {
transform: translate(144px, 27px);
}
20%,
60% {
/* 1 on 3 */
/* L-shape */
/* box */
transform: translate(96px, 54px);
}
90%,
100% {
/* compose logo */
transform: translate(48px, 27px);
}
}
@keyframes tetromino4 {
/* compose logo */
/* 1 on 3 */
/* L-shape */
/* box */
0%,
60% {
transform: translate(48px, 27px);
@@ -119,7 +138,6 @@
90%,
100% {
/* compose logo */
transform: translate(0, 0);
}
}
@@ -12,8 +12,8 @@
</div>
</div>
<div class="row text-center justify-content-center">
<div class="col col-md-3 p-r-5">
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer" :class="{ 'b-primary': parameters.warehouse_id === 3, 'b-grey': parameters.warehouse_id !== 3 }" @click="parameters.warehouse_id = 3">
<div class="col-12 col-md-3 p-l-5 p-r-5">
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer h-100" :class="{ 'b-primary': parameters.warehouse_id === 3, 'b-grey': parameters.warehouse_id !== 3 }" @click="parameters.warehouse_id = 3">
<div class="row m-b-15 justify-content-center">
<div class="col-8">
<img src="/images/guangzhou-map.png" class="w-100">
@@ -26,8 +26,8 @@
</div>
</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" @click="parameters.warehouse_id = 4" :class="{ 'b-primary': parameters.warehouse_id === 4, 'b-grey': parameters.warehouse_id !== 4 }">
<div class="col-12 col-md-3 p-l-5 p-r-5">
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer h-100" @click="parameters.warehouse_id = 4" :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">
@@ -40,6 +40,20 @@
</div>
</div>
</div>
<div class="col-12 col-md-3 p-l-5 p-r-5">
<div class="b-a b-thick p-t-15 p-b-15 p-l-35 p-r-35 pointer h-100" @click="parameters.warehouse_id = 'foshan'" :class="{ 'b-primary': parameters.warehouse_id === 'foshan', 'b-grey': parameters.warehouse_id !== 'foshan'}">
<div class="row m-b-15 justify-content-center">
<div class="col-8">
<img src="/images/foshan-map.png" class="w-100">
</div>
</div>
<div class="row">
<div class="col">
<h5 class="no-margin" :class="{ 'text-primary': parameters.warehouse_id === 'foshan', 'semi-bold': parameters.warehouse_id === 'foshan'}">Foshan</h5>
</div>
</div>
</div>
</div>
</div>
<div class="row justify-content-center m-t-15 align-items-center" v-if="parameters.warehouse_id">
<div class="col-6">
@@ -1,13 +1,7 @@
<template>
<div class="row">
<div class="col">
<!-- <loading-component style="height: 200px; top: 0;" v-if="isLoading"></loading-component> -->
<box-loading-component style="height: 200px; top: 0; margin-top: 50px;" v-if="isLoading"></box-loading-component>
<div class="row align-items-center justify-content-center" v-if="isLoading">
<div class="col">
<p class="text-center fs-15 muted all-caps font-lato" style="letter-spacing: 2px">Loading Packages Data</p>
</div>
</div>
<box-loading-component v-if="isLoading"></box-loading-component>
<div class="row" v-if="!dataLoaded">
<div class="col">
<div v-if="!isLoading" class="btn btn-sm btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none p-r-30" @click="fetchCompany">Click here to load Package Data</div>