Skip to content

Commit a3dd820

Browse files
authored
Merge pull request #174 from Riyad-Murad/admin_pages_dev
admin_pages_dev: Added Admin Screens for ReadMe file
2 parents 17f3b25 + 8f95eb7 commit a3dd820

File tree

12 files changed

+150
-19
lines changed

12 files changed

+150
-19
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@
6262
| --------------------------------------- | ------------------------------------- |
6363
| ![ClientDashboard](./readme/demo/Client/Client%20Dashboard.gif) | ![ClientReport](./readme/demo/Client/Client%20Report.gif) |
6464

65-
| Client Profile screen |
66-
| --------------------------------------- |
67-
| ![ClientProfile](./readme/demo/Client/Client_Profile.png) |
68-
65+
| Client Profile screen | Contact Us screen |
66+
| --------------------------------------- | ------------------------------------- |
67+
| ![ClientProfile](./readme/demo/Client/Client_Profile.png) | ![ContactUs](./readme/demo/Client/Contact%20Us.png) |
6968

7069
### Provider Screens
7170

@@ -77,6 +76,11 @@
7776
| --------------------------------------- | ------------------------------------- |
7877
| ![ProviderUsers](./readme/demo/Provider/Provider_Users.png) | ![ProviderProfile](./readme/demo/Provider/Provider_Profile.png) |
7978

79+
### Admin Screens
80+
81+
| Admin View All Providers screen | Admin View All Contact Messages screen |
82+
| --------------------------------------- | ------------------------------------- |
83+
| ![AdminViewProviders](./readme/demo/Admin/Admin_View_Providers.png) | ![AdminViewContactMessages](./readme/demo/Admin/Admin_View_Contact_Messages.png) |
8084

8185
<br><br>
8286

amp-client/src/Components/AdminComponents/AdminSidebar/styles.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
color: #fff;
99
padding: 20px;
1010
box-sizing: border-box;
11+
position: fixed;
12+
top: 0;
13+
left: 0;
1114
}
1215

1316
.sidebar-header {
@@ -54,10 +57,11 @@
5457
border-top: 1px solid rgba(255, 255, 255, 0.2);
5558
}
5659

57-
.main-content {
60+
.admin-main-content {
5861
flex: 1;
59-
margin-left: 300px;
62+
margin-left: 330px;
6063
margin-top: 20px;
64+
margin-right: 30px;
6165
}
6266

6367
.admin-main-content-title {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import "./styles.css";
2+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
3+
import { faPenToSquare } from "@fortawesome/free-solid-svg-icons";
4+
5+
const Table = ({ headers, data }) => {
6+
return (
7+
<table className="admin-table">
8+
<thead>
9+
<tr>
10+
{headers.map((header, idx) => (
11+
<th key={idx}>{header}</th>
12+
))}
13+
</tr>
14+
</thead>
15+
<tbody>
16+
{data.map((item, idx) => (
17+
<tr key={idx}>
18+
<td>{item.name}</td>
19+
<td>{item.email}</td>
20+
<td>{item.phone_number}</td>
21+
<td>{item.message}</td>
22+
<td>
23+
<FontAwesomeIcon icon={faPenToSquare} className="admin-edit-icon" />
24+
</td>
25+
</tr>
26+
))}
27+
</tbody>
28+
</table>
29+
);
30+
};
31+
32+
export default Table;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Table.css */
2+
.admin-table {
3+
width: 100%;
4+
border-collapse: collapse;
5+
margin-top: 20px;
6+
margin-bottom: 50px;
7+
}
8+
9+
.admin-table thead tr {
10+
background-color: #f9a43a;
11+
color: #000000;
12+
text-align: left;
13+
}
14+
15+
.admin-table th,
16+
.admin-table td {
17+
padding: 12px 15px;
18+
}
19+
20+
.admin-table tbody tr {
21+
background-color: #fff9f3;
22+
color: #000000;
23+
border-bottom: 1px solid #ddd;
24+
}
25+
26+
.admin-edit-icon {
27+
cursor: pointer;
28+
color: #000000;
29+
font-size: 18px;
30+
}

amp-client/src/Components/CommonComponents/CustomTable/CustomTable.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// src/Components/CommonComponents/CustomTable/CustomTable.jsx
21
import "./styles.css";
32
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
43
import { faPenToSquare } from "@fortawesome/free-solid-svg-icons";

amp-client/src/Pages/AdminPages/AdminContactMessages/AdminContactMessages.jsx

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11
import "./styles.css";
2+
import { useEffect, useState } from "react";
3+
import Table from "../../../Components/AdminComponents/Table/Table";
4+
import { fetchContactMessages } from "../Services/AdminContactMessagesService/AdminContactMessagesService";
25

36
const AdminContactMessages = () => {
7+
const [messages, setMessages] = useState([]);
8+
9+
useEffect(() => {
10+
const loadMessages = async () => {
11+
const data = await fetchContactMessages();
12+
setMessages(data);
13+
};
14+
15+
loadMessages();
16+
}, []);
17+
18+
const headers = ["Full Name", "Email", "Phone Number", "Message", "Actions"];
19+
420
return (
5-
<>
6-
<div className="admin-contact-messages-container">
7-
<div className="main-content">
8-
<h1 className="admin-main-content-title section-titles">Contact Messages</h1>
9-
</div>
21+
<div className="admin-contact-messages-container">
22+
<div className="admin-main-content">
23+
<h1 className="admin-main-content-title section-titles">
24+
Contact Messages
25+
</h1>
26+
<Table headers={headers} data={messages} />
1027
</div>
11-
</>
28+
</div>
1229
);
1330
};
1431

amp-client/src/Pages/AdminPages/AdminViewProviders/AdminViewProviders.jsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,37 @@
11
import "./styles.css";
2+
import { useEffect, useState } from "react";
3+
import Table from "../../../Components/AdminComponents/Table/Table";
4+
import { fetchAllProviders } from "../Services/AdminViewProvidersService/AdminViewProvidersService";
25

36
const AdminViewProviders = () => {
7+
const [providers, setProviders] = useState([]);
8+
9+
useEffect(() => {
10+
const loadProviders = async () => {
11+
const data = await fetchAllProviders();
12+
setProviders(data);
13+
};
14+
15+
loadProviders();
16+
}, []);
17+
18+
const headers = [
19+
"Provider ID",
20+
"Full Name",
21+
"Email",
22+
"Phone Number",
23+
"Actions",
24+
];
25+
426
return (
5-
<>
6-
<div className="admin-view-providers-container">
7-
<div className="main-content">
8-
<h1 className="admin-main-content-title section-titles">View Providers</h1>
9-
</div>
27+
<div className="admin-view-providers-container">
28+
<div className="admin-main-content">
29+
<h1 className="admin-main-content-title section-titles">
30+
View Providers
31+
</h1>
32+
<Table headers={headers} data={providers} />
1033
</div>
11-
</>
34+
</div>
1235
);
1336
};
1437

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import axiosInstance from "../../../../Axios/axios";
2+
3+
export const fetchContactMessages = async () => {
4+
try {
5+
const response = await axiosInstance.get("admins/getAllContactMessages");
6+
return response.data.data;
7+
} catch (error) {
8+
console.error("Failed to fetch contact messages:", error);
9+
return [];
10+
}
11+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import axiosInstance from "../../../../Axios/axios";
2+
3+
export const fetchAllProviders = async () => {
4+
try {
5+
const response = await axiosInstance.get("/admins/getAllProviders");
6+
return response.data.data;
7+
} catch (error) {
8+
console.error("Error fetching providers:", error);
9+
return [];
10+
}
11+
};
242 KB
Loading

0 commit comments

Comments
 (0)