Skip to content

Commit

Permalink
Overview: Show safe regenerate button when invoice has been created i…
Browse files Browse the repository at this point in the history
…n past.
  • Loading branch information
janbarasek committed Feb 7, 2022
1 parent 6ccb2d6 commit c4e0d56
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions templates/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,11 @@ Vue.component('cms-order-overview', {
<div class="col">
<h5>Invoice</h5>
</div>
<div class="col-4 text-right">
<b-button variant="secondary" size="sm" @click="createInvoice">Create</b-button>
<div class="col-5 text-right">
<b-button variant="secondary" size="sm" @click="createInvoice">
<template v-if="order.invoiceNumber === null">Create</template>
<template v-else>Regenerate</template>
</b-button>
</div>
</div>
<p v-if="order.invoiceNumber === null" class="text-secondary">No&nbsp;invoice.</p>
Expand Down Expand Up @@ -546,6 +549,9 @@ Vue.component('cms-order-overview', {
});
},
createInvoice() {
if (this.order.invoiceNumber !== null && confirm('Do you really want to re-generate the invoice?') === false) {
return;
}
axiosApi.post('cms-order/create-invoice', {
id: this.id
}).then(() => {
Expand Down

0 comments on commit c4e0d56

Please sign in to comment.