improved note making

This commit is contained in:
2025-11-21 16:59:02 +01:00
parent 80cb393768
commit 1076b12668

View File

@@ -140,42 +140,52 @@ export const HomePage = () => {
<Table.Cell>{item.item_name}</Table.Cell> <Table.Cell>{item.item_name}</Table.Cell>
</Table.Row> </Table.Row>
))} ))}
<Table.Row>
<Table.Cell colSpan={2}>
<InputGroup
endElement={
<Span color="fg.muted" textStyle="xs">
{note.length} / {MAX_CHARACTERS}
</Span>
}
>
<Input
placeholder={t("optional-note")}
value={note}
maxLength={MAX_CHARACTERS}
onChange={(e) => {
setNote(
e.currentTarget.value.slice(0, MAX_CHARACTERS)
);
}}
/>
</InputGroup>
</Table.Cell>
</Table.Row>
</Table.Body> </Table.Body>
<InputGroup
endElement={
<Span color="fg.muted" textStyle="xs">
{note.length} / {MAX_CHARACTERS}
</Span>
}
>
<Input
placeholder={t("optional-note")}
value={note}
maxLength={MAX_CHARACTERS}
onChange={(e) => {
setNote(e.currentTarget.value.slice(0, MAX_CHARACTERS));
}}
/>
</InputGroup>
</Table.Root> </Table.Root>
</Table.ScrollArea> </Table.ScrollArea>
)} )}
{selectedItems.length >= 1 && ( {selectedItems.length >= 1 && (
<Button <Button
onClick={() => onClick={() =>
createLoan(selectedItems, startDate, endDate, note).then((response) => { createLoan(selectedItems, startDate, endDate, note).then(
if (response.status === "error") { (response) => {
setMsgStatus("error"); if (response.status === "error") {
setMsgTitle(response.title || t("error")); setMsgStatus("error");
setMsgDescription(response.description || t("unknown-error")); setMsgTitle(response.title || t("error"));
setMsgDescription(
response.description || t("unknown-error")
);
setIsMsg(true);
return;
}
setMsgStatus("success");
setMsgTitle(t("success"));
setMsgDescription(t("loan-success"));
setIsMsg(true); setIsMsg(true);
return;
} }
setMsgStatus("success"); )
setMsgTitle(t("success"));
setMsgDescription(t("loan-success"));
setIsMsg(true);
})
} }
> >
{t("create-loan")} {t("create-loan")}