Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@
| --------------------------------------- | ------------------------------------- |
| ![ClientDashboard](./readme/demo/Client/Client%20Dashboard.gif) | ![ClientReport](./readme/demo/Client/Client%20Report.gif) |

| Client Profile screen |
| --------------------------------------- |
| ![ClientProfile](./readme/demo/Client/Client_Profile.png) |

| Client Profile screen | Contact Us screen |
| --------------------------------------- | ------------------------------------- |
| ![ClientProfile](./readme/demo/Client/Client_Profile.png) | ![ContactUs](./readme/demo/Client/Contact%20Us.png) |

### Provider Screens

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

### Admin Screens

| Admin View All Providers screen | Admin View All Contact Messages screen |
| --------------------------------------- | ------------------------------------- |
| ![AdminViewProviders](./readme/demo/Admin/Admin_View_Providers.png) | ![AdminViewContactMessages](./readme/demo/Admin/Admin_View_Contact_Messages.png) |

<br><br>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
color: #fff;
padding: 20px;
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
}

.sidebar-header {
Expand Down Expand Up @@ -54,10 +57,11 @@
border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.main-content {
.admin-main-content {
flex: 1;
margin-left: 300px;
margin-left: 330px;
margin-top: 20px;
margin-right: 30px;
}

.admin-main-content-title {
Expand Down
32 changes: 32 additions & 0 deletions amp-client/src/Components/AdminComponents/Table/Table.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import "./styles.css";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faPenToSquare } from "@fortawesome/free-solid-svg-icons";

const Table = ({ headers, data }) => {
return (
<table className="admin-table">
<thead>
<tr>
{headers.map((header, idx) => (
<th key={idx}>{header}</th>
))}
</tr>
</thead>
<tbody>
{data.map((item, idx) => (
<tr key={idx}>
Comment on lines +16 to +17
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Avoid using array index as key in list rendering

Use a stable unique identifier (e.g., item.id or item.provider_id) instead of the array index to avoid rendering glitches when the list changes.

Suggested change
{data.map((item, idx) => (
<tr key={idx}>
{data.map(item => (
<tr key={item.id}>

Comment on lines +15 to +17
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: No empty state handling for tables with no data

Add a fallback row (e.g. 'No records found') when data is empty to prevent a blank table body and improve user feedback.

Suggested change
<tbody>
{data.map((item, idx) => (
<tr key={idx}>
<tbody>
{data.length === 0 ? (
<tr>
<td colSpan={headers.length} style={{ textAlign: 'center' }}>
No records found
</td>
</tr>
) : (
data.map((item, idx) => (
<tr key={idx}>

<td>{item.name}</td>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Table component hardcodes data fields and doesn't align with provided headers

This will break if headers don’t match these hardcoded fields (e.g., missing message). Refactor Table to accept column accessors or render functions so each page can map its own data shape.

<td>{item.email}</td>
<td>{item.phone_number}</td>
<td>{item.message}</td>
<td>
<FontAwesomeIcon icon={faPenToSquare} className="admin-edit-icon" />
</td>
</tr>
))}
</tbody>
</table>
);
};

export default Table;
30 changes: 30 additions & 0 deletions amp-client/src/Components/AdminComponents/Table/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Table.css */
.admin-table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
margin-bottom: 50px;
}

.admin-table thead tr {
background-color: #f9a43a;
color: #000000;
text-align: left;
}

.admin-table th,
.admin-table td {
padding: 12px 15px;
}

.admin-table tbody tr {
background-color: #fff9f3;
color: #000000;
border-bottom: 1px solid #ddd;
}

.admin-edit-icon {
cursor: pointer;
color: #000000;
font-size: 18px;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// src/Components/CommonComponents/CustomTable/CustomTable.jsx
import "./styles.css";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faPenToSquare } from "@fortawesome/free-solid-svg-icons";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
import "./styles.css";
import { useEffect, useState } from "react";
import Table from "../../../Components/AdminComponents/Table/Table";
import { fetchContactMessages } from "../Services/AdminContactMessagesService/AdminContactMessagesService";

const AdminContactMessages = () => {
const [messages, setMessages] = useState([]);

useEffect(() => {
const loadMessages = async () => {
const data = await fetchContactMessages();
setMessages(data);
};

loadMessages();
}, []);

const headers = ["Full Name", "Email", "Phone Number", "Message", "Actions"];

return (
<>
<div className="admin-contact-messages-container">
<div className="main-content">
<h1 className="admin-main-content-title section-titles">Contact Messages</h1>
</div>
<div className="admin-contact-messages-container">
<div className="admin-main-content">
<h1 className="admin-main-content-title section-titles">
Contact Messages
</h1>
<Table headers={headers} data={messages} />
</div>
</>
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
import "./styles.css";
import { useEffect, useState } from "react";
import Table from "../../../Components/AdminComponents/Table/Table";
import { fetchAllProviders } from "../Services/AdminViewProvidersService/AdminViewProvidersService";

const AdminViewProviders = () => {
const [providers, setProviders] = useState([]);

useEffect(() => {
const loadProviders = async () => {
const data = await fetchAllProviders();
setProviders(data);
};

loadProviders();
}, []);

const headers = [
"Provider ID",
"Full Name",
"Email",
"Phone Number",
"Actions",
];

return (
<>
<div className="admin-view-providers-container">
<div className="main-content">
<h1 className="admin-main-content-title section-titles">View Providers</h1>
</div>
<div className="admin-view-providers-container">
<div className="admin-main-content">
<h1 className="admin-main-content-title section-titles">
View Providers
</h1>
<Table headers={headers} data={providers} />
</div>
</>
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import axiosInstance from "../../../../Axios/axios";

export const fetchContactMessages = async () => {
try {
const response = await axiosInstance.get("admins/getAllContactMessages");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick (bug_risk): Inconsistent endpoint format between services

Use a consistent leading slash for your API paths to prevent URL resolution issues.

return response.data.data;
} catch (error) {
console.error("Failed to fetch contact messages:", error);
return [];
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import axiosInstance from "../../../../Axios/axios";

export const fetchAllProviders = async () => {
try {
const response = await axiosInstance.get("/admins/getAllProviders");
return response.data.data;
} catch (error) {
console.error("Error fetching providers:", error);
return [];
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme/demo/Admin/Admin_View_Providers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme/demo/Client/Contact Us.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading