feat: reminder due calculation
This commit is contained in:
1 parent
f2b1d0293a
commit
6e1d0a7568
4 files changed
+72
-1
No files matched your search
@@ -23,6 +23,7 @@ export default function NewVoucherPage() {
|
||||
const [serverError, setServerError] = useState("");
|
||||
const [contacts, setContacts] = useState<{ id: number; name: string }[]>([]);
|
||||
const [contactIds, setContactIds] = useState<number[]>([]);
|
||||
const [reminderDays, setReminderDays] = useState("30,6,1");
|
||||
|
||||
useEffect(() => {
|
||||
fetch("/api/contacts")
|
||||
@@ -55,7 +56,7 @@ export default function NewVoucherPage() {
|
||||
const res = await fetch("/api/vouchers", {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({ ...input, contactIds }),
|
||||
body: JSON.stringify({ ...input, contactIds, reminderDays }),
|
||||
});
|
||||
if (!res.ok) {
|
||||
const data = await res.json().catch(() => ({}));
|
||||
@@ -87,6 +88,20 @@ export default function NewVoucherPage() {
|
||||
{errors.includes(f.name) && <p className="mt-1 text-sm text-red-600">Ungültig: {f.name}</p>}
|
||||
</div>
|
||||
))}
|
||||
<div>
|
||||
<label htmlFor="reminderDays" className="block text-sm font-medium">
|
||||
Erinnerung (Tage vorher, Kommaliste)
|
||||
</label>
|
||||
<input
|
||||
id="reminderDays"
|
||||
name="reminderDays"
|
||||
type="text"
|
||||
value={reminderDays}
|
||||
onChange={(e) => setReminderDays(e.target.value)}
|
||||
placeholder="30,6,1"
|
||||
className="mt-1 w-full rounded border px-3 py-2"
|
||||
/>
|
||||
</div>
|
||||
<section id="kontakte">
|
||||
<h2 className="text-sm font-medium">Empfänger</h2>
|
||||
{contacts.map((c) => (
|
||||
|
||||
Reference in new issue
Block a user