From f811fa4c3f8c96dbe445d06d4a6365dd9a1f8ccb Mon Sep 17 00:00:00 2001 From: olewandowski1 Date: Fri, 8 Nov 2024 13:08:16 +0100 Subject: [PATCH] hotfix: add printed data to dashboard --- src/actions.js | 8 ++++++++ src/components/VoucherAcquirementPaymentModal.js | 8 +++++--- src/components/VoucherAssignmentConfirmModal.js | 6 ++++-- src/hooks.js | 2 ++ src/translations/en.json | 1 + src/utils/utils.js | 4 ++-- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/actions.js b/src/actions.js index 94fdacb..6b8dc0c 100644 --- a/src/actions.js +++ b/src/actions.js @@ -766,6 +766,14 @@ export function fetchSystemData(economicUnit, startDate, endDate) { ) { totalCount } + printed: workerVoucher( + policyholder_Code: $economicUnitCode + status: PRINTED + dateCreated_Gte: $startDate + dateCreated_Lte: $endDate + ) { + totalCount + } paid: bill( subjectId: $economicUnitUuid status: A_2 diff --git a/src/components/VoucherAcquirementPaymentModal.js b/src/components/VoucherAcquirementPaymentModal.js index f86c9f7..27ef223 100644 --- a/src/components/VoucherAcquirementPaymentModal.js +++ b/src/components/VoucherAcquirementPaymentModal.js @@ -47,9 +47,11 @@ function VoucherAcquirementPaymentModal({ if (acquirementSummary?.errors) { return ( - {acquirementSummary?.errors?.map(( - { message, extensions }, index - ) => `${index + 1}. ${formatValidationError(message, extensions, formatMessage, formatMessageWithValues)}.`)} + {acquirementSummary?.errors?.map( + ({ message, extensions }, index) => + // eslint-disable-next-line implicit-arrow-linebreak + `${index + 1}. ${formatValidationError(message, extensions, formatMessage, formatMessageWithValues)}.`, + )} ); } diff --git a/src/components/VoucherAssignmentConfirmModal.js b/src/components/VoucherAssignmentConfirmModal.js index b0ddb46..e851220 100644 --- a/src/components/VoucherAssignmentConfirmModal.js +++ b/src/components/VoucherAssignmentConfirmModal.js @@ -47,8 +47,10 @@ function VoucherAssignmentConfirmModal({ return ( {assignmentSummary.errors - .map(({ message, extensions }, index) => - `${index + 1}. ${formatValidationError(message, extensions, formatMessage, formatMessageWithValues)}` + .map( + ({ message, extensions }, index) => + // eslint-disable-next-line implicit-arrow-linebreak + `${index + 1}. ${formatValidationError(message, extensions, formatMessage, formatMessageWithValues)}`, ) .join('\n')} diff --git a/src/hooks.js b/src/hooks.js index 933397d..ae210bb 100644 --- a/src/hooks.js +++ b/src/hooks.js @@ -19,6 +19,7 @@ export const useSystemData = (economicUnit, startDate, endDate) => { assigned: 0, expired: 0, cancelled: 0, + printed: 0, }, payment: { paid: 0, unpaid: 0 }, }); @@ -44,6 +45,7 @@ export const useSystemData = (economicUnit, startDate, endDate) => { assigned: payload.assigned.totalCount, expired: payload.expired.totalCount, cancelled: payload.cancelled.totalCount, + printed: payload.printed.totalCount, }, payment: { paid: payload.paid.totalCount, diff --git a/src/translations/en.json b/src/translations/en.json index 4ebea62..63a7e43 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -240,6 +240,7 @@ "workerVoucher.SystemData.voucher.assigned": "Assigned", "workerVoucher.SystemData.voucher.expired": "Expired", "workerVoucher.SystemData.voucher.cancelled": "Cancelled", + "workerVoucher.SystemData.voucher.printed": "Printed", "workerVoucher.SystemData.payment.title": "Payments", "workerVoucher.SystemData.payment.paid": "Paid", "workerVoucher.SystemData.payment.unpaid": "Unpaid", diff --git a/src/utils/utils.js b/src/utils/utils.js index 3532d02..5f886d5 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -82,6 +82,6 @@ export const trimDate = (date) => { export function formatValidationError(message, extensions, formatMessage, formatMessageWithValues) { return extensions - ? formatMessageWithValues(message, extensions) - : formatMessage(message); + ? formatMessageWithValues(message, extensions) + : formatMessage(message); }