Compare commits

...

97 Commits

Author SHA1 Message Date
Dillon Ngo 295072153d Merge branch 'dillon/70-laravel-vapor' into 'master'
Laravel Vapor - Disable all schedule commands

See merge request CIEFWorldwideSdnBhd/shipping-portal!237
2024-09-13 17:43:28 +00:00
Dillon Ngo e90aebd107 Laravel Vapor - Disable all schedule commands 2024-09-14 00:03:22 +08:00
edmondlang b7c6c13bde fix payment-and-billing vue console error 2024-09-01 19:58:51 +08:00
edmondlang 01d666d92a fix payment-and-billing vue console error 2024-09-01 19:48:44 +08:00
Dillon Ngo b3973b52d1 Merge branch 'dillon/46.15-onhold-list-anomaly-fix' into 'master'
Data patch for a problem reported about an item not suppose to appear in ...

See merge request CIEFWorldwideSdnBhd/shipping-portal!236
2024-08-17 00:41:10 +00:00
Dillon Ngo 694876c31f Data patch for a problem reported about an item not suppose to appear in export/on-hold-packing-list 2024-08-17 08:39:19 +08:00
edmondlang 499782bbec update /export/aging-list, add 'is credit term customer' column 2024-08-04 00:39:15 +08:00
edmondlang f3eca3dd89 Export Group Transactions CSV 2024-08-03 23:04:47 +08:00
Aqqil Azman 9c4c472a40 fix wrong decimal round off 2024-08-01 09:37:22 +08:00
Aqqil Azman a67afdc0ff changed decimal points to 2 2024-08-01 09:34:14 +08:00
edmondlang b30cdaba84 fix export/aging-list, it has duplicated rows due to unnecessary joins 2024-07-26 00:58:49 +08:00
Dillon Ngo 9ac0ca45be Merge branch 'dillon/46.14-data-patch' into 'master'
Data patch for storage invoice

See merge request CIEFWorldwideSdnBhd/shipping-portal!235
2024-07-22 23:07:16 +00:00
Dillon Ngo 3fe98b24a4 Data patch for storage invoice 2024-07-23 07:06:34 +08:00
Dillon Ngo 7e7e43ee9c Merge branch 'dillon/46.14-data-patch' into 'master'
Data patch for storage invoice

See merge request CIEFWorldwideSdnBhd/shipping-portal!234
2024-07-22 23:00:09 +00:00
Dillon Ngo 39892a0938 Data patch for storage invoice 2024-07-23 06:58:10 +08:00
edmondlang 0ffe81d1cf update call wac webhook 2024-07-19 00:35:38 +08:00
edmondlang 5fd6e6a528 update call wac webhook 2024-07-19 00:28:51 +08:00
edmondlang 09ede52ecf update call wac webhook 2024-07-18 23:59:23 +08:00
edmondlang e5d6f3f581 wac webhook 2024-07-18 23:11:04 +08:00
edmondlang aa65b333c8 update permits reminder 2024-07-17 18:13:50 +08:00
edmondlang 656c50e047 update permits reminder 2024-07-17 18:11:34 +08:00
edmondlang 275157b243 update permits reminder 2024-07-17 17:49:33 +08:00
edmondlang 0c9ffd2bf7 call wac webhook 2024-07-06 11:24:54 +08:00
edmondlang d4dcae155d add command to fix missing packinglist 2024-07-03 12:56:16 +08:00
edmondlang bad8cadb3a remove edmond email from permits reminder 2024-07-02 21:12:52 +08:00
edmondlang 3af32cc6e7 remove command fix missing packinglist 2024-07-02 20:57:27 +08:00
edmondlang 34bab6a45c fix missing packinglist 2024-07-02 20:52:06 +08:00
edmondlang dd1eae1ea2 fix missing packinglist 2024-07-02 13:02:16 +08:00
Dillon Ngo b46bfb38bf Merge branch 'dillon/62.3-fixes' into 'master'
Quick fix on https://izyim.cief-malaysia.com/order/show/245904319

See merge request CIEFWorldwideSdnBhd/shipping-portal!233
2024-07-01 07:01:20 +00:00
Dillon Ngo 19c4ee4fda Quick fix 2024-07-01 15:00:14 +08:00
Omair Saleh 13f13c7a0e export based on payment date 2024-07-01 13:46:12 +08:00
Omair Saleh ffa63f611b export based on payment date 2024-07-01 13:42:12 +08:00
Omair Saleh 82675ab80c export based on payment date 2024-07-01 13:40:14 +08:00
Omair Saleh aac04c4135 export based on payment date 2024-07-01 13:17:22 +08:00
Omair Saleh 56dca799f8 export based on payment date 2024-07-01 13:13:57 +08:00
Omair Saleh 42d8f811c6 export based on payment date 2024-07-01 13:13:15 +08:00
Omair Saleh 030136fd03 Merge remote-tracking branch 'origin/master' 2024-07-01 12:57:42 +08:00
Omair Saleh c8b6e271e3 export based on payment date 2024-07-01 12:57:23 +08:00
Dillon Ngo f93997b858 Merge branch 'dillon/62.2-benchmarking-yd-api-cron-job' into 'master'
Benchmark cron job for YD API call

See merge request CIEFWorldwideSdnBhd/shipping-portal!232
2024-06-29 07:33:25 +00:00
Dillon Ngo 6fbc23d7c4 Benchmark cron job for YD API call 2024-06-29 15:32:32 +08:00
Dillon Ngo e0a264d58f Merge branch 'dillon/62.2-benchmarking-yd-api-cron-job' into 'master'
Benchmark cron job for YD API call

See merge request CIEFWorldwideSdnBhd/shipping-portal!231
2024-06-29 06:01:54 +00:00
Dillon Ngo fec20b0947 Benchmark cron job for YD API call 2024-06-29 14:01:13 +08:00
Dillon Ngo 0bf61d93c5 Merge branch 'dillon/62.2-benchmarking-yd-api-cron-job' into 'master'
Benchmark cron job for YD API call

See merge request CIEFWorldwideSdnBhd/shipping-portal!230
2024-06-29 03:21:24 +00:00
Dillon Ngo bea24fb48e Benchmark cron job for YD API call 2024-06-29 11:19:55 +08:00
edmondlang 17a4522f50 add transaction counter 2024-06-26 23:52:25 +08:00
edmondlang dfedb99c13 fix bug: customer pay full amount but payment cant go through due to rounding up issue 2024-06-26 23:43:40 +08:00
edmondlang 669cac9bd4 fix-approved-payment-failed-group 2024-06-26 13:47:58 +08:00
edmondlang d7625aece7 update group-transaction-with-completed-payments 2024-06-26 13:07:30 +08:00
edmondlang a36c5c3063 show group-transaction-with-completed-payments 2024-06-26 12:47:44 +08:00
Dillon Ngo fd75da5778 Merge branch 'dillon/51.5-vue-store-update' into 'master'
A minor fix to not allow non-admin user to see admin data by navigating to the...

See merge request CIEFWorldwideSdnBhd/shipping-portal!229
2024-06-17 00:58:05 +00:00
Dillon Ngo b593605c72 A minor fix to not allow non-admin user to see admin data by navigating to the url /payment-and-billing-2 2024-06-17 08:51:09 +08:00
Dillon Ngo 8d75012390 Merge branch 'dillon/62.1-fixes' into 'master'
Reinstate original code after data patch

See merge request CIEFWorldwideSdnBhd/shipping-portal!228
2024-06-16 06:14:47 +00:00
Dillon Ngo 2d98757c1c Data patch meant to fix a group payment with group id 609 and transaction id 16803 that got stuck after making paying 2024-06-16 14:13:09 +08:00
Dillon Ngo b329f232f2 Merge branch 'dillon/62.1-fixes' into 'master'
Data patch meant to fix a group payment with group id 609 and transaction id...

See merge request CIEFWorldwideSdnBhd/shipping-portal!227
2024-06-16 06:06:54 +00:00
Dillon Ngo 713922d2ee Data patch meant to fix a group payment with group id 609 and transaction id 16803 that got stuck after making paying 2024-06-16 14:04:16 +08:00
Dillon Ngo 74d11f8305 Merge branch 'dillon/62.1-fixes' into 'master'
Fix a rounding problem in group payment which will result in goods cannot be...

See merge request CIEFWorldwideSdnBhd/shipping-portal!226
2024-06-14 21:58:25 +00:00
Dillon Ngo ea920717a1 Fix a rounding problem in group payment which will result in goods cannot be released through CallbackBillplzLogic 2024-06-15 05:56:23 +08:00
Dillon Ngo e1b49f6be0 Merge branch 'dillon/46.13-missing-payment-proof-feature' into 'master'
Restore missing payment proof feature

See merge request CIEFWorldwideSdnBhd/shipping-portal!224
2024-06-14 21:45:15 +00:00
edmondlang 1be405ca93 fix error message in admin dashbaord 2024-06-13 23:47:43 +08:00
Dillon Ngo e63e3e707f 'Your Payment Proof' feature missing for order with storage invoices through group payment 2024-06-09 12:44:19 +08:00
Dillon Ngo aeaec32dcb 'Your Payment Proof' feature missing for order with storage invoices through group payment 2024-06-09 12:16:18 +08:00
Dillon Ngo b000c25e66 'Your Payment Proof' feature missing for order with storage invoices through group payment 2024-06-09 12:00:19 +08:00
edmondlang 1e9af59b91 test gtag 2024-06-07 17:40:48 +08:00
edmondlang a392b8a5eb test ga4 2024-06-07 17:35:57 +08:00
edmondlang 30edc3eaba updates RescheduleContainerLogic delete all the previous container transport schedule, then create a new one 2024-05-30 23:08:05 +08:00
edmondlang b0eca18343 show packinglist reference for admin only 2024-05-27 00:53:48 +08:00
Dillon Ngo 88e1b43f19 Merge branch 'dillon/46.11-warehouse-storage-related-fixes' into 'master'
Inserted logs for monitoring warehouse storage charges

See merge request CIEFWorldwideSdnBhd/shipping-portal!223
2024-05-26 08:58:20 +00:00
omair saleh fc9f6d6dde Merge branch 'fulfilment-banner' into 'master'
fix segment requried contact bug

See merge request CIEFWorldwideSdnBhd/shipping-portal!222
2024-05-24 06:52:53 +00:00
Jia Sheng 141dab15b6 fix segment requried contact bug 2024-05-23 11:44:18 +08:00
edmondlang c9ac435e37 update confirmation message 2024-05-21 01:33:24 +08:00
edmondlang 6d01bdfb60 Merge branch 'fulfilment-banner' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal 2024-05-21 01:27:47 +08:00
edmondlang e2dc83e441 add segments in the menu bar. 2024-05-21 01:26:09 +08:00
Jia Sheng e9daadaf60 not interested confirmation 2024-05-21 01:25:14 +08:00
edmondlang 7cace7e800 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal into fulfilment-banner 2024-05-21 00:54:21 +08:00
Jia Sheng 64fa56c02f fulfilment banner flow update, segment user index list 2024-05-20 22:51:22 +08:00
Dillon Ngo 3f962e774d Merge branch 'dillon/51.5-vue-store-update' into 'master'
Vue Polling - Fix minor typo error

See merge request CIEFWorldwideSdnBhd/shipping-portal!221
2024-05-19 19:14:56 +00:00
Dillon Ngo 4ba2144f02 Vue Polling - Fix minor typo error 2024-05-20 02:28:49 +08:00
Dillon Ngo 69f2b384cf Merge branch 'dillon/51.5-vue-store-update' into 'master'
Vue Polling - Refactor code to use vuex

See merge request CIEFWorldwideSdnBhd/shipping-portal!220
2024-05-19 16:06:00 +00:00
Dillon Ngo f1a35299e6 Vue Polling - Remove unnecessary code 2024-05-19 23:48:40 +08:00
Dillon Ngo b15866ea16 Vue Polling - Remove comments in code 2024-05-19 23:47:00 +08:00
Dillon Ngo bd42f7213a Vue Polling - Refactor code to use vuex 2024-05-18 18:55:21 +08:00
jiasheng224 2d92b1a8ab fulfilment banner module 2024-05-08 18:30:12 +08:00
Dillon Ngo 06e3049e50 Debugging 2024-05-08 03:03:58 +08:00
Dillon Ngo b0fa73a12b Debugging 2024-05-08 01:52:51 +08:00
Dillon Ngo 5d66761465 Merge branch 'dillon/60-shipping-portal-fixes' into 'master'
Deleted a file that should no longer be used

See merge request CIEFWorldwideSdnBhd/shipping-portal!219
2024-05-07 16:53:13 +00:00
Dillon Ngo 1ac4615c99 Delete a file that should no longer be used 2024-05-08 00:52:33 +08:00
Dillon Ngo 590960b5fd Merge branch 'dillon/60-shipping-portal-fixes' into 'master'
Move a file that should no longer be used (deprecated)

See merge request CIEFWorldwideSdnBhd/shipping-portal!218
2024-05-07 16:50:42 +00:00
Dillon Ngo 5f24f58480 Move a file that should no longer be used 2024-05-08 00:48:15 +08:00
edmondlang 4dec576aa0 Merge branch 'master' of https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal 2024-05-08 00:31:22 +08:00
edmondlang 4a41c89024 fix MappableTransactionWithDetailsResource.php 2024-05-08 00:30:01 +08:00
Dillon Ngo a0997a4649 Merge branch 'dillon/60-shipping-portal-fixes' into 'master'
Fix a problem with inefficient query discovered from Laravel Vapor integration (payment and billing page, pending payment tab)

See merge request CIEFWorldwideSdnBhd/shipping-portal!217
2024-05-07 16:27:55 +00:00
Dillon Ngo b90dae882e Fix a problem with inefficient query discovered from Laravel Vapor integration 2024-05-08 00:26:12 +08:00
edmondlang f361a7e185 fix MappableTransactionWithDetailsResource.php 2024-05-08 00:24:22 +08:00
Dillon Ngo 29619625d1 Merge branch 'dillon/46.11-warehouse-storage-related-fixes' into 'master'
Fix multipe interface user experience (UX) problem originally reported by Yien

See merge request CIEFWorldwideSdnBhd/shipping-portal!216
2024-05-07 16:15:11 +00:00
Dillon Ngo 1705b5c2e5 Fix a front end UX problem reported by Yien 2024-05-06 13:19:23 +08:00
Dillon Ngo 1813783d87 Merge branch 'dillon/60-shipping-portal-fixes' into 'master'
Fix emails cannot be sent with attachment

See merge request CIEFWorldwideSdnBhd/shipping-portal!215
2024-05-04 09:53:01 +00:00
Dillon Ngo 46a0e670ba Fix emails cannot be sent with attachment 2024-05-04 17:51:57 +08:00
69 changed files with 1935 additions and 577 deletions
@@ -0,0 +1,24 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class CompanySegmentsIn implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereHas('companyModules', function ($module) use ($value) {
$module->whereHas('connections', function ($connection) use ($value) {
$connection->whereHas('connectionSegments', function ($segment) use ($value) {
$segment->whereIn('segment_id', $value);
});
});
});
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Classes\General\Eloquent\Filters;
use Illuminate\Database\Eloquent\Builder;
class MarkingIn implements Filter
{
/**
* @param Builder $builder
* @param $value
* @return Builder|mixed
*/
public static function apply(Builder $builder, $value)
{
return $builder->whereHas('companyModules', function ($module) use ($value) {
$module->whereHas('connections', function ($connection) use ($value) {
$connection->whereIn('invitee_reference', $value);
});
});
}
}
@@ -13,6 +13,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class FetchOrdersFromYDPortalJob implements ShouldQueue class FetchOrdersFromYDPortalJob implements ShouldQueue
{ {
@@ -29,12 +30,17 @@ class FetchOrdersFromYDPortalJob implements ShouldQueue
*/ */
public function handle() public function handle()
{ {
Log::info('FetchOrdersFromYDPortalJob starts');
Log::info('FetchPackingListsFromYdPortalProcessor starts');
(App()->make(FetchPackingListsFromYdPortalProcessor::class))->execute(); (App()->make(FetchPackingListsFromYdPortalProcessor::class))->execute();
Log::info('FetchContainersFromYdPortalProcessor starts');
(App()->make(FetchContainersFromYdPortalProcessor::class))->execute(); (App()->make(FetchContainersFromYdPortalProcessor::class))->execute();
Log::info('FetchContainersUpdatesFromYdPortalProcessor starts');
(App()->make(FetchContainersUpdatesFromYdPortalProcessor::class))->execute(); (App()->make(FetchContainersUpdatesFromYdPortalProcessor::class))->execute();
Log::info('FetchDeliveryUpdatesFromYdPortalProcessor starts');
(App()->make(FetchDeliveryUpdatesFromYdPortalProcessor::class))->execute(); (App()->make(FetchDeliveryUpdatesFromYdPortalProcessor::class))->execute();
Log::info('FetchOrdersFromYDPortalJob ends');
// (App()->make(FetchOrderListsFromYdPortalProcessor::class))->execute(); // (App()->make(FetchOrderListsFromYdPortalProcessor::class))->execute();
} }
} }
@@ -36,6 +36,8 @@ use App\Models\User;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class CreateCustomerLogic extends AbstractControllerLogic class CreateCustomerLogic extends AbstractControllerLogic
{ {
@@ -167,6 +169,19 @@ class CreateCustomerLogic extends AbstractControllerLogic
CreatePerfexCRMCustomer::dispatch($createLeadPerfexCRMObject); CreatePerfexCRMCustomer::dispatch($createLeadPerfexCRMObject);
} }
if(app()->environment(['production'])){
// call wac webhook
$url = config('wagWebhookUrl.account_registration_url');
$payload = [
'name' => $request->input('name'),
'email' => $request->input('email'),
'phone' => $request->input('phone'),
'portal' => 'izyim'
];
$response = Http::post($url, $payload);
Log::channel('wac_webhook')->info('Register Account: ' . json_encode($response));
}
// $this->generateEmailVerificationAttemptProcessor->execute($user); // $this->generateEmailVerificationAttemptProcessor->execute($user);
return $this->response($this->authenticationProcessor->execute($request)); return $this->response($this->authenticationProcessor->execute($request));
@@ -0,0 +1,140 @@
<?php
namespace App\Classes\Modules\Billplzs\Processors;
use Illuminate\Http\Request;
use App\Models\Wallet;
use App\Models\Group;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\Modules\Transactions\Processors\CreatePaymentTransactionProcessor;
use App\Classes\Modules\Transactions\Processors\ReleaseGoodsToCustomerProcessor;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use App\Classes\Modules\Wallets\Services\UpdatesWalletBalance;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use Illuminate\Support\Facades\Log;
//Date: 20240817
//This Processor is used for one time data patching with OneTimeTransactionFixBillplzFailedCallback.php
class CallbackBillplzDataPatchProcessor
{
/** @var UpdatesTransactionStatus */
private $updatesTransactionStatus;
/** @var UpdateDoFromVTPortalProcessor */
private $updateDoFromVTPortalProcessor;
/** @var UpdateDoFromYDPortalProcessor */
private $updateDoFromYDPortalProcessor;
/** @var UpdatesWalletBalance */
private $updatesWalletBalance;
/** @var CreatePaymentTransactionProcessor */
private $createPaymentTransactionProcessor;
/** @var ReleaseGoodsToCustomerProcessor */
private $releaseGoodsToCustomerProcessor;
/**
* CallbackBillplzDataPatchProcessor constructor.
* @param UpdatesTransactionStatus $updatesTransactionStatus
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
* @param UpdatesWalletBalance $updatesWalletBalance
* @param CreatePaymentTransactionProcessor $createPaymentTransactionProcessor
* @param ReleaseGoodsToCustomerProcessor $releaseGoodsToCustomerProcessor
*/
public function __construct(UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor, UpdatesWalletBalance $updatesWalletBalance, CreatePaymentTransactionProcessor $createPaymentTransactionProcessor, ReleaseGoodsToCustomerProcessor $releaseGoodsToCustomerProcessor)
{
$this->updatesTransactionStatus = $updatesTransactionStatus;
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
$this->updatesWalletBalance = $updatesWalletBalance;
$this->createPaymentTransactionProcessor = $createPaymentTransactionProcessor;
$this->releaseGoodsToCustomerProcessor = $releaseGoodsToCustomerProcessor;
}
/**
* @param Request $request
* @throws \App\Classes\Exceptions\MalformedRequestException
*/
public function execute($transaction, $status)
{
$invoice = $transaction->owner;
$packingList = $invoice->owner;
$proceed = $this->checkForGroupPayment($transaction);
if(!$proceed) return false;
$this->updatesTransactionStatus->execute($transaction, $status);
Log::info('CallbackBillplzDataPatchProcessor 1');
// check if is wallet top up
if ($transaction->owner instanceof Wallet && $status === ApprovalStatus::APPROVED) {
Log::info('CallbackBillplzDataPatchProcessor 2');
$this->updatesWalletBalance->execute($transaction->owner, $transaction->amount);
$group = Group::where('reference', $transaction->payment_reference)->first();
// check if is group payment
if ($group) {
foreach ($group->groupTransactions as $groupTransaction) {
$invoice = $groupTransaction->transaction;
Log::info('CallbackBillplzDataPatchProcessor 3: '.json_encode($invoice));
//if($invoice->status !== ApprovalStatus::COMPLETED){
// $paymentTransaction = $this->createPaymentTransactionProcessor->execute($invoice, PaymentMethodType::WALLET, null, false);
// if($paymentTransaction && $paymentTransaction->status == ApprovalStatus::APPROVED){
$pL = $invoice->owner;
$this->releaseGoodsToCustomerProcessor->execute($pL, $invoice, true);
//}
//}
}
$group->status = $status;
$group->save();
}
}
if (!$transaction->owner instanceof Wallet) {
Log::info('CallbackBillplzDataPatchProcessor 3');
$this->releaseGoodsToCustomerProcessor->execute($packingList, $invoice);
}
return true;
}
private function checkForGroupPayment($transaction){
//This check is targetting group payment that expired and soft deleted
//command:check-storage-invoices must already run for this part of the code to work properly
$group = Group::withTrashed()->where('reference', $transaction->payment_reference)->first();
if ($group) {
$totalAmountToBePaid = 0;
$actualAmountPaid = $transaction->amount;
foreach ($group->groupTransactions as $groupTransaction) {
$invoice = $groupTransaction->transaction;
if($invoice->status !== ApprovalStatus::COMPLETED){
$totalAmountToBePaid += $invoice->amount;
}
}
if(($totalAmountToBePaid - $actualAmountPaid) < 0.01){
}
else{
Log::channel('storage_invoices')->info('Total amount from current transaction: '.$totalAmountToBePaid); //cief todo: to be removed
Log::channel('storage_invoices')->info('Total amount from paid transaction: '.$transaction->amount); //cief todo: to be removed
return false;
}
}
return true;
}
}
@@ -36,7 +36,7 @@ class CallbackBillplzProcessor
private $releaseGoodsToCustomerProcessor; private $releaseGoodsToCustomerProcessor;
/** /**
* CreateUserProcessor constructor. * CallbackBillplzProcessor constructor.
* @param UpdatesTransactionStatus $updatesTransactionStatus * @param UpdatesTransactionStatus $updatesTransactionStatus
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor * @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor * @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
@@ -7,6 +7,8 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Companies\Processors\AssignConnectionSegmentProcessor; use App\Classes\Modules\Companies\Processors\AssignConnectionSegmentProcessor;
use App\Classes\Modules\Companies\Services\FetchesCompany; use App\Classes\Modules\Companies\Services\FetchesCompany;
use App\Classes\Modules\Companies\Services\FetchesCompanyConnection; use App\Classes\Modules\Companies\Services\FetchesCompanyConnection;
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
use App\Http\Resources\CompanyResource; use App\Http\Resources\CompanyResource;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@@ -33,17 +35,22 @@ class AssignCompanyConnectionToConnectionSegmentLogic extends AbstractController
/** @var AssignConnectionSegmentProcessor */ /** @var AssignConnectionSegmentProcessor */
private $assignCompanyConnectionToConnectionSegmentProcessor; private $assignCompanyConnectionToConnectionSegmentProcessor;
/** @var CreateContactProcessor */
private $createContactProcessor;
/** /**
* AssignCompanyToSegmentLogic constructor. * AssignCompanyToSegmentLogic constructor.
* @param FetchesCompany $fetchesCompany * @param FetchesCompany $fetchesCompany
* @param FetchesCompanyConnection $fetchesCompanyConnection * @param FetchesCompanyConnection $fetchesCompanyConnection
* @param AssignConnectionSegmentProcessor $assignCompanyConnectionToConnectionSegmentProcessor * @param AssignConnectionSegmentProcessor $assignCompanyConnectionToConnectionSegmentProcessor
* @param CreateContactProcessor $createContactProcessor
*/ */
public function __construct(FetchesCompany $fetchesCompany, FetchesCompanyConnection $fetchesCompanyConnection, AssignConnectionSegmentProcessor $assignCompanyConnectionToConnectionSegmentProcessor) public function __construct(FetchesCompany $fetchesCompany, FetchesCompanyConnection $fetchesCompanyConnection, AssignConnectionSegmentProcessor $assignCompanyConnectionToConnectionSegmentProcessor, CreateContactProcessor $createContactProcessor)
{ {
$this->fetchesCompany = $fetchesCompany; $this->fetchesCompany = $fetchesCompany;
$this->fetchesCompanyConnection = $fetchesCompanyConnection; $this->fetchesCompanyConnection = $fetchesCompanyConnection;
$this->assignCompanyConnectionToConnectionSegmentProcessor = $assignCompanyConnectionToConnectionSegmentProcessor; $this->assignCompanyConnectionToConnectionSegmentProcessor = $assignCompanyConnectionToConnectionSegmentProcessor;
$this->createContactProcessor = $createContactProcessor;
} }
/** /**
@@ -62,6 +69,11 @@ class AssignCompanyConnectionToConnectionSegmentLogic extends AbstractController
$this->assignCompanyConnectionToConnectionSegmentProcessor->execute($companyConnection, $request->input('segment_id')); $this->assignCompanyConnectionToConnectionSegmentProcessor->execute($companyConnection, $request->input('segment_id'));
if ($request->input('segment_id') == 10 || $request->input('segment_id') == 11) {
$contactObject = new ContactObject('Whatsapp: ' . $request->input('name'), $request->input('phone'), null, null);
$this->createContactProcessor->execute($contactObject, $company);
}
return $this->resourceResponse(new CompanyResource($company)); return $this->resourceResponse(new CompanyResource($company));
} }
} }
@@ -24,8 +24,8 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
{ {
$this->filters = [ $this->filters = [
"has_invoice_status_in" => [2], "has_invoice_status_in" => [2],
"packing_list_ordered_by_invoice_date" => true, // "packing_list_ordered_by_invoice_date" => true,
"with_aging_column" => true // "with_aging_column" => true
]; ];
} }
@@ -39,6 +39,7 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
'Invoice Date', 'Invoice Date',
'Days', 'Days',
'Amount', 'Amount',
'Credit Term Customer',
]; ];
} }
@@ -55,9 +56,16 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
$invDate = 'n/a'; $invDate = 'n/a';
$invNo = 'n/a'; $invNo = 'n/a';
$days = 'n/a'; $days = 'n/a';
$isCreditTermCustomer = false;
if ($list->owner instanceof Order) { if ($list->owner instanceof Order) {
$inviterPivotInviteeReference = $list->owner->companyModule->inviters()->withPivot('invitee_reference')->first(); $inviterPivotInviteeReference = $list->owner->companyModule->inviters()->withPivot('invitee_reference')->first();
$companyModule = $list->owner->companyModule;
$segment = $companyModule->connections()->first()->segments()->where('name', 'Credit Term Customer')->first();
if ($segment) {
$isCreditTermCustomer = true;
}
if ($inviterPivotInviteeReference) { if ($inviterPivotInviteeReference) {
$marking = $inviterPivotInviteeReference->pivot->invitee_reference; $marking = $inviterPivotInviteeReference->pivot->invitee_reference;
@@ -87,6 +95,7 @@ class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, Sho
$invDate, $invDate,
$days, $days,
$amt, $amt,
$isCreditTermCustomer ? 'TRUE' : 'FALSE',
]; ];
} }
@@ -0,0 +1,108 @@
<?php
namespace App\Classes\Modules\Exports\Services;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Group;
use App\Models\Transaction;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
use Maatwebsite\Excel\Concerns\WithHeadingRow;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithMapping;
use Illuminate\Http\Request;
use Carbon\Carbon;
class ExportsGroupTransactions implements
FromQuery,
WithHeadings,
WithHeadingRow,
WithMapping,
ShouldAutoSize
{
use Exportable;
private $request;
public function __construct(Request $request)
{
$this->request = $request;
}
public function headings(): array
{
return [
'DocNo',
'DocDate',
'PaymentDate',
'DebtorCode',
'Ref',
'ShipInfo',
'AccNo',
'DetailDescription',
'FurtherDescription',
'ProjNo',
'DeptNo',
'Qty',
'UnitPrice',
'TaxType',
'TaxableAmt',
'TaxRate'
];
}
public function query()
{
$start_date = $this->parseDate($this->request->input('startDate'));
$end_date = $this->parseDate($this->request->input('endDate'));
return Group::when($start_date && $end_date, function ($query) use ($start_date, $end_date) {
$query->whereBetween('created_at', [
$start_date->startOfDay(),
$end_date->endOfDay()
]);
})
->when($start_date && !$end_date, function ($query) use ($start_date) {
$query->where('created_at', '>=', $start_date->startOfDay());
})
->when(!$start_date && $end_date, function ($query) use ($end_date) {
$query->where('created_at', '<=', $end_date->endOfDay());
});
}
private function parseDate($date)
{
return $date ? Carbon::parse($date)->startOfDay() : null;
}
public function map($transaction): array
{
$company = $transaction->receiverCompany;
return [
'<<New>>', //'DocNo',
'', //'DocDate',
$transaction->created_at->format('m/d/Y H:m'), //'PaymentDate',
$company->debtor, //'DebtorCode',
$company->referece, //'Ref',
$company->referece, //'ShipInfo',
'500-0000', //'AccNo',
'X1 Freight Service Charge', //'DetailDescription',
'FurtherDescription', //'FurtherDescription',
'M3', //'ProjNo',
'CIEF', //'DeptNo',
'', //'Qty',
'', //'UnitPrice',
'', //'TaxType',
floatval($transaction->tax) > 0 ? number_format($transaction->tax, 2) : '0.00', //'TaxableAmt',
'', //'TaxRate'
];
}
private function getTaxType($tax_percentage)
{
return floatval($tax_percentage) > 0 ? 'SV-6' : '';
}
}
@@ -31,6 +31,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
return [ return [
'DocNo', 'DocNo',
'DocDate', 'DocDate',
'PaymentDate',
'DebtorCode', 'DebtorCode',
'Ref', 'Ref',
'ShipInfo', 'ShipInfo',
@@ -59,12 +60,12 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
{ {
$start_date = $this->request->input('startDate', null); $start_date = $this->request->input('startDate', null);
if ($start_date) { if ($start_date) {
$start_date = Carbon::parse($this->request->input('startDate'))->format('Y-m-d'); $start_date = Carbon::parse($start_date)->startOfDay();
} }
$end_date = $this->request->input('endDate', null); $end_date = $this->request->input('endDate', null);
if ($end_date) { if ($end_date) {
$end_date = Carbon::parse($this->request->input('endDate'))->format('Y-m-d'); $end_date = Carbon::parse($end_date)->endOfDay();
} }
$query = Transaction::query(); $query = Transaction::query();
@@ -77,30 +78,31 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
$approvalStatus = ApprovalStatus::APPROVED; $approvalStatus = ApprovalStatus::APPROVED;
} }
// $query->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [$approvalStatus]); // Adjusted the query to include both types and status
$query->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->whereIn('status', [$approvalStatus]); $query->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])
->where('status', $approvalStatus);
if($start_date && $end_date) { if ($start_date && $end_date) {
$query->whereBetween('updated_at', [ $query->whereHas('transactions', function($transaction) use ($start_date, $end_date) {
Carbon::parse($start_date)->format('Y-m-d 0:00:00'), $transaction->where('type', TransactionType::PAYMENT)
Carbon::parse($end_date)->format('Y-m-d 23:59:59') ->whereBetween('updated_at', [$start_date, $end_date]);
]);
}
elseif($start_date && !$end_date) {
$query->whereHas('transactions', function($transaction) use ($start_date) {
$transaction->where('type', TransactionType::PAYMENT)->where('updated_at', '>=', Carbon::parse($start_date)->format('Y-m-d 0:00:00'));
}); });
} elseif ($start_date) {
} $query->whereHas('transactions', function($transaction) use ($start_date) {
elseif(!$start_date && $end_date) { $transaction->where('type', TransactionType::PAYMENT)
->where('updated_at', '>=', $start_date);
});
} elseif ($end_date) {
$query->whereHas('transactions', function($transaction) use ($end_date) { $query->whereHas('transactions', function($transaction) use ($end_date) {
$transaction->where('type', TransactionType::PAYMENT)->where('updated_at', '>=', Carbon::parse($end_date)->format('Y-m-d 0:00:00')); $transaction->where('type', TransactionType::PAYMENT)
->where('updated_at', '<=', $end_date);
}); });
} }
return $query; return $query;
} }
public function map($transaction): array public function map($transaction): array
{ {
$container = $transaction->owner->containers()->first(); $container = $transaction->owner->containers()->first();
@@ -142,6 +144,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
$rows[] = [ $rows[] = [
$firstItem ? '<<New>>' : '', $firstItem ? '<<New>>' : '',
$transaction->created_at->format('m/d/Y H:m'), $transaction->created_at->format('m/d/Y H:m'),
$transaction->transactions()->where('type', TransactionType::PAYMENT)->first()->updated_at->format('m/d/Y H:m'),
$company->debtor, $company->debtor,
$order->reference, $order->reference,
$order->reference, $order->reference,
@@ -153,7 +156,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
$detail->quantity, $detail->quantity,
$detail->price, $detail->price,
floatval($detail->tax_percentage) > 0 ? 'SV-6' : '', floatval($detail->tax_percentage) > 0 ? 'SV-6' : '',
floatval($detail->tax_percentage) > 0 ? $detail->amount : '0', floatval($detail->tax_percentage) > 0 ? number_format($detail->amount, 2) : '0.00',
$detail->tax_percentage, $detail->tax_percentage,
]; ];
@@ -166,7 +169,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
return [ return [
'<<New>>', '<<New>>',
$transaction->created_at->format('m/d/Y H:m'), $transaction->transactions()->where('type', TransactionType::PAYMENT)->first()->updated_at->format('m/d/Y H:m'),
$company->debtor, $company->debtor,
$order->reference, $order->reference,
$order->reference, $order->reference,
@@ -56,27 +56,21 @@ class RescheduleContainerLogic extends AbstractControllerLogic
*/ */
public function logic(Request $request) : JsonResponse public function logic(Request $request) : JsonResponse
{ {
try { $container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]); $transport = $container->transports()->first();
$transport = $container->transports()->first();
$old_sechedule = $transport->schedules()->first(); $old_schedule = $transport->schedules()->delete();
$this->updatesScheduleStatus->execute($old_sechedule, ApprovalStatus::REJECTED); // $this->updatesScheduleStatus->execute($old_schedule, ApprovalStatus::REJECTED);
$scheduleObject = new ScheduleObject( $scheduleObject = new ScheduleObject(
Carbon::parse($request->input('etd')), Carbon::parse($request->input('etd')),
Carbon::parse($request->input('eta')), Carbon::parse($request->input('eta')),
ApprovalStatus::APPROVED ApprovalStatus::APPROVED
); );
$schedule = $this->createsSchedule->execute($transport, $scheduleObject); $schedule = $this->createsSchedule->execute($transport, $scheduleObject);
return $this->resourceResponse(new ContainerResource($container));
} catch (\Exception $exception){
throw new ErrorException($exception->getMessage(), $exception->getCode());
}
return $this->resourceResponse(new ContainerResource($container));
} }
} }
@@ -76,6 +76,7 @@ class FetchDeliveryUpdatesFromYdPortalProcessor
try { try {
$client = new \GuzzleHttp\Client(['cookies' => true, 'headers' => ['Cookie' => 'utc_offset=480']]); $client = new \GuzzleHttp\Client(['cookies' => true, 'headers' => ['Cookie' => 'utc_offset=480']]);
Log::info('Delivery tracking sTrackingNo: '. $packingList->reference);
$request = $client->request('get', 'https://main.universe.com.my/Tracking/User/Paging?sEcho=1&sTrackingNo='.$packingList->reference.'&sOrgId=sti', ['timeout' => 3]); $request = $client->request('get', 'https://main.universe.com.my/Tracking/User/Paging?sEcho=1&sTrackingNo='.$packingList->reference.'&sOrgId=sti', ['timeout' => 3]);
$deliveryTracking = json_decode($request->getBody()->getContents()); $deliveryTracking = json_decode($request->getBody()->getContents());
foreach (array_reverse($deliveryTracking->aaData) as $trackingRow) { foreach (array_reverse($deliveryTracking->aaData) as $trackingRow) {
@@ -119,7 +120,7 @@ class FetchDeliveryUpdatesFromYdPortalProcessor
} }
} }
Log::info('FetchDeliveryUpdatesFromYdPortalProcessor ends');
} }
} }
@@ -138,7 +138,13 @@ class FetchPackingListsFromYdPortalProcessor
$receiveDate = Carbon::parse(substr(preg_replace("/[^0-9]/", "", $row->expressno), 0, 8)); $receiveDate = Carbon::parse(substr(preg_replace("/[^0-9]/", "", $row->expressno), 0, 8));
$customerno = preg_split('(-|\(|\)|\/)', $row->customerno); $customerno = $row->customerno;
// Check if $customerno contains '正确唛头YD' and extract the part after it
if (strpos($customerno, '正确唛头YD') !== false) {
$customerno = explode('正确唛头YD', $customerno)[1];
}
$customerno = preg_split('/[-()\/]/', $customerno);
$orderNumber = $customerno[array_key_last($customerno)]; $orderNumber = $customerno[array_key_last($customerno)];
$allow_contract = true; $allow_contract = true;
@@ -164,6 +164,7 @@ class CheckStorageInvoiceTransactionProcessor
if ($transport) { if ($transport) {
$schedule = $transport->schedules->last(); $schedule = $transport->schedules->last();
if ($schedule) { if ($schedule) {
Log::channel('storage_invoices')->info('schedule: '.json_encode($schedule));
return $schedule->eta; return $schedule->eta;
} }
} }
@@ -177,11 +178,14 @@ class CheckStorageInvoiceTransactionProcessor
$pricePerCBM = 3; $pricePerCBM = 3;
$resultNumberOfDaysFree = 10; $resultNumberOfDaysFree = 10;
$dt1 = $eta->copy()->addDay()->startOfDay(); $dt1 = $eta->copy()->addDay()->startOfDay();
$resultStartDate = $dt1->format('Y-m-d'); $dt2 = Carbon::now()->copy()->addDay()->startOfDay();
$currentDatetime = Carbon::now();
$dt2 = $currentDatetime->copy()->addDay()->startOfDay();
$resultCurrentDate = $dt2->format('Y-m-d H:i:s');
$interval = Carbon::parse($dt2)->diff($dt1); $interval = Carbon::parse($dt2)->diff($dt1);
Log::channel('storage_invoices')->info('eta: '.json_encode($eta));
Log::channel('storage_invoices')->info('dt1: '.json_encode($dt1));
Log::channel('storage_invoices')->info('dt2: '.json_encode($dt2));
Log::channel('storage_invoices')->info('interval: '.json_encode($interval));
Log::channel('storage_invoices')->info('Carbon now: '.json_encode(Carbon::now()));
$resultNumberOfDaysExceeded = $interval->days - $resultNumberOfDaysFree; $resultNumberOfDaysExceeded = $interval->days - $resultNumberOfDaysFree;
$storageInvoice = $destinationWarehousePackage->transactions()->where('transactions.type', TransactionType::STORAGE_INVOICE)->first(); $storageInvoice = $destinationWarehousePackage->transactions()->where('transactions.type', TransactionType::STORAGE_INVOICE)->first();
@@ -200,14 +204,13 @@ class CheckStorageInvoiceTransactionProcessor
$taxPercentage = TaxPercentage::DEFAULT; $taxPercentage = TaxPercentage::DEFAULT;
$price_cbm = $pricePerCBM * $cbm * $resultNumberOfDaysExceeded; $price_cbm = $pricePerCBM * $cbm * $resultNumberOfDaysExceeded;
$dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00')); $dateToCompare = Carbon::parse(env('SST_START_DATE', '2024-04-01 00:00:00'));
$shippingInvoiceTransactionCreatedDate = Carbon::now();
Log::channel('storage_invoices')->info('storageInvoice: '.json_encode($storageInvoice).', $transaction->status: '.$transaction->status); Log::channel('storage_invoices')->info('dateToCompare: '.json_encode($dateToCompare));
if(!$storageInvoice && $resultNumberOfDaysExceeded > 0 && $transaction->status != ApprovalStatus::COMPLETED){ if(!$storageInvoice && $resultNumberOfDaysExceeded > 0 && $transaction->status != ApprovalStatus::COMPLETED){
Log::channel('storage_invoices')->info('Created $transaction->id: '.$transaction->id); Log::channel('storage_invoices')->info('Created $transaction->id: '.$transaction->id);
$billNumber = $this->generatesTransactionBillNumber->execute('STOR-'); $billNumber = $this->generatesTransactionBillNumber->execute('STOR-');
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare)) { if (Carbon::now()->isAfter($dateToCompare)) {
$taxPercentage = TaxPercentage::SIX_PERCENT; $taxPercentage = TaxPercentage::SIX_PERCENT;
$total_tax = $price_cbm * $taxPercentage / 100; $total_tax = $price_cbm * $taxPercentage / 100;
$price_cbm = $price_cbm + $total_tax; $price_cbm = $price_cbm + $total_tax;
@@ -228,13 +231,13 @@ class CheckStorageInvoiceTransactionProcessor
$paymentStorageTransaction = $storageInvoice->transactions()->where('transactions.type', TransactionType::PAYMENT)->where('transactions.status', ApprovalStatus::APPROVED)->first(); $paymentStorageTransaction = $storageInvoice->transactions()->where('transactions.type', TransactionType::PAYMENT)->where('transactions.status', ApprovalStatus::APPROVED)->first();
if($paymentStorageTransaction){ if($paymentStorageTransaction){
$dateStorageInvoicePaid = $paymentStorageTransaction->created_at->copy()->addDay()->startOfDay(); $dateStorageInvoicePaid = $paymentStorageTransaction->created_at->copy()->addDay()->startOfDay();
Log::channel('storage_invoices')->info('dateStorageInvoicePaid: '.$dateStorageInvoicePaid.', resultCurrentDate: '.$resultCurrentDate); Log::channel('storage_invoices')->info('dateStorageInvoicePaid: '.$dateStorageInvoicePaid.', resultCurrentDate: '.$dt2->format('Y-m-d H:i:s'));
$intervalRecalculate = Carbon::parse($dateStorageInvoicePaid)->diff($dt1); $intervalRecalculate = Carbon::parse($dateStorageInvoicePaid)->diff($dt1);
$resultNumberOfDaysExceeded = $intervalRecalculate->days - $resultNumberOfDaysFree; $resultNumberOfDaysExceeded = $intervalRecalculate->days - $resultNumberOfDaysFree;
$price_cbm = $pricePerCBM * $cbm * $resultNumberOfDaysExceeded; $price_cbm = $pricePerCBM * $cbm * $resultNumberOfDaysExceeded;
} }
if ($shippingInvoiceTransactionCreatedDate->isAfter($dateToCompare)) { if (Carbon::now()->isAfter($dateToCompare)) {
$taxPercentage = TaxPercentage::SIX_PERCENT; $taxPercentage = TaxPercentage::SIX_PERCENT;
$total_tax = $price_cbm * $taxPercentage / 100; $total_tax = $price_cbm * $taxPercentage / 100;
$price_cbm = $price_cbm + $total_tax; $price_cbm = $price_cbm + $total_tax;
@@ -280,8 +283,8 @@ class CheckStorageInvoiceTransactionProcessor
'storageInvoiceId' => $storageInvoiceId, 'storageInvoiceId' => $storageInvoiceId,
'numberOfDaysExceeded' => $resultNumberOfDaysExceeded, 'numberOfDaysExceeded' => $resultNumberOfDaysExceeded,
'numberOfDaysFree' => $resultNumberOfDaysFree, 'numberOfDaysFree' => $resultNumberOfDaysFree,
'startDate' => $resultStartDate, 'startDate' => $dt1->format('Y-m-d'),
'currentDate' => $resultCurrentDate, 'currentDate' => $dt2->format('Y-m-d H:i:s'),
'cbm' => $cbm, 'cbm' => $cbm,
'pricePerCBM' => $pricePerCBM, 'pricePerCBM' => $pricePerCBM,
'storageInvoice' => new TransactionWithStorageResource($storageInvoice) 'storageInvoice' => new TransactionWithStorageResource($storageInvoice)
@@ -34,6 +34,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf; use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
use Illuminate\Support\Facades\Http;
class CreateInvoiceTransactionProcessor class CreateInvoiceTransactionProcessor
{ {
@@ -74,6 +75,18 @@ class CreateInvoiceTransactionProcessor
*/ */
public function execute(PackingList $packingList) public function execute(PackingList $packingList)
{ {
$ori_packing_list = $packingList;
// call wac webhook
$hasInvoiceCreated = Transaction::withTrashed()
->where('type', TransactionType::SHIPPING_INVOICE)
->where('owner_type', PackingList::class)
->where('owner_id', $ori_packing_list->id)
->exists();
if ($hasInvoiceCreated) {
Log::channel('wac_webhook')->info('Regenerating Invoice for PackingList: ' . $ori_packing_list->id . '. No call wac api.');
}
$packing_list = PackingList::where('reference', $packingList->reference)->where('type', PackingListType::SHIPPING_PACKING_LIST)->first(); $packing_list = PackingList::where('reference', $packingList->reference)->where('type', PackingListType::SHIPPING_PACKING_LIST)->first();
$billable_packing_list = $packing_list->packingLists()->first(); $billable_packing_list = $packing_list->packingLists()->first();
@@ -238,6 +251,32 @@ class CreateInvoiceTransactionProcessor
$this->createsTransactionDetail->execute($invoice_transaction, $object_detail); $this->createsTransactionDetail->execute($invoice_transaction, $object_detail);
} }
if (app()->environment('production') && !$hasInvoiceCreated) {
$order = $ori_packing_list->owner;
$companyModule = $order->companyModule;
$company = $companyModule->company;
$companyContact = $company->contacts()->first();
$employee = $companyModule->employees()->first();
$invoiceCount = Transaction::where('type', TransactionType::SHIPPING_INVOICE)
->where('receiver', $companyModule->id)
->where('status', ApprovalStatus::APPROVED)
->count();
$payload = [
'name' => $employee->name,
'email' => $employee->email,
'phone' => $companyContact->phone,
'order_reference' => $order->reference,
'portal' => 'izyim',
'invoice_count' => $invoiceCount,
];
Log::channel('wac_webhook')->info('Attempt to send wac_webhook - Invoice Created: ' . json_encode($payload));
$response = Http::post(config('wagWebhookUrl.invoice_created_url'), $payload);
Log::channel('wac_webhook')->info('Invoice Created: ' . json_encode($response));
}
return; return;
} }
@@ -0,0 +1,188 @@
<?php
namespace App\Classes\Modules\Transactions\Processors;
use App\Classes\Exceptions\MalformedRequestException;
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
use App\Classes\Modules\Transactions\Services\CreatesPaymentTransaction;
use App\Classes\Modules\Transactions\Services\CreatesTransactionDetail;
use App\Classes\Modules\Billplzs\Services\CreatesBillplzBill;
use App\Classes\Modules\Transactions\Services\CreatesTransactionableTransaction;
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
use App\Classes\ValueObjects\Constants\TransactionType;
use App\Classes\ValueObjects\Constants\PaymentMethodType;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\Modules\Wallets\Services\UpdatesWalletBalance;
use App\Models\Transaction;
use App\Models\Wallet;
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
use Illuminate\Support\Facades\Log;
//DATE: 20240616
//THIS IS A ONE TIME FIX PROCESSOR MEANT TO FIX A GROUP PAYMENT THAT GOT STUCK: https://izyim.cief-malaysia.com/customer/943GCC/payment-and-billing
//TRNASACTION WITH ID: 16803
//GROUP WITH ID: 609
class CreatePaymentTransactionOneTimeFixProcessor
{
/** @var GeneratesTransactionBillNumber */
private $generatesTransactionBillNumber;
/** @var CreatesPaymentTransaction */
private $createsPaymentTransaction;
/** @var CreatesBillplzBill */
private $createsBillplzBill;
/** @var CreatesTransactionableTransaction */
private $createsTransactionableTransaction;
/** @var UpdatesWalletBalance */
private $updatesWalletBalance;
/** @var UpdateDoFromVTPortalProcessor */
private $updateDoFromVTPortalProcessor;
/** @var UpdateDoFromYDPortalProcessor */
private $updateDoFromYDPortalProcessor ;
/** @var UpdatesTransactionStatus */
private $updatesTransactionStatus ;
/**
* @param FetchesTransaction $fetchesTransaction,
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber,
* @param CreatesPaymentTransaction $createsPaymentTransaction
* @param CreatesTransactionDetail $createsTransactionDetail
* @param CreatesBillplzBill $createsBillplzBil
* @param CreatesTransactionableTransaction $createsTransactionableTransaction
* @param UpdatesWalletBalance $updatesWalletBalance
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
* @param UpdatesTransactionStatus $updatesTransactionStatus
*/
public function __construct(
GeneratesTransactionBillNumber $generatesTransactionBillNumber,
CreatesPaymentTransaction $createsPaymentTransaction,
CreatesBillplzBill $createsBillplzBill,
CreatesTransactionableTransaction $createsTransactionableTransaction,
UpdatesWalletBalance $updatesWalletBalance,
UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor,
UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor,
UpdatesTransactionStatus $updatesTransactionStatus
)
{
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
$this->createsPaymentTransaction = $createsPaymentTransaction;
$this->createsBillplzBill = $createsBillplzBill;
$this->createsTransactionableTransaction = $createsTransactionableTransaction;
$this->updatesWalletBalance = $updatesWalletBalance;
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
$this->updatesTransactionStatus = $updatesTransactionStatus;
}
/**
* @throws MalformedRequestException
*/
public function execute(Transaction $invoice, $payment_method, $bank_code, $date, $run = true)
{
$amount = $invoice->amount;
Log::info($invoice->owner);
$company_module = $invoice->owner->owner->companyModule()->first();
$approvalStatus = ApprovalStatus::PENDING_SUBMISSION;
$billNumber = $this->generatesTransactionBillNumber->execute('PYMT-');
$payment_reference = null;
if ($payment_method == PaymentMethodType::PAYMENT_GATEWAY) {
// create billplz transaction
$payment_method = PaymentMethodType::PAYMENT_GATEWAY;
$billPlzBill = $this->createsBillplzBill->execute(
$company_module->name,
(app()->environment(['production'])) ? $company_module->employees()->first()->email : 'uldvstar@gmail.com',
'This payment is for the invoice number . ' . $billNumber,
$amount,
$billNumber,
$bank_code,
true
);
$payment_reference = $billPlzBill->id;
}
else if ($payment_method === PaymentMethodType::WALLET) {
/** @var Wallet $wallet */
$wallet = $company_module->wallets()->first();
// if((float) number_format(($wallet->amount - $amount),2) < 0){
// throw new MalformedRequestException('Insufficient wallet balance. Please Top up your wallet.');
// }
$walletPaymentBillNumber = $this->generatesTransactionBillNumber->execute('PYMT-');
$transaction_object = new TransactionObject($walletPaymentBillNumber, TransactionType::PAYMENT, 1, $company_module->id, 1, PaymentMethodType::WALLET, $amount, $amount, 1, 1, 1, 0, 0, null, ApprovalStatus::APPROVED, [], '');
$transaction = $this->createsTransactionableTransaction->execute($wallet, $transaction_object);
$transaction->created_at = $date;
$transaction->updated_at = $date;
$transaction->save();
$payment_reference = $walletPaymentBillNumber;
$this->updatesWalletBalance->execute($wallet, ($amount * -1));
if($run)
{
$packingList = $invoice->owner;
$order = $packingList->owner;
$packingList->status = ApprovalStatus::APPROVED;
$packingList->save();
if(app()->environment('production')){
$this->updateDoFromVTPortalProcessor->execute($packingList);
$this->updateDoFromYDPortalProcessor->execute($packingList);
}
}
// later use this variabke to create a approved payment transaction
$approvalStatus = ApprovalStatus::APPROVED;
// update invoice to completed
if($run){
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
}
}
else {
$payment_method = PaymentMethodType::CASH;
}
$object = new TransactionObject(
$billNumber,
TransactionType::PAYMENT,
$company_module->id,
1,
1,
$payment_method,
$amount,
$amount,
1,
1,
0,
0,
0,
null,
$approvalStatus,
null,
$payment_reference
);
$payment_transaction = $this->createsPaymentTransaction->execute($invoice, $object);
return $payment_transaction;
}
}
@@ -114,7 +114,7 @@ class CreatePaymentTransactionProcessor
/** @var Wallet $wallet */ /** @var Wallet $wallet */
$wallet = $company_module->wallets()->first(); $wallet = $company_module->wallets()->first();
if((float) number_format(($wallet->amount - $amount),2) < 0){ if((float) number_format(($wallet->amount - $amount),2) < -0.01){
throw new MalformedRequestException('Insufficient wallet balance. Please Top up your wallet.'); throw new MalformedRequestException('Insufficient wallet balance. Please Top up your wallet.');
} }
@@ -44,24 +44,33 @@ class ReleaseGoodsToCustomerProcessor
/** /**
* @param $packingList * @param $packingList
* @param $invoice * @param $invoice
* @param $processCompletedInvoices
* @throws \App\Classes\Exceptions\MalformedRequestException * @throws \App\Classes\Exceptions\MalformedRequestException
*/ */
public function execute($packingList, $invoice = null) public function execute($packingList, $invoice = null, $processCompletedInvoices = false)
{ {
$result = false; $result = false;
$totalInvoicesAmountPaid = 0.00; $totalInvoicesAmountPaid = 0.00;
$totalInvoicesAmount = 0.00; $totalInvoicesAmount = 0.00;
$invoiceTransactions = $packingList->transactions()->where('status', [ApprovalStatus::APPROVED])->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->get(); if($processCompletedInvoices){
//processCompletedInvoices, for manual processing of invoices, e.g. incomplete payment gateway finish with storage invoice
$invoiceTransactions = $packingList->transactions()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->get();
}
else{
$invoiceTransactions = $packingList->transactions()->where('status', ApprovalStatus::APPROVED)->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->get();
}
//Part 1: Process each single invoice type and get the total of all invoices //Part 1: Process each single invoice type and get the total of all invoices (STORAGE + SHIPPING)
foreach($invoiceTransactions as $invoiceTransaction){ foreach($invoiceTransactions as $invoiceTransaction){
$totalInvoiceAmountPaid = $invoiceTransaction->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount'); $totalInvoiceAmountPaid = $invoiceTransaction->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
if ($invoice && $invoice->type == $invoiceTransaction->type) { if ($invoice && $invoice->type == $invoiceTransaction->type) {
if(($invoice->amount - $totalInvoiceAmountPaid) < 0.01){ if(($invoice->amount - $totalInvoiceAmountPaid) < 0.01){
Log::channel('storage_invoices')->info('ReleaseGoodsToCustomerProcessor updatesTransactionStatus');
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED); $this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
if($invoice->type == TransactionType::STORAGE_INVOICE){ //cief todo: remove the following if block
if($invoice->type === TransactionType::STORAGE_INVOICE){
Log::channel('storage_invoices')->info('ReleaseGoodsToCustomerProcessor createStorageInvoiceDocTransactionProcessor');
$this->createStorageInvoiceDocTransactionProcessor->execute($packingList); $this->createStorageInvoiceDocTransactionProcessor->execute($packingList);
} }
} }
@@ -0,0 +1,125 @@
<?php
namespace App\Classes\Modules\Wac\ControllersLogic;
use App\Classes\Exceptions\RequestValidationException;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Accounts\DataTransferObjects\RegistrationObject;
use App\Classes\Modules\Companies\DataTransferObjects\EmploymentObject;
use App\Classes\Modules\HelpMenu\Standards\Rules\CanFetchHelpMenuQuestion;
use App\Classes\Modules\HelpMenu\Processors\FetchFirstQuestionQAProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Http\Resources\HelpMenuQuestionResource;
use App\Models\User;
use ErrorException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use App\Classes\Modules\Companies\Processors\AssignEmployeeProcessor;
use App\Classes\Modules\Accounts\Services\CreatesUser;
use App\Classes\ValueObjects\Constants\RoleTypes;
class RegisterExchangeEmailLogic extends AbstractControllerLogic
{
/**
* @return array
*/
protected function notification(): array
{
return [
'title' => 'Register Exchange Email',
'message' => 'You have successfully registered an exchange email address'
];
}
/** @var AssignEmployeeProcessor */
private $assignEmployeeProcessor;
/** @var CreatesUser */
private $createsUser;
/**
* RegisterEmailLogic constructor.
* @param AssignEmployeeProcessor $assignEmployeeProcessor
*/
public function __construct(AssignEmployeeProcessor $assignEmployeeProcessor, CreatesUser $createsUser)
{
$this->assignEmployeeProcessor = $assignEmployeeProcessor;
$this->createsUser = $createsUser;
}
/**
* @param Request $request
* @return JsonResponse
* @throws ErrorException
*/
public function logic(Request $request): JsonResponse
{
// Validate the request inputs
$validator = Validator::make(
$request->all(),
[
'izyim_email' => 'email|required',
'exchange_email' => 'email|required',
]
);
if ($validator->fails()) {
throw new RequestValidationException($validator->messages()->first());
}
// Retrieve the validated emails from the request
$izyimEmail = $request->input('izyim_email');
$exchangeEmail = $request->input('exchange_email');
// Check if both emails are the same
if ($izyimEmail === $exchangeEmail) {
return response()->json([
'message' => 'Both emails are the same.',
'status' => 'ok',
], 200);
}
// Check if the exchange email already exists in the system
$existingUser = User::where('email', $exchangeEmail)->first();
if ($existingUser) {
return response()->json([
'message' => 'The Exchange email already exists in the system.',
'status' => 'error',
], 400);
}
// Retrieve the izyim user
$izyimUser = User::where('email', $izyimEmail)->first();
if (!$izyimUser) {
return response()->json([
'message' => 'The Izyim email not found in system.',
'status' => 'error',
], 404);
}
$newUser = new User();
$newUser->name = $izyimUser->name;
$newUser->email = $exchangeEmail;
$newUser->password = $izyimUser->password;
$newUser->type = RoleTypes::USER;
$newUser->status = ApprovalStatus::APPROVED;
$newUser->save();
Log::channel('wac_webhook')->info('Wac created user: ' . $exchangeEmail);
$companyModule = $izyimUser->companyModule->first();
$Object = new EmploymentObject($companyModule, $newUser);
$this->assignEmployeeProcessor->execute($Object);
return response()->json([
'message' => 'Exchange email registered successfully.',
'status' => 'success',
], 201);
}
}
@@ -8,6 +8,7 @@ use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\PackingList; use App\Models\PackingList;
use App\Models\User; use App\Models\User;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
class InvoiceIssuedEmail extends AbstractEmail class InvoiceIssuedEmail extends AbstractEmail
@@ -35,10 +36,14 @@ class InvoiceIssuedEmail extends AbstractEmail
$invoice = $this->packingList->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->where('status', ApprovalStatus::APPROVED)->first(); $invoice = $this->packingList->transactions()->where('type', TransactionType::SHIPPING_INVOICE)->where('status', ApprovalStatus::APPROVED)->first();
$invoiceDocument = $invoice->documents()->first()->files; $invoiceDocument = $invoice->documents()->first()->files;
// $fileContent = Storage::disk('documents')->get($invoiceDocument->first()->file->file_info->original->file);
$filePath = storage_path('app/documents/' . $invoiceDocument->first()->file->file_info->original->file);
Log::info('InvoiceIssuedEmail sent - Att: '.$this->user->name.' - Invoice for order no.'. $this->packingList->owner->reference);
return (new MailMessage) return (new MailMessage)
->subject('Att: '.$this->user->name.' - Invoice for order no.'. $this->packingList->owner->reference) ->subject('Att: '.$this->user->name.' - Invoice for order no.'. $this->packingList->owner->reference)
->attach(Storage::disk('documents')->get($invoiceDocument->first()->file->file_info->original->file), [ ->attach($filePath, [
'as' => 'name.pdf', 'as' => 'name.pdf',
'mime' => 'application/pdf', 'mime' => 'application/pdf',
])->view('emails.shipment.invoice', ['user' => $this->user, 'packingList' => $this->packingList]); ])->view('emails.shipment.invoice', ['user' => $this->user, 'packingList' => $this->packingList]);
@@ -9,6 +9,7 @@ use App\Models\PackingList;
use App\Models\PasswordReset; use App\Models\PasswordReset;
use App\Models\User; use App\Models\User;
use Illuminate\Notifications\Messages\MailMessage; use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
class ShipmentDepartureEmail extends AbstractEmail class ShipmentDepartureEmail extends AbstractEmail
@@ -40,10 +41,14 @@ class ShipmentDepartureEmail extends AbstractEmail
$invoiceDocument = $invoice->documents()->first()->files; $invoiceDocument = $invoice->documents()->first()->files;
// $fileContent = Storage::disk('documents')->get($invoiceDocument->first()->file->file_info->original->file);
$filePath= storage_path('app/documents/' . $invoiceDocument->first()->file->file_info->original->file);
Log::info('ShipmentDepartureEmail sent - Att: '.$this->user->name.' - Invoice for order no.'. $this->packingList->owner->reference);
return (new MailMessage) return (new MailMessage)
->subject('Your packages are on the way to malaysia - Invoice pending payment for order no.'. $this->packingList->owner->reference) ->subject('Your packages are on the way to malaysia - Invoice pending payment for order no.'. $this->packingList->owner->reference)
->attach(Storage::disk('documents')->get($invoiceDocument->first()->file->file_info->original->file), [ ->attach($filePath, [
'as' => 'name.pdf', 'as' => 'name.pdf',
'mime' => 'application/pdf', 'mime' => 'application/pdf',
])->bcc(['email_test@cief-malaysia.com'])->view('emails.shipment.ETD', ['user' => $this->user, 'packingList' => $this->packingList]); ])->bcc(['email_test@cief-malaysia.com'])->view('emails.shipment.ETD', ['user' => $this->user, 'packingList' => $this->packingList]);
@@ -0,0 +1,94 @@
<?php
namespace App\Console\Commands;
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Group;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
class FixApprovedPaymentFailedGroup extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'fix-approved-payment-failed-group';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fix all payment is approved or completed but group failed to be updated';
protected $output = null;
protected $outputArray = [];
/** @var CallbackBillplzProcessor */
private $callbackBillplzProcessor;
/**
* Create a new command instance.
*
* @return void
*/
public function __construct(CallbackBillplzProcessor $callbackBillplzProcessor)
{
parent::__construct();
$this->callbackBillplzProcessor = $callbackBillplzProcessor;
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
ini_set('memory_limit', '-1');
$this->outputArray = [];
$start = new Carbon();
$groups = Group::whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->whereHas('payment', function ($query) {
$query->whereIn('status', [2, 3]);
})->get();
foreach ($groups as $group) {
$transaction = $group->payment;
$response = Http::withBasicAuth(config('billplz.api_key') . ':', '')->get(config('billplz.base_url') . '/api/v3/bills/' . $transaction->payment_reference);
dump($transaction->payment_reference);
if ($response->successful()) {
$data = $response->json();
if ($data['paid']) {
$status = ApprovalStatus::PENDING_VERIFICATION;
if ($data['state'] === 'paid') {
$status = ApprovalStatus::APPROVED;
}
$this->info(Carbon::now() . ' : Fixing ' . $transaction->payment_reference);
$this->callbackBillplzProcessor->execute($transaction, $status);
}
} else {
$this->info("billplz error</br>");
}
}
$end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
if ($groups) {
$this->info(Carbon::now() . ' : Done . ElapsedTime: ' . $elapsedTime);
}
}
}
@@ -0,0 +1,54 @@
<?php
namespace App\Console\Commands;
use App\Classes\Modules\PackingLists\Processors\FetchPackingListsFromYdPortalProcessor;
use Carbon\Carbon;
use Illuminate\Console\Command;
class FixMissingPackingList extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'fix-missing-packinglist';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fix Missing Packinglist';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$start_date = '2024-05-05';
$end_date = '2024-05-05';
$start = $start_date ? Carbon::parse($start_date) : null;
$end = $end_date ? Carbon::parse($end_date) : null;
if (!$start || !$end) {
return;
}
(App()->make(FetchPackingListsFromYdPortalProcessor::class))->execute($start, $end);
}
}
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor; use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzDataPatchProcessor;
use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Models\Transaction; use App\Models\Transaction;
use Carbon\Carbon; use Carbon\Carbon;
@@ -32,15 +33,19 @@ class OneTimeTransactionFixBillplzFailedCallback extends Command
/** @var CallbackBillplzProcessor */ /** @var CallbackBillplzProcessor */
private $callbackBillplzProcessor; private $callbackBillplzProcessor;
/** @var CallbackBillplzDataPatchProcessor */
private $callbackBillplzDataPatchProcessor;
/** /**
* Create a new command instance. * Create a new command instance.
* *
* @return void * @return void
*/ */
public function __construct(CallbackBillplzProcessor $callbackBillplzProcessor) public function __construct(CallbackBillplzProcessor $callbackBillplzProcessor, CallbackBillplzDataPatchProcessor $callbackBillplzDataPatchProcessor)
{ {
parent::__construct(); parent::__construct();
$this->callbackBillplzProcessor = $callbackBillplzProcessor; $this->callbackBillplzProcessor = $callbackBillplzProcessor;
$this->callbackBillplzDataPatchProcessor = $callbackBillplzDataPatchProcessor;
} }
/** /**
@@ -55,19 +60,22 @@ class OneTimeTransactionFixBillplzFailedCallback extends Command
$this->outputArray = []; $this->outputArray = [];
$start = new Carbon(); $start = new Carbon();
//This transaction, 15205 has approve payment but not its owner, shipping invoice //Transaction fix with this one time fix command: 15205, 16803, 17310
$transaction = Transaction::whereIn('id', [15205])->first(); //This transaction, 16803 has approve payment but not its owner, shipping invoice
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 15205 cron started.'); $transaction = Transaction::whereIn('id', [17310])->first();
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 17310 cron started.');
if($transaction && $transaction->id == 15205){ if($transaction && $transaction->id == 17310){
$this->info(Carbon::now() . ' : 17310.');
$status = ApprovalStatus::APPROVED; $status = ApprovalStatus::APPROVED;
$this->callbackBillplzProcessor->execute($transaction, $status); // $this->callbackBillplzProcessor->execute($transaction, $status);
$this->callbackBillplzDataPatchProcessor->execute($transaction, $status);
} }
$end = new Carbon(); $end = new Carbon();
$elapsedTime = $start->diff($end)->format('%H:%I:%S'); $elapsedTime = $start->diff($end)->format('%H:%I:%S');
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 15205 cron ended. ElapsedTime: ' . $elapsedTime); $this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 17310 cron ended. ElapsedTime: ' . $elapsedTime);
} }
} }
@@ -76,7 +76,7 @@ class SendPermitsReminderEmails extends Command
protected function getEmailList(): array protected function getEmailList(): array
{ {
return [ return [
'edmond.wuiming2021@gmail.com', // 'edmond.wuiming2021@gmail.com',
'anithagurl96@gmail.com' 'anithagurl96@gmail.com'
]; ];
} }
+36 -36
View File
@@ -28,50 +28,50 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
$schedule->command('command:curlVTCommand') // $schedule->command('command:curlVTCommand')
->cron('0 8 * * *') // ->cron('0 8 * * *')
->withoutOverlapping() // ->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlvt.log'); // ->appendOutputTo (storage_path().'/logs/curlvt.log');
$schedule->command('command:curlYdOrderListCommand')
->cron('0 9-18/3 * * *')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/curlyd.log');
$schedule->command('fix-packinglist')
->cron('30 9-18/3 * * *')
->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/fix_packinglist.log');
// $schedule->command('command:curlYdOrderListCommand') // $schedule->command('command:curlYdOrderListCommand')
// ->cron('0 9 * * *') // ->cron('0 9-18/3 * * *')
// ->withoutOverlapping() // ->withoutOverlapping()
// ->appendOutputTo (storage_path().'/logs/departure_email.log'); // ->appendOutputTo (storage_path().'/logs/curlyd.log');
$schedule->command('fix-duplicate-container-reference') // $schedule->command('fix-packinglist')
->cron('0 1 * * *') // ->cron('30 9-18/3 * * *')
->withoutOverlapping() // ->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/fix_duplicate_container_reference.log'); // ->appendOutputTo (storage_path().'/logs/fix_packinglist.log');
$schedule->command('invoice:generate') // // $schedule->command('command:curlYdOrderListCommand')
->hourly() // // ->cron('0 9 * * *')
->withoutOverlapping() // // ->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/auto_generate_invoice.log'); // // ->appendOutputTo (storage_path().'/logs/departure_email.log');
$schedule->command('billplz-failed-callback:fix') // $schedule->command('fix-duplicate-container-reference')
->hourly() // ->cron('0 1 * * *')
->withoutOverlapping() // ->withoutOverlapping()
->appendOutputTo (storage_path().'/logs/fix_failed_callback_from_billplz.log'); // ->appendOutputTo (storage_path().'/logs/fix_duplicate_container_reference.log');
$schedule->command('check-storage-invoices-group-transactions') // $schedule->command('invoice:generate')
->dailyAt('0:01') // ->hourly()
->withoutOverlapping() // ->withoutOverlapping()
->appendOutputTo(storage_path().'/logs/check_storage_invoices.log'); // ->appendOutputTo (storage_path().'/logs/auto_generate_invoice.log');
$schedule->command('permitsReminder:send') // $schedule->command('billplz-failed-callback:fix')
->dailyAt('09:30') // ->hourly()
->withoutOverlapping() // ->withoutOverlapping()
->appendOutputTo(storage_path().'/logs/permits-reminder-send.log'); // ->appendOutputTo (storage_path().'/logs/fix_failed_callback_from_billplz.log');
// $schedule->command('check-storage-invoices-group-transactions')
// ->dailyAt('0:01')
// ->withoutOverlapping()
// ->appendOutputTo(storage_path().'/logs/check_storage_invoices.log');
// $schedule->command('permitsReminder:send')
// ->dailyAt('09:30')
// ->withoutOverlapping()
// ->appendOutputTo(storage_path().'/logs/permits-reminder-send.log');
} }
/** /**
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Exports;
use App\Classes\Modules\Exports\Services\ExportsCustomersOrderLatestDate; use App\Classes\Modules\Exports\Services\ExportsCustomersOrderLatestDate;
use App\Classes\Modules\Exports\Services\ExportsCustomerTotalOrderByYear; use App\Classes\Modules\Exports\Services\ExportsCustomerTotalOrderByYear;
use App\Classes\Modules\Exports\Services\ExportsGroupTransactions;
use App\Classes\Modules\Exports\Services\ExportsPaymentTransactions; use App\Classes\Modules\Exports\Services\ExportsPaymentTransactions;
use App\Models\User; use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@@ -33,6 +34,13 @@ class ExportCustomersToExcelController
return $response; return $response;
} }
public function groupTransaction(Request $request){
$exportsTransactions = new ExportsGroupTransactions($request);
$response = $exportsTransactions->download('group-transactions.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
ob_end_clean();
return $response;
}
public function totalOrders(Request $request){ public function totalOrders(Request $request){
$exportsTotalOrders = new ExportsCustomerTotalOrderByYear($request); $exportsTotalOrders = new ExportsCustomerTotalOrderByYear($request);
$response = $exportsTotalOrders->download('total-orders-' . $request->route('year') . '.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']); $response = $exportsTotalOrders->download('total-orders-' . $request->route('year') . '.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
@@ -40,25 +40,41 @@ class ImportPermitsReminderController
$row['reminder_date'] = $this->changeExcelDate($row['reminder_date']); $row['reminder_date'] = $this->changeExcelDate($row['reminder_date']);
$validator = Validator::make($row, [ $validator = Validator::make($row, [
'model' => 'required|unique:permits_reminders,model', 'model' => 'required',
'expiry_date' => 'required|date|after_or_equal:today', // 'expiry_date' => 'required|date|after_or_equal:today',
'reminder_date' => 'required|date|after_or_equal:today', 'expiry_date' => 'required|date',
// 'reminder_date' => 'required|date|after_or_equal:today',
'reminder_date' => 'required|date',
]); ]);
if ($validator->fails()) { if ($validator->fails()) {
$row['status'] = 'failed'; $row['status'] = 'failed';
$row['message'] = $validator->errors()->all(); $row['message'] = $validator->errors()->all();
$returnArray[] = $row; $returnArray[] = $row;
} else { } else {
$row['created_at'] = Carbon::now(); $existingRecord = PermitsReminder::where('model', $row['model'])->first();
$row['updated_at'] = Carbon::now();
$successRows[] = $row; if ($existingRecord) {
$existingRecord->update([
'expiry_date' => $row['expiry_date'],
'reminder_date' => $row['reminder_date'],
]);
$row['status'] = 'Updated';
$row['message'] = 'Record has been updated';
$returnArray[] = $row;
} else {
// Add to successful rows for batch insertion
$row['created_at'] = Carbon::now();
$row['updated_at'] = Carbon::now();
$successRows[] = $row;
}
} }
} }
// Insert only if there are new successful rows
if (!empty($successRows)) { if (!empty($successRows)) {
PermitsReminder::insert($successRows); // Insert only if there are successful rows PermitsReminder::insert($successRows);
} }
$successCount = count($successRows); $successCount = count($successRows);
@@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers\Wac;
use App\Classes\Modules\Wac\ControllersLogic\RegisterExchangeEmailLogic;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class RegisterExchangeEmailController
{
/**
* @param Request $request
* @param FetchQuestionQALogic $logic
* @return JsonResponse
*/
public function register(Request $request, RegisterExchangeEmailLogic $logic): JsonResponse {
return $logic->execute($request);
}
}
+2 -1
View File
@@ -40,7 +40,8 @@ class CompanyResource extends JsonResource
'last_order' => $companyModule->type === 7 ? new DeliveryOrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()) : new OrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()), 'last_order' => $companyModule->type === 7 ? new DeliveryOrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()) : new OrderResource($companyModule->orders()->orderBy('id', 'DESC')->first()),
'order_count' => $companyModule->orders()->count(), 'order_count' => $companyModule->orders()->count(),
'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])->first()), 'identification' => new DocumentResource($this->documents->whereIn('document_type', DocumentType::IDENTIFICATION_DOCUMENTS)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])->first()),
'created_at' => $this->created_at->format('d-m-Y') 'created_at' => $this->created_at->format('d-m-Y'),
'whatsapp' => new ContactResource($this->contacts()->where('reference', 'LIKE', '%Whatsapp%')->orderBy('created_at', 'DESC')->first())
]; ];
@@ -26,7 +26,7 @@ class GroupForOrderV2Resource extends JsonResource
'original_currency' => new CurrencyResource($this->original_currency), 'original_currency' => new CurrencyResource($this->original_currency),
'issuer_name' => $this->issuerCompany->name, 'issuer_name' => $this->issuerCompany->name,
'issuer_id' => $this->issuerCompany->id, 'issuer_id' => $this->issuerCompany->id,
'amount' => (float) $this->amount, //cief todo: 58 'amount' => (float) $this->amount,
'service_charge' => (float) $this->amount, 'service_charge' => (float) $this->amount,
'currency' => new CurrencyResource($this->currency), 'currency' => new CurrencyResource($this->currency),
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A'), 'created_at' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A'),
@@ -32,9 +32,11 @@ class MappableTransactionWithDetailsResource extends JsonResource
if ($this->type === TransactionType::PAYMENT) { if ($this->type === TransactionType::PAYMENT) {
$order = $this->owner->owner->owner; $order = $this->owner->owner->owner;
$data['order_reference'] = $order->reference; if ($order) {
$data['debtor_code'] = $order->companyModule->company->debtor; $data['order_reference'] = $order->reference;
$data['created_at'] = $this->owner->created_at; // invoice date $data['debtor_code'] = $order->companyModule->company->debtor;
$data['created_at'] = $this->owner->created_at; // invoice date
}
} elseif (in_array($this->type, [TransactionType::GROUP_PAYMENT, TransactionType::TOP_UP])) { } elseif (in_array($this->type, [TransactionType::GROUP_PAYMENT, TransactionType::TOP_UP])) {
$connection = $this->owner->owner->inviters()->withPivot('invitee_reference')->first(); $connection = $this->owner->owner->inviters()->withPivot('invitee_reference')->first();
$data['marking'] = $connection ? $connection->pivot->invitee_reference : ''; $data['marking'] = $connection ? $connection->pivot->invitee_reference : '';
@@ -48,17 +50,20 @@ class MappableTransactionWithDetailsResource extends JsonResource
if ($payments->count()) { if ($payments->count()) {
$data['payment_transactions'] = $payments->map(function ($payment) { $data['payment_transactions'] = $payments->map(function ($payment) {
$order = $payment->owner->owner->owner; $order = $payment->owner->owner->owner;
return [
'id' => $payment->id, if ($order) {
'updated_at' => $payment->updated_at, return [
'debtor_code' => $order->companyModule->company->debtor, 'id' => $payment->id,
'order_reference' => $order->reference, 'updated_at' => $payment->updated_at,
'bill_no' => null, 'debtor_code' => $order->companyModule->company->debtor,
'type' => $payment->type, 'order_reference' => $order->reference,
'marking' => null, 'bill_no' => null,
'amount' => $payment->amount, 'type' => $payment->type,
'created_at' => $this->created_at 'marking' => null,
]; 'amount' => $payment->amount,
'created_at' => $this->created_at
];
}
})->toArray(); })->toArray();
} else { } else {
$data['status'] = 'error'; $data['status'] = 'error';
+1 -1
View File
@@ -18,7 +18,7 @@ class SegmentResource extends JsonResource
$constant = $this->constants->where('reference', SegmentConstants::CUSTOM_PRICE)->first(); $constant = $this->constants->where('reference', SegmentConstants::CUSTOM_PRICE)->first();
return [ return [
'id' => $this->id, 'id' => $this->id,
'name' => $this->name, 'name' => ucwords(str_replace('_', ' ', $this->name)),
'price' => $constant ? $constant->value[0] : 0 'price' => $constant ? $constant->value[0] : 0
]; ];
} }
+1 -1
View File
@@ -52,7 +52,7 @@ class TransactionResource extends JsonResource
'documents' => $groupTransactions ? DocumentResource::collection($this->documents->where('status', ApprovalStatus::PENDING_VERIFICATION)) : DocumentResource::collection($this->documents), 'documents' => $groupTransactions ? DocumentResource::collection($this->documents->where('status', ApprovalStatus::PENDING_VERIFICATION)) : DocumentResource::collection($this->documents),
'type' => (int) $this->type, 'type' => (int) $this->type,
'bill_no' => $this->bill_no, 'bill_no' => $this->bill_no,
'amount' => (double) $this->amount, //cief todo: 58 'amount' => (double) $this->amount,
'payment_method' => (int) $this->payment_method, 'payment_method' => (int) $this->payment_method,
'payment_reference' => $this->payment_reference, 'payment_reference' => $this->payment_reference,
'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')), 'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')),
@@ -5,6 +5,7 @@ namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\ApprovalStatus; use App\Classes\ValueObjects\Constants\ApprovalStatus;
use App\Classes\ValueObjects\Constants\TransactionType; use App\Classes\ValueObjects\Constants\TransactionType;
use App\Models\Group; use App\Models\Group;
use App\Models\PackingList;
use App\Models\Transaction; use App\Models\Transaction;
use App\Models\Wallet; use App\Models\Wallet;
use Carbon\Carbon; use Carbon\Carbon;
@@ -27,7 +28,9 @@ class TransactionWithStorageResource extends JsonResource
$groupPaymentAttemptsFiltered = []; $groupPaymentAttemptsFiltered = [];
$group_payment_expired = null; $group_payment_expired = null;
$group_payment_history = null; $group_payment_history = null;
$group_payment_history_query = null;
$groupTotalAmount = 0; $groupTotalAmount = 0;
$payment_history = null;
if ($this->owner instanceof Transaction) { if ($this->owner instanceof Transaction) {
if ($this->owner) { if ($this->owner) {
@@ -43,7 +46,8 @@ class TransactionWithStorageResource extends JsonResource
if($this->groups){ if($this->groups){
$group_payment_attempts = GroupForOrderV2Resource::collection($this->groups->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])); $group_payment_attempts = GroupForOrderV2Resource::collection($this->groups->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]));
$group_payment_expired = GroupForOrderV2Resource::collection($this->groupsWithTrashed->whereIn('status', [ApprovalStatus::EXPIRED])); $group_payment_expired = GroupForOrderV2Resource::collection($this->groupsWithTrashed->whereIn('status', [ApprovalStatus::EXPIRED]));
$group_payment_history = GroupForOrderV2Resource::collection($this->groups->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::REJECTED])); $group_payment_history_query = $this->groups->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::REJECTED]);
$group_payment_history = GroupForOrderV2Resource::collection($group_payment_history_query);
} }
} else { } else {
@@ -54,12 +58,16 @@ class TransactionWithStorageResource extends JsonResource
} }
$packingListReference = null;
if ($this->owner instanceof PackingList) {
$packingListReference = $this->owner->reference;
}
$ts = $this->groups->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION])->last(); $ts = $this->groups->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION])->last();
if ($ts) { if ($ts && $group_payment_history && $group_payment_attempts) {
$paymentTransaction = Transaction::where('payment_reference', $ts->reference)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION])->first(); $paymentTransaction = Transaction::where('payment_reference', $ts->reference)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION])->first();
if($paymentTransaction){ if($paymentTransaction){
$groupTotalAmount = (double) $this->amount; //cief todo: 58 $groupTotalAmount = (double) $this->amount;
foreach ($group_payment_history as $key => $value) { foreach ($group_payment_history as $key => $value) {
if ($value->id === $ts->id && $value->reference === $ts->reference) { if ($value->id === $ts->id && $value->reference === $ts->reference) {
@@ -76,6 +84,21 @@ class TransactionWithStorageResource extends JsonResource
} }
$payment_history = TransactionResource::collection($this->transactions()
->payments()
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED])
->get());
//For 'Your Payment Proof' at frontend
if($group_payment_history_query && count($group_payment_history_query) > 0){
if($this->getReferenceForGroupPayment($group_payment_history_query)){
foreach ($payment_history as $item) {
$item['payment_reference'] = $this->getReferenceForGroupPayment($group_payment_history_query);
}
}
}
return [ return [
'id' => $this->id, 'id' => $this->id,
'owner_type' => $this->owner_type, 'owner_type' => $this->owner_type,
@@ -88,10 +111,10 @@ class TransactionWithStorageResource extends JsonResource
'documents' => $groupTransactions ? DocumentResource::collection($this->documents->where('status', ApprovalStatus::PENDING_VERIFICATION)) : DocumentResource::collection($this->documents), 'documents' => $groupTransactions ? DocumentResource::collection($this->documents->where('status', ApprovalStatus::PENDING_VERIFICATION)) : DocumentResource::collection($this->documents),
'type' => (int) $this->type, 'type' => (int) $this->type,
'bill_no' => $this->bill_no, 'bill_no' => $this->bill_no,
'amount' => (double) $this->amount, //cief todo: 58 'amount' => (double) $this->amount,
'payment_method' => (int) $this->payment_method, 'payment_method' => (int) $this->payment_method,
'payment_reference' => $this->payment_reference, 'payment_reference' => $this->payment_reference,
'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')), //cief todo: 58 'outstanding' => (double) $this->amount - ($this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount')),
'floating' => $group_payment_attempts ? $groupTotalAmount : (double) $this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION])->sum('amount'), 'floating' => $group_payment_attempts ? $groupTotalAmount : (double) $this->transactions()->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::PENDING_SUBMISSION, ApprovalStatus::PENDING_VERIFICATION])->sum('amount'),
'service_charge' => (double) $this->service_charge, 'service_charge' => (double) $this->service_charge,
'tax' => (double) $this->tax, 'tax' => (double) $this->tax,
@@ -112,13 +135,9 @@ class TransactionWithStorageResource extends JsonResource
->payments()->where('status', ApprovalStatus::EXPIRED) ->payments()->where('status', ApprovalStatus::EXPIRED)
->get() ->get()
), ),
'payment_history' => TransactionResource::collection( 'payment_history' => $payment_history,
$this->transactions()
->payments()
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED])
->get()
),
'remarks' => RemarkResource::collection($this->remarks), 'remarks' => RemarkResource::collection($this->remarks),
'packing_list_reference' => $packingListReference,
'storages' => $this->storages ? $this->storages : null, //from middleware 'storages' => $this->storages ? $this->storages : null, //from middleware
'is_waived' => (int) $this->is_waived, 'is_waived' => (int) $this->is_waived,
'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:i:s A'), 'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:i:s A'),
@@ -126,4 +145,12 @@ class TransactionWithStorageResource extends JsonResource
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y') 'created_at' => Carbon::parse($this->created_at)->format('d-m-Y')
]; ];
} }
private function getReferenceForGroupPayment($groups){
if (is_array($groups) && count($groups) > 0) {
$firstGroup = $groups[0];
return $firstGroup['reference'];
}
return null;
}
} }
+8
View File
@@ -69,4 +69,12 @@ class CompanyConnection extends AbstractModel
return $this->belongsToMany(Segment::class, (new ConnectionSegment())->getTable(), 'company_connection_id', 'segment_id'); return $this->belongsToMany(Segment::class, (new ConnectionSegment())->getTable(), 'company_connection_id', 'segment_id');
} }
/**
* @return belongsToMany
*/
public function connectionSegments(): HasMany
{
return $this->hasMany(ConnectionSegment::class, 'company_connection_id');
}
} }
+8
View File
@@ -84,4 +84,12 @@ class Group extends Model implements Documentable, Transactionable
{ {
return $this->BelongsTo(Currency::class, 'original_currency_id', 'id'); return $this->BelongsTo(Currency::class, 'original_currency_id', 'id');
} }
/**
* @return hasOne
*/
public function payment()
{
return $this->hasOne(Transaction::class, 'payment_reference', 'reference');
}
} }
+5
View File
@@ -130,6 +130,11 @@ return [
'path' => storage_path('logs/laravel_perfex_crm.log'), 'path' => storage_path('logs/laravel_perfex_crm.log'),
'level' => 'info', 'level' => 'info',
], ],
'wac_webhook' => [
'driver' => 'single',
'path' => storage_path('logs/wac_webhook.log'),
'level' => 'info',
],
], ],
]; ];
+6
View File
@@ -0,0 +1,6 @@
<?php
return [
'account_registration_url' => 'https://wacontact.readyspace.com/rest/trigger/9fe03daf-2ace-4095-b064-601ef6d9bfe7',
'invoice_created_url' => 'https://wacontact.readyspace.com/rest/trigger/c0d38aa7-91ac-458b-8014-cf3287a636e4',
];
@@ -10,6 +10,10 @@
<div class="font-heading all-caps fs-11">{{this.item.name}}</div> <div class="font-heading all-caps fs-11">{{this.item.name}}</div>
<div class="font-heading all-caps fs-11">CIEF/{{this.item.company_module.marking}}</div> <div class="font-heading all-caps fs-11">CIEF/{{this.item.company_module.marking}}</div>
</div> </div>
<div class="col-auto" v-if="this.item.whatsapp">
<div class="font-heading all-caps fs-11">Whatsapp:</div>
<div class="font-heading all-caps fs-11">{{ this.item.whatsapp.reference.replace('Whatsapp:', '') }}: {{ this.item.whatsapp.phone }}</div>
</div>
<div class="col-auto text-center"> <div class="col-auto text-center">
<div class="font-heading all-caps fs-11">Orders</div> <div class="font-heading all-caps fs-11">Orders</div>
<div class="font-heading all-caps fs-11">{{this.item.order_count}}</div> <div class="font-heading all-caps fs-11">{{this.item.order_count}}</div>
@@ -116,9 +116,10 @@
}, },
sumAmount () { sumAmount () {
var new_object = this.selectedInvoice; var new_object = this.selectedInvoice;
return Object.keys(new_object).reduce(function(total, key) { var total = Object.keys(new_object).reduce(function(total, key) {
return total + Math.round(new_object[key].amount * 100) / 100; return total + new_object[key].amount;
}, 0).toFixed(2); }, 0).toFixed(2);
return Math.round(total * 100) / 100;
}, },
selectedIds () { selectedIds () {
return this.selectedInvoice.map(s=>s.id); return this.selectedInvoice.map(s=>s.id);
@@ -0,0 +1,115 @@
<template>
<div class="row bg-white padding-25">
<div class="col" v-if="step === 1">
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
<div class="row justify-content-center" v-show="!isLoading">
<div class="col">
<div class="row">
<div class="col">
<h3>Please provide your Whatsapp phone number:</h3>
</div>
</div>
<div class="row m-t-20 m-b-15">
<div class="col-12">
<validation-wrapper-component :validator="$v.parameters.name">
<label>Name</label>
<input class="form-control" v-model="parameters.name">
</validation-wrapper-component>
</div>
<div class="col-12 p-t-15">
<validation-wrapper-component :validator="$v.parameters.phone">
<label>Phone</label>
<input class="form-control" v-model="parameters.phone">
</validation-wrapper-component>
</div>
</div>
<div class="row p-t-15">
<div class="col p-r-5">
<div class="btn btn-lg block btn m-b-5 no-border bg-master-lighter" data-dismiss="modal">Cancel</div>
</div>
<div class="col p-l-5">
<div class="btn btn-lg block btn m-b-5 no-border text-white bg-primary pointer" @click="nextStep">Confirm</div>
</div>
</div>
</div>
</div>
</div>
<div class="col" v-if="step === 2">
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
<div class="row justify-content-center" v-show="!isLoading">
<div class="col">
<div class="row">
<div class="col">
<h3>欲知更多详情请浏览 <a href="https://bit.ly/4a5v34p" target="_blank" class="text-underline">https://bit.ly/4a5v34p</a> Whatsapp: <a href="https://wa.me/601136814520" target="_blank" class="text-underline text-success">+6011-36814520</a></h3>
</div>
</div>
<div class="row p-t-15">
<div class="col p-r-5">
<div class="btn btn-lg block btn m-b-5 no-border bg-master-lighter" @click="previousStep">Cancel</div>
</div>
<div class="col p-l-5">
<div class="btn btn-lg block btn m-b-5 no-border text-white bg-primary pointer" @click="activateService">Confirm</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { required } from 'vuelidate/lib/validators';
import componentHandler from '../../../general/mixins/componentHandler';
import modalFormHandler from '../../../general/mixins/modalFormHandler';
export default {
props: {
company:{
type: Object,
required: true
},
segmentId:{
type: Number,
required: false
}
},
data() {
return {
step: 1,
parameters: {
name: '',
phone: '',
}
}
},
validations: {
parameters: {
name: { required },
phone: { required },
}
},
methods: {
previousStep() {
this.step = 1;
},
nextStep() {
if (this.parameters.name && this.parameters.phone) {
this.step = 2;
} else {
this.parameters = {};
this.submit(this.route('api.company.connection.assign', this.company.id, this.company.company_module.connections[0].id), 'post', 'activateService', true, false);
}
},
activateService(){
this.parameters.segment_id = this.segmentId
this.submit(this.route('api.company.connection.assign', this.company.id, this.company.company_module.connections[0].id), 'post', 'activateService', true, false);
},
successHandler(){
location.reload();
}
},
mixins: [componentHandler, modalFormHandler]
}
</script>
@@ -0,0 +1,119 @@
<template>
<div class="row m-t-15 m-b-15 align-items-end parentContainer" v-if="company">
<div class="col">
<!-- 1688 consent -->
<div class="row m-l-0 m-r-0 m-b-15 animate__animated animate__tada animate__repeat-2 animate__delay-3s" v-if="!company.segments.some(item => item.id === 10 || item.id === 11 || item.id === 12)">
<div class="col bg-white padding-15">
<div class="row">
<div class="col">
<div class="row ">
<div class="col">
<h5 class="m-t-0 text-justify">重磅消息! CIEF 正式开通 <span class="bold">3PL fulfillment 服务</span>!! 你从中国进来的货物, 我们可以直接帮你仓储, 分拣打包, 直接送货到您的顾客手上, 只需系统对接你的 Lazada , Shopee , Tiktok 网店, 就能实现全自动化! 一个月只需 <span class="bold">RMX88</span>! </h5>
<h5 class="m-t-0 text-justify">Exciting news! CIEF has officially launched its <span class="bold">3PL fulfillment service</span>! We can assist with warehousing, sorting, packaging, and direct delivery of your goods from China to your customers. Simply integrate your Lazada, Shopee, or TikTok online stores with our system for full automation! Only <span class="bold">RMX88</span> per month!</h5>
</div>
</div>
<div class="row">
<div class="col-12 text-center">
<div class="btn btn-md block btn m-b-5 no-border text-white pointer bg-success requestModal" data-type="fulfilment-interested-now">Interested now (感兴趣)</div>
</div>
<div class="col-12 text-center">
<div class="btn btn-md block btn m-b-5 pointer requestModal" data-type="fulfilment-interested-later">Interested later (感兴趣但现在不需要)</div>
</div>
<div class="col-12 text-center">
<div class="btn btn-md block btn m-b-5 no-border text-white pointer bg-danger requestModal" data-type="not-interested-confirm">Not interested (不感兴趣)</div>
</div>
</div>
</div>
</div>
</div>
</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" type="fulfilment-interested-now" styleType="fill-in" size="large">
<fulfilment-interested-form-component
section="activateService"
:company="company"
:segmentId="10"
>
</fulfilment-interested-form-component>
</modal-component>
<modal-component class="animate__animated animate__fast animate__fadeIn" type="fulfilment-interested-later" styleType="fill-in" size="large">
<fulfilment-interested-form-component
section="activateService"
:company="company"
:segmentId="11"
>
</fulfilment-interested-form-component>
</modal-component>
<modal-component small type="not-interested-confirm">
<div class="row">
<div class="col text-center">
<div class="row">
<div class="col text-center">
<div class="row m-b-20">
<div class="col">
<h5 class="all-caps">Are you Sure?</h5>
<div class="fs-11">Are you sure you are not interested in this service?</div>
</div>
</div>
<div class="row">
<div class="col p-r-5">
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">No, take me back</div>
</div>
<div class="col p-l-5">
<div data-dismiss="modal" class="btn btn-sm btn-danger btn-block b-rad-none" @click="activateService(12)">Yes, Im sure</div>
</div>
</div>
</div>
</div>
</div>
</div>
</modal-component>
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
data(){
return {
section: 'newServiceList',
parameters: {
segment_id: ''
},
expanded: false,
failed: false,
part: 0,
isFetchCompany: false,
company: null
}
},
created(){
this.fetchCompany();
},
methods: {
fetchCompany(){
this.parameters = null;
this.isFetchCompany = true;
this.submit(route('api.company.show', this.$store.getters.getCompanyId), 'get', this.section, false, false)
},
activateService(segmentId){
this.parameters = {
segment_id: segmentId
};
this.part = 1;
this.submit(this.route('api.company.connection.assign', this.company.id, this.company.company_module.connections[0].id), 'post', 'activateService', true, false);
},
successHandler(response){
if (this.isFetchCompany) {
this.company = response.payload.data;
this.isFetchCompany = false;
}
if(this.part == 1 || this.part == 4){
location.reload();
}
}
},
mixins: [componentHandler]
}
</script>
@@ -74,9 +74,6 @@
data(){ data(){
return { return {
filters: this.options, filters: this.options,
pollingInterval: null,
isPolling: false,
isFetchingResult: false,
isLoading: false, isLoading: false,
} }
}, },
@@ -87,13 +84,26 @@
computed: { computed: {
pendingList () { pendingList () {
return this.$store.getters.isInCompleteQueue(this.section); return this.$store.getters.isInCompleteQueue(this.section);
} },
getJob() {
return this.$store.getters.getJob(this.section);
},
getJobAttemptCount() {
return this.$store.getters.getJobAttemptCount(this.section);
},
}, },
watch: { watch: {
pendingList(inComplete){ pendingList(inComplete){
if(inComplete){ if(inComplete){
this.fetchList(); this.fetchList();
} }
},
getJobAttemptCount(newValue, oldValue) {
// console.log('Old value:', JSON.stringify(oldValue));
// console.log('New value:', JSON.stringify(newValue));
if(this.getJob){
this.fetchJobResult(this.getJob.isLastAttempt);
}
} }
}, },
methods: { methods: {
@@ -101,7 +111,7 @@
let listDecorators = this.$store.getters.getListDetails(this.section); let listDecorators = this.$store.getters.getListDetails(this.section);
let url = this.endpoint + '?page=' + listDecorators.page + '&filters=' + JSON.stringify(listDecorators.filters); let url = this.endpoint + '?page=' + listDecorators.page + '&filters=' + JSON.stringify(listDecorators.filters);
this.isLoading = true; this.isLoading = true;
this.submitJob(url); this.$store.dispatch('submitJobRequest', {'url': url, 'name': this.section});
}, },
successHandler(response){ successHandler(response){
let result = JSON.parse(response.payload.data.result); let result = JSON.parse(response.payload.data.result);
@@ -118,83 +128,21 @@
to: result.meta.to, to: result.meta.to,
total: result.meta.total total: result.meta.total
}; };
this.stopPolling();
this.$store.dispatch('completeList', {'name': this.section, 'data': result.data}); this.$store.dispatch('completeList', {'name': this.section, 'data': result.data});
this.$store.dispatch('stopPollingJobResultByJobId', {'jobId': this.getJob.jobId});
this.$refs.pagination.makePagination(result.meta, result.links); this.$refs.pagination.makePagination(result.meta, result.links);
this.isLoading = false; this.isLoading = false;
}, },
errorHandler(error){ errorHandler(error){
this.isFetchingResult = false; // console.log("Error: " + JSON.stringify(error));
this.isPolling = false; this.$store.dispatch('updatePollingJobResultByJobId', {'jobId': this.getJob.jobId, 'isPolling': false, 'isFetchingResult': false });
}, },
startPolling(jobId, maxAttempts = 8) { fetchJobResult(isLastAttempt = false) {
let attempts = 0; this.$store.dispatch('updatePollingJobResultByJobId', {'jobId': this.getJob.jobId, 'isFetchingResult': true });
let interval = 10000; // Initial interval
const resetPollingInterval = (customInterval) => {
this.pollingInterval = setInterval(pollJobResult, customInterval);
};
const pollJobResult = () => {
if (this.isPolling || this.isFetchingResult) {
return;
}
this.isPolling = true;
attempts++;
if(attempts === 1){
this.stopPolling();
resetPollingInterval(5000);
}
if (attempts > maxAttempts) {
this.stopPolling();
this.isLoading = false;
console.log(`Reached maximum attempts (${maxAttempts}). Polling stopped.`);
return;
}
if(attempts === maxAttempts){
this.fetchJobResult(jobId, true);
}
else{
this.fetchJobResult(jobId);
}
};
// pollJobResult(); // Initial call
this.pollingInterval = setInterval(pollJobResult, interval);
},
stopPolling() {
clearInterval(this.pollingInterval);
this.pollingInterval = null;
this.isPolling = false;
this.isFetchingResult = false;
},
submitJob(url){
try { try {
this.$store.dispatch('crudRequestV2', {endpoint: url, method: 'get'}).then(response => { let anotherEndpoint = route('api.job.fetch', this.getJob.jobId);
let success = response.ok;
response.json().then(response => {
if(!success){return;}
let jobId = response.payload.data.job_id;
if(jobId){
this.startPolling(jobId);
}
});
})
} catch (error) {
console.error('Error submitJob', error);
}
},
fetchJobResult(jobId, isLastAttempt = false) {
// console.log('fetchJobResult: ', jobId);
this.isFetchingResult = true;
try {
let anotherEndpoint = route('api.job.fetch', jobId);
if(isLastAttempt){ if(isLastAttempt){
anotherEndpoint = route('api.job.fetch.last.attempt', jobId, isLastAttempt); anotherEndpoint = route('api.job.fetch.last.attempt', this.getJob.jobId, isLastAttempt);
} }
this.poll(anotherEndpoint, 'get', this.section, false, false); //cief todo: Uncaught (in promise) null this.poll(anotherEndpoint, 'get', this.section, false, false); //cief todo: Uncaught (in promise) null
} catch (error) { } catch (error) {
@@ -17,7 +17,7 @@
<div class="col-auto hide" v-if="$store.getters.isSuperAdmin"> <div class="col-auto hide" v-if="$store.getters.isSuperAdmin">
<button type="button" class="btn b-rad-none btn-danger fs-11 requestModal" data-type="deletePackingList"><i class="fa fa-times text-white fs-12"></i></button> <button type="button" class="btn b-rad-none btn-danger fs-11 requestModal" data-type="deletePackingList"><i class="fa fa-times text-white fs-12"></i></button>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deletePackingList"> <modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deletePackingList">
<delete-packinglist-form-component :data="data"></delete-packinglist-form-component> <delete-packinglist-form-component :data="data" :section="section"></delete-packinglist-form-component>
</modal-component> </modal-component>
<button type="button" class="btn b-rad-none btn-primary fs-11 requestModal" data-type="claimPackingList">Claim</button> <button type="button" class="btn b-rad-none btn-primary fs-11 requestModal" data-type="claimPackingList">Claim</button>
</div> </div>
@@ -51,7 +51,7 @@
<div class="btn btn-sm btn-success btn-block b-rad-none" data-dismiss="modal">Cancel</div> <div class="btn btn-sm btn-success btn-block b-rad-none" data-dismiss="modal">Cancel</div>
</div> </div>
<div class="col p-l-5"> <div class="col p-l-5">
<div class="btn btn-sm btn-danger btn-block b-rad-none" data-dismiss="modal" @click="submit(route('api.packing_list.delete', item.id), 'delete', 'unclaimedPackingListSection', true, true)">Confirm</div> <div class="btn btn-sm btn-danger btn-block b-rad-none" data-dismiss="modal" @click="submit(route('api.packing_list.delete', item.id), 'delete', section, true, true)">Confirm</div>
</div> </div>
</div> </div>
</div> </div>
@@ -78,6 +78,12 @@
<script> <script>
import componentHandler from '../../../general/mixins/componentHandler'; import componentHandler from '../../../general/mixins/componentHandler';
export default { export default {
mixins: [componentHandler] mixins: [componentHandler],
data() {
return {
isLoading: false,
section: 'unclaimedPackingListSection',
}
}
} }
</script> </script>
@@ -68,10 +68,10 @@
<i class="fa fa-repeat"></i> <i class="fa fa-repeat"></i>
</span> </span>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="regenerateInvoice"> <modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="regenerateInvoice">
<general-confirmation-form-component <general-confirmation-form-component
contentText="Are you sure you want to regenerate this Invoice?" contentText="Are you sure you want to regenerate this Invoice?"
modalType="delete" modalType="delete"
buttonText="Regenerate" buttonText="Regenerate"
class="text-center" class="text-center"
:apiRoute="route('api.transaction.invoice.regenerate', item.id)" :apiRoute="route('api.transaction.invoice.regenerate', item.id)"
apiMethod="post" apiMethod="post"
@@ -93,6 +93,16 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row" v-if="$store.getters.isAdmin">
<div class="col padding-20">
<div class="row">
<div class="col">
<p class="no-margin fs-10 all-caps">Packinglist Reference</p>
<div>{{ item.packing_list_reference }}</div>
</div>
</div>
</div>
</div>
<div class="row b-t b-grey p-t-10 m-l-5 m-r-5" v-show="expanded" v-if="![5, 6].includes(item.status)"> <div class="row b-t b-grey p-t-10 m-l-5 m-r-5" v-show="expanded" v-if="![5, 6].includes(item.status)">
<div class="col-12 col-md-7 padding-20"> <div class="col-12 col-md-7 padding-20">
<div class="row bg-master-lightest h-100"> <div class="row bg-master-lightest h-100">
@@ -179,7 +189,7 @@
<div class="font-heading fs-12">MYR {{(Math.round((item.outstanding + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div> <div class="font-heading fs-12">MYR {{(Math.round((item.outstanding + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
</div> </div>
</div> </div>
<div class="row m-t-20" v-if="item.outstanding - item.floating > 0.009"> <div class="row m-t-20" v-if="item.outstanding - item.floating > 0.009 && !paymentPending">
<div class="col"> <div class="col">
<div class="btn btn-sm all-caps b-rad-none btn-success btn-block requestModal" data-type="makePayment">Make Payment</div> <div class="btn btn-sm all-caps b-rad-none btn-success btn-block requestModal" data-type="makePayment">Make Payment</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="makePayment"> <modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="makePayment">
@@ -238,6 +248,17 @@
latestComment() { latestComment() {
let questions = this.item.remarks; let questions = this.item.remarks;
return questions.slice().reverse()[0]; return questions.slice().reverse()[0];
},
paymentPending(){
if (Array.isArray(this.item.transactions)) {
for (let i = 0; i < this.item.transactions.length; i++) {
const status = this.item.transactions[i].status;
if (status === 1) {
return true;
}
}
}
return false;
} }
}, },
created(){ created(){
@@ -92,6 +92,22 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row bg-white padding-5" v-if="$store.getters.isSuperAdmin">
<div class="col-auto">
<div class="font-heading fs-8 muted all-caps">Payment Method</div>
<div class="font-heading fs-10">
{{ convertPaymentMethodToText(item.payment_method) }}
</div>
</div>
<div class="col-auto">
<div class="font-heading fs-8 muted all-caps">Created At</div>
<div class="font-heading fs-10">{{ item.created_at }}</div>
</div>
<div class="col-auto">
<div class="font-heading fs-8 muted all-caps">Updated At</div>
<div class="font-heading fs-10">{{ item.updated_at }}</div>
</div>
</div>
<div class="row b-t b-grey" v-if="expandPaymentDetails"> <div class="row b-t b-grey" v-if="expandPaymentDetails">
<div class="col bg-white padding-15"> <div class="col bg-white padding-15">
<!-- <div class="row align-items-end m-b-10 text-success bold"> <!-- <div class="row align-items-end m-b-10 text-success bold">
@@ -157,6 +173,13 @@
</div> </div>
</a> </a>
</div> </div>
<div class="row no-margin" v-if="item.payment_method === 4 && item.payment_reference">
<a :href="route('billplz.bill', item.payment_reference)" target="_blank">
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
<i class="fa fa-file-image-o fs-10"></i>
</div>
</a>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -181,12 +204,27 @@
}, },
methods: { methods: {
clickExpand(){ clickExpand(){
if(this.item // if(this.item
&& ((this.item.payment_method !== 5 && this. item.documents.length) // && ((this.item.payment_method !== 5 && this. item.documents.length)
|| (this.item.payment_method === 5 && (this.item.status === 2 || this.item.status === 3)))){ // || (this.item.payment_method === 5 && (this.item.status === 2 || this.item.status === 3)))){
// this.expandPaymentDetails = !this.expandPaymentDetails;
// }
if(this.item){
this.expandPaymentDetails = !this.expandPaymentDetails; this.expandPaymentDetails = !this.expandPaymentDetails;
} }
}, },
convertPaymentMethodToText(number) {
var paymentMethods = {
1: "CASH",
2: "CHEQUE",
3: "BA",
4: "WALLET",
5: "PAYMENT_GATEWAY"
};
return paymentMethods[number] || "Unknown Payment Method";
},
}, },
mixins: [componentHandler] mixins: [componentHandler]
} }
@@ -26,11 +26,11 @@
</div> </div>
<div class="col" v-if="['customerPaidInvoiceComponent', 'customerPaidGroupInvoiceComponent'].includes(section)"> <div class="col" v-if="['customerPaidInvoiceComponent', 'customerPaidGroupInvoiceComponent'].includes(section)">
<p class="no-margin fs-10 all-caps">Payment Date</p> <p class="no-margin fs-10 all-caps">Payment Date</p>
<div>{{ item.payment_history[item.payment_history.length-1].created_at }}</div> <div>{{ item.payment_history && item.payment_history.length > 0 ? item.payment_history[item.payment_history.length - 1].created_at : '-' }}</div>
</div> </div>
<div class="col" v-if="['customerPaidInvoiceComponent', 'customerPaidGroupInvoiceComponent'].includes(section)"> <div class="col" v-if="['customerPaidInvoiceComponent', 'customerPaidGroupInvoiceComponent'].includes(section)">
<p class="no-margin fs-10 all-caps">Bill Number</p> <p class="no-margin fs-10 all-caps">Bill Number</p>
<div>{{ item.payment_history[item.payment_history.length-1].payment_reference }}</div> <div>{{ item.payment_history && item.payment_history.length > 0 ? item.payment_history[item.payment_history.length - 1].payment_reference : '-' }}</div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<div v-if="item.documents.length"> <div v-if="item.documents.length">
@@ -1,322 +0,0 @@
<template>
<div class="row m-b-15 m-l-5 m-r-10 parentContainer">
<div class="col bg-white rounded">
<div class="row">
<div class="col padding-20">
<div class="row align-items-center">
<div class="col">
<p class="no-margin fs-10 all-caps">Marking</p>
<div class="no-margin">
<div v-if="item.order">
<a :href="route('customer.profile', item.order.company_module.marking)">{{item.order.company_module.marking}}</a>/<a :href="route('order.show', item.order.reference)">{{item.order.reference}}</a>
<p>{{item.loading_days_ago}}</p>
</div>
<div v-else class="text-danger">Unclaimed Packing List</div>
</div>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Container</p>
<div v-if="item.container"> {{item.container.container_reference}}</div>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Invoice Date</p>
<div v-if="!item.shipping_transaction">n/a</div>
<div v-if="item.shipping_transaction"> {{ item.shipping_transaction.updated_at }}</div>
</div>
<div class="col">
<div v-if="item.order">
<p class="no-margin fs-10 all-caps">Address</p>
<div>{{ item.order.address.post_code_area}}</div>
<div>{{ item.order.address.district.name +' '+item.order.address.postcode+' '+item.order.address.state.name }}</div>
</div>
<div v-else class="text-danger">Unclaimed</div>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Status</p>
<div class="all-caps">{{ invoice_status }}</div>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Amount</p>
<div v-if="!item.shipping_transaction">n/a</div>
<div v-if="item.shipping_transaction">MYR {{ item.shipping_transaction.amount.toFixed(2) }}</div>
</div>
<div class="col-auto p-l-0 p-r-0" v-if="['Pending Payment', 'Paid Invoice', 'Suspended Invoice'].includes(invoice_status)">
<div v-if="item.shipping_transaction">
<div v-if="item.shipping_transaction.documents.length">
<div v-for="file in item.shipping_transaction.documents[0].files" v-bind:key="file.id" class="col-auto no-padding">
<document-file-viewer-component :file="file">
<template slot="button">
<div class="btn bg-grey no-border muted">
<i class="fa fa-file-pdf-o"></i>
</div>
</template>
</document-file-viewer-component>
</div>
</div>
<div v-else>
<div class="btn bg-grey no-border muted invisible">
<i class="fa fa-file-pdf-o"></i>
</div>
</div>
</div>
</div>
<div class="col-auto">
<div class="row text-center parentContainer m-b-10" v-if="['Pending Invoice'].includes(invoice_status) && !item.receive_packing_list" >
<div class="col">
<div class="requestModal pointer btn btn-primary btn-xs" data-type="addWarehouseTransport">
Add Warehouse Transport
</div>
<modal-component class="animate_animated animatefast animate_fadeIn" styleType="fill-in" type="addWarehouseTransport">
<create-warehouse-transport-form-component :packinglistId="item.id" :section="section"></create-warehouse-transport-form-component>
</modal-component>
</div>
</div>
<div class="row">
<div class="col">
<div class="btn bg-grey no-border" @click="expanded = !expanded" v-if="['Pending Approval', 'Pending Payment'].includes(invoice_status)">
<i class="fa" :class="{'fa-angle-down': !expanded, 'fa-angle-up': expanded}" ></i>
</div>
<div v-if="!item.shipping_transaction">
<div v-if="item.order">
<div v-if="!item.order.company_module.billingAddress">
<div class="btn btn-primary btn-xs pointer requestModal btn-block" data-type="billingAddressComponent">Add Billing Address</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" size="extra-large" styleType="fill-in" type="billingAddressComponent">
<address-form-component :id="item.order.company_module.id" :section="section" :type=1></address-form-component>
</modal-component>
</div>
<div class="row" v-if="item.order.company_module.billingAddress">
<div class="col">
<div class="col-auto requestModal pointer" data-type="editBillingAddress">
<i class="fa fa-edit pointer fa-fw m-l-5"></i> Edit billing Address
</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" size="extra-large" styleType="fill-in" type="editBillingAddress">
<div class="row">
<div class="col bg-white">
<address-form-component :id="item.order.company_module.id" :data="item.order.company_module.billingAddress" section="editBillingAddress"></address-form-component>
</div>
</div>
</modal-component>
</div>
</div>
<div v-if="!item.order.address.post_code_area">
<div class="btn btn-xs btn-primary pointer m-t-10 requestModal btn-block" data-type="defineLocation">Define Location</div>
<modal-component class="animate_animated animatefast animate_fadeIn" styleType="fill-in" type="defineLocation">
<declare-postcode-area-form-component :data="item.order.address" :section="section"></declare-postcode-area-form-component>
</modal-component>
</div>
<div v-if="item.order.company_module.billingAddress && item.order.address.post_code_area" class="btn btn-outline-primary btn-lg pointer" @click="generateInvoice()">Generate Invoice</div>
</div>
<div v-else>
<div class="btn btn-outline-primary btn-lg pointer invisible">Generate Invoice</div>
</div>
</div>
<div class="btn bg-grey no-border muted requestModal" v-if="item.shipping_transaction && invoice_status == 'Pending Approval'" data-type="confirmInvoice">
<i class="fa fa-check fs-12"></i>
</div>
<div class="btn bg-grey no-border muted requestModal" v-if="item.shipping_transaction && invoice_status == 'Pending Approval'" data-type="deleteInoive">
<i class="fa fa-close fs-12"></i>
</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="confirmInvoice">
<approve-shipping-invoice-form-component :section="section" :data="data"></approve-shipping-invoice-form-component>
</modal-component>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteInoive">
<delete-shipping-invoice-form-component :section="section" :data="data"></delete-shipping-invoice-form-component>
</modal-component>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row b-t b-grey p-t-10 m-l-5 m-r-5" v-show="expanded" v-if="item.shipping_transaction && ['Pending Approval', 'Suspended Invoice'].includes(invoice_status)">
<div class="col p-b-10">
<div class="row">
<div class="col p-l-20 p-r-20 p-t-10 p-b-10">
<div class="row align-items-center">
<div class="col">
<p class="no-margin fs-10 all-caps">Container Reference</p>
<div v-if="item.packages.length">{{ item.container ? item.container.container_reference : 'n/a' }}</div>
<div v-else>n/a</div>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Due Date</p>
<div v-if="item.packages.length">
<div v-if="item.container">
<div v-if="item.container.transport">{{ item.container.transport.drop_date == null ? item.container.transport.current_schedule.etd : item.container.transport.drop_date }}</div>
<div v-else>n/a</div>
</div>
<div v-else>n/a</div>
</div>
<div v-else>n/a</div>
</div>
<!-- <div class="col">
<p class="no-margin fs-10 all-caps">Paid Date</p>
<div>n/a</div>
</div> -->
<div class="col">
<p class="no-margin fs-10 all-caps">Total CBM</p>
<div>{{ (parseFloat(cbm) + parseFloat(overweight)).toFixed(3) }}</div>
</div>
</div>
</div>
</div>
<h5 class="text-underline text-center">Invoice Details</h5>
<invoice-items-form-component :data="item.shipping_transaction" :section="section"></invoice-items-form-component>
<div class="row">
<div class="col">
<p class="no-margin fs-10 all-caps">Subtotal</p>
<div>{{ item.shipping_transaction.amount - item.shipping_transaction.service_charge - item.shipping_transaction.tax }}</div>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Service Charges</p>
<div>{{ item.shipping_transaction.service_charge }}</div>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Tax</p>
<div>{{ item.shipping_transaction.tax }}</div>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Total</p>
<div>{{ item.shipping_transaction.amount }}</div>
</div>
</div>
</div>
</div>
<div class="row b-t b-grey p-t-10 m-l-5 m-r-5" v-show="expanded" v-if="item.shipping_transaction && invoice_status == 'Pending Payment'">
<div class="col-12 col-md-7 padding-20">
<div class="row bg-master-lightest h-100">
<div class="col">
<div class="row bg-master-lightest" v-if="item.shipping_transaction.payment_attempts.length">
<div class="col">
<div class="row m-t-10 m-b-10">
<div class="col">
<div class="font-head fs-10 all-caps">Payment Attempt</div>
</div>
</div>
<div class="row">
<div class="col">
<shipping-transaction-component v-for="item in item.shipping_transaction.payment_attempts" v-bind:key="item.id" :data="item" ></shipping-transaction-component>
</div>
</div>
</div>
</div>
<div class="row bg-master-lightest" v-if="item.shipping_transaction.payment_history.length">
<div class="col">
<div class="row m-t-10 m-b-10">
<div class="col">
<div class="font-head fs-10 all-caps">Payment History</div>
</div>
</div>
<div class="row">
<div class="col">
<payment-history-component v-for="item in item.shipping_transaction.payment_history" v-bind:key="item.id" :data="item" ></payment-history-component>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-5 padding-20 parentContainer">
<div class="row bg-master-lightest h-100">
<div class="col">
<div class="row padding-10">
<div class="col">
<div class="row align-items-end m-b-10 text-complete">
<div class="col">
<div class="font-heading all-caps fs-12">Total Amount:</div>
</div>
<div class="col-auto text-right">
<div class="font-heading fs-12">MYR {{(Math.round((item.shipping_transaction.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
</div>
</div>
<div class="row align-items-end m-b-10 text-success hide">
<div class="col">
<div class="font-heading all-caps fs-12">Paid Total:</div>
</div>
<div class="col-auto text-right">
<!-- <div class="font-heading fs-12">MYR {{(Math.round((item.shipping_transaction.paid_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div> -->
<div class="font-heading fs-12">Paid Total</div>
</div>
</div>
<div class="row align-items-end m-b-10 hide">
<div class="col">
<div class="font-heading all-caps fs-12">Floating Amount:</div>
</div>
<div class="col-auto text-right">
<!-- <div class="font-heading fs-12">MYR {{(Math.round((item.shipping_transaction.floating_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div> -->
<div class="font-heading fs-12">Floating Amount</div>
</div>
</div>
<div class="row align-items-end bold text-danger">
<div class="col">
<div class="font-heading all-caps fs-12">OutStanding Total:</div>
</div>
<div class="col-auto text-right">
<div class="font-heading fs-12">MYR {{(Math.round((item.shipping_transaction.outstanding + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
</div>
</div>
<div class="row m-t-20" v-if="item.shipping_transaction.outstanding > 0">
<div class="col">
<div class="btn btn-sm all-caps b-rad-none btn-success btn-block requestModal" data-type="makePayment">Make Payment</div>
</div>
</div>
</div>
</div>
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="makePayment">
<payment-form-component :data="item.shipping_transaction" :section="section"></payment-form-component>
</modal-component>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
props: {
invoice_status: {
type: String,
required: true
},
section:{
type: String,
required: true
}
},
data(){
return {
parameters: {
packing_list_id: null,
transaction_details: [],
},
expanded: false,
}
},
computed: {
cbm () {
return (Math.ceil((this.item.packages.reduce((total, obj) => (obj.type === 2 ? 0 : obj.cbm) + total, 0)) * 1000) / 1000).toFixed(3)
},
overweight(){
return (Math.ceil((this.item.packages.reduce((total, obj) => (obj.type === 2 ? obj.cbm : 0) + total, 0)) * 1000) / 1000).toFixed(3)
}
},
created(){
this.parameters.packing_list_id = this.data.id;
},
methods: {
generateInvoice() {
this.submit(this.route('api.transaction.invoice.create'), 'post', this.section, true, true);
},
successHandler(response){
this.item = response.payload.data;
this.updateList();
}
},
mixins: [componentHandler]
}
</script>
@@ -69,6 +69,9 @@ export default {
case 'walletsReportSection': case 'walletsReportSection':
apiRoute = route('walletTransactions.export'); apiRoute = route('walletTransactions.export');
break; break;
case 'groupTransactionSection':
apiRoute = route('groupTransaction.export');
break;
} }
window.open(apiRoute + '?startDate=' + this.parameters.startDate + '&endDate=' + this.parameters.endDate, '_blank'); window.open(apiRoute + '?startDate=' + this.parameters.startDate + '&endDate=' + this.parameters.endDate, '_blank');
}, },
@@ -155,7 +155,7 @@
export default { export default {
props: { props: {
sumAmount: { sumAmount: {
type: String, type: Number,
required: true required: true
}, },
section:{ section:{
@@ -157,6 +157,7 @@
this.error = response.payload.data.message; this.error = response.payload.data.message;
} }
else{ else{
this.closeModal();
this.updateList(); this.updateList();
} }
} }
@@ -76,9 +76,14 @@
files: this.files files: this.files
}; };
this.submit(this.route('api.transaction.payment.verification.create', this.data.id), 'post', this.section, true, true) this.submit(this.route('api.transaction.payment.verification.create', this.data.id), 'post', this.section, true, true)
} },
successHandler(response){
this.closeModal();
this.formHandler();
window.location.reload();
},
}, },
mixins: [ModalFromHandler] mixins: [ModalFromHandler]
} }
</script> </script>
@@ -113,7 +113,7 @@
<div class="row tabsContainer tabContent hide" tab-name="pendingPayment" v-if="isActiveTab('pendingPayment') || showTabContent('pendingPayment')"> <div class="row tabsContainer tabContent hide" tab-name="pendingPayment" v-if="isActiveTab('pendingPayment') || showTabContent('pendingPayment')">
<div class="col"> <div class="col">
<payment-filter-component :endpoint="route('api.packing_list.list')" :data="data"></payment-filter-component> <payment-filter-component :endpoint="route('api.packing_list.list')" :data="data"></payment-filter-component>
<admin-payments-billing-with-search-component :options="{has_invoice_status_in: [2], packing_list_ordered_by_invoice_date: true, per_page: 5, check_for_storage_invoice: 1}" section="pendingPaymentSection" invoice_status="Pending Payment" :with_export="true"></admin-payments-billing-with-search-component> <admin-payments-billing-with-search-component :options="{has_invoice_status_in: [2], packing_list_limit_one_by_type_ordered_by_invoice_date: true, per_page: 5, check_for_storage_invoice: 1}" section="pendingPaymentSection" invoice_status="Pending Payment" :with_export="true"></admin-payments-billing-with-search-component>
</div> </div>
</div> </div>
<div class="row tabsContainer tabContent hide" tab-name="paidInvoice" v-if="isActiveTab('paidInvoice') || showTabContent('paidInvoice')"> <div class="row tabsContainer tabContent hide" tab-name="paidInvoice" v-if="isActiveTab('paidInvoice') || showTabContent('paidInvoice')">
@@ -0,0 +1,94 @@
<template>
<div class="w-100">
<div class="row m-b-20" @keyup.enter="downloadReport()">
<div class="col">
<div class="row m-l-0 m-r-0">
<div class="col p-l-0 p-r-0">
<validation-wrapper-component selectable :validator="$v.parameters.id">
<label>Segment</label>
<selectable-component :endpoint="route('api.segment.list')" :section="section" :value="3"
valueColumn="id" :labelColumn="['name']" v-model="parameters.id"
@input="onSelect"></selectable-component>
</validation-wrapper-component>
</div>
<div class="col p-l-0 p-r-0">
<validation-wrapper-component :validator="$v.parameters.company_marking">
<label class="text-primary">Company Marking</label>
<input type="text" class="form-control fs-12" v-model.trim="parameters.company_marking">
</validation-wrapper-component>
</div>
<div class="col-auto p-l-0 p-r-0">
<div class="btn btn-lg btn-primary fs-11 w-100 h-100 d-flex justify-content-center align-items-center"
@click="downloadReport()">
<span>
Search
</span>
</div>
</div>
</div>
</div>
</div>
<list-component class="mt-4" :key="parameters.vueKey" section="listSegmentSection"
:endpoint="route('api.company.list')" :options="options">
<template #list="{ data }">
<company-component :data="data"></company-component>
</template>
</list-component>
</div>
</template>
<script>
import componentHandler from "../../../general/mixins/componentHandler";
export default {
props: {
section: String,
type: Number,
id: { type: Number, default: null },
},
data() {
return {
parameters: {
id: null,
company_marking: null,
vueKey: 1,
}
};
},
validations: {
parameters: {
id: {},
company_marking: {},
}
},
computed: {
options() {
const options = {
company_segments_in: [this.parameters.id]
};
if (this.parameters.company_marking) {
options.marking_in = [this.parameters.company_marking];
}
return options;
},
},
methods: {
onSelect(val) {
this.parameters.id = val;
},
downloadReport() {
this.parameters.vueKey++;
console.log(this.parameters.vueKey);
},
},
created() {
const id = new URL(location.href).searchParams.get('id');
if (id) this.parameters.id = id;
},
mixins: [componentHandler],
};
</script>
@@ -34,6 +34,15 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-auto">
<div class="row">
<div class="col">
<a class="btn btn-xs btn-outline-info b-rad-none m-r-5 requestModal" :href="route('segments') + `?id=${item.id}`">
<i class="fa fa-list"></i>
</a>
</div>
</div>
</div>
<div class="col-auto hide"> <div class="col-auto hide">
<div class="row"> <div class="row">
<div class="col"> <div class="col">
+134
View File
@@ -0,0 +1,134 @@
const state = {
pollingJobResults: []
};
export default {
state,
getters: {
getJob: (state) => (name) => {
return state.pollingJobResults.find(item => item.name === name);;
},
getJobAttemptCount: (state) => (name) => {
let job = state.pollingJobResults.find(item => item.name === name);
return job ? job.pollingAttemptsCount : 0;
},
},
mutations: {
ADD_POLLING_JOB_RESULT(state, {jobId, name, pollingAttemptsCount, isPolling, isFetchingResult, maxAttempts, pollJobResult, interval}) {
let intervalId = setInterval(() => {
if (pollJobResult) {
pollJobResult(state);
}
}, interval);
state.pollingJobResults.push({ jobId, name, pollingAttemptsCount, isPolling, isFetchingResult, maxAttempts, intervalId});
},
UPDATE_POLLING_JOB_RESULT(state, { jobId, pollingAttemptsCount, isPolling, isFetchingResult, isLastAttempt}) {
const index = state.pollingJobResults.findIndex(s => s.jobId === jobId);
if (index !== -1) {
const updatedPollingJobResults = [...state.pollingJobResults];
updatedPollingJobResults[index] = { ...updatedPollingJobResults[index],
jobId,
pollingAttemptsCount: pollingAttemptsCount !== undefined ? pollingAttemptsCount : updatedPollingJobResults[index].pollingAttemptsCount,
isPolling: isPolling !== undefined ? isPolling : updatedPollingJobResults[index].isPolling,
isFetchingResult: isFetchingResult !== undefined ? isFetchingResult : updatedPollingJobResults[index].isFetchingResult,
isLastAttempt: isLastAttempt !== undefined ? isLastAttempt : updatedPollingJobResults[index].isLastAttempt,
};
state.pollingJobResults = updatedPollingJobResults;
}
},
REMOVE_POLLING_JOB_RESULT_BY_JOBID(state, jobId) {
const index = state.pollingJobResults.findIndex(s => s.jobId === jobId);
if (index !== -1) {
clearInterval(state.pollingJobResults[index].intervalId);
state.pollingJobResults.splice(index, 1);
}
},
// REMOVE_POLLING_JOB_RESULT_BY_JOBID_2(state, jobId) {
// const index = state.pollingJobResults.findIndex(s => s.jobId === jobId);
// if (index !== -1) {
// clearInterval(state.pollingJobResults[index].intervalId);
// //state.pollingJobResults.splice(index, 1);
// }
// },
REMOVE_POLLING_JOB_RESULT_BY_NAME(state, name) {
const index = state.pollingJobResults.findIndex(s => s.name === name);
if (index !== -1) {
clearInterval(state.pollingJobResults[index].intervalId);
state.pollingJobResults.splice(index, 1);
}
},
},
actions: {
submitJobRequest({ dispatch }, { url, name }){
dispatch('crudRequestV2', {
endpoint: url,
method: 'get',
}).then(response => {
let success = response.ok;
response.json().then(response => {
if(!success){return;}
let jobId = response.payload.data.job_id;
if(jobId){
let pollingAttemptsCount = 0;
dispatch('startPolling', { jobId, name, pollingAttemptsCount });
}
});
})
},
stopPollingJobResultByJobId({ commit }, { jobId }){
commit('REMOVE_POLLING_JOB_RESULT_BY_JOBID', jobId);
},
stopPollingJobResultByName({ commit }, { name }){
commit('REMOVE_POLLING_JOB_RESULT_BY_NAME', name);
},
startPolling({ state, commit, dispatch }, { jobId, name, pollingAttemptsCount, maxAttempts = 8}) {
let interval = 10000;
// console.log(`startPolling jobId: ${jobId}, pollingAttemptsCount: ${pollingAttemptsCount}, name: ${name}`);
const pollJobResult = (state) => {
//console.log(`MONITOR state ${JSON.stringify(state)}`);
const index = state.pollingJobResults.findIndex(s => s.jobId === jobId);
if (index !== -1) {
pollingAttemptsCount = state.pollingJobResults[index].pollingAttemptsCount;
if (state.pollingJobResults[index].isPolling || state.pollingJobResults[index].isFetchingResult) {
return;
}
}
else{
return;
}
pollingAttemptsCount++;
if(pollingAttemptsCount === 1){
commit("REMOVE_POLLING_JOB_RESULT_BY_JOBID", jobId );
commit("ADD_POLLING_JOB_RESULT", { jobId, name, pollingAttemptsCount, isPolling: false, isFetchingResult: false, maxAttempts, pollJobResult, interval: 5000});
}
if (pollingAttemptsCount > maxAttempts) {
//console.log(`Reached maximum attempts (${maxAttempts}). Polling stopped.`);
commit("REMOVE_POLLING_JOB_RESULT_BY_JOBID", jobId );
return;
}
if(pollingAttemptsCount === maxAttempts){
commit('UPDATE_POLLING_JOB_RESULT', { jobId, pollingAttemptsCount, isPolling: true, isFetchingResult: false, isLastAttempt: true });
}
else{
commit('UPDATE_POLLING_JOB_RESULT', { jobId, pollingAttemptsCount, isPolling: true, isFetchingResult: false, isLastAttempt: false});
}
}
commit("ADD_POLLING_JOB_RESULT", { jobId, name, pollingAttemptsCount, isPolling: false, isFetchingResult: false, maxAttempts, pollJobResult, interval});
},
updatePollingJobResultByJobId({ commit }, { jobId, isPolling, isFetchingResult }){
commit('UPDATE_POLLING_JOB_RESULT', { jobId, isPolling, isFetchingResult });
}
}
}
+3 -1
View File
@@ -7,6 +7,7 @@ import crudRequest from './modules/crudRequest'
import crudRequestV2 from './modules/crudRequestV2' import crudRequestV2 from './modules/crudRequestV2'
import authentication from './modules/authentication' import authentication from './modules/authentication'
import loadRequestQueue from './modules/loadRequestQueue' import loadRequestQueue from './modules/loadRequestQueue'
import jobPolling from './modules/jobPolling'
Vue.use(Vuex); Vue.use(Vuex);
@@ -18,6 +19,7 @@ export default new Vuex.Store({
createNotification, createNotification,
crudRequest, crudRequest,
crudRequestV2, crudRequestV2,
authentication authentication,
jobPolling
} }
}) })
+10 -4
View File
@@ -4,10 +4,16 @@
@include('vendor/head') @include('vendor/head')
</head> </head>
<body class="horizontal-menu horizontal-app-menu bg-white overflow-hidden"> <body class="horizontal-menu horizontal-app-menu bg-white overflow-hidden">
<!-- Google Tag Manager (noscript) --> <!-- Google tag (gtag.js) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-T3XCNMB" <script async src="https://www.googletagmanager.com/gtag/js?id=G-SP04J05142"></script>
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <script>
<!-- End Google Tag Manager (noscript) --> window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-SP04J05142');
</script>
<!-- End Google Tag Manager -->
<div id="app" style="min-height: 100%;"> <div id="app" style="min-height: 100%;">
@yield('content') @yield('content')
</div> </div>
@@ -131,6 +131,12 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row m-t-15 m-b-15">
<div class="col-8 p-l-0">
<small class="all-caps muted">Export Group Transactions CSV</small>
<download-billing-with-dates-component section="groupTransactionSection"></download-billing-with-dates-component>
</div>
</div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<admin-payments-billing-section-component></admin-payments-billing-section-component> <admin-payments-billing-section-component></admin-payments-billing-section-component>
@@ -131,7 +131,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row" v-if="$store.getters.isAdmin">
<div class="col"> <div class="col">
<admin-payments-billing-polling-section-component></admin-payments-billing-polling-section-component> <admin-payments-billing-polling-section-component></admin-payments-billing-polling-section-component>
</div> </div>
@@ -0,0 +1,134 @@
<div class="row">
<div class="col b-r b-white">
<div class="row fs-12 text-center">
<div class="col p-t-20 p-b-20 bg-master-lighter tabButton @if($active==1) active @endif" tab-name="segment1">
<div class="row justify-content-center m-b-5">
<div class="col-auto">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="35" height="35" viewBox="0 0 172 172" style=" fill:#000000;">
<defs>
<linearGradient x1="66.87575" y1="36.02325" x2="66.87575" y2="164.11756" gradientUnits="userSpaceOnUse" id="color-1_hUqtl21qkZmg_gr1">
<stop offset="0" stop-color="#009add"></stop>
<stop offset="1" stop-color="#00baa4"></stop>
</linearGradient>
<linearGradient x1="105.12425" y1="35.4535" x2="105.12425" y2="164.77331" gradientUnits="userSpaceOnUse" id="color-2_hUqtl21qkZmg_gr2">
<stop offset="0" stop-color="#009add"></stop>
<stop offset="1" stop-color="#00baa4"></stop>
</linearGradient>
<linearGradient x1="86" y1="130.00781" x2="86" y2="146.81275" gradientUnits="userSpaceOnUse" id="color-3_hUqtl21qkZmg_gr3">
<stop offset="0" stop-color="#4ec9ff"></stop>
<stop offset="1" stop-color="#2bffe6"></stop>
</linearGradient>
<linearGradient x1="86" y1="2.6875" x2="86" y2="163.9375" gradientUnits="userSpaceOnUse" id="color-4_hUqtl21qkZmg_gr4">
<stop offset="0" stop-color="#009add"></stop>
<stop offset="1" stop-color="#00baa4"></stop>
</linearGradient>
</defs>
<g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal">
<path d="M0,172v-172h172v172z" fill="none"></path>
<g>
<path d="M73.43863,107.5c-3.30294,0 -6.03075,2.40531 -6.48763,5.53087h-0.1505c-0.45687,-3.12556 -3.182,-5.53087 -6.48763,-5.53087c-3.62544,0 -6.56287,2.88906 -6.56287,6.45269c0,7.2885 6.78325,12.19856 10.59681,14.37812c1.55606,0.88956 3.49913,0.88956 5.05519,0c3.81625,-2.18225 10.59681,-7.08962 10.59681,-14.37812c0,-3.56363 -2.93744,-6.45269 -6.56019,-6.45269z" fill="url(#color-1_hUqtl21qkZmg_gr1)"></path>
<path d="M111.68713,107.5c-3.30294,0 -6.03075,2.40531 -6.48762,5.53087h-0.1505c-0.45419,-3.12556 -3.182,-5.53087 -6.48763,-5.53087c-3.62275,0 -6.56288,2.88906 -6.56288,6.45269c0,7.2885 6.78325,12.19856 10.59681,14.37813c1.55606,0.88956 3.49913,0.88956 5.05519,0c3.81625,-2.17956 10.5995,-7.08694 10.5995,-14.37812c0,-3.56363 -2.93744,-6.45269 -6.56288,-6.45269z" fill="url(#color-2_hUqtl21qkZmg_gr2)"></path>
<path d="M75.25,134.375c0,5.93669 4.81331,10.75 10.75,10.75c5.93669,0 10.75,-4.81331 10.75,-10.75v-2.6875h-21.5z" fill="url(#color-3_hUqtl21qkZmg_gr3)"></path>
<path d="M139.75,95.90344v-6.74831c0.02956,-0.15856 0.09406,-0.301 0.09406,-0.46762l-0.00806,-22.12619c0.2795,-14.89412 -7.39331,-27.3695 -10.70431,-32.04038c-5.54431,-7.80719 -11.05906,-11.73631 -13.83525,-12.08569c-1.06156,-0.12362 -2.11775,0.387 -2.65794,1.31688l-1.14487,1.97262c-0.97019,1.67431 -2.71169,2.67406 -4.65475,2.67406c-1.94306,0 -3.68994,-0.99975 -4.66012,-2.67406l-11.98625,-20.63194c-0.87613,-1.505 -2.44563,-2.40531 -4.1925,-2.40531c-1.74956,0 -3.31906,0.90031 -4.18981,2.408l-11.94056,20.54863c-0.97019,1.67431 -2.71169,2.67406 -4.65475,2.67406c-1.94306,0 -3.68994,-0.99975 -4.66281,-2.67406l-1.16906,-2.01025c-0.42463,-0.73369 -1.17712,-1.2255 -2.021,-1.31956c-2.64181,-0.3225 -7.47662,3.06375 -11.86531,8.38231c-6.26456,7.60025 -13.01019,20.86575 -13.15262,35.31375l-0.09406,22.66638c0,0 0,0 0,0.00269c0,0.00269 0,0.00538 0,0.00806v7.21594c-6.34519,3.02881 -10.75,9.48687 -10.75,16.97156c0,10.37106 8.44144,18.8125 18.8125,18.8125h0.12362c6.64888,18.77487 24.51,32.25 45.56388,32.25c21.05388,0 38.915,-13.47513 45.56388,-32.25h0.12363c10.37106,0 18.8125,-8.44144 18.8125,-18.8125c0,-7.48469 -4.40481,-13.94275 -10.75,-16.97156zM49.6435,34.11513c2.7735,-3.36475 4.94769,-5.02025 6.24038,-5.80769l0.0215,0.03762c1.94844,3.34863 5.42875,5.34813 9.3095,5.34813c3.88344,0 7.36106,-1.9995 9.30412,-5.35081l11.481,-19.76388l11.52669,19.84719c1.94844,3.34863 5.42875,5.34813 9.3095,5.34813c3.82969,0 7.267,-1.94844 9.22619,-5.21375c1.83019,1.20937 5.01756,3.90763 8.686,9.07031c2.28975,3.23038 9.59975,14.61463 9.69919,27.93119c-8.66719,-18.07881 -27.09538,-30.62406 -48.44756,-30.62406c-21.16406,0 -39.45788,12.32487 -48.21644,30.14838c0.4085,-12.65544 6.321,-24.252 11.85994,-30.97075zM26.875,112.875c0,-6.48763 4.62519,-11.91637 10.75,-13.16606v5.59806c-3.12556,1.10994 -5.375,4.0635 -5.375,7.568c0,3.59856 2.37306,6.60856 5.62763,7.64594c0.19619,1.91887 0.53481,3.79206 0.94869,5.64106c-6.70263,-0.74981 -11.95131,-6.3855 -11.95131,-13.287zM129,115.5625c0,23.70913 -19.29087,43 -43,43c-23.70913,0 -43,-19.29087 -43,-43v-16.125h8.0625c9.34981,0 17.47413,-5.32931 21.5,-13.11231c4.02587,7.783 12.15019,13.11231 21.5,13.11231h34.9375zM94.0625,94.0625c-10.37106,0 -18.8125,-8.44144 -18.8125,-18.8125v-2.6875h-5.375v2.6875c0,10.37106 -8.44144,18.8125 -18.8125,18.8125h-13.4375v-5.36425v-0.01075c0,-26.67344 21.70156,-48.375 48.375,-48.375c26.67344,0 48.375,21.70156 48.375,48.375v5.375zM133.17369,126.162c0.41387,-1.84631 0.75519,-3.7195 0.94869,-5.64106c3.25456,-1.03737 5.62762,-4.04738 5.62762,-7.64594c0,-3.5045 -2.24944,-6.45806 -5.375,-7.568v-5.59806c6.12481,1.24969 10.75,6.67575 10.75,13.16606c0,6.9015 -5.24869,12.53719 -11.95131,13.287z" fill="url(#color-4_hUqtl21qkZmg_gr4)"></path>
</g>
</g>
</svg>
</div>
</div>
<div class="row">
<div class="col">
<div class="fs-12 m-t-5 all-caps">{{ __('Standard') }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="col b-r b-white">
<div class="row fs-12 text-center">
<div class="col p-t-20 p-b-20 bg-master-lighter tabButton @if($active==2) active @endif" tab-name="segment2">
<div class="row justify-content-center m-b-5">
<div class="col-auto">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="35" height="35" viewBox="0 0 172 172" style=" fill:#000000;">
<defs>
<linearGradient x1="104.8125" y1="95.74219" x2="104.8125" y2="114.9175" gradientUnits="userSpaceOnUse" id="color-1_TUOBhQt-Vj1j_gr1">
<stop offset="0" stop-color="#4ec9ff"></stop>
<stop offset="1" stop-color="#2bffe6"></stop>
</linearGradient>
<linearGradient x1="67.1875" y1="95.74219" x2="67.1875" y2="114.9175" gradientUnits="userSpaceOnUse" id="color-2_TUOBhQt-Vj1j_gr2">
<stop offset="0" stop-color="#4ec9ff"></stop>
<stop offset="1" stop-color="#2bffe6"></stop>
</linearGradient>
<linearGradient x1="86" y1="125.40413" x2="86" y2="133.41288" gradientUnits="userSpaceOnUse" id="color-3_TUOBhQt-Vj1j_gr3">
<stop offset="0" stop-color="#4ec9ff"></stop>
<stop offset="1" stop-color="#2bffe6"></stop>
</linearGradient>
<linearGradient x1="86" y1="10.234" x2="86" y2="158.13788" gradientUnits="userSpaceOnUse" id="color-4_TUOBhQt-Vj1j_gr4">
<stop offset="0" stop-color="#009add"></stop>
<stop offset="1" stop-color="#00baa4"></stop>
</linearGradient>
</defs>
<g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal">
<path d="M0,172v-172h172v172z" fill="none"></path>
<g>
<circle cx="39" cy="39" transform="scale(2.6875,2.6875)" r="3" fill="url(#color-1_TUOBhQt-Vj1j_gr1)"></circle>
<circle cx="25" cy="39" transform="scale(2.6875,2.6875)" r="3" fill="url(#color-2_TUOBhQt-Vj1j_gr2)"></circle>
<rect x="28" y="47" transform="scale(2.6875,2.6875)" width="8" height="3" fill="url(#color-3_TUOBhQt-Vj1j_gr3)"></rect>
<path d="M142.4375,80.11975v-7.55725c0,-31.11856 -25.31625,-56.4375 -56.4375,-56.4375c-31.12125,0 -56.4375,25.31894 -56.4375,56.4375v7.55725c-4.81062,2.79231 -8.0625,7.98994 -8.0625,13.94275c0,8.89294 7.23206,16.125 16.125,16.125h0.13706c1.40556,25.42106 22.47019,45.6875 48.23794,45.6875c25.76775,0 46.83238,-20.26644 48.23794,-45.6875h0.13706c8.89294,0 16.125,-7.23206 16.125,-16.125c0,-5.95281 -3.25188,-11.15044 -8.0625,-13.94275zM34.9375,77.9375v-5.375h16.125c7.40944,0 13.4375,-6.02806 13.4375,-13.4375v-5.375h-5.375v5.375c0,4.44512 -3.61738,8.0625 -8.0625,8.0625h-15.83744c2.69556,-25.63875 24.43475,-45.6875 50.77494,-45.6875c26.34019,0 48.07938,20.04875 50.77494,45.6875h-42.71244c-4.44512,0 -8.0625,-3.61738 -8.0625,-8.0625v-5.375h-5.375v5.375c0,7.40944 6.02806,13.4375 13.4375,13.4375h43v5.375h-46.91837c-8.213,0 -14.89413,-6.68113 -14.89413,-14.89413v-9.29337h-5.375v8.94937c0,8.40113 -6.837,15.23813 -15.23813,15.23813zM26.875,94.0625c0,-5.92863 4.82138,-10.75 10.75,-10.75v8.0625h-2.6875c-1.4835,0 -2.6875,1.20131 -2.6875,2.6875c0,1.48619 1.204,2.6875 2.6875,2.6875h2.6875v8.0625c-5.92862,0 -10.75,-4.82137 -10.75,-10.75zM86,150.5c-23.70912,0 -43,-19.29087 -43,-43v-24.1875h11.63687c7.61906,0 14.28675,-4.15488 17.85575,-10.31731c3.48031,6.15438 10.08888,10.31731 17.6515,10.31731h38.85587v24.1875c0,23.70913 -19.29087,43 -43,43zM134.375,104.8125v-8.0625h2.6875c1.4835,0 2.6875,-1.20131 2.6875,-2.6875c0,-1.48619 -1.204,-2.6875 -2.6875,-2.6875h-2.6875v-8.0625c5.92863,0 10.75,4.82137 10.75,10.75c0,5.92863 -4.82137,10.75 -10.75,10.75z" fill="url(#color-4_TUOBhQt-Vj1j_gr4)"></path>
</g>
</g>
</svg>
</div>
</div>
<div class="row">
<div class="col">
<div class="fs-12 m-t-5 all-caps">{{ __('Custom') }}</div>
</div>
</div>
</div>
</div>
</div>
<div class="col b-r b-white">
<div class="row fs-12 text-center">
<div class="col p-t-20 p-b-20 bg-master-lighter tabButton @if($active==3) active @endif" tab-name="segment3">
<div class="row justify-content-center m-b-5">
<div class="col-auto">
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="35" height="35" viewBox="0 0 172 172" style=" fill:#000000;">
<defs>
<linearGradient x1="104.8125" y1="95.74219" x2="104.8125" y2="114.9175" gradientUnits="userSpaceOnUse" id="color-1_TUOBhQt-Vj1j_gr1">
<stop offset="0" stop-color="#4ec9ff"></stop>
<stop offset="1" stop-color="#2bffe6"></stop>
</linearGradient>
<linearGradient x1="67.1875" y1="95.74219" x2="67.1875" y2="114.9175" gradientUnits="userSpaceOnUse" id="color-2_TUOBhQt-Vj1j_gr2">
<stop offset="0" stop-color="#4ec9ff"></stop>
<stop offset="1" stop-color="#2bffe6"></stop>
</linearGradient>
<linearGradient x1="86" y1="125.40413" x2="86" y2="133.41288" gradientUnits="userSpaceOnUse" id="color-3_TUOBhQt-Vj1j_gr3">
<stop offset="0" stop-color="#4ec9ff"></stop>
<stop offset="1" stop-color="#2bffe6"></stop>
</linearGradient>
<linearGradient x1="86" y1="10.234" x2="86" y2="158.13788" gradientUnits="userSpaceOnUse" id="color-4_TUOBhQt-Vj1j_gr4">
<stop offset="0" stop-color="#009add"></stop>
<stop offset="1" stop-color="#00baa4"></stop>
</linearGradient>
</defs>
<g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal">
<path d="M0,172v-172h172v172z" fill="none"></path>
<g>
<circle cx="39" cy="39" transform="scale(2.6875,2.6875)" r="3" fill="url(#color-1_TUOBhQt-Vj1j_gr1)"></circle>
<circle cx="25" cy="39" transform="scale(2.6875,2.6875)" r="3" fill="url(#color-2_TUOBhQt-Vj1j_gr2)"></circle>
<rect x="28" y="47" transform="scale(2.6875,2.6875)" width="8" height="3" fill="url(#color-3_TUOBhQt-Vj1j_gr3)"></rect>
<path d="M142.4375,80.11975v-7.55725c0,-31.11856 -25.31625,-56.4375 -56.4375,-56.4375c-31.12125,0 -56.4375,25.31894 -56.4375,56.4375v7.55725c-4.81062,2.79231 -8.0625,7.98994 -8.0625,13.94275c0,8.89294 7.23206,16.125 16.125,16.125h0.13706c1.40556,25.42106 22.47019,45.6875 48.23794,45.6875c25.76775,0 46.83238,-20.26644 48.23794,-45.6875h0.13706c8.89294,0 16.125,-7.23206 16.125,-16.125c0,-5.95281 -3.25188,-11.15044 -8.0625,-13.94275zM34.9375,77.9375v-5.375h16.125c7.40944,0 13.4375,-6.02806 13.4375,-13.4375v-5.375h-5.375v5.375c0,4.44512 -3.61738,8.0625 -8.0625,8.0625h-15.83744c2.69556,-25.63875 24.43475,-45.6875 50.77494,-45.6875c26.34019,0 48.07938,20.04875 50.77494,45.6875h-42.71244c-4.44512,0 -8.0625,-3.61738 -8.0625,-8.0625v-5.375h-5.375v5.375c0,7.40944 6.02806,13.4375 13.4375,13.4375h43v5.375h-46.91837c-8.213,0 -14.89413,-6.68113 -14.89413,-14.89413v-9.29337h-5.375v8.94937c0,8.40113 -6.837,15.23813 -15.23813,15.23813zM26.875,94.0625c0,-5.92863 4.82138,-10.75 10.75,-10.75v8.0625h-2.6875c-1.4835,0 -2.6875,1.20131 -2.6875,2.6875c0,1.48619 1.204,2.6875 2.6875,2.6875h2.6875v8.0625c-5.92862,0 -10.75,-4.82137 -10.75,-10.75zM86,150.5c-23.70912,0 -43,-19.29087 -43,-43v-24.1875h11.63687c7.61906,0 14.28675,-4.15488 17.85575,-10.31731c3.48031,6.15438 10.08888,10.31731 17.6515,10.31731h38.85587v24.1875c0,23.70913 -19.29087,43 -43,43zM134.375,104.8125v-8.0625h2.6875c1.4835,0 2.6875,-1.20131 2.6875,-2.6875c0,-1.48619 -1.204,-2.6875 -2.6875,-2.6875h-2.6875v-8.0625c5.92863,0 10.75,4.82137 10.75,10.75c0,5.92863 -4.82137,10.75 -10.75,10.75z" fill="url(#color-4_TUOBhQt-Vj1j_gr4)"></path>
</g>
</g>
</svg>
</div>
</div>
<div class="row">
<div class="col">
<div class="fs-12 m-t-5 all-caps">{{ __('Label') }}</div>
</div>
</div>
</div>
</div>
</div>
</div>
@@ -0,0 +1,12 @@
@extends('layouts.base_portal')
@section('inner_content')
<div class="tabsContainer p-3 p-b-0 p-md-0">
<div class="row" v-if="$store.getters.isAdmin">
<div class="col bg-white padding-25">
<div class="row tabsContainer tabContent m-l-0 m-r-0" tab-name="segment1">
<segment-company-component section="customSegmentSection" />
</div>
</div>
</div>
</div>
@endsection
File diff suppressed because one or more lines are too long
-8
View File
@@ -1,11 +1,3 @@
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-T3XCNMB');</script>
<!-- End Google Tag Manager -->
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/> <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>@yield('title', 'IZYIM Shipping')</title> <title>@yield('title', 'IZYIM Shipping')</title>
-2
View File
@@ -34,8 +34,6 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
Route::post('/import/update-debtor/f614e339d7058904a831aad742e24d55', 'Imports\ImportUpdateDebtorController@import')->name('debtor.import'); Route::post('/import/update-debtor/f614e339d7058904a831aad742e24d55', 'Imports\ImportUpdateDebtorController@import')->name('debtor.import');
Route::post('/import/upload-permits-reminder', 'Imports\ImportPermitsReminderController@import')->name('permits_reminder.upload');
require __DIR__ . '/company.php'; require __DIR__ . '/company.php';
require __DIR__ . '/document.php'; require __DIR__ . '/document.php';
+4
View File
@@ -12,5 +12,9 @@ Route::group(['middleware' => 'apipub', 'prefix' => 'v1', 'as' => 'apipub.'], fu
Route::group(['prefix' => 'feedback', 'as' => 'feedback.', 'namespace' => 'HelpMenu'], function () { Route::group(['prefix' => 'feedback', 'as' => 'feedback.', 'namespace' => 'HelpMenu'], function () {
Route::post('/generate', 'GenerateFeedbackUrlController@generate')->name('feedback.url.generate'); Route::post('/generate', 'GenerateFeedbackUrlController@generate')->name('feedback.url.generate');
}); });
Route::group(['prefix' => 'wac', 'as' => 'wac.', 'namespace' => 'Wac'], function () {
Route::post('/register-email', 'RegisterExchangeEmailController@register')->name('register_email');
});
}); });
}); });
+2
View File
@@ -9,3 +9,5 @@ Route::group(['prefix' => 'permits-reminder', 'as' => 'permits_reminder.', 'name
Route::post('/{id}/update', 'UpdatePermitsReminderController@update')->name('update'); Route::post('/{id}/update', 'UpdatePermitsReminderController@update')->name('update');
}); });
Route::post('/import/upload-permits-reminder', 'Imports\ImportPermitsReminderController@import')->name('permits_reminder.upload');
+36
View File
@@ -34,6 +34,7 @@ use Carbon\Carbon;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Crypt;
use App\Models\Container; use App\Models\Container;
use App\Models\Group;
use App\Models\Transaction; use App\Models\Transaction;
use App\Models\Wallet; use App\Models\Wallet;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
@@ -578,6 +579,7 @@ Route::get('billplz/bills/{bill_no}', function($bill_no){
Route::get('/export/null-debtor/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@nullDebtor')->name('newDebtor.export'); Route::get('/export/null-debtor/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@nullDebtor')->name('newDebtor.export');
Route::get('/export/payment-transactions/{section}/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@paymentTransactions')->name('paymentTransactions.export'); Route::get('/export/payment-transactions/{section}/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@paymentTransactions')->name('paymentTransactions.export');
Route::get('/export/group-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@groupTransaction')->name('groupTransaction.export');
Route::get('/delayed_container/customers', function(){ Route::get('/delayed_container/customers', function(){
$containers = Container::whereHas('transports', function($query){ $containers = Container::whereHas('transports', function($query){
@@ -1271,6 +1273,8 @@ Route::get('/payment-and-billing-2', function () {
Route::get('/show-all-extra-payments', function () { Route::get('/show-all-extra-payments', function () {
ini_set('memory_limit', '-1'); ini_set('memory_limit', '-1');
ini_set('max_execution_time', 0);
$transactionCounter = 0;
$invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE) $invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE)
->where('status', ApprovalStatus::COMPLETED) ->where('status', ApprovalStatus::COMPLETED)
@@ -1300,6 +1304,7 @@ Route::get('/show-all-extra-payments', function () {
if (($paidAmount <= $invoice->amount) || ($paidAmount - $invoice->amount < 0.01)) { if (($paidAmount <= $invoice->amount) || ($paidAmount - $invoice->amount < 0.01)) {
continue; continue;
} }
$transactionCounter += 1;
echo '<tr>'; echo '<tr>';
echo '<td>' . $invoice->type . '</td>'; echo '<td>' . $invoice->type . '</td>';
@@ -1310,4 +1315,35 @@ Route::get('/show-all-extra-payments', function () {
echo '</tr>'; echo '</tr>';
} }
echo '</table>'; echo '</table>';
echo'<br> Total: ' . $transactionCounter;
});
Route::get('/segments', function (Request $request) {
return view('pages.segments.index');
})->name('segments');
Route::get('/group-transaction-with-completed-payments', function () {
$groups = Group::whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
->whereHas('payment', function ($query) {
$query->whereIn('status', [2, 3]);
})->get();
foreach ($groups as $group) {
$groupPayment = $group->payment;
$order = $group->groupTransactions->first()->transaction->owner->owner;
$companyModule = $order->companyModule;
$connection = $companyModule->connections()->first();
$companyMarking = $connection ? $connection->invitee_reference : '';
dump([
'reference' => $group->reference,
'groupPayment_id' => $groupPayment->id,
'groupPayment_status' => $groupPayment->status,
'order' => $order->reference,
'companyMarking' => $companyMarking,
]);
echo '<tr><td><a target="_blank" href="' . route('customer.payment-and-billing', $companyMarking) . '">' . $companyMarking . '</a><br></td></tr>';
}
}); });