diff --git a/resources/js/app.js b/resources/js/app.js index 8f81765..98d1800 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -779,6 +779,7 @@ document.addEventListener('alpine:init', () => { couponName: '', codePrefix: 'PREREG', usageCount: 1, + couponsRefreshing: false, strings: cfg.strings || {}, async init() { @@ -853,6 +854,18 @@ document.addEventListener('alpine:init', () => { this.ensureSelectedCouponInList(); this.syncCouponName(); }, + + async refreshCoupons() { + if (!this.isConnected) { + return; + } + this.couponsRefreshing = true; + try { + await this.loadCoupons(); + } finally { + this.couponsRefreshing = false; + } + }, })); }); diff --git a/resources/views/admin/weeztix/edit.blade.php b/resources/views/admin/weeztix/edit.blade.php index fc3955b..5b149a9 100644 --- a/resources/views/admin/weeztix/edit.blade.php +++ b/resources/views/admin/weeztix/edit.blade.php @@ -31,6 +31,9 @@ 'strings' => [ 'genericError' => __('Er ging iets mis. Probeer het opnieuw.'), 'loadCouponsError' => __('Kon kortingsbonnen niet laden.'), + 'refreshCoupons' => __('Vernieuwen'), + 'refreshCouponsBusy' => __('Bezig…'), + 'refreshCouponsTitle' => __('Couponlijst opnieuw ophalen van Weeztix'), ], ]))" > @@ -165,7 +168,22 @@ @method('PUT')
- +
+ + +