-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f36f0f
commit 59830d9
Showing
16 changed files
with
210 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
create table university | ||
( | ||
university_id serial primary key, | ||
university_name varchar(50), | ||
university_address varchar(200), | ||
university_phone varchar(20), | ||
university_email varchar(64), | ||
university_website varchar(64), | ||
university_logo varchar(200), | ||
university_description varchar, | ||
university_created_date timestamptz default now() not null, | ||
university_created_by bigint not null references profiles (id), | ||
university_updated_date timestamptz default now(), | ||
university_updated_by bigint references profiles (id) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,98 @@ | ||
import React, {useEffect, useState} from 'react'; | ||
import {Profile} from "../../SupaBase/SupabseUni"; | ||
import {Text} from "@mantine/core"; | ||
import {ActionIcon, Anchor, Avatar, Badge, Group, ScrollArea, Table, Text, useMantineTheme} from "@mantine/core"; | ||
import {Edit, Eraser} from "tabler-icons-react"; | ||
import {org, org_member} from '../../SupaBase/Org'; | ||
import orgData from "./Org/OrgData"; | ||
|
||
interface UsersTableProps { | ||
data: { avatar: string; name: string; job: string; email: string; phone: string }[]; | ||
} | ||
|
||
const jobColors: Record<string, string> = { | ||
admin: 'blue', | ||
pending: 'cyan', | ||
member: 'pink', | ||
}; | ||
let isLoading = false; | ||
const Org = (props: any) => { | ||
const [orgsData, setOrgsData] = useState<Profile>(props.profile); | ||
const [joinedOrgs, setJoinedOrgs] = useState([]); | ||
|
||
const [orgsData] = useState<Profile>(props.profile); | ||
const [joinedOrgs, setJoinedOrgs] = useState<Map<number, string>>(); | ||
|
||
const handleFatchJoinedOrg = () => { | ||
orgsData._org.fetch_joined_org_list(orgsData.profile).then(data => { | ||
console.log(data); | ||
isLoading= false; | ||
orgsData._org.fetch_joined_org_list(orgsData.profile).then(() => { | ||
setJoinedOrgs(orgsData._org.orgId); | ||
}) | ||
} | ||
|
||
useEffect(() => { | ||
if (!isLoading) { | ||
isLoading=true; | ||
isLoading = true; | ||
handleFatchJoinedOrg(); | ||
} | ||
}, []); | ||
|
||
const theme = useMantineTheme(); | ||
let rows=[] as any ; | ||
joinedOrgs?.forEach((status,id) => {rows.push(<tr key={id}> | ||
<td> | ||
<Group spacing="sm"> | ||
<Avatar size={30} src={""} radius={30} /> | ||
<Text size="sm" weight={500}> | ||
{id} | ||
</Text> | ||
</Group> | ||
</td> | ||
|
||
<td> | ||
<Badge | ||
color={jobColors[status]} | ||
variant={theme.colorScheme === 'dark' ? 'light' : 'outline'} | ||
> | ||
{status} | ||
</Badge> | ||
</td> | ||
<td> | ||
<Anchor<'a'> size="sm" href="#" onClick={(event) => event.preventDefault()}> | ||
{orgsData._org.org.get(id)?.name} | ||
</Anchor> | ||
</td> | ||
<td> | ||
<Text size="sm" color="dimmed"> | ||
{orgsData._org.org.get(id)?.description} | ||
</Text> | ||
</td> | ||
<td> | ||
<Group spacing={0} position="right"> | ||
<ActionIcon> | ||
<Edit size={16} /> | ||
</ActionIcon> | ||
<ActionIcon color="red"> | ||
<Eraser size={16} /> | ||
</ActionIcon> | ||
</Group> | ||
</td> | ||
</tr>)}); | ||
|
||
|
||
return ( | ||
<div> | ||
<Text>{}</Text> | ||
</div> | ||
<> | ||
<Table sx={{minWidth: 800}} verticalSpacing="sm"> | ||
<thead> | ||
<tr> | ||
<th>Organization Name</th> | ||
<th>Title</th> | ||
<th>Name</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody>{rows}</tbody> | ||
</Table> | ||
</> | ||
|
||
|
||
); | ||
}; | ||
|
||
export default Org; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.