aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'packages/merchant-backoffice-ui/src/components')
-rw-r--r--packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx12
-rw-r--r--packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx1
-rw-r--r--packages/merchant-backoffice-ui/src/components/instance/DefaultInstanceFormFields.tsx8
3 files changed, 18 insertions, 3 deletions
diff --git a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx
index 68f79bc35..3cd36a6e0 100644
--- a/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx
+++ b/packages/merchant-backoffice-ui/src/components/form/InputPaytoForm.tsx
@@ -171,7 +171,7 @@ export function InputPaytoForm<T>({
label,
tooltip,
}: Props<keyof T>): VNode {
- const { value: paytos, onChange } = useField<T>(name);
+ const { value: paytos, onChange, required } = useField<T>(name);
const [value, valueHandler] = useState<Partial<Entity>>(defaultTarget);
@@ -198,7 +198,10 @@ export function InputPaytoForm<T>({
const paytoURL = !url ? "" : url.href;
const errors: FormErrors<Entity> = {
- target: value.target === noTargetValue ? i18n.str`required` : undefined,
+ target:
+ value.target === noTargetValue && !paytos.length
+ ? i18n.str`required`
+ : undefined,
path1: !value.path1
? i18n.str`required`
: value.target === "iban"
@@ -368,6 +371,11 @@ export function InputPaytoForm<T>({
</div>
))}
{!paytos.length && i18n.str`No accounts yet.`}
+ {required && (
+ <span class="icon has-text-danger is-right">
+ <i class="mdi mdi-alert" />
+ </span>
+ )}
</div>
</div>
diff --git a/packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx b/packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx
index 495c93897..8a57a9de8 100644
--- a/packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx
+++ b/packages/merchant-backoffice-ui/src/components/form/InputSelector.tsx
@@ -45,7 +45,6 @@ export function InputSelector<T>({
toStr = defaultToString,
}: Props<keyof T>): VNode {
const { error, value, onChange } = useField<T>(name);
- console.log(error);
return (
<div class="field is-horizontal">
<div class="field-label is-normal">
diff --git a/packages/merchant-backoffice-ui/src/components/instance/DefaultInstanceFormFields.tsx b/packages/merchant-backoffice-ui/src/components/instance/DefaultInstanceFormFields.tsx
index c497773d9..3a3bdd6f3 100644
--- a/packages/merchant-backoffice-ui/src/components/instance/DefaultInstanceFormFields.tsx
+++ b/packages/merchant-backoffice-ui/src/components/instance/DefaultInstanceFormFields.tsx
@@ -31,6 +31,7 @@ import { InputImage } from "../form/InputImage.js";
import { InputLocation } from "../form/InputLocation.js";
import { InputPaytoForm } from "../form/InputPaytoForm.js";
import { InputWithAddon } from "../form/InputWithAddon.js";
+import { InputSelector } from "../form/InputSelector.js";
export function DefaultInstanceFormFields({
readonlyId,
@@ -59,6 +60,13 @@ export function DefaultInstanceFormFields({
tooltip={i18n.str`Legal name of the business represented by this instance.`}
/>
+ <InputSelector<Entity>
+ name="user_type"
+ label={i18n.str`Type`}
+ tooltip={i18n.str`Different type of account can have different rules and requirements.`}
+ values={["business", "individual"]}
+ />
+
<Input<Entity>
name="email"
label={i18n.str`Email`}