mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # .env.example
This commit is contained in:
+4
-1
@@ -24,4 +24,7 @@ db/*
|
||||
docker-compose.yml
|
||||
package-lock.json
|
||||
public/*
|
||||
/public/*
|
||||
/public/*
|
||||
/storage/app/public
|
||||
public
|
||||
/storage/framework/laravel-excel
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ServiceCharge implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('reference', SegmentConstants::SERVICE_CHARGE)->where('detail->id', $value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
namespace App\Classes\General;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
class ExcelHandel
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function generateFolder($path = '')
|
||||
{
|
||||
$folder = \Storage::disk('public')->makeDirectory($path);
|
||||
return $folder;
|
||||
}
|
||||
|
||||
public static function insertExcel($path = '', $base64Set = [])
|
||||
{
|
||||
$file_info = [];
|
||||
$folder_path = ExcelHandel::generateFolder('excels/' . $path);
|
||||
|
||||
foreach ($base64Set as $key => $row) {
|
||||
|
||||
$exceldata = $row;
|
||||
$filename = (string) Str::uuid();
|
||||
|
||||
$f = finfo_open();
|
||||
$mime_type = finfo_file($f, $exceldata, FILEINFO_MIME_TYPE);
|
||||
|
||||
$extension = 'xls';
|
||||
|
||||
switch ($mime_type) {
|
||||
case 'application/vnd.ms-excel':
|
||||
$extension = 'xls';
|
||||
break;
|
||||
case 'application/zip':
|
||||
$extension = 'xlsx';
|
||||
break;
|
||||
}
|
||||
|
||||
if (empty($extension)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$exceldata = explode('base64,', $exceldata);
|
||||
$exceldata = base64_decode($exceldata[1]);
|
||||
|
||||
$filename_with_ext = $filename . '.' . $extension;
|
||||
|
||||
$file = ExcelHandel::generateExcel($path, $exceldata, $filename, $extension);
|
||||
|
||||
$file_info[] = [
|
||||
'path' => $path,
|
||||
'filename' => $filename_with_ext,
|
||||
'mime_type' => $mime_type,
|
||||
'extension' => $extension,
|
||||
'file_info' => empty($file) ? [] : $file,
|
||||
];
|
||||
}
|
||||
|
||||
return $file_info;
|
||||
}
|
||||
|
||||
public static function generateExcel($path = '', $exceldata = '', $filename = '', $extension = '')
|
||||
{
|
||||
$file_info = [];
|
||||
$file = \Storage::disk('public')->put('excels/' . $path . '/' . $filename . '.' . $extension, $exceldata);
|
||||
$file_info['original']['file'] = storage_path('app/public/excels/' . $path . '/' . $filename . '.' . $extension);
|
||||
|
||||
return $file_info;
|
||||
}
|
||||
|
||||
public static function removeExcel($excel_info = [])
|
||||
{
|
||||
$excel_info = json_decode(json_encode($excel_info), true);
|
||||
foreach ($excel_info as $key => $row) {
|
||||
if (!empty($row['path'])) {
|
||||
\File::delete([$row['file_info']['original']['file']]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +39,6 @@ class UpdateBankLogic extends AbstractControllerLogic
|
||||
/** @var FetchesBank */
|
||||
private $fetchesBank;
|
||||
|
||||
|
||||
/**
|
||||
* UpdateBankLogic constructor.
|
||||
* @param CanUpdateBank $canUpdateBank
|
||||
@@ -66,11 +65,18 @@ class UpdateBankLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$bankObject = new BankObject($request->input('company_id'), $request->input('country_id'),
|
||||
$request->input('reference'), $request->input('bank_name'), $request->input('holder_name'),
|
||||
$request->input('account_no'));
|
||||
|
||||
$bankObject = 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'),
|
||||
$request->input('country_id'),
|
||||
$request->input('reference')
|
||||
);
|
||||
|
||||
$bank = $this->fetchesBank->execute(['id' => $request->route('id')]);
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Banks\ControllersLogic;
|
||||
|
||||
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 Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateBankStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Update Bank Account Status',
|
||||
'message' => 'You have successfully updated the Bank Account Status'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesBank */
|
||||
private $fetchesBank;
|
||||
|
||||
/** @var UpdatesBankStatus */
|
||||
private $updatesBankStatus;
|
||||
|
||||
/**
|
||||
* UpdateBankStatusLogic constructor.
|
||||
* @param FetchesBank $fetchesBank
|
||||
* @param UpdatesBankStatus $updatesBankStatus
|
||||
*/
|
||||
public function __construct(
|
||||
FetchesBank $fetchesBank,
|
||||
UpdatesBankStatus $updatesBankStatus
|
||||
)
|
||||
{
|
||||
$this->fetchesBank = $fetchesBank;
|
||||
$this->updatesBankStatus = $updatesBankStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
$bank = $this->fetchesBank->execute(['id' => $request->route('id')]);
|
||||
|
||||
$bank_query = $this->updatesBankStatus->execute($bank, $request->input('status'));
|
||||
|
||||
return $this->resourceResponse(new BankResource($bank_query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class UpdatesBank extends AbstractUpdateRecord
|
||||
$model->bank_branch = $object->getBankBranch();
|
||||
$model->swift = $object->getSwift();
|
||||
$model->snap = $object->getSnap();
|
||||
$model->default = $object->getDefault();
|
||||
$model->reference = $object->getReference();
|
||||
|
||||
return $this->handler($model);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Banks\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Models\Bank;
|
||||
|
||||
class UpdatesBankStatus extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Bank $model
|
||||
* @param int $status
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Bank $model, int $status)
|
||||
{
|
||||
$model->status = $status;
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -78,31 +78,27 @@ class CreateBookingRefundLogic extends AbstractControllerLogic
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
|
||||
$booking = Booking::find($request->route('id'));
|
||||
|
||||
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('payment_id')]);
|
||||
|
||||
$booking = $transaction->owner;
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('RFD-');
|
||||
|
||||
if((int) $transaction->type === TransactionType::BILL){
|
||||
$customerBooking = $booking->transactions()->payments()->complete()->where('original_amount', '=', $transaction->original_amount)->where('id', '<', $transaction->id)->orderByDesc('id')->first();
|
||||
}
|
||||
|
||||
$refund = $this->calculatesBookingRefundAmount->execute($booking, $booking->fix_currency_id, $transaction->bill_no);
|
||||
dd($refund);
|
||||
$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, (int) $transaction->type === TransactionType::BILL ? $customerBooking : $transaction, $request->input('amount'));
|
||||
$transactionRefundCalculationObject = new TransactionRefundCalculationObject($booking, $transaction, $request->input('amount'));
|
||||
$transactionRefundCalculationObject->init();
|
||||
|
||||
$object = new TransactionObject($billNumber, TransactionType::REFUND, 1, $booking->company->id,
|
||||
$request->input('bank_id'),$transactionRefundCalculationObject->getConversionObject()->getPaymentMethod(),
|
||||
1, $transactionRefundCalculationObject->getConversionObject()->getPaymentMethod(),
|
||||
$transactionRefundCalculationObject->getRefundTotalAmount(), $transactionRefundCalculationObject->getAmount(), 1,
|
||||
$transactionRefundCalculationObject->getConversionObject()->getCurrencyId(), $transactionRefundCalculationObject->getTransaction()->currency_rate,
|
||||
$transactionRefundCalculationObject->getRefundTax(), $transactionRefundCalculationObject->getRefundServiceCharge(), null, ApprovalStatus::PENDING_VERIFICATION, [], $transaction->bill_no);
|
||||
|
||||
$transaction = $this->createsTransaction->execute($booking, $object);
|
||||
$transaction = $this->createsTransaction->execute($transaction, $object);
|
||||
|
||||
return $this->resourceResponse(new TransactionResource($transaction));
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ class FetchBookingPaymentQuotationLogic extends AbstractControllerLogic
|
||||
|
||||
return $this->response(['data' => $this->generatesBookingQuotation->execute(
|
||||
$this->fetchBookingQuotation->execute($booking->company, $conversionObject),
|
||||
$this->fetchesCompanyPaymentAttemptLimit->execute($booking->company)
|
||||
$this->fetchesCompanyPaymentAttemptLimit->execute($booking->company),
|
||||
$conversionObject
|
||||
)]);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Classes\Modules\Bookings\Services;
|
||||
|
||||
|
||||
use App\Classes\Modules\Bookings\DataTransferObjects\CalculationObject;
|
||||
use App\Classes\Modules\Currencies\DataTransferObjects\CurrencyConversionObject;
|
||||
use App\Http\Resources\BankResource;
|
||||
use App\Models\Bank;
|
||||
use Carbon\Carbon;
|
||||
@@ -12,12 +13,14 @@ use Carbon\CarbonInterval;
|
||||
class GeneratesBookingQuotation
|
||||
{
|
||||
|
||||
public function execute(CalculationObject $calculationObject, ?int $paymentAttemptLimit = 0){
|
||||
public function execute(CalculationObject $calculationObject, ?int $paymentAttemptLimit = 0, ?CurrencyConversionObject $currencyConversionObject = null){
|
||||
$date = Carbon::now();
|
||||
$days = $date->diffInDays($date->copy()->addMinutes($paymentAttemptLimit));
|
||||
$hours = $date->diffInHours($date->copy()->addMinutes($paymentAttemptLimit)->subDays($days)) ;
|
||||
$minutes = $date->diffInMinutes($date->copy()->addMinutes($paymentAttemptLimit)->subDays($days)->subHours($hours));
|
||||
|
||||
$receive_date = $currencyConversionObject ? Carbon::now()->endOfDay()->addWeekdays($currencyConversionObject->getServiceId() === 3 ? 4 : 2)->timezone('Asia/Singapore')->format('4:00 \P\M, jS M, Y \G\M\T T') : null;
|
||||
|
||||
return [
|
||||
'bank' => new BankResource(Bank::find($calculationObject->getConfigurations()->getBankId())),
|
||||
'rate' => $calculationObject->getConfigurations()->getRate(),
|
||||
@@ -30,6 +33,7 @@ class GeneratesBookingQuotation
|
||||
'sub_total' => $calculationObject->getSubTotal(),
|
||||
'total' => $calculationObject->getTotal(),
|
||||
'date' => Carbon::now()->timezone('Asia/Singapore')->format('h:i a, jS M, Y \G\M\T T'),
|
||||
'receive_date' => $receive_date,
|
||||
'payment_attempt_limit' => CarbonInterval::days($days)->hours($hours)->minutes($minutes)->forHumans()
|
||||
];
|
||||
}
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ use App\Models\Company;
|
||||
use App\Models\Currency;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class FetchCompanyBookingQuotationLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -71,7 +72,7 @@ class FetchCompanyBookingQuotationLogic extends AbstractControllerLogic
|
||||
if($calculationObject->getConvertibleTotal() < $calculationObject->getConfigurations()->getMinLimit()) throw new RequestValidationException('Your transfer is below the minimum amount allowed of '.$calculationObject->getConfigurations()->getMinLimit().' '.$currency->short_code);
|
||||
|
||||
//TODO add po limit validation
|
||||
return $this->response(['data' => $this->generatesBookingQuotation->execute($calculationObject)]);
|
||||
return $this->response(['data' => $this->generatesBookingQuotation->execute($calculationObject, 0, $conversionObject)]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\UpdatesCompanyDebtor;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Companies\Standards\Rules\CanUpdateCompany;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyDebtorLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Company',
|
||||
'message' => 'You have successfully updated the Company'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateCompany */
|
||||
private $canUpdateCompany;
|
||||
|
||||
/** @var UpdatesCompanyDebtor */
|
||||
private $updatesCompanyDebtor;
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/**
|
||||
* UpdateCompanyControllersLogic constructor.
|
||||
* @param CanUpdateCompany $canUpdateCompany
|
||||
* @param UpdatesCompanyDebtor $updatesCompanyDebtor
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
*/
|
||||
public function __construct(CanUpdateCompany $canUpdateCompany, UpdatesCompanyDebtor $updatesCompanyDebtor, FetchesCompany $fetchesCompany)
|
||||
{
|
||||
$this->canUpdateCompany = $canUpdateCompany;
|
||||
$this->updatesCompanyDebtor = $updatesCompanyDebtor;
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$debtor = $request->input('debtor');
|
||||
|
||||
$query = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
|
||||
$query = $this->updatesCompanyDebtor->execute($query, $debtor);
|
||||
|
||||
return $this->resourceResponse(new CompanyResource($query));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Companies\Services;
|
||||
|
||||
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
||||
use App\Classes\Modules\Companies\DataTransferObjects\CompanyObject;
|
||||
use App\Models\Company;
|
||||
|
||||
class UpdatesCompanyDebtor extends AbstractUpdateRecord
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Company $model
|
||||
* @param string $debtor
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Company $model, string $debtor)
|
||||
{
|
||||
$model->debtor = $debtor;
|
||||
return $this->handler($model);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Models\Company;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
class ExportsNullDebtors implements FromQuery, WithHeadings, WithHeadingRow, WithMapping, ShouldAutoSize
|
||||
{
|
||||
|
||||
use Exportable;
|
||||
|
||||
public function styles(Worksheet $sheet)
|
||||
{
|
||||
return [
|
||||
1 => ['font' => ['bold' => true]]
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Code',
|
||||
'CompanyName',
|
||||
'Desc2',
|
||||
'AreaCode',
|
||||
'SalesAgent',
|
||||
'DebtorType',
|
||||
'DisplayTerm',
|
||||
'AgingOn',
|
||||
'StatementType',
|
||||
'CurrencyCode',
|
||||
'RegisterNo',
|
||||
'Address1',
|
||||
'Address2',
|
||||
'Address3',
|
||||
'Address4',
|
||||
'PostCode',
|
||||
'DeliverAddr1',
|
||||
'DeliverAddr2',
|
||||
'DeliverAddr3',
|
||||
'DeliverAddr4',
|
||||
'DeliverPostCode',
|
||||
'Attention',
|
||||
'Phone1',
|
||||
'Phone2',
|
||||
'Fax1',
|
||||
'Fax2',
|
||||
'ExemptNo',
|
||||
'ExpiryDate',
|
||||
'PriceCategory',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
return Company::where('debtor', '=', null)->where('business_type', BusinessType::IMPORTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Company $company
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($company): array
|
||||
{
|
||||
return [
|
||||
$company->reference, //Code
|
||||
$company->name, //CompanyName
|
||||
'', //Desc2
|
||||
'', //AreaCode
|
||||
'', //SalesAgent
|
||||
'', //DebtorType
|
||||
'', //DisplayTerm
|
||||
'', //AgingOn
|
||||
'', //StatementType
|
||||
'MYR', //CurrencyCode
|
||||
$company->reference, //RegisterNo
|
||||
'', //Address1
|
||||
'', //Address2
|
||||
'', //Address3
|
||||
'', //Address4
|
||||
'', //PostCode
|
||||
'', //DeliverAddr1
|
||||
'', //DeliverAddr2
|
||||
'', //DeliverAddr3
|
||||
'', //DeliverAddr4
|
||||
'', //DeliverPostCode
|
||||
'', //Attention
|
||||
'', //Phone1
|
||||
'', //Phone2
|
||||
'', //Fax1
|
||||
'', //Fax2
|
||||
'', //ExemptNo
|
||||
'', //ExpiryDate
|
||||
'', //PriceCategory
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
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 Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ExportsPaymentTransactions implements FromQuery, WithHeadingRow, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'DocNo',
|
||||
'DocDate',
|
||||
'DebtorCode',
|
||||
'Ref',
|
||||
'Note',
|
||||
'ShipInfo',
|
||||
'Numbering',
|
||||
'AccNo',
|
||||
'DetailDescription',
|
||||
'FutherDEscription',
|
||||
'YourPONo',
|
||||
'YourPODate',
|
||||
'ProjNo',
|
||||
'UOM',
|
||||
'Qty',
|
||||
'UnitPrice',
|
||||
'SubTotal'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$start_date = $this->request->input('start_date', null);
|
||||
if ($start_date) {
|
||||
$start_date = Carbon::parse($this->request->input('start_date'))->format('Y-m-d');
|
||||
}
|
||||
|
||||
$end_date = $this->request->input('end_date', null);
|
||||
if ($end_date) {
|
||||
$end_date = Carbon::parse($this->request->input('end_date'))->format('Y-m-d');
|
||||
}
|
||||
|
||||
$query = Transaction::query();
|
||||
|
||||
$query->where('type', TransactionType::PAYMENT)->where('payment_method', '!=', PaymentMethodType::WALLET);
|
||||
$query->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
|
||||
if($start_date && $end_date) {
|
||||
$query->whereBetween('created_at', [
|
||||
Carbon::parse($start_date)->format('Y-m-d 0:00:00'),
|
||||
Carbon::parse($end_date)->format('Y-m-d 23:59:59')
|
||||
]);
|
||||
}
|
||||
elseif($start_date && !$end_date) {
|
||||
$query->where('created_at', '>=', Carbon::parse($start_date)->format('Y-m-d 0:00:00'));
|
||||
}
|
||||
elseif(!$start_date && $end_date) {
|
||||
$query->where('created_at', '<=', Carbon::parse($end_date)->format('Y-m-d 23:59:59'));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Company $transaction
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($transaction): array
|
||||
{
|
||||
$booking = $transaction->owner()->first();
|
||||
$company = $booking->company()->first();
|
||||
|
||||
return [
|
||||
'<<New>>',
|
||||
$transaction->updated_at,
|
||||
$company->debtor,
|
||||
'',
|
||||
'',
|
||||
$booking->marking,
|
||||
'',
|
||||
'500-0000',
|
||||
'PLEASE REFER TO THE ATTACHED APPENDIX REF ' . $booking->marking,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
1,
|
||||
$transaction->amount,
|
||||
$transaction->amount,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Exports\Services;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
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 Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class ExportsWalletTransactions implements FromQuery, WithHeadingRow, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
private $request;
|
||||
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'DocNo',
|
||||
'DocDate',
|
||||
'DebtorCode',
|
||||
'Ref',
|
||||
'Note',
|
||||
'ShipInfo',
|
||||
'Numbering',
|
||||
'AccNo',
|
||||
'DetailDescription',
|
||||
'FutherDEscription',
|
||||
'YourPONo',
|
||||
'YourPODate',
|
||||
'ProjNo',
|
||||
'UOM',
|
||||
'Qty',
|
||||
'UnitPrice',
|
||||
'SubTotal'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection|mixed
|
||||
*/
|
||||
public function query()
|
||||
{
|
||||
$start_date = $this->request->input('start_date', null);
|
||||
if ($start_date) {
|
||||
$start_date = Carbon::parse($this->request->input('start_date'))->format('Y-m-d');
|
||||
}
|
||||
|
||||
$end_date = $this->request->input('end_date', null);
|
||||
if ($end_date) {
|
||||
$end_date = Carbon::parse($this->request->input('end_date'))->format('Y-m-d');
|
||||
}
|
||||
|
||||
$query = Transaction::query();
|
||||
|
||||
$query->where('type', TransactionType::TOP_UP);
|
||||
$query->whereIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
|
||||
if($start_date && $end_date) {
|
||||
$query->whereBetween('created_at', [
|
||||
Carbon::parse($start_date)->format('Y-m-d 0:00:00'),
|
||||
Carbon::parse($end_date)->format('Y-m-d 23:59:59')
|
||||
]);
|
||||
}
|
||||
elseif($start_date && !$end_date) {
|
||||
$query->where('created_at', '>=', Carbon::parse($start_date)->format('Y-m-d 0:00:00'));
|
||||
}
|
||||
elseif(!$start_date && $end_date) {
|
||||
$query->where('created_at', '<=', Carbon::parse($end_date)->format('Y-m-d 23:59:59'));
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Company $transaction
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function map($transaction): array
|
||||
{
|
||||
$company = $transaction->owner->owner;
|
||||
|
||||
return [
|
||||
'<<New>>',
|
||||
$transaction->updated_at,
|
||||
$company->debtor,
|
||||
'',
|
||||
'',
|
||||
$company->reference,
|
||||
'',
|
||||
'500-0000',
|
||||
'BUYING CREDIT REF.' . $company->reference,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
1,
|
||||
$transaction->amount,
|
||||
$transaction->amount,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Imports\Services;
|
||||
|
||||
use App\Models\Company;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\ToModel;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadingRow;
|
||||
use Maatwebsite\Excel\Concerns\WithBatchInserts;
|
||||
use Maatwebsite\Excel\Concerns\WithValidation;
|
||||
|
||||
class ImportsDebtor implements ToModel, WithHeadingRow, WithBatchInserts, WithValidation
|
||||
{
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function model($row = [])
|
||||
{
|
||||
$reference = preg_split('(-|\(|\)|\/)', $row['2nd_description']);
|
||||
$reference = $reference[array_key_last($reference)];
|
||||
$debtor = $row['code'];
|
||||
$company = Company::where('reference', $reference)->first();
|
||||
|
||||
if ($company) {
|
||||
$company->debtor = $debtor;
|
||||
$company->update();
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
public function batchSize(): int
|
||||
{
|
||||
return 100;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\SegmentConstants\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanCreateConstant;
|
||||
use App\Classes\Modules\Segments\Services\CreatesConstant;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
|
||||
use App\Classes\Modules\Segments\Services\FetchesSegment;
|
||||
use App\Http\Resources\ConstantResource;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateSegmentConstantLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created Segment Constant',
|
||||
'message' => 'You have successfully created a new Segment Constant'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanCreateConstant */
|
||||
private $canCreateConstant;
|
||||
|
||||
/** @var CreatesConstant */
|
||||
private $createsConstant;
|
||||
|
||||
/** @var FetchesSegment */
|
||||
private $fetchesSegment;
|
||||
|
||||
|
||||
/**
|
||||
* CreateSegmentLogic constructor.
|
||||
* @param CanCreateConstant $canCreateConstant
|
||||
* @param CreatesConstant $createsConstant
|
||||
*/
|
||||
public function __construct(CanCreateConstant $canCreateConstant, CreatesConstant $createsConstant, FetchesSegment $fetchesSegment)
|
||||
{
|
||||
$this->canCreateConstant = $canCreateConstant;
|
||||
$this->createsConstant = $createsConstant;
|
||||
$this->fetchesSegment = $fetchesSegment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
{
|
||||
$constant_object = new ConstantObject($request->input('name'), $request->input('reference'), $request->input('detail'));
|
||||
|
||||
$segment = $this->fetchesSegment->execute(['id' => $request->input('segment_id')]);
|
||||
|
||||
$this->canCreateConstant->passes($constant_object);
|
||||
$constant = $this->createsConstant->execute($segment, $constant_object);
|
||||
|
||||
return $this->resourceResponse(new ConstantResource($constant));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\SegmentConstants\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
use App\Http\Resources\ConstantResource;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchSegmentConstantLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Segment Constant',
|
||||
'message' => 'You have successfully retrieved a segment constant'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesConstant */
|
||||
private $fetchesConstant;
|
||||
|
||||
/**
|
||||
* FetchSegmentLogic constructor.
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
*/
|
||||
public function __construct(FetchesConstant $fetchesConstant)
|
||||
{
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$query = $this->fetchesConstant->execute(['id' => $request->route('id')]);
|
||||
|
||||
return $this->resourceResponse(new ConstantResource($query));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\SegmentConstants\ControllersLogic;
|
||||
|
||||
use App\Http\Resources\ConstantResource;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
|
||||
use App\Classes\Modules\Segments\Services\FetchesConstant;
|
||||
|
||||
use App\Classes\Modules\Segments\Standards\Rules\CanUpdateConstant;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesConstant;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\ConstantObject;
|
||||
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class UpdateSegmentConstantLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Segment Constant',
|
||||
'message' => 'You have successfully updated the Segment Constant'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var CanUpdateConstant */
|
||||
private $canUpdateConstant;
|
||||
|
||||
/** @var UpdatesConstant */
|
||||
private $updatesConstant;
|
||||
|
||||
/** @var FetchesConstant */
|
||||
private $fetchesConstant;
|
||||
|
||||
|
||||
/**
|
||||
* UpdateSegmentLogic constructor.
|
||||
* @param CanUpdateConstant $canUpdateConstant
|
||||
* @param UpdatesConstant $updatesConstant
|
||||
* @param FetchesConstant $fetchesConstant
|
||||
*/
|
||||
public function __construct(
|
||||
CanUpdateConstant $canUpdateConstant,
|
||||
UpdatesConstant $updatesConstant,
|
||||
FetchesConstant $fetchesConstant
|
||||
)
|
||||
{
|
||||
$this->canUpdateConstant = $canUpdateConstant;
|
||||
$this->updatesConstant = $updatesConstant;
|
||||
$this->fetchesConstant = $fetchesConstant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$constant_query = $this->fetchesConstant->execute(['id' => $request->route('id')]);
|
||||
|
||||
$constant_object = new ConstantObject(
|
||||
$request->input('name', $constant_query->name),
|
||||
$request->input('reference', $constant_query->reference),
|
||||
$request->input('detail', (array) $constant_query->detail));
|
||||
$this->canUpdateConstant->passes($constant_object);
|
||||
$constant_query = $this->updatesConstant->execute($constant_query, $constant_object);
|
||||
|
||||
DB::commit();
|
||||
|
||||
return $this->resourceResponse(new ConstantResource($constant_query));
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+21
-69
@@ -3,31 +3,19 @@
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Transactions\Processors\CreateSupplierTransactionProcessor;
|
||||
use App\Models\Document;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\Services\CreatesFiles;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\DocumentType;
|
||||
use App\Models\Document;
|
||||
use App\Models\Transaction;
|
||||
use Barryvdh\DomPDF\PDF;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use Meneses\LaravelLaravelMpdf\Facades\LaravelLaravelMpdf;
|
||||
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
|
||||
use App\Classes\Modules\Documents\Services\CreatesDocument;
|
||||
use App\Classes\Modules\Documents\DataTransferObjects\DocumentObject;
|
||||
|
||||
class CreateSupplierTransactionLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -46,14 +34,8 @@ class CreateSupplierTransactionLogic extends AbstractControllerLogic
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var CreatesTransaction */
|
||||
private $createsTransaction;
|
||||
/** @var CreateSupplierTransactionProcessor */
|
||||
private $createSupplierTransactionProcessor;
|
||||
|
||||
/** @var CreatesDocument */
|
||||
private $createsDocument;
|
||||
@@ -61,32 +43,19 @@ class CreateSupplierTransactionLogic extends AbstractControllerLogic
|
||||
/** @var CreatesFiles */
|
||||
private $createsFile;
|
||||
|
||||
/** @var GeneratesTransactionBillNumber */
|
||||
private $generatesTransactionBillNumber;
|
||||
|
||||
/** @var PDF */
|
||||
private $pdf;
|
||||
|
||||
/**
|
||||
* CreateSupplierTransactionLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param CreatesTransaction $createsTransaction
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
* @param PDF $pdf
|
||||
* @param CreateSupplierTransactionProcessor $createSupplierTransactionProcessor
|
||||
* @param CreatesDocument $createsDocument
|
||||
* @param CreatesFiles $createsFile
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, CreatesTransaction $createsTransaction, CreatesDocument $createsDocument, CreatesFiles $createsFile, GeneratesTransactionBillNumber $generatesTransactionBillNumber, PDF $pdf)
|
||||
public function __construct(FetchesCompany $fetchesCompany, CreateSupplierTransactionProcessor $createSupplierTransactionProcessor, CreatesDocument $createsDocument, CreatesFiles $createsFile)
|
||||
{
|
||||
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->createSupplierTransactionProcessor = $createSupplierTransactionProcessor;
|
||||
$this->createsDocument = $createsDocument;
|
||||
$this->createsFile = $createsFile;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->pdf = $pdf;
|
||||
}
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
@@ -96,30 +65,13 @@ class CreateSupplierTransactionLogic extends AbstractControllerLogic
|
||||
|
||||
$rate = $request->input('rate');
|
||||
|
||||
$transactions = collect();
|
||||
$payments = $request->input('payments');
|
||||
|
||||
foreach($request->input('payments') as $payment){
|
||||
$this->createSupplierTransactionProcessor->execute($supplier, $rate, $payments);
|
||||
|
||||
/** @var Transaction $payment */
|
||||
$payment = $this->fetchesTransaction->execute(['id' => $payment['id']]);
|
||||
|
||||
if($payment->status !== ApprovalStatus::APPROVED) continue;
|
||||
if(!count($this->createSupplierTransactionProcessor->getBills())) return $this->response([]);
|
||||
|
||||
$this->updatesTransactionStatus->execute($payment, ApprovalStatus::COMPLETED);
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('SPLR-');
|
||||
$object = new TransactionObject($billNumber, TransactionType::BILL, $supplier->id, 1,
|
||||
$supplier->banks()->where('default', true)->first()->id, PaymentMethodType::CASH,
|
||||
$payment->original_amount * (1 / $rate), $payment->original_amount, 1, $payment->original_currency_id,
|
||||
$rate, 0, 0, null, ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
$transactions[] = $this->createsTransaction->execute($payment, $object);
|
||||
}
|
||||
|
||||
if(!count($transactions)) return $this->response([]);
|
||||
|
||||
$pdf = LaravelMpdf::loadView('pages.pdfs.currency_vendor_order', ['transactions' => $transactions, 'supplier' => $supplier]);
|
||||
|
||||
$path = Str::studly($supplier->name).'_'.Carbon::now()->format('Y_m_d_h_s_i').'.pdf';
|
||||
$pdf = LaravelMpdf::loadView('pages.pdfs.currency_vendor_order', ['transactions' => $this->createSupplierTransactionProcessor->getBills(), 'transferFeeTransactions' => $this->createSupplierTransactionProcessor->getTransferTransactions(), 'supplier' => $supplier]);
|
||||
|
||||
$object = new DocumentObject(
|
||||
DocumentType::CURRENCY_VENDOR_ORDER,
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Classes\Modules\Transactions\Processors\CreateSupplierTransactionProcessor;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Meneses\LaravelMpdf\Facades\LaravelMpdf;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use Meneses\LaravelLaravelMpdf\Facades\LaravelLaravelMpdf;
|
||||
|
||||
class DownloadMockUpWhiteFormPdfLogic
|
||||
{
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var CreateSupplierTransactionProcessor */
|
||||
private $createSupplierTransactionProcessor;
|
||||
|
||||
/**
|
||||
* DownloadMockUpWhiteFormPdfLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param CreateSupplierTransactionProcessor $createSupplierTransactionProcessor
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, CreateSupplierTransactionProcessor $createSupplierTransactionProcessor)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->createSupplierTransactionProcessor = $createSupplierTransactionProcessor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return string|\Symfony\Component\HttpFoundation\Response
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Request $request)
|
||||
{
|
||||
|
||||
$supplier = $this->fetchesCompany->execute(['id' => $request->route('id')]);
|
||||
|
||||
$rate = $request->input('rate');
|
||||
|
||||
$payments = array_map(function($value){
|
||||
return ['id' => $value];
|
||||
}, json_decode($request->input('payments')));
|
||||
|
||||
DB::beginTransaction();
|
||||
|
||||
$this->createSupplierTransactionProcessor->execute($supplier, $rate, $payments);
|
||||
|
||||
if(!count($this->createSupplierTransactionProcessor->getBills())) return 'unexpected error';
|
||||
|
||||
$pdf = LaravelMpdf::loadView('pages.pdfs.currency_vendor_order', ['transactions' => $this->createSupplierTransactionProcessor->getBills(), 'transferFeeTransactions' => $this->createSupplierTransactionProcessor->getTransferTransactions(), 'supplier' => $supplier]);
|
||||
|
||||
DB::rollBack();
|
||||
|
||||
return $pdf->stream('MockUpWhiteForm.pdf');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Models\Bank;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesBankBalanceAccount;
|
||||
|
||||
class FetchBankAccountBalanceLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Bank Balance Account',
|
||||
'message' => 'You have successfully retrieved bank balance account'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var GeneratesBankBalanceAccount */
|
||||
private $generatesBankBalanceAccount;
|
||||
|
||||
/**
|
||||
* FetchCompanyAccountBalanceLogic constructor.
|
||||
* @param GeneratesBankBalanceAccount $generatesBankBalanceAccount
|
||||
*/
|
||||
public function __construct(GeneratesBankBalanceAccount $generatesBankBalanceAccount)
|
||||
{
|
||||
$this->generatesBankBalanceAccount = $generatesBankBalanceAccount;
|
||||
}
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$bank = Bank::find($request->route('id'));
|
||||
|
||||
return $this->response(['data' => $this->generatesBankBalanceAccount->execute($bank)]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
use App\Models\Company;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesCompanyBalanceAccount;
|
||||
|
||||
class FetchCompanyAccountBalanceLogic extends AbstractControllerLogic
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Retrieved Company Balance Account',
|
||||
'message' => 'You have successfully retrieved company balance account'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var GeneratesCompanyBalanceAccount */
|
||||
private $generatesCompanyBalanceAccount;
|
||||
|
||||
/**
|
||||
* FetchCompanyAccountBalanceLogic constructor.
|
||||
* @param GeneratesCompanyBalanceAccount $generatesCompanyBalanceAccount
|
||||
*/
|
||||
public function __construct(GeneratesCompanyBalanceAccount $generatesCompanyBalanceAccount)
|
||||
{
|
||||
$this->generatesCompanyBalanceAccount = $generatesCompanyBalanceAccount;
|
||||
}
|
||||
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$company = Company::find($request->route('id'));
|
||||
|
||||
return $this->response(['data' => $this->generatesCompanyBalanceAccount->execute($company)]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\ControllersLogic;
|
||||
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Modules\Documents\Services\DeletesDocument;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Classes\Modules\Wallets\Processors\CreditWalletProcessor;
|
||||
|
||||
|
||||
class UpdateRefundTransactionStatusLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Updated Transaction',
|
||||
'message' => 'You have successfully updated a transaction'
|
||||
];
|
||||
}
|
||||
|
||||
/** @var FetchesCompany */
|
||||
private $fetchesCompany;
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var DeletesDocument */
|
||||
private $deletesDocument;
|
||||
|
||||
/** @var CreditWalletProcessor */
|
||||
private $creditWalletProcessor;
|
||||
|
||||
/**
|
||||
* CreatePaymentVerificationDocumentLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param DeletesDocument $deletesDocument
|
||||
* @param CreditWalletProcessor $creditWalletProcessor
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, DeletesDocument $deletesDocument, CreditWalletProcessor $creditWalletProcessor)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->deletesDocument = $deletesDocument;
|
||||
$this->creditWalletProcessor = $creditWalletProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
$transaction = $this->fetchesTransaction->execute(['id' => $request->route('id')]);
|
||||
|
||||
$transaction = $this->updatesTransactionStatus->execute($transaction, $request->input('status'));
|
||||
|
||||
$booking = $transaction->owner->owner;
|
||||
|
||||
$reference = 'Credit Voucher for Overpaid for Ref. '.$booking->marking;
|
||||
|
||||
if ($transaction->status == ApprovalStatus::APPROVED) {
|
||||
$this->creditWalletProcessor->execute($booking->company, $transaction->type, $transaction->amount, $reference);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $this->response([]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Processors;
|
||||
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\Services\CalculatesTransactionServiceCharge;
|
||||
use App\Classes\Modules\Transactions\Services\CalculatesTransactionTransferFee;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\FetchesTransaction;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\Modules\Transactions\Services\UpdatesTransactionStatus;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Company;
|
||||
use App\Models\SegmentConstant;
|
||||
use App\Models\Transaction;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class CreateSupplierTransactionProcessor
|
||||
{
|
||||
|
||||
/** @var FetchesTransaction */
|
||||
private $fetchesTransaction;
|
||||
|
||||
/** @var UpdatesTransactionStatus */
|
||||
private $updatesTransactionStatus;
|
||||
|
||||
/** @var CreatesTransaction */
|
||||
private $createsTransaction;
|
||||
|
||||
/** @var GeneratesTransactionBillNumber */
|
||||
private $generatesTransactionBillNumber;
|
||||
|
||||
/** @var CalculatesTransactionServiceCharge */
|
||||
private $calculatesTransactionServiceCharge;
|
||||
|
||||
/** @var CalculatesTransactionTransferFee */
|
||||
private $calculatesTransactionTransferFee;
|
||||
|
||||
/** @var Collection */
|
||||
private $bills;
|
||||
|
||||
/** @var Collection */
|
||||
private $transferFee;
|
||||
|
||||
/**
|
||||
* CreateSupplierTransactionProcessor constructor.
|
||||
* @param FetchesTransaction $fetchesTransaction
|
||||
* @param UpdatesTransactionStatus $updatesTransactionStatus
|
||||
* @param CreatesTransaction $createsTransaction
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
* @param CalculatesTransactionServiceCharge $calculatesTransactionServiceCharge
|
||||
* @param CalculatesTransactionTransferFee $calculatesTransactionTransferFee
|
||||
*/
|
||||
public function __construct(FetchesTransaction $fetchesTransaction, UpdatesTransactionStatus $updatesTransactionStatus, CreatesTransaction $createsTransaction, GeneratesTransactionBillNumber $generatesTransactionBillNumber, CalculatesTransactionServiceCharge $calculatesTransactionServiceCharge, CalculatesTransactionTransferFee $calculatesTransactionTransferFee)
|
||||
{
|
||||
$this->fetchesTransaction = $fetchesTransaction;
|
||||
$this->updatesTransactionStatus = $updatesTransactionStatus;
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->calculatesTransactionServiceCharge = $calculatesTransactionServiceCharge;
|
||||
$this->calculatesTransactionTransferFee = $calculatesTransactionTransferFee;
|
||||
$this->bills = collect();
|
||||
$this->transferFee = collect();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Company $supplier
|
||||
* @param String $rate
|
||||
* @param array $payments
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Company $supplier, String $rate, Array $payments) {
|
||||
|
||||
foreach($payments as $payment){
|
||||
|
||||
/** @var Transaction $payment */
|
||||
$payment = $this->fetchesTransaction->execute(['id' => $payment['id']]);
|
||||
|
||||
if($payment->status !== ApprovalStatus::APPROVED) continue;
|
||||
|
||||
$this->updatesTransactionStatus->execute($payment, ApprovalStatus::COMPLETED);
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute('SPLR-');
|
||||
$constant = SegmentConstant::where('reference', SegmentConstants::SERVICE_CHARGE)->where('detail->id', $supplier->id)->first();
|
||||
|
||||
$serviceCharge = $this->calculatesTransactionServiceCharge->execute($payment->original_amount, $rate, $constant);
|
||||
|
||||
$object = new TransactionObject($billNumber, TransactionType::BILL, $supplier->id, 1,
|
||||
$supplier->banks()->where('default', true)->first()->id, PaymentMethodType::CASH,
|
||||
$payment->original_amount * (1 / $rate), $payment->original_amount, 1, $payment->original_currency_id,
|
||||
$rate, 0, $serviceCharge, null, ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
/** @var Transaction $billTransaction */
|
||||
$billTransaction = $this->createsTransaction->execute($payment, $object);
|
||||
$this->pushBill($billTransaction);
|
||||
|
||||
$transferFeeNumber = $this->generatesTransactionBillNumber->execute('TRFR-');
|
||||
$transferFee = $this->calculatesTransactionTransferFee->execute($payment->original_amount, $constant);
|
||||
$object = new TransactionObject($transferFeeNumber, TransactionType::TRANSFER_FEE, 1, $supplier->id,
|
||||
$supplier->banks()->where('default', true)->first()->id, PaymentMethodType::CASH,
|
||||
$payment->original_amount, $payment->original_amount, $payment->original_currency_id, $payment->original_currency_id,
|
||||
1, 0, $transferFee, null, ApprovalStatus::PENDING_VERIFICATION);
|
||||
|
||||
$this->pushTransferFee($this->createsTransaction->execute($billTransaction, $object));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getBills(): Collection
|
||||
{
|
||||
return $this->bills;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getTransferTransactions(): Collection
|
||||
{
|
||||
return $this->transferFee;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $bill
|
||||
*/
|
||||
private function pushBill($bill): void
|
||||
{
|
||||
$this->bills->push($bill);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $transferFee
|
||||
*/
|
||||
private function pushTransferFee($transferFee): void
|
||||
{
|
||||
$this->transferFee->push($transferFee);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Services;
|
||||
|
||||
use App\Models\SegmentConstant;
|
||||
|
||||
class CalculatesTransactionServiceCharge
|
||||
{
|
||||
/** @var CalculatesTransactionTransferFee */
|
||||
private $calculatesTransactionTransferFee;
|
||||
|
||||
/**
|
||||
* CalculatesTransactionServiceCharge constructor.
|
||||
* @param CalculatesTransactionTransferFee $calculatesTransactionTransferFee
|
||||
*/
|
||||
public function __construct(CalculatesTransactionTransferFee $calculatesTransactionTransferFee)
|
||||
{
|
||||
$this->calculatesTransactionTransferFee = $calculatesTransactionTransferFee;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param float $amount
|
||||
* @param float $rate
|
||||
* @param SegmentConstant|null $service_charge
|
||||
* @return float
|
||||
*/
|
||||
public function execute(float $amount, float $rate, ?SegmentConstant $service_charge) {
|
||||
|
||||
if(!$service_charge) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$transfer_fee = $this->calculatesTransactionTransferFee->execute($amount, $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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Services;
|
||||
|
||||
use App\Models\SegmentConstant;
|
||||
|
||||
class CalculatesTransactionTransferFee
|
||||
{
|
||||
|
||||
/**
|
||||
* @param float $amount
|
||||
* @param SegmentConstant|null $service_charge
|
||||
* @return float
|
||||
*/
|
||||
public function execute(float $amount, ?SegmentConstant $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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Services;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Bank;
|
||||
use App\Http\Resources\BankResource;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\Modules\Transactions\Services\ChecksIfTransactionBillNumberExists;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class GeneratesBankBalanceAccount
|
||||
{
|
||||
|
||||
/** @var ChecksIfTransactionBillNumberExists */
|
||||
private $checksIfTransactionBillNumberExists;
|
||||
|
||||
/**
|
||||
* GeneratesTransactionBillNo constructor.
|
||||
* @param ChecksIfTransactionBillNumberExists $checksIfTransactionBillNumberExists
|
||||
*/
|
||||
public function __construct(ChecksIfTransactionBillNumberExists $checksIfTransactionBillNumberExists)
|
||||
{
|
||||
$this->checksIfTransactionBillNumberExists = $checksIfTransactionBillNumberExists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Bank $bank
|
||||
*/
|
||||
public function execute(Bank $bank) {
|
||||
$floatTransactions = $bank->recipientTransactions()->where('transactions.type', TransactionType::BILL)->whereIn('transactions.status', [ApprovalStatus::APPROVED])->orderBy('id', 'DESC')->get();
|
||||
$transferFeeTransactions = $bank->recipientTransactions()->where('transactions.type', TransactionType::TRANSFER_FEE)->whereIn('transactions.status', [ApprovalStatus::APPROVED])->orderBy('id', 'DESC')->get();
|
||||
|
||||
$creditNoteTransactions = [];
|
||||
foreach($transferFeeTransactions as $transferFeeTransaction){
|
||||
$creditNoteTransactions[] = $transferFeeTransaction->creditNoteTransaction;
|
||||
}
|
||||
$creditNoteTransactions = new Collection($creditNoteTransactions);
|
||||
|
||||
return [
|
||||
'bank' => new BankResource($bank),
|
||||
'floatTransactions' => $floatTransactions,
|
||||
'transferFeeTransactions' => $transferFeeTransactions,
|
||||
'creditNoteTransactions' => $creditNoteTransactions,
|
||||
'account_balance' => $floatTransactions->sum('amount') + $transferFeeTransactions->sum('amount') - $creditNoteTransactions->sum('amount'),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Transactions\Services;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Company;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\Modules\Transactions\Services\ChecksIfTransactionBillNumberExists;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class GeneratesCompanyBalanceAccount
|
||||
{
|
||||
|
||||
/** @var ChecksIfTransactionBillNumberExists */
|
||||
private $checksIfTransactionBillNumberExists;
|
||||
|
||||
/**
|
||||
* GeneratesTransactionBillNo constructor.
|
||||
* @param ChecksIfTransactionBillNumberExists $checksIfTransactionBillNumberExists
|
||||
*/
|
||||
public function __construct(ChecksIfTransactionBillNumberExists $checksIfTransactionBillNumberExists)
|
||||
{
|
||||
$this->checksIfTransactionBillNumberExists = $checksIfTransactionBillNumberExists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Company $company
|
||||
*/
|
||||
public function execute(Company $company) {
|
||||
$transferFeeTransactions = $company->issuerTransactions()->where('transactions.type', TransactionType::TRANSFER_FEE)->whereIn('transactions.status', [ApprovalStatus::APPROVED])->orderBy('id', 'DESC')->get();
|
||||
|
||||
$creditNoteTransactions = [];
|
||||
foreach($transferFeeTransactions as $transferFeeTransaction){
|
||||
$creditNoteTransactions[] = $transferFeeTransaction->creditNoteTransaction;
|
||||
}
|
||||
$creditNoteTransactions = new Collection($creditNoteTransactions);
|
||||
|
||||
return [
|
||||
'company' => new CompanyResource($company),
|
||||
'transferFeeTransactions' => $transferFeeTransactions,
|
||||
'creditNoteTransactions' => $creditNoteTransactions,
|
||||
'account_balance' => $transferFeeTransactions->sum('amount') - $creditNoteTransactions->sum('amount'),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,25 +2,19 @@
|
||||
|
||||
namespace App\Classes\Modules\Wallets\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Resources\WalletResource;
|
||||
use App\Classes\Modules\Wallets\Services\CreatesWallet;
|
||||
use App\Classes\Modules\Wallets\Services\GeneratesWalletCode;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Wallets\Services\UpdatesWallet;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Http\Resources\WalletResource;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Wallets\Services\GeneratesWalletCode;
|
||||
|
||||
use ErrorException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Wallets\Processors\CreditWalletProcessor;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
|
||||
class CreditWalletLogic extends AbstractControllerLogic
|
||||
{
|
||||
@@ -53,6 +47,9 @@ class CreditWalletLogic extends AbstractControllerLogic
|
||||
/** @var UpdatesWallet */
|
||||
private $updatesWallet;
|
||||
|
||||
/** @var CreditWalletProcessor */
|
||||
private $creditWalletProcessor;
|
||||
|
||||
/**
|
||||
* CreateWalletLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
@@ -61,6 +58,7 @@ class CreditWalletLogic extends AbstractControllerLogic
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
* @param CreatesTransaction $createsTransaction
|
||||
* @param UpdatesWallet $updatesWallet
|
||||
* @param CreditWalletProcessor $creditWalletProcessor
|
||||
*/
|
||||
public function __construct(
|
||||
FetchesCompany $fetchesCompany,
|
||||
@@ -68,7 +66,8 @@ class CreditWalletLogic extends AbstractControllerLogic
|
||||
CreatesWallet $createsWallet,
|
||||
GeneratesTransactionBillNumber $generatesTransactionBillNumber,
|
||||
CreatesTransaction $createsTransaction,
|
||||
UpdatesWallet $updatesWallet
|
||||
UpdatesWallet $updatesWallet,
|
||||
CreditWalletProcessor $creditWalletProcessor
|
||||
)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
@@ -77,6 +76,7 @@ class CreditWalletLogic extends AbstractControllerLogic
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->updatesWallet = $updatesWallet;
|
||||
$this->creditWalletProcessor = $creditWalletProcessor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,23 +94,7 @@ class CreditWalletLogic extends AbstractControllerLogic
|
||||
|
||||
$type = $request->input('transaction_type');
|
||||
|
||||
if (!$company->wallets()->first()) {
|
||||
$object = new WalletObject($company->id, 1, $this->generatesWalletCode->execute());
|
||||
$this->createsWallet->execute($object, $company);
|
||||
}
|
||||
|
||||
$wallet = $company->wallets()->first();
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute($type === 2 ? 'DEBIT-NOTE-' : 'CREDIT-NOTE-');
|
||||
|
||||
$transaction_object = new TransactionObject($billNumber, $type === 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 = $type === 2 ? ($wallet->amount - $transaction->amount) : ($wallet->amount + $transaction->amount);
|
||||
|
||||
$walletObject = new WalletObject($wallet->owner->id, $wallet->currency_id, $wallet->code, $updateWalletAmount);
|
||||
|
||||
$wallet = $this->updatesWallet->execute($wallet, $walletObject);
|
||||
$wallet = $this->creditWalletProcessor->execute($company, $type, $amount, $reference);
|
||||
|
||||
return $this->resourceResponse(new WalletResource($wallet));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Wallets\Processors;
|
||||
|
||||
use App\Models\Wallet;
|
||||
use App\Models\Company;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\Modules\Wallets\Services\CreatesWallet;
|
||||
use App\Classes\Modules\Wallets\Services\UpdatesWallet;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Classes\ValueObjects\Constants\PaymentMethodType;
|
||||
use App\Classes\Modules\Wallets\Services\GeneratesWalletCode;
|
||||
use App\Classes\Modules\Transactions\Services\CreatesTransaction;
|
||||
use App\Classes\Modules\Wallets\DataTransferObjects\WalletObject;
|
||||
use App\Classes\Modules\Transactions\DataTransferObjects\TransactionObject;
|
||||
use App\Classes\Modules\Transactions\Services\GeneratesTransactionBillNumber;
|
||||
|
||||
class CreditWalletProcessor
|
||||
{
|
||||
/** @var GeneratesWalletCode */
|
||||
private $generatesWalletCode;
|
||||
|
||||
/** @var CreatesWallet */
|
||||
private $createsWallet;
|
||||
|
||||
/** @var GeneratesTransactionBillNumber */
|
||||
private $generatesTransactionBillNumber;
|
||||
|
||||
/** @var CreatesTransaction */
|
||||
private $createsTransaction;
|
||||
|
||||
/** @var UpdatesWallet */
|
||||
private $updatesWallet;
|
||||
|
||||
/**
|
||||
* CreateWalletLogic constructor.
|
||||
* @param GeneratesWalletCode $generatesWalletCode
|
||||
* @param CreatesWallet $createsWallet
|
||||
* @param GeneratesTransactionBillNumber $generatesTransactionBillNumber
|
||||
* @param CreatesTransaction $createsTransaction
|
||||
* @param UpdatesWallet $updatesWallet
|
||||
*/
|
||||
public function __construct(
|
||||
GeneratesWalletCode $generatesWalletCode,
|
||||
CreatesWallet $createsWallet,
|
||||
GeneratesTransactionBillNumber $generatesTransactionBillNumber,
|
||||
CreatesTransaction $createsTransaction,
|
||||
UpdatesWallet $updatesWallet
|
||||
)
|
||||
{
|
||||
$this->generatesWalletCode = $generatesWalletCode;
|
||||
$this->createsWallet = $createsWallet;
|
||||
$this->generatesTransactionBillNumber = $generatesTransactionBillNumber;
|
||||
$this->createsTransaction = $createsTransaction;
|
||||
$this->updatesWallet = $updatesWallet;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param Company $company
|
||||
* @param int $transactionType
|
||||
* @param float $amount
|
||||
* @param string $reference
|
||||
* @return \Illuminate\Database\Eloquent\Model
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function execute(Company $company, int $transactionType, float $amount, string $reference)
|
||||
{
|
||||
if (!$company->wallets()->first()) {
|
||||
$object = new WalletObject($company->id, 1, $this->generatesWalletCode->execute());
|
||||
$this->createsWallet->execute($object, $company);
|
||||
}
|
||||
|
||||
/** @var Wallet $wallet */
|
||||
$wallet = $company->wallets()->first();
|
||||
|
||||
$billNumber = $this->generatesTransactionBillNumber->execute($transactionType === 2 ? 'DEBIT-NOTE-' : 'CREDIT-NOTE-');
|
||||
|
||||
$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);
|
||||
|
||||
$wallet = $this->updatesWallet->execute($wallet, $walletObject);
|
||||
|
||||
return $wallet;
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,6 @@ final class BankAccountType {
|
||||
|
||||
public const EXTERNAL = 2;
|
||||
|
||||
public const ALIPAY= 3;
|
||||
|
||||
}
|
||||
|
||||
@@ -10,4 +10,6 @@ final class BusinessType {
|
||||
|
||||
public const CURRENCY_VENDOR = 3;
|
||||
|
||||
public const TRANSFER_AGENT = 4;
|
||||
|
||||
}
|
||||
|
||||
@@ -20,4 +20,8 @@ class SegmentConstants
|
||||
|
||||
public const CUSTOM_SERVICE_TYPE = 'CUSTOM_SERVICE_TYPE';
|
||||
|
||||
public const SERVICE_CHARGE = 'SERVICE_CHARGE';
|
||||
|
||||
public const TRANSFER_FEE = 'TRANSFER_FEE';
|
||||
|
||||
}
|
||||
@@ -27,4 +27,6 @@ final class TransactionType {
|
||||
public const DEBIT_NOTE = 11;
|
||||
|
||||
public const WITHDRAW = 10;
|
||||
|
||||
public const TRANSFER_FEE = 11;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Banks;
|
||||
|
||||
use App\Classes\Modules\Banks\ControllersLogic\UpdateBankStatusLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateBankStatusController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateBankStatusLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateBankStatusLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Companies;
|
||||
|
||||
use App\Classes\Modules\Companies\ControllersLogic\UpdateCompanyDebtorLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateCompanyDebtorController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateCompanyDebtorLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateCompanyDebtorLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,10 @@ 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\ExportsNullDebtors;
|
||||
use App\Classes\Modules\Exports\Services\ExportsPaymentTransactions;
|
||||
|
||||
use App\Classes\Modules\Exports\Services\ExportsWalletTransactions;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
@@ -13,15 +17,35 @@ use Maatwebsite\Excel\Excel;
|
||||
class ExportCustomersToExcelController
|
||||
{
|
||||
|
||||
public function export(ExportsCustomers $exportsCustomers, Request $request){
|
||||
/**
|
||||
* ExportCustomersToExcelController constructor.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
}
|
||||
|
||||
public function export(ExportsCustomers $exportsCustomers, Request $request){
|
||||
return $exportsCustomers->download('customers.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
}
|
||||
|
||||
public function transactions(ExportsTransactions $exportsTransactions, Request $request){
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
return $exportsTransactions->download('transactions.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
}
|
||||
|
||||
public function nullDebtor(ExportsNullDebtors $exportsNullDebtors, Request $request){
|
||||
return $exportsNullDebtors->download('nullDebtor.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
}
|
||||
|
||||
public function paymentTransactions(Request $request){
|
||||
$exportsTransactions = new ExportsPaymentTransactions($request);
|
||||
return $exportsTransactions->download('payment-transactions.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
}
|
||||
|
||||
public function walletTransactions(Request $request){
|
||||
$exportsTransactions = new ExportsWalletTransactions($request);
|
||||
return $exportsTransactions->download('wallet-transactions.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Imports;
|
||||
|
||||
use App\Classes\Modules\Imports\Services\ImportsDebtor;
|
||||
use App\Classes\General\ExcelHandel;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class ImportUpdateDebtorController
|
||||
{
|
||||
public function import(Request $request) {
|
||||
$token = Auth::fromUser(User::find(1));
|
||||
$request->headers->set('Authorization', 'Bearer '.$token);
|
||||
|
||||
$excel_file = $request->input('excel_file');
|
||||
|
||||
$excel_file = ExcelHandel::insertExcel('debtor', $excel_file);
|
||||
|
||||
return $import = Excel::import(new ImportsDebtor(), $excel_file[0]['file_info']['original']['file']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\SegmentConstants;
|
||||
|
||||
use App\Classes\Modules\SegmentConstants\ControllersLogic\CreateSegmentConstantLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateSegmentConstantController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateSegmentConstantLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateSegmentConstantLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\SegmentConstants;
|
||||
|
||||
use App\Classes\Modules\SegmentConstants\ControllersLogic\FetchSegmentConstantLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FetchSegmentConstantController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchSegmentConstantLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchSegmentConstantLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\SegmentConstants;
|
||||
|
||||
use App\Classes\Modules\SegmentConstants\ControllersLogic\UpdateSegmentConstantLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateSegmentConstantController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param UpdateSegmentConstantLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function update(Request $request, UpdateSegmentConstantLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\DownloadMockUpWhiteFormPdfLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class DownloadMockUpWhiteFormPdfController
|
||||
{
|
||||
public function download(Request $request, DownloadMockUpWhiteFormPdfLogic $logic) {
|
||||
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\FetchBankAccountBalanceLogic;
|
||||
|
||||
|
||||
class FetchBankAccountBalanceController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchBankAccountBalanceLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchBankAccountBalanceLogic $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\FetchCompanyAccountBalanceLogic;
|
||||
|
||||
|
||||
class FetchCompanyAccountBalanceController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param FetchCompanyAccountBalanceLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function fetch(Request $request, FetchCompanyAccountBalanceLogic $logic) : JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Transactions;
|
||||
|
||||
use App\Classes\Modules\Transactions\ControllersLogic\UpdateRefundTransactionStatusLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateRefundTransactionStatusController
|
||||
{
|
||||
public function update(Request $request, UpdateRefundTransactionStatusLogic $logic): JsonResponse {
|
||||
return $logic->execute($request);
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,7 @@ class BookingResource extends JsonResource
|
||||
],
|
||||
'status' => $this->status,
|
||||
'created_at' => Carbon::parse($this->created_at)->format('d-m-Y'),
|
||||
'created_at_with_time' => Carbon::parse($this->created_at)->format('d-m-Y h:i:s A'),
|
||||
$this->mergeWhen($this->relationLoaded('transactions'), [
|
||||
'purchase_order' => new TransactionResource($this->transactions()->where('type', TransactionType::PURCHASE_ORDER)->first()),
|
||||
'payment_attempts' => TransactionResource::collection(
|
||||
|
||||
@@ -30,6 +30,9 @@ class CompanyResource extends JsonResource
|
||||
$lastPayment = $this->transactions()->where('transactions.type', TransactionType::PAYMENT)->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->orderBy('id', 'DESC')->first();
|
||||
$totalPayments = $this->transactions()->where('transactions.type', TransactionType::PAYMENT)->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
|
||||
|
||||
$segment = SegmentConstant::where('reference', SegmentConstants::SUPPLIER_CURRENCIES)->where('detail->id', $this->id)->first();
|
||||
$serviceCharge = SegmentConstant::where('reference', SegmentConstants::SERVICE_CHARGE)->where('detail->id', $this->id)->first();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
@@ -58,12 +61,13 @@ class CompanyResource extends JsonResource
|
||||
],
|
||||
'segments' => SegmentResource::collection($this->segments),
|
||||
'services' => (new FetchesCompanyServices())->getServices($this->servicesConfigurations()),
|
||||
'currencies' => $this->when($this->business_type === BusinessType::CURRENCY_VENDOR, function(){
|
||||
$segment = SegmentConstant::where('reference', SegmentConstants::SUPPLIER_CURRENCIES)->where('detail->id', $this->id)->first();
|
||||
return $segment ? CurrencyResource::collection(Currency::whereIn('id', $segment->detail->currencies)->get()) : [];
|
||||
}),
|
||||
'wallet' => new WalletResource($this->wallets()->first()),
|
||||
'created_at' => $this->created_at->format('d-m-Y')
|
||||
'created_at' => $this->created_at->format('d-m-Y'),
|
||||
$this->mergeWhen($this->business_type === BusinessType::CURRENCY_VENDOR, [
|
||||
'currencies' => $segment ? CurrencyResource::collection(Currency::whereIn('id', $segment->detail->currencies)->get()) : [],
|
||||
'service_charge' => $serviceCharge
|
||||
])
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
use App\Models\Booking;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -17,8 +18,8 @@ class TransactionResource extends JsonResource
|
||||
public function toArray($request)
|
||||
{
|
||||
|
||||
$booking = (int)$this->type === TransactionType::BILL ? $this->owner->owner : $this->booking;
|
||||
$days = $this->updated_at->endOfDay()->addWeekdays($booking->service_id === 1 ? 1 : 3);
|
||||
$booking = in_array((int)$this->type, [TransactionType::BILL, TransactionType::REFUND])? $this->owner->owner : $this->owner;
|
||||
$days = $this->updated_at->endOfDay()->addWeekdays($booking->service_id === 3 ? 3 : 1);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
@@ -39,7 +40,8 @@ class TransactionResource extends JsonResource
|
||||
'status' => (int) $this->status,
|
||||
'details' => TransactionDetailResource::collection($this->transactionDetails),
|
||||
'documents' => new DocumentResource($this->documents()->first()),
|
||||
'transaction_bill' => new TransactionResource($this->when((int) $this->type === TransactionType::PAYMENT, $this->transactions()->first())),
|
||||
'transaction_bill' => new TransactionResource($this->when((int) $this->type === TransactionType::PAYMENT, $this->transactions()->bills()->first())),
|
||||
'transaction_refunds' => TransactionResource::collection($this->when((int) $this->type === TransactionType::PAYMENT, $this->transactions()->refunds()->get())),
|
||||
'expires_on' => Carbon::parse($this->expires_on)->format('d-m-Y h:i:s A'),
|
||||
'updated_at' => Carbon::parse($this->updated_at)->format('d-m-Y h:i:s A'),
|
||||
'interval' => [
|
||||
|
||||
+11
-2
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class Bank
|
||||
* @package App\Models
|
||||
@@ -41,4 +42,12 @@ class Bank extends AbstractModel
|
||||
{
|
||||
return $this->BelongsTo(Company::class, 'company_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function recipientTransactions(): HasMany
|
||||
{
|
||||
return $this->HasMany(Transaction::class, 'recipient_bank_account_id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,14 @@ class Company extends AbstractModel implements Documentable
|
||||
{
|
||||
return $this->hasManyDeep(Transaction::class, [Booking::class], ['company_id', 'owner_id'], ['id', 'id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HasMany
|
||||
*/
|
||||
public function issuerTransactions(): HasMany
|
||||
{
|
||||
return $this->HasMany(Transaction::class, 'issuer');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
|
||||
@@ -20,6 +20,10 @@ class SegmentConstant extends AbstractModel
|
||||
protected $table = 'segment_constants';
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
// protected $casts = [
|
||||
// 'detail' => 'array',
|
||||
// ];
|
||||
|
||||
public function getDetailAttribute($value)
|
||||
{
|
||||
|
||||
@@ -30,14 +30,6 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function booking(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Booking::class, 'owner_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
@@ -46,6 +38,22 @@ class Transaction extends AbstractModel implements Documentable, Transactionable
|
||||
return $this->MorphMany(Transaction::class, 'owner');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\MorphOne
|
||||
*/
|
||||
public function creditNoteTransaction()
|
||||
{
|
||||
return $this->MorphOne(Transaction::class, 'owner')->where('type', TransactionType::CREDIT_NOTE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function booking(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Booking::class, 'owner_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddDebtorToCompaniesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->string('debtor')->nullable()->after('reference');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Transaction;
|
||||
use App\Classes\ValueObjects\Constants\TransactionType;
|
||||
|
||||
@@ -17,17 +18,22 @@ class UpdateTransactionBillOwnerSeeder extends Seeder
|
||||
{
|
||||
DB::beginTransaction();
|
||||
|
||||
$transaction = Transaction::where('type', TransactionType::BILL)->get();
|
||||
$bookings = Booking::all();
|
||||
|
||||
foreach ($transaction as $key => $row) {
|
||||
$key = 0;
|
||||
$bills = $row->booking->transactions()->bills()->where('original_amount', '=', $row->original_amount)->get();
|
||||
if(count($bills) > 1){ $key = $bills->search(function($bill)use($row){ return $bill->id === $row->id; }); }
|
||||
$paymentTransaction = $row->booking->transactions()->payments()->complete()->where('original_amount', '=', $row->original_amount)->skip($key)->first();
|
||||
foreach ($bookings as $booking) {
|
||||
|
||||
$row->owner_type = Transaction::class;
|
||||
$row->owner_id = $paymentTransaction->id;
|
||||
$row->update();
|
||||
$transactions = $booking->transactions()->bills()->get();
|
||||
foreach ($transactions as $row) {
|
||||
$key = 0;
|
||||
$bills = $booking->transactions()->bills()->where('original_amount', '=', $row->original_amount)->get();
|
||||
if(count($bills) > 1){ $key = $bills->search(function($bill)use($row){ return $bill->id === $row->id; }); }
|
||||
$paymentTransaction = $booking->transactions()->payments()->complete()->where('original_amount', '=', $row->original_amount)->skip($key)->first();
|
||||
|
||||
$row->owner_type = Transaction::class;
|
||||
$row->owner_id = $paymentTransaction->id;
|
||||
$row->updated_at = $row->updated_at;
|
||||
$row->update();
|
||||
}
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center">
|
||||
<div class="col-5 padding-25 d-none d-md-inline">
|
||||
<div class="col-12 col-lg-5 padding-25 d-none d-md-inline">
|
||||
<div class="row h-100 align-items-end">
|
||||
<div class="col no-padding">
|
||||
<img src="/images/2829248.png" class="w-100">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col padding-25">
|
||||
<div class="col-12 col-lg padding-25">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row parentContainer">
|
||||
|
||||
@@ -33,13 +33,13 @@
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.account_no">
|
||||
<label>Account No.</label>
|
||||
<label>{{ serviceType ? serviceType.id === 4 ? 'Alipay recipient Email / Phone' : 'Account No.' : 'Account No.'}}</label>
|
||||
<input type="text" class="form-control" v-model="parameters.account_no" :disabled="disabled">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="type === 2">
|
||||
<div class="col">
|
||||
<div class="row" v-if="type === 2 && serviceType">
|
||||
<div class="col" v-if="serviceType.id !== 4">
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.bank_name">
|
||||
@@ -117,6 +117,11 @@
|
||||
country_id: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
serviceType: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data(){
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<loading-component style="height: 50px; 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-20" v-if="type !== 2">
|
||||
<div class="col">
|
||||
<h6 class="all-caps m-b-5 bold no-margin">Add Bank Account</h6>
|
||||
</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" v-if="type === 2">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.reference">
|
||||
<label>Reference</label>
|
||||
<input type="text" class="form-control" v-model="parameters.reference" :disabled="disabled">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.account_no">
|
||||
<label>{{ serviceType.id === 4 ? 'Alipay recipient Email / Phone' : 'Account No.' }}</label>
|
||||
<input type="text" class="form-control" v-model="parameters.account_no" :disabled="disabled">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<validation-wrapper-component :validator="$v.parameters.holder_name">
|
||||
<label>Account Holder Name</label>
|
||||
<input type="text" class="form-control" v-model="parameters.holder_name" @keyup="onlyChinese($event)" :disabled="disabled">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-show="englishTextWarning === true">
|
||||
<div class="col">
|
||||
<div class="fs-11 text-danger m-b-10" v-if="!confirmProceedEnglishText">Warning: We do not encourage to transfer to non-chinese recipient Alipay account ! <span class="text-danger bold pointer text-underline" @click="confirmProceedEnglishText = !confirmProceedEnglishText">Proceed Anyway.</span></div>
|
||||
<div class="row" v-if="confirmProceedEnglishText">
|
||||
<div class="col text-danger bold">
|
||||
<p>Foreign name alipay may exceed Monthly / Yearly Limit , and may be unable to withdraw your funds out.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-danger m-b-10" v-if="confirmProceedEnglishText">The risk is too high. <span class="text-danger bold pointer text-underline" @click="confirmProceedEnglishText = !confirmProceedEnglishText">I changed my mind.</span></div>
|
||||
</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="closable ? 'modal' : ''" @click="$emit('close')">{{disabled ? 'Change Recipient Account' : 'Cancel'}}</div>
|
||||
</div>
|
||||
<div class="col p-l-5" v-if="!disabled">
|
||||
<button class="btn btn-sm btn-success btn-block b-rad-none" @click="submitForm()" :disabled="!confirmProceedEnglishText && englishTextWarning">Add Account</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import FormHandler from '../../../general/mixins/formHandler';
|
||||
import { required, requiredIf } from "vuelidate/lib/validators";
|
||||
export default {
|
||||
props : {
|
||||
company_id: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
type: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
closable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
country_id: {
|
||||
type: Number,
|
||||
default: 1
|
||||
},
|
||||
serviceType: {
|
||||
type: Object,
|
||||
required: false,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
company_id: this.company_id,
|
||||
account_type: 3,
|
||||
reference: '',
|
||||
bank_name: '-',
|
||||
holder_name: '',
|
||||
account_no: '',
|
||||
bank_branch: '-',
|
||||
country_id: this.country_id,
|
||||
},
|
||||
englishTextWarning: false,
|
||||
confirmProceedEnglishText: false,
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
holder_name: {
|
||||
required
|
||||
},
|
||||
account_no: {
|
||||
required
|
||||
},
|
||||
reference: {
|
||||
required: requiredIf(function () { return this.parameters.type === 2 })
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.parameters.account_type = 3,
|
||||
this.parameters.bank_name = '-',
|
||||
this.submit(route('api.bank.create'), 'post', this.section, true, false);
|
||||
},
|
||||
successHandler(response){
|
||||
this.type !== 2 ? this.closeModal() : this.$emit('createdBank', response.payload.data);
|
||||
this.formHandler();
|
||||
this.resetForm();
|
||||
},
|
||||
errorHandler(error){
|
||||
this.formHandler(error.message);
|
||||
},
|
||||
onlyChinese(event){
|
||||
let value = event.target.value,
|
||||
regex = /^[^~`!@#$%^&*()_+=[\]\{}|;':",.\/<>?a-zA-Z0-9-]+$/;
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
this.englishTextWarning = false;
|
||||
if(regex.test(value) === false){
|
||||
this.englishTextWarning = true;
|
||||
}
|
||||
},
|
||||
},
|
||||
mixins: [FormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -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 Bank Account?</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: 'paymentProofSection'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.parameters.status = 5;
|
||||
this.submit(this.route('api.bank.status.update', this.data.recipient_bank_account.id), 'put', this.section, true, false);
|
||||
}
|
||||
},
|
||||
mixins: [componentHandler, ModalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="row h-100">
|
||||
<div class="col fs-9 d-flex align-items-center flex-column" style="padding-top: 7px; padding-bottom: 4px;">
|
||||
<label class="all-caps w-100 m-b-0" style="font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500;">Document Type</label>
|
||||
<span class="w-100 fs-14">{{parameters.type}}</span>
|
||||
<span class="w-100 fs-14">{{parameters.type.replaceAll('_', ' ')}}</span>
|
||||
</div>
|
||||
<div class="col-auto b-l b-grey">
|
||||
<div class="row h-100 align-items-center">
|
||||
@@ -27,10 +27,10 @@
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" v-for="document in documents" :key="document">
|
||||
<div class="col b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10 b-a" @click="updateDocumentType(document)">
|
||||
<div class="col b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10 b-a" :class="[{'bg-primary-light': document === parameters.type}, {'text-white': document === parameters.type}, {'b-primary': document === parameters.type}, {'hover-primary': document !== parameters.type}, {'pointer': document !== parameters.type}]" @click="updateDocumentType(document)">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">{{document}}</div>
|
||||
<div class="font-heading fs-10">{{document.replaceAll('_', ' ')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -40,11 +40,15 @@
|
||||
<div class="font-heading text-success bold">{{item.owner.amount}} {{item.owner.fixed_currency.short_code}}</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<document-file-viewer-component :file="item.files[0]">
|
||||
<template slot="button">
|
||||
<button class="btn btn-success">Download</button>
|
||||
</template>
|
||||
</document-file-viewer-component>
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<document-file-viewer-component :file="item.files[0]">
|
||||
<template slot="button">
|
||||
<button class="btn btn-success w-100">Download</button>
|
||||
</template>
|
||||
</document-file-viewer-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end">
|
||||
<div class="col-2">
|
||||
<div class="col-4">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">{{this.data.serviceType.name}}</div>
|
||||
@@ -20,7 +20,6 @@
|
||||
<div class="font-heading fs-8 all-caps">Service Type</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="row">
|
||||
@@ -79,7 +78,7 @@
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-group no-margin form-group-default">
|
||||
<label>Account No.</label>
|
||||
<label>{{ data.serviceType.id === 4 ? 'Alipay recipient Email / Phone' : 'Account No.' }}</label>
|
||||
<input type="text" class="form-control" v-model="account_no" @keyup="parameters.bankAccount = {}" @focus="dropdownStatus = true">
|
||||
</div>
|
||||
</div>
|
||||
@@ -124,7 +123,8 @@
|
||||
</div>
|
||||
<div class="row" v-show="createBank">
|
||||
<div class="col">
|
||||
<bank-account-form-component section="customerProfileSection" :disabled="formDisabled" :data="Object.keys(parameters.bankAccount).length ? parameters.bankAccount : {account_no: account_no, company_id: data.company.id, country_id: 2, account_type: 2}" :company_id="data.company.id" :country_id="2" :type="2" v-on:createdBank="updateBank($event)" :closable=false v-on:close="clearAccount()"></bank-account-form-component>
|
||||
<bank-account-form-component v-if="data.serviceType.id !== 4" section="customerProfileSection" :disabled="formDisabled" :data="Object.keys(parameters.bankAccount).length ? parameters.bankAccount : {account_no: account_no, company_id: data.company.id, country_id: 2, account_type: 2}" :company_id="data.company.id" :country_id="2" :type="2" v-on:createdBank="updateBank($event)" :serviceType="data.serviceType" :closable=false v-on:close="clearAccount()"></bank-account-form-component>
|
||||
<phone-account-form-component v-if="data.serviceType.id === 4" section="customerProfileSection" :disabled="formDisabled" :data="Object.keys(parameters.bankAccount).length ? parameters.bankAccount : {account_no: account_no, company_id: data.company.id, country_id: 2, account_type: 2}" :company_id="data.company.id" :country_id="2" :type="2" v-on:createdBank="updateBank($event)" :serviceType="data.serviceType" :closable=false v-on:close="clearAccount()"></phone-account-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,13 +4,16 @@
|
||||
<div class="row" v-if="!item.transaction_bill">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col p-t-10 p-b-10 p-r-0 pointer" @click="clickExpand()" :class="[{'bg-master-lighter': item.status === 1}, {'bg-white': item.status !== 1 && item.status !== 4}]">
|
||||
<div class="col p-t-10 p-b-10 p-r-0 pointer" @click="clickExpand()" :class="[{'bg-master-lighter': item.status === 1 && item.type !== 6}, {'bg-white': item.status !== 1 && item.status !== 4}, {'bg-warning-lighter': item.type === 6}]">
|
||||
<div class="row m-b-5">
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-8 muted all-caps">Status</div>
|
||||
<div class="font-heading fs-10 bold" v-if="item.type === 1" :class="[{'text-danger': item.status === 1 || item.status === 4}, {'text-success': item.status !== 1 && item.status !== 4}]">
|
||||
{{ item.status === 1 ? 'Pending Verification' : item.status === 4 ? 'Rejected' : 'Processing Payment'}}
|
||||
</div>
|
||||
<div class="font-heading fs-10 bold" v-if="item.type === 6" :class="[{'text-danger': item.status === 1 || item.status === 4}, {'text-success': item.status !== 1 && item.status !== 4}]">
|
||||
{{ item.status === 1 ? 'Pending Verification' : item.status === 4 ? 'Rejected' : 'Processing Payment'}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0">
|
||||
<div class="font-heading fs-8 muted all-caps">Payment Amount</div>
|
||||
@@ -18,6 +21,12 @@
|
||||
{{item.currency.short_code}} {{(Math.round((item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0" v-if="totalRefunds !== 0">
|
||||
<div class="font-heading fs-8 muted all-caps">Refunded Amount</div>
|
||||
<div class="font-heading fs-10 bold text-danger">
|
||||
{{item.original_currency.short_code}} {{(Math.round((totalRefunds + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -25,7 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" v-if="item.status !== 3" :class="[{'bg-master-light': item.status === 1}, {'bg-master-lighter': item.status === 2}]">
|
||||
<div class="col-auto" v-if="item.status !== 3" :class="[{'bg-master-light': item.status === 1 && item.type !== 6}, {'bg-master-lighter': item.status === 2}, {'bg-warning-light': item.type === 6}]">
|
||||
<div class="row align-items-center h-100" v-if="item.status !== 1 || item.payment_method !== 5">
|
||||
<div class="col">
|
||||
<i class="fa" :class="[{'fa-cloud-download': item.status === 1 || item.status === 2}, {'fa-ban': item.status === 4}, {'muted': item.status === 1 || item.status === 2}, {'text-danger': item.status === 4}]"></i>
|
||||
@@ -54,7 +63,15 @@
|
||||
<div class="col-auto p-l-0">
|
||||
<div class="font-heading fs-8 muted all-caps">Payment Amount</div>
|
||||
<div class="font-heading fs-10 bold">
|
||||
{{item.transaction_bill.original_currency.short_code}} {{(Math.round((item.transaction_bill.original_amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
{{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 class="row align-items-end m-b-10 bold text-danger" v-if="totalRefunds !== 0">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">Refunded Amount</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="font-heading fs-12">{{item.original_currency.short_code}} {{(Math.round((totalRefunds + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" v-if="$store.getters.isAdmin">
|
||||
@@ -101,6 +118,22 @@
|
||||
<div class="font-heading fs-10">{{item.original_currency.short_code}} {{(item.original_amount).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="totalRequestedRefund != 0">
|
||||
<div class="col">
|
||||
<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>
|
||||
</div>
|
||||
<div class="row align-items-end m-b-10 bold text-danger" v-if="totalRefunds != 0">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">Refunded Amount</div>
|
||||
</div>
|
||||
<div class="col-auto text-right">
|
||||
<div class="font-heading fs-12">{{item.original_currency.short_code}} {{(Math.round((totalRefunds + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end bold m-b-10 text-primary">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">Rate</div>
|
||||
@@ -161,6 +194,11 @@
|
||||
<div class="font-heading all-caps fs-10 m-b-5">Our Payment Proof</div>
|
||||
<div class="row" v-if="item.transaction_bill">
|
||||
<div class="col">
|
||||
<div class="row" v-if="item.transaction_bill.status !== 2 && item.transaction_bill.status !== 3">
|
||||
<div class="col">
|
||||
<p class="fs-12 muted">Payment proof will be uploaded {{ (parseFloat(item.interval.duration) + 1) <= 0 ? 'today' : (parseFloat(item.interval.duration) + 1) === 2 ? 'tomorrow' : 'in '+(parseFloat(item.interval.duration) + 1)+' days'}} at 4:00 PM</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin justify-content-end" v-if="(item.transaction_bill.status === 2 || item.transaction_bill.status === 3)">
|
||||
<div v-for="file in item.transaction_bill.documents.files" v-bind:key="file.id" class="col-auto no-padding m-l-5">
|
||||
<document-file-viewer-component :file="file">
|
||||
@@ -174,114 +212,23 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-if="!item.transaction_bill">
|
||||
<div class="col">
|
||||
<p class="fs-12 muted">Payment proof will be uploaded {{ (parseFloat(item.interval.duration) + 1) <= 0 ? 'today' : (parseFloat(item.interval.duration) + 1) === 2 ? 'tomorrow' : 'in '+(parseFloat(item.interval.duration) + 1)+' days'}} at 4:00 PM</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-t-10 hide">
|
||||
<div class="col">
|
||||
<button class="btn btn-xs all-caps b-rad-none btn-success btn-block requestModal" data-type="transferSummary">Request Refund</button>
|
||||
<div class="row m-t-10" v-show="[2, 3].includes(item.status) && totalRequestedRefund < data.booking.amount">
|
||||
<div class="col hide">
|
||||
<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"></refund-confirmation-component>
|
||||
<refund-confirmation-component :data="data" :section="section" :totalRefunds="totalRequestedRefund + totalRefunds"></refund-confirmation-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="row" v-show="expandRefund"> -->
|
||||
<div class="row" v-show="false">
|
||||
<div class="col bg-white padding-15">
|
||||
<div class="row m-b-10">
|
||||
<div class="col-8">
|
||||
<div class="font-heading all-caps fs-10 m-b-5">Refund Type: </div>
|
||||
<div class="btn btn-xs btn-complete no-border btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="refundMethod.status = !refundMethod.status">
|
||||
<div class="row">
|
||||
<div class="col p-t-10 p-b-10">
|
||||
{{refundMethod.name}}
|
||||
</div>
|
||||
<div class="col-auto bg-complete-light">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa" :class="[{'fa-angle-down': !refundMethod.status}, {'fa-angle-up': refundMethod.status}]"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="relative w-100">
|
||||
<div class="absolute w-100 b-l b-b b-r b-complete" :class="[{'hide': !refundMethod.status}]" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" :class="[{'bg-complete-light': refundMethod.name === 'Fully Refund'}, {'text-white': refundMethod.name === 'Fully Refund'}, {'hover-complete': refundMethod.name !== 'Fully Refund'}]" @click="updateRefundType({name: 'Fully Refund'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">Fully Refund</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin" :class="[{'bg-complete-light': refundMethod.name === 'Partially Refund'}, {'text-white': refundMethod.name === 'Partially Refund'}, {'hover-complete': refundMethod.name !== 'Partially Refund'}]" @click="updateRefundType({name: 'Partially Refund'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">Partially Refund</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-r-0 m-b-10" v-if="refundMethod.name === 'Fully Refund'">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="parameters.amount" v-if="refundMethod.name === 'Fully Refund'">
|
||||
<label>Amount</label>
|
||||
<input class="form-control disabled" name="amount" v-model.lazy="amount" disabled>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-auto b-r b-t b-b b-grey">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 muted">{{''}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-r-0 m-b-10" v-if="refundMethod.name === 'Partially Refund'">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="parameters.amount">
|
||||
<label>Amount</label>
|
||||
<input class="form-control" name="amount">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-auto b-r b-t b-b b-grey">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 muted">{{''}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="form-group no-margin form-group-default">
|
||||
<label>Account No.</label>
|
||||
<input type="text" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4 p-r-0">
|
||||
<button class="btn btn-xs all-caps b-rad-none btn-default bg-master-lighter btn-block" @click="requestRefund()">Cancel</button>
|
||||
</div>
|
||||
<div class="col p-l-0">
|
||||
<button class="btn btn-xs all-caps b-rad-none btn-success btn-block" @click="submitForm()">Refund</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -292,41 +239,33 @@
|
||||
data(){
|
||||
return {
|
||||
expandPaymentDetails: false,
|
||||
expandRefund: false,
|
||||
refundMethod: {
|
||||
name: 'Fully Refund',
|
||||
status: false
|
||||
},
|
||||
amount: (Math.round(1000 * 100) / 100).toFixed(2),
|
||||
parameters: {
|
||||
amount: (Math.round(1000 * 100) / 100).toFixed(2),
|
||||
bank_id: 1
|
||||
},
|
||||
expanded: false,
|
||||
section: 'bookingDetailSection',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
totalRequestedRefund() {
|
||||
var TotalRequestedRefund = 0;
|
||||
this.data.transaction_refunds.forEach(function(refunds) {
|
||||
TotalRequestedRefund += refunds.status === 1 ? refunds.original_amount : 0;
|
||||
});
|
||||
return TotalRequestedRefund;
|
||||
},
|
||||
totalRefunds() {
|
||||
var TotalRequestedRefund = 0;
|
||||
this.data.transaction_refunds.forEach(function(refunds) {
|
||||
TotalRequestedRefund += refunds.status === 2 ? refunds.original_amount : 0;
|
||||
});
|
||||
return TotalRequestedRefund;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(this.route('api.booking.refund.create', this.data.booking.id, this.data.id), 'post', this.section, true, true);
|
||||
},
|
||||
requestRefund(){
|
||||
this.expandRefund = !this.expandRefund;
|
||||
this.expandPaymentDetails = !this.expandPaymentDetails;
|
||||
},
|
||||
clickExpand(){
|
||||
if (this.expandPaymentDetails === false && this.expandRefund === false) {
|
||||
this.expandPaymentDetails = !this.expandPaymentDetails;
|
||||
} else {
|
||||
this.expandRefund = false;
|
||||
this.expandPaymentDetails = false;
|
||||
}
|
||||
},
|
||||
updateRefundType(refund){
|
||||
this.refundMethod = {
|
||||
name: refund.name,
|
||||
status: !this.refundMethod.status
|
||||
}
|
||||
this.expandPaymentDetails = !this.expandPaymentDetails;
|
||||
},
|
||||
},
|
||||
mixins: [componentHandler]
|
||||
|
||||
@@ -47,13 +47,24 @@
|
||||
</div>
|
||||
</div>
|
||||
<bank-in-component :data="item"></bank-in-component>
|
||||
<div class="row hide" v-if="item.status === 1 || item.status === 2">
|
||||
<div class="col">
|
||||
<span class="text-complete fs-10 pointer requestModal" data-type="topUpModal">Cancel this order?</span>
|
||||
<div class="row">
|
||||
<div class="col" v-if="item.recipient_bank_account.status === 5">
|
||||
<div class="fs-9 bold text-warning">*This Bank Account has been suspended. Please notify customer to update their Bank Account.*</div>
|
||||
</div>
|
||||
<div class="col" v-if="item.recipient_bank_account.status !== 5">
|
||||
<span class="text-complete fs-10 pointer requestModal text-underline" data-type="suspendBankAccountModal">Suspend this Bank Account ?</span>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component type="topUpModal">
|
||||
<delete-transaction-form-component :data="item" section="section" class="text-center"></delete-transaction-form-component>
|
||||
<modal-component type="suspendBankAccountModal">
|
||||
<suspend-bank-account-form-component :data="item" section="paymentProofSection"></suspend-bank-account-form-component>
|
||||
</modal-component>
|
||||
<div class="row hide" v-if="item.status === 1 || item.status === 2">
|
||||
<div class="col">
|
||||
<span class="text-complete fs-10 pointer requestModal" data-type="cancelOrderModal">Cancel this order?</span>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component type="cancelOrderModal">
|
||||
<delete-transaction-form-component :data="item" section="paymentProofSection" class="text-center"></delete-transaction-form-component>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+29
-249
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="row zig-zag-top">
|
||||
<div class="row zig-zag-top">
|
||||
<div class="col bg-white padding-25">
|
||||
<div class="row p-b-10">
|
||||
<div class="col">
|
||||
@@ -10,7 +10,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-b-20 b-b b-dashed b-grey m-b-20">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
@@ -23,61 +23,21 @@
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10 m-b-5">Refund Type: </div>
|
||||
<!-- <div class="btn btn-xs btn-complete no-border btn-block text-left b-rad-none p-t-0 p-b-0 p-l-15 p-r-15" @click="refundMethod.status = !refundMethod.status">
|
||||
<div class="row">
|
||||
<div class="col p-t-10 p-b-10">
|
||||
{{refundMethod.name}}
|
||||
</div>
|
||||
<div class="col-auto bg-complete-light">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col">
|
||||
<i class="fa" :class="[{'fa-angle-down': !refundMethod.status}, {'fa-angle-up': refundMethod.status}]"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-l-15">
|
||||
<div class="col p-t-20 p-b-20 bg-master-lightest text-center b-grey pointer" :class="[{'bg-complete': refundMethod.name === 'Fully Refund'}, {'text-white': refundMethod.name === 'Fully Refund'}]" @click="updateRefundType({name: 'Fully Refund'})">
|
||||
Full Refund
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- <div class="relative w-100">
|
||||
<div class="absolute w-100 b-l b-b b-r b-complete" :class="[{'hide': !refundMethod.status}]" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" :class="[{'bg-complete-light': refundMethod.name === 'Fully Refund'}, {'text-white': refundMethod.name === 'Fully Refund'}, {'hover-complete': refundMethod.name !== 'Fully Refund'}]" @click="updateRefundType({name: 'Fully Refund'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">Fully Refund</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin" :class="[{'bg-complete-light': refundMethod.name === 'Partially Refund'}, {'text-white': refundMethod.name === 'Partially Refund'}, {'hover-complete': refundMethod.name !== 'Partially Refund'}]" @click="updateRefundType({name: 'Partially Refund'})">
|
||||
<div class="col b-b b-grey p-t-10 p-b-10 pointer hover-t-10 p-b-10">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10">Partially Refund</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="row">
|
||||
<div class="col-auto b-a m-l-15 padding-5 p-l-10 p-r-10 rounded b-grey pointer" :class="[{'b-complete': refundMethod.name === 'Fully Refund'}]" @click="updateRefundType({name: 'Fully Refund'})">
|
||||
Fully Refund
|
||||
</div>
|
||||
<div class="col-auto b-a m-l-10 padding-5 p-l-10 p-r-10 rounded b-grey pointer" :class="[{'b-complete': refundMethod.name === 'Partially Refund'}]" @click="updateRefundType({name: 'Partially Refund'})">
|
||||
Partially Refund
|
||||
<div class="col p-t-20 p-b-20 bg-master-lightest text-center b-grey pointer" :class="[{'bg-complete': refundMethod.name === 'Partially Refund'}, {'text-white': refundMethod.name === 'Partially Refund'}]" @click="updateRefundType({name: 'Partially Refund'})">
|
||||
Partial Refund
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-r-0 m-b-10" v-if="refundMethod.name == 'Partially Refund'">
|
||||
<div class="row m-r-0 m-b-10" v-if="refundMethod.name === 'Partially Refund'">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.refundAmount">
|
||||
<validation-wrapper-component :validator="$v.refundAmount">
|
||||
<label>Amount</label>
|
||||
<input class="form-control disabled" name="amount" v-model="data.booking.amount">
|
||||
<input class="form-control" name="amount" v-model="refundAmount" :disabled="refundMethod.name == 'Fully Refund'" v-money="moneyV2">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-auto b-r b-t b-b b-grey">
|
||||
@@ -90,61 +50,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-show="!createBank">
|
||||
<div class="col-7 p-r-0">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="form-group no-margin form-group-default">
|
||||
<label>Account No.</label>
|
||||
<input type="text" class="form-control" v-model="account_no" @keyup="parameters.bankAccount = {}" @focus="dropdownStatus = true">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="relative w-100">
|
||||
<div class="absolute w-100 b-l b-b b-r b-grey" :class="[{'hide': !dropdownStatus}]" style="top: 100%; right: 0; z-index: 1;">
|
||||
<div class="row text-left no-margin bg-white">
|
||||
<div class="col no-padding">
|
||||
<div class="row no-margin" v-for="bank in data.booking.company.personal_banks.accounts" 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 class="col b-b b-grey p-t-10 p-b-10 pointer p-t-10 p-b-10" @click="selectBank(bank)">
|
||||
<div class="row align-items-center justify-content-center">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading bold lh-15 fs-13">{{bank.reference ? bank.reference + ' - ':''}}{{bank.holder_name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-13 muted"><b class="m-r-5 text-primary">{{bank.account_no}}</b> {{bank.bank_name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto p-l-0" v-show="!createBank && account_no && !Object.keys(parameters.bankAccount).length">
|
||||
<button class="btn btn-sm h-100 btn-primary b-rad-none all-caps" @click="createBank = !createBank; dropdownStatus = false">
|
||||
<i class="fa fa-plus m-r-5"></i>
|
||||
Create New
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" v-show="createBank">
|
||||
<div class="col">
|
||||
<!-- <bank-account-form-component section="customerProfileSection" :company_id="data.booking.company.id" :data="{account_no: account_no, company_id: data.booking.company.id, country_id: 1, account_type: 1}" :type='1'></bank-account-form-component> -->
|
||||
<bank-account-form-component section="customerProfileSection" :company_id="data.booking.company.id" :data="{account_no: account_no, company_id: data.booking.company.id, country_id: 1, account_type: 1}" :type='2'></bank-account-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -153,95 +58,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-20" v-show="createBank">
|
||||
<div class="col">
|
||||
<div class="row align-items-end no-margin">
|
||||
<div class="col">
|
||||
<div class="row align-items-end bg-master-lightest p-t-10 p-b-10">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 all-caps">Amount you are Transferring</div>
|
||||
</div>
|
||||
<div class="col-1 no-padding text-center">
|
||||
<!-- <div class="font-heading fs-10 bold">{{this.parameters.type === 0 ? 'MYR': parameters.serviceType.selectedCurrency.short_code}}</div> -->
|
||||
<div class="font-heading fs-10 bold">short_code</div>
|
||||
</div>
|
||||
<div class="col-3 text-right">
|
||||
<!-- <div class="font-heading fs-10 bold">{{(Math.round((parseFloat(this.parameters.amount.replace(",", ""))+ Number.EPSILON) * 100) / 100).toFixed(2)}}</div> -->
|
||||
<div class="font-heading fs-10 bold">amount</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end p-t-10 p-b-10">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 all-caps text-primary">Exchange Rate</div>
|
||||
</div>
|
||||
<div class="col-1 no-padding text-center">
|
||||
<div class="font-heading fs-10"></div>
|
||||
</div>
|
||||
<div class="col-3 text-right">
|
||||
<!-- <div class="font-heading fs-10 text-primary bold">{{(Math.round((this.parameters.calculation.rate + Number.EPSILON) * 100000) / 100000).toFixed(5)}}</div> -->
|
||||
<div class="font-heading fs-10 text-primary bold">rate</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end bg-master-lightest p-t-10 p-b-10">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-10 all-caps">Money Transfer Fee</div>
|
||||
</div>
|
||||
<div class="col-1 no-padding text-center">
|
||||
<div class="font-heading fs-10">MYR</div>
|
||||
</div>
|
||||
<div class="col-3 text-right">
|
||||
<!-- <div class="font-heading fs-10">{{(Math.round((this.parameters.calculation.service_charge + Number.EPSILON) * 100) / 100).toFixed(2)}}</div> -->
|
||||
<div class="font-heading fs-10">amount</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end p-t-10 p-b-10">
|
||||
<div class="col text-right">
|
||||
<div class="font-heading fs-10 all-caps">Sub-Total</div>
|
||||
</div>
|
||||
<div class="col-1 no-padding text-center">
|
||||
<div class="font-heading fs-10">MYR</div>
|
||||
</div>
|
||||
<div class="col-3 text-right">
|
||||
<!-- <div class="font-heading fs-10">{{(Math.round((this.parameters.calculation.sub_total + Number.EPSILON) * 100) / 100).toFixed(2)}}</div> -->
|
||||
<div class="font-heading fs-10">Sub-Total</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end bg-master-lightest p-t-10 p-b-10">
|
||||
<div class="col text-right">
|
||||
<div class="font-heading fs-10 all-caps">Tax</div>
|
||||
</div>
|
||||
<div class="col-1 no-padding text-center">
|
||||
<!-- <div class="font-heading fs-10">{{Math.round((this.parameters.calculation.tax + Number.EPSILON) * 100) / 100}}%</div> -->
|
||||
<div class="font-heading fs-10">some%</div>
|
||||
</div>
|
||||
<div class="col-3 text-right">
|
||||
<!-- <div class="font-heading fs-10">{{(Math.round((this.parameters.calculation.tax_total + Number.EPSILON) * 100) / 100).toFixed(2)}}</div> -->
|
||||
<div class="font-heading fs-10">some tax</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-end p-t-10 p-b-10">
|
||||
<div class="col text-right">
|
||||
<div class="font-heading all-caps bold">Amount you are Paying</div>
|
||||
</div>
|
||||
<div class="col-1 no-padding text-center">
|
||||
<div class="font-heading bold">MYR</div>
|
||||
</div>
|
||||
<div class="col-3 text-right">
|
||||
<!-- <div class="font-heading text-success bold">{{(Math.round((this.parameters.calculation.total + Number.EPSILON) * 100) / 100).toFixed(2)}}</div> -->
|
||||
<div class="font-heading text-success bold">payming amount</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <confirm-booking-component :section="section" :data="data" v-if="parameters.bankAccount"></confirm-booking-component> -->
|
||||
<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>
|
||||
</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 class="btn btn-lg btn-success b-rad-none all-caps fs-12" @click="submitForm()">Confirm & Proceed</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -251,86 +72,45 @@
|
||||
|
||||
<script>
|
||||
import FormHandler from '../../../general/mixins/formHandler';
|
||||
// import ConfirmBookingComponent from "../forms/confirmBookingComponent";
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required } from "vuelidate/lib/validators";
|
||||
import { required, maxValue } from "vuelidate/lib/validators";
|
||||
export default {
|
||||
// components: {ConfirmBookingComponent},
|
||||
props: {
|
||||
totalRefunds:{
|
||||
type: Number,
|
||||
default: 0,
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
createBank: false,
|
||||
recipientBanks: [],
|
||||
dropdownStatus: false,
|
||||
account_no: '',
|
||||
parameters: {
|
||||
bankAccount: '',
|
||||
refundAmount: this.data.booking.amount,
|
||||
bank_id: '',
|
||||
},
|
||||
expandRefund: false,
|
||||
refundAmount: (Math.round((this.data.booking.amount - this.totalRefunds + Number.EPSILON) * 100) / 100).toFixed(2),
|
||||
refundMethod: {
|
||||
name: 'Fully Refund',
|
||||
name: 'Partially Refund',
|
||||
status: false
|
||||
},
|
||||
refundMaxValue: (Math.round((this.data.booking.amount - this.totalRefunds + Number.EPSILON) * 100) / 100).toFixed(2),
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
bankAccount: { required },
|
||||
refundAmount: { required },
|
||||
validations() {
|
||||
return {
|
||||
refundAmount: {
|
||||
// required,
|
||||
maxValue: maxValue(this.refundMaxValue)
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formDisabled(){
|
||||
return !!Object.keys(this.parameters.bankAccount).length;
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.recipientBanks = this.data.recipientBanks;
|
||||
},
|
||||
methods: {
|
||||
AccountNumber(bank){
|
||||
return bank.account_no.startsWith(this.account_no)
|
||||
},
|
||||
updateBank(bank){
|
||||
this.selectBank(bank);
|
||||
this.recipientBanks.push(bank);
|
||||
this.parameters.bankAccount = bank;
|
||||
},
|
||||
selectBank(bank){
|
||||
console.log(bank);
|
||||
this.account_no = bank.account_no;
|
||||
this.createBank = true;
|
||||
this.parameters.bankAccount = bank;
|
||||
this.dropdownStatus = false;
|
||||
},
|
||||
clearAccount(){
|
||||
this.createBank = false;
|
||||
this.account_no = '';
|
||||
this.parameters.bankAccount = {};
|
||||
},
|
||||
submitForm(){
|
||||
// this.parameters = {
|
||||
// company_id: this.data.company.id,
|
||||
// type: this.data.type,
|
||||
// fix_amount: this.data.amount,
|
||||
// service_id: this.data.serviceType.id,
|
||||
// transferable_bank_id: this.data.bankAccount.id,
|
||||
// convertible_currency_id: this.data.serviceType.selectedCurrency.id,
|
||||
// };
|
||||
|
||||
this.submit(route('api.booking.create'), 'post', this.section, true, true)
|
||||
this.parameters.amount = this.refundAmount;
|
||||
this.submit(this.route('api.booking.refund.create', this.data.booking.id, this.data.id), 'post', this.section, true, true)
|
||||
},
|
||||
updateRefundType(refund){
|
||||
this.refundMethod = {
|
||||
name: refund.name,
|
||||
status: !this.refundMethod.status
|
||||
}
|
||||
this.refundMethod.name === 'Fully Refund' ? this.refundAmount = this.refundMaxValue : '';
|
||||
},
|
||||
successHandler(response){
|
||||
window.location.href = this.route('booking.details', response.payload.data.marking)
|
||||
|
||||
}
|
||||
},
|
||||
mixins: [FormHandler, ModalFormHandler]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
<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">
|
||||
<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">
|
||||
{{ data.booking.created_at_with_time }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">reference</div>
|
||||
<div class="font-heading fs-10">
|
||||
<a :href="route('booking.details', item.booking.marking)">{{item.booking.marking}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="font-heading fs-10 muted all-caps">Marking</div>
|
||||
<div class="font-heading fs-10">
|
||||
<a :href="route('customer.profile', data.booking.company.reference)">{{data.booking.company.reference}}</a>
|
||||
</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">
|
||||
{{(Math.round((data.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10">
|
||||
<div class="col">
|
||||
<div class="text-right">
|
||||
<button class="btn btn-xs btn-outline-danger b-rad-none m-r-5 requestModal" data-type="rejectRefund">
|
||||
<i class="fa fa-times fa-fw"></i>
|
||||
</button>
|
||||
<button class="btn btn-xs btn-success b-rad-none requestModal" data-type="approveRefund">
|
||||
<i class="fa fa-check fa-fw"></i>
|
||||
</button>
|
||||
<modal-component small type="rejectRefund">
|
||||
<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 Refund</h5>
|
||||
<div class="fs-11">Are you sure you want to reject this refund?</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="approveRefund(4)">Reject</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
<modal-component small type="approveRefund">
|
||||
<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">Approve Refund</h5>
|
||||
<div class="fs-11">Are you sure you want to approve this refund?</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-success btn-block b-rad-none" @click="approveRefund(2)">Approve</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</modal-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import componentHandler from '../../../general/mixins/componentHandler';
|
||||
import staticFormHandler from '../../../general/mixins/staticFormHandler'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
parameters: {
|
||||
status: null,
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
approveRefund(status){
|
||||
this.isLoading = true;
|
||||
this.parameters.status = status;
|
||||
this.submit(this.route('api.transaction.refund.status.update', this.data.id), 'put', 'listRefundTransactionSection', true, true);
|
||||
},
|
||||
},
|
||||
mixins: [componentHandler, staticFormHandler]
|
||||
}
|
||||
</script>
|
||||
@@ -44,7 +44,7 @@
|
||||
<div class="col no-padding m-b-10" :class="[{'p-l-5': index !== 0}, {'p-r-5': index+1 !== data.services.length}]" v-for="(service, index) in data.services" v-bind:key="service.id" >
|
||||
<div class="btn btn-xs b-rad-none padding-25 btn-block" :class="[{'btn-success': serviceType.id === service.id}, {'bg-master-lighter': serviceType.id !== service.id}]" @click="updateServiceType(service)">
|
||||
{{service.name}}
|
||||
<span class="absolute" style="right: -15px;top: -15px;width: 40px;" v-if="index !==0">
|
||||
<span class="absolute" style="right: -10px;top: -15px;width: 30px;" v-if="index !==0">
|
||||
<img src="/images/new-icon.png" class="w-100">
|
||||
</span>
|
||||
</div>
|
||||
|
||||
+21
-3
File diff suppressed because one or more lines are too long
@@ -23,11 +23,6 @@
|
||||
<div class="font-heading fs-11">You will be redirected to your bank to complete the payment of <span class="text-success bold">{{(Math.round((calculation.total + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} MYR</span> after clicking on the confirm button below. please follow your bank instruction to complete the payment</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-25" v-if="payment_method === 'payment_gateway'">
|
||||
<div class="col">
|
||||
<div class="font-heading fs-11">You will be redirected to your bank to complete the payment of <span class="text-success bold">{{(Math.round((calculation.total + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}} MYR</span> after clicking on the confirm button below. please follow your bank instruction to complete the payment</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center m-b-25" v-if="payment_method !== 'payment_gateway'">
|
||||
<div class="col-auto p-r-0">
|
||||
<div class="icon-thumbnail icon-50 bg-master-lightest">
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
<small class="bold fs-10 text-danger">{{error}}</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-15" v-show="calculation.date && !error">
|
||||
<div class="col padding-15 bg-master-lightest text-center m-l-15 m-r-15">
|
||||
<div class="fs-14 muted" >The recipient will receive the transfer amount by <br><span class="bold text-success">{{ this.calculation.receive_date }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-l-0 m-r-0">
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
<div class="row" v-if="paymentTotal > 0">
|
||||
<div class="col">
|
||||
<button class="btn btn-xs btn-success b-rad-none p-t-5 p-b-5 all-caps fs-10 btn-block" @click="submitForm()">Create Order</button>
|
||||
<button class="btn btn-xs btn-complete b-rad-none p-t-5 p-b-5 all-caps fs-10 w-100" @click="generateMockWhiteForm()">Create Mock Up White Form</button>
|
||||
</div>
|
||||
</div>
|
||||
<modal-component size="small" id="">
|
||||
@@ -138,6 +139,13 @@
|
||||
payments: [],
|
||||
rate: 0
|
||||
};
|
||||
},
|
||||
generateMockWhiteForm() {
|
||||
let paymentIds = this.payments.map(function(payment) {
|
||||
return payment.id
|
||||
});
|
||||
|
||||
window.open(this.route('whiteForm.mockUp', this.supplier.id)+'?rate='+this.parameters.rate+'&payments='+JSON.stringify(paymentIds), '_blank');
|
||||
}
|
||||
},
|
||||
mixins: [FormHandler]
|
||||
|
||||
+6
-5
@@ -114,7 +114,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<list-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list')" :options="{per_page: 10000, status: 2, owner_type: 'App\\Models\\Booking', type: 1, original_currency_id_in: [selectedCurrency.id], transaction_service_id: selectedService.id}">
|
||||
<list-component ref="pendingOrdersList" section="pendingOrdersSection" :endpoint="route('api.transaction.list')" :options="{per_page: 5, status: 2, owner_type: 'App\\Models\\Booking', type: 1, original_currency_id_in: [selectedCurrency.id], transaction_service_id: selectedService.id}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<supplier-pending-order-component :data="data" v-on:input="updateOrder($event)"></supplier-pending-order-component>
|
||||
</template>
|
||||
@@ -126,7 +126,7 @@
|
||||
<supplier-place-order-form-component :payments="payments" :currency="selectedCurrency" :supplier="selectedSupplier" section="pendingOrdersSection"></supplier-place-order-form-component>
|
||||
<div class="row m-t-20">
|
||||
<div class="col">
|
||||
<list-component key="2" section="currencyOrdersListSection" :options="{'per_page': 5, 'document_type_in': ['CURRENCY_VENDOR_ORDER'], 'status': 1, 'with_company': true}" :endpoint="route('api.document.list')">
|
||||
<list-component key="2" section="currencyOrdersListSection" :options="{'per_page': 10000, 'document_type_in': ['CURRENCY_VENDOR_ORDER'], 'status': 1, 'with_company': true}" :endpoint="route('api.document.list')">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<currency-order-component section="currencyOrdersListSection" :data="data"></currency-order-component>
|
||||
</template>
|
||||
@@ -176,9 +176,10 @@
|
||||
methods: {
|
||||
successHandler(response){
|
||||
this.suppliers = response.payload.data;
|
||||
this.updateSupplier(this.suppliers[0]);
|
||||
this.updateCurrency(this.suppliers[0].currencies[0]);
|
||||
this.updateService(this.suppliers[0].services[0]);
|
||||
this.selectedSupplier= this.suppliers[0];
|
||||
this.selectedService = this.suppliers[0].services[0];
|
||||
this.selectedCurrency = this.suppliers[0].currencies[0];
|
||||
this.updateList();
|
||||
},
|
||||
updateSupplier(supplier){
|
||||
if(supplier !== this.selectedSupplier){
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="col-auto">
|
||||
<div class="row">
|
||||
<div class="col-auto p-r-10">
|
||||
<div class="font-heading all-caps fs-8 muted">Currencies</div>
|
||||
@@ -34,15 +34,45 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto p-r-10">
|
||||
<div class="font-heading all-caps fs-8 muted">Service Charge</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">{{item.service_charge ? ((Math.round((parseFloat(item.service_charge.detail.amount.value) + Number.EPSILON) * 1000) / 1000).toFixed(3)+ '' +(item.service_charge.detail.amount.type === 'percentage' ? '%' : ' MYR')) : '0.000%'}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col-auto p-r-10">
|
||||
<div class="font-heading all-caps fs-8 muted">Transfer Fee</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="font-heading all-caps fs-10">{{item.service_charge ? ((Math.round((parseFloat(item.service_charge.detail.transferFee.value) + Number.EPSILON) * 1000) / 1000).toFixed(3)+ '' +(item.service_charge.detail.transferFee.type === 'percentage' ? '%' : ' FEC')) : '0.000%'}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<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>
|
||||
<button class="btn btn-xs btn-outline-danger b-rad-none m-r-5 requestModal" data-type="deleteSupplier">
|
||||
<i class="fa fa-times"></i>
|
||||
</button>
|
||||
<button class="btn btn-xs btn-complete p-l-10 p-r-10 b-rad-none" @click="expanded = !expanded">
|
||||
<i class="fa" :class="[{'fa-angle-up': expanded}, {'fa-angle-down': !expanded}]"></i>
|
||||
</button>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" type="editServiceCharge">
|
||||
<supplier-service-charge-form-component :supplierId="item.id" :data="item.service_charge" section="suppliersSection"></supplier-service-charge-form-component>
|
||||
</modal-component>
|
||||
<modal-component class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="deleteSupplier">
|
||||
<delete-supplier-form-component :data="item" section="suppliersSection" class="text-center"></delete-supplier-form-component>
|
||||
</modal-component>
|
||||
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<loading-component style="height: 50px; 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-20">
|
||||
<div class="col">
|
||||
<h6 class="all-caps m-b-5 bold no-margiPsn">Edit Service Charge</h6>
|
||||
</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 m-r-0">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.detail.amount.value">
|
||||
<label>Service Charge (MYR)</label>
|
||||
<input type="text" class="form-control" v-model="parameters.detail.amount.value" v-money="parameters.detail.amount.type === 'percentage' ? threeDecimalPercentage : productPrice">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-2 text-white pointer text-center" :class="[{'bg-master-lightest': parameters.detail.amount.type === 'percentage'}, {'bg-info': parameters.detail.amount.type === 'fix_amount'}]" @click="parameters.detail.amount.type = 'fix_amount'">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col p-r-20 fs-20" :class="[{'text-master': parameters.detail.amount.type === 'percentage'}]">
|
||||
MYR
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 text-white pointer text-center" :class="[{'bg-master-lightest': parameters.detail.amount.type === 'fix_amount'}, {'bg-info': parameters.detail.amount.type === 'percentage'}]" @click="parameters.detail.amount.type = 'percentage'">
|
||||
<div class="row h-100 align-items-center">
|
||||
<div class="col p-r-20 fs-20" :class="[{'text-master': parameters.detail.amount.type === 'fix_amount'}]">
|
||||
%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-10 m-r-0">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.detail.transferFee.value" >
|
||||
<label>Transfer Fee (FEC)</label>
|
||||
<input type="text" class="form-control" v-model="parameters.detail.transferFee.value" v-money="parameters.detail.transferFee.type === 'percentage' ? threeDecimalPercentage : productPrice">
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col-2 text-white pointer" :class="[{'bg-master-lightest': parameters.detail.transferFee.type === 'percentage'}, {'bg-info': parameters.detail.transferFee.type === 'fix_amount'}]" @click="parameters.detail.transferFee.type = 'fix_amount'">
|
||||
<div class="row h-100 align-items-center text-center">
|
||||
<div class="col p-r-20 p-l-20 fs-20" :class="[{'text-master': parameters.detail.transferFee.type === 'percentage'}]">
|
||||
FEC
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 text-white pointer" :class="[{'bg-master-lightest': parameters.detail.transferFee.type === 'fix_amount'}, {'bg-info': parameters.detail.transferFee.type === 'percentage'}]" @click="parameters.detail.transferFee.type = 'percentage'">
|
||||
<div class="row h-100 align-items-center text-center">
|
||||
<div class="col p-r-20 fs-20" :class="[{'text-master': parameters.detail.transferFee.type === 'fix_amount'}]">
|
||||
%
|
||||
</div>
|
||||
</div>
|
||||
</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()">Confirm</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import ModalFormHandler from '../../../general/mixins/modalFormHandler';
|
||||
import { required, requiredIf } from "vuelidate/lib/validators";
|
||||
export default {
|
||||
props: {
|
||||
supplierId: {
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
parameters: {
|
||||
name: 'Service Charge',
|
||||
reference: 'SERVICE_CHARGE',
|
||||
detail: {
|
||||
id: this.supplierId,
|
||||
amount: {
|
||||
type: "percentage",
|
||||
value: 0
|
||||
},
|
||||
transferFee: {
|
||||
type: "percentage",
|
||||
value: 0
|
||||
},
|
||||
transferCompanyId: this.supplierId
|
||||
},
|
||||
segment_id: 1
|
||||
},
|
||||
serviceChargeOptions: false,
|
||||
transferFeeOptions: false,
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
parameters: {
|
||||
detail: {
|
||||
amount: {
|
||||
value: required
|
||||
},
|
||||
transferFee: {
|
||||
value: required
|
||||
},
|
||||
transferCompanyId: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
created(){
|
||||
if(this.data){
|
||||
this.parameters.detail = {
|
||||
id: this.supplierId,
|
||||
amount: {
|
||||
type: this.data.detail.amount.type,
|
||||
value: parseFloat(this.data.detail.amount.value).toFixed(3)
|
||||
},
|
||||
transferFee: {
|
||||
type: this.data.detail.transferFee.type,
|
||||
value: parseFloat(this.data.detail.transferFee.value).toFixed(3)
|
||||
},
|
||||
transferCompanyId: this.data.detail.transferCompanyId
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
this.submit(this.data ? this.route('api.segment_constant.update', this.data.id) : this.route('api.segment_constant.create'), this.data ? 'put' : 'post', this.section, true, true);
|
||||
},
|
||||
},
|
||||
mixins: [ModalFormHandler]
|
||||
|
||||
}
|
||||
</script>
|
||||
+1
-1
@@ -200,7 +200,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="col-12 col-lg-3">
|
||||
<wallet-component :data="company"></wallet-component>
|
||||
<verification-warning-component v-if="!isLoading" :data="company"></verification-warning-component>
|
||||
</div>
|
||||
|
||||
@@ -16,20 +16,49 @@
|
||||
<label class="all-caps">Bookings Frequency</label>
|
||||
<input type="text" class="form-control" v-model.lazy="parameters.frequency">
|
||||
</validation-wrapper-component>
|
||||
<div class="row">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.frequency">
|
||||
<label class="all-caps">Date From</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.frequencyDateFrom"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col p-l-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.frequency">
|
||||
<label class="all-caps">Date To</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.frequencyDateTo"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md mb-2 mb-md-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.monetary">
|
||||
<label class="all-caps">Total Payments</label>
|
||||
<input type="text" class="form-control" v-model.lazy="parameters.monetary">
|
||||
</validation-wrapper-component>
|
||||
<div class="row">
|
||||
<div class="col p-r-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.frequency">
|
||||
<label class="all-caps">Date From</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.monetaryDateFrom"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
<div class="col p-l-0">
|
||||
<validation-wrapper-component :validator="$v.parameters.frequency">
|
||||
<label class="all-caps">Date To</label>
|
||||
<date-picker-component :parameters="parameters" v-model.lazy="parameters.monetaryDateTo"></date-picker-component>
|
||||
</validation-wrapper-component>
|
||||
</div>
|
||||
</div>
|
||||
</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()">Search</button>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row no-margin" v-show="search">
|
||||
<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}}">
|
||||
<template slot="list" slot-scope="{data}">
|
||||
@@ -53,16 +82,32 @@ export default {
|
||||
section: 'customerSectionComponent',
|
||||
isLoading: false,
|
||||
search: false,
|
||||
serachSectionKey: 2,
|
||||
parameters: {
|
||||
recency: '2022-02-15',
|
||||
frequency: 0,
|
||||
frequencyDateFrom: '2021-01-01',
|
||||
frequencyDateTo: '2022-01-01',
|
||||
monetary : 0,
|
||||
monetaryDateFrom: '2021-01-01',
|
||||
monetaryDateTo: '2022-02-15',
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submitSearch(){
|
||||
this.search = true;
|
||||
this.serachSectionKey ++;
|
||||
},
|
||||
reserSearch() {
|
||||
this.parameters.recency = '2022-02-15';
|
||||
this.parameters.frequency = 0;
|
||||
this.parameters.frequencyDateFrom ='2021-01-01';
|
||||
this.parameters.frequencyDateTo = '2022-01-01';
|
||||
this.parameters.monetary = 0;
|
||||
this.parameters.monetaryDateFrom = '2021-01-01';
|
||||
this.parameters.monetaryDateTo = '2022-02-15';
|
||||
this.serachSectionKey ++;
|
||||
}
|
||||
},
|
||||
validations: {
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
if(!success){return;}
|
||||
|
||||
let vm = this;
|
||||
let mappedList = response.payload.data.map(function(value){
|
||||
let mappedList = $.map(response.payload.data, function(value){
|
||||
let preservedValue = value;
|
||||
return {'id': !isNaN(value[vm.valueColumn]) ? parseInt(value[vm.valueColumn]) : value[vm.valueColumn],
|
||||
'text': vm.labelColumn.map(function(label){
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<template>
|
||||
<div v-if="validator.$error" class="text-danger fs-10">
|
||||
<small class="bold" v-for="(object, param) in validator.$params" v-if="!validator[param]">
|
||||
{{errorMessages[param]}}
|
||||
<span v-if="object.type === 'minLength'">{{object.min}} characters</span>
|
||||
<span v-if="object.type === 'sameAs'">{{object.eq}} field</span>
|
||||
<small class="bold" v-for="(object, param) in validator.$params">
|
||||
<span class="btn-block" v-if="object.type === 'required'">{{errorMessages[param]}}</span>
|
||||
<span class="btn-block" v-if="object.type === 'minLength'">{{errorMessages[param]}} {{object.min}} characters</span>
|
||||
<span class="btn-block" v-if="object.type === 'sameAs'">{{errorMessages[param]}} {{object.eq}} field</span>
|
||||
<span class="btn-block" v-if="object.type === 'maxValue'">{{errorMessages[param]}} {{object.max}}</span>
|
||||
</small>
|
||||
</div>
|
||||
</template>
|
||||
@@ -21,7 +22,8 @@
|
||||
required: 'this field is required',
|
||||
email: 'enter a valid email address',
|
||||
minLength: 'this field must have at least',
|
||||
sameAs: 'this field must match the'
|
||||
sameAs: 'this field must match the',
|
||||
maxValue: 'this value must not exceeds'
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
parameters: {
|
||||
starting_on:'',
|
||||
ending_on:'',
|
||||
// segment_id: '',
|
||||
title: '',
|
||||
description: '',
|
||||
}
|
||||
@@ -106,21 +105,11 @@
|
||||
|
||||
},
|
||||
created(){
|
||||
console.log("lado form");
|
||||
},
|
||||
methods: {
|
||||
submitForm(){
|
||||
//this.submit(route('api.announcement.create'), 'post', this.section, true, false);
|
||||
this.submit((this.data ? this.route('api.announcement.update', this.data.id) : this.route('api.announcement.create')), (this.data ? 'put' : 'post'), this.section, true, false)
|
||||
},
|
||||
// successHandler(response){
|
||||
// this.closeModal();
|
||||
// //this.formHandler();
|
||||
// this.resetForm();
|
||||
// },
|
||||
// errorHandler(error){
|
||||
// this.formHandler(error.message);
|
||||
// }
|
||||
}
|
||||
},
|
||||
mixins: [ModalFormHandler],
|
||||
|
||||
|
||||
@@ -28,9 +28,11 @@ export default {
|
||||
isLoading: false,
|
||||
error: '',
|
||||
money: {decimal: '.',thousands: ',', precision: 2},
|
||||
moneyV2: {decimal: '.',thousands: '', precision: 2},
|
||||
productPrice: {decimal: '.',thousands: ',', precision: 3},
|
||||
exchangeRate: {decimal: '.', thousands: '', precision: 5},
|
||||
percentage: {decimal: '.', thousands: '', precision: 2, suffix: '%'},
|
||||
threeDecimalPercentage: {decimal: '.', thousands: '', precision: 3, suffix: '%'},
|
||||
integer: {decimal: '', thousands: '', precision: 0},
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,29 +1,33 @@
|
||||
@extends('layouts.base_pdf')
|
||||
@section('inner_content')
|
||||
<style>
|
||||
table, th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 15px;
|
||||
}
|
||||
</style>
|
||||
<br>
|
||||
<htmlpageheader name="page-header">
|
||||
<br>
|
||||
<htmlpageheader name="page-header">
|
||||
<br>
|
||||
<table style="margin-bottom: 25px; border: none;">
|
||||
<tbody>
|
||||
<table style="margin-bottom: 25px; border: none;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{$supplier->name}}</td>
|
||||
<td>{{\Carbon\Carbon::now('Asia/Singapore')->format('d-m-Y h:s')}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</htmlpageheader>
|
||||
<br>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</htmlpageheader>
|
||||
<br>
|
||||
<table style="width:100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Reference</td>
|
||||
<td>Marking</td>
|
||||
@@ -33,29 +37,67 @@
|
||||
</tr>
|
||||
@foreach($transactions as $transaction)
|
||||
<tr style="margin-bottom: 10px;">
|
||||
<td>{{$transaction->owner()->first()->booking->marking}}</td>
|
||||
<td>{{$transaction->owner()->first()->booking->company->reference}}</td>
|
||||
<td>{{$transaction->owner->owner->marking}}</td>
|
||||
<td>{{$transaction->owner->owner->company->reference}}</td>
|
||||
<td>{{$transaction->currency_rate}}</td>
|
||||
<td>{{$transaction->currency->short_code}} {{number_format((float)$transaction->amount, 2, '.', '')}}</td>
|
||||
<td>Account Holder Name: {{$transaction->owner()->first()->booking->bank->holder_name}}<br>{{$transaction->owner()->first()->booking->bank->bank_name}}: {{$transaction->owner()->first()->booking->bank->account_no}}
|
||||
<br>Branch: {{$transaction->owner()->first()->booking->bank->bank_branch}}<br>Bank in Amount: {{$transaction->original_currency->short_code}} {{$transaction->original_amount}}</td>
|
||||
<td>Account Holder Name: {{$transaction->owner->owner->bank->holder_name}}<br>{{$transaction->owner->owner->bank->bank_name}}: {{$transaction->owner->owner->bank->account_no}}
|
||||
<br>Branch: {{$transaction->owner->owner->bank->bank_branch}}<br>Bank in Amount: {{$transaction->original_currency->short_code}} {{$transaction->original_amount}}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="margin-bottom: 25px; border: none;">
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<table style="margin-bottom: 25px; border: none;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;">Sub total booking amount: </td>
|
||||
@php
|
||||
$sub_total_booking_amount = number_format((float)$transactions->sum('original_amount'), 2, '.', '');
|
||||
@endphp
|
||||
<td>RMB {{$sub_total_booking_amount}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;">Transfer fee: </td>
|
||||
@php
|
||||
$transfer_fee = number_format((float)$transferFeeTransactions->sum('service_charge'), 2, '.', '');
|
||||
@endphp
|
||||
<td>RMB {{$transfer_fee}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;">Total booking amount: </td>
|
||||
@php
|
||||
$total_booking_amount = number_format((float) ($transactions->sum('original_amount') + $transfer_fee), 2, '.', '');
|
||||
@endphp
|
||||
<td>RMB {{$total_booking_amount}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;">Sub total amount: </td>
|
||||
@php
|
||||
$sub_total_amount = number_format((float)$transactions->sum('amount') + ($transfer_fee * 1/$transactions[0]->currency_rate), 2, '.', '');
|
||||
@endphp
|
||||
<td>MYR {{$sub_total_amount}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;">Service charge: </td>
|
||||
@php
|
||||
$service_charge = number_format((float)$transactions->sum('service_charge'), 2, '.', '');
|
||||
@endphp
|
||||
<td>MYR {{$service_charge}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="70%" style="text-align: right;">Total amount: </td>
|
||||
<td>MYR {{number_format((float)$transactions->sum('amount'), 2, '.', '')}}</td>
|
||||
@php
|
||||
$total_amount = number_format((float)$sub_total_amount + $service_charge, 2, '.', '');
|
||||
@endphp
|
||||
<td>MYR {{$total_amount}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<htmlpagefooter name="page-footer">
|
||||
<table width="100%" style="border: none;">
|
||||
<tr>
|
||||
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<htmlpagefooter name="page-footer">
|
||||
<table width="100%" style="border: none;">
|
||||
<tr>
|
||||
<td style="text-align: right; ">Page {PAGENO} of {nbpg}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</htmlpagefooter>
|
||||
</htmlpagefooter>
|
||||
@endsection
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row no-margin">
|
||||
<div class="col p-l-0 p-t-20 p-b-20 sm-text-center">
|
||||
<small class="small no-margin pull-left sm-pull-reset all-caps fs-10 muted" style=" letter-spacing: 1px; ">Copyright © 2021 CIEF Exchange. All rights reserved.</small>
|
||||
<small class="small no-margin pull-left sm-pull-reset all-caps fs-10 muted" style=" letter-spacing: 1px; ">Copyright © {{ date('Y') }} CIEF Exchange. All rights reserved.</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -35,6 +35,8 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function
|
||||
|
||||
require __DIR__ . '/segment.php';
|
||||
|
||||
require __DIR__ . '/segment_constant.php';
|
||||
|
||||
require __DIR__ . '/currency.php';
|
||||
|
||||
require __DIR__ . '/bank.php';
|
||||
|
||||
@@ -8,4 +8,6 @@ Route::group(['prefix' => 'bank', 'as' => 'bank.', 'namespace' => 'Banks'], func
|
||||
Route::put('/update/{id}', 'UpdateBankController@update')->name('update');
|
||||
Route::put('/{id}/default', 'SetBankToDefaultController@update')->name('default');
|
||||
Route::delete('/delete/{id}', 'DeleteBankController@delete')->name('delete');
|
||||
|
||||
Route::put('/update/{id}/status', 'UpdateBankStatusController@update')->name('status.update');
|
||||
});
|
||||
@@ -9,6 +9,8 @@ Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Compani
|
||||
Route::put('/update/{id}', 'UpdateCompanyController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete');
|
||||
|
||||
Route::put('/update/debtor/{id}', 'UpdateCompanyDebtorController@update')->name('delete');
|
||||
|
||||
Route::post('/team/create', 'AddNewMemberController@create')->name('team.create');
|
||||
|
||||
Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () {
|
||||
|
||||
@@ -2,19 +2,20 @@
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['namespace' => 'StandardSegmentConstants'], function () {
|
||||
Route::group(['middleware' => 'valid.token'], function () {
|
||||
Route::group(['prefix' => 'standard-segment-constant'], function () {
|
||||
Route::get('/list', 'ListStandardSegmentConstantsController@list')->name('standard_segment.update');
|
||||
Route::put('/update/{id}', 'UpdateStandardSegmentConstantController@update')->name('standard_segment_constant.update');
|
||||
});
|
||||
});
|
||||
});
|
||||
// Route::group(['namespace' => 'StandardSegmentConstants'], function () {
|
||||
// Route::group(['middleware' => 'valid.token'], function () {
|
||||
// Route::group(['prefix' => 'standard-segment-constant'], function () {
|
||||
// Route::get('/list', 'ListStandardSegmentConstantsController@list')->name('standard_segment.update');
|
||||
// Route::put('/update/{id}', 'UpdateStandardSegmentConstantController@update')->name('standard_segment_constant.update');
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
Route::group(['namespace' => 'SegmentConstants'], function () {
|
||||
Route::group(['middleware' => 'valid.token'], function () {
|
||||
Route::group(['prefix' => 'segment-constant'], function () {
|
||||
Route::get('/{id}/show', 'FetchSegmentConstantController@fetch')->name('segment_constant.show');
|
||||
Route::post('/create', 'CreateSegmentConstantController@create')->name('segment_constant.create');
|
||||
Route::put('/update/{id}', 'UpdateSegmentConstantController@update')->name('segment_constant.update');
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' =>
|
||||
route::post('{id}/bill/verification', 'CreatePaymentProofDocumentController@verify')->name('bill.verification');
|
||||
route::post('{id}/bill/pay', 'CreatePaymentProofDocumentController@pay')->name('bill.pay');
|
||||
Route::put('/{id}/bill/{status}', 'UpdatePaymentTransactionStatusController@update')->where('status', 'pending|complete')->name('bill.status');
|
||||
Route::put('/{id}/refund/status/update', 'UpdateRefundTransactionStatusController@update')->name('refund.status.update');
|
||||
|
||||
route::delete('{id}/bill/delete', 'DeletePaymentProofDocumentController@delete')->name('bill.delete');
|
||||
|
||||
@@ -18,4 +19,7 @@ Route::group(['prefix' => 'transactions', 'namespace' => 'Transactions', 'as' =>
|
||||
|
||||
Route::get('wallet/list', 'ListWalletTransactionsController@list')->name('wallet.list');
|
||||
|
||||
Route::get('/company/{id}/account/balance', 'FetchCompanyAccountBalanceController@fetch')->name('company.account.balance');
|
||||
|
||||
Route::get('/bank/{id}/account/balance', 'FetchBankAccountBalanceController@fetch')->name('bank.account.balance');
|
||||
});
|
||||
+8
-1
@@ -142,6 +142,11 @@ Route::get('billplz/bills/{bill_no}', function($bill_no){
|
||||
|
||||
Route::get('/export/customers/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@export');
|
||||
Route::get('/export/transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@transactions');
|
||||
Route::get('/export/null-debtor/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@nullDebtor');
|
||||
Route::get('/export/payment-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@paymentTransactions');
|
||||
Route::get('/export/wallet-transactions/f614e339d7058904a831aad742e24d55', 'Exports\ExportCustomersToExcelController@walletTransactions');
|
||||
|
||||
Route::get('/import/update-debtor/f614e339d7058904a831aad742e24d55', 'Imports\ImportUpdateDebtorController@import');
|
||||
|
||||
Route::get('/products', function (\App\Classes\Modules\Exports\Services\ExportsProducts $exportsProducts) {
|
||||
return $exportsProducts->download('products.csv', Excel::CSV, ['Content-Type' => 'text/csv']);
|
||||
@@ -166,4 +171,6 @@ Route::get('purchase/sensitive/', function(Request $request){
|
||||
foreach ($items as $key => $item){
|
||||
echo ($key+1).'. '.$item->product_name.' => <a href="'.\route('booking.details', $item->transaction->owner->marking).'" target="_blank">'.$item->transaction->owner->marking.'</a><br><br>';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Route::get('/transactions/supplier/{id}/mock_up', 'Transactions\DownloadMockUpWhiteFormPdfController@download')->name('whiteForm.mockUp');
|
||||
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
Reference in New Issue
Block a user