[e6c2521] | 1 | import useGet from "../Hooks/useGet";
|
---|
| 2 | import {Container} from "react-bootstrap";
|
---|
| 3 | import {FaCheckCircle} from "react-icons/fa";
|
---|
| 4 | import React from "react";
|
---|
| 5 | import useApprove from "../Hooks/useApprove";
|
---|
| 6 |
|
---|
| 7 | const UnapprovedBusinessesTable = () => {
|
---|
| 8 |
|
---|
| 9 | const { data, isLoading, setData, getData, setChanged } = useGet('/business/unapproved');
|
---|
| 10 | const { getData: approveBusiness} = useApprove();
|
---|
| 11 |
|
---|
| 12 | return (
|
---|
| 13 | <>
|
---|
| 14 | <Container fluid >
|
---|
| 15 | <table className="table table-hover">
|
---|
| 16 | <thead>
|
---|
| 17 | <tr>
|
---|
| 18 | <th scope="col">Ред. бр.</th>
|
---|
| 19 | <th scope="col">Име на фирма</th>
|
---|
| 20 | <th scope="col">Адреса</th>
|
---|
| 21 | <th scope="col">Даночен број</th>
|
---|
| 22 | <th scope="col">Одговорно лице</th>
|
---|
| 23 | <th>Одобри</th>
|
---|
| 24 | </tr>
|
---|
| 25 | </thead>
|
---|
| 26 | <tbody>
|
---|
| 27 | {!isLoading && data.map((f, i) => { return <tr key={f.businessId}>
|
---|
| 28 | <th style={{verticalAlign: "middle"}} scope="row">{i + 1}</th>
|
---|
| 29 | <td style={{verticalAlign: "middle"}}>{f.name}</td>
|
---|
| 30 | <td style={{verticalAlign: "middle"}}>{f.address}</td>
|
---|
| 31 | <td style={{verticalAlign: "middle"}}>{f.edbs}</td>
|
---|
| 32 | <td style={{verticalAlign: "middle"}}>{f.user.name + " " + f.user.surname}</td>
|
---|
| 33 | <td style={{verticalAlign: "middle"}}><FaCheckCircle size={'2.2em'} color={'#159895'} onClick={() => {
|
---|
| 34 | approveBusiness('/business/approve/' + f.businessId).then(() => {
|
---|
| 35 | setChanged((prev) => {
|
---|
| 36 | return Math.random();
|
---|
| 37 | })
|
---|
| 38 | })
|
---|
| 39 | }}/></td>
|
---|
| 40 | </tr>})}
|
---|
| 41 | </tbody>
|
---|
| 42 | </table>
|
---|
| 43 | </Container>
|
---|
| 44 | </>
|
---|
| 45 | )
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | export default UnapprovedBusinessesTable; |
---|