mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
153 lines
8.2 KiB
Vue
153 lines
8.2 KiB
Vue
<template>
|
|
<div class="row">
|
|
<div class="col">
|
|
<loading-component style="height: 200px; top: 0;" key="1" color="success" v-show="isLoading"></loading-component>
|
|
<div class="row m-l-5 m-t-15" v-if="wallet">
|
|
<div class="col-8 p-r-30">
|
|
<div class="row p-b-5 b-b b-grey m-b-10 m-l-0 m-r-0 padding-15">
|
|
<div class="col no-padding">
|
|
<h6>Transaction History</h6>
|
|
</div>
|
|
</div>
|
|
<div class="row" v-if="wallet.transactions">
|
|
<div class="col">
|
|
<div class="row padding-10">
|
|
<div class="col-3 fs-10">Date</div>
|
|
<div class="col fs-10">Description</div>
|
|
<div class="col-2 fs-10 text-center">Incoming</div>
|
|
<div class="col-2 fs-10 text-center">Outgoing</div>
|
|
<div class="col-2 fs-10 text-right">Balance</div>
|
|
</div>
|
|
|
|
<div class="row bg-white padding-10 m-b-10 rounded align-items-center" v-for="(item, index) in wallet.transactions" v-bind:key="item.id" :data="item">
|
|
<div class="col-3 fs-12">{{item.created_at}}</div>
|
|
<div class="col fs-12"><span v-html="item.description"></span> <a target=”_blank” v-if="[9,11].includes(item.type) " :href="route('transaction.credit_note.download', item.id)"><i class="fa fa-download fs-11 m-l-5 text-secondary hover-primary"></i></a></div>
|
|
<div class="col-2 text-success text-center">{{[5, 9, 15].includes(parseFloat(item.type)) ? (Math.round((parseFloat(item.amount) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : ''}}</div>
|
|
<div class="col-2 text-danger text-center">{{[2, 11].includes(parseFloat(item.type)) ? '- ' + (Math.round((parseFloat(item.amount) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") : ''}}</div>
|
|
<div class="col-2 text-right">{{remainingBalance(index)}}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row align-items-center justify-content-center p-t-50 p-b-50" v-if="!wallet.transactions || !wallet.transactions.length">
|
|
<div class="col-12">
|
|
<div class="row align-items-center justify-content-center hint-text">
|
|
<div class="col-4 hint-text"><img src="/images/not-found-illustration.png" class="w-100 hint-text"></div>
|
|
</div>
|
|
<div class="row text-center">
|
|
<div class="col">
|
|
<div class="row m-t-20">
|
|
<div class="col">
|
|
<p class="all-caps no-margin fs-11" style="letter-spacing: 2px;">Nothing To Show Here</p>
|
|
</div>
|
|
</div>
|
|
<div class="row m-t-5 align-items-center justify-content-center">
|
|
<div class="col">
|
|
<small class="fs-9 muted all-caps font-lato" style="letter-spacing: 2px">There is no results found, Try adjusting your filters to find what you are looking for.</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-4">
|
|
<wallet-component :data="wallet" :company_module_id="id" section="CompanyWalletTransactionSection" :creditable=true></wallet-component>
|
|
<div class="row m-t-20">
|
|
<div class="col">
|
|
<div class="row m-b-10">
|
|
<div class="col">
|
|
<div class="font-head fs-10 all-caps">Top Up Records</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col">
|
|
<wallet-top-up-history-component v-for="item in wallet.top_up_records" v-bind:key="item.id" :data="item"></wallet-top-up-history-component>
|
|
</div>
|
|
</div>
|
|
<div class="row align-items-center justify-content-center p-t-50 p-b-50" v-if="!wallet.top_up_records.length">
|
|
<div class="col-10">
|
|
<div class="row align-items-center justify-content-center hint-text">
|
|
<div class="col-4 hint-text"><img src="/images/not-found-illustration.png" class="w-100 hint-text"></div>
|
|
</div>
|
|
<div class="row text-center">
|
|
<div class="col">
|
|
<div class="row m-t-20">
|
|
<div class="col">
|
|
<p class="all-caps no-margin fs-11" style="letter-spacing: 2px;">Nothing To Show Here</p>
|
|
</div>
|
|
</div>
|
|
<div class="row m-t-5 align-items-center justify-content-center">
|
|
<div class="col">
|
|
<small class="fs-9 muted all-caps font-lato" style="letter-spacing: 2px">There is no results found, Try adjusting your filters to find what you are looking for.</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
props: {
|
|
id: {
|
|
type: Number,
|
|
required: true
|
|
},
|
|
},
|
|
data(){
|
|
return {
|
|
section: 'customerTransactionSection',
|
|
isLoading: true,
|
|
wallet: null,
|
|
attention: false
|
|
}
|
|
},
|
|
computed: {
|
|
pendingQueue () {
|
|
return this.$store.getters.isInCompleteQueue(this.section);
|
|
}
|
|
},
|
|
watch: {
|
|
pendingQueue(inComplete){
|
|
if(inComplete){
|
|
this.fetchWallet();
|
|
}
|
|
}
|
|
},
|
|
created(){
|
|
this.$store.dispatch('updateListQueue', {'name': this.section});
|
|
},
|
|
methods: {
|
|
fetchWallet(){
|
|
this.isLoading = true;
|
|
var filters = {with_transactions: true};
|
|
this.submit(route('api.wallet.company_module.show', this.id) + '?filters=' + JSON.stringify(filters), 'get', this.section, false, false);
|
|
},
|
|
remainingBalance(index) {
|
|
let tempBalance = 0;
|
|
|
|
if(this.wallet){
|
|
let transactions = this.wallet.transactions.slice().reverse();
|
|
transactions.slice(0, transactions.length - index).map(function(transaction) {
|
|
[2, 11].includes(transaction.type) ? tempBalance -= (transaction.amount) : tempBalance += (transaction.amount);
|
|
return tempBalance
|
|
}, 0);
|
|
}
|
|
|
|
return (Math.round((tempBalance + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
},
|
|
successHandler(response){
|
|
this.isLoading = false;
|
|
this.wallet = response.payload.data;
|
|
}
|
|
}
|
|
}
|
|
</script>
|