diff --git a/src/assets/main.scss b/src/assets/main.scss index 0dd65d3a..d7cef171 100644 --- a/src/assets/main.scss +++ b/src/assets/main.scss @@ -112,7 +112,7 @@ body { font-weight: normal; text-transform: uppercase; line-height: 16px; - padding-bottom: 1em !important; + padding-bottom: 1em; } .custom-button { diff --git a/src/components/ConfirmPaymentModal.vue b/src/components/ConfirmPaymentModal.vue index c49cfe27..2c2552be 100644 --- a/src/components/ConfirmPaymentModal.vue +++ b/src/components/ConfirmPaymentModal.vue @@ -8,13 +8,14 @@ { transactionDetail: $gettext("Transaction details"), paymentConfirmation: $gettext("Payment confirmation"), + topup: $gettext("Top-up details"), }[$modal.args?.value[0].type] }}

@@ -27,14 +28,22 @@ ? $gettext("Transaction sent") : $gettext("Transaction processed"), paymentConfirmation: $gettext("Payment sent"), + topup: $gettext("Top-up requested"), }[$modal.args?.value[0].type] }}

-
+
+ +
+

+

+ {{ + ((t) => + $gettext("Requested %{amount}", { + amount: `${numericFormat(t.amount)} ${t.currency}`, + }))($modal.args?.value[0].transaction) + }} +

+

+ {{ + $modal.args?.value[0].transaction.paid + ? $gettext( + "This top-up request is waiting for an administrator of your local currency to validate it" + ) + : $gettext( + "This top-up request is waiting for you to pay it or cancel it" + ) + }} +

+

{{ $modal.args?.value[0].transaction.amount < 0 ? $gettext("to") @@ -84,10 +122,32 @@ is-justify-content-flex-end " > +
+ + +
@@ -99,6 +159,7 @@ import { Options, Vue } from "vue-class-component" import { mapGetters } from "vuex" import moment from "moment" + import { UIError } from "../exception" @Options({ name: "ConfirmPaymentModal", @@ -110,6 +171,38 @@ ).format("YYYY-MM-DD HH:mm:ssZ") }, }, + methods: { + payTopUpRequest(): void { + // XXXvlab: we would need to launch regular checks + // here to acknowledge the payment + window.open( + this.$modal.args?.value[0].transaction.jsonData.odoo.order_url, + "_blank" + ) + }, + async cancelTopUpRequest(): Promise { + this.$loading.show() + try { + await this.$modal.args?.value[0].transaction.cancel() + } catch (err) { + throw new UIError( + this.$gettext( + "An error occured while deleting transaction, please try again or contact an administrator" + ), + err + ) + } finally { + this.$loading.hide() + this.closeAndRefresh() + } + }, + // XXXvlab: the refresh is unnecessary in most case, and + // should occur only when needed. + closeAndRefresh(): void { + this.$modal.close("refreshTopUpList") + this.$lokapi.flushBackendCaches() + }, + }, }) export default class ConfirmPaymentModal extends Vue {} diff --git a/src/components/MoneyCreditModal.vue b/src/components/MoneyCreditModal.vue index e535ffc2..8d2a529e 100644 --- a/src/components/MoneyCreditModal.vue +++ b/src/components/MoneyCreditModal.vue @@ -180,6 +180,7 @@ + diff --git a/src/components/TheBankAccountList.vue b/src/components/TheBankAccountList.vue index 51a60b2a..987e5b17 100644 --- a/src/components/TheBankAccountList.vue +++ b/src/components/TheBankAccountList.vue @@ -51,7 +51,7 @@ }} {{ $gettext("to create one.") }}

-
+

{{ $gettext("your accounts") }}

@@ -73,11 +73,14 @@
-
+

{{ $gettext("your pending accounts") }}

-
+

{{ $gettext( "The accounts listed below have been subjected to " + @@ -85,7 +88,7 @@ " approved, these accounts will become usable." ) }} -

+

-
- -
+ + + +
@@ -19,6 +25,7 @@ import { Options, Vue } from "vue-class-component" import TransactionListRecent from "./TransactionListRecent.vue" + import PendingTopUp from "./PendingTopUp.vue" import { mapModuleState } from "@/utils/vuex" @@ -26,19 +33,35 @@ name: "TheTransactionList", components: { TransactionListRecent, + PendingTopUp, }, props: { refreshToggle: Boolean, account: Object, }, + data() { + return { + isTransactionsLoading: false, + } + }, computed: { ...mapModuleState("lokapi", ["transactionsLoading", "lastTransactions"]), }, mounted() { console.log("TransactionList", this.account) }, + methods: { + trigger(value: boolean) { + this.isTransactionsLoading = value + }, + }, }) export default class TheTransactionList extends Vue {} - + diff --git a/src/components/TransactionItem.vue b/src/components/TransactionItem.vue index a10578b2..cf7df0df 100644 --- a/src/components/TransactionItem.vue +++ b/src/components/TransactionItem.vue @@ -1,5 +1,5 @@