diff --git a/.changeset/wet-forks-nail.md b/.changeset/wet-forks-nail.md
new file mode 100644
index 00000000..16720793
--- /dev/null
+++ b/.changeset/wet-forks-nail.md
@@ -0,0 +1,6 @@
+---
+"@quassel/frontend": patch
+"@quassel/ui": patch
+---
+
+Introduce setting weeklyRecurring for entries
diff --git a/apps/frontend/src/components/questionnaire/calendar/EntryForm.tsx b/apps/frontend/src/components/questionnaire/calendar/EntryForm.tsx
index 4e2d0fce..4c22d5d1 100644
--- a/apps/frontend/src/components/questionnaire/calendar/EntryForm.tsx
+++ b/apps/frontend/src/components/questionnaire/calendar/EntryForm.tsx
@@ -1,7 +1,7 @@
-import { Button, Group, Stack, TimeInput, NumberInput, ActionIcon, IconMinus, isInRange, isNotEmpty, useForm } from "@quassel/ui";
+import { Button, Group, Stack, TimeInput, NumberInput, ActionIcon, IconMinus, isInRange, isNotEmpty, useForm, Switch } from "@quassel/ui";
import { i18n } from "../../../stores/i18n";
import { useStore } from "@nanostores/react";
-import { useEffect } from "react";
+import { useEffect, useState } from "react";
import { CarerSelect } from "../../CarerSelect";
import { LanguageSelect } from "../../LanguageSelect";
import { components } from "../../../api.gen";
@@ -13,15 +13,20 @@ export type EntryFormValues = {
ratio: number;
language?: number;
}[];
+ weeklyRecurring?: number;
startedAt: string;
endedAt: string;
};
const messages = i18n("entityForm", {
- actionAddDialect: "Add dialect",
+ actionAddLanguage: "Add language",
+ actionAddRecurringRule: "Add recurring rule",
actionDelete: "Delete",
+
labelCarer: "Carer",
labelLanguage: "Language",
+ labelRecurringRulePrefix: "Recurs every",
+ labelRecurringRuleSuffix: "weeks.",
validationRatio: "Ratio must be between 1 and 100.",
validationTotalRatio: "Total Ratio must always be 100%.",
validationNotEmpty: "Field must not be empty.",
@@ -67,10 +72,16 @@ export function EntityForm({ onSave, onDelete, onAddCarer, onAddLanguage, action
},
});
+ const [showRecurringRule, setShowRecurringRule] = useState(false);
+
useEffect(() => {
if (entry) {
f.setValues(entry);
f.resetDirty();
+
+ if (entry.weeklyRecurring && entry.weeklyRecurring > 1) {
+ setShowRecurringRule(true);
+ }
}
}, [entry]);
@@ -132,7 +143,7 @@ export function EntityForm({ onSave, onDelete, onAddCarer, onAddLanguage, action
}}
variant="light"
>
- {t.actionAddDialect}
+ {t.actionAddLanguage}
@@ -140,6 +151,22 @@ export function EntityForm({ onSave, onDelete, onAddCarer, onAddLanguage, action
+ {
+ f.setValues({ weeklyRecurring: showRecurringRule ? 1 : 2 });
+ setShowRecurringRule(!showRecurringRule);
+ }}
+ label={t.actionAddRecurringRule}
+ >
+ {showRecurringRule && (
+
+ {t.labelRecurringRulePrefix}
+
+ {t.labelRecurringRuleSuffix}
+
+ )}
+
{onDelete && (