update refund section

This commit is contained in:
edmondlang
2022-03-11 10:27:40 +08:00
parent 5fac75de95
commit a7646fb4eb
4 changed files with 28 additions and 134 deletions
+1
View File
@@ -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(
@@ -4,16 +4,19 @@
<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>
<div class="font-heading fs-8 muted all-caps">{{ item.type === 6 ? 'Refund' : 'Payment' }} Amount</div>
<div class="font-heading fs-10 bold">
{{item.currency.short_code}} {{(Math.round((item.amount + Number.EPSILON) * 100) / 100).toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}}
</div>
@@ -25,7 +28,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>
@@ -176,7 +179,7 @@
</div>
</div>
</div>
<div class="row m-t-10">
<div class="row m-t-10" v-show="item.type !== 6">
<div class="col">
<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">
@@ -186,102 +189,6 @@
</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 +199,17 @@
data(){
return {
expandPaymentDetails: false,
expandRefund: false,
refundMethod: {
name: 'Partially 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',
}
},
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]
@@ -10,7 +10,13 @@
<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 }}
{{ 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">
@@ -19,12 +25,14 @@
<a :href="route('customer.profile', data.booking.company.reference)">{{data.booking.company.reference}}</a>
</div>
</div>
<div class="col-auto">
<div class="col text-right">
<div class="font-heading fs-10 muted all-caps">Amount</div>
<div class="font-heading fs-10">
{{ data.booking.amount }}
<div class="font-heading fs-14 text-success bold">
{{(Math.round((data.booking.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">
@@ -49,7 +57,7 @@
<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('reject')">Reject</div>
<div data-dismiss="modal" class="btn btn-sm btn-danger btn-block b-rad-none" @click="approveRefund(4)">Reject</div>
</div>
</div>
</div>
@@ -73,7 +81,7 @@
<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('approve')">Approve</div>
<div data-dismiss="modal" class="btn btn-sm btn-success btn-block b-rad-none" @click="approveRefund(2)">Approve</div>
</div>
</div>
</div>
@@ -98,13 +106,15 @@
export default {
data() {
return {
status: ''
parameters: {
status: null,
}
}
},
methods: {
approveRefund(status){
this.isLoading = true;
this.status = status;
this.parameters.status = status;
this.submit(this.route('api.transaction.refund.status.update', this.data.id), 'put', 'listRefundTransactionSection', true, true);
},
},
@@ -83,7 +83,7 @@
<div class="col">
<div class="row">
<div class="col">
<list-component key="2" section="listRefundTransactionSection" :endpoint="route('api.transaction.list')" :options="{'type': 6}">
<list-component key="2" section="listRefundTransactionSection" :endpoint="route('api.transaction.list')" :options="{'type': 6, status: 1}">
<template slot="list" slot-scope="{data}">
<refund-verification-component section="listRefundTransactionSection" :data="data"></refund-verification-component>
</template>