mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'development' of gitlab.com:CIEFWorldwideSdnBhd/exchange-2.0
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<php>
|
||||
<ini name="display_errors" value="On" />
|
||||
<ini name="display_startup_errors" value="On" />
|
||||
</php>
|
||||
<phpunit
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="dryrun">
|
||||
<directory suffix="php">./tests/Browser/DryRun/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=base64:X521H/hWdbsG6S/JG0Q/BZgTo1azoV18kzqkqMQSDrQ=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
DB_CONNECTION=dusk
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=exchange-test
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=smtp.mailtrap.io
|
||||
MAIL_PORT=2525
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
|
||||
FILESYSTEM_DRIVER="documents"
|
||||
|
||||
JWT_SECRET=
|
||||
JWT_TTL=1440
|
||||
|
||||
SHIPPING_URL=http://shipping-portal.test/
|
||||
MIX_SHIPPING_URL="${SHIPPING_URL}"
|
||||
|
||||
BILLPLZ_BASE_URL="https://www.billplz-sandbox.com"
|
||||
BILLPLZ_API_KEY="0fa4c710-761b-4a7a-a501-c2c2d02643d5"
|
||||
BILLPLZ_X_SIGNATURE_KEY="S-pbNVthVRsvnPfZlgLwqqOg"
|
||||
BILLPLZ_COLLECTION_ID="hev2wdjy"
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Interfaces;
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
interface Notifiable
|
||||
{
|
||||
public function subject(): MorphTo;
|
||||
|
||||
public function target(): MorphTo;
|
||||
|
||||
public function causer(): MorphTo;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class CreateCustomerLogic extends AbstractControllerLogic
|
||||
|
||||
$this->assignSegmentProcessor->execute($company);
|
||||
|
||||
$this->generateEmailVerificationAttemptProcessor->execute($user);
|
||||
// $this->generateEmailVerificationAttemptProcessor->execute($user);
|
||||
|
||||
return $this->response($this->authenticationProcessor->execute($request));
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Banks\Standards\Rules\CanCreateBank;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBank;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBankLog;
|
||||
use App\Classes\Modules\Banks\DataTransferObjects\BankObject;
|
||||
use App\Http\Resources\BankResource;
|
||||
|
||||
@@ -32,19 +33,24 @@ class CreateBankLogic extends AbstractControllerLogic
|
||||
/** @var CreatesBank */
|
||||
private $createsBank;
|
||||
|
||||
/** @var CreatesBankLog */
|
||||
private $createsBankLog;
|
||||
|
||||
/**
|
||||
* CreateBankLogic constructor.
|
||||
* @param CanCreateBank $canCreateBank
|
||||
* @param CreatesBank $createsBank
|
||||
* @param CreatesBankLog $createsBankLog
|
||||
*/
|
||||
public function __construct(
|
||||
CanCreateBank $canCreateBank,
|
||||
CreatesBank $createsBank
|
||||
CreatesBank $createsBank,
|
||||
CreatesBankLog $createsBankLog
|
||||
)
|
||||
{
|
||||
$this->canCreateBank = $canCreateBank;
|
||||
$this->createsBank = $createsBank;
|
||||
$this->createsBankLog = $createsBankLog;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +62,6 @@ class CreateBankLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$bank_object = new BankObject($request->input('company_id'), $request->input('account_type'),
|
||||
$request->input('bank_name'), $request->input('holder_name'), $request->input('account_no'),
|
||||
$request->input('bank_branch'), $request->input('swift'), $request->input('snap'),
|
||||
@@ -66,6 +71,8 @@ class CreateBankLogic extends AbstractControllerLogic
|
||||
|
||||
$bank = $this->createsBank->execute($bank_object);
|
||||
|
||||
$bankLog = $this->createsBankLog->execute($bank);
|
||||
|
||||
return $this->resourceResponse(new BankResource($bank));
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Banks\Services\FetchesBank;
|
||||
use App\Classes\Modules\Banks\Standards\Rules\CanDeleteBank;
|
||||
use App\Classes\Modules\Banks\Services\DeletesBank;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBankLog;
|
||||
use App\Http\Resources\BankResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -33,22 +34,27 @@ class DeleteBankLogic extends AbstractControllerLogic
|
||||
/** @var FetchesBank */
|
||||
private $fetchesBank;
|
||||
|
||||
/** @var CreatesBankLog */
|
||||
private $createsBankLog;
|
||||
|
||||
/**
|
||||
* DeleteBankLogic constructor.
|
||||
* @param CanDeleteBank $canDeleteBank
|
||||
* @param DeletesBank $deletesBank
|
||||
* @param FetchesBank $fetchesBank
|
||||
* @param CreatesBankLog $createsBankLog
|
||||
*/
|
||||
public function __construct(
|
||||
CanDeleteBank $canDeleteBank,
|
||||
DeletesBank $deletesBank,
|
||||
FetchesBank $fetchesBank
|
||||
FetchesBank $fetchesBank,
|
||||
CreatesBankLog $createsBankLog
|
||||
)
|
||||
{
|
||||
$this->canDeleteBank = $canDeleteBank;
|
||||
$this->deletesBank = $deletesBank;
|
||||
$this->fetchesBank = $fetchesBank;
|
||||
$this->createsBankLog = $createsBankLog;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,7 +75,9 @@ class DeleteBankLogic extends AbstractControllerLogic
|
||||
throw new RequestValidationException('You can\'t delete bank account when it set to default');
|
||||
}
|
||||
|
||||
$this->deletesBank->execute($bank);
|
||||
$bank = $this->deletesBank->execute($bank);
|
||||
|
||||
$bankLog = $this->createsBankLog->execute($bank);
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ use App\Classes\Modules\Banks\Services\FetchesBank;
|
||||
|
||||
use App\Classes\Modules\Banks\Standards\Rules\CanUpdateBank;
|
||||
use App\Classes\Modules\Banks\Services\UpdatesBank;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBankLog;
|
||||
|
||||
use App\Classes\Modules\Banks\DataTransferObjects\BankObject;
|
||||
|
||||
use ErrorException;
|
||||
@@ -39,21 +41,27 @@ class UpdateBankLogic extends AbstractControllerLogic
|
||||
/** @var FetchesBank */
|
||||
private $fetchesBank;
|
||||
|
||||
/** @var CreatesBankLog */
|
||||
private $createsBankLog;
|
||||
|
||||
/**
|
||||
* UpdateBankLogic constructor.
|
||||
* @param CanUpdateBank $canUpdateBank
|
||||
* @param UpdatesBank $updatesBank
|
||||
* @param FetchesBank $fetchesBank
|
||||
* @param CreatesBankLog $createsBankLog
|
||||
*/
|
||||
public function __construct(
|
||||
CanUpdateBank $canUpdateBank,
|
||||
UpdatesBank $updatesBank,
|
||||
FetchesBank $fetchesBank
|
||||
FetchesBank $fetchesBank,
|
||||
CreatesBankLog $createsBankLog
|
||||
)
|
||||
{
|
||||
$this->canUpdateBank = $canUpdateBank;
|
||||
$this->updatesBank = $updatesBank;
|
||||
$this->fetchesBank = $fetchesBank;
|
||||
$this->createsBankLog = $createsBankLog;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,6 +92,8 @@ class UpdateBankLogic extends AbstractControllerLogic
|
||||
|
||||
$bank_query = $this->updatesBank->execute($bank, $bankObject);
|
||||
|
||||
$bankLog = $this->createsBankLog->execute($bank_query);
|
||||
|
||||
return $this->resourceResponse(new BankResource($bank_query));
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Http\Resources\BankResource;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Banks\Services\FetchesBank;
|
||||
use App\Classes\Modules\Banks\Services\UpdatesBankStatus;
|
||||
use App\Classes\Modules\Banks\Services\CreatesBankLog;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -28,18 +29,24 @@ class UpdateBankStatusLogic extends AbstractControllerLogic
|
||||
/** @var UpdatesBankStatus */
|
||||
private $updatesBankStatus;
|
||||
|
||||
/** @var CreatesBankLog */
|
||||
private $createsBankLog;
|
||||
|
||||
/**
|
||||
* UpdateBankStatusLogic constructor.
|
||||
* @param FetchesBank $fetchesBank
|
||||
* @param UpdatesBankStatus $updatesBankStatus
|
||||
* @param CreatesBankLog $createsBankLog
|
||||
*/
|
||||
public function __construct(
|
||||
FetchesBank $fetchesBank,
|
||||
UpdatesBankStatus $updatesBankStatus
|
||||
UpdatesBankStatus $updatesBankStatus,
|
||||
CreatesBankLog $createsBankLog
|
||||
)
|
||||
{
|
||||
$this->fetchesBank = $fetchesBank;
|
||||
$this->updatesBankStatus = $updatesBankStatus;
|
||||
$this->createsBankLog = $createsBankLog;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,6 +62,8 @@ class UpdateBankStatusLogic extends AbstractControllerLogic
|
||||
|
||||
$bank_query = $this->updatesBankStatus->execute($bank, $request->input('status'));
|
||||
|
||||
$bankLog = $this->createsBankLog->execute($bank_query);
|
||||
|
||||
return $this->resourceResponse(new BankResource($bank_query));
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Banks\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\Bank;
|
||||
use App\Models\BankLog;
|
||||
|
||||
class CreatesBankLog extends AbstractUpdateRecord
|
||||
{
|
||||
/**
|
||||
* @param Bank $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Bank $object) {
|
||||
$model = new BankLog();
|
||||
$model->bank_id = $object->id;
|
||||
$model->company_id = $object->company_id;
|
||||
$model->reference = $object->reference;
|
||||
$model->bank_name = $object->bank_name;
|
||||
$model->holder_name = $object->holder_name;
|
||||
$model->account_no = $object->account_no;
|
||||
$model->bank_branch = $object->bank_branch;
|
||||
$model->swift = $object->swift;
|
||||
$model->snap = $object->snap;
|
||||
$model->type = $object->type;
|
||||
$model->country_id = $object->country_id;
|
||||
return $this->handler($model);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Billplzs\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject;
|
||||
use App\Classes\Modules\Wallets\Services\UpdatesWallet;
|
||||
use App\Classes\Modules\Transactions\Processors\CreateCashBackTransactionProcessor;
|
||||
|
||||
use App\Classes\Exceptions\ResourceNotFoundException;
|
||||
use App\Classes\Modules\Wallets\Services\UpdatesWalletBalance;
|
||||
@@ -16,6 +17,7 @@ use Illuminate\Http\JsonResponse;
|
||||
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\Modules\Billplzs\Services\GetBillplzBill;
|
||||
use App\Classes\Modules\Billplzs\DataTransferObjects\BillplzXSignatureObject;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
@@ -40,6 +42,9 @@ class CallbackBillplzLogic
|
||||
/** @var UpdatesWalletBalance */
|
||||
private $updatesWalletBalance;
|
||||
|
||||
/** @var CreateCashBackTransactionProcessor */
|
||||
private $createCashBackTransactionProcessor;
|
||||
|
||||
/**
|
||||
* CallbackBillplzLogic constructor.
|
||||
* @param GetBillplzBill $getBillplzBill
|
||||
@@ -47,12 +52,13 @@ class CallbackBillplzLogic
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param UpdatesWalletBalance $updatesWalletBalance
|
||||
*/
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdatesWalletBalance $updatesWalletBalance)
|
||||
public function __construct(GetBillplzBill $getBillplzBill, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, UpdatesWalletBalance $updatesWalletBalance, CreateCashBackTransactionProcessor $createCashBackTransactionProcessor)
|
||||
{
|
||||
$this->getBillplzBill = $getBillplzBill;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->updatesWalletBalance = $updatesWalletBalance;
|
||||
$this->createCashBackTransactionProcessor = $createCashBackTransactionProcessor;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +86,7 @@ class CallbackBillplzLogic
|
||||
$status = ApprovalStatus::APPROVED;
|
||||
}
|
||||
|
||||
|
||||
if($billPlz->state === 'due') {
|
||||
$status = $billplzXSignatureObject->getStatus() === 'failed' ? ApprovalStatus::REJECTED : ApprovalStatus::PENDING_VERIFICATION;
|
||||
}
|
||||
@@ -93,6 +100,9 @@ class CallbackBillplzLogic
|
||||
|
||||
}
|
||||
|
||||
if ($transaction->type == TransactionType::PAYMENT) {
|
||||
$cash_back_transaction = $this->createCashBackTransactionProcessor->execute($transaction);
|
||||
}
|
||||
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
namespace App\Classes\Modules\Bookings\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
|
||||
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\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
|
||||
use App\Classes\Modules\Transactions\Processors\CreateCashBackTransactionProcessor;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -26,14 +26,15 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
|
||||
* @param ApprovesDocument $approvesDocument
|
||||
* @param RejectsDocument $rejectsDocument
|
||||
* @param FetchesDocument $fetchesDocument
|
||||
* @param CreateInvoiceTransactionProcessor $createInvoiceTransactionProcessor
|
||||
* @param CreateCashBackTransactionProcessor $createCashBackTransactionProcessor
|
||||
*/
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument)
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, CreateCashBackTransactionProcessor $createCashBackTransactionProcessor)
|
||||
{
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->approvesDocument = $approvesDocument;
|
||||
$this->rejectsDocument = $rejectsDocument;
|
||||
$this->createCashBackTransactionProcessor = $createCashBackTransactionProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,6 +59,9 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
|
||||
/** @var RejectsDocument */
|
||||
private $rejectsDocument;
|
||||
|
||||
/** @var CreateCashBackTransactionProcessor */
|
||||
private $createCashBackTransactionProcessor;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
@@ -65,7 +69,6 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$status = $request->route('status');
|
||||
|
||||
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('payment_id')]);
|
||||
@@ -74,7 +77,7 @@ class ApprovePaymentVerificationLogic extends AbstractControllerLogic
|
||||
|
||||
$this->updatesTransactionStatus->execute($transaction, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
|
||||
|
||||
// $this->createInvoiceTransactionProcessor->execute($transaction->booking);
|
||||
$this->createCashBackTransactionProcessor->execute($transaction);
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Http\Resources\TransactionResource;
|
||||
|
||||
use App\Classes\Modules\Transactions\Processors\CreateCashBackTransactionProcessor;
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\Wallet;
|
||||
@@ -64,6 +67,9 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var CreateCashBackTransactionProcessor */
|
||||
private $createCashBackTransactionProcessor;
|
||||
|
||||
/**
|
||||
* CreateBookingPaymentLogic constructor.
|
||||
* @param FetchesBookingQuotation $fetchBookingQuotation
|
||||
@@ -74,8 +80,9 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic
|
||||
* @param CreatesBillplzBill $createsBillplzBill
|
||||
* @param UpdatesWalletBalance $updatesWalletBalance
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param CreateCashBackTransactionProcessor $createCashBackTransactionProcessor
|
||||
*/
|
||||
public function __construct(FetchesBookingQuotation $fetchBookingQuotation, FetchesCompanyPaymentAttemptLimit $fetchesCompanyPaymentAttemptLimit, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreatesTransaction $createsTransaction, CalculatesBookingOutstanding $calculatesBookingOutstanding, CreatesBillplzBill $createsBillplzBill, UpdatesWalletBalance $updatesWalletBalance, UpdatesTransactionStatus $updatesTransactionStatus)
|
||||
public function __construct(FetchesBookingQuotation $fetchBookingQuotation, FetchesCompanyPaymentAttemptLimit $fetchesCompanyPaymentAttemptLimit, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreatesTransaction $createsTransaction, CalculatesBookingOutstanding $calculatesBookingOutstanding, CreatesBillplzBill $createsBillplzBill, UpdatesWalletBalance $updatesWalletBalance, UpdatesTransactionStatus $updatesTransactionStatus, CreateCashBackTransactionProcessor $createCashBackTransactionProcessor)
|
||||
{
|
||||
$this->fetchBookingQuotation = $fetchBookingQuotation;
|
||||
$this->fetchesCompanyPaymentAttemptLimit = $fetchesCompanyPaymentAttemptLimit;
|
||||
@@ -85,6 +92,7 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic
|
||||
$this->createsBillplzBill = $createsBillplzBill;
|
||||
$this->updatesWalletBalance = $updatesWalletBalance;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->createCashBackTransactionProcessor = $createCashBackTransactionProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,12 +134,11 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic
|
||||
}
|
||||
|
||||
$transaction_object = new TransactionObject($billNumber, TransactionType::PAYMENT, 1, $booking->company->id, 1, PaymentMethodType::WALLET, $amount, $amount, 1, 1, 1, 0, 0, null, ApprovalStatus::APPROVED, [], '');
|
||||
$this->createsTransaction->execute($wallet, $transaction_object);
|
||||
$transaction = $this->createsTransaction->execute($wallet, $transaction_object);
|
||||
|
||||
$paymentReference = $billNumber;
|
||||
|
||||
$this->updatesWalletBalance->execute($wallet, ($amount * -1));
|
||||
|
||||
}
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('PYMT-');
|
||||
@@ -144,6 +151,7 @@ class CreateBookingPaymentLogic extends AbstractControllerLogic
|
||||
|
||||
/** @var Transaction $transaction */
|
||||
$transaction = $this->createsTransaction->execute($booking, $object);
|
||||
$cash_back_transaction = $this->createCashBackTransactionProcessor->execute($transaction);
|
||||
|
||||
if(PaymentMethodType::PAYMENT_METHODS[$request->input('payment_method')] == PaymentMethodType::WALLET){
|
||||
$this->updatesTransactionStatus->execute($transaction, ApprovalStatus::APPROVED);
|
||||
|
||||
@@ -84,12 +84,14 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('RFD-');
|
||||
|
||||
|
||||
$refund = $transaction->transactions()->refunds()->sum('amount');
|
||||
|
||||
if($refund + $request->input('amount') > $transaction->original_amount) throw new MalformedRequestException('Your refund must not be greater than '. $transaction->original_amount .'.');
|
||||
|
||||
$transactionRefundCalculationObject = new TransactionRefundCalculationObject($booking, $transaction, $request->input('amount'));
|
||||
$amount = $transaction->booking->fix_currency_id == 1 ? $request->input('amount') : $request->input('amount') / $transaction->currency_rate;
|
||||
|
||||
|
||||
$transactionRefundCalculationObject = new TransactionRefundCalculationObject($booking, $transaction, $amount);
|
||||
$transactionRefundCalculationObject->init();
|
||||
|
||||
$object = new TransactionObject($billNumber, TransactionType::REFUND, 1, $booking->company->id,
|
||||
|
||||
@@ -14,6 +14,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Classes\Exceptions\MalformedRequestException;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
|
||||
class DownloadBookingDocumentLogic
|
||||
{
|
||||
@@ -26,9 +27,9 @@ class DownloadBookingDocumentLogic
|
||||
*/
|
||||
public function execute(Request $request)
|
||||
{
|
||||
|
||||
Auth::login(User::findOrFail(1));
|
||||
$zip_file = $request->input('type').'.zip';
|
||||
$document_type = str_replace(' ', '', $request->input('type'));
|
||||
$zip_file = $document_type.'.zip';
|
||||
$attachment = storage_path().'/app/documents/collections/' . $zip_file;
|
||||
|
||||
$zip = new ZipArchive();
|
||||
@@ -36,19 +37,42 @@ class DownloadBookingDocumentLogic
|
||||
|
||||
$bookings = Booking::where('status', ApprovalStatus::COMPLETED)
|
||||
->whereDate('created_at', '>=', Carbon::parse($request->input('startDate')))
|
||||
->whereDate('created_at', '<=', Carbon::parse($request->input('endDate')))->whereHas('transactions', function ($query) use ($request){
|
||||
->whereDate('created_at', '<=', Carbon::parse($request->input('endDate')))
|
||||
->whereHas('transactions', function ($query) use ($request){
|
||||
return $query->where('type', TransactionType::PAYMENT)->whereHas('transactions', function ($query) use ($request){
|
||||
return $query->where('type', TransactionType::BILL)->where('issuer', $request->input('supplier'));
|
||||
});
|
||||
})->get();
|
||||
|
||||
if (!count($bookings)) throw new MalformedRequestException('No available file to download');
|
||||
|
||||
foreach ($bookings as $booking) {
|
||||
$file = $booking->documents()->where('document_type', $request->input('type'))->first()->files()->first();
|
||||
$zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y') . '_' . $booking->marking . '.pdf');
|
||||
if (!count($bookings)) {
|
||||
return response()->json(['no file to download']);
|
||||
}
|
||||
|
||||
foreach ($bookings as $booking) {
|
||||
|
||||
if ($document_type == 'INVOICEPODO' || $document_type == 'INVOICEPODOSDO') {
|
||||
$invoice_file = $booking->documents()->where('document_type', DocumentType::INVOICE)->first()->files()->first();
|
||||
$purchase_file = $booking->documents()->where('document_type', DocumentType::PURCHASE_ORDER)->first()->files()->first();
|
||||
$deliver_file = $booking->documents()->where('document_type', DocumentType::DELIVER_ORDER)->first()->files()->first();
|
||||
if ($document_type == 'INVOICEPODOSDO') {
|
||||
$supplier_deliver_order_file = $booking->documents()->where('document_type', DocumentType::SUPPLIER_DELIVER_ORDER)->first()->files()->first();
|
||||
}
|
||||
|
||||
$zip->addFile(Storage::disk('documents')->path($invoice_file->file->file_info->original->file), 'invoice-' . $booking->created_at->format('d_m_Y') . '_' . $booking->marking . '.pdf');
|
||||
|
||||
$zip->addFile(Storage::disk('documents')->path($purchase_file->file->file_info->original->file), 'purchase-order-' . $booking->created_at->format('d_m_Y') . '_' . $booking->marking . '.pdf');
|
||||
|
||||
$zip->addFile(Storage::disk('documents')->path($deliver_file->file->file_info->original->file), 'deliver-' . $booking->created_at->format('d_m_Y') . '_' . $booking->marking . '.pdf');
|
||||
|
||||
$zip->addFile(Storage::disk('documents')->path($supplier_deliver_order_file->file->file_info->original->file), 'supplier-deliver-order-' . $booking->created_at->format('d_m_Y') . '_' . $booking->marking . '.pdf');
|
||||
}
|
||||
else {
|
||||
$file = $booking->documents()->where('document_type', $document_type)->first()->files()->first();
|
||||
$zip->addFile(Storage::disk('documents')->path($file->file->file_info->original->file), $booking->created_at->format('d_m_Y') . '_' . $booking->marking . '.pdf');
|
||||
}
|
||||
|
||||
}
|
||||
$zip->close();
|
||||
while (ob_get_level()) {
|
||||
ob_end_clean();
|
||||
|
||||
@@ -62,7 +62,6 @@ class FetchBookingPaymentQuotationLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$booking = Booking::find($request->route('id'));
|
||||
|
||||
$conversionObject = new CurrencyConversionObject(floatval(str_replace(',', '', $request->input('amount'))), $booking->convertible_currency_id, $booking->service_id, $booking->fix_currency_id === 1 ? 0:1, PaymentMethodType::PAYMENT_METHODS[$request->input('payment_method')]);
|
||||
|
||||
+19
-1
@@ -13,6 +13,9 @@ use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Documents\Services\FetchesDocument;
|
||||
|
||||
use App\Classes\Modules\Documents\Services\ApprovesDocument;
|
||||
use App\Classes\Modules\Notifications\DataTransferObjects\NotificationObject;
|
||||
Use App\Classes\Modules\Notifications\Processors\CreateNotificationProcessor;
|
||||
use App\Classes\General\Interfaces\Notifiable;
|
||||
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -46,6 +49,9 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
|
||||
/** @var UpdatesCompanyStatus */
|
||||
private $updatesCompanyStatus;
|
||||
|
||||
/** @var CreateNotificationProcessor */
|
||||
private $createNotificationProcessor;
|
||||
|
||||
/**
|
||||
* ApproveIdentificationDocumentLogic constructor.
|
||||
* @param CanApproveDocument $canApproveDocument
|
||||
@@ -53,14 +59,16 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
|
||||
* @param RejectsDocument $rejectsDocument
|
||||
* @param FetchesDocument $fetchesDocument
|
||||
* @param UpdatesCompanyStatus $updatesCompanyStatus
|
||||
* @param CreateNotificationProcessor $createNotificationProcessor
|
||||
*/
|
||||
public function __construct(CanApproveDocument $canApproveDocument, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, UpdatesCompanyStatus $updatesCompanyStatus)
|
||||
public function __construct(CanApproveDocument $canApproveDocument, ApprovesDocument $approvesDocument, RejectsDocument $rejectsDocument, FetchesDocument $fetchesDocument, UpdatesCompanyStatus $updatesCompanyStatus, CreateNotificationProcessor $createNotificationProcessor)
|
||||
{
|
||||
$this->canApproveDocument = $canApproveDocument;
|
||||
$this->approvesDocument = $approvesDocument;
|
||||
$this->rejectsDocument = $rejectsDocument;
|
||||
$this->fetchesDocument = $fetchesDocument;
|
||||
$this->updatesCompanyStatus = $updatesCompanyStatus;
|
||||
$this->createNotificationProcessor = $createNotificationProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,6 +92,16 @@ class ApproveIdentificationDocumentLogic extends AbstractControllerLogic
|
||||
|
||||
$this->updatesCompanyStatus->execute($document->owner, $status === 'approve' ? ApprovalStatus::APPROVED : ApprovalStatus::REJECTED);
|
||||
|
||||
$object = new NotificationObject(
|
||||
'ID Verification ' . ( $status === 'approve' ? 'Approved' : 'Rejected' ),
|
||||
( $status === 'approve' ? 'Dear user, congratulations that your ' : 'Dear user, we are sorry to inform you that your ' ) . ( $document->type === 'IDENTITY_CARD' ? 'IC' : 'SSM' ) . ( $status === 'approve' ? ' has been approved. Start your first order now!' : ' has been rejected due to ' . ( $request->input('rejectRemark') ?? '' ) . ', please resubmit it for further action.' ),
|
||||
$document->owner,
|
||||
$document->owner->employees()->first(),
|
||||
$document,
|
||||
);
|
||||
|
||||
$this->createNotificationProcessor->execute($object);
|
||||
|
||||
return $this->resourceResponse(new DocumentResource($document));
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Services\UpdatesCompanyStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Update Company Account Status',
|
||||
'message' => 'You have successfully updated the Company Account Status'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var UpdatesCompanyStatus */
|
||||
private $updatesCompanyStatus;
|
||||
|
||||
/**
|
||||
* UpdateCompanyStatusLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param UpdatesCompanyStatus $updatesCompanyStatus
|
||||
*/
|
||||
public function __construct(
|
||||
FetchesCompany $fetchesCompany,
|
||||
UpdatesCompanyStatus $updatesCompanyStatus
|
||||
)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->updatesCompanyStatus = $updatesCompanyStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$company = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
|
||||
$company_query = $this->updatesCompanyStatus->execute($company, $request->input('status'));
|
||||
|
||||
return $this->resourceResponse(new CompanyResource($company_query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,9 +46,10 @@ class CreateCompanyProcessor
|
||||
public function execute(Request $request, int $businessType = BusinessType::IMPORTER, ?int $companyType = CompanyType::COMPANY_BUSINESS, ?int $status = ApprovalStatus::PENDING_SUBMISSION): Model {
|
||||
|
||||
$companyName = $companyType === CompanyType::COMPANY_BUSINESS ? $request->input('company_name') : $request->input('name');
|
||||
$companyReference = $request->input('company_reference') ? $request->input('company_reference') : mt_rand(1000, 9999).(new GeneratesInitials())->name($companyName)->length(3)->generate();
|
||||
$company_object = new CompanyObject(
|
||||
$companyName,
|
||||
mt_rand(1000, 9999).(new GeneratesInitials())->name($companyName)->length(3)->generate(),
|
||||
$companyReference,
|
||||
$businessType, $companyType, $status);
|
||||
|
||||
$this->canCreateCompany->passes($company_object);
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Transaction;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ExportsBookingTransactions implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Ref No',
|
||||
'Creted Date',
|
||||
'Amount',
|
||||
'Rate',
|
||||
'Supplier'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$supplierIds = array_map(function($value){
|
||||
return ['id' => $value];
|
||||
}, json_decode($this->request->input('supplierIds')));
|
||||
|
||||
$dateFrom =Carbon::parse($this->request->input('startDate'))->format('Y-m-d');
|
||||
$dateTo =Carbon::parse($this->request->input('endDate'))->format('Y-m-d');
|
||||
|
||||
return Transaction::where('type', 3)->whereIn('issuer', $supplierIds)->whereBetween('created_at', [$dateFrom, $dateTo]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $transaction
|
||||
* @return array
|
||||
*/
|
||||
public function map($transaction): array
|
||||
{
|
||||
$supplierName = Company::where('id', $transaction->issuer)->get()->first()->name;
|
||||
$refNo = $transaction->owner->owner == null ? $transaction->owner->marking : $transaction->owner->owner->marking;
|
||||
|
||||
$createdAt = $transaction->created_at->format('d-m-Y');
|
||||
$amount = $transaction->amount;
|
||||
$rate = $transaction->currency_rate;
|
||||
|
||||
return [
|
||||
$refNo,
|
||||
$createdAt,
|
||||
$amount,
|
||||
$rate,
|
||||
$supplierName
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,9 @@ use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
|
||||
class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping
|
||||
class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping, ShouldAutoSize
|
||||
{
|
||||
|
||||
use Exportable;
|
||||
@@ -89,6 +90,7 @@ class ExportsTransactions implements FromQuery, WithHeadingRow, WithMapping
|
||||
$transactionStatus[$transaction->status],
|
||||
\PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($transaction->created_at),
|
||||
\PhpOffice\PhpSpreadsheet\Shared\Date::dateTimeToExcel($transaction->updated_at),
|
||||
$marking
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Notifications\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Notifications\Services\ListsNotification;
|
||||
use App\Http\Resources\NotificationResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListNotificationsLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieve Notifications',
|
||||
'message' => 'You have successfully retrieved a list of Notifications'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var ListsNotification */
|
||||
private $listsNotification;
|
||||
|
||||
/**
|
||||
* ListNotificationsLogic constructor.
|
||||
* @param ListsNotification $listsNotification
|
||||
*/
|
||||
public function __construct(
|
||||
ListsNotification $listsNotification
|
||||
)
|
||||
{
|
||||
$this->listsNotification = $listsNotification;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$filters = [
|
||||
// 'target_id'=>auth()->user()->id,
|
||||
// 'per_page'=>$request->route('per_page')
|
||||
];
|
||||
|
||||
$notifications = $this->listsNotification->execute($filters);
|
||||
|
||||
return $this->collectionResponse(NotificationResource::collection($notifications));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Notifications\DataTransferObjects;
|
||||
|
||||
use App\Classes\General\Interfaces\Notifiable;
|
||||
use App\Classes\General\Interfaces\DataTransferObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
|
||||
class NotificationObject implements DataTransferObject
|
||||
{
|
||||
/** @var string */
|
||||
private $title;
|
||||
|
||||
/** @var string */
|
||||
private $description;
|
||||
|
||||
/** @var Notifiable */
|
||||
private $subject;
|
||||
|
||||
/** @var Notifiable */
|
||||
private $target;
|
||||
|
||||
/** @var Notifiable */
|
||||
private $causer;
|
||||
|
||||
/** @var int|null */
|
||||
private $status;
|
||||
|
||||
/**
|
||||
* OrderObject constructor.
|
||||
* @param string $reference
|
||||
* @param int $type
|
||||
* @param int|null $status
|
||||
*/
|
||||
public function __construct(
|
||||
string $title,
|
||||
string $description,
|
||||
Notifiable $subject,
|
||||
Notifiable $target,
|
||||
Notifiable $causer,
|
||||
?int $status = ApprovalStatus::PENDING_VERIFICATION
|
||||
)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->description = $description;
|
||||
$this->subject = $subject;
|
||||
$this->target = $target;
|
||||
$this->causer = $causer;
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Notifiable
|
||||
*/
|
||||
public function getSubject(): Notifiable
|
||||
{
|
||||
return $this->subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Notifiable
|
||||
*/
|
||||
public function getTarget(): Notifiable
|
||||
{
|
||||
return $this->target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Notifiable
|
||||
*/
|
||||
public function getCauser(): Notifiable
|
||||
{
|
||||
return $this->causer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getStatus(): int
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Notifications\Processors;
|
||||
|
||||
use App\Classes\Modules\Notifications\DataTransferObjects\NotificationObject;
|
||||
use App\Classes\Modules\Notifications\Services\CreatesNotification;
|
||||
|
||||
class CreateNotificationProcessor
|
||||
{
|
||||
/** @var CreatesNotification */
|
||||
private $createsNotification;
|
||||
|
||||
/**
|
||||
* CreateNotificationProcessor constructor.
|
||||
* @param CreatesNotification $createsNotification
|
||||
*/
|
||||
public function __construct(CreatesNotification $createsNotification)
|
||||
{
|
||||
$this->createsNotification = $createsNotification;
|
||||
}
|
||||
|
||||
public function execute(NotificationObject $object)
|
||||
{
|
||||
$notification = $this->createsNotification->execute($object);
|
||||
return $notification;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Notifications\Services;
|
||||
|
||||
use App\Classes\Modules\Notifications\DataTransferObjects\NotificationObject;
|
||||
use App\Models\Notification;
|
||||
|
||||
class CreatesNotification
|
||||
{
|
||||
/**
|
||||
* @param NotificationObject $object
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(NotificationObject $object) {
|
||||
$model = new Notification();
|
||||
$model->title = $object->getTitle();
|
||||
$model->description = $object->getDescription();
|
||||
$model->status = $object->getStatus();
|
||||
$model->subject_type = get_class($object->getSubject());
|
||||
$model->subject_id = $object->getSubject()->id;
|
||||
$model->target_type = get_class($object->getTarget());
|
||||
$model->target_id = $object->getTarget()->id;
|
||||
$model->causer_type = get_class($object->getCauser());
|
||||
$model->causer_id = $object->getCauser()->id;
|
||||
$model->save();
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Notifications\Services;
|
||||
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractListRecord;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Models\Notification;
|
||||
|
||||
class ListsNotification extends AbstractListRecord
|
||||
{
|
||||
|
||||
/** @var Bank */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsBank constructor.
|
||||
* @param Notification $repository
|
||||
*/
|
||||
public function __construct(Notification $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Transactions\Processors\CreateSupplierTransactionProcessor;
|
||||
use App\Models\Document;
|
||||
use App\Models\Group;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
|
||||
@@ -71,6 +73,44 @@ class CreateSupplierTransactionLogic extends AbstractControllerLogic
|
||||
|
||||
if(!count($this->createSupplierTransactionProcessor->getBills())) return $this->response([]);
|
||||
|
||||
$group = new Group();
|
||||
$group->save();
|
||||
|
||||
$issuer = '';
|
||||
$receiver = '';
|
||||
$amount = 0;
|
||||
$original_amount = 0;
|
||||
$currency_id = 0;
|
||||
$original_currency_id = '';
|
||||
$currency_rate = '';
|
||||
$tax = 0;
|
||||
$service_charge = 0;
|
||||
|
||||
foreach ($this->createSupplierTransactionProcessor->getBills() as $key => $row) {
|
||||
$group->transactions()->sync($row->id, false);
|
||||
$issuer = $row->issuer;
|
||||
$receiver = $row->receiver;
|
||||
$amount += $row->amount;
|
||||
$original_amount += $row->original_amount;
|
||||
$currency_id = $row->currency_id;
|
||||
$original_currency_id = $row->original_currency_id;
|
||||
$currency_rate = $row->currency_rate;
|
||||
$tax += $row->tax;
|
||||
$service_charge += $row->service_charge;
|
||||
}
|
||||
|
||||
$group->issuer = $issuer;
|
||||
$group->receiver = $receiver;
|
||||
$group->amount = $amount;
|
||||
$group->original_amount = $original_amount;
|
||||
$group->currency_id = $currency_id;
|
||||
$group->original_currency_id = $original_currency_id;
|
||||
$group->currency_rate = $currency_rate;
|
||||
$group->tax = $tax;
|
||||
$group->service_charge = $service_charge;
|
||||
|
||||
$group->update();
|
||||
|
||||
$pdf = LaravelMpdf::loadView('pages.pdfs.currency_vendor_order', ['transactions' => $this->createSupplierTransactionProcessor->getBills(), 'transferFeeTransactions' => $this->createSupplierTransactionProcessor->getTransferTransactions(), 'supplier' => $supplier]);
|
||||
|
||||
$object = new DocumentObject(
|
||||
@@ -85,6 +125,7 @@ class CreateSupplierTransactionLogic extends AbstractControllerLogic
|
||||
$document = $this->createsDocument->execute($supplier, $object);
|
||||
$this->createsFile->execute($document, $object);
|
||||
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesGroup;
|
||||
use App\Classes\Modules\Transactions\Services\DeletesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\updatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\GroupResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DeleteGroupLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Delete Group Transaction',
|
||||
'message' => 'You have successfully deleted this Group Transaction'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var FetchesGroup */
|
||||
private $fetchesGroup;
|
||||
|
||||
/** @var DeletesTransaction */
|
||||
private $deletesTransaction;
|
||||
|
||||
public function __construct(
|
||||
UpdatesTransactionStatus $updatesTransactionStatus,
|
||||
FetchesGroup $fetchesGroup,
|
||||
DeletesTransaction $deletesTransaction
|
||||
)
|
||||
{
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->fetchesGroup = $fetchesGroup;
|
||||
$this->deletesTransaction = $deletesTransaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$group = $this->fetchesGroup->execute(['id' => $request->route('id')]);
|
||||
|
||||
$items = $group->transactions()->get();
|
||||
|
||||
foreach($items as $item) {
|
||||
$bill = $item;
|
||||
$payment = $bill->owner;
|
||||
$group->transactions()->detach($bill->id);
|
||||
$this->updatesTransactionStatus->execute($payment, ApprovalStatus::APPROVED);
|
||||
$this->deletesTransaction->execute($bill);
|
||||
}
|
||||
|
||||
$group->delete();
|
||||
|
||||
return $this->resourceResponse(new GroupResource($group));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\ListsGroups;
|
||||
use App\Http\Resources\GroupResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListGroupsLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* ListTransactionsLogic constructor.
|
||||
* @param ListsGroups $listsGroups
|
||||
*/
|
||||
public function __construct(ListsGroups $listsGroups)
|
||||
{
|
||||
$this->listsGroups = $listsGroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Groups',
|
||||
'message' => 'You have successfully retrieved a list of groups'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var ListsGroups */
|
||||
private $listsGroups;
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$query = $this->listsGroups->execute($this->listsGroups->deserializeFilters($request->input('filters')));
|
||||
|
||||
return $this->collectionResponse(GroupResource::collection($query));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Http\Resources\GroupResource;
|
||||
use App\Models\SegmentConstant;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Transactions\Services\CalculatesTransactionServiceCharge;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesGroup;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\CalculatesTransactionTransferFee;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use ErrorException;
|
||||
|
||||
class UpdateGroupLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Update Group Transaction',
|
||||
'message' => 'You have successfully updated this Group Transaction'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesGroup */
|
||||
private $fetchesGroup;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var CalculatesTransactionServiceCharge */
|
||||
private $calculatesTransactionServiceCharge;
|
||||
|
||||
/** @var UpdatesTransaction */
|
||||
private $updatesTransaction;
|
||||
|
||||
/** @var CalculatesTransactionTransferFee */
|
||||
private $calculatesTransactionTransferFee;
|
||||
|
||||
public function __construct(
|
||||
FetchesGroup $fetchesGroup,
|
||||
FetchesCompany $fetchesCompany,
|
||||
CalculatesTransactionServiceCharge $calculatesTransactionServiceCharge,
|
||||
UpdatesTransaction $updatesTransaction,
|
||||
CalculatesTransactionTransferFee $calculatesTransactionTransferFee
|
||||
)
|
||||
{
|
||||
$this->fetchesGroup = $fetchesGroup;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->calculatesTransactionServiceCharge = $calculatesTransactionServiceCharge;
|
||||
$this->updatesTransaction = $updatesTransaction;
|
||||
$this->calculatesTransactionTransferFee = $calculatesTransactionTransferFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$group = $this->fetchesGroup->execute(['id' => $request->route('id')]);
|
||||
|
||||
$transactions = $group->transactions()->get();
|
||||
|
||||
$rate = $request->input('rate');
|
||||
|
||||
$supplier = $this->fetchesCompany->execute(['id' => $request->input('supplier_id')]);
|
||||
|
||||
foreach($transactions as $transaction) {
|
||||
|
||||
$constant = SegmentConstant::where('reference', SegmentConstants::SERVICE_CHARGE)->where('detail->id', $supplier->id)->first();
|
||||
$serviceCharge = $this->calculatesTransactionServiceCharge->execute($transaction->original_amount, $rate, $constant);
|
||||
|
||||
$object = new TransactionObject(
|
||||
$transaction->bill_no,
|
||||
TransactionType::BILL,
|
||||
$supplier->id,
|
||||
1,
|
||||
$supplier->banks()->where('default', true)->first()->id,
|
||||
PaymentMethodType::CASH,
|
||||
$transaction->original_amount * (1 / $rate),
|
||||
$transaction->original_amount,
|
||||
1,
|
||||
$transaction->original_currency_id,
|
||||
$rate,
|
||||
0,
|
||||
$serviceCharge,
|
||||
null,
|
||||
ApprovalStatus::PENDING_VERIFICATION
|
||||
);
|
||||
|
||||
$billTransaction = $this->updatesTransaction->execute($transaction, $object);
|
||||
|
||||
$transferTransaction = $transaction->transactions()->where('type', TransactionType::TRANSFER_FEE)->first();
|
||||
|
||||
$transferFee = $this->calculatesTransactionTransferFee->execute($billTransaction->amount, $constant);
|
||||
|
||||
$object = new TransactionObject(
|
||||
$transferTransaction->bill_no,
|
||||
TransactionType::TRANSFER_FEE,
|
||||
1,
|
||||
$supplier->id,
|
||||
$supplier->banks()->where('default', true)->first()->id,
|
||||
PaymentMethodType::CASH,
|
||||
$transaction->original_amount,
|
||||
$transaction->original_amount,
|
||||
$transaction->original_currency_id,
|
||||
$transaction->original_currency_id,
|
||||
1,
|
||||
0,
|
||||
$transferFee,
|
||||
null,
|
||||
ApprovalStatus::PENDING_VERIFICATION
|
||||
);
|
||||
|
||||
$this->updatesTransaction->execute($transferTransaction, $object);
|
||||
}
|
||||
|
||||
$group->issuer = $supplier;
|
||||
$group->amount = $group->transactions()->sum('amount');
|
||||
$group->currency_rate = $rate;
|
||||
$group->tax = $group->transactions()->sum('tax');
|
||||
$group->service_charge = $group->transactions()->sum('service_charge');
|
||||
|
||||
$group->save();
|
||||
|
||||
return $this->resourceResponse(new GroupResource($group));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransactionDetail;
|
||||
use App\Classes\Modules\Transactions\Services\DeletesTransactionDetails;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\Modules\Wallets\Processors\CreditWalletProcessor;
|
||||
|
||||
use App\Classes\Modules\Wallets\Services\CreatesWallet;
|
||||
use App\Classes\Modules\Wallets\Services\GeneratesWalletCode;
|
||||
use App\Classes\ValueObjects\Constants\CashBack;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Transaction;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CreateCashBackTransactionProcessor
|
||||
{
|
||||
|
||||
/** @var CreatesTransaction */
|
||||
private $createsTransaction;
|
||||
|
||||
|
||||
/** @var GeneratesTransactionBillNumber */
|
||||
private $generatesTransactionBillNumber;
|
||||
|
||||
|
||||
/** @var CreditWalletProcessor */
|
||||
private $creditWalletProcessor;
|
||||
|
||||
/**
|
||||
* CreateCashBackTransactionProcessor constructor.
|
||||
* @param CreatesTransaction $createsTransaction
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
* @param CreditWalletProcessor $creditWalletProcessor
|
||||
*/
|
||||
public function __construct(CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CreditWalletProcessor $creditWalletProcessor)
|
||||
{
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->creditWalletProcessor = $creditWalletProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Transaction $transaction
|
||||
* @return Transaction|\Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Transaction $transaction)
|
||||
{
|
||||
// leave this disabled until ready to launch to production
|
||||
return;
|
||||
// ((MYR) * (cash back %)) * (1/conversion rate)
|
||||
$current_total_cash_back = Transaction::
|
||||
where('type', TransactionType::CASH_BACK)
|
||||
->whereMonth('created_at', Carbon::now()->month)->sum('amount');
|
||||
|
||||
if (
|
||||
$current_total_cash_back < CashBack::MAX &&
|
||||
$transaction->owner()->first()->transactions()->where('type', TransactionType::PURCHASE_ORDER)->whereIn('status', [ApprovalStatus::PENDING_VERIFICATION, ApprovalStatus::APPROVED])->count() > 0
|
||||
) {
|
||||
|
||||
$cash_back_segemnt = CashBack::SEGMENT;
|
||||
|
||||
foreach ($cash_back_segemnt as $key => $row) {
|
||||
if ($row['max_value'] > $transaction->amount && $row['min_value'] <= $transaction->amount) {
|
||||
|
||||
$method = $this->getRandomWeightedElement($row['weight']);
|
||||
|
||||
$total = $transaction->amount * $row['percent'][$method];
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('CBACK-');
|
||||
|
||||
$object = new TransactionObject(
|
||||
$billNumber,
|
||||
TransactionType::CASH_BACK,
|
||||
$transaction->issuer,
|
||||
1,
|
||||
1,
|
||||
PaymentMethodType::WALLET,
|
||||
$total,
|
||||
$total,
|
||||
$transaction->currency_id,
|
||||
$transaction->currency_id,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
null,
|
||||
ApprovalStatus::APPROVED,
|
||||
null,
|
||||
'cash back ' . $transaction->bill_no
|
||||
);
|
||||
|
||||
$cash_back_transaction = $this->createsTransaction->execute($transaction, $object);
|
||||
|
||||
$company = $transaction->owner()->first()->company;
|
||||
$credit = $this->creditWalletProcessor->execute($company, $transaction->type, $cash_back_transaction->amount, 'cash back ' . $transaction->bill_no);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $transaction;
|
||||
}
|
||||
|
||||
public function getRandomWeightedElement(array $weightedValues) {
|
||||
$rand = mt_rand(1, (int) array_sum($weightedValues));
|
||||
foreach ($weightedValues as $key => $value) {
|
||||
$rand -= $value;
|
||||
if ($rand <= 0) {
|
||||
return $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
|
||||
|
||||
class CreateInvoiceDocumentProcessor
|
||||
{
|
||||
/** @var CreatesDocument */
|
||||
private $createsDocument;
|
||||
|
||||
/** @var CreatesFiles */
|
||||
private $createsFile;
|
||||
|
||||
/**
|
||||
* CreateInvoiceDocumentProcessor constructor.
|
||||
* @param CreatesDocument $createsDocument
|
||||
* @param CreatesFiles $createsFile
|
||||
*/
|
||||
public function __construct(CreatesDocument $createsDocument, CreatesFiles $createsFile)
|
||||
{
|
||||
$this->createsDocument = $createsDocument;
|
||||
$this->createsFile = $createsFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function execute($transaction, $purchaseOrder, $supplier, $document_type)
|
||||
{
|
||||
$lowercaseDocumentType = strtolower($document_type);
|
||||
|
||||
$order_pdf = LaravelMpdf::loadView('pages.pdfs.' . $lowercaseDocumentType, ['transaction' => $transaction, 'po_order_transaction' => $purchaseOrder, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
$document_type,
|
||||
[chunk_split('data:application/pdf;base64,' . base64_encode($order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
$lowercaseDocumentType . 's'
|
||||
);
|
||||
|
||||
$document = $this->createsDocument->execute($purchaseOrder->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
}
|
||||
}
|
||||
@@ -11,20 +11,14 @@ use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingPaidAmount;
|
||||
use App\Classes\Modules\Bookings\Services\CalculatesBookingCurrencyAverageRate;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\Modules\Bookings\Services\UpdatesBookingStatus;
|
||||
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Models\Booking;
|
||||
use App\Models\Document;
|
||||
use App\Models\SegmentConstant;
|
||||
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
|
||||
|
||||
class CreateInvoiceTransactionProcessor
|
||||
{
|
||||
@@ -55,15 +49,12 @@ class CreateInvoiceTransactionProcessor
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var CreatesDocument */
|
||||
private $createsDocument;
|
||||
|
||||
/** @var CreatesFiles */
|
||||
private $createsFile;
|
||||
|
||||
/** @var UpdatesBookingStatus */
|
||||
private $updatesBookingStatus;
|
||||
|
||||
/** @var CreateInvoiceDocumentProcessor */
|
||||
private $invoiceDocumentProcessor;
|
||||
|
||||
/**
|
||||
* CreateInvoiceTransactionProcessor constructor.
|
||||
* @param ListsTransactions $listsTransactions
|
||||
@@ -75,11 +66,10 @@ class CreateInvoiceTransactionProcessor
|
||||
* @param FetchesServiceConfigurations $fetchesServiceConfigurations
|
||||
* @param CalculatesBookingCurrencyAverageRate $calculatesBookingCurrencyAverageRate
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param CreatesDocument $createsDocument
|
||||
* @param CreatesFiles $createsFile
|
||||
* @param UpdatesBookingStatus $updatesBookingStatus
|
||||
* @param CreateInvoiceDocumentProcessor $invoiceDocumentProcessor
|
||||
*/
|
||||
public function __construct(ListsTransactions $listsTransactions, CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CalculatesBookingPaidAmount $calculatesBookingPaidAmount, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingTransferredAmount $calculatesBookingTransferredAmount, FetchesServiceConfigurations $fetchesServiceConfigurations, CalculatesBookingCurrencyAverageRate $calculatesBookingCurrencyAverageRate, FetchesCompany $fetchesCompany, CreatesDocument $createsDocument, CreatesFiles $createsFile, UpdatesBookingStatus $updatesBookingStatus)
|
||||
public function __construct(ListsTransactions $listsTransactions, CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CalculatesBookingPaidAmount $calculatesBookingPaidAmount, CalculatesBookingPayableAmount $calculatesBookingPayableAmount, CalculatesBookingTransferredAmount $calculatesBookingTransferredAmount, FetchesServiceConfigurations $fetchesServiceConfigurations, CalculatesBookingCurrencyAverageRate $calculatesBookingCurrencyAverageRate, FetchesCompany $fetchesCompany, UpdatesBookingStatus $updatesBookingStatus, CreateInvoiceTransactionProcessor $invoiceDocumentProcessor)
|
||||
{
|
||||
$this->listsTransactions = $listsTransactions;
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
@@ -90,18 +80,16 @@ class CreateInvoiceTransactionProcessor
|
||||
$this->fetchesServiceConfigurations = $fetchesServiceConfigurations;
|
||||
$this->calculatesBookingCurrencyAverageRate = $calculatesBookingCurrencyAverageRate;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->createsDocument = $createsDocument;
|
||||
$this->createsFile = $createsFile;
|
||||
$this->updatesBookingStatus = $updatesBookingStatus;
|
||||
$this->invoiceDocumentProcessor = $invoiceDocumentProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Booking $booking
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Booking $booking)
|
||||
public function execute(Booking $booking)
|
||||
{
|
||||
|
||||
if ($booking->status === ApprovalStatus::COMPLETED) {
|
||||
@@ -116,18 +104,18 @@ class CreateInvoiceTransactionProcessor
|
||||
return;
|
||||
}
|
||||
// confirm that all payments has been transferred
|
||||
if($this->calculatesBookingTransferredAmount->execute($booking) !== $this->calculatesBookingPaidAmount->execute($booking)){
|
||||
if ($this->calculatesBookingTransferredAmount->execute($booking) !== $this->calculatesBookingPaidAmount->execute($booking)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$po_order_transaction = $booking->transactions()
|
||||
$purchaseOrder = $booking->transactions()
|
||||
->where('type', TransactionType::PURCHASE_ORDER)
|
||||
->complete()
|
||||
->first();
|
||||
|
||||
$constants = SegmentConstant::where('reference', SegmentConstants::SERVICE_TYPE)->where('detail->id', $booking->service->id)->first();
|
||||
|
||||
if($constants->detail->is_billable && !$po_order_transaction) {
|
||||
if ($constants->detail->is_billable && !$purchaseOrder) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,46 +154,18 @@ class CreateInvoiceTransactionProcessor
|
||||
null,
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
$invoice_transaction = $this->createsTransaction->execute($po_order_transaction->booking, $transaction_object);
|
||||
$invoice_transaction = $this->createsTransaction->execute($purchaseOrder->booking, $transaction_object);
|
||||
|
||||
$supplier = $this->fetchesCompany->execute(['id' => $transaction->receiver]);
|
||||
|
||||
$purchase_order_pdf = LaravelMpdf::loadView('pages.pdfs.purchase_order', ['invoice_transaction' => $invoice_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::PURCHASE_ORDER,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($purchase_order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'purchase_orders'
|
||||
);
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
// purchase order
|
||||
$this->invoiceDocumentProcessor->execute($invoice_transaction, $purchaseOrder, $supplier, DocumentType::PURCHASE_ORDER);
|
||||
|
||||
$deliver_order_pdf = LaravelMpdf::loadView('pages.pdfs.deliver_order', ['invoice_transaction' => $invoice_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::DELIVER_ORDER,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($deliver_order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'delivery_orders'
|
||||
);
|
||||
// deliver order
|
||||
$this->invoiceDocumentProcessor->execute($invoice_transaction, $purchaseOrder, $supplier, DocumentType::DELIVER_ORDER);
|
||||
|
||||
/** @var Document $document */
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
|
||||
|
||||
$invoice_pdf = LaravelMpdf::loadView('pages.pdfs.invoice', ['invoice_transaction' => $invoice_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::INVOICE,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($invoice_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'invoices'
|
||||
);
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
// invoice
|
||||
$this->invoiceDocumentProcessor->execute($invoice_transaction, $purchaseOrder, $supplier, DocumentType::INVOICE);
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('SPDO-');
|
||||
|
||||
@@ -231,18 +191,10 @@ class CreateInvoiceTransactionProcessor
|
||||
null,
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
$supplier_deliver_order_transaction = $this->createsTransaction->execute($po_order_transaction->booking, $transaction_object);
|
||||
$supplier_deliver_order_transaction = $this->createsTransaction->execute($purchaseOrder->booking, $transaction_object);
|
||||
|
||||
$supplier_order_pdf = LaravelMpdf::loadView('pages.pdfs.supplier_deliver_order', ['supplier_deliver_order_transaction' => $supplier_deliver_order_transaction, 'po_order_transaction' => $po_order_transaction, 'supplier' => $supplier]);
|
||||
$document_object = new DocumentObject(
|
||||
DocumentType::SUPPLIER_DELIVER_ORDER,
|
||||
[chunk_split('data:application/pdf;base64,'.base64_encode($supplier_order_pdf->output()))],
|
||||
'',
|
||||
ApprovalStatus::COMPLETED,
|
||||
'supplier_delivery_orders'
|
||||
);
|
||||
$document = $this->createsDocument->execute($po_order_transaction->booking, $document_object);
|
||||
$this->createsFile->execute($document, $document_object);
|
||||
// supply deliver order
|
||||
$this->invoiceDocumentProcessor->execute($supplier_deliver_order_transaction, $purchaseOrder, $supplier, DocumentType::SUPPLIER_DELIVER_ORDER);
|
||||
|
||||
$this->updatesBookingStatus->execute($booking, ApprovalStatus::COMPLETED);
|
||||
}
|
||||
|
||||
@@ -25,15 +25,18 @@ class CalculatesTransactionServiceCharge
|
||||
* @param SegmentConstant|null $service_charge
|
||||
* @return float
|
||||
*/
|
||||
public function execute(float $amount, float $rate, ?SegmentConstant $service_charge) {
|
||||
public function execute(float $amount, float $rate, ?SegmentConstant $service_charge)
|
||||
{
|
||||
|
||||
if(!$service_charge) {
|
||||
if (!$service_charge) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$transfer_fee = $this->calculatesTransactionTransferFee->execute(($amount * (1 / $rate)), $service_charge);
|
||||
return $service_charge->detail->amount->type === 'percentage' ? (($amount + $transfer_fee) * ( (float) $service_charge->detail->amount->value /100) * (1/$rate)) : (float) $service_charge->detail->amount->value;
|
||||
|
||||
if (isset($service_charge->detail->amount)) {
|
||||
return $service_charge->detail->amount->type === 'percentage' ? (($amount + $transfer_fee) * ((float) $service_charge->detail->amount->value / 100) * (1 / $rate)) : (float) $service_charge->detail->amount->value;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,17 @@ class CalculatesTransactionTransferFee
|
||||
* @param SegmentConstant|null $service_charge
|
||||
* @return float
|
||||
*/
|
||||
public function execute(float $amount, ?SegmentConstant $service_charge) {
|
||||
public function execute(float $amount, ?SegmentConstant $service_charge)
|
||||
{
|
||||
|
||||
if(!$service_charge) {
|
||||
if (!$service_charge) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $service_charge->detail->transferFee->type === 'percentage' ? $amount * ((float) $service_charge->detail->transferFee->value /100) : (float) $service_charge->detail->transferFee->value;
|
||||
if (isset($service_charge->detail->transferFee)) {
|
||||
return $service_charge->detail->transferFee->type === 'percentage' ? $amount * ((float) $service_charge->detail->transferFee->value / 100) : (float) $service_charge->detail->transferFee->value;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Services;
|
||||
|
||||
use App\Models\Group;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Classes\General\Eloquent\AbstractFetchRecord;
|
||||
|
||||
class FetchesGroup extends AbstractFetchRecord
|
||||
{
|
||||
/** @var Group */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsBookings constructor.
|
||||
* @param Group $repository
|
||||
*/
|
||||
public function __construct(Group $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Services;
|
||||
|
||||
use App\Models\Group;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Classes\General\Eloquent\AbstractListRecord;
|
||||
|
||||
class ListsGroups extends AbstractListRecord
|
||||
{
|
||||
/** @var Group */
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* ListsBookings constructor.
|
||||
* @param Group $repository
|
||||
*/
|
||||
public function __construct(Group $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Builder
|
||||
*/
|
||||
public function getRepository(): Builder
|
||||
{
|
||||
return $this->repository->newQuery();
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class CreditWalletProcessor
|
||||
|
||||
$transaction_object = new TransactionObject($billNumber, $transactionType === 2 ? TransactionType::DEBIT_NOTE : TransactionType::CREDIT_NOTE, 1, $wallet->owner->id, 1, PaymentMethodType::CASH, $amount, $amount, 1, 1, 1, 0, 0, null, ApprovalStatus::APPROVED, [], $reference);
|
||||
$transaction = $this->createsTransaction->execute($wallet, $transaction_object);
|
||||
|
||||
|
||||
$updateWalletAmount = $transactionType === 2 ? ($wallet->amount - $transaction->amount) : ($wallet->amount + $transaction->amount);
|
||||
|
||||
$walletObject = new WalletObject($wallet->owner->id, $wallet->currency_id, $wallet->code, $updateWalletAmount);
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
final class CashBack {
|
||||
|
||||
public const MAX = 15000;
|
||||
|
||||
public const DISPLAY_MAX = 50000;
|
||||
|
||||
public const SEGMENT = [
|
||||
'0' => [
|
||||
'min_value' => 0,
|
||||
'max_value' => 2000,
|
||||
'weight' => [
|
||||
'0' => 80,
|
||||
'1' => 18,
|
||||
'2' => 2,
|
||||
],
|
||||
'percent' => [
|
||||
'0' => 0.002,
|
||||
'1' => 0.005,
|
||||
'2' => 0.02,
|
||||
]
|
||||
],
|
||||
'1' => [
|
||||
'min_value' => 2001,
|
||||
'max_value' => 10000,
|
||||
'weight' => [
|
||||
'0' => 85,
|
||||
'1' => 10,
|
||||
'2' => 5,
|
||||
],
|
||||
'percent' => [
|
||||
'0' => 0.002,
|
||||
'1' => 0.005,
|
||||
'2' => 0.02,
|
||||
]
|
||||
],
|
||||
'2' => [
|
||||
'min_value' => 10001,
|
||||
'max_value' => 100000,
|
||||
'weight' => [
|
||||
'0' => 70,
|
||||
'1' => 20,
|
||||
'2' => 10,
|
||||
],
|
||||
'percent' => [
|
||||
'0' => 0.002,
|
||||
'1' => 0.005,
|
||||
'2' => 0.02,
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -29,4 +29,6 @@ final class TransactionType {
|
||||
public const WITHDRAW = 10;
|
||||
|
||||
public const TRANSFER_FEE = 12;
|
||||
|
||||
public const CASH_BACK = 13;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class DownloadBookingDocumentController
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function download(Request $request, DownloadBookingDocumentLogic $logic) {
|
||||
$logic->execute($request);
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\UpdateCompanyStatusLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyStatusController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateCompanyStatusLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateCompanyStatusLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Exports;
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsCustomers;
|
||||
use App\Classes\Modules\Exports\Services\ExportsTransactions;
|
||||
use App\Classes\Modules\Exports\Services\ExportsBookingTransactions;
|
||||
use App\Classes\Modules\Exports\Services\ExportsNullDebtors;
|
||||
use App\Classes\Modules\Exports\Services\ExportsPaymentTransactions;
|
||||
|
||||
@@ -54,4 +55,10 @@ class ExportCustomersToExcelController
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function bookingTransactions(ExportsBookingTransactions $exportsBookingTransactions, Request $request){
|
||||
$response = $exportsBookingTransactions->download('bookingTransactions.xls', Excel::XLS, ['Content-Type' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']);
|
||||
ob_end_clean();
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Notifications;
|
||||
|
||||
use App\Classes\Modules\Notifications\ControllersLogic\ListNotificationsLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ListNotificationsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListNotificationsLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListNotificationsLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\DeleteGroupLogic;
|
||||
|
||||
class DeleteGroupController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeleteGroupTransactionLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function delete(Request $request, DeleteGroupLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\ListGroupsLogic;
|
||||
|
||||
|
||||
class ListGroupsController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ListGroupsLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function list(Request $request, ListGroupsLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\UpdateGroupLogic;
|
||||
|
||||
class UpdateGroupController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param DeleteGroupTransactionLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateGroupLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Wallets;
|
||||
|
||||
use App\Classes\ValueObjects\Response\ApiResponseObject;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\Wallet;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class WalletReportController
|
||||
{
|
||||
public function walletsReport(Request $request): JsonResponse
|
||||
{
|
||||
return (new ApiResponseObject(
|
||||
'fetch service report Successful',
|
||||
'',
|
||||
HttpStatus::OK_WITH_MESSAGE,
|
||||
['data' => [
|
||||
'walletSum' => (float) Wallet::all()->sum('amount'),
|
||||
'outgoingSum' => (float) Transaction::where('type', TransactionType::PAYMENT)->where('owner_type', Wallet::class)->sum('amount'),
|
||||
'incomingSum' => (float) Transaction::whereIn('type', [TransactionType::TOP_UP, TransactionType::CREDIT_NOTE])->where('owner_type', Wallet::class)->sum('amount'),
|
||||
]]
|
||||
))->handler();
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ class BookingResource extends JsonResource
|
||||
'service' => new ServiceTypeResource($this->service),
|
||||
'marking' => $this->marking,
|
||||
'amount' => $this->fix_amount,
|
||||
'amount' => $this->fix_amount,
|
||||
'floating_amount' => floatval((App()->make(CalculatesBookingFloatingAmount::class))->execute($this->resource, $this->fix_currency_id)),
|
||||
'paid_amount' => floatval((App()->make(CalculatesBookingPayableAmount::class))->execute($this->resource, $this->fix_currency_id)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)),
|
||||
'outstanding_amount' => floatval((App()->make(CalculatesBookingOutstanding::class))->execute($this->resource)) - floatval((App()->make(CalculatesBookingRefundAmount::class))->execute($this->resource, $this->fix_currency_id)),
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class GroupResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'original_amount' => (double) $this->original_amount,
|
||||
'original_currency' => new CurrencyResource($this->original_currency),
|
||||
'amount' => (double) $this->amount,
|
||||
'currency' => new CurrencyResource($this->currency),
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A'),
|
||||
'currency_rate' => (float) $this->currency_rate,
|
||||
'transactions' => TransactionResource::collection($this->transactions()->get()),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
|
||||
class NotificationResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'long_ago' => $this->created_at->diffForHumans(),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
];
|
||||
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ class TransactionResource extends JsonResource
|
||||
'payment_method' => (float) $this->payment_method,
|
||||
'recipient_bank_account' => new BankResource($booking->bank),
|
||||
'issuer_name' => $this->issuerCompany->name,
|
||||
'issuer_id' => $this->issuerCompany->id,
|
||||
'amount' => (double) $this->amount,
|
||||
'original_amount' => (double) $this->original_amount,
|
||||
'currency' => new CurrencyResource($this->currency),
|
||||
|
||||
@@ -3,11 +3,37 @@
|
||||
namespace App\Models;
|
||||
|
||||
|
||||
use App\Classes\General\Interfaces\Notifiable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
class AbstractModel extends Model
|
||||
class AbstractModel extends Model implements Notifiable
|
||||
{
|
||||
use LogsActivity;
|
||||
protected static $logFillable = true;
|
||||
|
||||
/**
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function subject(): MorphTo
|
||||
{
|
||||
return $this->MorphTo('subject');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function target(): MorphTo
|
||||
{
|
||||
return $this->MorphTo('target');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function causer(): MorphTo
|
||||
{
|
||||
return $this->MorphTo('causer');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BankLog extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Group extends Model
|
||||
{
|
||||
public function transactions()
|
||||
{
|
||||
return $this->belongsToMany(Transaction::class, GroupTransaction::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function currency(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Currency::class, 'currency_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function original_currency(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Currency::class, 'original_currency_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class GroupTransaction extends Model
|
||||
{
|
||||
protected $table = 'group_transactions';
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function group(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Group::class, 'group_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function transaction(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Transaction::class, 'transaction_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Notification extends AbstractModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'notifications';
|
||||
|
||||
public function package(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Package::class, 'package_id', 'id');
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -10,7 +10,7 @@
|
||||
"require": {
|
||||
"php": "^7.2.5",
|
||||
"ext-fileinfo": "*",
|
||||
"ext-json": "^1.6",
|
||||
"ext-json": "*",
|
||||
"ext-zip": "*",
|
||||
"barryvdh/laravel-dompdf": "^0.9.0",
|
||||
"carlos-meneses/laravel-mpdf": "^2.1",
|
||||
@@ -31,6 +31,7 @@
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.0",
|
||||
"fzaninotto/faker": "^1.9.1",
|
||||
"laravel/dusk": "^6.23",
|
||||
"mockery/mockery": "^1.3.1",
|
||||
"nunomaduro/collision": "^4.1",
|
||||
"phpunit/phpunit": "^8.5"
|
||||
|
||||
@@ -63,6 +63,26 @@ return [
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'dusk' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => false,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGroupsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('groups', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('issuer')->unsigned();
|
||||
$table->foreignId('receiver')->unsigned();
|
||||
$table->decimal('amount', 14, 5)->default(0.00);
|
||||
$table->decimal('original_amount', 14, 5)->default(0.00);
|
||||
$table->foreignId('currency_id')->unsigned();
|
||||
$table->foreignId('original_currency_id')->unsigned();
|
||||
$table->decimal('currency_rate', 14, 5)->default(0.00);
|
||||
$table->decimal('tax', 14, 5)->default(0.00);
|
||||
$table->decimal('service_charge', 14, 5)->default(0.00);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('groups');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGroupTransactionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('group_transactions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('group_id')->unsigned();
|
||||
$table->foreignId('transaction_id')->unsigned();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('group_transactions');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\BankAccountType;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBankLogsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('bank_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('bank_id')->unsigned();
|
||||
$table->foreignId('company_id')->unsigned();
|
||||
$table->string('reference')->nullable();
|
||||
$table->string('bank_name');
|
||||
$table->string('holder_name');
|
||||
$table->string('account_no');
|
||||
$table->string('bank_branch')->nullable();
|
||||
$table->string('swift')->nullable();
|
||||
$table->string('snap')->nullable();
|
||||
$table->integer('type')->default(BankAccountType::EXTERNAL);
|
||||
$table->integer('default')->default(false);
|
||||
$table->integer('status')->default(ApprovalStatus::APPROVED);
|
||||
$table->foreignId('country_id')->unsigned();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('bank_id')->references('id')->on('banks');
|
||||
$table->foreign('country_id')->references('id')->on('countries');
|
||||
$table->foreign('company_id')->references('id')->on('companies');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('bank_logs');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
|
||||
class CreateNotificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->text('description');
|
||||
$table->morphs('subject');
|
||||
$table->morphs('target');
|
||||
$table->morphs('causer');
|
||||
$table->integer('status')->default(ApprovalStatus::APPROVED);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Document;
|
||||
use App\Models\Transaction;
|
||||
use App\Models\Group;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class RecoverGroupTransactionTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
$document = Document::where('document_type', 'CURRENCY_VENDOR_ORDER')->get();
|
||||
$transaction_group = Transaction::
|
||||
select('issuer', 'currency_rate', 'type', DB::raw('count(DISTINCT id) as total'), DB::raw("DATE_FORMAT(created_at, '%Y-%m-%d %H:%i') as new_date"))
|
||||
->where('type', 3)
|
||||
->groupBy(
|
||||
'issuer',
|
||||
'currency_rate',
|
||||
'new_date'
|
||||
)
|
||||
->get();
|
||||
|
||||
foreach ($transaction_group as $key => $row) {
|
||||
$transaction = Transaction::
|
||||
where('type', 3)
|
||||
->where('issuer', $row->issuer)
|
||||
->where('currency_rate', $row->currency_rate)
|
||||
->where(DB::raw("DATE_FORMAT(created_at, '%Y-%m-%d %H:%i')"), $row->new_date)
|
||||
->get();
|
||||
|
||||
$group = new Group();
|
||||
$group->save();
|
||||
|
||||
$issuer = '';
|
||||
$receiver = '';
|
||||
$amount = 0;
|
||||
$original_amount = 0;
|
||||
$currency_id = 0;
|
||||
$original_currency_id = '';
|
||||
$currency_rate = '';
|
||||
$tax = 0;
|
||||
$service_charge = 0;
|
||||
|
||||
foreach ($transaction as $key_2 => $row_2) {
|
||||
$group->transaction()->sync($row_2->id, false);
|
||||
$issuer = $row_2->issuer;
|
||||
$receiver = $row_2->receiver;
|
||||
$amount += $row_2->amount;
|
||||
$original_amount += $row_2->original_amount;
|
||||
$currency_id = $row_2->currency_id;
|
||||
$original_currency_id = $row_2->original_currency_id;
|
||||
$currency_rate = $row_2->currency_rate;
|
||||
$tax += $row_2->tax;
|
||||
$service_charge += $row_2->service_charge;
|
||||
}
|
||||
|
||||
$group->issuer = $issuer;
|
||||
$group->receiver = $receiver;
|
||||
$group->amount = $amount;
|
||||
$group->original_amount = $original_amount;
|
||||
$group->currency_id = $currency_id;
|
||||
$group->original_currency_id = $original_currency_id;
|
||||
$group->currency_rate = $currency_rate;
|
||||
$group->tax = $tax;
|
||||
$group->service_charge = $service_charge;
|
||||
|
||||
$group->update();
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
}
|
||||
}
|
||||
@@ -316,6 +316,12 @@ hr{
|
||||
background-color: $color-primary-lighter !important;
|
||||
}
|
||||
|
||||
.bg-primary-lighter-hover {
|
||||
&:hover {
|
||||
background-color: $color-primary-lighter !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Complete
|
||||
------------------------------------
|
||||
*/
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<validation-wrapper-component class="m-b-15" :validator="$v.parameters.email">
|
||||
<label class="text-primary">Email Address</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="form-control fs-12" v-model.trim="parameters.email">
|
||||
<input id="email" name="email" type="text" class="form-control fs-12" v-model.trim="parameters.email">
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
<validation-wrapper-component :validator="$v.parameters.password">
|
||||
<label class="text-primary">Password</label>
|
||||
<div class="controls">
|
||||
<input type="password" class="form-control fs-12" v-model="parameters.password">
|
||||
<input id="password" name="password" type="password" class="form-control fs-12" v-model="parameters.password">
|
||||
</div>
|
||||
</validation-wrapper-component>
|
||||
<div class="row m-t-15 align-items-center justify-content-center">
|
||||
@@ -21,7 +21,7 @@
|
||||
<p class="muted fs-11 font-arial m-b-0 pointer" @click="$store.dispatch('toggleSection', {name: 'forgetPassword', status: true})">Forgot password?</p>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<div class="btn btn-sm p-l-30 p-r-30 btn-primary bold v-align-middle b-rad-none all-caps" @click="submitForm">Sign In</div>
|
||||
<div class="btn btn-sm p-l-30 p-r-30 btn-primary bold v-align-middle b-rad-none all-caps" @click="submitForm" id="sign-in">Sign In</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -55,4 +55,4 @@
|
||||
mixins: [loginFormValidation]
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -84,7 +84,14 @@ export default {
|
||||
type: 'INVOICE',
|
||||
supplier: null
|
||||
},
|
||||
documents: ['INVOICE', 'PURCHASE_ORDER', 'DELIVER_ORDER', 'SUPPLIER_DELIVER_ORDER'],
|
||||
documents: [
|
||||
'INVOICE',
|
||||
'PURCHASE_ORDER',
|
||||
'DELIVER_ORDER',
|
||||
'SUPPLIER_DELIVER_ORDER',
|
||||
'INVOICE + PO + DO',
|
||||
'INVOICE + PO + DO + SDO'
|
||||
],
|
||||
selectedDocumentStatus: false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
</div>
|
||||
<div class="row" v-show="!createBank">
|
||||
<div class="col-7 p-r-0">
|
||||
<div class="row">
|
||||
<div class="row" id="select-list" name="select-list">
|
||||
<div class="col">
|
||||
<div class="form-group no-margin form-group-default">
|
||||
<label>{{ data.serviceType.id === 4 ? '1688 Login Id/Email/Phone' : 'Account No.' }}</label>
|
||||
@@ -115,7 +115,7 @@
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" v-for="bank in data.recipientBanks.filter(AccountNumber)" v-bind:key="bank.id" >
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer p-t-10 p-b-10" :class="[{'bg-master-lightest': parameters.bankAccount.id === bank.id}, {'text-master': parameters.bankAccount.id === bank.id}, {'hover-primary': parameters.bankAccount.id !== bank.id}, {'pointer': parameters.bankAccount.id !== bank.id}]" @click="selectBank(bank)">
|
||||
<div id="select-option" name="select-option" class="col b-b b-grey p-t-10 p-b-10 pointer p-t-10 p-b-10" :class="[{'bg-master-lightest': parameters.bankAccount.id === bank.id}, {'text-master': parameters.bankAccount.id === bank.id}, {'hover-primary': parameters.bankAccount.id !== bank.id}, {'pointer': parameters.bankAccount.id !== bank.id}]" @click="selectBank(bank)">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
@@ -320,4 +320,4 @@
|
||||
},
|
||||
mixins: [FormHandler]
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Currency Order Placed</h5>
|
||||
<div class="fs-11">Are you sure you that the currency order has been placed with the supplier?</div>
|
||||
<div class="fs-11">Are you sure that the currency order has been placed with the supplier?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-l-0 m-r-0">
|
||||
<div class="col-12 col-md mb-2 mb-md-0 p-l-3 p-r-3 p-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.startDate">
|
||||
<label class="all-caps">Start Date</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.startDate"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md mb-2 mb-md-0 p-l-3 p-r-3 p-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.endDate">
|
||||
<label class="all-caps">End Date</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.endDate"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md-auto p-l-3 p-r-3 p-md-0">
|
||||
<div class="btn btn-lg btn-primary fs-11 w-100 h-100 d-flex justify-content-center align-items-center" @click="downloadReport()">
|
||||
<span>
|
||||
Export
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from "../../../general/mixins/componentHandler";
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
},
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
startDate: {
|
||||
required
|
||||
},
|
||||
endDate: {
|
||||
required
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
downloadReport(){
|
||||
var apiRoute = '';
|
||||
if(!this.validate()){ return; }
|
||||
switch(this.section) {
|
||||
case 'paymentsReportSection':
|
||||
apiRoute = route('paymentTransactions.export');
|
||||
break;
|
||||
case 'walletsReportSection':
|
||||
apiRoute = route('walletTransactions.export');
|
||||
break;
|
||||
}
|
||||
window.open(apiRoute + '?startDate=' + this.parameters.startDate + '&endDate=' + this.parameters.endDate, '_blank');
|
||||
},
|
||||
updateDocumentType(documentType) {
|
||||
this.parameters.type = documentType;
|
||||
this.selectedDocumentStatus = !this.selectedDocumentStatus
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
};
|
||||
</script>
|
||||
@@ -123,7 +123,7 @@
|
||||
<div class="font-heading all-caps fs-10">Requested Refund Amount</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="font-heading fs-10">{{item.original_currency.short_code}} {{(Math.round((totalRequestedRefund + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
<div class="font-heading fs-10">{{item.currency.short_code}} {{(Math.round((totalRequestedRefund + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end m-b-10 bold text-danger" v-if="totalRefunds != 0">
|
||||
@@ -219,8 +219,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10" v-show="[2, 3].includes(item.status) && totalRequestedRefund < data.booking.amount">
|
||||
<div class="col hide">
|
||||
<div class="row m-t-10" v-show="[2, 3].includes(item.status) && totalRequestedConvertRefund < data.booking.amount">
|
||||
<div class="col">
|
||||
<button class="btn btn-xs all-caps b-rad-none bg-master-lighter btn-block no-border requestModal" data-type="transferSummary">Request Refund</button>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="transferSummary" size="large">
|
||||
<refund-confirmation-component :data="data" :section="section" :totalRefunds="totalRequestedRefund + totalRefunds"></refund-confirmation-component>
|
||||
@@ -249,12 +249,25 @@
|
||||
},
|
||||
computed: {
|
||||
totalRequestedRefund() {
|
||||
let vm = this;
|
||||
var TotalRequestedRefund = 0;
|
||||
this.data.transaction_refunds.forEach(function(refunds) {
|
||||
TotalRequestedRefund += refunds.status === 1 ? refunds.original_amount : 0;
|
||||
});
|
||||
|
||||
return TotalRequestedRefund;
|
||||
},
|
||||
totalRequestedConvertRefund() {
|
||||
let vm = this;
|
||||
var TotalRequestedRefund = 0;
|
||||
this.data.transaction_refunds.forEach(function(refunds) {
|
||||
TotalRequestedRefund += refunds.status === 1 ? refunds.original_amount : 0;
|
||||
});
|
||||
if (vm.data.booking.fixed_currency.id != 1 && this.data.transaction_refunds[0]) {
|
||||
TotalRequestedRefund = (TotalRequestedRefund * this.data.transaction_refunds[0].currency_rate);
|
||||
}
|
||||
return ((Math.round((TotalRequestedRefund + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","));
|
||||
},
|
||||
totalRefunds() {
|
||||
var TotalRequestedRefund = 0;
|
||||
this.data.transaction_refunds.forEach(function(refunds) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<div class="col text-right">
|
||||
<div class="font-heading fs-10 muted all-caps">Amount</div>
|
||||
<div class="font-heading fs-14 text-success bold">
|
||||
{{(Math.round((data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
{{(Math.round((data.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<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="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Date</div>
|
||||
<div class="font-heading fs-10">
|
||||
{{item.created_at}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Currency Rate</div>
|
||||
<div class="font-heading fs-10">
|
||||
{{item.currency_rate}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<div class="font-heading fs-10 muted all-caps">Amount</div>
|
||||
<div class="font-heading fs-14 text-success bold">
|
||||
{{item.original_currency.short_code}} {{(Math.round((item.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 muted all-caps">reference</div>
|
||||
<span class="font-heading fs-10" v-for="transaction in item.transactions">
|
||||
<a :href="route('booking.details', transaction.booking.marking)">{{transaction.booking.marking}} </a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="row parentContainer">
|
||||
<div class="col p-l-0">
|
||||
<button class="btn btn-xs btn-default bg-warning b-rad-none no-border requestModal" data-type="editTransactionGroup">
|
||||
<i class="fa fa-pencil text-white"></i>
|
||||
</button>
|
||||
<modal-component small type="editTransactionGroup">
|
||||
<edit-transaction-group-form-component :section="section" :currency_rate="item.currency_rate" :supplier_id ="data.transactions[0].issuer_id" :id="item.id"></edit-transaction-group-form-component>
|
||||
</modal-component>
|
||||
<button class="btn btn-xs btn-default bg-danger b-rad-none no-border requestModal" data-type="deleteTransactionGroup">
|
||||
<i class="fa fa-times text-white"></i>
|
||||
</button>
|
||||
<modal-component small type="deleteTransactionGroup">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Delete Transaction Group</h5>
|
||||
<div class="fs-11">Are you sure that you want to delete this transaction group?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-danger btn-block b-rad-none" @click="deleteGroupTransaction()">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import staticFormHandler from '../../../general/mixins/staticFormHandler'
|
||||
export default {
|
||||
props: {
|
||||
section:{
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deleteGroupTransaction() {
|
||||
this.isLoading = true;
|
||||
this.submit(this.route('api.transaction.group.delete', this.item.id), 'delete', this.section, true, true);
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler, staticFormHandler]
|
||||
}
|
||||
</script>
|
||||
@@ -1,31 +1,44 @@
|
||||
<template>
|
||||
<div class="row" @keyup.enter="submitForm">
|
||||
<div class="col no-padding">
|
||||
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
|
||||
<div class="row" v-show="!$store.getters.isLoading(section)">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row" @keyup.enter="submitForm">
|
||||
<div class="col ml-md-3 ml-0 mt-md-0 mt-3 bg-white padding-15">
|
||||
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="$store.getters.isLoading(section)"></loading-component>
|
||||
<div class="row" v-show="!$store.getters.isLoading(section)">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-16 all-caps bold m-b-15">Upload Debtors</div>
|
||||
</div>
|
||||
</div>
|
||||
<error-message-component class="m-b-20" :error="error"></error-message-component>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<file-input-component :validator="$v.files" v-model="files">
|
||||
<template slot="label">
|
||||
<div class="font-heading fs-11 text-primary all-caps">Debtor Excel</div>
|
||||
</template>
|
||||
</file-input-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-20">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-success b-rad-none" @click="submitForm">Upload & Update</button>
|
||||
<div class="font-heading fs-16 all-caps bold m-b-15">Upload Debtors</div>
|
||||
</div>
|
||||
</div>
|
||||
<error-message-component class="m-b-20" :error="error"></error-message-component>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<file-input-component :validator="$v.files" v-model="files">
|
||||
<template slot="label">
|
||||
<div class="font-heading fs-11 text-primary all-caps">Debtor Excel</div>
|
||||
</template>
|
||||
</file-input-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-20">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-success b-rad-none" @click="submitForm">Upload & Update</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-20">
|
||||
<div class="col ml-md-3 ml-0">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-block p-t-10 p-b-10 p-r-35 p-l-35 btn-primary b-rad-none" @click="downloadReport()">Download New Debtors Report</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -57,7 +70,10 @@
|
||||
};
|
||||
|
||||
this.submit(this.route('api.debtor.import'), 'post', this.section, true, false)
|
||||
}
|
||||
},
|
||||
downloadReport(){
|
||||
window.open(route('newDebtor.export'), '_blank');
|
||||
},
|
||||
},
|
||||
mixins: [ModalFromHandler]
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
</div>
|
||||
<div class="row p-b-15" v-if="(summary.calculation.total > 0 && (data.status === 1 || data.status === 2)) || ($store.getters.isAdmin && summary.calculation.total > 0)">
|
||||
<div class="col">
|
||||
<div class="btn btn-sm btn-block btn-success b-rad-none shadow-sm pointer requestModal" data-type="transferSummary" >Transfer Now</div>
|
||||
<div class="btn btn-sm btn-block btn-success b-rad-none shadow-sm pointer requestModal" data-type="transferSummary" id="transfer-now" name="transfer-now">Transfer Now</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="summary.calculation.total > 0 && data.status === 0">
|
||||
@@ -153,7 +153,7 @@
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component v-if="summary.calculation.total > 0" class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="transferSummary" size="large">
|
||||
<modal-component id="select-account-modal" v-if="summary.calculation.total > 0" class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="transferSummary" size="large">
|
||||
<booking-confirmation-component :data="summary" :section="section"></booking-confirmation-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
|
||||
+18
-7
@@ -40,6 +40,17 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center m-b-15 parentContainer bg-master-lighter p-t-10 p-b-10">
|
||||
<div class="col">
|
||||
<div class="row m-b-5">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10 muted">
|
||||
{{ !item.purchase_order ? 'Please fill up purchase order to enjoy the cashback' : 'You have entitled to earn cashbback' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center m-b-15 parentContainer bg-master-lighter p-t-10 p-b-10">
|
||||
<div class="col">
|
||||
<div class="row m-b-5">
|
||||
@@ -113,7 +124,7 @@
|
||||
</div>
|
||||
<div class="row m-t-20" v-if="data.company.employee.status === 2 && data.company.status === 2 && data.outstanding_amount > 0">
|
||||
<div class="col">
|
||||
<button class="btn btn-sm all-caps b-rad-none btn-success btn-block" @click="makePayment()">Make Payment</button>
|
||||
<button id="payment-btn" class="btn btn-sm all-caps b-rad-none btn-success btn-block" @click="makePayment()">Make Payment</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -222,7 +233,7 @@
|
||||
<div class="m-b-15 m-t-10 text-center">
|
||||
<img src="/images/fpx-logo-vector-01.png" alt="logo" height="25">
|
||||
</div>
|
||||
<p class="no-margin bold all-caps">Online Banking</p>
|
||||
<p id="online-banking" class="no-margin bold all-caps">Online Banking</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -255,7 +266,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10 m-b-10">
|
||||
<div class="col text-center"><div class="padding-10 bg-master-lightest pointer" @click="$store.dispatch('toggleSection', {name: 'otherPaymentMethods', status: !$store.getters.isShowing('otherPaymentMethods')})"><i class="fa m-r-10" :class="[{'fa-angle-up': $store.getters.isShowing('otherPaymentMethods')}, {'fa-angle-down': !$store.getters.isShowing('otherPaymentMethods')}]"></i>{{$store.getters.isShowing('otherPaymentMethods') ? 'Hide' : 'Show'}} Alternative Methods <i class="fa m-l-10" :class="[{'fa-angle-up': $store.getters.isShowing('otherPaymentMethods')}, {'fa-angle-down': !$store.getters.isShowing('otherPaymentMethods')}]"></i></div></div>
|
||||
<div class="col text-center"><div id="expend-method" class="padding-10 bg-master-lightest pointer" @click="$store.dispatch('toggleSection', {name: 'otherPaymentMethods', status: !$store.getters.isShowing('otherPaymentMethods')})"><i class="fa m-r-10" :class="[{'fa-angle-up': $store.getters.isShowing('otherPaymentMethods')}, {'fa-angle-down': !$store.getters.isShowing('otherPaymentMethods')}]"></i>{{$store.getters.isShowing('otherPaymentMethods') ? 'Hide' : 'Show'}} Alternative Methods <i class="fa m-l-10" :class="[{'fa-angle-up': $store.getters.isShowing('otherPaymentMethods')}, {'fa-angle-down': !$store.getters.isShowing('otherPaymentMethods')}]"></i></div></div>
|
||||
</div>
|
||||
<div class="row" v-show="$store.getters.isShowing('otherPaymentMethods')">
|
||||
<div class="col">
|
||||
@@ -269,7 +280,7 @@
|
||||
viewBox="0 0 172 172"
|
||||
style=" fill:#000000;"><defs><linearGradient x1="86" y1="15.45313" x2="86" y2="157.24562" gradientUnits="userSpaceOnUse" id="color-1_46094_gr1"><stop offset="0" stop-color="#009add"></stop><stop offset="1" stop-color="#00baa4"></stop></linearGradient><linearGradient x1="86" y1="62.14844" x2="86" y2="87.68238" gradientUnits="userSpaceOnUse" id="color-2_46094_gr2"><stop offset="0" stop-color="#4ec9ff"></stop><stop offset="1" stop-color="#2bffe6"></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="M142.4375,26.875h-18.8125v-5.375c0,-2.96431 -2.41069,-5.375 -5.375,-5.375h-64.5c-2.96431,0 -5.375,2.41069 -5.375,5.375v5.375h-18.8125c-4.44513,0 -8.0625,3.61737 -8.0625,8.0625v86c0,4.44512 3.61737,8.0625 8.0625,8.0625h40.3125v10.75h-10.75c-4.44512,0 -8.0625,3.61738 -8.0625,8.0625v2.6875h-10.75v5.375h10.75h69.875h10.75v-5.375h-10.75v-2.6875c0,-4.44512 -3.61738,-8.0625 -8.0625,-8.0625h-10.75v-10.75h40.3125c4.44512,0 8.0625,-3.61738 8.0625,-8.0625v-86c0,-4.44513 -3.61737,-8.0625 -8.0625,-8.0625zM123.625,96.75v-53.75h10.75v64.5h-96.75v-64.5h10.75v53.75zM107.5,91.375h-43v-48.64644c5.25675,-1.06962 9.40894,-5.22181 10.47856,-10.47856h22.04019c1.06963,5.25675 5.22181,9.40894 10.47856,10.47856v48.64644zM53.75,21.5h64.5v69.875h-5.375v-53.75h-2.6875c-4.44512,0 -8.0625,-3.61738 -8.0625,-8.0625v-2.6875h-32.25v2.6875c0,4.44512 -3.61737,8.0625 -8.0625,8.0625h-2.6875v53.75h-5.375zM112.875,145.125c1.4835,0 2.6875,1.204 2.6875,2.6875v2.6875h-59.125v-2.6875c0,-1.4835 1.204,-2.6875 2.6875,-2.6875h10.75h32.25zM96.75,139.75h-21.5v-10.75h21.5zM145.125,120.9375c0,1.4835 -1.204,2.6875 -2.6875,2.6875h-40.3125h-32.25h-40.3125c-1.4835,0 -2.6875,-1.204 -2.6875,-2.6875v-86c0,-1.4835 1.204,-2.6875 2.6875,-2.6875h18.8125v5.375h-10.75c-2.96431,0 -5.375,2.41069 -5.375,5.375v64.5c0,2.96431 2.41069,5.375 5.375,5.375h96.75c2.96431,0 5.375,-2.41069 5.375,-5.375v-64.5c0,-2.96431 -2.41069,-5.375 -5.375,-5.375h-10.75v-5.375h18.8125c1.4835,0 2.6875,1.204 2.6875,2.6875z" fill="url(#color-1_46094_gr1)"></path><path d="M86,64.5c-5.93706,0 -10.75,4.81294 -10.75,10.75c0,5.93706 4.81294,10.75 10.75,10.75c5.93706,0 10.75,-4.81294 10.75,-10.75c0,-5.93706 -4.81294,-10.75 -10.75,-10.75z" fill="url(#color-2_46094_gr2)"></path></g></g></svg>
|
||||
</div>
|
||||
<p class="no-margin bold">Manual Transfer</p>
|
||||
<p id="manual-transfer" class="no-margin bold">Manual Transfer</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -395,7 +406,7 @@
|
||||
<button class="btn btn-xs all-caps b-rad-none btn-default bg-master-lighter btn-block" @click="expandPayment = false">Cancel</button>
|
||||
</div>
|
||||
<div class="col p-l-0">
|
||||
<button class="btn btn-xs all-caps b-rad-none btn-success btn-block" :class="[{'hide': paymentMethod.name === ''}]" @click="submitForm()">Create Booking</button>
|
||||
<button id="create-booking" class="btn btn-xs all-caps b-rad-none btn-success btn-block" :class="[{'hide': paymentMethod.name === ''}]" @click="submitForm()">Create Booking</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -495,9 +506,9 @@
|
||||
<button class="btn btn-sm all-caps b-rad-none btn-default bg-master-lighter btn-block" @click="cancelQuotation()">Cancel</button>
|
||||
</div>
|
||||
<div class="col p-l-0" >
|
||||
<button class="btn btn-sm all-caps b-rad-none btn-success btn-block requestModal" data-type="paymentSummary" v-if="paymentMethod.id !== 'wallet' || walletOutstanding >= 0">Lock Booking</button>
|
||||
<button id="lock-booking" class="btn btn-sm all-caps b-rad-none btn-success btn-block requestModal" data-type="paymentSummary" v-if="paymentMethod.id !== 'wallet' || walletOutstanding >= 0">Lock Booking</button>
|
||||
</div>
|
||||
<modal-component v-if="calculation.total > 0" class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="paymentSummary">
|
||||
<modal-component id="confirm-booking-modal" v-if="calculation.total > 0" class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="paymentSummary">
|
||||
<confirm-quotation-form-component v-on:cancelQuotation="cancelQuotation()" :calculation="calculation" :section="section" :id="item.id" :payment_method="paymentMethod.id" :bank_code="onlinePayment.id" :amount="amount"></confirm-quotation-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<button class="btn btn-sm all-caps b-rad-none btn-default bg-master-lighter" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-sm all-caps b-rad-none btn-success" @click="submitForm()">Confirm Booking</button>
|
||||
<button id="confirm-booking" class="btn btn-sm all-caps b-rad-none btn-success" @click="submitForm()">Confirm Booking</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-right" v-if="payment_method !== 'wallet'">
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<div class="col no-padding">
|
||||
<div class="form-group form-group-default m-b-0">
|
||||
<label>Recipient Gets</label>
|
||||
<input type="text" placeholder="0.00" value="0" class="form-control" v-model="recipientInput" @keyup="updateAmount($event, 1)" v-money="money">
|
||||
<input id="cc_get" name="cc_get" type="text" placeholder="0.00" value="0" class="form-control" v-model="recipientInput" @keyup="updateAmount($event, 1)" v-money="money">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto bg-primary text-white">
|
||||
@@ -111,7 +111,7 @@
|
||||
<div class="col no-padding">
|
||||
<div class="form-group form-group-default m-b-0">
|
||||
<label>You'r Sending</label>
|
||||
<input type="text" placeholder="0.00" value="0.00" v-model="senderInput" class="form-control" @keyup="updateAmount($event, 0)" v-money="money">
|
||||
<input id="cc_sending" name="cc_sending" type="text" placeholder="0.00" value="0.00" v-model="senderInput" class="form-control" @keyup="updateAmount($event, 0)" v-money="money">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto bg-primary text-white">
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<h5 class="all-caps m-b-5 bold no-margin">Edit Transaction Group</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-5 animate__animated animate__fadeInUpBig animate__fast" v-if="error">
|
||||
<div class="col">
|
||||
<small class="bold fs-10 text-danger">{{error}}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component selectable :validator="$v.parameters.supplier_id">
|
||||
<label>Supplier</label>
|
||||
<selectable-component :endpoint="route('api.company.list') + '?filters=' + JSON.stringify({'business_type': 3, 'status_in': [2, 0]})" section="supplierListSection" valueColumn="id" :labelColumn="['name']" v-model="parameters.supplier_id"></selectable-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.rate">
|
||||
<label class="all-caps">Purchase Rate</label>
|
||||
<input type="text" class="form-control" v-model.lazy="parameters.rate" v-money="exchangeRate">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Update</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
currency_rate:{
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
supplier_id: {
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
id: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
error: '',
|
||||
suppliers: [],
|
||||
selectedSupplier: {
|
||||
id: '',
|
||||
name: '',
|
||||
status: false
|
||||
},
|
||||
parameters: {
|
||||
supplier_id: this.supplier_id,
|
||||
rate: (Math.round((this.currency_rate + Number.EPSILON) * 10000) / 10000).toFixed(5)
|
||||
},
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
supplier_id: { },
|
||||
rate: { },
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.submit(route('api.transaction.group.update', this.id), 'put', this.section, true, true);
|
||||
}
|
||||
},
|
||||
mixins: [ModalFormHandler]
|
||||
}
|
||||
</script>
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-l-0 m-r-0 bg-master-light padding-10 parentContainer">
|
||||
<div class="col">
|
||||
<div class="row requestModal pointer" data-type="deleteBank">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.supplierNames">
|
||||
<label>Supplier</label>
|
||||
<input type="text" class="form-control fs-12 pointer" v-model="parameters.supplierNames" disabled>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteBank">
|
||||
<select-supplier-form-component section="supplierListSection" v-on:input="updateList($event)"></select-supplier-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
<div class="col-12 col-md mb-2 mb-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.startDate">
|
||||
<label class="all-caps">Start Date</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.startDate"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 col-md mb-2 mb-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.endDate">
|
||||
<label class="all-caps">End Date</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.endDate"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-12 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()">Download</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from "../../../general/mixins/componentHandler";
|
||||
import { required, minValue} from "vuelidate/lib/validators";
|
||||
import {VMoney} from 'v-money'
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
supplier: null,
|
||||
supplierIds: [],
|
||||
supplierNames: []
|
||||
},
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
startDate: {
|
||||
required
|
||||
},
|
||||
endDate: {
|
||||
required
|
||||
},
|
||||
supplierIds: {
|
||||
required
|
||||
},
|
||||
supplierNames: {
|
||||
required
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitSearch(){
|
||||
if(!this.validate()){ return; }
|
||||
|
||||
var supplierIds = JSON.stringify(this.parameters.supplierIds);
|
||||
|
||||
window.open(route('export.transactions.booking')+'?startDate='+this.parameters.startDate+'&endDate='+this.parameters.endDate+'&supplierIds='+supplierIds, '_blank');
|
||||
},
|
||||
updateList(supplierList){
|
||||
let supplierIds = [];
|
||||
let supplierNames = [];
|
||||
supplierList.forEach(function(supplier) {
|
||||
supplierIds.push(supplier.id);
|
||||
supplierNames.push(supplier.name);
|
||||
});
|
||||
this.parameters.supplierIds = supplierIds;
|
||||
this.parameters.supplierNames = supplierNames;
|
||||
},
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
};
|
||||
</script>
|
||||
@@ -30,13 +30,13 @@
|
||||
<div class="col-sm-12 col-md-4 pr-md-1">
|
||||
<div class="form-group form-group-default b-rad-none">
|
||||
<label>Stock Code</label>
|
||||
<input type="text" class="form-control b-rad-none" v-model="product.stockCode" />
|
||||
<input id="stock_code" name="stock_code" type="text" class="form-control b-rad-none" v-model="product.stockCode" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md pl-md-1">
|
||||
<div class="form-group form-group-default b-rad-none required">
|
||||
<label>description</label>
|
||||
<input class="form-control b-rad-none" rows="1" @keyup="onlyEnglish($event)" v-model="product.description">
|
||||
<input id="desc" name="desc" class="form-control b-rad-none" rows="1" @keyup="onlyEnglish($event)" v-model="product.description">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,13 +44,13 @@
|
||||
<div class="col-sm-12 col-md-6 pr-md-1">
|
||||
<div class="form-group form-group-default b-rad-none required">
|
||||
<label>Unit Price</label>
|
||||
<input type="text" class="form-control b-rad-none" placeholder="Unit Price" v-model.lazy="product.unit_price" v-money="productPrice" />
|
||||
<input id="unit_price" name="unit_price" type="text" class="form-control b-rad-none" placeholder="Unit Price" v-model.lazy="product.unit_price" v-money="productPrice" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-6 pl-md-1">
|
||||
<div class="form-group form-group-default b-rad-none no-padding no-border">
|
||||
<div class="row no-margin">
|
||||
<div class="col-auto bg-master-lightest pointer" @mousedown="updateQuantity" @mouseleave="clearInterval" @mouseup="clearInterval" @touchstart="updateQuantity" @touchend="clearInterval" @touchcancel="clearInterval">
|
||||
<div id="minus-quantity" name="minus-quantity" class="col-auto bg-master-lightest pointer" @mousedown="updateQuantity" @mouseleave="clearInterval" @mouseup="clearInterval" @touchstart="updateQuantity" @touchend="clearInterval" @touchcancel="clearInterval">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa fa-minus"></i>
|
||||
@@ -59,9 +59,9 @@
|
||||
</div>
|
||||
<div class="col no-padding">
|
||||
<label class="p-t-5 p-l-5 text-center">Quantity</label>
|
||||
<input type="text" class="form-control m-b-5 b-rad-none no-border text-center" v-model.lazy="product.quantity" v-mask="'#########'"/>
|
||||
<input id="quantity" name="quantity" type="text" class="form-control m-b-5 b-rad-none no-border text-center" v-model.lazy="product.quantity" v-mask="'#########'"/>
|
||||
</div>
|
||||
<div class="col-auto bg-master-lightest pointer" @mousedown="updateQuantity('add')" @mouseleave="clearInterval" @mouseup="clearInterval" @touchstart="updateQuantity('add')" @touchend="clearInterval" @touchcancel="clearInterval">
|
||||
<div id="add-quantity" name="add-quantity" class="col-auto bg-master-lightest pointer" @mousedown="updateQuantity('add')" @mouseleave="clearInterval" @mouseup="clearInterval" @touchstart="updateQuantity('add')" @touchend="clearInterval" @touchcancel="clearInterval">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa fa-plus"></i>
|
||||
@@ -78,7 +78,7 @@
|
||||
<h6 class="no-margin bold text-complete">{{data.fixed_currency.short_code}} {{productTotal.toFixed(3)}}</h6>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md">
|
||||
<button class="btn btn-sm btn-block btn-complete b-rad-none" @click="addProduct()">Add Product</button>
|
||||
<button id="add-product" name="add-product" class="btn btn-sm btn-block btn-complete b-rad-none" @click="addProduct()">Add Product</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -119,7 +119,7 @@
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<button class="btn btn-xs all-caps b-rad-none btn-primary btn-block" @click="submitForm()">{{(Math.round((poTotal + Number.EPSILON) * 1000) / 1000).toFixed(3) !== (Math.round((data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3) ? 'Save Purchase Order' : 'Save & Confirm'}}</button>
|
||||
<button id="save-purchase-order" name="save-purchase-order" class="btn btn-xs all-caps b-rad-none btn-primary btn-block" @click="submitForm()">{{(Math.round((poTotal + Number.EPSILON) * 1000) / 1000).toFixed(3) !== (Math.round((data.amount + Number.EPSILON) * 1000) / 1000).toFixed(3) ? 'Save Purchase Order' : 'Save & Confirm'}}</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="(Math.round((poTotal + Number.EPSILON) * 1000) / 1000).toFixed(3) !== data.amount">
|
||||
@@ -269,4 +269,4 @@
|
||||
},
|
||||
mixins: [formHandler]
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -58,13 +58,13 @@
|
||||
<div class="col-4 p-r-5">
|
||||
<div class="form-group form-group-default b-rad-none">
|
||||
<label>Stock Code</label>
|
||||
<input type="text" class="form-control b-rad-none" v-model="product.stockCode" />
|
||||
<input id="stock_code" name="stock_code" type="text" class="form-control b-rad-none" v-model="product.stockCode" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="form-group form-group-default b-rad-none required">
|
||||
<label>description</label>
|
||||
<input class="form-control b-rad-none" rows="1" @keyup="onlyEnglish($event)" v-model="product.description">
|
||||
<input id="desc" name="desc" class="form-control b-rad-none" rows="1" @keyup="onlyEnglish($event)" v-model="product.description">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,13 +72,13 @@
|
||||
<div class="col-6 p-r-5">
|
||||
<div class="form-group form-group-default b-rad-none required">
|
||||
<label>Unit Price</label>
|
||||
<input type="text" class="form-control b-rad-none" placeholder="Unit Price" v-model.lazy="product.unit_price" v-money="productPrice" />
|
||||
<input id="unit_price" name="unit_price" type="text" class="form-control b-rad-none" placeholder="Unit Price" v-model.lazy="product.unit_price" v-money="productPrice" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 p-l-5">
|
||||
<div class="form-group form-group-default b-rad-none no-padding no-border">
|
||||
<div class="row no-margin">
|
||||
<div class="col-auto bg-master-lighter pointer" @mousedown="updateQuantity" @mouseleave="clearInterval" @mouseup="clearInterval" @touchstart="updateQuantity" @touchend="clearInterval" @touchcancel="clearInterval">
|
||||
<div id="minus-quantity" name="minus-quantity" class="col-auto bg-master-lighter pointer" @mousedown="updateQuantity" @mouseleave="clearInterval" @mouseup="clearInterval" @touchstart="updateQuantity" @touchend="clearInterval" @touchcancel="clearInterval">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa fa-minus"></i>
|
||||
@@ -87,9 +87,9 @@
|
||||
</div>
|
||||
<div class="col no-padding">
|
||||
<label class="p-t-5 p-l-5 text-center">Quantity</label>
|
||||
<input type="text" class="form-control m-b-5 b-rad-none no-border text-center" v-model.lazy="product.quantity" v-mask="'#########'"/>
|
||||
<input id="quantity" name="quantity" type="text" class="form-control m-b-5 b-rad-none no-border text-center" v-model.lazy="product.quantity" v-mask="'#########'"/>
|
||||
</div>
|
||||
<div class="col-auto bg-master-lighter pointer" @mousedown="updateQuantity('add')" @mouseleave="clearInterval" @mouseup="clearInterval" @touchstart="updateQuantity('add')" @touchend="clearInterval" @touchcancel="clearInterval">
|
||||
<div id="add-quantity" name="add-quantity" class="col-auto bg-master-lighter pointer" @mousedown="updateQuantity('add')" @mouseleave="clearInterval" @mouseup="clearInterval" @touchstart="updateQuantity('add')" @touchend="clearInterval" @touchcancel="clearInterval">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa fa-plus"></i>
|
||||
@@ -185,4 +185,4 @@
|
||||
},
|
||||
mixins: [formHandler]
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col b-a b-grey" :class="{'b-gray': !selected, 'b-primary': selected, 'bg-primary-lighter': selected}">
|
||||
<div class="row">
|
||||
<div class="col padding-20">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-auto pointer align-items-center" @click="selectSupplier()">
|
||||
<i class="fa fs-30 fa-fw" :class="{'fa-square-o': !selected, 'fa-check-square': selected, 'text-primary':selected}" ></i>
|
||||
</div>
|
||||
<div class="col">
|
||||
<h5 class="no-margin">{{ item.name }}</h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from "../../../general/mixins/componentHandler";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
selectedSupplier: {
|
||||
type: Array,
|
||||
required: false,
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
selected: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectSupplier(){
|
||||
this.selected = !this.selected;
|
||||
this.$emit('input', this.item);
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="row bg-white padding-40">
|
||||
<div class="col">
|
||||
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
|
||||
<div class="row justify-content-center" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h3 class="all-caps text-center">Please select the supplier.</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<list-component section="supplierListSection" :endpoint="route('api.company.list')" :options="{business_type: 3}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<select-individual-supplier-form-component :data="data" :selectedSupplier="selectedSupplier" v-on:input="updateList($event)"></select-individual-supplier-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from "../../../general/mixins/componentHandler";
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required, minValue} from "vuelidate/lib/validators";
|
||||
import {VMoney} from 'v-money'
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
selectedSupplier: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.$emit('input', this.selectedSupplier);
|
||||
this.closeModal();
|
||||
},
|
||||
updateList(supplier){
|
||||
this.selectedSupplier.includes(supplier) ? this.selectedSupplier.splice(this.selectedSupplier.indexOf(supplier), 1) : this.selectedSupplier.push(supplier);
|
||||
},
|
||||
},
|
||||
mixins: [componentHandler, ModalFormHandler]
|
||||
};
|
||||
</script>
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<button class="btn btn-lg btn-default bg-master-lightest b-rad-none all-caps fs-12" data-dismiss="modal">Cancel</button>
|
||||
<button id="cancel-new-booking" name="cancel-new-booking" class="btn btn-lg btn-default bg-master-lightest b-rad-none all-caps fs-12" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<button class="btn btn-lg btn-success b-rad-none all-caps fs-12" v-if="Object.keys(data.bankAccount).length" @click="submitForm()">Confirm & Proceed</button>
|
||||
<button id="confirm-new-booking" name="confirm-new-booking" class="btn btn-lg btn-success b-rad-none all-caps fs-12" v-if="Object.keys(data.bankAccount).length" @click="submitForm()">Confirm & Proceed</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -37,4 +37,4 @@
|
||||
},
|
||||
mixins: [ModalFormHandler]
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@
|
||||
<div class="btn btn-xs btn-outline-primary btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="selectedSupplier.status = !selectedSupplier.status">
|
||||
<div class="row">
|
||||
<div class="col p-t-5 p-b-5 fs-9">
|
||||
{{selectedSupplier.name}}
|
||||
{{selectedSupplier.name}} - {{selectedSupplier.reference}}
|
||||
</div>
|
||||
<div class="col-auto b-l b-success">
|
||||
<div class="row h-100 align-items-center">
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10" :class="[{'bg-primary-light': selectedSupplier.id === supplier.id}, {'text-white': selectedSupplier.id === supplier.id}, {'hover-primary': selectedSupplier.id !== supplier.id}, {'pointer': selectedSupplier.id !== supplier.id}]" @click="updateSupplier(supplier)">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">{{supplier.name}}</div>
|
||||
<div class="font-heading fs-10">{{supplier.name}} - {{supplier.reference}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-22
@@ -123,28 +123,7 @@
|
||||
</button>
|
||||
</div>
|
||||
<modal-component small type="rejectDocument">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Reject Document</h5>
|
||||
<div class="fs-11">Are you sure you want to reject this customer's identification?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-danger btn-block b-rad-none" @click="approveDocument('reject')">Reject</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<reject-identification-verification-form-component :section="section" :data="item"></reject-identification-verification-form-component>
|
||||
</modal-component>
|
||||
<div class="col no-padding ml-auto">
|
||||
<button class="btn btn-md btn-block btn-success b-rad-none p-t-10 p-b-10 requestModal" data-type="approveDocument">
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-auto text-center">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h5 class="all-caps">Reject Document</h5>
|
||||
<div class="fs-11">Are you sure you want to reject this customer's identification?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-left margin-auto m-t-10 m-b-10">
|
||||
<div class="col">
|
||||
<span class="text-danger fs-9">{{ error }}</span>
|
||||
<div class="fs-11">Reason: </div>
|
||||
<div class="row">
|
||||
<div class="col fs-11">
|
||||
<div class="b-a padding-5 w-100 m-b-5 pointer b-grey muted" :class="{'b-primary': rejectRemark === rejectRemarkItem, 'text-primary': rejectRemark === rejectRemarkItem}" v-for="rejectRemarkItem in rejectRemarkArray" @click="chooseRejectRemark(rejectRemarkItem)">{{ rejectRemarkItem }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div data-dismiss="modal" class="btn btn-sm btn-default bg-master-lighter btn-block b-rad-none">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-danger btn-block b-rad-none" @click="approveDocument('reject')">Reject</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import modalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
rejectRemark: null,
|
||||
rejectRemarkArray: null,
|
||||
documentType: this.data.document_type === 'IDENTITY_CARD' ? 'IC' : 'SSM',
|
||||
error: null,
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
rejectRemark: { required },
|
||||
},
|
||||
created(){
|
||||
this.rejectRemarkArray = [
|
||||
this.documentType + ' not clear',
|
||||
this.documentType + ' name different with registration name',
|
||||
'Wrong Document uploaded',
|
||||
'Non-Malaysian ' + this.documentType + ' Uploaded',
|
||||
this.documentType + ' not Genuine'
|
||||
];
|
||||
},
|
||||
methods: {
|
||||
approveDocument(status){
|
||||
this.rejectRemark === null ? this.error = 'Please choose a remark.' : null;
|
||||
this.isLoading = true;
|
||||
this.submit(this.route('api.company.identification.approval', this.item.owner.id, this.item.id, status), 'put', 'identificationVerificationSection', true, true);
|
||||
},
|
||||
chooseRejectRemark(remark) {
|
||||
this.rejectRemark = remark;
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler, modalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -18,7 +18,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">{{item.name}}</div>
|
||||
<div class="font-heading all-caps fs-10">{{item.name}} - {{item.reference}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,6 +61,18 @@
|
||||
<div class="col-auto">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button class="btn btn-xs btn-outline-primary b-rad-none m-r-5 requestModal" data-type="activateSupplierModal" v-if="item.status === 5">
|
||||
Activate
|
||||
</button>
|
||||
<modal-component type="activateSupplierModal">
|
||||
<activate-supplier-form-component :data="item" section="suppliersSection"></activate-supplier-form-component>
|
||||
</modal-component>
|
||||
<button class="btn btn-xs btn-outline-danger b-rad-none m-r-5 requestModal" data-type="suspendSupplierModal" v-if="item.status !== 5">
|
||||
Suspend
|
||||
</button>
|
||||
<modal-component type="suspendSupplierModal">
|
||||
<suspend-supplier-form-component :data="item" section="suppliersSection"></suspend-supplier-form-component>
|
||||
</modal-component>
|
||||
<button class="btn btn-xs btn-outline-warning b-rad-none m-r-5 requestModal" data-type="editServiceCharge">
|
||||
<i class="fa fa-pencil"></i>
|
||||
</button>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div class="row text-center">
|
||||
<div class="col">
|
||||
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
|
||||
<div class="row justify-content-center" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h3 class="all-caps">Are you Sure?</h3>
|
||||
<div class="fs-11">Are you sure you want to activate this Supplier?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-danger btn-block b-rad-none" @click="submitForm()">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
section: {
|
||||
default: 'suppliersSection'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.parameters.status = 1;
|
||||
this.submit(this.route('api.company.status.update', this.data.id), 'put', this.section, true, false);
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler, ModalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -22,6 +22,14 @@
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.company_reference">
|
||||
<label>Reference</label>
|
||||
<input type="text" class="form-control" v-model="parameters.company_reference">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-default bg-master-lightest btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
@@ -43,6 +51,7 @@
|
||||
return {
|
||||
parameters: {
|
||||
company_name: '',
|
||||
company_reference: '',
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -50,7 +59,10 @@
|
||||
parameters: {
|
||||
company_name: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
company_reference: {
|
||||
required: true
|
||||
},
|
||||
}
|
||||
},
|
||||
mixins: [ModalFormHandler]
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div class="row text-center">
|
||||
<div class="col">
|
||||
<loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
|
||||
<div class="row justify-content-center" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<div class="row m-b-20">
|
||||
<div class="col">
|
||||
<h3 class="all-caps">Are you Sure?</h3>
|
||||
<div class="fs-11">Are you sure you want to suspend this Supplier?</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col p-r-5">
|
||||
<div class="btn btn-sm btn-success btn-block b-rad-none" data-dismiss="modal">Cancel</div>
|
||||
</div>
|
||||
<div class="col p-l-5">
|
||||
<div class="btn btn-sm btn-danger btn-block b-rad-none" @click="submitForm()">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
section: {
|
||||
default: 'suppliersSection'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.parameters.status = 5;
|
||||
this.submit(this.route('api.company.status.update', this.data.id), 'put', this.section, true, false);
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler, ModalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -53,14 +53,14 @@
|
||||
</div>
|
||||
<div class="col-12 col-md-auto d-flex align-items-center flex-md-column justify-content-center">
|
||||
<button type="button" class="btn btn-lg btn-primary fs-11 w-100 d-block m-r-5 mr-md-0 mb-md-1 mb-0" @click="submitSearch()">Search</button>
|
||||
<button type="button" class="btn btn-lg btn-secondary fs-11 w-100 d-block m-l-5 ml-md-0 mt-md-1 0t-0" @click="reserSearch()">Reset</button>
|
||||
<button type="button" class="btn btn-lg btn-secondary fs-11 w-100 d-block m-l-5 ml-md-0 mt-md-1 0t-0" @click="resetSarch()">Reset</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin" v-show="search" :key="serachSectionKey">
|
||||
<div class="col bg-white padding-25">
|
||||
<list-component :section="section" :endpoint="route('api.company.list')" :options="{'with_total_payments': true, 'recency': recency, 'frequency': frequency, 'monetary': monetary, 'business_type': 2, with_bookings:true, order_by:{ column:'total_payments', DESC:true}}">
|
||||
<list-component :section="section" :endpoint="route('api.company.list')" :options="{'with_total_payments': true, 'recency': parameters.recency, 'frequency': parameters.frequency, 'monetary': parameters.monetary, 'business_type': 2, with_bookings:true, order_by:{ column:'total_payments', DESC:true}}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<company-component :data="data"></company-component>
|
||||
</template>
|
||||
@@ -96,10 +96,11 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
submitSearch(){
|
||||
this.search = true;
|
||||
this.serachSectionKey ++;
|
||||
this.search = true;
|
||||
},
|
||||
reserSearch() {
|
||||
resetSarch() {
|
||||
this.search = false;
|
||||
this.parameters.recency = '2022-02-15';
|
||||
this.parameters.frequency = 0;
|
||||
this.parameters.frequencyDateFrom ='2021-01-01';
|
||||
@@ -107,7 +108,6 @@ export default {
|
||||
this.parameters.monetary = 0;
|
||||
this.parameters.monetaryDateFrom = '2021-01-01';
|
||||
this.parameters.monetaryDateTo = '2022-02-15';
|
||||
this.serachSectionKey ++;
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<div class="row h-100">
|
||||
<div class="col">
|
||||
<div class="btn-group h-100">
|
||||
<div class="d-none d-md-flex row align-items-center justify-content-center b-a b-thick h-100 pointer" :class="{'b-info' : isClicked}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @click="openNotification()" style="border-color: #ffffff3d">
|
||||
<div class="col p-r-10 p-l-10">
|
||||
<i class="fa fa-bell fs-12" :class="{'text-info' : isClicked, 'text-primary-lighter' : !isClicked}"></i>
|
||||
</div>
|
||||
</div>
|
||||
<i class="fa fa-bell fs-18 d-md-none" :class="{'text-info' : isClicked, 'text-white' : !isClicked}" style="margin-right: -10px;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" @click="openNotification()"></i>
|
||||
<div class="b-rad-md dropdown-menu dropdown-menu-right p-l-15 p-b-15 p-r-15 p-t-0" style="height: 100vh; width:100vw; background: transparent !important; box-shadow: none!important;" @click="openNotification()">
|
||||
<div class="container-fluid container-fixed-lg" style="position: relative; background: transparent; height: 100vh; left: 0;">
|
||||
<div class="row shadow" style="width: 320px; position: absolute; top: 50px; right: 30px; background: white!important;">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="bg-master-lighter col p-l-10 p-l-10 p-t-10 bg-white text-center">
|
||||
<p>Notification Center</p>
|
||||
</div>
|
||||
</div>
|
||||
<loading-component style="height: 200px; top: 0;" key="1" color="primary" v-show="isLoading"></loading-component>
|
||||
<div class="row" :class="{'h-100' : notificationsLength >= 5}" v-show="!isLoading" style="max-height: 400px; ">
|
||||
<div class="col page-container overflow-hidden">
|
||||
<div class="row b-b b-grey bg-primary-lighter-hover pointer w-100 m-l-0 m-r-0" v-for="(notification, index) in notifications">
|
||||
<div class="col-auto justify-content-center align-items-center d-flex hide">
|
||||
<div>
|
||||
<i class="fa fa-check-circle fs-20 p-l-5 text-success"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col padding-10 p-l-15 p-r-15">
|
||||
<p class="bold m-b-5 lh-16">{{ notification.title }}</p>
|
||||
<p class="fs-9 m-b-0 lh-10">{{ notification.description }}</p>
|
||||
<p class="fs-9 m-b-0 m-t-10 lh-10">{{ notification.long_ago }}</p>
|
||||
</div>
|
||||
<div class="col-auto justify-content-center align-items-center d-none" :class="{'d-flex' : index === 0}">
|
||||
<div>
|
||||
<i class="fa fa-circle fs-10 text-primary"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row text-center m-t-50 m-b-50" v-if="notificationsLength === 0" v-show="!isLoading">
|
||||
<div class="col">
|
||||
<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>
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<div class="col">
|
||||
<div class="row m-t-20">
|
||||
<div class="col">
|
||||
<p class="all-caps no-margin fs-11" style="letter-spacing: 2px;">Nothing To Show Here</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-5 align-items-center justify-content-center hide">
|
||||
<div class="col">
|
||||
<small class="fs-9 muted all-caps font-lato" style="letter-spacing: 2px">There is no results found.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row b-t muted">
|
||||
<div class="col p-l-10 p-l-10 p-t-10 m-b-10 bg-white text-center">
|
||||
<a href="#">View All Notifications</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
isLoading: true,
|
||||
error: '',
|
||||
notifications: null,
|
||||
isClicked: false,
|
||||
notificationsLength: 0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openNotification(){
|
||||
this.isClicked === false ? this.fetchNotification() : '';
|
||||
this.isClicked = !this.isClicked;
|
||||
},
|
||||
fetchNotification(){
|
||||
this.isLoading = true;
|
||||
this.submit(route('notifications.list'), 'get', this.section, false, false)
|
||||
},
|
||||
successHandler(response){
|
||||
this.isLoading = false;
|
||||
this.notifications = response.payload.data;
|
||||
this.notificationsLength = response.payload.data.length;
|
||||
},
|
||||
},
|
||||
mixins: [ModalFormHandler]
|
||||
}
|
||||
</script>
|
||||
@@ -1,122 +1,127 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-12 p-0" style="width: 500px; height:350px">
|
||||
<canvas id="wallets-chart"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<loading-component v-if="isLoading"></loading-component>
|
||||
<div class="row" v-if="!isLoading">
|
||||
<div class="col">
|
||||
<div class="card no-border bg-success text-white widget-loader-bar m-b-10">
|
||||
<div class="container-xs-height full-height">
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="card-header top-left top-right">
|
||||
<div class="card-title">
|
||||
<span class="font-montserrat fs-11 all-caps">Total Amount</span>
|
||||
<div class="row">
|
||||
<div class="col-12 p-0" style="height:350px">
|
||||
<canvas id="wallets-chart" class="w-100"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card no-border bg-success text-white widget-loader-bar m-b-10">
|
||||
<div class="container-xs-height full-height">
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="card-header top-left top-right">
|
||||
<div class="card-title">
|
||||
<span class="font-montserrat fs-11 all-caps">Total Amount</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
|
||||
<h3 class="no-margin p-b-5 text-white">MYR 500,123</h3>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
|
||||
<h3 class="no-margin p-b-5 text-white">MYR {{(Math.round((report.walletSum + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-bottom">
|
||||
<div class="progress progress-small m-b-0">
|
||||
<div class="progress-bar progress-bar-success" style="width: 0"></div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-bottom">
|
||||
<div class="progress progress-small m-b-0">
|
||||
<div class="progress-bar progress-bar-success" style="width: 0"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="card no-border bg-success-light text-white widget-loader-bar m-b-10">
|
||||
<div class="container-xs-height full-height">
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="card-header top-left top-right">
|
||||
<div class="card-title">
|
||||
<span class="font-montserrat fs-11 all-caps">Total Incoming Amount</span>
|
||||
<div class="col">
|
||||
<div class="card no-border bg-success-light text-white widget-loader-bar m-b-10">
|
||||
<div class="container-xs-height full-height">
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="card-header top-left top-right">
|
||||
<div class="card-title">
|
||||
<span class="font-montserrat fs-11 all-caps">Total Incoming Amount</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
|
||||
<h3 class="no-margin p-b-5 text-white">MYR 500,123</h3>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
|
||||
<h3 class="no-margin p-b-5 text-white">MYR {{(Math.round((report.incomingSum + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-bottom">
|
||||
<div class="progress progress-small m-b-0">
|
||||
<div class="progress-bar progress-bar-success" style="width: 0"></div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-bottom">
|
||||
<div class="progress progress-small m-b-0">
|
||||
<div class="progress-bar progress-bar-success" style="width: 0"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="card no-border bg-warning widget-loader-bar m-b-10">
|
||||
<div class="container-xs-height full-height">
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="card-header top-left top-right">
|
||||
<div class="card-title">
|
||||
<span class="font-montserrat fs-11 all-caps">Total Outgoing Amount</span>
|
||||
<div class="col">
|
||||
<div class="card no-border bg-warning widget-loader-bar m-b-10">
|
||||
<div class="container-xs-height full-height">
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="card-header top-left top-right">
|
||||
<div class="card-title">
|
||||
<span class="font-montserrat fs-11 all-caps">Total Outgoing Amount</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
|
||||
<h3 class="no-margin p-b-5">MYR 500,123</h3>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
|
||||
<h3 class="no-margin p-b-5 text-white">MYR {{(Math.round((report.outgoingSum + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-bottom">
|
||||
<div class="progress progress-small m-b-0">
|
||||
<div class="progress-bar progress-bar-primary" style="width: 0"></div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-bottom">
|
||||
<div class="progress progress-small m-b-0">
|
||||
<div class="progress-bar progress-bar-primary" style="width: 0"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="card no-border bg-danger text-white widget-loader-bar m-b-10">
|
||||
<div class="container-xs-height full-height">
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="card-header top-left top-right">
|
||||
<div class="card-title">
|
||||
<span class="font-montserrat fs-11 all-caps">Total Floating Amount</span>
|
||||
<div class="col d-none">
|
||||
<div class="card no-border bg-danger text-white widget-loader-bar m-b-10">
|
||||
<div class="container-xs-height full-height">
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="card-header top-left top-right">
|
||||
<div class="card-title">
|
||||
<span class="font-montserrat fs-11 all-caps">Total Floating Amount</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
|
||||
<h3 class="no-margin p-b-5 text-white">MYR 500,123</h3>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-top">
|
||||
<div class="p-l-20 p-t-50 p-b-40 p-r-20">
|
||||
<h3 class="no-margin p-b-5 text-white">MYR 500,123</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-bottom">
|
||||
<div class="progress progress-small m-b-0">
|
||||
<div class="progress-bar progress-bar-primary" style="width: 0"></div>
|
||||
<div class="row-xs-height">
|
||||
<div class="col-xs-height col-bottom">
|
||||
<div class="progress progress-small m-b-0">
|
||||
<div class="progress-bar progress-bar-primary" style="width: 0"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -133,43 +138,67 @@
|
||||
import Chart from 'chart.js';
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
section: 'walletStatsSection',
|
||||
isLoading: false,
|
||||
report: {
|
||||
incomingSum: 0,
|
||||
outgoingSum: 0,
|
||||
walletSum: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pendingQueue () {
|
||||
return this.$store.getters.isInCompleteQueue(this.section);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
wallet_details: function() {
|
||||
const ctx = document.getElementById('wallets-chart');
|
||||
var xValues = [100,200,300,400,500,600,700,800,900,1000];
|
||||
new Chart(ctx, {
|
||||
type: "line",
|
||||
data: {
|
||||
labels: 'ndcs',
|
||||
datasets: [{
|
||||
data: [860,1140,1060,1060,1070,1110,1330,2210,7830,2478],
|
||||
borderColor: "red",
|
||||
fill: false
|
||||
},
|
||||
pendingQueue(inComplete){
|
||||
if(inComplete){
|
||||
this.fetchReport();
|
||||
}
|
||||
},
|
||||
},
|
||||
created(){
|
||||
this.$store.dispatch('updateListQueue', {'name': this.section});
|
||||
},
|
||||
mounted() {
|
||||
const ctx = document.getElementById('wallets-chart');
|
||||
new Chart(ctx, {
|
||||
type: 'pie',
|
||||
data: {
|
||||
labels: ['Red', 'Orange', 'Yellow', 'Green', 'Blue'],
|
||||
datasets: [
|
||||
{
|
||||
data: [1600,1700,1700,1900,2000,2700,4000,5000,6000,7000],
|
||||
borderColor: "green",
|
||||
fill: false
|
||||
},
|
||||
{
|
||||
data: [300,700,2000,5000,6000,4000,2000,1000,200,100],
|
||||
borderColor: "blue",
|
||||
fill: false
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'top',
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Chart.js Line Chart'
|
||||
}
|
||||
label: 'Dataset 1',
|
||||
data: [1, 1, 1, 1, 1],
|
||||
}
|
||||
},
|
||||
});
|
||||
]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'top',
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: 'Chart.js Pie Chart'
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
fetchReport(){
|
||||
this.isLoading = true;
|
||||
this.submit(route('api.wallet.reports'), 'get', this.section, false, false)
|
||||
},
|
||||
successHandler(response){
|
||||
this.isLoading = false;
|
||||
this.report = response.payload.data;
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@section('inner_content')
|
||||
<div class="row">
|
||||
<div class="col p-t-15 p-b-15">
|
||||
<export-booking-transaction-form-component></export-booking-transaction-form-component>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="row tabsContainer">
|
||||
|
||||
@@ -303,11 +303,6 @@
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<upload-debtor-excel-component section="uploadDebtorExcelSection"></upload-debtor-excel-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
@extends('layouts.base_portal')
|
||||
@section('inner_content')
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6 no-padding">
|
||||
<download-billing-with-dates-component section="paymentsReportSection"></download-billing-withdates-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col bg-white p-t-15 p-b-15">
|
||||
<div class="row no-margin">
|
||||
@@ -35,6 +40,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-4">
|
||||
<div class="row m-b-15 p-b-10 b-b b-grey">
|
||||
<div class="col">
|
||||
<small class="all-caps muted fs-10">Transaction Groups</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component key="2" section="transactionGroupsListSection" :options="{'per_page': 5}" :endpoint="route('api.transaction.group.list')">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<transaction-group-component section="transactionGroupsListSection" :data="data"></transaction-group-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<br>
|
||||
<htmlpageheader name="page-header">
|
||||
<br><br>
|
||||
<div class="separator"><strong><i>{{ $invoice_transaction->bill_no }}</i></strong></div>
|
||||
<div class="separator"><strong><i>{{ $transaction->bill_no }}</i></strong></div>
|
||||
</htmlpageheader>
|
||||
|
||||
<table>
|
||||
@@ -30,10 +30,10 @@
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<div class="number">EDO: {{ $invoice_transaction->bill_no }}</div>
|
||||
<div class="number">EDO: {{ $transaction->bill_no }}</div>
|
||||
|
||||
|
||||
<div class="ref">REF: {{ $invoice_transaction->booking->marking }}</div>
|
||||
<div class="ref">REF: {{ $transaction->booking->marking }}</div>
|
||||
<div class="date">Date: {{ $po_order_transaction->created_at }}</div>
|
||||
<div> </div>
|
||||
</div>
|
||||
@@ -93,19 +93,19 @@
|
||||
<td class="description">{{ $transaction_detail->product_name }}</td>
|
||||
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
|
||||
<td width="15%" class="center top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }}
|
||||
@if($transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$transaction->currency_rate) * $transaction_detail->price, 2) }}
|
||||
@else
|
||||
{{ number_format($transaction_detail->price, 2) }}
|
||||
@endif
|
||||
</td>
|
||||
<td width="20%" class="right top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
@if($transaction->booking()->first()->fix_currency_id !== 1)
|
||||
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
{{ number_format((float)number_format( (1/$transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
|
||||
@php
|
||||
$subtotal += number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.','');
|
||||
$subtotal += number_format((float)number_format( (1/$transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.','');
|
||||
@endphp
|
||||
@else
|
||||
{{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
@@ -130,35 +130,35 @@
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Service Charges</td>
|
||||
<td class="right">
|
||||
{{ number_format($invoice_transaction->service_charge, 2) }}
|
||||
{{ number_format($transaction->service_charge, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Adjustment</td>
|
||||
<td class="right">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@if($transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format((float)number_format( (1/$transaction->currency_rate) * $transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@else
|
||||
{{ number_format((float)number_format($invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
{{ number_format((float)number_format($transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@if($invoice_transaction->tax > 0)
|
||||
@if($transaction->tax > 0)
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Tax</td>
|
||||
<td class="right">{{ number_format($invoice_transaction->tax, 2) }}</td>
|
||||
<td class="right">{{ number_format($transaction->tax, 2) }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td colspan="4"></td>
|
||||
<td class="right middle">Total</td>
|
||||
<td class="total right middle">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( ((1/$invoice_transaction->currency_rate) * $invoice_transaction->amount) + $invoice_transaction->service_charge + $invoice_transaction->tax, 2) }}
|
||||
@if($transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( ((1/$transaction->currency_rate) * $transaction->amount) + $transaction->service_charge + $transaction->tax, 2) }}
|
||||
@else
|
||||
{{ number_format($invoice_transaction->amount + $invoice_transaction->service_charge + $invoice_transaction->tax, 2) }}
|
||||
{{ number_format($transaction->amount + $transaction->service_charge + $transaction->tax, 2) }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<br>
|
||||
<htmlpageheader name="page-header">
|
||||
<br><br>
|
||||
<div class="separator"><strong><i>{{ $invoice_transaction->bill_no }}</i></strong></div>
|
||||
<div class="separator"><strong><i>{{ $transaction->bill_no }}</i></strong></div>
|
||||
</htmlpageheader>
|
||||
<table>
|
||||
<tr>
|
||||
@@ -29,7 +29,7 @@
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<div class="number">EI#: {{ $invoice_transaction->bill_no }}</div>
|
||||
<div class="number">EI#: {{ $transaction->bill_no }}</div>
|
||||
|
||||
|
||||
<div class="ref">Ref# {{ $po_order_transaction->booking->marking }}</div>
|
||||
@@ -92,19 +92,19 @@
|
||||
<td class="description">{{ $transaction_detail->product_name }}</td>
|
||||
<td width="10%" class="center top">{{ $transaction_detail->quantity }}</td>
|
||||
<td width="15%" class="center top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2) }}
|
||||
@if($transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( (1/$transaction->currency_rate) * $transaction_detail->price, 2) }}
|
||||
@else
|
||||
{{ number_format($transaction_detail->price, 2) }}
|
||||
@endif
|
||||
</td>
|
||||
<td width="20%" class="right top">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
@if($transaction->booking()->first()->fix_currency_id !== 1)
|
||||
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
{{ number_format((float)number_format( (1/$transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
|
||||
@php
|
||||
$subtotal += number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.','');
|
||||
$subtotal += number_format((float)number_format( (1/$transaction->currency_rate) * $transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2,'.','');
|
||||
@endphp
|
||||
@else
|
||||
{{ number_format((float)number_format($transaction_detail->price, 2,'.','')*$transaction_detail->quantity,2) }}
|
||||
@@ -129,35 +129,35 @@
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Service Charges</td>
|
||||
<td class="right">
|
||||
{{ number_format($invoice_transaction->service_charge, 2) }}
|
||||
{{ number_format($transaction->service_charge, 2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Adjustment</td>
|
||||
<td class="right">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format((float)number_format( (1/$invoice_transaction->currency_rate) * $invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@if($transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format((float)number_format( (1/$transaction->currency_rate) * $transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@else
|
||||
{{ number_format((float)number_format($invoice_transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
{{ number_format((float)number_format($transaction->amount, 2,'.','') - (float)number_format($subtotal, 2,'.',''),2) }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@if($invoice_transaction->tax > 0)
|
||||
@if($transaction->tax > 0)
|
||||
<tr class="billingcharges">
|
||||
<td colspan="4"></td>
|
||||
<td class="right">Tax</td>
|
||||
<td class="right">{{ number_format($invoice_transaction->tax, 2) }}</td>
|
||||
<td class="right">{{ number_format($transaction->tax, 2) }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<td colspan="4"></td>
|
||||
<td class="right middle">Total</td>
|
||||
<td class="total right middle">
|
||||
@if($invoice_transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( ((1/$invoice_transaction->currency_rate) * $invoice_transaction->amount) + $invoice_transaction->service_charge + $invoice_transaction->tax, 2) }}
|
||||
@if($transaction->booking()->first()->fix_currency_id !== 1)
|
||||
{{ number_format( ((1/$transaction->currency_rate) * $transaction->amount) + $transaction->service_charge + $transaction->tax, 2) }}
|
||||
@else
|
||||
{{ number_format($invoice_transaction->amount + $invoice_transaction->service_charge + $invoice_transaction->tax, 2) }}
|
||||
{{ number_format($transaction->amount + $transaction->service_charge + $transaction->tax, 2) }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user