Browse Source

Boutons de paiement

refactoring
Guillaume Bourgeois 5 years ago
parent
commit
7eb39983f0
2 changed files with 16 additions and 6 deletions
  1. +12
    -5
      backend/views/distribution/index.php
  2. +4
    -1
      backend/web/js/vuejs/distribution-index.js

+ 12
- 5
backend/views/distribution/index.php View File

</td> </td>
<td> <td>
<div class="btn-group" v-if="order.user"> <div class="btn-group" v-if="order.user">
<button class="btn btn-xs btn-default" :data-id-order="order.id">
<span class="glyphicon glyphicon-euro"></span>
<span v-if="order.amount_paid == order.amount">Rembourser</span>
<span v-else-if="order.amount_paid == 0 || order.amount_paid < order.amount">Payer</span>
<span v-else-if="order.amount_paid > order.amount">Rembourser</span>
<button class="btn btn-xs btn-default" v-if="order.amount_paid == order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="refund" :data-amount="order.amount">
<span class="glyphicon glyphicon-euro"></span> Rembourser
</button> </button>
<button class="btn btn-xs btn-default" v-else-if="order.amount_paid == 0" @click="orderPaymentClick" :data-id-order="order.id" data-type="payment" :data-amount="order.amount">
<span class="glyphicon glyphicon-euro"></span> Payer
</button>
<button class="btn btn-xs btn-default" v-else-if="order.amount_paid < order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="payment" :data-amount="order.amount_remaining">
<span class="glyphicon glyphicon-euro"></span> Payer
</button>
<button class="btn btn-xs btn-default" v-else-if="order.amount_paid > order.amount" @click="orderPaymentClick" :data-id-order="order.id" data-type="refund" :data-amount="order.amount_surplus">
<span class="glyphicon glyphicon-euro"></span> Rembourser
</button>
<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="caret"></span> <span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span> <span class="sr-only">Toggle Dropdown</span>

+ 4
- 1
backend/web/js/vuejs/distribution-index.js View File

orderPaymentClick: function(event) { orderPaymentClick: function(event) {
var app = this ; var app = this ;
var idOrder = event.currentTarget.getAttribute('data-id-order') ; var idOrder = event.currentTarget.getAttribute('data-id-order') ;
if(!idOrder) {
idOrder = this.idOrderPayment ;
}
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-payment",{params: { axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-payment",{params: {
idOrder: this.idOrderPayment,
idOrder: idOrder,
type: event.currentTarget.getAttribute('data-type'), type: event.currentTarget.getAttribute('data-type'),
amount: event.currentTarget.getAttribute('data-amount') amount: event.currentTarget.getAttribute('data-amount')
}}) }})

Loading…
Cancel
Save