Skip to content

Commit

Permalink
fixbug
Browse files Browse the repository at this point in the history
  • Loading branch information
leopoldch committed Mar 15, 2024
1 parent 961e7ce commit 7d754e4
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/components/LogoutButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function LogoutButton() {
}
// Supprimer le token du local storage
localStorage.removeItem('token');
localStorage.setItem('activeItem', 'inventaire');
sessionStorage.removeItem('user_id');

setUserId(-1);
setIsAuthenticated(false);
// window.location.href = '/login';
Expand Down
11 changes: 10 additions & 1 deletion src/components/Matos.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {MenuItem, Menu, MenuMenu} from "semantic-ui-react";
import {useEffect, useState, useContext} from "react";
import HistoryTable from "./History";
import {AuthContext} from "../context/AuthContext";
import item4 from "../ressources/item4.png";




Expand All @@ -28,10 +30,17 @@ function Matos(){
setActiveItem(name);
};

function handleClickMain(){
window.location.href = '/';
}

return(<>
<div className={"header-inventory"}>
<h1>Gestion du matériel</h1>
<div className="top-left-wrapper">
<img className={"image-flyht"} src={item4} onClick={handleClickMain} />
<h1>Gestion du matériel</h1>
</div>

{/* menu*/}
<Menu secondary>

Expand Down
4 changes: 2 additions & 2 deletions src/components/TableData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ const handleDeselectButton = () => {
<TableCell>{item.brand}</TableCell>
<TableCell>{options.find(option => option.value === item.type).text}</TableCell>
<TableCell>{options2.find(option => option.value === item.state).text}</TableCell></>}
<TableCell>{item.description}</TableCell>
{isLargeScreen? <TableCell>{item.description}</TableCell> :null}
<TableCell>{item.power}</TableCell>
<TableCell>{item.price}</TableCell>
<TableCell>{item.quantity}</TableCell>
Expand All @@ -650,7 +650,7 @@ const handleDeselectButton = () => {
<TableCell>{convertDateFormat(item.modification_date)}</TableCell>
</> : null
}
{!showDeleted && userId !==2 && isAuthenticated ?
{!showDeleted && (userId !== 2) && isAuthenticated ?
<>
<TableCell>
<ModalEdit submission={handleSubmissionEdit} item_id={item.id} reason={item.modification_reason} state={item.state} power={item.power} name={item.name} brand={item.brand} type={item.type} description={item.description} price={item.price} quantity={item.quantity} date={item.creation} />
Expand Down
1 change: 1 addition & 0 deletions src/pages/Inventory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Matos from "../components/Matos";

function Inventory(){
return(<>

<body id={"body-inv"}>
<div className={"matos-content"}>
<Matos/>
Expand Down
16 changes: 16 additions & 0 deletions src/style/Matos.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
color: black;
}



p{
color: black;
}
Expand Down Expand Up @@ -115,6 +117,20 @@ p{
padding: 2%;
}

.image-flyht{
width: 30%;
height: auto;
margin-right: 2%;
cursor: pointer;
}
.top-left-wrapper{
margin-left: -2%;
height: auto;
width: 40%;
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
}


@media only screen and (min-device-width : 0px) and (max-device-width : 1024px) {
Expand Down

0 comments on commit 7d754e4

Please sign in to comment.