diff --git a/client/src/components/Form/FormRepeat.vue b/client/src/components/Form/FormRepeat.vue index 8f4bb29fa87e..881878f677b1 100644 --- a/client/src/components/Form/FormRepeat.vue +++ b/client/src/components/Form/FormRepeat.vue @@ -25,6 +25,22 @@ const maxRepeats = computed(() => { return typeof props.input.max === "number" ? props.input.cache?.length >= props.input.max : false; }); +const minRepeats = computed(() => { + return typeof props.input.min === "number" ? props.input.cache?.length > props.input.min : true; +}); + +const buttonTooltip = computed(() => { + return maxRepeats.value + ? `Maximum number of ${props.input.title || "Repeat"} fields reached` + : `Click to add ${props.input.title || "Repeat"} fields`; +}); + +const deleteTooltip = computed(() => { + return !minRepeats.value + ? `Minimum number of ${props.input.title || "Repeat"} not reached` + : `Click to delete ${props.input.title || "Repeat"} fields`; +}); + const props = defineProps({ input: { type: Object as PropType, @@ -136,17 +152,18 @@ const { keyObject } = useKeyedObjects(); - - - + + + + + @@ -155,10 +172,11 @@ const { keyObject } = useKeyedObjects(); - - - Insert {{ props.input.title || "Repeat" }} - -
Maximum number of {{ props.input.title || "Repeat" }} fields reached
+ + + + Insert {{ props.input.title || "Repeat" }} + +