1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(bug) invalid plan prices in interface

This commit is contained in:
Sylvain 2023-01-26 09:39:27 +01:00
parent 8b5fd8d6d2
commit 65e2f037ab
2 changed files with 13 additions and 8 deletions

View File

@ -1,5 +1,7 @@
# Changelog Fab-manager
- Fix a bug: plan prices are not reported correctly in the interface
## v5.6.7 2023 January 25
- Fix a bug: updating plan prices
@ -14,7 +16,8 @@
- Fix a bug: unable to run task fix_invoice_item when some invoice items are associated with errors
- Fix a bug: invalid event date reported when the timezone in before UTC
- Fix a bug: unable to run accounting export if a line label was not defined
- Fix a security issue: updated rack to 2.2.6.2 to fix [CVE-2022-44571](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-44571)
- Fix a security issue: updated rack to 2.2.6.2 to fix [CVE-2022-44571](https
- cgi-bin/cvename.cgi?name=CVE-2022-44571)
- Fix a security issue: updated globalid to 1.0.1 to fix [CVE-2023-22799](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-22799)
- [TODO DEPLOY] `rails fablab:fix:invoice_items_in_error` THEN `rails fablab:fix_invoice_items` THEN `rails db:migrate`

View File

@ -30,7 +30,7 @@ interface PlanPricingFormProps<TContext extends object> {
*/
export const PlanPricingForm = <TContext extends object>({ register, control, formState, setValue, onError }: PlanPricingFormProps<TContext>) => {
const { t } = useTranslation('admin');
const { fields } = useFieldArray({ control, name: 'prices_attributes' });
const { fields } = useFieldArray<Plan, 'prices_attributes'>({ control, name: 'prices_attributes' });
const [machines, setMachines] = useState<Array<Machine>>(null);
const [spaces, setSpaces] = useState<Array<Space>>(null);
@ -104,16 +104,18 @@ export const PlanPricingForm = <TContext extends object>({ register, control, fo
machines && {
id: 'machines',
title: t('app.admin.plan_pricing_form.machines'),
content: fields.filter(p => p.priceable_type === 'Machine').map((price, index) =>
renderPriceElement(price, index)
)
content: fields.map((price, index) => {
if (price.priceable_type !== 'Machine') return false;
return renderPriceElement(price, index);
}).filter(Boolean)
},
spaces && {
id: 'spaces',
title: t('app.admin.plan_pricing_form.spaces'),
content: fields.filter(p => p.priceable_type === 'Space').map((price, index) =>
renderPriceElement(price, index)
)
content: fields.map((price, index) => {
if (price.priceable_type !== 'Space') return false;
return renderPriceElement(price, index);
}).filter(Boolean)
}
]} />}
</div>