mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-30 09:54:04 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6094bf03ca | |||
| c58886eeff | |||
| 4a9ac3de02 | |||
| 1e6fafef28 | |||
| 9d0924c674 |
@@ -13,7 +13,6 @@ 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
|
||||||
{
|
{
|
||||||
@@ -30,17 +29,12 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,6 +15,7 @@ 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;
|
||||||
@@ -102,6 +103,16 @@ class UpdateAddressLogic 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));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
|||||||
return [
|
return [
|
||||||
'DocNo',
|
'DocNo',
|
||||||
'DocDate',
|
'DocDate',
|
||||||
'PaymentDate',
|
|
||||||
'DebtorCode',
|
'DebtorCode',
|
||||||
'Ref',
|
'Ref',
|
||||||
'ShipInfo',
|
'ShipInfo',
|
||||||
@@ -60,12 +59,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($start_date)->startOfDay();
|
$start_date = Carbon::parse($this->request->input('startDate'))->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
|
||||||
$end_date = $this->request->input('endDate', null);
|
$end_date = $this->request->input('endDate', null);
|
||||||
if ($end_date) {
|
if ($end_date) {
|
||||||
$end_date = Carbon::parse($end_date)->endOfDay();
|
$end_date = Carbon::parse($this->request->input('endDate'))->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = Transaction::query();
|
$query = Transaction::query();
|
||||||
@@ -78,31 +77,30 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
|||||||
$approvalStatus = ApprovalStatus::APPROVED;
|
$approvalStatus = ApprovalStatus::APPROVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjusted the query to include both types and status
|
// $query->where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [$approvalStatus]);
|
||||||
$query->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])
|
$query->whereIn('type', [TransactionType::SHIPPING_INVOICE, TransactionType::STORAGE_INVOICE])->whereIn('status', [$approvalStatus]);
|
||||||
->where('status', $approvalStatus);
|
|
||||||
|
|
||||||
if ($start_date && $end_date) {
|
if($start_date && $end_date) {
|
||||||
$query->whereHas('transactions', function($transaction) use ($start_date, $end_date) {
|
$query->whereBetween('updated_at', [
|
||||||
$transaction->where('type', TransactionType::PAYMENT)
|
Carbon::parse($start_date)->format('Y-m-d 0:00:00'),
|
||||||
->whereBetween('updated_at', [$start_date, $end_date]);
|
Carbon::parse($end_date)->format('Y-m-d 23:59:59')
|
||||||
});
|
]);
|
||||||
} elseif ($start_date) {
|
}
|
||||||
|
elseif($start_date && !$end_date) {
|
||||||
$query->whereHas('transactions', function($transaction) use ($start_date) {
|
$query->whereHas('transactions', function($transaction) use ($start_date) {
|
||||||
$transaction->where('type', TransactionType::PAYMENT)
|
$transaction->where('type', TransactionType::PAYMENT)->where('updated_at', '>=', Carbon::parse($start_date)->format('Y-m-d 0:00:00'));
|
||||||
->where('updated_at', '>=', $start_date);
|
|
||||||
});
|
});
|
||||||
} elseif ($end_date) {
|
|
||||||
|
}
|
||||||
|
elseif(!$start_date && $end_date) {
|
||||||
$query->whereHas('transactions', function($transaction) use ($end_date) {
|
$query->whereHas('transactions', function($transaction) use ($end_date) {
|
||||||
$transaction->where('type', TransactionType::PAYMENT)
|
$transaction->where('type', TransactionType::PAYMENT)->where('updated_at', '>=', Carbon::parse($end_date)->format('Y-m-d 0:00:00'));
|
||||||
->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();
|
||||||
@@ -144,7 +142,6 @@ 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,
|
||||||
@@ -169,7 +166,7 @@ class ExportsPaymentTransactions implements FromQuery, WithHeadings, WithHeading
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'<<New>>',
|
'<<New>>',
|
||||||
$transaction->transactions()->where('type', TransactionType::PAYMENT)->first()->updated_at->format('m/d/Y H:m'),
|
$transaction->created_at->format('m/d/Y H:m'),
|
||||||
$company->debtor,
|
$company->debtor,
|
||||||
$order->reference,
|
$order->reference,
|
||||||
$order->reference,
|
$order->reference,
|
||||||
|
|||||||
+1
-2
@@ -76,7 +76,6 @@ 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) {
|
||||||
@@ -120,7 +119,7 @@ class FetchDeliveryUpdatesFromYdPortalProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Log::info('FetchDeliveryUpdatesFromYdPortalProcessor ends');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-7
@@ -138,13 +138,7 @@ 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 = $row->customerno;
|
$customerno = preg_split('(-|\(|\)|\/)', $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);
|
||||||
|
|
||||||
|
|||||||
@@ -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.01){
|
if((float) number_format(($wallet->amount - $amount),2) < 0){
|
||||||
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,94 +0,0 @@
|
|||||||
<?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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -27,6 +27,9 @@ 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;
|
||||||
|
|
||||||
|
$extrafields = json_decode($this->addressExtraFields->first());
|
||||||
|
$extrafields = $extrafields ? (isset($extrafields->content) ? json_decode($extrafields->content) : null) : null;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'reference' => $this->reference,
|
'reference' => $this->reference,
|
||||||
@@ -43,6 +46,11 @@ class AddressResource extends JsonResource
|
|||||||
'contact' => new ContactResource($this->contacts->first()),
|
'contact' => new ContactResource($this->contacts->first()),
|
||||||
'remark' => new RemarkResource($this->remarks->first()),
|
'remark' => new RemarkResource($this->remarks->first()),
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
|
'extrafields' => $extrafields,
|
||||||
|
'property_type' => $extrafields ? $extrafields->property_type : null,
|
||||||
|
'tools_required_unload' => $extrafields ? $extrafields->tools_required_unload : null,
|
||||||
|
'pickup_time_from' => $extrafields ? $extrafields->pickup_time_from : null,
|
||||||
|
'pickup_time_to' => $extrafields ? $extrafields->pickup_time_to : null,
|
||||||
$this->mergeWhen($this->relationLoaded('owner'), [
|
$this->mergeWhen($this->relationLoaded('owner'), [
|
||||||
'owner' => $this->when($this->owner instanceof Order, [
|
'owner' => $this->when($this->owner instanceof Order, [
|
||||||
'reference' => $this->owner->reference,
|
'reference' => $this->owner->reference,
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class TransactionWithStorageResource extends JsonResource
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function getReferenceForGroupPayment($groups){
|
private function getReferenceForGroupPayment($groups){
|
||||||
if (is_array($groups) && count($groups) > 0) {
|
if(count($groups)){
|
||||||
$firstGroup = $groups[0];
|
$firstGroup = $groups[0];
|
||||||
return $firstGroup['reference'];
|
return $firstGroup['reference'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -89,4 +90,12 @@ class Address extends AbstractModel implements Contactable, Remarkable
|
|||||||
{
|
{
|
||||||
return $this->morphMany(Remark::class, 'owner');
|
return $this->morphMany(Remark::class, 'owner');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return MorphMany
|
||||||
|
*/
|
||||||
|
public function addressExtraFields(): MorphMany
|
||||||
|
{
|
||||||
|
return $this->morphMany(Remark::class, 'owner')->where('type', RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,12 +84,4 @@ 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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<label class="text-primary">卸货工具 Tools required to unload goods</label>
|
||||||
|
<vue-multi-select
|
||||||
|
ref="multiSelect"
|
||||||
|
:options="options"
|
||||||
|
:btnLabel="btnLabel"
|
||||||
|
@open="open"
|
||||||
|
@close="close"
|
||||||
|
:selectOptions="data">
|
||||||
|
<template v-slot:option="{ option }">
|
||||||
|
<input type="checkbox" :checked="option.selected"/>
|
||||||
|
<span>{{ option.name }}</span>
|
||||||
|
</template>
|
||||||
|
</vue-multi-select>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import vueMultiSelect from 'vue-multi-select';
|
||||||
|
import 'vue-multi-select/dist/lib/vue-multi-select.css';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
values: [],
|
||||||
|
data: [{
|
||||||
|
list: [
|
||||||
|
{ name: 'Manpower' },
|
||||||
|
{ name: 'Forklift' },
|
||||||
|
{ name: 'None of the above' }
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
options: {
|
||||||
|
multi: true,
|
||||||
|
groups: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open() {
|
||||||
|
console.log('open');
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
console.log('close');
|
||||||
|
},
|
||||||
|
btnLabel(values) {
|
||||||
|
if (values.length === 0) {
|
||||||
|
return 'Select Tools required';
|
||||||
|
}
|
||||||
|
return values.map(v => v.name).join(', ');
|
||||||
|
},
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
vueMultiSelect,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -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,14 +117,48 @@
|
|||||||
</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>
|
||||||
</div>
|
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||||
</div>
|
</validation-wrapper-component>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row m-b-15">
|
||||||
|
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||||
|
<validation-wrapper-component :validator="$v.parameters.pickup_time_from">
|
||||||
|
<label>收货时间从 Available Hours From</label>
|
||||||
|
<input type="time" class="form-control" name="pickup_time" v-model="parameters.pickup_time_from">
|
||||||
|
</validation-wrapper-component>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md pl-md-1">
|
||||||
|
<validation-wrapper-component :validator="$v.parameters.pickup_time_to">
|
||||||
|
<label>最晚收货时间 Available Hours To</label>
|
||||||
|
<input type="time" class="form-control" name="latest_pickup_time" v-model="parameters.pickup_time_to">
|
||||||
|
</validation-wrapper-component>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row m-b-15">
|
||||||
|
<div class="col-12 col-md pr-md-1 pb-3 pb-md-0">
|
||||||
|
<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 class="col-12 col-md pl-md-1 pb-3 pb-md-0">
|
||||||
|
<!-- <validation-wrapper-component selectable :validator="$v.parameters.tools_required_unload">
|
||||||
|
<label>卸货工具 Tools require to unload goods</label>
|
||||||
|
<select-component :options="['Manpower', 'Forklift', 'None of above']" v-model="parameters.tools_required_unload"></select-component>
|
||||||
|
</validation-wrapper-component> -->
|
||||||
|
<address-extra-details-component v-model="parameters.tools_required_unload"></address-extra-details-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>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -154,7 +180,7 @@
|
|||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
// required: true
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@@ -174,6 +200,10 @@
|
|||||||
remark: '',
|
remark: '',
|
||||||
phone: '',
|
phone: '',
|
||||||
person_in_charge: '',
|
person_in_charge: '',
|
||||||
|
property_type: '',
|
||||||
|
tools_required_unload: '',
|
||||||
|
pickup_time_from: '',
|
||||||
|
pickup_time_to: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -189,12 +219,16 @@
|
|||||||
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.tools_required_unload = this.data.tools_required_unload ? this.data.tools_required_unload : '';
|
||||||
|
this.parameters.pickup_time_from = this.data.pickup_time_from ? this.data.pickup_time_from : '';
|
||||||
|
this.parameters.pickup_time_to = this.data.pickup_time_to ? this.data.pickup_time_to : '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'id': function () {
|
'id': function () {
|
||||||
this.parameters.company_module_id = this.id;
|
this.parameters.company_module_id = this.id;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
submitForm(){
|
submitForm(){
|
||||||
|
|||||||
@@ -92,22 +92,6 @@
|
|||||||
</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">
|
||||||
@@ -214,17 +198,6 @@
|
|||||||
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]
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-3
@@ -10,15 +10,20 @@ 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 },
|
||||||
|
tools_required_unload: { required },
|
||||||
|
pickup_time_from: { required },
|
||||||
|
pickup_time_to: { required },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mixins: [addressFormHandler]
|
mixins: [addressFormHandler]
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ 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;
|
||||||
@@ -1272,8 +1271,6 @@ 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)
|
||||||
@@ -1303,7 +1300,6 @@ 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>';
|
||||||
@@ -1314,35 +1310,8 @@ 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