ENCOA-99: Added a Student ID field to Students
This commit is contained in:
@@ -86,7 +86,7 @@ export default function BatchCodeGenerator({user}: {user: User}) {
|
||||
const information = uniqBy(
|
||||
rows
|
||||
.map((row) => {
|
||||
const [firstName, lastName, country, passport_id, email, ...phone] = row as string[];
|
||||
const [firstName, lastName, country, passport_id, email, phone] = row as string[];
|
||||
return EMAIL_REGEX.test(email.toString().trim())
|
||||
? {
|
||||
email: email.toString().trim().toLowerCase(),
|
||||
|
||||
@@ -104,7 +104,7 @@ export default function BatchCreateUser({user}: {user: User}) {
|
||||
const information = uniqBy(
|
||||
rows
|
||||
.map((row) => {
|
||||
const [firstName, lastName, country, passport_id, email, phone, group] = row as string[];
|
||||
const [firstName, lastName, country, passport_id, email, phone, group, studentID] = row as string[];
|
||||
const countryItem =
|
||||
countryCodes.findOne("countryCode" as any, country.toUpperCase()) ||
|
||||
countryCodes.all().find((x) => x.countryNameEn.toLowerCase() === country.toLowerCase());
|
||||
@@ -116,6 +116,7 @@ export default function BatchCreateUser({user}: {user: User}) {
|
||||
type: type,
|
||||
passport_id: passport_id?.toString().trim() || undefined,
|
||||
groupName: group,
|
||||
studentID,
|
||||
demographicInformation: {
|
||||
country: countryItem?.countryCode,
|
||||
passport_id: passport_id?.toString().trim() || undefined,
|
||||
@@ -182,6 +183,7 @@ export default function BatchCreateUser({user}: {user: User}) {
|
||||
<th className="border border-neutral-200 px-2 py-1">E-mail</th>
|
||||
<th className="border border-neutral-200 px-2 py-1">Phone Number</th>
|
||||
<th className="border border-neutral-200 px-2 py-1">Group Name</th>
|
||||
<th className="border border-neutral-200 px-2 py-1">Student ID</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
@@ -391,6 +391,15 @@ export default function UserList({
|
||||
) as any,
|
||||
cell: (info) => USER_TYPE_LABELS[info.getValue()],
|
||||
}),
|
||||
columnHelper.accessor("studentID", {
|
||||
header: (
|
||||
<button className="flex gap-2 items-center" onClick={() => setSorter((prev) => selectSorter(prev, "studentID"))}>
|
||||
<span>Student ID</span>
|
||||
<SorterArrow name="studentID" />
|
||||
</button>
|
||||
) as any,
|
||||
cell: (info) => info.getValue() || "N/A",
|
||||
}),
|
||||
columnHelper.accessor("corporateInformation.companyInformation.name", {
|
||||
header: (
|
||||
<button className="flex gap-2 items-center" onClick={() => setSorter((prev) => selectSorter(prev, "companyName"))}>
|
||||
@@ -465,6 +474,11 @@ export default function UserList({
|
||||
? userTypes.findIndex((t) => a.type === t) - userTypes.findIndex((t) => b.type === t)
|
||||
: userTypes.findIndex((t) => b.type === t) - userTypes.findIndex((t) => a.type === t);
|
||||
|
||||
if (sorter === "studentID" || sorter === reverseString("studentID"))
|
||||
return sorter === "studentID"
|
||||
? (a.type === "student" ? a.studentID || "N/A" : "N/A").localeCompare(b.type === "student" ? b.studentID || "N/A" : "N/A")
|
||||
: (b.type === "student" ? b.studentID || "N/A" : "N/A").localeCompare(a.type === "student" ? a.studentID || "N/A" : "N/A");
|
||||
|
||||
if (sorter === "verification" || sorter === reverseString("verification"))
|
||||
return sorter === "verification"
|
||||
? a.isVerified.toString().localeCompare(b.isVerified.toString())
|
||||
|
||||
Reference in New Issue
Block a user