Added a "Linked Corporate" column to the Groups list
This commit is contained in:
@@ -13,10 +13,25 @@ import Select from "react-select";
|
||||
import {toast} from "react-toastify";
|
||||
import readXlsxFile from "read-excel-file";
|
||||
import {useFilePicker} from "use-file-picker";
|
||||
import {getUserCorporate} from "@/utils/groups";
|
||||
|
||||
const columnHelper = createColumnHelper<Group>();
|
||||
const EMAIL_REGEX = new RegExp(/^[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*@[a-zA-Z0-9]+(?:\.[a-zA-Z0-9]+)*$/);
|
||||
|
||||
const LinkedCorporate = ({userId}: {userId: string}) => {
|
||||
const [companyName, setCompanyName] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setIsLoading(true);
|
||||
getUserCorporate(userId)
|
||||
.then((result) => setCompanyName(result?.corporateInformation?.companyInformation?.name || ""))
|
||||
.finally(() => setIsLoading(false));
|
||||
}, [userId]);
|
||||
|
||||
return isLoading ? <span className="animate-pulse">Loading...</span> : <>{companyName}</>;
|
||||
};
|
||||
|
||||
interface CreateDialogProps {
|
||||
user: User;
|
||||
users: User[];
|
||||
@@ -209,6 +224,10 @@ export default function GroupList({user}: {user: User}) {
|
||||
</div>
|
||||
),
|
||||
}),
|
||||
columnHelper.accessor("admin", {
|
||||
header: "Linked Corporate",
|
||||
cell: (info) => <LinkedCorporate userId={info.getValue()} />,
|
||||
}),
|
||||
columnHelper.accessor("participants", {
|
||||
header: "Participants",
|
||||
cell: (info) =>
|
||||
|
||||
Reference in New Issue
Block a user