Responsivite admin page
This commit is contained in:
parent
b10408f443
commit
6f054bc707
@ -146,16 +146,15 @@ function AdminObjet() {
|
|||||||
{/*Formulaire d'ajout d'objet*/}
|
{/*Formulaire d'ajout d'objet*/}
|
||||||
<FormNewObject isAdmin={true} />
|
<FormNewObject isAdmin={true} />
|
||||||
|
|
||||||
{/* Tri des objets */}
|
|
||||||
<section className="bg-white p-6 rounded-xl shadow-md mt-12 mb-12">
|
<section className="bg-white p-6 rounded-xl shadow-md mt-12 mb-12">
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex flex-col md:flex-row md:items-center md:justify-between mb-4 gap-4">
|
||||||
<h2 className="text-2xl font-semibold">
|
<h2 className="text-2xl font-semibold">
|
||||||
Liste des Objets et Outils/Services
|
Liste des Objets et Outils/Services
|
||||||
</h2>
|
</h2>
|
||||||
<select
|
<select
|
||||||
value={sortCriteria}
|
value={sortCriteria}
|
||||||
onChange={(e) => setSortCriteria(e.target.value)}
|
onChange={(e) => setSortCriteria(e.target.value)}
|
||||||
className="border border-gray-300 rounded-lg p-2"
|
className="border border-gray-300 rounded-lg p-2 w-full md:w-auto"
|
||||||
>
|
>
|
||||||
<option value="">-- Trier par --</option>
|
<option value="">-- Trier par --</option>
|
||||||
<option value="proprietaire">Propriétaire</option>
|
<option value="proprietaire">Propriétaire</option>
|
||||||
@ -164,14 +163,15 @@ function AdminObjet() {
|
|||||||
<option value="status">Status</option>
|
<option value="status">Status</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
|
<div className="overflow-x-auto">
|
||||||
<table className="min-w-full divide-y divide-gray-200">
|
<table className="min-w-full divide-y divide-gray-200">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
Nom
|
Nom
|
||||||
</th>
|
</th>
|
||||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-48">
|
||||||
Description
|
Description
|
||||||
</th>
|
</th>
|
||||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
@ -195,7 +195,7 @@ function AdminObjet() {
|
|||||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
||||||
{obj.name}
|
{obj.name}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 w-48 truncate">
|
||||||
{obj.description}
|
{obj.description}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||||
|
|||||||
@ -182,7 +182,6 @@ function User() {
|
|||||||
<td className={`${thTd}`}>{user.name}</td>
|
<td className={`${thTd}`}>{user.name}</td>
|
||||||
<td className={`${thTd}`}>{user.email}</td>
|
<td className={`${thTd}`}>{user.email}</td>
|
||||||
<td className={`${thTd}`}>
|
<td className={`${thTd}`}>
|
||||||
{/* Menu déroulant pour changer le niveau d'accès */}
|
|
||||||
<select
|
<select
|
||||||
value={user.role}
|
value={user.role}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
@ -196,7 +195,6 @@ function User() {
|
|||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td className={`${thTd}`}>
|
<td className={`${thTd}`}>
|
||||||
{/* Input et bouton pour ajuster les points */}
|
|
||||||
<input
|
<input
|
||||||
className="border ml-4 w-16"
|
className="border ml-4 w-16"
|
||||||
type="number"
|
type="number"
|
||||||
@ -217,7 +215,6 @@ function User() {
|
|||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td className={`${thTd}`}>
|
<td className={`${thTd}`}>
|
||||||
{/* Bouton de suppression */}
|
|
||||||
<button
|
<button
|
||||||
className="p-2 bg-red-600 text-white border-none rounded-md"
|
className="p-2 bg-red-600 text-white border-none rounded-md"
|
||||||
onClick={() => handleDeleteUser(user.id)}
|
onClick={() => handleDeleteUser(user.id)}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ function ObjectManagement() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
axios.get("http://localhost:8888/objets").then((response) => {
|
axios.get(`${API_BASE_URL}/objets`).then((response) => {
|
||||||
setObjects(response.data);
|
setObjects(response.data);
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { Mail, Lock } from 'lucide-react';
|
|||||||
import { useNavigate, Link } from 'react-router-dom';
|
import { useNavigate, Link } from 'react-router-dom';
|
||||||
import axios from 'axios'; // Assurez-vous d'avoir axios importé
|
import axios from 'axios'; // Assurez-vous d'avoir axios importé
|
||||||
import { useAuth } from '../AuthContext';
|
import { useAuth } from '../AuthContext';
|
||||||
|
import { API_BASE_URL } from "../config";
|
||||||
|
|
||||||
function Login() {
|
function Login() {
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
@ -24,7 +25,7 @@ function Login() {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch("http://localhost:8888/login", {
|
const response = await fetch(`${API_BASE_URL}/login`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
@ -30,7 +30,7 @@ function Settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch("http://localhost:8888/settings", {
|
const response = await fetch(`${API_BASE_URL}/settings`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Mail, User, Lock } from 'lucide-react';
|
import { Mail, User, Lock } from 'lucide-react';
|
||||||
import { useNavigate, Link} from 'react-router-dom'; // Importation du hook useNavigate
|
import { useNavigate, Link} from 'react-router-dom'; // Importation du hook useNavigate
|
||||||
|
import { API_BASE_URL } from "../config.js";
|
||||||
|
|
||||||
function Signup() {
|
function Signup() {
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
@ -30,7 +31,7 @@ function Signup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch("http://localhost:8888/signup", {
|
const response = await fetch(`${API_BASE_URL}/signup`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -46,8 +47,8 @@ function Signup() {
|
|||||||
|
|
||||||
alert("Inscription réussie !");
|
alert("Inscription réussie !");
|
||||||
|
|
||||||
// Redirection vers la page d'accueil après une inscription réussie
|
|
||||||
navigate("/home"); // Remplace "/home" par l'URL de ta page d'accueil
|
navigate("/");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert(error.message);
|
alert(error.message);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user