Files
exchange-2.0/resources/assets/vue/components/bookings/elements/PaymentHistoryComponent.vue
T
2021-12-19 17:30:41 +08:00

296 lines
19 KiB
Vue

<template>
<div class="row m-l-0 m-b-10 m-r-0 parentContainer" :class="[{'b-a': item.status === 4}, {'b-danger': item.status === 4}]" >
<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="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 === 3" :class="[{'text-danger': item.status === 1 || item.status === 4}, {'text-success': item.status !== 1 && item.status !== 4}]">
{{ item.status === 1 ? 'Processing Payment' : 'Transferred'}}
</div>
</div>
<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.type === 3 ? item.original_currency.short_code : item.currency.short_code}} {{(Math.round((item.type === 3 ? item.original_amount : item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="font-heading fs-8 all-caps" v-if="(item.payment_method === 5 && item.status !== 0 && item.status !== 1) || item.payment_method !==5" :class="[{'text-danger': item.status === 4}, {'text-primary': item.status !== 4}]">{{ item.status === 1 ? 'Submitted' : item.status === 2 ? 'Received' : item.status === 4 ? 'Rejected' : 'Paid'}} On: {{item.updated_at}}</div>
</div>
</div>
</div>
<div class="col-auto" v-if="item.status !== 3 && item.status !== 2" :class="[{'bg-master-light': item.status === 1}, {'bg-master-lighter': item.status === 2}]">
<div class="row align-items-center h-100" v-if="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>
</div>
</div>
<div class="row align-items-center h-100" v-if="item.payment_method === 5">
<div class="col">
<i class="fa fa-cloud-download muted" v-if="item.status === 2"></i>
<a :href="'https://www.billplz-sandbox.com/bills/'+item.payment_reference"><i class="fa fa-repeat text-success" v-if="item.status !== 2"></i></a>
</div>
</div>
</div>
<div class="col-auto bg-success" v-if="item.type === 3 && (item.status === 2 || item.status === 3)">
<document-file-viewer-component class="h-100" :file="item.documents.files[0]">
<template slot="button">
<div class="row align-items-center h-100">
<div class="col">
<i class="fa fa-cloud-download text-white"></i>
</div>
</div>
</template>
</document-file-viewer-component>
</div>
</div>
<div class="row" v-if="expandPaymentDetails">
<div class="col bg-white padding-15">
<div class="row align-items-end m-b-10 text-success bold">
<div class="col">
<div class="font-heading all-caps fs-10">Recipient Gets</div>
</div>
<div class="col-auto text-right">
<div class="font-heading fs-10">{{this.customerBooking.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 bold m-b-10 text-primary">
<div class="col">
<div class="font-heading all-caps fs-10">Rate</div>
</div>
<div class="col-auto text-right">
<div class="font-heading fs-10 ">{{(Math.round((this.customerBooking.currency_rate + Number.EPSILON) * 100000) / 100000).toFixed(5) }}</div>
</div>
</div>
<div class="row align-items-end m-b-10 hint-text">
<div class="col">
<div class="font-heading all-caps fs-10">Transfer Charges</div>
</div>
<div class="col-auto text-right">
<div class="font-heading fs-10">MYR {{(Math.round((this.customerBooking.service_charge + Number.EPSILON) * 100) / 100).toFixed(2)}}</div>
</div>
</div>
<div class="row align-items-end m-b-5 hint-text">
<div class="col">
<div class="font-heading all-caps fs-10">Tax</div>
</div>
<div class="col-auto text-right">
<div class="font-heading fs-10">MYR {{(Math.round((this.customerBooking.tax + Number.EPSILON) * 100) / 100).toFixed(2)}}</div>
</div>
</div>
<div class="row align-items-end m-b-10 bold text-success">
<div class="col">
<div class="font-heading all-caps fs-10">Your Payment</div>
</div>
<div class="col-auto text-right">
<div class="font-heading fs-12">MYR {{(Math.round((this.customerBooking.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="font-heading all-caps fs-10 m-b-5">Your Payment Proof</div>
<div class="row no-margin" v-if="customerBooking.payment_method !== 5">
<div v-if="item.documents != null">
<div v-for="file in item.documents.files" v-bind:key="file.id" class="col-auto no-padding m-r-5">
<document-file-viewer-component :file="file">
<template slot="button">
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
<i class="fa fa-file-image-o fs-10"></i>
</div>
</template>
</document-file-viewer-component>
</div>
</div>
</div>
<div class="row no-margin" v-if="customerBooking.payment_method === 5 && (customerBooking.status === 2 || customerBooking.status === 3)">
<a :href="'https://www.billplz-sandbox.com/bills/'+customerBooking.payment_reference" target="_blank">
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-5">
<i class="fa fa-file-image-o fs-10"></i>
</div>
</a>
</div>
</div>
<div class="col text-right">
<div class="font-heading all-caps fs-10 m-b-5">Our Payment Proof</div>
<div class="row no-margin justify-content-end" v-if="item.type === 3 && (item.status === 2 || item.status === 3)">
<div v-for="file in customerBooking.item.documents.files" v-bind:key="file.id" class="col-auto no-padding m-l-5">
<document-file-viewer-component :file="file">
<template slot="button">
<div class="icon-thumbnail fs-11 text-white icon-25 bg-primary btn-rounded float-left m-r-0">
<i class="fa fa-file-image-o fs-10"></i>
</div>
</template>
</document-file-viewer-component>
</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>
<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>
</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>
<script>
import componentHandler from '../../../general/mixins/componentHandler';
export default {
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: {
customerBooking(){
return this.item.type === 1 ? this.item : this.item.customer_booking;
}
},
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
}
},
},
mixins: [componentHandler]
}
</script>