From 07416f5bef31260367fa2501b5c0551258d3de51 Mon Sep 17 00:00:00 2001 From: Benjamin Piouffle Date: Wed, 11 Dec 2024 09:21:10 +0100 Subject: [PATCH] enhancement(EditTier): show default receipt title if none set --- components/edit-collective/tiers/EditTierModal.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/edit-collective/tiers/EditTierModal.js b/components/edit-collective/tiers/EditTierModal.js index 02f4b7f9f59..f4f1e7cf277 100644 --- a/components/edit-collective/tiers/EditTierModal.js +++ b/components/edit-collective/tiers/EditTierModal.js @@ -67,14 +67,17 @@ function getTierTypeOptions(intl, collectiveType) { return [...simplifiedTierTypes, membershipTierType]; } -function getReceiptTemplates(host) { +function getReceiptTemplates(intl, host) { const receiptTemplates = host?.settings?.invoice?.templates; const receiptTemplateTitles = []; if (receiptTemplates?.default) { receiptTemplateTitles.push({ value: 'default', - label: receiptTemplates.default.title, + label: intl.formatMessage( + { defaultMessage: '{value} (default)', id: 'OgbGHX' }, + { value: receiptTemplates.default.title }, + ), }); } if (receiptTemplates?.alternative) { @@ -102,7 +105,7 @@ function FormFields({ collective, values, hideTypeSelect }) { }, ]; - const receiptTemplateOptions = getReceiptTemplates(collective.host); + const receiptTemplateOptions = getReceiptTemplates(intl, collective.host); const taxes = getApplicableTaxes(collective, collective.host, values.type); @@ -520,7 +523,7 @@ function FormFields({ collective, values, hideTypeSelect }) { onChange={({ value }) => form.setFieldValue(field.name, value)} isLoading={loading} options={receiptTemplateOptions} - value={receiptTemplateOptions.find(option => option.value === field.value)} + value={receiptTemplateOptions.find(option => option.value === (field.value ?? 'default'))} /> )}