Skip to content

Commit dc432ab

Browse files
committed
feat: add select box for search
1 parent 8169e9a commit dc432ab

2 files changed

Lines changed: 66 additions & 42 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Paper, MultiSelect, Group, Button } from "@mantine/core";
2+
import React from "react";
3+
4+
export const PageActions = () => {
5+
return (
6+
<Paper p="lg" withBorder>
7+
<Group justify="space-between">
8+
<MultiSelect
9+
label="Show purchases from academic years"
10+
description=" "
11+
defaultValue={["23-24"]}
12+
data={["23-24", "24-25"]}
13+
/>
14+
<Button>Import data from eActivities</Button>{" "}
15+
</Group>
16+
</Paper>
17+
);
18+
};

collection/app/(app)/UserSearch.tsx

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { useRouter, useSearchParams } from "next/navigation";
88
import React, { useCallback, useEffect, useMemo, useState, useTransition } from "react";
99
import { FaSearch, FaTimesCircle } from "react-icons/fa";
1010

11+
import { PageActions } from "./PageActions";
12+
1113
export const UserSearch = () => {
1214
const [error, setError] = useState<string | null>(null);
1315
const [purchases, setPurchases] = useState<OrderResponse[]>([]);
@@ -71,46 +73,50 @@ export const UserSearch = () => {
7173
);
7274

7375
return (
74-
<Stack>
75-
<Center>
76-
<Stack w="60%" justify="centre" align="centre">
77-
<form
78-
style={{
79-
width: "100%",
80-
display: "flex",
81-
justifyContent: "center",
82-
alignItems: "center",
83-
}}
84-
action={submitActionWithTransition}
85-
>
86-
<Group w="100%">
87-
<TextInput
88-
placeholder="Enter shortcode"
89-
leftSection={<FaSearch />}
90-
w="60%"
91-
flex={1}
92-
required
93-
name="shortcode"
94-
id="shortcode"
95-
onChange={(e) => setSetshortcodeFormState(e.currentTarget.value)}
96-
value={shortcodeFormState}
97-
/>
98-
<Button loading={isPending} type="submit">
99-
Submit
100-
</Button>
101-
</Group>
102-
</form>
103-
{error && (
104-
<Alert title="Error" color="red" mt="md" icon={<FaTimesCircle />}>
105-
{error}
106-
</Alert>
107-
)}
108-
</Stack>
109-
</Center>
110-
<Center>
111-
<UserInfo shortcode={shortcode} />
112-
</Center>
113-
<Container w="70%">
76+
<Container w="70%">
77+
<Stack gap="lg">
78+
<PageActions />
79+
<Center>
80+
<Stack w="90%" justify="centre" align="centre">
81+
<form
82+
style={{
83+
width: "100%",
84+
display: "flex",
85+
justifyContent: "center",
86+
alignItems: "center",
87+
}}
88+
action={submitActionWithTransition}
89+
>
90+
<Group w="100%">
91+
<TextInput
92+
placeholder="Enter shortcode"
93+
leftSection={<FaSearch />}
94+
w="60%"
95+
flex={1}
96+
required
97+
name="shortcode"
98+
id="shortcode"
99+
onChange={(e) =>
100+
setSetshortcodeFormState(e.currentTarget.value)
101+
}
102+
value={shortcodeFormState}
103+
/>
104+
<Button loading={isPending} type="submit">
105+
Submit
106+
</Button>
107+
</Group>
108+
</form>
109+
{error && (
110+
<Alert title="Error" color="red" mt="md" icon={<FaTimesCircle />}>
111+
{error}
112+
</Alert>
113+
)}
114+
</Stack>
115+
</Center>
116+
<Center>
117+
<UserInfo shortcode={shortcode} />
118+
</Center>
119+
114120
{!error ? (
115121
<BuyerItemsTable
116122
shortcode={shortcode}
@@ -120,7 +126,7 @@ export const UserSearch = () => {
120126
) : (
121127
<></>
122128
)}
123-
</Container>
124-
</Stack>
129+
</Stack>
130+
</Container>
125131
);
126132
};

0 commit comments

Comments
 (0)