Skip to content

Commit 8fc9a3a

Browse files
BackendExpertJehanKandyAnupa1998
committed
Update Employee.jsx
Co-Authored-By: JehanKandy <[email protected]> Co-Authored-By: Anupa Gamage <[email protected]>
1 parent 94d9ece commit 8fc9a3a

File tree

1 file changed

+39
-37
lines changed

1 file changed

+39
-37
lines changed

client/src/components/Employees/Employee.jsx

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -54,46 +54,48 @@ const Employee = () => {
5454
<tbody>
5555
{
5656
UserData.map((deptUser, index) => {
57-
return (
58-
<tr key={index}>
59-
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
60-
{deptUser.email}
61-
</td>
62-
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
63-
{deptUser.username}
64-
</td>
65-
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
66-
{deptUser.Role}
67-
</td>
68-
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
69-
{deptUser.Department}
70-
</td>
71-
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
72-
<div className="md:flex">
73-
{
74-
(() => {
75-
if(deptUser.Department !== ""){
76-
return (
77-
<p className='py-1 px-3 font-semibold rounded bg-blue-500 shadow-md text-white'>Alredy Added</p> )
78-
}
79-
else{
80-
if(RoleUser === "HOD"){
57+
if(deptUser.Role !== "Director" && deptUser.Role !== "Secretary"){
58+
return (
59+
<tr key={index}>
60+
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
61+
{deptUser.email}
62+
</td>
63+
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
64+
{deptUser.username}
65+
</td>
66+
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
67+
{deptUser.Role}
68+
</td>
69+
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
70+
{deptUser.Department}
71+
</td>
72+
<td scope="row" class="hidden md:table-cell px-2 py-4 text-gray-500 whitespace-nowrap dark:text-white">
73+
<div className="md:flex">
74+
{
75+
(() => {
76+
if(deptUser.Department !== ""){
8177
return (
82-
<button onClick={() => headleAddDept(deptUser.email)} className='py-1 px-3 bg-none text-blue-500 font-semibold rounded duration-500 hover:bg-blue-500 hover:shadow-md hover:text-white'>+ Add to My Dept</button>
83-
)
78+
<p className='py-1 px-3 font-semibold rounded bg-blue-500 shadow-md text-white'>Alredy Added</p> )
8479
}
85-
else if(RoleUser === "SuperAdmin" || RoleUser === "Director" || RoleUser === "Secretary" ){
86-
return (
87-
<button onClick={() => headleAddDept(deptUser.email)} className='py-1 px-3 bg-none text-blue-500 font-semibold rounded duration-500 hover:bg-blue-500 hover:shadow-md hover:text-white'>+ Add to Dept</button>
88-
)
80+
else{
81+
if(RoleUser === "HOD"){
82+
return (
83+
<button onClick={() => headleAddDept(deptUser.email)} className='py-1 px-3 bg-none text-blue-500 font-semibold rounded duration-500 hover:bg-blue-500 hover:shadow-md hover:text-white'>+ Add to My Dept</button>
84+
)
85+
}
86+
else if(RoleUser === "SuperAdmin" || RoleUser === "Director" || RoleUser === "Secretary" ){
87+
return (
88+
<button onClick={() => headleAddDept(deptUser.email)} className='py-1 px-3 bg-none text-blue-500 font-semibold rounded duration-500 hover:bg-blue-500 hover:shadow-md hover:text-white'>+ Add to Dept</button>
89+
)
90+
}
8991
}
90-
}
91-
})()
92-
}
93-
</div>
94-
</td>
95-
</tr>
96-
)
92+
})()
93+
}
94+
</div>
95+
</td>
96+
</tr>
97+
)
98+
}
9799
})
98100
}
99101
</tbody>

0 commit comments

Comments
 (0)