From ad77e5be0f246179793c291dd24321a37fcee3f7 Mon Sep 17 00:00:00 2001 From: Anas Saleem Date: Sun, 7 Jan 2024 22:39:22 +0500 Subject: [PATCH] Fiverr-Client:Manueltaveras #1.2 --- .gitignore | 2 +- controllers/attendance.js | 18 +- frontend/.firebase/hosting.YnVpbGQ.cache | 20 +- frontend/src/App.js | 18 +- frontend/src/components/AddEmployee.js | 237 +++++++++++++++-------- frontend/src/components/Attendance.js | 18 +- frontend/src/components/Navbar.jsx | 5 +- frontend/src/components/Supervisor.js | 22 ++- frontend/src/components/TaskCard.jsx | 2 +- model/employee.js | 1 - routes/attendance.js | 3 +- 11 files changed, 211 insertions(+), 135 deletions(-) diff --git a/.gitignore b/.gitignore index 128861c7eb..bacf63479d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ # Node artifact files node_modules/ -frontend/node_modules/ +frontend/ diff --git a/controllers/attendance.js b/controllers/attendance.js index a6eaf6b25e..a422ddb861 100644 --- a/controllers/attendance.js +++ b/controllers/attendance.js @@ -23,6 +23,22 @@ const markAttendance = async (req, res) => { } } +const deleteAttendance = async (req, res) => { + try { + const { id } = req.body + const response = await attendanceModel.findOneAndDelete({ employeeID: id }) + const update = await employeeModel.findByIdAndUpdate(id , { columnId: 'justComeIn' }) + + if (response && update) { + res.status(200).send("Removed Successfully") + } + } catch (error) { + console.log(error) + res.status(400).send(error) + } +} + module.exports = { - markAttendance + markAttendance, + deleteAttendance } \ No newline at end of file diff --git a/frontend/.firebase/hosting.YnVpbGQ.cache b/frontend/.firebase/hosting.YnVpbGQ.cache index 8a942d989e..fdd82f5986 100644 --- a/frontend/.firebase/hosting.YnVpbGQ.cache +++ b/frontend/.firebase/hosting.YnVpbGQ.cache @@ -1,14 +1,14 @@ -asset-manifest.json,1704346213494,683dda928baf100aa526aa94b41ed91a9a2279c5cd5df10d1d72839fa68e9a11 +asset-manifest.json,1704532836837,6029a135b59635b8f2d77b8c1d05bec3416e2deb7d33245efdd0a4220abf58e5 favicon.ico,1703916380428,27edce7be5922cf0bef7d4136f69b5bfbdd5bf8c13c7b026f71187d41a00aa7d -index.html,1704346213494,0a7af72373355552aec7537a38ebca3941681255f6ab51200dddadaeb2245a62 +index.html,1704532836837,5b3698b6466e82f127687b4cb291bb8b4f8ed69de3d1e7a2e9e7148b30ee0899 logo192.png,1703916385621,79e2b749561016bc8af300ea19f48347ceed3cb1a54f48ae456172eca45e08f0 +logo512.png,1703916385770,212b102aa09e51b3b3e06647e81f7801a61333e171f6582e8124379aabccb41d manifest.json,1703916384269,ee04fb47e525c67d8424ffe9b4d8a8a24e434504478afca4e0ca602146836d4c robots.txt,1703916387913,bfe106a3fb878dc83461c86818bf74fc1bdc7f28538ba613cd3e775516ce8b49 -logo512.png,1703916385770,212b102aa09e51b3b3e06647e81f7801a61333e171f6582e8124379aabccb41d -static/css/main.df6fdbff.css,1704346213498,5cdf51ab3b1b6834629dd176b078b004cd07590b3e139d6f86bb8654bcfed145 -static/js/787.7f5a1603.chunk.js,1704346213498,d1c56c4ccee8cd01f41593669db64c2db2210dda0addaa9cce2349252ad51e57 -static/css/main.df6fdbff.css.map,1704346213498,49ab3be7a7d9886fcb4b4bfeb7d559b9d37c3d582347bf867f43081bd6bd0328 -static/js/main.3d825961.js.LICENSE.txt,1704346213498,1816694f55f8c926962178d808fa817fab63f3a889e740ddb54d628e529c6df5 -static/js/787.7f5a1603.chunk.js.map,1704346213498,a1da92fe96f176f27e3a7602c0c9ff985ae8b29b3405b8b7c6b66158ebda95b6 -static/js/main.3d825961.js,1704346213498,2a9497b1d92e8555988e3d772d333d07fb9f4248463f9edee8d2591a2cafce38 -static/js/main.3d825961.js.map,1704346213498,e2144b6645cee11c4399a0695b3be952bd2bbc69a2a2213247985e958ffe1d86 +static/css/main.4d33680a.css,1704532836843,e9909d931830d4d31e2770ab6384b69642c7e1139fa652175356527e67c4a74c +static/js/787.7f5a1603.chunk.js,1704532836842,d1c56c4ccee8cd01f41593669db64c2db2210dda0addaa9cce2349252ad51e57 +static/css/main.4d33680a.css.map,1704532836842,3e12246c44fa04432ea3d0672d14cbcdc811bb2bd463a0b85962d95327f97f98 +static/js/main.5269ce4a.js.LICENSE.txt,1704532836842,1816694f55f8c926962178d808fa817fab63f3a889e740ddb54d628e529c6df5 +static/js/787.7f5a1603.chunk.js.map,1704532836843,a1da92fe96f176f27e3a7602c0c9ff985ae8b29b3405b8b7c6b66158ebda95b6 +static/js/main.5269ce4a.js,1704532836843,41b44abd0187d449a1d2f7752010faf390c497bc0c819e28083d6115b8cd0fe6 +static/js/main.5269ce4a.js.map,1704532836843,74f2acf1d4c789dd9644fef0d6b290edede69d71903c479d2cbf041524fe8517 diff --git a/frontend/src/App.js b/frontend/src/App.js index 4a93808090..f3258d7804 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -1,28 +1,16 @@ -import { useEffect, useState } from 'react'; import { Attendance, Supervisor, AddEmployee, Navbar } from './components' -import './App.css' +// import './App.css' import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; function App() { - const [employeeDetails, setEmployeeDetails] = useState([]) - - const handleEmployeeAttendance = (data) => { - - setEmployeeDetails( - [ // with a new array - ...employeeDetails, // that contains all the old items - data // and one new item at the end - ] - ) - } return ( - } /> - } /> + } /> + } /> } /> diff --git a/frontend/src/components/AddEmployee.js b/frontend/src/components/AddEmployee.js index c56f314cf7..f50edc6d63 100644 --- a/frontend/src/components/AddEmployee.js +++ b/frontend/src/components/AddEmployee.js @@ -37,8 +37,8 @@ const AddEmployee = () => { } const addEmployee = async () => { - const response = await axios.post(SaveEmployeesURL, employeeDetails) - console.log(response.data) + await axios.post(SaveEmployeesURL, employeeDetails) + // console.log(response.data) setEmployeeDetails(INITIAL_VALUES) const updatedEmployeeDetails = [ ...allEmployees, @@ -48,9 +48,82 @@ const AddEmployee = () => { } return ( -
+
+
+
+
+
+
+
+

Register Employee

+
+
+
+
+ +
+
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ {/*
+
+ + +
+
*/} +
-
+
+
+
+ +
+
+
+
+ +
+
+ {/*
- + */} {/*
@@ -149,86 +222,88 @@ const AddEmployee = () => {
*/} - -
- {/*
Employees List
*/} - - - - - - - - - - - - - - - - - {allEmployees.map(employee => { - const { employeeID, skills, dayOff, hours, employeeStatus, firstName, lastName, cardNumber, department, isHere, } = employee - return ( - - + {allEmployees.map(employee => { + const { employeeID, skills, dayOff, hours, employeeStatus, firstName, lastName, cardNumber, department, isHere, } = employee + return ( + + + + + + + + + + + + + ) + })} + +
- employee ID - - first Name - - last Name - - skills - - dayOff - - hours - - employee Status - - card Number - - department - - is Here -
- {employeeID} +
+
+
+ {/*
Employees List
*/} + + + + + + + - - - - - - + + + + + - - - - ) - })} - -
+ employee ID + + first Name + + last Name + + skills - {firstName} - - {lastName} - - {skills} - - {dayOff} - - {hours} - - {employeeStatus} + + dayOff + + hours + + employee Status + + card Number + + department + + is Here - {cardNumber} - - {department} - - {isHere} -
+ +
+ {employeeID} + + {firstName} + + {lastName} + + {skills} + + {dayOff} + + {hours} + + {employeeStatus} + + {cardNumber} + + {department} + + {isHere} +
+
+
-
) } diff --git a/frontend/src/components/Attendance.js b/frontend/src/components/Attendance.js index a18f25bbab..e3c78a777e 100644 --- a/frontend/src/components/Attendance.js +++ b/frontend/src/components/Attendance.js @@ -2,7 +2,7 @@ import React, { useState } from 'react' import axios from 'axios' import Details from './Details' -const Attendance = ({ handleEmployeeAttendance }) => { +const Attendance = () => { const [id, setId] = useState(0) const [employeeDetails, setEmployeeDetails] = useState({}) @@ -14,22 +14,14 @@ const Attendance = ({ handleEmployeeAttendance }) => { const response = await axios.post(API_URL, { employeeID: id, }) - + const data = response.data - const updatedData = { - ...data, - columnId: "justComeIn", - id: data._id, - content: data.skills, - } - console.log(updatedData) - handleEmployeeAttendance(updatedData) setEmployeeDetails(data) } return ( -
+
Employee Attendance
@@ -56,9 +48,9 @@ const Attendance = ({ handleEmployeeAttendance }) => {
-
+
- {employeeDetails ?
:
No Data Found
} + {employeeDetails ?
:
No Data Found
}
diff --git a/frontend/src/components/Navbar.jsx b/frontend/src/components/Navbar.jsx index eede16a5da..7d5aed07d1 100644 --- a/frontend/src/components/Navbar.jsx +++ b/frontend/src/components/Navbar.jsx @@ -6,7 +6,7 @@ const Navbar = () => {