improved note making
This commit is contained in:
@@ -140,42 +140,52 @@ export const HomePage = () => {
|
||||
<Table.Cell>{item.item_name}</Table.Cell>
|
||||
</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>
|
||||
<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.ScrollArea>
|
||||
)}
|
||||
{selectedItems.length >= 1 && (
|
||||
<Button
|
||||
onClick={() =>
|
||||
createLoan(selectedItems, startDate, endDate, note).then((response) => {
|
||||
if (response.status === "error") {
|
||||
setMsgStatus("error");
|
||||
setMsgTitle(response.title || t("error"));
|
||||
setMsgDescription(response.description || t("unknown-error"));
|
||||
createLoan(selectedItems, startDate, endDate, note).then(
|
||||
(response) => {
|
||||
if (response.status === "error") {
|
||||
setMsgStatus("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);
|
||||
return;
|
||||
}
|
||||
setMsgStatus("success");
|
||||
setMsgTitle(t("success"));
|
||||
setMsgDescription(t("loan-success"));
|
||||
setIsMsg(true);
|
||||
})
|
||||
)
|
||||
}
|
||||
>
|
||||
{t("create-loan")}
|
||||
|
||||
Reference in New Issue
Block a user