mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 12:34:18 +00:00
Compare commits
56 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a3466a8b8 | |||
| 782a5c33ad | |||
| 6d3a2d9259 | |||
| 730b3d439a | |||
| 6b09d5facc | |||
| 4c532deb4d | |||
| 12f05b7aa6 | |||
| 5cdbc09c5b | |||
| c9877bb53e | |||
| 0bf84fa7b1 | |||
| 4c9235cc53 | |||
| babd492caa | |||
| 3d1d1cce11 | |||
| 820d96858f | |||
| 058ba592bf | |||
| d950ee3d68 | |||
| da6ec00dbd | |||
| 412dbd64d5 | |||
| 496df549f6 | |||
| 97eaefa45a | |||
| 68c9e0451a | |||
| 671c7a54fb | |||
| 2a28183426 | |||
| 0ebea79750 | |||
| a701242646 | |||
| 4bdeae997d | |||
| 36809f34cc | |||
| 032171bb18 | |||
| d41bd3db39 | |||
| 56bba0eaaf | |||
| 9fce0efaeb | |||
| af8444e0d9 | |||
| b2a7d1f73d | |||
| 9d2ff3fafa | |||
| 487d07e28c | |||
| 4176e09ea3 | |||
| c44bf46a42 | |||
| e687dd2b9a | |||
| 59951c4efd | |||
| c00a4712a0 | |||
| 1bb07e9402 | |||
| 683bdec1f7 | |||
| ee53a9438a | |||
| 2e2087f16e | |||
| 998b0b4da5 | |||
| dcf5c2e455 | |||
| 156b1dee07 | |||
| 544d7907c3 | |||
| 5b77f7baa6 | |||
| b33016aac4 | |||
| 2788e349ae | |||
| 04af87f640 | |||
| 5b190d5334 | |||
| 8f32769656 | |||
| 2d175f4acc | |||
| 782aed06e4 |
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class CreatedAfterOrEqual implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
$table = $builder->getModel()->getTable();
|
||||
$startDate = Carbon::createFromFormat('d-m-Y', $value)->startOfDay();
|
||||
return $builder->where("{$table}.created_at", '>=', $startDate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class CreatedBeforeOrEqual implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
$table = $builder->getModel()->getTable();
|
||||
$endDate = Carbon::createFromFormat('d-m-Y', $value)->endOfDay();
|
||||
return $builder->where("{$table}.created_at", '<=', $endDate);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,8 @@ class OwnerId implements Filter
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('owner_id', $value);
|
||||
$table = $builder->getModel()->getTable();
|
||||
return $builder->where("{$table}.owner_id", $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class OwnerType implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
$table = $builder->getModel()->getTable();
|
||||
return $builder->where("{$table}.owner_type", $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,8 @@ class StatusIn implements Filter
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->whereIn('status', $value);
|
||||
$table = $builder->getModel()->getTable();
|
||||
return $builder->whereIn("{$table}.status", $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class WithAgingColumn implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
$today = Carbon::now();
|
||||
return $builder->select('packing_lists.*')
|
||||
->addSelect(DB::raw("DATEDIFF('$today', transactions.updated_at) as days_over_duedate"))
|
||||
->addSelect(DB::raw("CASE
|
||||
WHEN DATEDIFF('$today', transactions.updated_at) <= 0 THEN 0
|
||||
WHEN DATEDIFF('$today', transactions.updated_at) > 0 AND DATEDIFF('$today', transactions.updated_at) <= 30 THEN 1
|
||||
WHEN DATEDIFF('$today', transactions.updated_at) > 30 AND DATEDIFF('$today', transactions.updated_at) <= 60 THEN 2
|
||||
WHEN DATEDIFF('$today', transactions.updated_at) > 60 AND DATEDIFF('$today', transactions.updated_at) <= 90 THEN 3
|
||||
ELSE 4
|
||||
END AS due_date_number"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class WithOrderReferenceLike implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->join('transactions as t2', 't2.payment_reference', '=', 'transactions.bill_no')
|
||||
->join('transactions as t3', 't3.id', '=', 't2.owner_id')
|
||||
->join('packing_lists', 'packing_lists.id', '=', 't3.owner_id')
|
||||
->join('orders', function ($join) use ($value) {
|
||||
$join->on('orders.id', '=', 'packing_lists.owner_id')
|
||||
->where('orders.reference', 'LIKE', '%'.$value.'%');
|
||||
})
|
||||
->addSelect(['transactions.*', 't2.id as paymentTransactionId', 't3.id as invoiceTransactionId', 'packing_lists.id as packingListId', 'orders.reference as orderReference']);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
|
||||
use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject;
|
||||
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Processors\CreatePaymentTransactionProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
@@ -46,6 +47,9 @@ class CallbackBillplzLogic
|
||||
/** @var CreatePaymentTransactionProcessor */
|
||||
private $createPaymentTransactionProcessor;
|
||||
|
||||
/** @var CallbackBillplzProcessor */
|
||||
private $callbackBillplzProcessor;
|
||||
|
||||
/**
|
||||
* CallbackBillplzLogic constructor.
|
||||
* @param GetBillplzBill $getBillplzBill
|
||||
@@ -54,8 +58,9 @@ class CallbackBillplzLogic
|
||||
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
|
||||
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
|
||||
* @param CreatePaymentTransactionProcessor $createPaymentTransactionProcessor
|
||||
* @param CallbackBillplzProcessor $callbackBillplzProcessor
|
||||
*/
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor, UpdatesWalletBalance $updatesWalletBalance, CreatePaymentTransactionProcessor $createPaymentTransactionProcessor)
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor, UpdatesWalletBalance $updatesWalletBalance, CreatePaymentTransactionProcessor $createPaymentTransactionProcessor, CallbackBillplzProcessor $callbackBillplzProcessor)
|
||||
{
|
||||
$this->getBillplzBill = $getBillplzBill;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
@@ -64,6 +69,7 @@ class CallbackBillplzLogic
|
||||
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
|
||||
$this->updatesWalletBalance = $updatesWalletBalance;
|
||||
$this->createPaymentTransactionProcessor = $createPaymentTransactionProcessor;
|
||||
$this->callbackBillplzProcessor = $callbackBillplzProcessor;
|
||||
}
|
||||
|
||||
|
||||
@@ -106,41 +112,7 @@ class CallbackBillplzLogic
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
|
||||
// check if is wallet top up
|
||||
if($transaction->owner instanceof Wallet && $status === ApprovalStatus::APPROVED &&!in_array($transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
$this->updatesWalletBalance->execute($transaction->owner, $transaction->amount);
|
||||
}
|
||||
|
||||
// group payment
|
||||
if ($transaction->type == TransactionType::GROUP_PAYMENT && $status === ApprovalStatus::APPROVED &&!in_array($transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
|
||||
$group = Group::where('reference', $billplzXSignatureObject->getBillPlzId())->first();
|
||||
|
||||
foreach($group->groupTransactions as $groupTransaction) {
|
||||
$invoice = $groupTransaction->transaction;
|
||||
$this->createPaymentTransactionProcessor->execute($invoice, PaymentMethodType::WALLET, null);
|
||||
}
|
||||
|
||||
$group->status = $status;
|
||||
$group->save();
|
||||
}
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, $status);
|
||||
|
||||
if (!$transaction->owner instanceof Wallet) {
|
||||
$totalPaidAmount = $invoice->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
|
||||
if(($invoice->amount - $totalPaidAmount) < 0.01) {
|
||||
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
|
||||
|
||||
$packingList->status = ApprovalStatus::APPROVED;
|
||||
$packingList->save();
|
||||
|
||||
if(app()->environment('production')){
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromYDPortalProcessor->execute($packingList);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->callbackBillplzProcessor->execute($transaction, $status);
|
||||
|
||||
$company_module_marking = $transaction->owner->owner->connections? $transaction->owner->owner->connections->first()->invitee_reference: null;
|
||||
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Billplzs\Processors;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Wallet;
|
||||
use App\Models\Group;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\Modules\Transactions\Processors\CreatePaymentTransactionProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\Modules\Wallets\Services\UpdatesWalletBalance;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
|
||||
|
||||
class CallbackBillplzProcessor
|
||||
{
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var UpdateDoFromVTPortalProcessor */
|
||||
private $updateDoFromVTPortalProcessor;
|
||||
|
||||
/** @var UpdateDoFromYDPortalProcessor */
|
||||
private $updateDoFromYDPortalProcessor;
|
||||
|
||||
/** @var UpdatesWalletBalance */
|
||||
private $updatesWalletBalance;
|
||||
|
||||
/** @var CreatePaymentTransactionProcessor */
|
||||
private $createPaymentTransactionProcessor;
|
||||
|
||||
/**
|
||||
* CreateUserProcessor constructor.
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
|
||||
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
|
||||
* @param UpdatesWalletBalance $updatesWalletBalance
|
||||
* @param CreatePaymentTransactionProcessor $createPaymentTransactionProcessor
|
||||
*/
|
||||
public function __construct(UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor, UpdatesWalletBalance $updatesWalletBalance, CreatePaymentTransactionProcessor $createPaymentTransactionProcessor)
|
||||
{
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
|
||||
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
|
||||
$this->updatesWalletBalance = $updatesWalletBalance;
|
||||
$this->createPaymentTransactionProcessor = $createPaymentTransactionProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute($transaction, $status)
|
||||
{
|
||||
$invoice = $transaction->owner;
|
||||
$packingList = $invoice->owner;
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, $status);
|
||||
|
||||
// check if is wallet top up
|
||||
if ($transaction->owner instanceof Wallet && $status === ApprovalStatus::APPROVED) {
|
||||
|
||||
$this->updatesWalletBalance->execute($transaction->owner, $transaction->amount);
|
||||
|
||||
$group = Group::where('reference', $transaction->payment_reference)->first();
|
||||
|
||||
// check if is group payment
|
||||
if ($group) {
|
||||
foreach ($group->groupTransactions as $groupTransaction) {
|
||||
$invoice = $groupTransaction->transaction;
|
||||
$this->createPaymentTransactionProcessor->execute($invoice, PaymentMethodType::WALLET, null);
|
||||
}
|
||||
|
||||
$group->status = $status;
|
||||
$group->save();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$transaction->owner instanceof Wallet) {
|
||||
$totalPaidAmount = $invoice->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
|
||||
if (($invoice->amount - $totalPaidAmount) < 0.01) {
|
||||
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
|
||||
|
||||
$packingList->status = ApprovalStatus::APPROVED;
|
||||
$packingList->save();
|
||||
|
||||
if (app()->environment('production')) {
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromYDPortalProcessor->execute($packingList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Models\Order;
|
||||
use App\Models\PackingList;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use App\Classes\General\Eloquent\ApplyFiltersToQuery;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use DateTime;
|
||||
|
||||
class ExportsAgingList implements WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize, FromQuery
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $filters;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->filters = [
|
||||
"has_invoice_status_in" => [2],
|
||||
"packing_list_ordered_by_invoice_date" => true,
|
||||
"with_aging_column" => true
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Company Name',
|
||||
'Customer Marking',
|
||||
'Order Number',
|
||||
'Invoice No',
|
||||
'Invoice Date',
|
||||
'Days',
|
||||
'Amount',
|
||||
];
|
||||
}
|
||||
|
||||
public function query()
|
||||
{
|
||||
return (new ApplyFiltersToQuery())->execute(PackingList::query(), $this->filters);
|
||||
}
|
||||
|
||||
public function map($list): array
|
||||
{
|
||||
$marking = null;
|
||||
$orderNo = null;
|
||||
$name = null;
|
||||
$invDate = 'n/a';
|
||||
$invNo = 'n/a';
|
||||
$days = 'n/a';
|
||||
|
||||
if ($list->owner instanceof Order) {
|
||||
$inviterPivotInviteeReference = $list->owner->companyModule->inviters()->withPivot('invitee_reference')->first();
|
||||
|
||||
if ($inviterPivotInviteeReference) {
|
||||
$marking = $inviterPivotInviteeReference->pivot->invitee_reference;
|
||||
$orderNo = $list->owner->reference;
|
||||
}
|
||||
$name = $list->owner->companyModule->company->name;
|
||||
}
|
||||
|
||||
$transaction = $list->transactions()->whereIn('status', [ApprovalStatus::APPROVED])->first();
|
||||
if ($transaction) {
|
||||
|
||||
$invoiceDate = $transaction->created_at;
|
||||
$invDate = date_format($invoiceDate, 'd-m-Y');
|
||||
$invNo = $transaction->bill_no;
|
||||
$amt = number_format($transaction->amount, 2);
|
||||
|
||||
$currentDate = new DateTime();
|
||||
$interval = $currentDate->diff($invoiceDate);
|
||||
$days = $interval->format('%a');
|
||||
}
|
||||
|
||||
return [
|
||||
$name,
|
||||
$marking,
|
||||
$orderNo,
|
||||
$invNo,
|
||||
$invDate,
|
||||
$days,
|
||||
$amt,
|
||||
];
|
||||
}
|
||||
|
||||
private function dueDateColumn($colNum, $dueDateNumber, $amt)
|
||||
{
|
||||
if ($colNum == $dueDateNumber) return $amt;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\Company;
|
||||
use App\Models\Wallet;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
|
||||
class ExportsCustomersWalletTransactionHistory implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
private $runningBalance = 0;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Date',
|
||||
'Description',
|
||||
'Incoming',
|
||||
'Outgoing',
|
||||
'Balance',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$wallet = Wallet::find($this->request->route('wallet_id'));
|
||||
$transactions = $wallet->transactions()->whereIn('transactions.status', [2, 3])->orderBy('id');
|
||||
|
||||
return $transactions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Transaction $transaction
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($transaction): array
|
||||
{
|
||||
$decimals = $this->request->route('is_precise') == 'true' ? 5 : 2;
|
||||
|
||||
$description = '';
|
||||
switch ((int) $transaction->type) {
|
||||
case TransactionType::TOP_UP:
|
||||
$description = (float) $transaction->amount . ' Credit Top up';
|
||||
break;
|
||||
case TransactionType::GROUP_PAYMENT:
|
||||
$description = (float) $transaction->amount . ' Credit Top up';
|
||||
break;
|
||||
case TransactionType::CREDIT_NOTE:
|
||||
$description = 'Credit Voucher for ' . $transaction->payment_reference;
|
||||
break;
|
||||
case TransactionType::PAYMENT:
|
||||
$booking = Transaction::where('payment_reference', $transaction->bill_no)->first()->owner;
|
||||
|
||||
if (!$booking) {
|
||||
$description = 'Payment for unknown booking, please contact tech support.';
|
||||
break;
|
||||
}
|
||||
|
||||
$marking = $booking->marking;
|
||||
$description = 'Payment For booking refs' . $marking;
|
||||
break;
|
||||
case TransactionType::DEBIT_NOTE:
|
||||
$description = 'Debit Voucher for ' . $transaction->payment_reference;
|
||||
break;
|
||||
}
|
||||
|
||||
$incoming = $outgoing = '';
|
||||
|
||||
if (in_array($transaction->type, [TransactionType::TOP_UP, TransactionType::CREDIT_NOTE, TransactionType::GROUP_PAYMENT])) {
|
||||
$incoming = number_format($transaction->amount, $decimals, '.', ',');
|
||||
$this->runningBalance += $transaction->amount;
|
||||
}
|
||||
|
||||
if (in_array($transaction->type, [TransactionType::PAYMENT, TransactionType::DEBIT_NOTE])) {
|
||||
$outgoing = number_format($transaction->amount, $decimals, '.', ',');
|
||||
$this->runningBalance -= $transaction->amount;
|
||||
}
|
||||
|
||||
return [
|
||||
Carbon::parse($transaction->created_at)->format('d-m-Y h:i:s A'),
|
||||
$description,
|
||||
$incoming,
|
||||
$outgoing,
|
||||
number_format($this->runningBalance, $decimals, '.', ',')
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,11 @@ class ExportsFeedback implements FromQuery, WithHeadings, WithHeadingRow, WithMa
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Version',
|
||||
'Question Set',
|
||||
'Question Text',
|
||||
'Answer',
|
||||
'Answer Text',
|
||||
'Answer Value',
|
||||
'Source System',
|
||||
'Source Marking',
|
||||
'Source Email',
|
||||
@@ -38,7 +40,7 @@ class ExportsFeedback implements FromQuery, WithHeadings, WithHeadingRow, WithMa
|
||||
return QAUserAnswerSelected::whereHas('question', function ($query) {
|
||||
$query->whereHas('questionnaire', function ($innerQuery) {
|
||||
$innerQuery->where('group', 'feedback');
|
||||
})->where('created_at', '>', Carbon::now()->subMonths(1));
|
||||
}); //->where('created_at', '>', Carbon::now()->subMonths(1));
|
||||
})->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
@@ -56,11 +58,14 @@ class ExportsFeedback implements FromQuery, WithHeadings, WithHeadingRow, WithMa
|
||||
$companyModule = $user->companyModule()->first();
|
||||
$user_marking = $companyModule ? $companyModule->inviters()->withPivot('invitee_reference')->first()->pivot->invitee_reference : "";
|
||||
}
|
||||
$answer = $userAnswer->answer;
|
||||
|
||||
return [
|
||||
$userAnswer->question->questionnaire->version,
|
||||
$userAnswer->question->questionnaire->description,
|
||||
$userAnswer->question->question_text,
|
||||
$userAnswer->free_text_answer,
|
||||
$answer->display_text,
|
||||
$answer->value,
|
||||
$user ? QASystemSourceType::getText(QASystemSourceType::IZYIM) : QASystemSourceType::getText($source->system),
|
||||
$user ? $user_marking : $source->marking,
|
||||
$user ? $user->email : $source->email,
|
||||
|
||||
@@ -59,7 +59,7 @@ class ListQuestionsQALogic extends AbstractControllerLogic
|
||||
$delimiter = "|";
|
||||
$parts = explode($delimiter, $decriptedToken);
|
||||
$questionSet = $parts[3];
|
||||
$query = $this->listsHelpMenuQuestions->execute(['questionnaire_set_id' => $questionSet]);
|
||||
$query = $this->listsHelpMenuQuestions->execute(['questionnaire_set_id' => $questionSet, 'order_by' => (object)['column' => 'order','DESC' => false]]);
|
||||
return $this->collectionResponse(HelpMenuQuestionResource::collection($query));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ use App\Classes\Modules\Addresses\Services\FetchesAddress;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Models\PackingList;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdateDoFromVTPortalProcessor
|
||||
{
|
||||
/** @var FetchesDataFromVTPortal */
|
||||
@@ -36,6 +38,8 @@ class UpdateDoFromVTPortalProcessor
|
||||
*/
|
||||
public function execute(PackingList $packing_list) {
|
||||
|
||||
Log::info('Trying to Call UpdateDoFromVTPortalProcessor');
|
||||
|
||||
if(!app()->environment(['production'])){
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ class UpdateDoFromYDPortalProcessor
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function execute(PackingList $packingList) {
|
||||
Log::info('Trying to Call UpdateDoFromYDPortalProcessor');
|
||||
|
||||
if(!app()->environment(['production'])){
|
||||
return;
|
||||
}
|
||||
@@ -70,6 +72,7 @@ class UpdateDoFromYDPortalProcessor
|
||||
|
||||
|
||||
} catch (\Exception $exception){
|
||||
log::debug($exception);
|
||||
throw new InternalServerErrorException('failed to approve address due to an error related to YD portal');
|
||||
}
|
||||
}
|
||||
|
||||
+10
-31
@@ -4,18 +4,15 @@ namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
|
||||
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
|
||||
use App\Classes\Modules\Documents\Services\ApprovesDocument;
|
||||
use App\Classes\Modules\Documents\Services\FetchesDocument;
|
||||
use App\Classes\Modules\Documents\Services\RejectsDocument;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
|
||||
use App\Classes\Modules\Transactions\Processors\CreatePaymentTransactionProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -29,15 +26,15 @@ class ApprovePaymentTransactionLogic extends AbstractControllerLogic
|
||||
* @param RejectsDocument $rejectsDocument
|
||||
* @param UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor
|
||||
* @param UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor
|
||||
* @param CreatePaymentTransactionProcessor $createPaymentTransactionProcessor
|
||||
*/
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, CallbackBillplzProcessor $callbackBillplzProcessor)
|
||||
{
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->approvesDocument = $approvesDocument;
|
||||
$this->rejectsDocument = $rejectsDocument;
|
||||
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
|
||||
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
|
||||
$this->callbackBillplzProcessor = $callbackBillplzProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,11 +59,8 @@ class ApprovePaymentTransactionLogic extends AbstractControllerLogic
|
||||
/** @var RejectsDocument */
|
||||
private $rejectsDocument;
|
||||
|
||||
/** @var UpdateDoFromVTPortalProcessor */
|
||||
private $updateDoFromVTPortalProcessor;
|
||||
|
||||
/** @var UpdateDoFromYDPortalProcessor */
|
||||
private $updateDoFromYDPortalProcessor ;
|
||||
/** @var CallbackBillplzProcessor */
|
||||
private $callbackBillplzProcessor;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
@@ -82,29 +76,14 @@ class ApprovePaymentTransactionLogic extends AbstractControllerLogic
|
||||
|
||||
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('transaction_id')]);
|
||||
|
||||
$status === 'approve' ? $this->approvesDocument->execute($transaction->documents()->first()) : $this->rejectsDocument->execute($transaction->documents()->first());
|
||||
$status === 'approve' ? $this->approvesDocument->execute($transaction->documents()->where('status', ApprovalStatus::PENDING_VERIFICATION)->first()) : $this->rejectsDocument->execute($transaction->documents()->where('status', ApprovalStatus::PENDING_VERIFICATION)->first());
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
|
||||
|
||||
if($transaction->status === ApprovalStatus::APPROVED){
|
||||
$invoice = $transaction->owner;
|
||||
$packingList = $invoice->owner;
|
||||
|
||||
if(($invoice->amount - $transaction->amount) < 0.01) {
|
||||
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
|
||||
|
||||
$packingList->status = ApprovalStatus::APPROVED;
|
||||
$packingList->save();
|
||||
|
||||
if(app()->environment('production')){
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromYDPortalProcessor->execute($packingList);
|
||||
}
|
||||
}
|
||||
|
||||
if ($status === 'approve') {
|
||||
$this->callbackBillplzProcessor->execute($transaction, ApprovalStatus::APPROVED);
|
||||
}
|
||||
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,6 +84,25 @@ class CreateGroupsLogic extends AbstractControllerLogic
|
||||
// $invoices = $this->fetchesTransaction->execute(['id_in' => $invoice_ids]);
|
||||
$invoices = Transaction::whereIn('id', $invoice_ids)->get();
|
||||
|
||||
foreach ($invoices as $invoice) {
|
||||
$order = null;
|
||||
if ($invoice->owner instanceof Transaction) {
|
||||
if ($invoice->owner) {
|
||||
if ($invoice->owner->owner) {
|
||||
$order = $invoice->owner->owner->owner;
|
||||
}
|
||||
}
|
||||
} else if (!($invoice->owner instanceof Transaction) && !($invoice->owner instanceof Wallet)) {
|
||||
if ($invoice->owner) {
|
||||
$order = $invoice->owner->owner;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$order) {
|
||||
throw new MalformedRequestException("There is an error while paying for invoice {$invoice->bill_no}");
|
||||
}
|
||||
}
|
||||
|
||||
if ($payment_method == PaymentMethodType::WALLET) {
|
||||
|
||||
$companyModuleId = $invoices->first()->receiver;
|
||||
@@ -153,7 +172,7 @@ class CreateGroupsLogic extends AbstractControllerLogic
|
||||
$companyModuleId = $invoice->receiver;
|
||||
$companyModule = $this->fetchesCompanyModule->execute(['id' => $companyModuleId]);
|
||||
|
||||
$topUpTransaction = $this->createWalletTopUpTransactionProcessor->execute($companyModule, $amount, $request->input('bank_code'), true, $payment_method);
|
||||
$topUpTransaction = $this->createWalletTopUpTransactionProcessor->execute($companyModule, $amount, $request->input('bank_code'), $payment_method, $billNumber, true);
|
||||
}
|
||||
|
||||
$group->issuer = $issuer;
|
||||
|
||||
@@ -50,6 +50,11 @@ class DeleteGroupLogic extends AbstractControllerLogic
|
||||
{
|
||||
$group = $this->fetchesGroup->execute(['id' => $request->route('id')]);
|
||||
|
||||
foreach ($group->groupTransactions as $groupTransaction) {
|
||||
// $groupTransaction->transaction->delete();
|
||||
$groupTransaction->delete();
|
||||
}
|
||||
|
||||
$this->deletesGroup->execute($group);
|
||||
|
||||
return $this->response([]);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeletePaymentTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Delete Payment Transaction',
|
||||
'message' => 'You have successfully deleted the payment transaction'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
|
||||
/**
|
||||
* SuspendTransactionLogic constructor.
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
*/
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus)
|
||||
{
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
}
|
||||
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]);
|
||||
|
||||
$transaction->delete();
|
||||
|
||||
$invoice = $transaction->owner;
|
||||
|
||||
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::APPROVED);
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\ListsTransactions;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Http\Resources\WalletTransactionResource ;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListWalletTransactionsLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* ListTransactionsLogic constructor.
|
||||
* @param ListsTransactions $listsTransactions
|
||||
*/
|
||||
public function __construct(ListsTransactions $listsTransactions)
|
||||
{
|
||||
$this->listsTransactions = $listsTransactions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Wallet Transactions',
|
||||
'message' => 'You have successfully retrieved a list of transactions'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var ListsTransactions */
|
||||
private $listsTransactions;
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$query = $this->listsTransactions->execute($this->listsTransactions->deserializeFilters($request->input('filters')));
|
||||
|
||||
if (str_contains($request->input('filters'), "owner_id") && $query->count() > 0) {
|
||||
$wallet_total_incoming = Transaction::where('owner_type', $query->first()->owner_type)
|
||||
->where('owner_id', $query->first()->owner_id)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->whereIn('type', [TransactionType::TOP_UP, TransactionType::CREDIT_NOTE, TransactionType::GROUP_PAYMENT])
|
||||
->sum('amount');
|
||||
|
||||
$wallet_total_outgoing = Transaction::where('owner_type', $query->first()->owner_type)
|
||||
->where('owner_id', $query->first()->owner_id)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->whereIn('type', [TransactionType::PAYMENT, TransactionType::DEBIT_NOTE])
|
||||
->sum('amount');
|
||||
|
||||
$currentWalletBalance = $wallet_total_incoming - $wallet_total_outgoing;
|
||||
$incoming = Transaction::where('owner_type', $query->first()->owner_type)
|
||||
->where('owner_id', $query->first()->owner_id)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->whereIn('type', [TransactionType::TOP_UP, TransactionType::CREDIT_NOTE, TransactionType::GROUP_PAYMENT])
|
||||
->where('id', '>', $query->first()->id)
|
||||
->sum('amount');
|
||||
$outgoing = Transaction::where('owner_type', $query->first()->owner_type)
|
||||
->where('owner_id', $query->first()->owner_id)
|
||||
->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])
|
||||
->whereIn('type', [TransactionType::PAYMENT, TransactionType::DEBIT_NOTE])
|
||||
->where('id', '>', $query->first()->id)
|
||||
->sum('amount');
|
||||
$runningBalanceInReverse = $currentWalletBalance - $incoming + $outgoing;
|
||||
$request['running_balance'] = $runningBalanceInReverse;
|
||||
}
|
||||
|
||||
return $this->collectionResponse(WalletTransactionResource::collection($query));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Order;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Mccarlosen\LaravelMpdf\Facades\LaravelMpdf;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Models\Document;
|
||||
|
||||
class RegenerateSingleShippingInvoiceTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Regenerate Shipping Invoice',
|
||||
'message' => 'You have successfully regenerated shipping invoice'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CreatesDocument */
|
||||
private $createsDocument;
|
||||
|
||||
/** @var CreatesFiles */
|
||||
private $createsFiles;
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/**
|
||||
* @param CreatesDocument $createsDocument
|
||||
*/
|
||||
public function __construct(CreatesDocument $createsDocument, CreatesFiles $createsFiles, FetchesTransaction $fetchesTransaction)
|
||||
{
|
||||
$this->createsDocument = $createsDocument;
|
||||
$this->createsFiles = $createsFiles;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
}
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$invoice = $this->fetchesTransaction->execute(['id' => $request->route('invoice_id')]);
|
||||
|
||||
$invoice->documents()->delete();
|
||||
|
||||
$transaction_invoice_pdf = LaravelMpdf::loadView('pages.pdfs.shipping_invoice', ['invoice_transaction' => $invoice]);
|
||||
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::SHIPPING_INVOICE,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($transaction_invoice_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'shipping_invoice'
|
||||
);
|
||||
|
||||
$document =$this->createsDocument->execute($invoice, $document_object);
|
||||
|
||||
$this->createsFiles->execute($document, $document_object);
|
||||
|
||||
// dump($document);
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class CreateWalletTopUpTransactionProcessor
|
||||
/**
|
||||
* @throws MalformedRequestException
|
||||
*/
|
||||
public function execute(CompanyModule $companyModule, $amount, $bank_code, ?bool $groupTransaction = false)
|
||||
public function execute(CompanyModule $companyModule, $amount, $bank_code, ?int $payment_method = PaymentMethodType::PAYMENT_GATEWAY, ?string $payment_reference = null, ?bool $groupTransaction = false)
|
||||
{
|
||||
/** @var Wallet $wallet */
|
||||
$wallet = $companyModule->wallets()->first();
|
||||
@@ -82,7 +82,9 @@ class CreateWalletTopUpTransactionProcessor
|
||||
$billPlzBill = $this->createsBillplzBill->execute($companyModule->name, $user->email, 'This payment is credit topup for company ref. ' . $companyModule->reference, $amount, $billNumber, $bank_code, true);
|
||||
|
||||
// IF $groupTransaction, transaction type is GROUP_PAYMENT
|
||||
$transaction_object = new TransactionObject($billNumber, $groupTransaction? TransactionType::GROUP_PAYMENT: TransactionType::TOP_UP, 1, $companyModule->id, 1, PaymentMethodType::PAYMENT_GATEWAY, $amount, $amount, 1, 1, 1, 0, 0, null, ApprovalStatus::PENDING_SUBMISSION, [], $billPlzBill->id);
|
||||
// $transaction_object = new TransactionObject($billNumber, $groupTransaction? TransactionType::GROUP_PAYMENT: TransactionType::TOP_UP, 1, $companyModule->id, 1, PaymentMethodType::PAYMENT_GATEWAY, $amount, $amount, 1, 1, 1, 0, 0, null, ApprovalStatus::PENDING_SUBMISSION, [], $billPlzBill->id);
|
||||
// no more group payment
|
||||
$transaction_object = new TransactionObject($billNumber, TransactionType::TOP_UP, 1, $companyModule->id, 1, $payment_method, $amount, $amount, 1, 1, 1, 0, 0, null, ApprovalStatus::PENDING_SUBMISSION, [], $payment_method === PaymentMethodType::PAYMENT_GATEWAY ? $billPlzBill->id : $payment_reference);
|
||||
|
||||
$transaction = $this->createsTransactionableTransaction->execute($wallet, $transaction_object);
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace App\Classes\Modules\Wallets\Services;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRelationshipRecord;
|
||||
use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Wallet;
|
||||
use App\Models\Company;
|
||||
|
||||
@@ -16,10 +18,24 @@ class UpdatesWalletBalance extends AbstractUpdateRecord
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Wallet $model, $amount) {
|
||||
public function execute(Wallet $model, $amount)
|
||||
{
|
||||
$topups = 0;
|
||||
$credit = 0;
|
||||
$payments = 0;
|
||||
$debit = 0;
|
||||
|
||||
$model->amount = $model->amount + $amount;
|
||||
foreach ($model->transactions as $transaction) {
|
||||
if (!in_array((int) $transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) continue;
|
||||
if ((int) $transaction->type === TransactionType::TOP_UP) $topups += (float) $transaction->amount;
|
||||
if ((int) $transaction->type === TransactionType::GROUP_PAYMENT) $topups += (float) $transaction->amount;
|
||||
if ((int) $transaction->type === TransactionType::CREDIT_NOTE) $credit += (float) $transaction->amount;
|
||||
if ((int) $transaction->type === TransactionType::PAYMENT) $payments += (float) $transaction->amount;
|
||||
if ((int) $transaction->type === TransactionType::DEBIT_NOTE) $debit += (float) $transaction->amount;
|
||||
}
|
||||
$auditBalance = ($topups + $credit) - ($payments + $debit);
|
||||
|
||||
$model->amount = $auditBalance;
|
||||
return $this->handler($model);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject;
|
||||
use App\Classes\Modules\Billplzs\Processors\CallbackBillplzProcessor;
|
||||
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromVTPortalProcessor;
|
||||
use App\Classes\Modules\Orders\Processors\UpdateDoFromYDPortalProcessor;
|
||||
@@ -53,12 +54,15 @@ class FixBillplzFailedCallbackPayment extends Command
|
||||
/** @var UpdateDoFromYDPortalProcessor */
|
||||
private $updateDoFromYDPortalProcessor ;
|
||||
|
||||
/** @var CallbackBillplzProcessor */
|
||||
private $callbackBillplzProcessor;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor)
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor, CallbackBillplzProcessor $callbackBillplzProcessor)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->getBillplzBill = $getBillplzBill;
|
||||
@@ -66,6 +70,7 @@ class FixBillplzFailedCallbackPayment extends Command
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updateDoFromVTPortalProcessor = $updateDoFromVTPortalProcessor;
|
||||
$this->updateDoFromYDPortalProcessor = $updateDoFromYDPortalProcessor;
|
||||
$this->callbackBillplzProcessor = $callbackBillplzProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +87,7 @@ class FixBillplzFailedCallbackPayment extends Command
|
||||
|
||||
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
|
||||
|
||||
$transactions = Transaction::whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP])->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
|
||||
$transactions = Transaction::whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP, TransactionType::GROUP_PAYMENT])->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
|
||||
$totalTransactions = count($transactions);
|
||||
|
||||
if ($totalTransactions) {
|
||||
@@ -96,84 +101,15 @@ class FixBillplzFailedCallbackPayment extends Command
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
if($data['paid']){
|
||||
$totalAmount += $transaction->amount;
|
||||
$invoiceStatus = null;
|
||||
if($data['paid']) {
|
||||
$status = ApprovalStatus::PENDING_VERIFICATION;
|
||||
|
||||
switch($transaction->owner->status) {
|
||||
case 3:
|
||||
$invoiceStatus = 'Payment Completed';
|
||||
break;
|
||||
case 5:
|
||||
$invoiceStatus = 'Dispute in progress';
|
||||
break;
|
||||
case 6:
|
||||
$invoiceStatus = 'Cancelled Invoice';
|
||||
break;
|
||||
default:
|
||||
$invoiceStatus = 'Pending Payment';
|
||||
if($data['state'] === 'paid') {
|
||||
$status = ApprovalStatus::APPROVED;
|
||||
}
|
||||
|
||||
$order = $transaction->owner->owner->owner;
|
||||
|
||||
if (in_array($invoiceStatus , ['Pending Payment', 'Payment Completed'])) {
|
||||
// code here
|
||||
|
||||
// $billPlz = $this->getBillplzBill->execute($billplzXSignatureObject->getBillPlzId());
|
||||
|
||||
// if(!$billPlz) throw new ResourceNotFoundException('Billplz bill not found.');
|
||||
|
||||
// $transaction = $this->fetchesTransaction->execute(['payment_reference' => $billplzXSignatureObject->getBillPlzId()]);
|
||||
|
||||
$invoice = $transaction->owner;
|
||||
$packingList = $invoice->owner;
|
||||
$order = $packingList->owner;
|
||||
|
||||
$status = ApprovalStatus::PENDING_VERIFICATION;
|
||||
|
||||
if($data['state'] === 'paid') {
|
||||
$status = ApprovalStatus::APPROVED;
|
||||
}
|
||||
|
||||
// if($data->state === 'due') {
|
||||
// $status = $billplzXSignatureObject->getStatus() === 'failed' ? ApprovalStatus::REJECTED : ApprovalStatus::PENDING_VERIFICATION;
|
||||
// }
|
||||
|
||||
// $token = Auth::fromUser(User::find(1));
|
||||
// $request->headers->set('Authorization', 'Bearer '.$token);
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, $status);
|
||||
|
||||
$totalPaidAmount = $invoice->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
|
||||
if(($invoice->amount - $totalPaidAmount) < 0.01) {
|
||||
$this->updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
|
||||
|
||||
$packingList->status = ApprovalStatus::APPROVED;
|
||||
$packingList->save();
|
||||
|
||||
if(app()->environment('production')){
|
||||
$this->updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$this->updateDoFromYDPortalProcessor->execute($packingList);
|
||||
}
|
||||
|
||||
$this->info('Updated invoice ' . $counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
|
||||
} else {
|
||||
$this->info('Failed to update invoice due to unsufficeint payment ' . $counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if(!$order instanceof Order) {
|
||||
$this->info("Error transaction id:" . $transaction->id . 'Type: ' . get_class($order));
|
||||
} else {
|
||||
$this->info($counter . ' of ' . $totalTransactions . '. Order: '. $order->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status] . '. Invoice Status: ' . $invoiceStatus);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// $totalAmount += $transaction->amount;
|
||||
// $this->appendToOutput($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount);
|
||||
$this->info(Carbon::now() . ' : Fixing ' . $transaction->payment_reference);
|
||||
$this->callbackBillplzProcessor->execute($transaction, $status);
|
||||
}
|
||||
}else{
|
||||
$this->info("billplz error</br>");
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ShowFailediBllplzCallback extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'show-failed-billplz-callback';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Show all failled callback from billplz';
|
||||
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
ini_set('memory_limit', '-1');
|
||||
|
||||
$start = new Carbon();
|
||||
|
||||
$transactions = Transaction::whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP, TransactionType::GROUP_PAYMENT])->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
|
||||
$totalTransactions = count($transactions);
|
||||
|
||||
if ($totalTransactions) {
|
||||
$this->info(Carbon::now() . ' : ' . $this->description);
|
||||
}
|
||||
|
||||
$counter = 1;
|
||||
$totalAmount = 0;
|
||||
foreach ($transactions as $transaction){
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
if($data['paid']){
|
||||
dump($transaction->payment_reference);
|
||||
dump($transaction->id);
|
||||
}
|
||||
}else{
|
||||
$this->info("billplz error</br>");
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$end = new Carbon();
|
||||
$elapsedTime = $start->diff($end)->format('%H:%I:%S');
|
||||
|
||||
if ($totalTransactions) {
|
||||
$this->info(Carbon::now() . ' : Done Billplz Failled Callback. ElapsedTime: ' . $elapsedTime . '. Total: ' . $totalAmount);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
use App\Classes\Modules\Exports\Services\ExportsAgingList;
|
||||
|
||||
class ExportArrivedParcelController
|
||||
{
|
||||
@@ -46,4 +47,11 @@ class ExportArrivedParcelController
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function aging(Request $request) {
|
||||
$data = new ExportsAgingList();
|
||||
$response = $data->download('aging_report.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Exports;
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsCustomersWalletTransactionHistory;
|
||||
use App\Models\User;
|
||||
use App\Models\Wallet;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Excel;
|
||||
|
||||
class ExportCustomersWalletTransactionToExcelController
|
||||
{
|
||||
|
||||
/**
|
||||
* ExportCustomersWalletTransactionToExcelController constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer ' . $token);
|
||||
}
|
||||
|
||||
public function export(Request $request)
|
||||
{
|
||||
$exportsTransactions = new ExportsCustomersWalletTransactionHistory($request);
|
||||
$wallet = Wallet::find($request->route('wallet_id'));
|
||||
$company_marking = $wallet->owner->connections->first()->invitee_reference;
|
||||
|
||||
$filename = $company_marking . '-wallet-' . ($request->route('is_precise') == 'true' ? 'precise-' : '') . 'transaction-history.xls';
|
||||
$response = $exportsTransactions->download($filename, Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\DeletePaymentTransactionLogic;
|
||||
|
||||
|
||||
class DeletePaymentTransactionController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeletePaymentTransactionLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(Request $request, DeletePaymentTransactionLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\ListWalletTransactionsLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class ListWalletTransactionsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListWalletTransactionsLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListWalletTransactionsLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\RegenerateSingleShippingInvoiceTransactionLogic;
|
||||
|
||||
|
||||
class RegenerateSingleShippingInvoiceTransactionController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param RegenerateShippingInvoiceTransactionLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function regenerate(Request $request, RegenerateSingleShippingInvoiceTransactionLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -19,6 +20,7 @@ class GroupResource extends JsonResource
|
||||
{
|
||||
|
||||
// dd($this->groupTransactions);
|
||||
$payment_transaction = Transaction::where('payment_reference', $this->reference)->first();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
@@ -37,6 +39,12 @@ class GroupResource extends JsonResource
|
||||
'payment_method_name' => ucwords(PaymentMethodType::PAYMENT_METHODS_ID[$this->payment_method]),
|
||||
'invoices' => GroupTransactionResource::collection($this->groupTransactions),
|
||||
'reference' => $this->reference,
|
||||
'payment_transaction' => $payment_transaction ? [
|
||||
'id' => $payment_transaction->id,
|
||||
'status' => $payment_transaction->status,
|
||||
'status_name' => ApprovalStatus::APPROVAL_STATUS_ID[$payment_transaction->status],
|
||||
'documents' => $this->status === ApprovalStatus::APPROVED ? DocumentResource::collection($payment_transaction->documents->where('status', ApprovalStatus::APPROVED)) : DocumentResource::collection($payment_transaction->documents->where('status', ApprovalStatus::PENDING_VERIFICATION)),
|
||||
] : []
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class HelpMenuQuestionResource extends JsonResource
|
||||
'question_number' => $q->question_number,
|
||||
'question_text' => $q->question_text,
|
||||
'question_type' => $q->question_type,
|
||||
'question_answers' => HelpMenuAnswerOptionsResource::collection(QAAnswerOptions::where('question_number', $q->question_number)->where('questionnaire_set_id', $q->questionnaire_set_id)->get()),
|
||||
'question_answers' => HelpMenuAnswerOptionsResource::collection(QAAnswerOptions::where('question_number', $q->question_number)->where('questionnaire_set_id', $q->questionnaire_set_id)->orderBy('order', 'ASC')->get()),
|
||||
'questionnaire_set_id' => $q->questionnaire_set_id,
|
||||
'next_nested_question' => $q->next_nested_question,
|
||||
'next_main_question' => $q->next_main_question,
|
||||
|
||||
@@ -18,6 +18,7 @@ class HelpMenuQuestionnaireSetsResource extends JsonResource
|
||||
'name' => $this->name,
|
||||
'description' => $this->description,
|
||||
'group' => $this->group,
|
||||
'version' => $this->version,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use App\Classes\ValueObjects\Constants\QASystemSourceType;
|
||||
use App\Models\QAAnswerOptions;
|
||||
use App\Models\QAQuestions;
|
||||
use Carbon\Carbon;
|
||||
|
||||
@@ -20,6 +21,7 @@ class HelpMenuQuestionsAnswersResource extends JsonResource
|
||||
$question = QAQuestions::where('id', $this->question_id)->first();
|
||||
$source = new HelpMenuUserSourceResource($this->userSource);
|
||||
$user = $this->source_id === 0 ? new UserResource($this->user) : null;
|
||||
$answerOption = QAAnswerOptions::where('id', $this->answer_option_id)->first();
|
||||
|
||||
$user_marking = '';
|
||||
if($user){
|
||||
@@ -31,7 +33,8 @@ class HelpMenuQuestionsAnswersResource extends JsonResource
|
||||
'question_id' => $this->question_id,
|
||||
'questionnaire' => new HelpMenuQuestionnaireSetsResource($this->question->questionnaire),
|
||||
'question_text' => $question ? $question->question_text : null,
|
||||
'free_text_answer' => $this->free_text_answer,
|
||||
'free_text_answer' => $answerOption ? $answerOption->display_text : null,
|
||||
'answer_value' => $answerOption ? $answerOption->value : null,
|
||||
'source_system' => $user ? QASystemSourceType::getText(QASystemSourceType::IZYIM) : QASystemSourceType::getText($source->system),
|
||||
'source_marking' => $user ? $user_marking : $source->marking,
|
||||
'source_email' => $user ? $user->email : $source->email,
|
||||
|
||||
@@ -5,8 +5,10 @@ namespace App\Http\Resources;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Group;
|
||||
use App\Models\Order;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\Wallet;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -20,11 +22,36 @@ class TransactionResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$order = null;
|
||||
$groupTransactions = null;
|
||||
$packingListReference = null;
|
||||
|
||||
if ($this->owner instanceof Transaction) {
|
||||
if ($this->owner) {
|
||||
if ($this->owner->owner) {
|
||||
$order = new OrderResource($this->owner->owner->owner);
|
||||
}
|
||||
}
|
||||
} else if (!($this->owner instanceof Transaction) && !($this->owner instanceof Wallet)) {
|
||||
if ($this->owner) {
|
||||
$order = new OrderResource($this->owner->owner);
|
||||
}
|
||||
} else {
|
||||
$group = Group::where('reference', $this->payment_reference)->first();
|
||||
if ($group) {
|
||||
$groupTransactions = GroupTransactionResource::collection($group->groupTransactions);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'owner_type' => $this->owner_type,
|
||||
'order' => ($this->owner instanceof Transaction) ? new OrderResource($this->owner->owner->owner) : new OrderResource($this->owner->owner),
|
||||
'documents' => DocumentResource::collection($this->documents),
|
||||
'order' => $order,
|
||||
'packing_list_reference' => $packingListReference,
|
||||
'group_transactions' => $groupTransactions,
|
||||
'group_reference' => $groupTransactions ? $group->reference : null,
|
||||
'documents' => $groupTransactions ? DocumentResource::collection($this->documents->where('status', ApprovalStatus::PENDING_VERIFICATION)) : DocumentResource::collection($this->documents),
|
||||
'type' => (int) $this->type,
|
||||
'bill_no' => $this->bill_no,
|
||||
'amount' => (double) $this->amount,
|
||||
|
||||
@@ -23,7 +23,7 @@ class WalletResource extends JsonResource
|
||||
'amount' => (double) $this->amount,
|
||||
'company_id' => (int) $this->owner->id,
|
||||
'transactions' => $this->whenLoaded('transactions', WalletTransactionResource::collection($this->transactions()->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->orderBy('id', 'DESC')->get()), []),
|
||||
'top_up_records' => $this->whenLoaded('transactions', WalletTransactionResource::collection($this->transactions()->whereIn('type', [TransactionType::TOP_UP])->orderBy('id', 'DESC')->get()), []),
|
||||
'top_up_records' => $this->whenLoaded('transactions', WalletTransactionResource::collection($this->transactions()->whereIn('type', [TransactionType::TOP_UP, TransactionType::GROUP_PAYMENT])->orderBy('id', 'DESC')->get()), []),
|
||||
'company_module_marking' => $this->owner->connections->first()->invitee_reference,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -20,28 +20,41 @@ class WalletTransactionResource extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
$description = '';
|
||||
$current_running_balance = $request['running_balance'];
|
||||
switch((int) $this->type){
|
||||
case TransactionType::TOP_UP:
|
||||
$description = (double) $this->amount.' Credit Top up';
|
||||
$request['running_balance'] = bcsub($request['running_balance'], $this->amount, 5);
|
||||
break;
|
||||
case TransactionType::CREDIT_NOTE:
|
||||
$description = 'Credit Voucher for '.$this->payment_reference;
|
||||
$request['running_balance'] = bcsub($request['running_balance'], $this->amount, 5);
|
||||
break;
|
||||
case TransactionType::PAYMENT:
|
||||
$order = Transaction::where('payment_reference', $this->bill_no)->first()->owner->owner->owner;
|
||||
$invoice = Transaction::where('payment_reference', $this->bill_no)->first();
|
||||
if(!$invoice) {
|
||||
Log::channel('paymentUnknownOrderLog')->info('ID: ' . $this->id);
|
||||
$description = 'Payment for unknown invoice, please contact tech support.';
|
||||
break;
|
||||
}
|
||||
|
||||
$order = $invoice->owner->owner->owner;
|
||||
if(!$order) {
|
||||
Log::channel('paymentUnknownOrderLog')->info('ID: ' . $this->id);
|
||||
$description = 'Payment for unknown order, please contact tech support.';
|
||||
break;
|
||||
}
|
||||
|
||||
$request['running_balance'] = bcadd($request['running_balance'], $this->amount, 5);
|
||||
$marking = $order->reference;
|
||||
$description = 'Payment For order refs.'.'<a href="'.route('order.details', $marking).'">'.$marking.'</a>';
|
||||
break;
|
||||
case 11:
|
||||
$request['running_balance'] = bcadd($request['running_balance'], $this->amount, 5);
|
||||
$description = 'Debit Voucher for '.$this->payment_reference;
|
||||
break;
|
||||
case 15:
|
||||
$request['running_balance'] = bcsub($request['running_balance'], $this->amount, 5);
|
||||
$description = (double) $this->amount.' Credit Top up';
|
||||
break;
|
||||
|
||||
@@ -56,6 +69,7 @@ class WalletTransactionResource extends JsonResource
|
||||
'payment_method' => (float) $this->payment_method,
|
||||
// 'issuer_name' => $this->issuerCompany->name,
|
||||
'amount' => (double) $this->amount,
|
||||
'running_balance' => (double) $current_running_balance,
|
||||
'service_charge' => (double) $this->service_charge,
|
||||
'tax' => (double) $this->tax,
|
||||
'status' => (int) $this->status,
|
||||
|
||||
@@ -4,10 +4,12 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class GroupTransaction extends Model
|
||||
{
|
||||
protected $table = 'group_transactions';
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
|
||||
@@ -46,4 +46,13 @@ class QAUserAnswerSelected extends AbstractModel implements Documentable
|
||||
return $this->BelongsTo(QAQuestions::class, 'question_id', 'id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function answer(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(QAAnswerOptions::class, 'answer_option_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
|
||||
*/
|
||||
public function scopePayments(Builder $query)
|
||||
{
|
||||
return $query->where('type', TransactionType::PAYMENT);
|
||||
return $query->whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -100,6 +100,12 @@ return [
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
|
||||
'paymentUnknownOrderLog' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/paymentUnknownOrderLog.log'),
|
||||
'level' => 'info',
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -26,7 +26,12 @@ class DatabaseSeeder extends Seeder
|
||||
// $this->call(QAQuestionsDemoSeeder::class); //DEMO POC
|
||||
// $this->call(QAAnswerOptionsDemoSeeder::class); //DEMO POC
|
||||
|
||||
// 20230928 Set 1 to Set 3
|
||||
// $this->call(QAQuestionsSeeder::class);
|
||||
// $this->call(QAAnswerOptionsSeeder::class);
|
||||
|
||||
// 20231121 Set 4 to Set 6
|
||||
// $this->call(QAQuestions2Seeder::class);
|
||||
// $this->call(QAAnswerOptions2Seeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,395 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\QAAnswerOptions;
|
||||
|
||||
class QAAnswerOptions2Seeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// Set 1
|
||||
// Option 1 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Dissatisfied";
|
||||
$answerOption->value = "1";
|
||||
$answerOption->order = 1;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 2 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Dissatisfied";
|
||||
$answerOption->value = "2";
|
||||
$answerOption->order = 2;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 3 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Neutral";
|
||||
$answerOption->value = "3";
|
||||
$answerOption->order = 3;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 4 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Satisfied";
|
||||
$answerOption->value = "4";
|
||||
$answerOption->order = 4;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 5 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Satisfied";
|
||||
$answerOption->value = "5";
|
||||
$answerOption->order = 5;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
|
||||
|
||||
// Set 1
|
||||
// Option 1 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Yes";
|
||||
$answerOption->value = "3";
|
||||
$answerOption->order = 3;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 2 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Partially";
|
||||
$answerOption->value = "2";
|
||||
$answerOption->order = 2;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 3 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "No";
|
||||
$answerOption->value = "1";
|
||||
$answerOption->order = 1;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
|
||||
|
||||
// Set 1
|
||||
// Option 1 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Clear";
|
||||
$answerOption->value = "5";
|
||||
$answerOption->order = 5;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 2 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Clear";
|
||||
$answerOption->value = "4";
|
||||
$answerOption->order = 4;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 3 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Neutral";
|
||||
$answerOption->value = "3";
|
||||
$answerOption->order = 3;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 4 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Unclear";
|
||||
$answerOption->value = "2";
|
||||
$answerOption->order = 2;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 5 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Unclear";
|
||||
$answerOption->value = "1";
|
||||
$answerOption->order = 1;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 4;
|
||||
$answerOption->save();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Set 2
|
||||
// Option 1 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Yes";
|
||||
$answerOption->value = "3";
|
||||
$answerOption->order = 3;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 2 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Somewhat";
|
||||
$answerOption->value = "2";
|
||||
$answerOption->order = 2;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 3 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "No";
|
||||
$answerOption->value = "1";
|
||||
$answerOption->order = 1;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
|
||||
|
||||
// Set 2
|
||||
// Option 1 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Exceeded Expectations";
|
||||
$answerOption->value = "3";
|
||||
$answerOption->order = 3;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 2 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Met Expectations";
|
||||
$answerOption->value = "2";
|
||||
$answerOption->order = 2;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 3 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Below Expectations";
|
||||
$answerOption->value = "1";
|
||||
$answerOption->order = 1;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
|
||||
|
||||
// Set 2
|
||||
// Option 1 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Dissatisfied";
|
||||
$answerOption->value = "1";
|
||||
$answerOption->order = 1;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 2 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Dissatisfied";
|
||||
$answerOption->value = "2";
|
||||
$answerOption->order = 2;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 3 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Neutral";
|
||||
$answerOption->value = "3";
|
||||
$answerOption->order = 3;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 4 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Satisfied";
|
||||
$answerOption->value = "4";
|
||||
$answerOption->order = 4;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 5 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Satisfied";
|
||||
$answerOption->value = "5";
|
||||
$answerOption->order = 5;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 5;
|
||||
$answerOption->save();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Set 3
|
||||
// Option 1 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Immediately";
|
||||
$answerOption->value = "5";
|
||||
$answerOption->order = 5;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 2 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Within a few hours";
|
||||
$answerOption->value = "4";
|
||||
$answerOption->order = 4;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 3 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Within a day";
|
||||
$answerOption->value = "3";
|
||||
$answerOption->order = 3;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 4 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "More than a day";
|
||||
$answerOption->value = "2";
|
||||
$answerOption->order = 2;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 5 for Question 10
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Never received a response";
|
||||
$answerOption->value = "1";
|
||||
$answerOption->order = 1;
|
||||
$answerOption->question_number = 10;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
|
||||
|
||||
// Set 3
|
||||
// Option 1 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Clear";
|
||||
$answerOption->value = "5";
|
||||
$answerOption->order = 5;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 2 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Clear";
|
||||
$answerOption->value = "4";
|
||||
$answerOption->order = 4;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 3 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Neutral";
|
||||
$answerOption->value = "3";
|
||||
$answerOption->order = 3;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 4 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Unclear";
|
||||
$answerOption->value = "2";
|
||||
$answerOption->order = 2;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 5 for Question 20
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Unclear";
|
||||
$answerOption->value = "1";
|
||||
$answerOption->order = 1;
|
||||
$answerOption->question_number = 20;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
|
||||
|
||||
// Set 3
|
||||
// Option 1 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Likely";
|
||||
$answerOption->value = "5";
|
||||
$answerOption->order = 5;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 2 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Likely";
|
||||
$answerOption->value = "4";
|
||||
$answerOption->order = 4;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 3 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Neutral";
|
||||
$answerOption->value = "3";
|
||||
$answerOption->order = 3;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 4 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Unlikely";
|
||||
$answerOption->value = "2";
|
||||
$answerOption->order = 2;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
// Option 5 for Question 30
|
||||
$answerOption = new QAAnswerOptions;
|
||||
$answerOption->display_text = "Very Unlikely";
|
||||
$answerOption->value = "1";
|
||||
$answerOption->order = 1;
|
||||
$answerOption->question_number = 30;
|
||||
$answerOption->questionnaire_set_id = 6;
|
||||
$answerOption->save();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\QAQuestionnaireSet;
|
||||
use App\Models\QAQuestions;
|
||||
use App\Classes\ValueObjects\Constants\QAType;
|
||||
|
||||
class QAQuestions2Seeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$questionnaireSets = [
|
||||
[
|
||||
'name' => 'Set 1',
|
||||
'description' => 'Customer Support Satisfaction Survey',
|
||||
'group' => 'feedback',
|
||||
'version' => 2
|
||||
],
|
||||
[
|
||||
'name' => 'Set 2',
|
||||
'description' => 'First Order Experience Feedback',
|
||||
'group' => 'feedback',
|
||||
'version' => 2
|
||||
],
|
||||
[
|
||||
'name' => 'Set 3',
|
||||
'description' => 'Sales Inquiry Experience',
|
||||
'group' => 'feedback',
|
||||
'version' => 2
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($questionnaireSets as $set) {
|
||||
$questionnaireSet = QAQuestionnaireSet::create([
|
||||
'name' => $set['name'],
|
||||
'description' => $set['description'],
|
||||
'group' => $set['group'],
|
||||
'version' => $set['version'],
|
||||
]);
|
||||
|
||||
$questions = [];
|
||||
|
||||
switch ($set['name']) {
|
||||
case 'Set 1':
|
||||
$questions = [
|
||||
[
|
||||
'question_number' => 10,
|
||||
'question_text' => 'How satisfied are you with the time it took to receive a response?',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => true,
|
||||
'is_end' => false,
|
||||
],
|
||||
[
|
||||
'question_number' => 20,
|
||||
'question_text' => 'Was your issue resolved during this interaction?',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
],
|
||||
[
|
||||
'question_number' => 30,
|
||||
'question_text' => 'How clear and understandable was the communication from the support team?',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
]
|
||||
];
|
||||
break;
|
||||
case 'Set 2':
|
||||
$questions = [
|
||||
[
|
||||
'question_number' => 10,
|
||||
'question_text' => 'Did you find what you were looking for without any issues?',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => true,
|
||||
'is_end' => false,
|
||||
],
|
||||
[
|
||||
'question_number' => 20,
|
||||
'question_text' => 'Did the service meet your expectations?',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
],
|
||||
[
|
||||
'question_number' => 30,
|
||||
'question_text' => 'How satisfied are you with the delivery time?',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
]
|
||||
];
|
||||
break;
|
||||
case 'Set 3':
|
||||
$questions = [
|
||||
[
|
||||
'question_number' => 10,
|
||||
'question_text' => 'How quickly did our sales team respond to your inquiry?',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => true,
|
||||
'is_end' => false,
|
||||
],
|
||||
[
|
||||
'question_number' => 20,
|
||||
'question_text' => 'Was the information provided by our sales team clear and easy to understand?',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => false,
|
||||
],
|
||||
[
|
||||
'question_number' => 30,
|
||||
'question_text' => 'After interacting with our sales team, how likely are you to use our service?',
|
||||
'question_type' => QAType::MULTIPLE_CHOICES,
|
||||
'is_start' => false,
|
||||
'is_end' => true,
|
||||
]
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($questions as $key => $questionData) {
|
||||
$question = new QAQuestions;
|
||||
$question->question_number = $questionData['question_number'];
|
||||
$question->question_text = $questionData['question_text'];
|
||||
$question->question_type = $questionData['question_type'];
|
||||
$question->questionnaire_set_id = $questionnaireSet->id;
|
||||
|
||||
if (isset($questionData['next_nested_question'])) {
|
||||
$question->next_nested_question = $questionData['next_nested_question'];
|
||||
}
|
||||
if (isset($questionData['next_main_question'])) {
|
||||
$question->next_main_question = $questionData['next_main_question'];
|
||||
}
|
||||
|
||||
$question->is_start = $questionData['is_start'];
|
||||
$question->is_end = $questionData['is_end'];
|
||||
if (isset($questionData['end_text'])) {
|
||||
$question->end_text = $questionData['end_text'];
|
||||
}
|
||||
|
||||
$question->order = $key + 1;
|
||||
$question->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div v-if="$store.getters.isAdmin" class="btn btn-sm btn-danger pointer m-t-10 m-b-15 d-none" @click="submit(route('api.transaction.invoice.company.regenerate', company_module_id), 'post', section, true , true)">Regenerate Invoice</div>
|
||||
<div v-if="$store.getters.isAdmin" class="btn btn-sm btn-danger pointer m-t-10 m-b-15" @click="submit(route('api.transaction.invoice.company.regenerate', company_module_id), 'post', section, true , true)">Regenerate Invoice</div>
|
||||
<div class="row flex-nowrap">
|
||||
<div class="col">
|
||||
<div class="row tabsContainer">
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="col">
|
||||
<div class="row align-items-center justify-content-center m-b-10">
|
||||
<div class="col-auto p-r-10">
|
||||
<h5 class="light">Welcome Abroad <span class="text-primary">{{$store.getters.getUserName}}</span>, we provide logistics services.</h5>
|
||||
<h5 class="light">Welcome Aboard <span class="text-primary">{{$store.getters.getUserName}}</span>, we provide logistics services.</h5>
|
||||
</div>
|
||||
<div class="col-auto b-a b-thick b-primary padding-5">
|
||||
<h5 class="light no-margin">Powered by technology, delivered by experts.</h5>
|
||||
@@ -99,4 +99,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<template>
|
||||
<div class="row parentContainer">
|
||||
<div class="col-1">{{ item.questionnaire.version }}</div>
|
||||
<div class="col-1">{{ item.questionnaire.description }}</div>
|
||||
<div class="col-2"> <p>{{ item.question_text }}</p> </div>
|
||||
<div class="col-1">{{ item.free_text_answer }}</div>
|
||||
<div class="col-1">{{ item.answer_value }}</div>
|
||||
<div class="col-1">{{ item.source_system }}</div>
|
||||
<div class="col-1">{{ item.source_marking }}</div>
|
||||
<div class="col-2">{{ item.source_email }}</div>
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
<div class="col-12 col-md-8">
|
||||
<validation-wrapper-component selectable class="m-b-15" :validator="$v.parameters.question_set">
|
||||
<label class="text-primary">Question Set</label>
|
||||
<select-component :options="[{'id': 1, 'text': 'Customer Support Satisfaction Survey'}, {'id': 2, 'text': 'First Order Experience Feedback'}, {'id': 3, 'text': 'Sales Inquiry Experience'}]" v-model="parameters.question_set"></select-component>
|
||||
<select-component :options="[{'id': 4, 'text': 'Customer Support Satisfaction Survey'}, {'id': 5, 'text': 'First Order Experience Feedback'}, {'id': 6, 'text': 'Sales Inquiry Experience'}]" v-model="parameters.question_set"></select-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<p class="bold m-b-5 fs-12">{{item.description}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10 align-items-center" v-if="$store.getters.isAdmin">
|
||||
<div class="row m-b-10 align-items-center">
|
||||
<div class="col-auto">
|
||||
<p class="no-margin all-caps fs-10 lh-10 light">Reference</p>
|
||||
<p class="no-margin fs-12">{{item.reference}}</p>
|
||||
@@ -58,7 +58,7 @@
|
||||
<small class="fs-10 all-caps muted">Status</small>
|
||||
<p class="no-margin bold">{{item.container ? item.container.transport.schedule_complete && status === 'Shipping' ? 'Custom Clearance' : status : status}}</p>
|
||||
</div>
|
||||
<div class="col-auto" v-if="$store.getters.isAdmin">
|
||||
<div class="col-auto">
|
||||
<small class="fs-10 all-caps muted">Container</small>
|
||||
<p class="no-margin bold">{{item.container ? item.container.container_reference : '-'}}</p>
|
||||
</div>
|
||||
@@ -66,7 +66,7 @@
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<small class="fs-10 all-caps muted">Warehouse</small>
|
||||
<h6 class="no-margin small">{{item.order.warehouse.name}} {{$store.getters.isAdmin ? item.order.warehouse.reference : ''}}</h6>
|
||||
<h6 class="no-margin small">{{item.order.warehouse.name}} {{ item.order.warehouse.reference }}</h6>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<small class="fs-10 all-caps muted">Delivery Address</small>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<p class="no-margin all-caps fs-10 light">Est. CBM</p>
|
||||
<p class="no-margin">{{((parseFloat(item.cbm) * 1000) / 1000).toFixed(3)}}</p>
|
||||
</div>
|
||||
<div class="col" v-if="$store.getters.isAdmin">
|
||||
<div class="col">
|
||||
<p class="no-margin all-caps fs-10 light">Warehouse</p>
|
||||
<p class="no-margin" v-if="item.order">{{item.order.warehouse.reference}}</p>
|
||||
<span class='text-danger' v-if="!item.order">Unclaimed</span>
|
||||
@@ -75,7 +75,7 @@
|
||||
<p class="no-margin bold text-info fs-12"><a :href="route('customer.profile', item.order.company_module.marking)">{{item.order.company_module.marking}}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-5" v-if="$store.getters.isAdmin">
|
||||
<div class="row m-b-5">
|
||||
<div class="col-auto p-r-5">
|
||||
<p class="no-margin all-caps fs-10 light">Reference</p>
|
||||
</div>
|
||||
|
||||
+14
-28
@@ -84,6 +84,20 @@
|
||||
<address-form-component :id="item.order.company_module.id" :section="section" :type=1></address-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="row" v-if="item.order.company_module.billingAddress">
|
||||
<div class="col">
|
||||
<div class="col-auto requestModal pointer" data-type="editBillingAddress">
|
||||
<i class="fa fa-edit pointer fa-fw m-l-5"></i> Edit billing Address
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" size="extra-large" styleType="fill-in" type="editBillingAddress">
|
||||
<div class="row">
|
||||
<div class="col bg-white">
|
||||
<address-form-component :id="item.order.company_module.id" :data="item.order.company_module.billingAddress" section="editBillingAddress"></address-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!item.order.address.post_code_area">
|
||||
<div class="btn btn-xs btn-primary pointer m-t-10 requestModal btn-block" data-type="defineLocation">Define Location</div>
|
||||
<modal-component class="animate_animated animatefast animate_fadeIn" styleType="fill-in" type="defineLocation">
|
||||
@@ -110,34 +124,6 @@
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-center parentContainer m-t-10" v-if="['Pending Invoice', 'Pending Approval'].includes(invoice_status)" >
|
||||
<div class="col">
|
||||
<div class="row" v-if="!item.order.company_module.billingAddress">
|
||||
<div class="col">
|
||||
<div>
|
||||
<div class="btn btn-primary btn-xs pointer requestModal btn-block" data-type="billingAddressComponent">Add Billing Address</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" size="extra-large" styleType="fill-in" type="billingAddressComponent">
|
||||
<address-form-component :id="item.order.company_module.id" :section="section" :type=1></address-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="item.order.company_module.billingAddress">
|
||||
<div class="col">
|
||||
<div class="col-auto requestModal pointer" data-type="editBillingAddress">
|
||||
<i class="fa fa-edit pointer fa-fw m-l-5"></i> Edit billing Address
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" size="extra-large" styleType="fill-in" type="editBillingAddress">
|
||||
<div class="row">
|
||||
<div class="col bg-white">
|
||||
<address-form-component :id="item.order.company_module.id" :data="item.order.company_module.billingAddress" section="editBillingAddress"></address-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+63
-24
@@ -4,11 +4,19 @@
|
||||
<div class="row" :class="[{'b-danger': item.status == 5 ||item.status == 6, 'b-a': item.status == 5||item.status == 6}]">
|
||||
<div class="col padding-20">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-2">
|
||||
<p class="no-margin fs-10 all-caps">Invoice No</p>
|
||||
<div> {{ item.bill_no }}</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<p class="no-margin fs-10 all-caps">Reference</p>
|
||||
<div> {{ item.packing_list_reference }}</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<p class="no-margin fs-10 all-caps">Invoice Date</p>
|
||||
<div> {{ item.updated_at }}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col-2">
|
||||
<p class="no-margin fs-10 all-caps">Status</p>
|
||||
<div class="all-caps" v-if="item.status == 3">Payment Completed</div>
|
||||
<div class="all-caps text-danger" v-else-if="item.status == 5">Dispute in progress</div>
|
||||
@@ -19,7 +27,7 @@
|
||||
<p class="no-margin fs-10 all-caps">Amount</p>
|
||||
<div>MYR {{ item.amount.toFixed(2) }}</div>
|
||||
</div>
|
||||
<div class="col-3" v-if="item.remarks.length">
|
||||
<div class="col-2" v-if="item.remarks.length">
|
||||
<p class="no-margin fs-10 all-caps">Billing Question</p>
|
||||
<div>
|
||||
{{ latestComment.content }}
|
||||
@@ -31,39 +39,70 @@
|
||||
<remark-component :section="section" :data="item" module_type="Transaction"></remark-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="col-3" v-else>
|
||||
<!-- <div class="col-2" >
|
||||
<p class="no-margin fs-10 all-caps invisible">Billing Question</p>
|
||||
<div>
|
||||
<span class="btn requestModal no-border invisible">
|
||||
<i class="fa fa-edit"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0 p-r-0 d-flex justify-content-center align-items-center">
|
||||
<div :class="[{'invisible': [5, 6, 3].includes(item.status)}]">
|
||||
<span class="d-inline-block m-r-15 text-primary bold text-underline pointer requestModal" data-type="billingRemark">Billing Question?</span>
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="billingRemark">
|
||||
<customer-invoice-remark-form-component module_type="Transaction" :data="item" :section="section"></customer-invoice-remark-form-component>
|
||||
</modal-component>
|
||||
<div v-if="item.documents.length">
|
||||
<div v-for="file in item.documents[0].files" v-bind:key="file.id" class="col-auto no-padding">
|
||||
<document-file-viewer-component :file="file">
|
||||
<template slot="button">
|
||||
<div class="btn bg-grey no-border muted">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewer-component>
|
||||
</div> -->
|
||||
<div class="col-2">
|
||||
<div class="row p-l-15">
|
||||
<div class="col-auto p-l-0 p-r-0 d-flex justify-content-center align-items-center">
|
||||
<div :class="[{'invisible': [5, 6, 3].includes(item.status)}]">
|
||||
<span class="d-inline-block text-primary bold text-underline pointer requestModal" data-type="billingRemark">Billing Question?</span>
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="billingRemark">
|
||||
<customer-invoice-remark-form-component module_type="Transaction" :data="item" :section="section"></customer-invoice-remark-form-component>
|
||||
</modal-component>
|
||||
<div v-if="item.documents.length">
|
||||
<div v-for="file in item.documents[0].files" v-bind:key="file.id" class="col-auto no-padding">
|
||||
<document-file-viewer-component :file="file">
|
||||
<template slot="button">
|
||||
<div class="btn bg-grey no-border muted">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewer-component>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="btn bg-grey no-border muted invisible">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="btn bg-grey no-border muted invisible">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
<div class="col-auto p-l-0 p-r-0 d-flex justify-content-center align-items-center" v-if="$store.getters.isSuperAdmin">
|
||||
<span class="d-inline-block text-primary bold text-underline pointer requestModal" data-type="deleteInvoice">
|
||||
<i class="fa fa-close"></i>
|
||||
</span>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteInvoice">
|
||||
<delete-invoice-form-component :data="item" :section="section"></delete-invoice-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="col-auto hide">
|
||||
<div class="btn btn-sm all-caps b-rad-none btn-block" :class="{'btn-success': !expanded, 'btn-default': expanded}" @click="expanded = !expanded">
|
||||
{{ expanded ? 'Cancel' : 'Make Payment' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0 p-r-0 d-flex justify-content-center align-items-center" v-if="$store.getters.isSuperAdmin">
|
||||
<span class="d-inline-block m-r-15 text-primary bold text-underline pointer requestModal" data-type="regenerateInvoice">
|
||||
<i class="fa fa-repeat"></i>
|
||||
</span>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="regenerateInvoice">
|
||||
<general-confirmation-form-component
|
||||
contentText="Are you sure you want to regenerate this Invoice?"
|
||||
modalType="delete"
|
||||
buttonText="Regenerate"
|
||||
class="text-center"
|
||||
:apiRoute="route('api.transaction.invoice.regenerate', item.id)"
|
||||
apiMethod="post"
|
||||
:section="section"
|
||||
>
|
||||
</general-confirmation-form-component>
|
||||
</modal-component>
|
||||
<span class="d-inline-block m-r-15 text-primary bold text-underline pointer requestModal" data-type="deleteInvoice">
|
||||
<i class="fa fa-close"></i>
|
||||
</span>
|
||||
|
||||
+26
-7
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="row m-b-15 m-l-5 m-r-10">
|
||||
<div class="row m-b-15 m-l-5 m-r-10 parentContainer">
|
||||
<div class="col bg-white rounded b-a" :class="{'b-white': !selected, 'b-primary': selected, 'bg-primary-lighter': selected, 'b-danger': item.status != 2, 'b-success': item.status == 2}">
|
||||
<div class="row">
|
||||
<div class="row parentContainer">
|
||||
<div class="col padding-20">
|
||||
<div class="row align-items-center">
|
||||
<div class="col">
|
||||
@@ -43,16 +43,38 @@
|
||||
</general-confirmation-form-component>
|
||||
</modal-component>
|
||||
<!-- payment method 1 -->
|
||||
<!-- <div class="col-auto pointer btn btn-success requestModal pointer" v-if="item.payment_method == 1 && item.status != 2" data-type="paymentProofModal" @click="selectedID(item.id)">
|
||||
<div class="col-auto pointer btn btn-success requestModal pointer" v-if="item.payment_method == 1 && [0, 4].includes(item.payment_transaction.status)" data-type="paymentProofModal" @click="selectedID(item.id)">
|
||||
<div class="no-border h-100">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="30" height="30" viewBox="0 0 172 172" style=" fill:#000000;"><defs><linearGradient x1="86" y1="70.76994" x2="86" y2="116.46013" gradientUnits="userSpaceOnUse" id="color-1_52139_gr1"><stop offset="0" stop-color="#ffffff"></stop><stop offset="1" stop-color="#ffffff"></stop></linearGradient><linearGradient x1="61.8125" y1="34.48869" x2="61.8125" y2="144.97181" gradientUnits="userSpaceOnUse" id="color-2_52139_gr2"><stop offset="0" stop-color="#ffffff"></stop><stop offset="1" stop-color="#ffffff"></stop></linearGradient><linearGradient x1="130.34375" y1="34.48869" x2="130.34375" y2="144.97181" gradientUnits="userSpaceOnUse" id="color-3_52139_gr3"><stop offset="0" stop-color="#ffffff"></stop><stop offset="1" stop-color="#ffffff"></stop></linearGradient><linearGradient x1="86" y1="32.25" x2="86" y2="148.71013" gradientUnits="userSpaceOnUse" id="color-4_52139_gr4"><stop offset="0" stop-color="#ffffff"></stop><stop offset="1" stop-color="#ffffff"></stop></linearGradient></defs><g fill="none" fill-rule="nonzero" stroke="none" stroke-width="1" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" font-family="none" font-weight="none" font-size="none" text-anchor="none" style="mix-blend-mode: normal"><path d="M0,172v-172h172v172z" fill="none"></path><g><path d="M102.45825,99.43213h-5.70825c-1.4835,0 -2.6875,1.16637 -2.6875,2.65256v8.10013c0,1.48081 -1.19862,2.68481 -2.67944,2.68481h-10.76612c-1.48081,0 -2.67944,-1.204 -2.67944,-2.68481v-8.10013c0,-1.48619 -1.204,-2.65256 -2.6875,-2.65256h-5.70825c-1.93769,0 -3.04225,-2.39188 -1.88125,-4.05275l14.577,-20.855c1.8275,-2.61494 5.69481,-2.61763 7.52231,-0.00538l14.577,20.86306c1.16369,1.66088 0.05644,4.05006 -1.87856,4.05006z" fill="url(#color-1_52139_gr1)"></path><path d="M51.0625,67.1875h5.375c0,-8.0625 7.23206,-16.12231 16.125,-16.12231v-5.375c-11.85456,0 -21.5,10.74731 -21.5,21.49731z" fill="url(#color-2_52139_gr2)"></path><path d="M139.75,80.625c0,-10.75 -8.44144,-18.80981 -18.8125,-18.80981v5.375c7.40944,0 13.4375,5.37231 13.4375,13.43481z" fill="url(#color-3_52139_gr3)"></path><path d="M148.09738,92.27263c1.59369,-3.68188 2.40263,-7.59219 2.40263,-11.64494c0,-16.29969 -13.26281,-29.5625 -29.5625,-29.5625c-6.5145,0 -12.68769,2.08819 -17.78588,5.96088c-4.30269,-13.03438 -16.52006,-22.08587 -30.58912,-22.08587c-17.78319,0 -32.25,14.46681 -32.25,32.25c0,4.14681 0.16662,8.05981 1.42437,10.74731h-1.42437c-13.33806,0 -24.1875,10.84944 -24.1875,24.1875c0,11.56431 8.16194,21.24737 19.0275,23.62044c1.02394,6.39894 6.53869,11.31706 13.2225,11.31706h56.4375h16.125h5.375c6.54944,0 12.00238,-4.71388 13.18488,-10.92469c9.2235,-1.20131 16.37762,-9.08913 16.37762,-18.63513c0,-6.09256 -2.924,-11.72019 -7.77762,-15.23006zM126.3125,131.6875h-5.375h-16.125h-56.4375c-3.49912,0 -6.45538,-2.6875 -7.568,-5.375h93.0735c-1.11263,2.6875 -4.06888,5.375 -7.568,5.375zM137.0625,120.9375h-96.75c-10.37106,0 -18.8125,-8.44144 -18.8125,-18.8125c0,-10.37106 8.44144,-18.8125 18.8125,-18.8125h9.51375l-1.68506,-3.78131c-2.23063,-5.01488 -2.45369,-7.48737 -2.45369,-12.341c0,-14.81888 12.05613,-26.875 26.875,-26.875c13.01825,0 24.13106,9.29875 26.42619,22.11275l0.92719,5.17075l3.64962,-3.77325c4.60638,-4.76225 10.77687,-7.38525 17.372,-7.38525c13.33806,0 24.1875,10.84944 24.1875,24.1875c0,3.6765 -0.81431,7.21056 -2.37575,10.41944l-1.763,3.32713l2.37037,1.26044c4.40481,2.34081 7.14338,6.88806 7.14338,11.868c0,7.40944 -6.02806,13.43481 -13.4375,13.43481z" fill="url(#color-4_52139_gr4)"></path></g></g></svg>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component type="paymentProofModal">
|
||||
<payment-verification-form-component v-if="selected_id === item.id" :section="section" :data="{...item, id: item.payment_transaction.id}"></payment-verification-form-component>
|
||||
</modal-component>
|
||||
<div class="col-auto" v-if="item.payment_method == 1 && [1, 2].includes(item.payment_transaction.status)">
|
||||
<div class="fs-10 all-caps">Payment Proof</div>
|
||||
<div v-if="item.payment_transaction.documents.length">
|
||||
<div v-for="file in item.payment_transaction.documents[0].files" v-bind:key="file.id" class="col-auto no-padding">
|
||||
<document-file-viewer-component :file="file">
|
||||
<template slot="button">
|
||||
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</div>
|
||||
</template>
|
||||
</document-file-viewer-component>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="btn bg-grey no-border muted invisible">
|
||||
<i class="fa fa-file-pdf-o"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto pointer btn btn-success invisible" v-else>
|
||||
<div class=" no-border h-100">
|
||||
<i class="fa fa-repeat fs-20 text-white"></i>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="btn bg-grey no-border" @click="expanded = !expanded">
|
||||
<i class="fa" :class="{'fa-angle-down': !expanded, 'fa-angle-up': expanded}" ></i>
|
||||
@@ -66,9 +88,6 @@
|
||||
<payments-billing-components :section="section" v-for="invoice in data.invoices" v-bind:key="invoice.id" :data="invoice" :selectedInvoice="selectedInvoice" v-on:input="updateList($event)"></payments-billing-components>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component type="paymentProofModal">
|
||||
<payment-verification-form-component v-if="selected_id === item.id" :section="section" :data="item"></payment-verification-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
+20
-1
@@ -3,7 +3,7 @@
|
||||
<div class="col">
|
||||
<div class="row" v-if="!item.transaction_bill">
|
||||
<div class="col">
|
||||
<div class="row bg-white ">
|
||||
<div class="row bg-white parentContainer">
|
||||
<div class="col p-t-10 p-b-10 p-r-0 pointer" @click="clickExpand()" :class="[{'bg-master-lighter': item.status === 1 && item.type !== 6}, {'bg-white': item.status !== 1 && item.status !== 4}, {'bg-warning-lighter': item.type === 6}]">
|
||||
<div class="row m-b-5">
|
||||
<div class="col-auto">
|
||||
@@ -43,6 +43,25 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" v-if="$store.getters.isSuperAdmin">
|
||||
<div class="row align-items-center h-100 bg-danger pointer requestModal" data-type="deleteInvoiceFunction">
|
||||
<div class="col">
|
||||
<i class="fa fa-times text-white"></i>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteInvoiceFunction">
|
||||
<general-confirmation-form-component
|
||||
contentText="Are you sure you want to delete this Payment?"
|
||||
modalType="delete"
|
||||
buttonText="Delete"
|
||||
class="text-center"
|
||||
:apiRoute="route('api.transaction.payment.delete', item.id)"
|
||||
apiMethod="delete"
|
||||
:section="section"
|
||||
>
|
||||
</general-confirmation-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center m-b-25" v-if="item.status === 0 && item.payment_method === 1">
|
||||
<div class="col-auto p-r-0">
|
||||
|
||||
+70
-10
@@ -2,25 +2,39 @@
|
||||
<div class="row m-b-10 parentContainer">
|
||||
<div class="col">
|
||||
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
|
||||
<div class="row p-b-5 b-b b-grey" v-show="!isLoading">
|
||||
<div class="row p-1 b-b b-grey" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col-auto">
|
||||
<div class="col-auto p-l-0">
|
||||
<div class="font-heading fs-10 muted all-caps">Date</div>
|
||||
<div class="font-heading fs-10">
|
||||
{{ item.updated_at }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Order</div>
|
||||
<div class="font-heading fs-10"><a :href="route('order.show' , item.order.reference)" target="_blank">{{item.order.reference}}</a></div>
|
||||
<div v-if="item.order">
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Order</div>
|
||||
<div class="font-heading fs-10"><a :href="route('order.show' , item.order.reference)" target="_blank">{{item.order.reference}}</a></div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Customer</div>
|
||||
<div class="font-heading fs-10">
|
||||
<a :href="route('customer.profile', item.order.company_module.marking)">{{item.order.company_module.marking}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Customer</div>
|
||||
<div class="font-heading fs-10">
|
||||
<a :href="route('customer.profile', item.order.company_module.marking)">{{item.order.company_module.marking}}</a>
|
||||
<div v-if="item.group_transactions">
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Group Payment</div>
|
||||
<div class="font-heading fs-10">{{item.group_reference}}</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Customer</div>
|
||||
<div class="font-heading fs-10">
|
||||
<a :href="route('customer.profile', item.group_transactions[0].order.company_module.marking)">{{item.group_transactions[0].order.company_module.marking}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
@@ -31,7 +45,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="col p-l-0">
|
||||
<div class="font-heading fs-10 muted all-caps">Payment Proof</div>
|
||||
<div class="row no-margin" v-if="item.payment_method !==5 && item.payment_method !==4">
|
||||
<div v-for="file in item.documents[0].files" v-bind:key="file.id" class="col-auto no-padding">
|
||||
@@ -132,6 +146,47 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10 m-b-10" v-if="item.group_transactions">
|
||||
<div class="col text-center p-l-0">
|
||||
<div id="expend-method" class="padding-10 bg-master-lightest pointer" @click="expanded = !expanded">
|
||||
<i class="fa m-r-10" :class="[{'fa-angle-up': expanded}, {'fa-angle-down': !expanded}]"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row b-t b-grey p-t-10" v-show="expanded" v-if="item.group_transactions">
|
||||
<div class="col">
|
||||
<div class="row p-b-10 b-b b-grey" v-for="(invoice, index) in item.group_transactions">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-1">
|
||||
<p class="no-margin fs-10 all-caps">{{ index + 1 }}.</p>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps bold">Invoice No</p>
|
||||
<div class="fs-10">{{ invoice.bill_no }}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps bold">Order</p>
|
||||
<div class="fs-10"><a :href="route('order.show', invoice.order.reference)">{{invoice.order.reference}}</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-1">
|
||||
<p class="no-margin fs-10 all-caps bold"></p>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps bold">Invoice Date</p>
|
||||
<div class="fs-10">{{ invoice.created_at }}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps bold">Amount</p>
|
||||
<div class="font-heading fs-14 text-success bold">{{ invoice.amount.toFixed(2) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -147,6 +202,11 @@
|
||||
props: {
|
||||
no_action: Boolean
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
expanded: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
approvePayment(status){
|
||||
this.isLoading = true;
|
||||
|
||||
+5
-2
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="row m-b-15 m-l-5 m-r-10">
|
||||
<div class="row m-b-15 m-l-5 m-r-10" v-if="$store.getters.isAdmin || item.order">
|
||||
<div class="col bg-white rounded b-a" :class="{'b-white': !selected, 'b-primary': selected, 'bg-primary-lighter': selected}">
|
||||
<div class="row">
|
||||
<div class="col padding-20">
|
||||
@@ -10,10 +10,13 @@
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Invoice No</p>
|
||||
<div>{{ item.bill_no }}</div>
|
||||
<p class="no-margin fs-10 all-caps">Reference</p>
|
||||
<div>{{ item.packing_list_reference }}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Order</p>
|
||||
<div><a :href="route('order.show', item.order.reference)">{{item.order.reference}}</a></div>
|
||||
<div v-if="item.order"><a :href="route('order.show', item.order.reference)">{{item.order.reference}}</a></div>
|
||||
<div class="text-danger" v-else>Error in retrieving order</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="no-margin fs-10 all-caps">Invoice Date</p>
|
||||
|
||||
+57
-54
File diff suppressed because one or more lines are too long
+83
-20
@@ -9,6 +9,43 @@
|
||||
<h6>Transaction History</h6>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10 m-b-10">
|
||||
<div class="col">
|
||||
<div class="d-flex align-items-center h-100">
|
||||
<span class="btn btn-md fs-11 bg-primary text-white fs-12 m-r-5" :class="[{'bg-primary-darker': showingPreciseAmount}]" @click="showingPreciseAmount=!showingPreciseAmount">{{ showingPreciseAmount ? 'Showing Precise Wallet Transaction' : 'Show Precise Wallet Transaction'}}</span>
|
||||
<a v-if="wallet" :href="route('wallet.details-export', wallet.id, showingPreciseAmount)" target="_blank" class="btn btn-md btn-primary fs-11"><i class="fa fa-download m-r-5"></i>{{ showingPreciseAmount ? 'Download Precise Transaction' : 'Download Transaction'}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<validation-wrapper-component selectable :validator="$v.showingTransactionCount">
|
||||
<label>Showing Rows</label>
|
||||
<select-component :options="[5, 10, 20, 30, 50]" v-model="showingTransactionCount"></select-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-5" @keyup.enter="submitSearch">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.reference_no">
|
||||
<label class="all-caps">Order Reference</label>
|
||||
<input type="text" class="form-control" v-model="reference_no">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.startDate">
|
||||
<label class="all-caps">Start Date</label>
|
||||
<date-picker-component v-model.lazy="startDate"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.endDate">
|
||||
<label class="all-caps">End Date</label>
|
||||
<date-picker-component v-model.lazy="endDate"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col col-md-auto d-flex justify-content-center align-items-center">
|
||||
<button type="button" class="btn btn-lg btn-primary fs-11 w-100" @click="submitSearch()">Search</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="wallet.transactions">
|
||||
<div class="col">
|
||||
<div class="row padding-10">
|
||||
@@ -19,17 +56,15 @@
|
||||
<div class="col-2 fs-10 text-right">Balance</div>
|
||||
</div>
|
||||
|
||||
<div class="row bg-white padding-10 m-b-10 rounded align-items-center" v-for="(item, index) in wallet.transactions" v-bind:key="item.id" :data="item">
|
||||
<div class="col-3 fs-12">{{item.created_at}}</div>
|
||||
<div class="col fs-12"><span v-html="item.description"></span> <a target=”_blank” v-if="[9,11].includes(item.type) " :href="route('transaction.credit_note.download', item.id)"><i class="fa fa-download fs-11 m-l-5 text-secondary hover-primary"></i></a></div>
|
||||
<div class="col-2 text-success text-center">{{[5, 9, 15].includes(parseFloat(item.type)) ? (Math.round((parseFloat(item.amount) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : ''}}</div>
|
||||
<div class="col-2 text-danger text-center">{{[2, 11].includes(parseFloat(item.type)) ? '- ' + (Math.round((parseFloat(item.amount) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : ''}}</div>
|
||||
<div class="col-2 text-right">{{remainingBalance(index)}}</div>
|
||||
</div>
|
||||
<list-component :key="key" section="walletTransactionSection" :endpoint="route('api.transaction.wallet.list')" :options="options">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<customer-wallet-transaction-component :data="data" :showingPreciseAmount="showingPreciseAmount" ></customer-wallet-transaction-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row align-items-center justify-content-center p-t-50 p-b-50" v-if="!wallet.transactions || !wallet.transactions.length">
|
||||
<!-- <div class="row align-items-center justify-content-center p-t-50 p-b-50" v-if="!wallet.transactions || !wallet.transactions.length">
|
||||
<div class="col-12">
|
||||
<div class="row align-items-center justify-content-center hint-text">
|
||||
<div class="col-4 hint-text"><img src="/images/not-found-illustration.png" class="w-100 hint-text"></div>
|
||||
@@ -49,7 +84,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<wallet-component :data="wallet" :company_module_id="id" section="CompanyWalletTransactionSection" :creditable=true></wallet-component>
|
||||
@@ -103,10 +138,22 @@ export default {
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
key: 1,
|
||||
section: 'customerTransactionSection',
|
||||
isLoading: true,
|
||||
wallet: null,
|
||||
attention: false
|
||||
showingPreciseAmount: false,
|
||||
showingTransactionCount: 10,
|
||||
attention: false,
|
||||
reference_no: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
options: {
|
||||
status_in: [2, 3],
|
||||
owner_type: 'App\\Models\\Wallet',
|
||||
owner_id: 0,
|
||||
per_page: this.showingTransactionCount
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -119,8 +166,17 @@ export default {
|
||||
if(inComplete){
|
||||
this.fetchWallet();
|
||||
}
|
||||
},
|
||||
showingTransactionCount() {
|
||||
this.key ++;
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
showingTransactionCount: { },
|
||||
reference_no: { },
|
||||
startDate: { },
|
||||
endDate: { },
|
||||
},
|
||||
created(){
|
||||
this.$store.dispatch('updateListQueue', {'name': this.section});
|
||||
},
|
||||
@@ -130,22 +186,29 @@ export default {
|
||||
var filters = {with_transactions: true};
|
||||
this.submit(route('api.wallet.company_module.show', this.id) + '?filters=' + JSON.stringify(filters), 'get', this.section, false, false);
|
||||
},
|
||||
remainingBalance(index) {
|
||||
let tempBalance = 0;
|
||||
submitSearch() {
|
||||
console.log("searcvhing");
|
||||
delete this.options.with_order_reference_like;
|
||||
delete this.options.created_after_or_equal;
|
||||
delete this.options.created_before_or_equal;
|
||||
|
||||
if(this.wallet){
|
||||
let transactions = this.wallet.transactions.slice().reverse();
|
||||
transactions.slice(0, transactions.length - index).map(function(transaction) {
|
||||
[2, 11].includes(transaction.type) ? tempBalance -= (transaction.amount) : tempBalance += (transaction.amount);
|
||||
return tempBalance
|
||||
}, 0);
|
||||
if (this.reference_no) {
|
||||
this.options.with_order_reference_like = this.reference_no
|
||||
}
|
||||
|
||||
return (Math.round((tempBalance + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
if (this.startDate) {
|
||||
this.options.created_after_or_equal = this.startDate
|
||||
}
|
||||
if (this.endDate) {
|
||||
this.options.created_before_or_equal = this.endDate
|
||||
}
|
||||
|
||||
this.key ++;
|
||||
},
|
||||
successHandler(response){
|
||||
this.isLoading = false;
|
||||
this.wallet = response.payload.data;
|
||||
this.options.owner_id = this.wallet.id
|
||||
this.key ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<div class="row bg-white padding-10 m-b-10 rounded align-datas-center">
|
||||
<div class="col-3 fs-12">{{data.created_at}}</div>
|
||||
<div class="col fs-12"><span v-html="data.description"></span> <a target=”_blank” v-if="[9,11].includes(data.type) " :href="route('transaction.credit_note.download', data.id)"><i class="fa fa-download fs-11 m-l-5 text-secondary hover-primary"></i></a></div>
|
||||
<div class="col-2 text-success text-center">{{[5, 9, 15].includes(parseFloat(data.type)) ? formatValue(data.amount) : ''}}</div>
|
||||
<div class="col-2 text-danger text-center">{{[2, 11].includes(parseFloat(data.type)) ? '- ' + formatValue(data.amount, ) : ''}}</div>
|
||||
<div class="col-2 text-right">{{formatValue(data.running_balance)}}</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
data: {
|
||||
required: true,
|
||||
type: Object
|
||||
},
|
||||
showingPreciseAmount: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
formatValue(value) {
|
||||
if (this.showingPreciseAmount) {
|
||||
return (Math.round((parseFloat(value) + Number.EPSILON) * 100000) / 100000).toLocaleString('en-US', { minimumFractionDigits: 5, maximumFractionDigits: 5 });
|
||||
}
|
||||
|
||||
return (Math.round((parseFloat(value) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler],
|
||||
}
|
||||
</script>
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="col">
|
||||
<div class="row align-items-center justify-content-center m-b-10">
|
||||
<div class="col-auto p-r-10">
|
||||
<h5 class="light">Welcome Abroad, we provide logistics services.</h5>
|
||||
<h5 class="light">Welcome Aboard, we provide logistics services.</h5>
|
||||
</div>
|
||||
<div class="col-auto b-a b-thick b-primary padding-5">
|
||||
<h5 class="light no-margin">Powered by technology, delivered by experts.</h5>
|
||||
@@ -310,4 +310,4 @@
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -25,9 +25,11 @@
|
||||
</button>
|
||||
</anchor-link-component>
|
||||
<div class="row align-items-center m-t-10 p-t-10 p-b-10 b-t b-grey muted all-caps fs-10">
|
||||
<div class="col-1">Version</div>
|
||||
<div class="col-1">Question Set</div>
|
||||
<div class="col-2">Question Text</div>
|
||||
<div class="col-1">Answer</div>
|
||||
<div class="col-1">Answer Text</div>
|
||||
<div class="col-1">Answer Value</div>
|
||||
<div class="col-1">Source System</div>
|
||||
<div class="col-1">Source Marking</div>
|
||||
<div class="col-2">Source Email</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@extends('layouts.base_no_login')
|
||||
@section('title', 'Share Your Feedback - CIEF Customer Service')
|
||||
@section('inner_content')
|
||||
<feedback-customer-section-component token="{{$token}}"></feedback-customer-section-component>
|
||||
@endsection
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
</div> --}}
|
||||
</div>
|
||||
<div class="row no-margin">
|
||||
<div class="col bg-white padding-25">
|
||||
<div class="col bg-white p-t-10">
|
||||
<div class="row tabsContainer tabContent" tab-name="payments">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
|
||||
@@ -42,10 +42,13 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$packages = $invoice_transaction->owner->packages;
|
||||
@php
|
||||
$billable_packing_list = $invoice_transaction->owner->packingLists()->first();
|
||||
$billable_packing_list = $billable_packing_list ? $billable_packing_list : $invoice_transaction->owner;
|
||||
$packages = $billable_packing_list->packages;
|
||||
$totalCBM = 0;
|
||||
$totalQty = 0;
|
||||
$order_reference = $invoice_transaction->owner->owner ? $invoice_transaction->owner->owner->reference : null;
|
||||
@endphp
|
||||
@foreach ($packages as $key => $package)
|
||||
@php
|
||||
@@ -57,7 +60,8 @@
|
||||
@endphp
|
||||
<tr>
|
||||
<td width="5%" class="center top">{{ $key + 1 }}</td>
|
||||
<td class="description">{!! $package->description !!}</td>
|
||||
<!-- <td class="description">{!! $package->description !!}</td> -->
|
||||
<td class="description">{!! $order_reference . '<br>' . $billable_packing_list->owner->reference !!}</td>
|
||||
<td width="15%" class="center top" style="text-align: center">
|
||||
{!! $measurement !!}
|
||||
</td>
|
||||
|
||||
@@ -129,6 +129,8 @@ $grandSubTotal = 0;
|
||||
@foreach ($invoice_transactions as $transaction)
|
||||
<pagebreak />
|
||||
@include('pages.pdfs.shipping_invoice_inner', ['invoice_transaction' => $transaction])
|
||||
<pagebreak />
|
||||
@include('pages.pdfs.packing_list_measurement', ['invoice_transaction' => $transaction])
|
||||
@endforeach
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
|
||||
<meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
|
||||
<meta charset="utf-8"/>
|
||||
<title>IZYIM Shipping</title>
|
||||
<title>@yield('title', 'IZYIM Shipping')</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"/>
|
||||
<link rel="apple-touch-icon" sizes="57x57" href="{{asset('images/favicon/apple-icon-57x57.png')}}">
|
||||
<link rel="apple-touch-icon" sizes="60x60" href="{{asset('images/favicon/apple-icon-60x60.png')}}">
|
||||
@@ -28,4 +28,4 @@
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<link href="{{ asset('css/vendor.css') }}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{ asset('css/site.css') }}" rel="stylesheet" type="text/css"/>
|
||||
<link href="{{ asset('css/site.css') }}" rel="stylesheet" type="text/css"/>
|
||||
|
||||
@@ -7,7 +7,11 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' =>
|
||||
Route::get('/list', 'ListTransactionsController@list')->name('list');
|
||||
Route::delete('/suspend/{id}', 'SuspendTransactionController@suspend')->name('suspend');
|
||||
Route::delete('/delete/{id}', 'DeleteTransactionController@delete')->name('delete');
|
||||
Route::delete('/delete-payment/{id}', 'DeletePaymentTransactionController@delete')->name('payment.delete');
|
||||
Route::put('{id}/status/update/{status}', 'UpdateTransactionStatusController@update')->where('status', 'approve|expire|reject')->name('update');
|
||||
route::post('/{invoice_id}/regenerate', 'RegenerateSingleShippingInvoiceTransactionController@regenerate')->name('invoice.regenerate');
|
||||
|
||||
Route::get('wallet/list', 'ListWalletTransactionsController@list')->name('wallet.list');
|
||||
|
||||
Route::group(['prefix' => 'payment', 'as' => 'payment.'], function () {
|
||||
Route::post('/create', 'CreatePaymentTransactionController@create')->name('create');
|
||||
|
||||
+33
-32
@@ -1,11 +1,8 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Jobs\FetchContainersStatusUpdateFromVTPortalJob;
|
||||
use App\Classes\Jobs\FetchDeliveryListFromVTPortalJob;
|
||||
use App\Classes\Jobs\FetchLoadedContainersFromVTPortalJob;
|
||||
use App\Classes\Jobs\FetchOrdersFromYDPortalJob;
|
||||
use App\Classes\Jobs\FetchPackingListFromVTPortalJob;
|
||||
use App\Classes\Jobs\FetchWarehouseReceiveListFromVTPortalJob;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
@@ -16,12 +13,9 @@ use App\Classes\Modules\PackingLists\Processors\FetchContainersFromYdPortalProce
|
||||
use App\Classes\Modules\PackingLists\Processors\FetchContainersUpdatesFromYdPortalProcessor;
|
||||
use App\Classes\Modules\PackingLists\Processors\FetchDeliveryUpdatesFromYdPortalProcessor;
|
||||
use App\Classes\Modules\PackingLists\Processors\FetchLoadedContainersFromVTPortalProcessor;
|
||||
use App\Classes\Modules\PackingLists\Processors\FetchOrderListsFromYdPortalProcessor;
|
||||
use App\Classes\Modules\PackingLists\Processors\FetchPackingListFromVTPortalProcessor;
|
||||
use App\Classes\Modules\PackingLists\Processors\FetchPackingListsFromYdPortalProcessor;
|
||||
use App\Classes\Modules\PackingLists\Services\ListsPackingLists;
|
||||
use App\Classes\Modules\Transactions\Processors\ApproveShippingInvoiceTransactionProcessor;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateInvoiceTransactionProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
@@ -30,7 +24,6 @@ use App\Classes\ValueObjects\Constants\PackageType;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use App\Models\CompanyConnection;
|
||||
use App\Models\CompanyModule;
|
||||
use App\Models\Document;
|
||||
@@ -436,9 +429,11 @@ Route::get('/warehouse/{id}/show', function ($id) {
|
||||
Route::get('/export/customer-latest-order-date/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');
|
||||
Route::get('/export/packing-list/{id}', 'Exports\ExportContainerPackingListController@export')->name('container.packaging_list.export');
|
||||
Route::get('/export/pending-arrangement-delivery-list', 'Exports\ExportPendingArrangementPackingListV2Controller@export')->name('packaging_list.pending_arrangement.export');
|
||||
Route::get('/export/on-hold-packing-list', 'Exports\ExportPendingArrangementPackingListV2Controller@onHold')->name('packaging_list.on_hold.export');
|
||||
// Route::get('/export/on-hold-packing-list', 'Exports\ExportPendingArrangementPackingListV2Controller@onHold')->name('packaging_list.on_hold.export');
|
||||
Route::get('/export/on-hold-packing-list', 'Exports\ExportPendingArrangementPackingListController@onHold')->name('packaging_list.on_hold.export');
|
||||
Route::get('/export/arrived-parcel', 'Exports\ExportArrivedParcelController@export')->name('packing_list.arrived_parcel.export');
|
||||
Route::get('/export/parcel-summary', 'Exports\ExportArrivedParcelController@summary');
|
||||
Route::get('/export/aging-list', 'Exports\ExportArrivedParcelController@aging')->name('aging-listing.export');
|
||||
Route::get('/export/parcel-postcode', 'Exports\ExportParcelPostcodesController@export');
|
||||
Route::get('/export/{year}/customer-total-order', 'Exports\ExportCustomersToExcelController@totalOrders');
|
||||
Route::get('/export/packing-list-warehouse/guangzhou2-to-johor', 'Exports\ExportArrivedParcelController@guangZhou2ToJohor');
|
||||
@@ -1067,6 +1062,8 @@ Route::get('/wallet/{marking}/details', function ($marking) {
|
||||
return view('pages.wallet.index', ['id' => $id, 'marking' => $marking]);
|
||||
})->name('wallet.details');
|
||||
|
||||
Route::get('/wallet/{wallet_id}/{is_precise}/export', 'Exports\ExportCustomersWalletTransactionToExcelController@export')->name('wallet.details-export');
|
||||
|
||||
Route::get('/wallet/audit', function (Request $request) {
|
||||
$wallets = \App\Models\Wallet::all();
|
||||
|
||||
@@ -1208,23 +1205,6 @@ Route::get('/404', function () {
|
||||
|
||||
Route::get('transaction/{id}/credit_note/download', 'Transactions\GenerateCreditNotePdfController@download')->name('transaction.credit_note.download');
|
||||
|
||||
Route::get('/check-successful-payment-or-topup', function () {
|
||||
$sum = 0 ;
|
||||
$transactions = Transaction::whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP, TransactionType::GROUP_PAYMENT])->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
|
||||
foreach ($transactions as $transaction){
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
|
||||
|
||||
if($response->successful()){
|
||||
$sum += $transaction->amount;
|
||||
dump($transaction->payment_reference . 'Amount : ' . $transaction->amount);
|
||||
}else{
|
||||
dump("billplz error</br>");
|
||||
}
|
||||
}
|
||||
|
||||
dump("Sum is : " . $sum);
|
||||
});
|
||||
|
||||
Route::get('/wallets/active', function(){
|
||||
$wallets = Wallet::all();
|
||||
|
||||
@@ -1232,17 +1212,38 @@ Route::get('/wallets/active', function(){
|
||||
foreach ($wallets as $wallet){
|
||||
$companyMarking = $wallet->owner->getMarking();
|
||||
echo '<tr>';
|
||||
echo '<td><a href="'.route('wallet.details', $companyMarking).'" target="_blank">'.$companyMarking.'</a></td>';
|
||||
echo '<td><a href="'.route('wallet.details', $companyMarking).'" target="_blank">'.$companyMarking.'</a>'."(".$wallet->id.")".'</td>';
|
||||
echo '<td>'.$wallet->amount.'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
});
|
||||
|
||||
Route::get('/accident-approve-invoice', function(){
|
||||
$invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE)->whereDate('updated_at', '2023-10-12')->get();
|
||||
Route::get('fix-payment-status-updated-but-failed-update-invoice', function (UpdatesTransactionStatus $updatesTransactionStatus, UpdateDoFromVTPortalProcessor $updateDoFromVTPortalProcessor, UpdateDoFromYDPortalProcessor $updateDoFromYDPortalProcessor) {
|
||||
$invoices = Transaction::where('type', TransactionType::SHIPPING_INVOICE)->whereIn('status', [2])
|
||||
->whereHas('transactions', function ($query) {
|
||||
$query->where('type', TransactionType::PAYMENT)
|
||||
->whereIn('status', [2, 3]);
|
||||
})->get();
|
||||
|
||||
|
||||
foreach ($invoices as $invoice) {
|
||||
$orderMarking = $invoice->owner->owner->reference;
|
||||
echo '<a href="'.route('order.v2.show', $orderMarking).'" target="_blank">'.$orderMarking.'</a><br>';
|
||||
echo "Fixing" . $invoice->owner->owner->reference . '<br>';
|
||||
|
||||
$totalPaidAmount = $invoice->transactions->where('type', TransactionType::PAYMENT)->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
|
||||
if (($invoice->amount - $totalPaidAmount) < 0.01) {
|
||||
$updatesTransactionStatus->execute($invoice, ApprovalStatus::COMPLETED);
|
||||
$packingList = $invoice->owner;
|
||||
$packingList->status = ApprovalStatus::APPROVED;
|
||||
$packingList->save();
|
||||
|
||||
if (app()->environment('production')) {
|
||||
$updateDoFromVTPortalProcessor->execute($packingList);
|
||||
$updateDoFromYDPortalProcessor->execute($packingList);
|
||||
}
|
||||
|
||||
echo 'done fix ' . $invoice->owner->owner->reference . '<br>';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user