diff --git a/db.json b/db.json index 0cf1d8e..5d86213 100644 --- a/db.json +++ b/db.json @@ -102,6 +102,16 @@ "email": "dikshant001@gmail.com", "address": "Bavdhan, Pune", "mobile": "45654665645" + }, + { + "id": "377d", + "firstname": "tejas", + "lastname": "chari", + "age": "28", + "gender": "male", + "email": "tejas001@gmail.com", + "address": " Baner, Pune", + "mobile": "8675493099" } ] } \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx index 278cb79..961459c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -8,10 +8,9 @@ import CustomerList from './components/customer/CustomerList'; import AddCustomer from './components/customer/AddCustomer'; import Sidebar from './components/sidebar/Sidebar'; import CustomerMeasurements from './components/customer/CustomerMeasurements'; - - - import { AuthProvider, AuthContext } from './contexts/AuthContext'; +import EmployeeList from './components/admin/EmployeeList'; +import AddEmployee from './components/admin/AddEmployee'; const { Content } = Layout; @@ -25,13 +24,15 @@ const App = () => { } /> - } /> {/* Add HomePage route */} + } /> {/* Add HomePage route */} } /> } /> } /> } /> } /> } /> + } /> + } /> diff --git a/src/components/Auth/LoginPage.css b/src/components/Auth/LoginPage.css index 962ce0c..178644e 100644 --- a/src/components/Auth/LoginPage.css +++ b/src/components/Auth/LoginPage.css @@ -21,7 +21,7 @@ body, html { /* background-color: #222; */ border-radius: 8px; padding: 40px; - box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); + box-shadow: 0 0 10px #d1d5db; width: 310.4px; display: flex; flex-direction: column; diff --git a/src/components/admin/AddEmployee.jsx b/src/components/admin/AddEmployee.jsx new file mode 100644 index 0000000..12ad1c9 --- /dev/null +++ b/src/components/admin/AddEmployee.jsx @@ -0,0 +1,147 @@ +import React, { useState } from 'react'; +import { Link, useNavigate } from 'react-router-dom'; +import Sidebar from '../sidebar/Sidebar'; +import axiosInstance from '../../api/axiosConfig'; + +const AddEmployee = () => { + const navigate = useNavigate(); + const [employeeData, setEmployeeData] = useState({ + firstname: '', + lastname: '', + age: '', + gender: '', + email: '', + address: '', + mobile: '', + }); + + const handleInputChange = (e) => { + const { name, value } = e.target; + setEmployeeData({ + ...employeeData, + [name]: value, + }); + }; + + const handleAddEmployeeSubmit = async (e) => { + e.preventDefault(); + try { + await axiosInstance.post('/employees', employeeData); + navigate('/employees'); + } catch (error) { + console.error('Error adding employee:', error.response || error.message); + } + }; + + return ( +
+ +
+
+
+

Creating Employee Account

+ Skip for now +
+
+
+
+
+
+ +
+
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+
+
+
+ ); +}; + +export default AddEmployee; diff --git a/src/components/admin/AdminDashboard.jsx b/src/components/admin/AdminDashboard.jsx index 9f42004..f1a7360 100644 --- a/src/components/admin/AdminDashboard.jsx +++ b/src/components/admin/AdminDashboard.jsx @@ -26,22 +26,22 @@ const AdminDashboard = () => {
Dashboard Graphic
diff --git a/src/components/admin/Dashboard.css b/src/components/admin/Dashboard.css index 66aa392..3be2642 100644 --- a/src/components/admin/Dashboard.css +++ b/src/components/admin/Dashboard.css @@ -50,6 +50,7 @@ flex-direction: column; gap: 20px; align-items: center; + background-color: #0e355b; } .dashboard-button { @@ -64,7 +65,7 @@ color: #0e355b; } -.dashboard-button:hover { +.button:hover { background-color: #154676; border-color: #154676; } diff --git a/src/components/admin/EmployeeList.jsx b/src/components/admin/EmployeeList.jsx new file mode 100644 index 0000000..a909bfc --- /dev/null +++ b/src/components/admin/EmployeeList.jsx @@ -0,0 +1,104 @@ +import React, { useState, useEffect, useCallback } from 'react'; +import { useNavigate } from 'react-router-dom'; +import Sidebar from '../sidebar/Sidebar'; +import axiosInstance from '../../api/axiosConfig'; +// import EmployeeCards from './EmployeeCards'; +// import PropTypes from 'prop-types'; + +const EmployeeList = ({ className = '' }) => { + const [employees, setEmployees] = useState([]); + const navigate = useNavigate(); + + useEffect(() => { + // Fetch the employees data from the JSON file + getEmployees(); + }, []); + + const getEmployees = async () => { + try { + const response = await axiosInstance.get('http://localhost:5000/employees'); + let employees_data = response.data; // List of employees + setEmployees(employees_data); + } catch (error) { + throw error; + } + }; + + const handleAddEmployee = () => { + navigate('/add-employee'); + }; + +// const onEmployeeCardsClick = useCallback(() => { +// navigate('/employee-profile'); +// }, [navigate]); + + return ( +
+ +
+
+
+

Employees List

+ +
+
+ + + + Filter +
+

Total Employees ({employees.length})

+ + + + + + + + + + + {employees.map((employee, index) => ( + + + + + + + ))} + +
#Employee NameEmail AddressDetails
{index + 1}{employee.firstname} {employee.lastname}{employee.email} + +
+
+
+
+ ); +}; + +// EmployeeList.propTypes = { +// className: PropTypes.string, +// }; + +export default EmployeeList; diff --git a/src/components/customer/AddCustomer.jsx b/src/components/customer/AddCustomer.jsx index cadaa77..e1b2129 100644 --- a/src/components/customer/AddCustomer.jsx +++ b/src/components/customer/AddCustomer.jsx @@ -8,7 +8,8 @@ import { useNavigate } from 'react-router-dom'; const AddCustomer = () => { const navigate = useNavigate(); const [customerData, setCustomerData] = useState({ - name: '', + firstname: '', + lastname:'', age: '', gender: '', email: '', @@ -40,42 +41,52 @@ const AddCustomer = () => {
-

Add Customer

- Skip for now +

add customer

+ skip for now
-
-

Customer Information

+

customer information

-

Measurements

+

measurements

- +
- + + +
+
+ { />
- +
- + { />
- + { />
- + {

-
diff --git a/src/components/customer/CustomerList.css b/src/components/customer/CustomerList.css index 2f4b301..db2bfd2 100644 --- a/src/components/customer/CustomerList.css +++ b/src/components/customer/CustomerList.css @@ -1,7 +1,7 @@ .customer-list { padding: 20px; - background-color: #09090B; - color: #09090B; + background-color: #ffffff; + /* color: #09090B; */ border-radius: 8px; max-width: 800px; margin: 0 auto; @@ -21,7 +21,7 @@ .add-customer-button { padding: 10px 20px; background-color: #0e355b; - color: #09090B; + /* color: #09090B; */ border: none; cursor: pointer; border-radius: 5px; @@ -40,22 +40,22 @@ .customer-table th, .customer-table td { - border: 1px solid #09090B; + border: 1px solid #ffffff; padding: 10px; text-align: left; } - .customer-table th { + .customer-table th { background-color: #09090B; - } + } - .customer-table tbody tr:nth-child(odd) { + .customer-table tbody tr:nth-child(odd) { background-color: #09090B; - } + } - .customer-table tbody tr:nth-child(even) { + .customer-table tbody tr:nth-child(even) { background-color: #09090B; - } + } .customer-table tbody tr:hover { background-color: #0e355b; @@ -80,7 +80,7 @@ background-color: transparent; border: none; border-bottom: 1px solid #b3b3b3; - color: #b3b3b3; + color: #e8e8e8; width: 100%; padding: 0.5rem 0; margin-bottom: 20px; @@ -89,6 +89,6 @@ } .input-underline:focus { - border-bottom-color: #F97316; /* Orange underline on focus */ + border-bottom-color: #4b5563; /* Orange underline on focus */ } \ No newline at end of file diff --git a/src/components/customer/CustomerList.jsx b/src/components/customer/CustomerList.jsx index bfb79bf..7d12b5e 100644 --- a/src/components/customer/CustomerList.jsx +++ b/src/components/customer/CustomerList.jsx @@ -1,26 +1,26 @@ import React, { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import Sidebar from '../sidebar/Sidebar'; -import axiosInstance from '../../api/axiosConfig'; +import axiosInstance from '../../api/axiosConfig'; + const CustomerList = () => { const [customers, setCustomers] = useState([]); const navigate = useNavigate(); useEffect(() => { // Fetch the customers data from the JSON file - getCustomers() + getCustomers(); }, []); const getCustomers = async () => { try { const response = await axiosInstance.get('http://localhost:5000/customers'); let customers_data = response.data; // List of customers - setCustomers(customers_data) + setCustomers(customers_data); } catch (error) { throw error; } }; - const handleAddCustomer = () => { navigate('/add-customer'); @@ -29,38 +29,50 @@ const CustomerList = () => { return (
-
-
-
-

Customers List

+
+
+
+

Customers List

- - + + - Filter + Filter
-

Total Customers ({customers.length})

- +

Total Customers ({customers.length})

+
- + - - + + {customers.map((customer, index) => ( - - - - + + + + + ))} diff --git a/src/components/customer/CustomerMeasurements.jsx b/src/components/customer/CustomerMeasurements.jsx index a7e05a2..c5e26fe 100644 --- a/src/components/customer/CustomerMeasurements.jsx +++ b/src/components/customer/CustomerMeasurements.jsx @@ -25,50 +25,50 @@ const CustomerMeasurements = () => {
-
+

Customer Measurements

- skip for now + skip for now
-

Upper Body Measurements

- Neck Circumference (in inch)}> - +

Upper Body Measurements

+ Neck Circumference (in inch)}> + - Chest Circumference (in inch)}> - + Chest Circumference (in inch)}> + - Waist Circumference (in inch)}> - + Waist Circumference (in inch)}> + - Shoulder Width (in inch)}> - + Shoulder Width (in inch)}> + - Arm Length (in inch)}> - + Arm Length (in inch)}> + - Sleeve Length (in inch)}> - + Sleeve Length (in inch)}> + -

Lower Body Measurements

- Hip Circumference (in inch)}> - +

Lower Body Measurements

+ Hip Circumference (in inch)}> + - Inseam (in inch)}> - + Inseam (in inch)}> + - Out Seam (in inch)}> - + Out Seam (in inch)}> + - Thigh Circumference (in inch)}> - + Thigh Circumference (in inch)}> + - Ankle Circumference (in inch)}> - + Ankle Circumference (in inch)}> + - diff --git a/src/components/employee/EmployeeDashboard.jsx b/src/components/employee/EmployeeDashboard.jsx index e145aca..1d2d3b7 100644 --- a/src/components/employee/EmployeeDashboard.jsx +++ b/src/components/employee/EmployeeDashboard.jsx @@ -22,19 +22,19 @@ const HomePage = () => {
Suit
#Customer IDCustomer Namecustomer idcustomer fullname
{index + 1}{customer.id}{customer.name}
{index + 1}{customer.id}{customer.firstname} {customer.lastname}