source: frontend/src/Components/AdminPanel/UnapprovedProfilesTable.js@ e6c2521

Last change on this file since e6c2521 was e6c2521, checked in by darsov2 <62809499+darsov2@…>, 6 months ago

images upload/download impl, other fixes

  • Property mode set to 100644
File size: 2.5 KB
Line 
1import useGet from "../Hooks/useGet";
2import {Container} from "react-bootstrap";
3import {FaCheckCircle} from "react-icons/fa";
4import React from "react";
5import useApprove from "../Hooks/useApprove";
6
7const UnapprovedProfilesTable = () => {
8
9 const { data, isLoading, setData, getData, setChanged } = useGet('/users/unapproved')
10 const { getData: approveProfile} = useApprove()
11
12 !isLoading && console.log(data)
13
14 const dateFormatter = (str) => {
15 const inputDate = new Date(str);
16
17 const options = {
18 year: '2-digit',
19 month: '2-digit',
20 day: '2-digit',
21 hour12: false,
22 };
23
24 return inputDate.toLocaleString('mk-MK', options);
25
26 }
27
28 return (
29 <>
30 <Container fluid >
31 <table className="table table-hover">
32 <thead>
33 <tr>
34 <th scope="col"></th>
35 <th scope="col">Име и презиме</th>
36 <th scope="col">Адреса</th>
37 <th scope="col">Email</th>
38 <th scope="col">Датум на раѓање</th>
39 <th scope="col">Контакт телефон</th>
40 <th>Одобри</th>
41 </tr>
42 </thead>
43 <tbody>
44 {!isLoading && data.map((f, i) => { return <tr key={f.userID}>
45 <th style={{verticalAlign: "middle"}} scope="row">{i + 1}</th>
46 <td style={{verticalAlign: "middle"}}>{f.name + ' ' + f.surname}</td>
47 <td style={{verticalAlign: "middle"}}>{f.address}</td>
48 <td style={{verticalAlign: "middle"}}>{f.email}</td>
49 <td style={{verticalAlign: "middle"}}>{dateFormatter(f.birthDate)}</td>
50 <td style={{verticalAlign: "middle"}}>{f.contact}</td>
51 <td style={{verticalAlign: "middle"}}><FaCheckCircle size={'2.2em'} color={'#159895'} onClick={() => {
52 approveProfile('/users/approve/' + f.userID).then(() => {
53 setChanged((prev) => {
54 return Math.random();
55 })
56 })
57 }}/></td>
58 </tr>})}
59 </tbody>
60 </table>
61 </Container>
62 </>
63 )
64}
65
66export default UnapprovedProfilesTable;
Note: See TracBrowser for help on using the repository browser.