commit 065b69c718f9a4f2ef89a29e84de96ddec2f9bb9
parent 4333fb9aec57fd9040db34ebd627061dc9277011
Author: Sebastian <sebasjm@taler-systems.com>
Date: Thu, 15 Jan 2026 12:10:21 -0300
fix #10839 hide options
Diffstat:
3 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/packages/merchant-backoffice-ui/src/components/menu/SideBar.tsx b/packages/merchant-backoffice-ui/src/components/menu/SideBar.tsx
@@ -488,6 +488,7 @@ export function getAvailableForPersona(p: MerchantPersona): ElementMap {
[UIElement.sidebar_tokenFamilies]: false,
[UIElement.option_ageRestriction]: false,
[UIElement.option_refreshableScopes]: false,
+ [UIElement.option_advanceProductTaxes]: false,
};
case "offline-vending-machine":
return {
@@ -520,6 +521,7 @@ export function getAvailableForPersona(p: MerchantPersona): ElementMap {
[UIElement.option_inventoryTaxes]: false,
[UIElement.sidebar_statistics]: false,
[UIElement.option_refreshableScopes]: false,
+ [UIElement.option_advanceProductTaxes]: false,
};
// case "inperson-vending-with-inventory":
case "point-of-sale":
@@ -553,6 +555,7 @@ export function getAvailableForPersona(p: MerchantPersona): ElementMap {
[UIElement.option_inventoryTaxes]: false,
[UIElement.sidebar_statistics]: false,
[UIElement.option_refreshableScopes]: false,
+ [UIElement.option_advanceProductTaxes]: false,
};
case "digital-publishing":
return {
@@ -585,6 +588,7 @@ export function getAvailableForPersona(p: MerchantPersona): ElementMap {
[UIElement.action_useRevenueApi]: false,
[UIElement.option_inventoryTaxes]: false,
[UIElement.option_refreshableScopes]: false,
+ [UIElement.option_advanceProductTaxes]: false,
};
case "e-commerce":
return {
@@ -617,6 +621,7 @@ export function getAvailableForPersona(p: MerchantPersona): ElementMap {
[UIElement.action_useRevenueApi]: false,
[UIElement.option_inventoryTaxes]: false,
[UIElement.option_refreshableScopes]: false,
+ [UIElement.option_advanceProductTaxes]: false,
};
}
}
diff --git a/packages/merchant-backoffice-ui/src/components/product/ProductForm.tsx b/packages/merchant-backoffice-ui/src/components/product/ProductForm.tsx
@@ -77,8 +77,8 @@ export function ProductForm({
!initial || !initial.categories
? []
: categories
- .filter((c) => initial.categories?.indexOf(c.category_id) !== -1)
- .map((c) => ({ id: String(c.category_id), description: c.name }));
+ .filter((c) => initial.categories?.indexOf(c.category_id) !== -1)
+ .map((c) => ({ id: String(c.category_id), description: c.name }));
const groupMap = new Map<number, string>();
for (const c of groups) {
groupMap.set(c.group_serial, c.group_name);
@@ -109,12 +109,12 @@ export function ProductForm({
!initial || initial.total_stock === -1
? undefined
: {
- current: initial.total_stock || 0,
- lost: initial.total_lost || 0,
- sold: initial.total_sold || 0,
- address: initial.address,
- nextRestock: initial.next_restock,
- },
+ current: initial.total_stock || 0,
+ lost: initial.total_lost || 0,
+ sold: initial.total_sold || 0,
+ address: initial.address,
+ nextRestock: initial.next_restock,
+ },
});
const errors = undefinedIfEmpty<FormErrors<Entity>>({
@@ -270,26 +270,29 @@ export function ProductForm({
tooltip={i18n.str`Categories where this product will be listed on.`}
unique
/>
- <InputSelector<Entity>
- name="money_pot_id"
- label={i18n.str`Money pot`}
- help={i18n.str`Search by money pot description or id`}
- tooltip={i18n.str`Money pots where this product will be listed on.`}
- values={[0, ...potMap.keys()]}
- toStr={(p: number) => (!p ? i18n.str`Select one` : potMap.get(p)!)}
- fromStr={(d) => Number.parseInt(d, 10)}
- readonly={pots.length === 0}
- />
- <InputSelector<Entity>
- name="product_group_id"
- label={i18n.str`Group`}
- help={i18n.str`Search by group name or id`}
- tooltip={i18n.str`Categories where this product will be listed on.`}
- values={[0, ...groupMap.keys()]}
- toStr={(g: number) => (!g ? i18n.str`Select one` : groupMap.get(g)!)}
- fromStr={(d) => Number.parseInt(d, 10)}
- readonly={groups.length === 0}
- />
+
+ <FragmentPersonaFlag point={UIElement.option_advanceProductTaxes}>
+ <InputSelector<Entity>
+ name="money_pot_id"
+ label={i18n.str`Money pot`}
+ help={i18n.str`Search by money pot description or id`}
+ tooltip={i18n.str`Money pots where this product will be listed on.`}
+ values={[0, ...potMap.keys()]}
+ toStr={(p: number) => (!p ? i18n.str`Select one` : potMap.get(p)!)}
+ fromStr={(d) => Number.parseInt(d, 10)}
+ readonly={pots.length === 0}
+ />
+ <InputSelector<Entity>
+ name="product_group_id"
+ label={i18n.str`Group`}
+ help={i18n.str`Search by group name or id`}
+ tooltip={i18n.str`Categories where this product will be listed on.`}
+ values={[0, ...groupMap.keys()]}
+ toStr={(g: number) => (!g ? i18n.str`Select one` : groupMap.get(g)!)}
+ fromStr={(d) => Number.parseInt(d, 10)}
+ readonly={groups.length === 0}
+ />
+ </FragmentPersonaFlag>
</FormProvider>
</div>
);
diff --git a/packages/merchant-backoffice-ui/src/hooks/preference.ts b/packages/merchant-backoffice-ui/src/hooks/preference.ts
@@ -55,6 +55,7 @@ export enum UIElement {
option_ageRestriction,
option_inventoryTaxes,
option_refreshableScopes,
+ option_advanceProductTaxes,
}
export interface Preferences {