mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-21 13:34:00 +00:00
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bcfeb49275 | |||
| b4c6e721fd | |||
| aa65b333c8 | |||
| 656c50e047 | |||
| 275157b243 | |||
| 0c9ffd2bf7 | |||
| a953f78771 | |||
| cf3e7f04e4 | |||
| be0cd16285 | |||
| d4dcae155d | |||
| bad8cadb3a | |||
| 3af32cc6e7 | |||
| 34bab6a45c | |||
| dd1eae1ea2 | |||
| b46bfb38bf | |||
| 19c4ee4fda | |||
| 13f13c7a0e | |||
| ffa63f611b | |||
| 82675ab80c | |||
| aac04c4135 | |||
| 56dca799f8 | |||
| 42d8f811c6 | |||
| 030136fd03 | |||
| c8b6e271e3 | |||
| f93997b858 | |||
| 6fbc23d7c4 | |||
| e0a264d58f | |||
| fec20b0947 | |||
| 0bf61d93c5 | |||
| bea24fb48e | |||
| 17a4522f50 | |||
| dfedb99c13 | |||
| 669cac9bd4 | |||
| d7625aece7 | |||
| a36c5c3063 | |||
| 2f55821046 | |||
| 4a9ac3de02 | |||
| 1e6fafef28 | |||
| fd75da5778 | |||
| b593605c72 | |||
| 8d75012390 | |||
| 2d98757c1c | |||
| b329f232f2 | |||
| 713922d2ee | |||
| 74d11f8305 | |||
| ea920717a1 | |||
| e1b49f6be0 | |||
| 1be405ca93 | |||
| 9d0924c674 | |||
| e63e3e707f | |||
| aeaec32dcb | |||
| b000c25e66 |
@@ -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,18 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
|||||||
CreatePerfexCRMCustomer::dispatch($createLeadPerfexCRMObject);
|
CreatePerfexCRMCustomer::dispatch($createLeadPerfexCRMObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!app()->environment(['production'])){
|
||||||
|
// call wac webhook
|
||||||
|
$url = 'https://wacontact.readyspace.com/rest/trigger/9fe03daf-2ace-4095-b064-601ef6d9bfe7';
|
||||||
|
$payload = [
|
||||||
|
'name' => $request->input('name'),
|
||||||
|
'email' => $request->input('email'),
|
||||||
|
'phone' => $request->input('phone'),
|
||||||
|
];
|
||||||
|
$response = Http::post($url, $payload);
|
||||||
|
Log::channel('wac_webhook')->info(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));
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
|||||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||||
|
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||||
use App\Http\Resources\AddressResource;
|
use App\Http\Resources\AddressResource;
|
||||||
use App\Models\Address;
|
use App\Models\Address;
|
||||||
use ErrorException;
|
use ErrorException;
|
||||||
@@ -100,6 +101,16 @@ class CreateAddressLogic extends AbstractControllerLogic
|
|||||||
$this->createRemarkProcessor->execute($address, $remarkObject);
|
$this->createRemarkProcessor->execute($address, $remarkObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$addressExtraFields = [
|
||||||
|
'property_type' => $request->input('property_type'),
|
||||||
|
'tools_required_unload' => $request->input('tools_required_unload'),
|
||||||
|
'pickup_time_from' => $request->input('pickup_time_from'),
|
||||||
|
'pickup_time_to' => $request->input('pickup_time_to'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$addressExtraFieldsObject = new RemarkObject(json_encode($addressExtraFields), Auth()->user()->id, RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
||||||
|
$this->createRemarkProcessor->execute($address, $addressExtraFieldsObject);
|
||||||
|
|
||||||
return $this->resourceResponse(new AddressResource($address));
|
return $this->resourceResponse(new AddressResource($address));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
|||||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||||
use App\Classes\ValueObjects\Constants\AddressType;
|
use App\Classes\ValueObjects\Constants\AddressType;
|
||||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||||
|
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||||
use App\Http\Resources\AddressResource;
|
use App\Http\Resources\AddressResource;
|
||||||
use App\Models\Address;
|
use App\Models\Address;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
class UpdateAddressLogic extends AbstractControllerLogic
|
class UpdateAddressLogic extends AbstractControllerLogic
|
||||||
{
|
{
|
||||||
@@ -102,6 +104,25 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
|||||||
$this->createRemarkProcessor->execute($address, $remarkObject);
|
$this->createRemarkProcessor->execute($address, $remarkObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($request->input('pickup_time_to') <= $request->input('pickup_time_from')) {
|
||||||
|
$pickupTimeFrom = Carbon::parse($request->input('pickup_time_from'));
|
||||||
|
$request->merge([
|
||||||
|
'pickup_time_to' => $pickupTimeFrom->addHour()->format('H:i') // Format to hh:mm
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$addressExtraFields = [
|
||||||
|
'property_type' => $request->input('property_type'),
|
||||||
|
'additional_request' => $request->input('additional_request'),
|
||||||
|
'receive_goods_working_hours' => $request->input('receive_goods_working_hours'),
|
||||||
|
'receive_goods_after_hours' => $request->input('receive_goods_after_hours'),
|
||||||
|
'receive_goods_on_saturday' => $request->input('receive_goods_on_saturday'),
|
||||||
|
];
|
||||||
|
|
||||||
|
$address->addressExtraFields()->delete();
|
||||||
|
$addressExtraFieldsObject = new RemarkObject(json_encode($addressExtraFields), Auth()->user()->id, RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
||||||
|
$this->createRemarkProcessor->execute($address, $addressExtraFieldsObject);
|
||||||
|
|
||||||
return $this->resourceResponse(new AddressResource($address));
|
return $this->resourceResponse(new AddressResource($address));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -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,
|
||||||
|
|||||||
+2
-1
@@ -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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -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;
|
||||||
|
|||||||
@@ -13,10 +13,14 @@ class RemarkObject implements DataTransferObject
|
|||||||
/** @var string*/
|
/** @var string*/
|
||||||
private $content;
|
private $content;
|
||||||
|
|
||||||
public function __construct(string $content, int $commenterID)
|
/** @var int|null */
|
||||||
|
private $type;
|
||||||
|
|
||||||
|
public function __construct(string $content, int $commenterID, int $type = null)
|
||||||
{
|
{
|
||||||
$this->commenterID = $commenterID;
|
$this->commenterID = $commenterID;
|
||||||
$this->content = $content;
|
$this->content = $content;
|
||||||
|
$this->type = $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,4 +39,12 @@ class RemarkObject implements DataTransferObject
|
|||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int|null
|
||||||
|
*/
|
||||||
|
public function getType(): ?int
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class CreatesRemark extends AbstractUpdateRelationshipRecord
|
|||||||
|
|
||||||
$model->commenter_id = $object->getCommenterId();
|
$model->commenter_id = $object->getCommenterId();
|
||||||
$model->content = $object->getContent();
|
$model->content = $object->getContent();
|
||||||
|
$model->type = $object->getType();
|
||||||
|
|
||||||
return $this->handler($remarkable->remarks(), $model);
|
return $this->handler($remarkable->remarks(), $model);
|
||||||
|
|
||||||
|
|||||||
+188
@@ -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.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,4 +10,6 @@ final class RemarkTypes
|
|||||||
|
|
||||||
public const EXTERNAL = 1;
|
public const EXTERNAL = 1;
|
||||||
|
|
||||||
}
|
public const ADDRESS_EXTRA_COLUMNS = 2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -55,11 +55,12 @@ 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
|
||||||
$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', [16803])->first();
|
||||||
|
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 16803 cron started.');
|
||||||
|
|
||||||
if($transaction && $transaction->id == 15205){
|
if($transaction && $transaction->id == 16803){
|
||||||
|
|
||||||
$status = ApprovalStatus::APPROVED;
|
$status = ApprovalStatus::APPROVED;
|
||||||
$this->callbackBillplzProcessor->execute($transaction, $status);
|
$this->callbackBillplzProcessor->execute($transaction, $status);
|
||||||
@@ -68,6 +69,6 @@ class OneTimeTransactionFixBillplzFailedCallback extends Command
|
|||||||
|
|
||||||
$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 16803 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'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -27,7 +27,11 @@ class AddressResource extends JsonResource
|
|||||||
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
||||||
in_array((String)$this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : null;
|
in_array((String)$this->postcode, $outstationPostcodeConstant) ? $postcodeArea = 'OUTSTATION_POSTCODE' : null;
|
||||||
|
|
||||||
return [
|
// Handle extra fields
|
||||||
|
$extrafields = $this->addressExtraFields->first();
|
||||||
|
$extrafields = $extrafields ? json_decode($extrafields->content, true) : [];
|
||||||
|
|
||||||
|
$returnArray = [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'reference' => $this->reference,
|
'reference' => $this->reference,
|
||||||
'street_one' => $this->street_one,
|
'street_one' => $this->street_one,
|
||||||
@@ -52,5 +56,12 @@ class AddressResource extends JsonResource
|
|||||||
])
|
])
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Merge extra fields into the return array
|
||||||
|
if ($extrafields) {
|
||||||
|
$returnArray = array_merge($returnArray, $extrafields);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $returnArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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\OrderRoleTypes;
|
use App\Classes\ValueObjects\Constants\OrderRoleTypes;
|
||||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||||
|
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||||
use App\Classes\ValueObjects\Constants\TransportType;
|
use App\Classes\ValueObjects\Constants\TransportType;
|
||||||
use App\Models\Transaction;
|
use App\Models\Transaction;
|
||||||
@@ -53,7 +54,7 @@ class OrderResource extends JsonResource
|
|||||||
'invoices' => $this->whenLoaded('packingLists', function() use ($orderId) {
|
'invoices' => $this->whenLoaded('packingLists', function() use ($orderId) {
|
||||||
return TransactionResource::collection($this->transactions()->whereNotIn('transactions.status', [0, 1])->where('transactions.type', TransactionType::SHIPPING_INVOICE)->get());
|
return TransactionResource::collection($this->transactions()->whereNotIn('transactions.status', [0, 1])->where('transactions.type', TransactionType::SHIPPING_INVOICE)->get());
|
||||||
}),
|
}),
|
||||||
'remarks' => RemarkResource::collection($this->remarks),
|
'remark' => new RemarkResource($this->remarks->first()),
|
||||||
'created_at' => $this->created_at->format('d-m-Y')
|
'created_at' => $this->created_at->format('d-m-Y')
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -28,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) {
|
||||||
@@ -44,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 {
|
||||||
@@ -61,7 +64,7 @@ class TransactionWithStorageResource extends JsonResource
|
|||||||
}
|
}
|
||||||
|
|
||||||
$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;
|
$groupTotalAmount = (double) $this->amount;
|
||||||
@@ -81,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,
|
||||||
@@ -117,12 +135,7 @@ 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,
|
'packing_list_reference' => $packingListReference,
|
||||||
'storages' => $this->storages ? $this->storages : null, //from middleware
|
'storages' => $this->storages ? $this->storages : null, //from middleware
|
||||||
@@ -132,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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -4,6 +4,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use App\Classes\General\Interfaces\Contactable;
|
use App\Classes\General\Interfaces\Contactable;
|
||||||
use App\Classes\General\Interfaces\Remarkable;
|
use App\Classes\General\Interfaces\Remarkable;
|
||||||
|
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
@@ -87,6 +88,14 @@ class Address extends AbstractModel implements Contactable, Remarkable
|
|||||||
*/
|
*/
|
||||||
public function remarks(): morphMany
|
public function remarks(): morphMany
|
||||||
{
|
{
|
||||||
return $this->morphMany(Remark::class, 'owner');
|
return $this->morphMany(Remark::class, 'owner')->whereNull('type');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return MorphMany
|
||||||
|
*/
|
||||||
|
public function addressExtraFields(): MorphMany
|
||||||
|
{
|
||||||
|
return $this->morphMany(Remark::class, 'owner')->where('type', RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddTypeToRemarksTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('remarks', function (Blueprint $table) {
|
||||||
|
$table->string('type')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('remarks', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('type');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
"vue": "^2.6.10",
|
"vue": "^2.6.10",
|
||||||
"vue-avatar": "^2.1.8",
|
"vue-avatar": "^2.1.8",
|
||||||
"vue-debounce": "^2.6.0",
|
"vue-debounce": "^2.6.0",
|
||||||
|
"vue-multi-select": "^4.6.0",
|
||||||
"vue-template-compiler": "^2.6.10",
|
"vue-template-compiler": "^2.6.10",
|
||||||
"vue-the-mask": "^0.11.1",
|
"vue-the-mask": "^0.11.1",
|
||||||
"vuelidate": "^0.7.4",
|
"vuelidate": "^0.7.4",
|
||||||
|
|||||||
@@ -3,14 +3,6 @@
|
|||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row" v-if="![7,8].includes($store.getters.getCompanyModuleType)">
|
<div class="row" v-if="![7,8].includes($store.getters.getCompanyModuleType)">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row m-b-15">
|
|
||||||
<div class="col">
|
|
||||||
<validation-wrapper-component :validator="$v.parameters.reference">
|
|
||||||
<label>Address Reference/Label</label>
|
|
||||||
<input class="form-control" name="reference" v-model="parameters.reference">
|
|
||||||
</validation-wrapper-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row m-b-15">
|
<div class="row m-b-15">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<validation-wrapper-component :validator="$v.parameters.street_one">
|
<validation-wrapper-component :validator="$v.parameters.street_one">
|
||||||
@@ -41,6 +33,14 @@
|
|||||||
</validation-wrapper-component>
|
</validation-wrapper-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row m-b-15">
|
||||||
|
<div class="col">
|
||||||
|
<validation-wrapper-component :validator="$v.parameters.reference">
|
||||||
|
<label>Address Name / Label</label>
|
||||||
|
<input class="form-control" name="reference" v-model="parameters.reference" placeholder="E.g. Home Address">
|
||||||
|
</validation-wrapper-component>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -59,14 +59,6 @@
|
|||||||
</validation-wrapper-component>
|
</validation-wrapper-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row m-b-15">
|
|
||||||
<div class="col">
|
|
||||||
<validation-wrapper-component :validator="$v.parameters.remark">
|
|
||||||
<label>Delivery Remark</label>
|
|
||||||
<input class="form-control" name="remark" v-model="parameters.remark">
|
|
||||||
</validation-wrapper-component>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -125,16 +117,70 @@
|
|||||||
</validation-wrapper-component>
|
</validation-wrapper-component>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row m-b-15">
|
</div>
|
||||||
<div class="col">
|
</div>
|
||||||
<validation-wrapper-component :validator="$v.parameters.remark">
|
<div class="row m-b-15">
|
||||||
<label>Remark</label>
|
<div class="col">
|
||||||
<input class="form-control" name="remark" v-model="parameters.remark">
|
<validation-wrapper-component :validator="$v.parameters.remark">
|
||||||
</validation-wrapper-component>
|
<label>Delivery Remark</label>
|
||||||
|
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||||
|
</validation-wrapper-component>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row m-b-15">
|
||||||
|
<div class="col">
|
||||||
|
<validation-wrapper-component selectable :validator="$v.parameters.property_type">
|
||||||
|
<label>房型 Receiver's property type</label>
|
||||||
|
<select-component :options="['住家Landed house', '公寓Condominium (Drop on lobby only)', '工厂Factory', '店面Shop', '商场Shopping Mall (Drop on loading bay only)', 'Others']" v-model="parameters.property_type"></select-component>
|
||||||
|
</validation-wrapper-component>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row m-b-15">
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-group no-margin form-group-default p-b-5">
|
||||||
|
<label>Available to receive goods on: </label>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md pb-3 pb-md-0">
|
||||||
|
<div class="row justify-content-center m-t-10 m-b-10" @click="parameters.receive_goods_working_hours = !parameters.receive_goods_working_hours">
|
||||||
|
<div class="col pointer d-flex justtify-content-center align-items-center">
|
||||||
|
<i class="fa fs-20 fa-fw m-r-5" :class="{'fa-square-o': !parameters.receive_goods_working_hours, 'fa-check-square': parameters.receive_goods_working_hours, 'text-primary':parameters.receive_goods_working_hours}" ></i>
|
||||||
|
<p class="m-b-0">Working Hours (9am-6pm)</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md pb-3 pb-md-0">
|
||||||
|
<div class="row justify-content-center m-t-10 m-b-10" @click="parameters.receive_goods_after_hours = !parameters.receive_goods_after_hours">
|
||||||
|
<div class="col pointer d-flex justtify-content-center align-items-center">
|
||||||
|
<i class="fa fs-20 fa-fw m-r-5" :class="{'fa-square-o': !parameters.receive_goods_after_hours, 'fa-check-square': parameters.receive_goods_after_hours, 'text-primary':parameters.receive_goods_after_hours}" ></i>
|
||||||
|
<p class="m-b-0">After Working Hours</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md pb-3 pb-md-0">
|
||||||
|
<div class="row justify-content-center m-t-10 m-b-10" @click="parameters.receive_goods_on_saturday = !parameters.receive_goods_on_saturday">
|
||||||
|
<div class="col pointer d-flex justtify-content-center align-items-center">
|
||||||
|
<i class="fa fs-20 fa-fw m-r-5" :class="{'fa-square-o': !parameters.receive_goods_on_saturday, 'fa-check-square': parameters.receive_goods_on_saturday, 'text-primary':parameters.receive_goods_on_saturday}" ></i>
|
||||||
|
<p class="m-b-0">On Saturday</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row m-b-15">
|
||||||
|
<div class="col">
|
||||||
|
<validation-wrapper-component :validator="$v.parameters.additional_request">
|
||||||
|
<label>Additional Request</label>
|
||||||
|
<input class="form-control" name="additional_request" v-model="parameters.additional_request">
|
||||||
|
</validation-wrapper-component>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row justify-content-center allign-items-center">
|
||||||
|
<div class="col-12 col-sm-7">
|
||||||
|
<h6 class="text-center fs-12 text-danger">**kindly reply within 2 hours while warehouse contact to arrange for delivery, otherwise, reschedule of delivery date will apply</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -154,7 +200,7 @@
|
|||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
// required: true
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -174,6 +220,11 @@
|
|||||||
remark: '',
|
remark: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
person_in_charge: '',
|
person_in_charge: '',
|
||||||
|
property_type: '',
|
||||||
|
additional_request: '',
|
||||||
|
receive_goods_working_hours: false,
|
||||||
|
receive_goods_after_hours: false,
|
||||||
|
receive_goods_on_saturday: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -189,6 +240,11 @@
|
|||||||
this.parameters.phone = this.data.contact ? this.data.contact.phone : '';
|
this.parameters.phone = this.data.contact ? this.data.contact.phone : '';
|
||||||
this.parameters.person_in_charge = this.data.contact ? this.data.contact.reference : '';
|
this.parameters.person_in_charge = this.data.contact ? this.data.contact.reference : '';
|
||||||
this.parameters.remark = this.data.remark ? this.data.remark.content : '';
|
this.parameters.remark = this.data.remark ? this.data.remark.content : '';
|
||||||
|
this.parameters.property_type = this.data.property_type ? this.data.property_type : '';
|
||||||
|
this.parameters.additional_request = this.data.additional_request ? this.data.additional_request : '';
|
||||||
|
this.parameters.receive_goods_working_hours = this.data.receive_goods_working_hours ? this.data.receive_goods_working_hours : false;
|
||||||
|
this.parameters.receive_goods_after_hours = this.data.receive_goods_after_hours ? this.data.receive_goods_after_hours : false;
|
||||||
|
this.parameters.receive_goods_on_saturday = this.data.receive_goods_on_saturday ? this.data.receive_goods_on_saturday : false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
+3
-2
@@ -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,67 @@
|
|||||||
|
<template>
|
||||||
|
<div class="w-100 multi-select-container">
|
||||||
|
<vue-multi-select ref="multiSelect" v-model="localValue" search :options="settings" :btnLabel="btnLabel" :selectOptions="options" class="w-100" style="height: 25px;" @close="close">
|
||||||
|
<template v-slot:option="{ option }">
|
||||||
|
<div class="d-flex justify-content-start align-items-center">
|
||||||
|
<input class="m-l-5 m-r-5" type="checkbox" :checked="option.selected" />
|
||||||
|
<span>{{ option.name }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</vue-multi-select>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import vueMultiSelect from 'vue-multi-select';
|
||||||
|
import 'vue-multi-select/dist/lib/vue-multi-select.css';
|
||||||
|
import PerfectScrollbar from 'perfect-scrollbar';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
required: false,
|
||||||
|
default: () => []
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
type: Array,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
localValue: this.value,
|
||||||
|
settings: {
|
||||||
|
multi: true,
|
||||||
|
groups: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
btnLabel(localValue) {
|
||||||
|
if (localValue.length === 0) {
|
||||||
|
return 'Please select';
|
||||||
|
}
|
||||||
|
return localValue.join(', ');
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$emit('input', this.localValue);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
vueMultiSelect,
|
||||||
|
PerfectScrollbar,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.multi-select-container .select>button {
|
||||||
|
width: 100%;
|
||||||
|
min-height: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.multi-select-container .select .selectItem {
|
||||||
|
color: black !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -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" section="section"></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>
|
||||||
@@ -81,7 +81,8 @@
|
|||||||
mixins: [componentHandler],
|
mixins: [componentHandler],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isLoading: false
|
isLoading: false,
|
||||||
|
section: 'unclaimedPackingListSection',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+41
-3
@@ -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]
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -10,15 +10,18 @@ export default {
|
|||||||
},
|
},
|
||||||
street_one: { required },
|
street_one: { required },
|
||||||
street_two: {
|
street_two: {
|
||||||
required: requiredIf(function(){
|
required
|
||||||
return [7,8].includes(this.$store.getters.getCompanyModuleType);
|
// required: requiredIf(function(){
|
||||||
})
|
// return [7,8].includes(this.$store.getters.getCompanyModuleType);
|
||||||
|
// })
|
||||||
},
|
},
|
||||||
district_id: { required },
|
district_id: { required },
|
||||||
post_code: { required },
|
post_code: { required },
|
||||||
remark: {},
|
remark: {},
|
||||||
phone: {required, numeric},
|
phone: {required, numeric},
|
||||||
person_in_charge: { required },
|
person_in_charge: { required },
|
||||||
|
property_type: { required },
|
||||||
|
additional_request: { },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mixins: [addressFormHandler]
|
mixins: [addressFormHandler]
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
@@ -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');
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -1271,6 +1272,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 +1303,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,8 +1314,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) {
|
Route::get('/segments', function (Request $request) {
|
||||||
return view('pages.segments.index');
|
return view('pages.segments.index');
|
||||||
})->name('segments');
|
})->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>';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user