mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 12:34:18 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6094bf03ca | |||
| c58886eeff | |||
| 4a9ac3de02 | |||
| 1e6fafef28 | |||
| fd75da5778 | |||
| b593605c72 | |||
| 8d75012390 | |||
| 2d98757c1c | |||
| b329f232f2 | |||
| 713922d2ee | |||
| 74d11f8305 | |||
| ea920717a1 | |||
| e1b49f6be0 | |||
| 1be405ca93 | |||
| 9d0924c674 | |||
| e63e3e707f | |||
| aeaec32dcb | |||
| b000c25e66 | |||
| 1e9af59b91 | |||
| a392b8a5eb | |||
| 30edc3eaba | |||
| b0eca18343 |
@@ -15,6 +15,7 @@ use App\Classes\Modules\Contacts\Processors\CreateContactProcessor;
|
||||
use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use ErrorException;
|
||||
@@ -100,6 +101,16 @@ class CreateAddressLogic extends AbstractControllerLogic
|
||||
$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));
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ use App\Classes\Modules\Remarks\DataTransferObjects\RemarkObject;
|
||||
use App\Classes\Modules\Remarks\Processors\CreateRemarkProcessor;
|
||||
use App\Classes\ValueObjects\Constants\AddressType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||
use App\Http\Resources\AddressResource;
|
||||
use App\Models\Address;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -102,6 +103,16 @@ class UpdateAddressLogic extends AbstractControllerLogic
|
||||
$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));
|
||||
|
||||
}
|
||||
|
||||
+11
-17
@@ -56,27 +56,21 @@ class RescheduleContainerLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
$transport = $container->transports()->first();
|
||||
$container = $this->fetchesContainer->execute(['id' => $request->route('id')]);
|
||||
$transport = $container->transports()->first();
|
||||
|
||||
$old_sechedule = $transport->schedules()->first();
|
||||
$old_schedule = $transport->schedules()->delete();
|
||||
|
||||
$this->updatesScheduleStatus->execute($old_sechedule, ApprovalStatus::REJECTED);
|
||||
// $this->updatesScheduleStatus->execute($old_schedule, ApprovalStatus::REJECTED);
|
||||
|
||||
$scheduleObject = new ScheduleObject(
|
||||
Carbon::parse($request->input('etd')),
|
||||
Carbon::parse($request->input('eta')),
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
$schedule = $this->createsSchedule->execute($transport, $scheduleObject);
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
$scheduleObject = new ScheduleObject(
|
||||
Carbon::parse($request->input('etd')),
|
||||
Carbon::parse($request->input('eta')),
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
$schedule = $this->createsSchedule->execute($transport, $scheduleObject);
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,10 +13,14 @@ class RemarkObject implements DataTransferObject
|
||||
/** @var string*/
|
||||
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->content = $content;
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,4 +39,12 @@ class RemarkObject implements DataTransferObject
|
||||
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->content = $object->getContent();
|
||||
$model->type = $object->getType();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,6 @@ final class RemarkTypes
|
||||
|
||||
public const EXTERNAL = 1;
|
||||
|
||||
}
|
||||
public const ADDRESS_EXTRA_COLUMNS = 2;
|
||||
|
||||
}
|
||||
|
||||
@@ -55,11 +55,12 @@ class OneTimeTransactionFixBillplzFailedCallback extends Command
|
||||
$this->outputArray = [];
|
||||
$start = new Carbon();
|
||||
|
||||
//This transaction, 15205 has approve payment but not its owner, shipping invoice
|
||||
$transaction = Transaction::whereIn('id', [15205])->first();
|
||||
$this->info(Carbon::now() . ' : One time fix failled callback from billplz for transaction with id 15205 cron started.');
|
||||
//Transaction fix with this one time fix command: 15205, 16803
|
||||
//This transaction, 16803 has approve payment but not its owner, shipping invoice
|
||||
$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;
|
||||
$this->callbackBillplzProcessor->execute($transaction, $status);
|
||||
@@ -68,6 +69,6 @@ class OneTimeTransactionFixBillplzFailedCallback extends Command
|
||||
|
||||
$end = new Carbon();
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ class AddressResource extends JsonResource
|
||||
$outstationPostcodeConstant = $outstationPostcodeConstantObject->isEmpty() ? [] : (array)$outstationPostcodeConstantObject->first()->value;
|
||||
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 [
|
||||
'id' => $this->id,
|
||||
'reference' => $this->reference,
|
||||
@@ -43,6 +46,11 @@ class AddressResource extends JsonResource
|
||||
'contact' => new ContactResource($this->contacts->first()),
|
||||
'remark' => new RemarkResource($this->remarks->first()),
|
||||
'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'), [
|
||||
'owner' => $this->when($this->owner instanceof Order, [
|
||||
'reference' => $this->owner->reference,
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Resources;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Group;
|
||||
use App\Models\PackingList;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\Wallet;
|
||||
use Carbon\Carbon;
|
||||
@@ -27,7 +28,9 @@ class TransactionWithStorageResource extends JsonResource
|
||||
$groupPaymentAttemptsFiltered = [];
|
||||
$group_payment_expired = null;
|
||||
$group_payment_history = null;
|
||||
$group_payment_history_query = null;
|
||||
$groupTotalAmount = 0;
|
||||
$payment_history = null;
|
||||
|
||||
if ($this->owner instanceof Transaction) {
|
||||
if ($this->owner) {
|
||||
@@ -43,7 +46,8 @@ class TransactionWithStorageResource extends JsonResource
|
||||
if($this->groups){
|
||||
$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_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 {
|
||||
@@ -54,9 +58,13 @@ class TransactionWithStorageResource extends JsonResource
|
||||
|
||||
}
|
||||
|
||||
$packingListReference = null;
|
||||
if ($this->owner instanceof PackingList) {
|
||||
$packingListReference = $this->owner->reference;
|
||||
}
|
||||
|
||||
$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();
|
||||
if($paymentTransaction){
|
||||
$groupTotalAmount = (double) $this->amount;
|
||||
@@ -76,6 +84,21 @@ class TransactionWithStorageResource extends JsonResource
|
||||
}
|
||||
|
||||
|
||||
$payment_history = TransactionResource::collection($this->transactions()
|
||||
->payments()
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED])
|
||||
->get());
|
||||
|
||||
//For 'Your Payment Proof' at frontend
|
||||
|
||||
if($group_payment_history_query && count($group_payment_history_query) > 0){
|
||||
if($this->getReferenceForGroupPayment($group_payment_history_query)){
|
||||
foreach ($payment_history as $item) {
|
||||
$item['payment_reference'] = $this->getReferenceForGroupPayment($group_payment_history_query);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'owner_type' => $this->owner_type,
|
||||
@@ -112,13 +135,9 @@ class TransactionWithStorageResource extends JsonResource
|
||||
->payments()->where('status', ApprovalStatus::EXPIRED)
|
||||
->get()
|
||||
),
|
||||
'payment_history' => TransactionResource::collection(
|
||||
$this->transactions()
|
||||
->payments()
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::COMPLETED, ApprovalStatus::REJECTED])
|
||||
->get()
|
||||
),
|
||||
'payment_history' => $payment_history,
|
||||
'remarks' => RemarkResource::collection($this->remarks),
|
||||
'packing_list_reference' => $packingListReference,
|
||||
'storages' => $this->storages ? $this->storages : null, //from middleware
|
||||
'is_waived' => (int) $this->is_waived,
|
||||
'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:i:s A'),
|
||||
@@ -126,4 +145,12 @@ class TransactionWithStorageResource extends JsonResource
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y')
|
||||
];
|
||||
}
|
||||
|
||||
private function getReferenceForGroupPayment($groups){
|
||||
if(count($groups)){
|
||||
$firstGroup = $groups[0];
|
||||
return $firstGroup['reference'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Contactable;
|
||||
use App\Classes\General\Interfaces\Remarkable;
|
||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
@@ -89,4 +90,12 @@ class Address extends AbstractModel implements Contactable, Remarkable
|
||||
{
|
||||
return $this->morphMany(Remark::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function addressExtraFields(): MorphMany
|
||||
{
|
||||
return $this->morphMany(Remark::class, 'owner')->where('type', RemarkTypes::ADDRESS_EXTRA_COLUMNS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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="row" v-if="![7,8].includes($store.getters.getCompanyModuleType)">
|
||||
<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="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.street_one">
|
||||
@@ -41,6 +33,14 @@
|
||||
</validation-wrapper-component>
|
||||
</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="col">
|
||||
<div class="row">
|
||||
@@ -59,14 +59,6 @@
|
||||
</validation-wrapper-component>
|
||||
</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>
|
||||
@@ -125,14 +117,48 @@
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.remark">
|
||||
<label>Remark</label>
|
||||
<input class="form-control" name="remark" v-model="parameters.remark">
|
||||
</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 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 class="row">
|
||||
@@ -154,7 +180,7 @@
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
required: true
|
||||
// required: true
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
@@ -174,6 +200,10 @@
|
||||
remark: '',
|
||||
phone: '',
|
||||
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.person_in_charge = this.data.contact ? this.data.contact.reference : '';
|
||||
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: {
|
||||
'id': function () {
|
||||
this.parameters.company_module_id = this.id;
|
||||
}
|
||||
},
|
||||
},
|
||||
methods:{
|
||||
submitForm(){
|
||||
|
||||
+3
-2
@@ -116,9 +116,10 @@
|
||||
},
|
||||
sumAmount () {
|
||||
var new_object = this.selectedInvoice;
|
||||
return Object.keys(new_object).reduce(function(total, key) {
|
||||
return total + Math.round(new_object[key].amount * 100) / 100;
|
||||
var total = Object.keys(new_object).reduce(function(total, key) {
|
||||
return total + new_object[key].amount;
|
||||
}, 0).toFixed(2);
|
||||
return Math.round(total * 100) / 100;
|
||||
},
|
||||
selectedIds () {
|
||||
return this.selectedInvoice.map(s=>s.id);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<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>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deletePackingList">
|
||||
<delete-packinglist-form-component :data="data"></delete-packinglist-form-component>
|
||||
<delete-packinglist-form-component :data="data" :section="section"></delete-packinglist-form-component>
|
||||
</modal-component>
|
||||
<button type="button" class="btn b-rad-none btn-primary fs-11 requestModal" data-type="claimPackingList">Claim</button>
|
||||
</div>
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-danger btn-block b-rad-none" data-dismiss="modal" @click="submit(route('api.packing_list.delete', item.id), 'delete', 'unclaimedPackingListSection', true, true)">Confirm</div>
|
||||
<div class="btn btn-sm btn-danger btn-block b-rad-none" data-dismiss="modal" @click="submit(route('api.packing_list.delete', item.id), 'delete', section, true, true)">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,6 +78,12 @@
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
export default {
|
||||
mixins: [componentHandler]
|
||||
mixins: [componentHandler],
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
section: 'unclaimedPackingListSection',
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
+10
@@ -93,6 +93,16 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="$store.getters.isAdmin">
|
||||
<div class="col padding-20">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Packinglist Reference</p>
|
||||
<div>{{ item.packing_list_reference }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row b-t b-grey p-t-10 m-l-5 m-r-5" v-show="expanded" v-if="![5, 6].includes(item.status)">
|
||||
<div class="col-12 col-md-7 padding-20">
|
||||
<div class="row bg-master-lightest h-100">
|
||||
|
||||
+14
-3
@@ -157,6 +157,13 @@
|
||||
</div>
|
||||
</a>
|
||||
</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>
|
||||
@@ -181,9 +188,13 @@
|
||||
},
|
||||
methods: {
|
||||
clickExpand(){
|
||||
if(this.item
|
||||
&& ((this.item.payment_method !== 5 && this. item.documents.length)
|
||||
|| (this.item.payment_method === 5 && (this.item.status === 2 || this.item.status === 3)))){
|
||||
// if(this.item
|
||||
// && ((this.item.payment_method !== 5 && this. item.documents.length)
|
||||
// || (this.item.payment_method === 5 && (this.item.status === 2 || this.item.status === 3)))){
|
||||
// this.expandPaymentDetails = !this.expandPaymentDetails;
|
||||
// }
|
||||
|
||||
if(this.item){
|
||||
this.expandPaymentDetails = !this.expandPaymentDetails;
|
||||
}
|
||||
},
|
||||
|
||||
+8
-3
@@ -10,15 +10,20 @@ export default {
|
||||
},
|
||||
street_one: { required },
|
||||
street_two: {
|
||||
required: requiredIf(function(){
|
||||
return [7,8].includes(this.$store.getters.getCompanyModuleType);
|
||||
})
|
||||
required
|
||||
// required: requiredIf(function(){
|
||||
// return [7,8].includes(this.$store.getters.getCompanyModuleType);
|
||||
// })
|
||||
},
|
||||
district_id: { required },
|
||||
post_code: { required },
|
||||
remark: {},
|
||||
phone: {required, numeric},
|
||||
person_in_charge: { required },
|
||||
property_type: { required },
|
||||
tools_required_unload: { required },
|
||||
pickup_time_from: { required },
|
||||
pickup_time_to: { required },
|
||||
}
|
||||
},
|
||||
mixins: [addressFormHandler]
|
||||
|
||||
@@ -4,10 +4,16 @@
|
||||
@include('vendor/head')
|
||||
</head>
|
||||
<body class="horizontal-menu horizontal-app-menu bg-white overflow-hidden">
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-T3XCNMB"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SP04J05142"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-SP04J05142');
|
||||
</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
<div id="app" style="min-height: 100%;">
|
||||
@yield('content')
|
||||
</div>
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row" v-if="$store.getters.isAdmin">
|
||||
<div class="col">
|
||||
<admin-payments-billing-polling-section-component></admin-payments-billing-polling-section-component>
|
||||
</div>
|
||||
|
||||
-8
@@ -1,11 +1,3 @@
|
||||
<!-- Google Tag Manager -->
|
||||
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-T3XCNMB');</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
|
||||
<meta charset="utf-8"/>
|
||||
<title>@yield('title', 'IZYIM Shipping')</title>
|
||||
|
||||
Reference in New Issue
Block a user