diff --git a/src/components/Auth/LoginPage.jsx b/src/components/Auth/LoginPage.jsx
index 55737b2..d91fdea 100644
--- a/src/components/Auth/LoginPage.jsx
+++ b/src/components/Auth/LoginPage.jsx
@@ -44,8 +44,8 @@ const LoginPage = () => {
-
Welcome Back
-
Be among the first to experience 3D magic! Register for private alpha.
+
welcome back
+
be among the first to experience 3D magic! register for private alpha.
{error &&
{error}
}
diff --git a/src/components/admin/AddEmployee.css b/src/components/admin/AddEmployee.css
new file mode 100644
index 0000000..979e0f1
--- /dev/null
+++ b/src/components/admin/AddEmployee.css
@@ -0,0 +1,18 @@
+.employee-image-container {
+ position: relative;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .employee-image-container button {
+ position: absolute;
+ bottom: -10px;
+ left: 50%;
+ transform: translateX(-50%);
+ }
+
+ .input-underline:focus {
+ border-color: #4b5563; /* Adjust focus border color */
+ }
+
\ No newline at end of file
diff --git a/src/components/admin/AddEmployee.jsx b/src/components/admin/AddEmployee.jsx
index 4ecfba4..ad8dedb 100644
--- a/src/components/admin/AddEmployee.jsx
+++ b/src/components/admin/AddEmployee.jsx
@@ -1,6 +1,8 @@
import React, { useState, useEffect } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import Sidebar from '../sidebar/Sidebar';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { faChevronLeft } from '@fortawesome/free-solid-svg-icons';
import axiosInstance from '../../api/axiosConfig';
const AddEmployee = () => {
@@ -17,25 +19,28 @@ const AddEmployee = () => {
pincode: '',
city_id: '',
mobile: '',
+ image: null,
});
const [cities, setCities] = useState([]);
+ const [imagePreview, setImagePreview] = useState(null);
- useEffect(() => {
- const fetchCities = async () => {
- try {
- const response = await axiosInstance.get('/cities');
- if (Array.isArray(response.data)) {
- setCities(response.data);
- } else {
- console.error('Error: Data is not an array', response.data);
- }
- } catch (error) {
- console.error('Error fetching cities:', error.response || error.message);
- }
- };
+ // Uncomment to fetch cities data from backend
+ // useEffect(() => {
+ // const fetchCities = async () => {
+ // try {
+ // const response = await axiosInstance.get('/cities');
+ // if (Array.isArray(response.data)) {
+ // setCities(response.data);
+ // } else {
+ // console.error('Error: Data is not an array', response.data);
+ // }
+ // } catch (error) {
+ // console.error('Error fetching cities:', error.response || error.message);
+ // }
+ // };
- fetchCities();
- }, []);
+ // fetchCities();
+ // }, []);
const handleInputChange = (e) => {
const { name, value } = e.target;
@@ -45,10 +50,30 @@ const AddEmployee = () => {
});
};
+ const handleImageChange = (e) => {
+ const file = e.target.files[0];
+ if (file) {
+ setEmployeeData({
+ ...employeeData,
+ image: file,
+ });
+ setImagePreview(URL.createObjectURL(file));
+ }
+ };
+
const handleAddEmployeeSubmit = async (e) => {
e.preventDefault();
+ const formData = new FormData();
+ Object.keys(employeeData).forEach((key) => {
+ formData.append(key, employeeData[key]);
+ });
+
try {
- await axiosInstance.post('http://localhost:5000/employees', employeeData);
+ await axiosInstance.post('http://localhost:5000/employees', formData, {
+ headers: {
+ 'Content-Type': 'multipart/form-data',
+ },
+ });
navigate('/employees');
} catch (error) {
console.error('Error adding employee:', error.response || error.message);
@@ -60,144 +85,202 @@ const AddEmployee = () => {
-
-
creating employee account
-
skip for now
+
+
+
+
+
+ create employee account
+
-
-
+
+
-
-
-
-