admin.js
3 days ago
appointment.js
3 days ago
booking.js
3 days ago
customers.js
3 days ago
event.js
3 days ago
package.js
3 days ago
payment.js
3 days ago
socialAuthOptions.js
3 days ago
status.js
3 days ago
useReactiveCustomize.js
3 days ago
payment.js
61 lines
| 1 | import { reactive } from 'vue' |
| 2 | |
| 3 | const globalLabels = reactive(window.wpAmeliaLabels) |
| 4 | |
| 5 | function usePaymentGatewayName(payment) { |
| 6 | if (payment.gateway === 'onSite') { |
| 7 | return globalLabels.on_site |
| 8 | } |
| 9 | |
| 10 | if (payment.gateway === 'wc') { |
| 11 | return payment.gatewayTitle |
| 12 | } |
| 13 | |
| 14 | if (payment.gateway) { |
| 15 | return payment.gateway.charAt(0).toUpperCase() + payment.gateway.slice(1) |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | function usePaymentStatusName(status) { |
| 20 | switch (status) { |
| 21 | case 'paid': |
| 22 | return globalLabels.paid |
| 23 | |
| 24 | case 'pending': |
| 25 | return globalLabels.pending |
| 26 | |
| 27 | case 'partiallyPaid': |
| 28 | return globalLabels.partially_paid |
| 29 | |
| 30 | case 'refunded': |
| 31 | return globalLabels.refunded |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | function usePaymentStatusIcon(status, amColors) { |
| 36 | switch (status) { |
| 37 | case 'paid': |
| 38 | return { |
| 39 | icon: 'am-icon-checkmark-circle', |
| 40 | color: amColors.colorSuccess, |
| 41 | } |
| 42 | case 'pending': |
| 43 | return { |
| 44 | icon: 'am-icon-refresh', |
| 45 | color: amColors.colorWarning, |
| 46 | } |
| 47 | case 'partiallyPaid': |
| 48 | return { |
| 49 | icon: 'am-icon-prepaid', |
| 50 | color: amColors.colorPrimary, |
| 51 | } |
| 52 | case 'refunded': |
| 53 | return { |
| 54 | icon: 'am-icon-refund', |
| 55 | color: amColors.colorError, |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | export { usePaymentGatewayName, usePaymentStatusName, usePaymentStatusIcon } |
| 61 |