mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
clean up wallet
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use App\Models\Booking;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class TransactionServiceId implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return Builder|mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->where('owner_type', Booking::class)->whereHas('booking', function ($query) use($value) {
|
||||
$query->where('service_id', $value);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+11
-5
@@ -455,15 +455,15 @@
|
||||
</div>
|
||||
<div class="row" v-if="paymentMethod.id === 'wallet'">
|
||||
<div class="col">
|
||||
<div class="row m-b-10 m-l-0 m-r-0" v-if="data.company.wallet ? data.company.wallet.amount : 0 < (Math.round((calculation.total + Number.EPSILON) * 100) / 100).toFixed(2)">
|
||||
<div class="row m-b-10 m-l-0 m-r-0" v-if="paymentMethod.id === 'wallet' && walletOutstanding < 0">
|
||||
<div class="col bg-danger-lighter">
|
||||
<h6 class="text-danger fs-14 m-b-0">You don't have sufficient credit in your wallet to complete this transaction. Please Reload your wallet.</h6>
|
||||
<h6 class="text-danger fs-14 bold">You don't have sufficient credit in your wallet to complete this transaction. Please Reload your wallet.</h6>
|
||||
<p class="text-complete fs-12 text-underline pointer" @click="calculation = ''">change the payment method?</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row m-b-20" v-if="data.company.wallet ? data.company.wallet.amount : 0 < (Math.round((calculation.total + Number.EPSILON) * 100) / 100).toFixed(2)">
|
||||
<div class="row m-b-20" v-if="paymentMethod.id === 'wallet' && walletOutstanding < 0">
|
||||
<div class="col">
|
||||
<wallet-component :data="data.company" :amount="(Math.round((calculation.total + Number.EPSILON) * 100) / 100).toFixed(2)"></wallet-component>
|
||||
<wallet-top-up-form-component :data="data.company" :amount="(Math.round(((walletOutstanding * -1)+ Number.EPSILON) * 100) / 100).toFixed(2)"></wallet-top-up-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -475,7 +475,7 @@
|
||||
<button class="btn btn-sm all-caps b-rad-none btn-default bg-master-lighter btn-block" @click="cancelQuotation()">Cancel</button>
|
||||
</div>
|
||||
<div class="col p-l-0" >
|
||||
<button class="btn btn-sm all-caps b-rad-none btn-success btn-block requestModal" data-type="paymentSummary" v-if="!(paymentMethod.id === 'wallet' && data.company.wallet ? data.company.wallet.amount : 0 < (Math.round((calculation.total + Number.EPSILON) * 100) / 100).toFixed(2))">Lock Booking</button>
|
||||
<button class="btn btn-sm all-caps b-rad-none btn-success btn-block requestModal" data-type="paymentSummary" v-if="paymentMethod.id !== 'wallet' || walletOutstanding >= 0">Lock Booking</button>
|
||||
</div>
|
||||
<modal-component v-if="calculation.total > 0" class="animate__animated animate__fast animate__fadeIn" styleType="fill-in" type="paymentSummary">
|
||||
<confirm-quotation-form-component v-on:cancelQuotation="cancelQuotation()" :calculation="calculation" :section="section" :id="item.id" :payment_method="paymentMethod.id" :bank_code="onlinePayment.id" :amount="amount"></confirm-quotation-form-component>
|
||||
@@ -524,6 +524,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
walletOutstanding(){
|
||||
let walletBalance = this.data.company.wallet ? this.data.company.wallet.amount : 0;
|
||||
return walletBalance - this.calculation.total;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updatePaymentType(payment){
|
||||
this.paymentMethod = {
|
||||
|
||||
+22
-13
@@ -181,23 +181,32 @@
|
||||
this.updateService(this.suppliers[0].services[0]);
|
||||
},
|
||||
updateSupplier(supplier){
|
||||
this.selectedSupplier = supplier;
|
||||
this.selectedSupplier.status = false;
|
||||
this.updateCurrency(supplier.currencies[0]);
|
||||
},
|
||||
updateCurrency(currency){
|
||||
|
||||
if(currency !== this.selectedCurrency){
|
||||
this.selectedCurrency = currency;
|
||||
this.$refs.pendingOrdersList.updateFilters({per_page: 10000, status: 2, type: 1, original_currency_id_in: [this.selectedCurrency.id]});
|
||||
if(supplier !== this.selectedSupplier){
|
||||
this.selectedSupplier= supplier;
|
||||
this.updateList();
|
||||
}
|
||||
this.currencyDropdownLaunch.status = false;
|
||||
this.payments = [];
|
||||
|
||||
},
|
||||
updateService(service){
|
||||
this.selectedService = service;
|
||||
if(service !== this.selectedService){
|
||||
this.selectedService = service;
|
||||
this.updateList();
|
||||
}
|
||||
},
|
||||
updateCurrency(currecny){
|
||||
if(currecny !== this.selectedCurrency){
|
||||
this.selectedCurrency = currecny;
|
||||
this.updateList();
|
||||
}
|
||||
},
|
||||
updateList(){
|
||||
|
||||
this.$refs.pendingOrdersList.updateFilters({per_page: 10000, status: 2, type: 1, original_currency_id_in: [this.selectedCurrency.id], transaction_service_id: this.selectedService.id});
|
||||
|
||||
this.selectedSupplier.status = false;
|
||||
this.currencyDropdownLaunch.status = false;
|
||||
this.serviceDropdownLaunch.status = false;
|
||||
this.payments = [];
|
||||
|
||||
},
|
||||
updateOrder(payment){
|
||||
this.payments.includes(payment) ? this.payments.splice(this.payments.indexOf(payment), 1) : this.payments.push(payment);
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="col m-b-15">
|
||||
<wallet-component :data="company"></wallet-component>
|
||||
<wallet-component :data="company" :creditable=true></wallet-component>
|
||||
</div>
|
||||
</div>
|
||||
<booking-form-component :data="company" section="customerProfileSection"></booking-form-component>
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 m-l-15">
|
||||
<wallet-component :data="company"></wallet-component>
|
||||
<wallet-component :data="company" :creditable=true></wallet-component>
|
||||
<div class="row m-t-20">
|
||||
<div class="col">
|
||||
<div class="row m-b-10">
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<label class="fs-10 text-white m-b-0 text-uppercase cursor" @click="reload = false"><i class="fa fa-angle-left p-r-15"></i>Top Up Wallet</label>
|
||||
</div>
|
||||
</div>
|
||||
<wallet-top-up-form-component :data="data" :amount="(!data.wallet ? amount : (Math.round((((amount - data.wallet.amount) < '0.00' ? '0.00' : (amount - data.wallet.amount)) + Number.EPSILON) * 100) / 100).toFixed(2))"></wallet-top-up-form-component>
|
||||
<wallet-top-up-form-component :data="data" :amount="(!data.wallet ? amount : (Math.round((((amount - data.wallet.amount) < '0.00' ? '0.00' : (amount - data.wallet.amount)) + Number.EPSILON) * 100) / 100).toFixed(2))" :creditable="creditable"></wallet-top-up-form-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -47,6 +47,10 @@
|
||||
amount: {
|
||||
type: String,
|
||||
default: '0.00'
|
||||
},
|
||||
creditable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data(){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="row m-b-20 text-center" v-if="$store.getters.isSuperAdmin">
|
||||
<div class="row m-b-20 text-center" v-if="$store.getters.isSuperAdmin && creditable">
|
||||
<div class="col p-r-5">
|
||||
<div class="b-a b-grey bg-white p-t-20 p-b-20 p-l-45 p-r-45 pointer" :class="{ 'bg-success': transactionType === 1, 'text-white': transactionType === 1, 'b-grey': transactionType !== 1 }" @click="transactionType !== 1 ? transactionType = 1 : transactionType = 0">
|
||||
<p class="no-margin bold">Credit</p>
|
||||
@@ -82,6 +82,10 @@
|
||||
amount: {
|
||||
type: String,
|
||||
default: '0.00'
|
||||
},
|
||||
creditable: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data(){
|
||||
@@ -89,7 +93,7 @@
|
||||
isLoading: false,
|
||||
transactionType: 0,
|
||||
parameters: {
|
||||
company_id: this.data,
|
||||
company_id: this.data.id,
|
||||
amount: '0.00',
|
||||
}
|
||||
}
|
||||
@@ -118,7 +122,7 @@
|
||||
submitForm() {
|
||||
this.isLoading = true;
|
||||
|
||||
if (this.transactionType !== 0) {
|
||||
if (this.transactionType !== 0 && this.creditable) {
|
||||
this.submit(this.route('api.wallet.'+(this.transactionType === 2 ? 'debit': 'credit')), 'post', '', true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user