Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #590 from beabee-communityrm/feat/draft-payment-st…
Browse files Browse the repository at this point in the history
…atus

feat: hide draft payments in payment history
  • Loading branch information
wpf500 authored May 9, 2024
2 parents 90d8129 + f68c7aa commit ca9d028
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 30 deletions.
1 change: 1 addition & 0 deletions locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@
"pageCount": "Seite {pageNumber} von {pageTotal}",
"paymentStatus": {
"cancelled": "Gekündigt",
"draft": "Entwurf",
"failed": "Fehlgeschlagen",
"pending": "In Bearbeitung",
"successful": "Erfolgreich"
Expand Down
4 changes: 3 additions & 1 deletion locales/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@
"loading": "Der Computer arbeitet.",
"newsletterStatus": {},
"noResults": "Der Computer hat keine Ergebnisse gefunden.",
"paymentStatus": {},
"paymentStatus": {
"draft": "Hier ist ein erster Vorschlag."
},
"role": {},
"selectNone": "keine",
"selectOne": "Hier kannst du ein Bild / eine Unterschrift / … aus-suchen",
Expand Down
1 change: 1 addition & 0 deletions locales/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@
"pageCount": "Seite {pageNumber} von {pageTotal}",
"paymentStatus": {
"cancelled": "Gekündigt",
"draft": "Entwurf",
"failed": "Fehlgeschlagen",
"pending": "In Bearbeitung",
"successful": "Erfolgreich"
Expand Down
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@
"pageCount": "Page {pageNumber} out of {pageTotal}",
"paymentStatus": {
"cancelled": "Cancelled",
"draft": "Draft",
"failed": "Failed",
"pending": "Pending",
"successful": "Successful"
Expand Down
3 changes: 2 additions & 1 deletion locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"pageCount": "Pagina {pageNumber} di {pageTotal}",
"paymentStatus": {
"cancelled": "Cancellato",
"draft": "Bozza",
"failed": "Errore",
"pending": "In attesa",
"successful": "Riuscito"
Expand Down Expand Up @@ -490,4 +491,4 @@
"tagEditor": {
"confirmDelete": {}
}
}
}
4 changes: 3 additions & 1 deletion locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@
"loading": "Ladt...",
"newsletterStatus": {},
"noResults": "Geen resultaten gevonden",
"paymentStatus": {},
"paymentStatus": {
"draft": "Ontwerp"
},
"role": {},
"selectNone": "Geen",
"selectOne": "Kiies er één",
Expand Down
1 change: 1 addition & 0 deletions locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@
"pageCount": "Página {pageNumber} de {pageTotal}",
"paymentStatus": {
"cancelled": "Cancelado",
"draft": "Rascunho",
"failed": "Falhado",
"pending": "A aguardar",
"successful": "Sucesso"
Expand Down
1 change: 1 addition & 0 deletions locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
"pageCount": "Страница {pageNumber} из {pageTotal}",
"paymentStatus": {
"cancelled": "Отменён",
"draft": "Черновик",
"failed": "Ошибка",
"pending": "В работе",
"successful": "Успех"
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"@appsignal/javascript": "^1.3.28",
"@beabee/beabee-common": "^0.20.3",
"@beabee/beabee-common": "^0.20.7",
"@captchafox/vue": "^1.1.0",
"@fontsource/fira-sans": "^5.0.18",
"@fontsource/fira-sans-condensed": "^5.0.8",
Expand Down
24 changes: 9 additions & 15 deletions src/components/contact/ContactPaymentsHistory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
{{ formatLocale(value, 'PPP') }}
</template>
<template #value-amount="{ value, item }">
<span class="mr-3">
{{ getStatusText(item) }}
<span v-if="item.status !== PaymentStatus.Successful" class="mr-3">
{{ t('common.paymentStatus.' + item.status) }}
</span>
<b>{{ n(value, 'currency') }}</b>
</template>
Expand Down Expand Up @@ -48,7 +48,7 @@ import AppHeading from '@components/AppHeading.vue';
import { formatLocale } from '@utils/dates';
import { fetchPayments } from '@utils/api/contact';
import type { GetPaymentData } from '@type';
import type { GetPaymentData, GetPaymentsQuery } from '@type';
const { t, n } = useI18n();
Expand Down Expand Up @@ -79,29 +79,23 @@ function getRowClass(item: GetPaymentData) {
case PaymentStatus.Failed:
return 'text-danger';
case PaymentStatus.Pending:
case PaymentStatus.Draft:
return 'text-body-60';
default:
return '';
}
}
function getStatusText(item: GetPaymentData) {
switch (item.status) {
case PaymentStatus.Cancelled:
return t('common.paymentStatus.cancelled');
case PaymentStatus.Failed:
return t('common.paymentStatus.failed');
case PaymentStatus.Pending:
return t('common.paymentStatus.pending');
}
}
watchEffect(async () => {
const query = {
const query: GetPaymentsQuery = {
offset: currentPage.value * pageSize,
limit: pageSize,
sort: 'chargeDate',
order: SortType.Desc,
rules: {
condition: 'AND',
rules: [{ field: 'status', operator: 'not_equal', value: ['draft'] }],
},
};
paymentsHistoryTable.value = await fetchPayments(props.id, query);
});
Expand Down
3 changes: 2 additions & 1 deletion src/components/pages/admin/payments.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ export const filterItems = computed<FilterItems<PaymentFilterName>>(() => ({
contact: withLabel(paymentFilters.contact, t('payments.data.contact')),
amount: withLabel(paymentFilters.amount, t('payments.data.amount')),
status: withLabel(paymentFilters.status, t('payments.data.status'), {
successful: t('common.paymentStatus.successful'),
draft: t('common.paymentStatus.draft'),
pending: t('common.paymentStatus.pending'),
successful: t('common.paymentStatus.successful'),
failed: t('common.paymentStatus.failed'),
cancelled: t('common.paymentStatus.cancelled'),
}),
Expand Down
1 change: 1 addition & 0 deletions src/components/payment/PaymentStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { PaymentStatus } from '@beabee/beabee-common';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const color = {
draft: 'text-body-60',
pending: 'text-body-60',
successful: 'text-success',
cancelled: 'text-danger',
Expand Down
12 changes: 6 additions & 6 deletions src/lib/i18n-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
"displayName": "English",
"adminLocale": "en"
},
"it": {
"baseLocale": "it",
"name": "Italiano",
"displayName": "Italiano",
"adminLocale": "en"
},
"de": {
"baseLocale": "de",
"name": "Deutsch (formal)",
Expand All @@ -23,6 +17,12 @@
"displayName": "Deutsch",
"adminLocale": "de@informal"
},
"it": {
"baseLocale": "it",
"name": "Italiano",
"displayName": "Italiano",
"adminLocale": "en"
},
"ru": {
"baseLocale": "ru",
"name": "Русский",
Expand Down

0 comments on commit ca9d028

Please sign in to comment.