Files
exchange-2.0/resources/assets/vue/components/wallets/elements/CustomerWalletTransactionComponent.vue

61 lines
2.7 KiB
Vue

<template>
<div class="row bg-white padding-10 m-b-10 rounded">
<div class="col-3 fs-12">{{data.created_at}}</div>
<div class="col fs-12"><span v-html="data.description"></span>
<!-- Allow Credit Note to be downloaded for company NOT opted in E-Invoice -->
<!-- <a target=_blank v-if="[9].includes(data.type) && !data.einvoice" @click="downloadTransaction(data)"><i class="fa fa-download fs-11 m-l-5 text-secondary hover-primary"></i></a> -->
<!-- cief todo: 90 - E Credit Note incomplete (for company opted in E-Invoice)-->
</div>
<div class="col-2 text-success text-center">{{[5, 9].includes(parseFloat(data.type)) ? formatValue(data.amount) : ''}}</div>
<div class="col-2 text-danger text-center">{{[1, 11].includes(parseFloat(data.type)) ? '- ' + (formatValue(data.amount)) : ''}}</div>
<div class="col-2 text-right">{{formatValue(data.running_balance)}}</div>
</div>
</template>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
props: {
data: {
required: true,
type: Object
},
deciamls: {
type: Number,
required: true
},
},
methods: {
formatValue(value) {
if (this.deciamls != 2) {
return (Math.round((parseFloat(value) + Number.EPSILON) * 100000) / 100000).toLocaleString('en-US', { minimumFractionDigits: 5, maximumFractionDigits: 5 });
}
return (Math.round((parseFloat(value) + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
},
downloadTransaction(paramItem) {
let url = this.route('transaction.credit_note.download', paramItem.id);
if(window.LARAVEL_VAPOR_ENABLED){
this.$store.dispatch('crudRequest', {endpoint: url, method: 'get'})
.then(response =>
{
let success = response.ok;
response.json().then(response => {
if(!success){return;}
if (response.src) {
// window.location.href = response.src;
window.open(response.src, '_blank');
}
});
}
);
}
else{
window.open(url, '_blank');
}
},
},
mixins: [componentHandler],
}
</script>