mirror of
https://git.v0id.ovh/n3wt-innov/n3wt-school.git
synced 2026-01-29 07:53:23 +00:00
refactor: Transformation des requetes vers le back en action ajout des
erreurs 400 et refresh lors d'un envoie de formulaire
This commit is contained in:
@ -2,7 +2,7 @@ import { useState } from 'react';
|
||||
import { ChevronUp } from 'lucide-react';
|
||||
import DropdownMenu from './DropdownMenu';
|
||||
|
||||
const StatusLabel = ({ etat, onChange, showDropdown = true }) => {
|
||||
const StatusLabel = ({ status, onChange, showDropdown = true }) => {
|
||||
const [dropdownOpen, setDropdownOpen] = useState(false);
|
||||
const statusOptions = [
|
||||
{ value: 1, label: 'Créé' },
|
||||
@ -13,7 +13,7 @@ const StatusLabel = ({ etat, onChange, showDropdown = true }) => {
|
||||
{ value: 6, label: 'Archivé' },
|
||||
];
|
||||
|
||||
const currentStatus = statusOptions.find(option => option.value === etat);
|
||||
const currentStatus = statusOptions.find(option => option.value === status);
|
||||
return (
|
||||
<>
|
||||
{showDropdown ? (
|
||||
@ -29,12 +29,12 @@ const StatusLabel = ({ etat, onChange, showDropdown = true }) => {
|
||||
onClick: () => onChange(option.value),
|
||||
}))}
|
||||
buttonClassName={`w-[150px] flex items-center justify-center gap-2 px-2 py-2 rounded-md text-sm text-center font-medium ${
|
||||
etat === 1 && 'bg-blue-50 text-blue-600' ||
|
||||
etat === 2 && 'bg-orange-50 text-orange-600' ||
|
||||
etat === 3 && 'bg-purple-50 text-purple-600' ||
|
||||
etat === 4 && 'bg-red-50 text-red-600' ||
|
||||
etat === 5 && 'bg-green-50 text-green-600' ||
|
||||
etat === 6 && 'bg-red-50 text-red-600'
|
||||
status === 1 && 'bg-blue-50 text-blue-600' ||
|
||||
status === 2 && 'bg-orange-50 text-orange-600' ||
|
||||
status === 3 && 'bg-purple-50 text-purple-600' ||
|
||||
status === 4 && 'bg-red-50 text-red-600' ||
|
||||
status === 5 && 'bg-green-50 text-green-600' ||
|
||||
status === 6 && 'bg-red-50 text-red-600'
|
||||
}`}
|
||||
menuClassName="absolute right-0 mt-2 w-48 bg-white border border-gray-200 rounded-md shadow-lg z-10"
|
||||
dropdownOpen={dropdownOpen}
|
||||
@ -42,12 +42,12 @@ const StatusLabel = ({ etat, onChange, showDropdown = true }) => {
|
||||
/>
|
||||
) : (
|
||||
<div className={`w-[150px] flex items-center justify-center gap-2 px-2 py-2 rounded-md text-sm text-center font-medium ${
|
||||
etat === 1 && 'bg-blue-50 text-blue-600' ||
|
||||
etat === 2 && 'bg-orange-50 text-orange-600' ||
|
||||
etat === 3 && 'bg-purple-50 text-purple-600' ||
|
||||
etat === 4 && 'bg-red-50 text-red-600' ||
|
||||
etat === 5 && 'bg-green-50 text-green-600' ||
|
||||
etat === 6 && 'bg-red-50 text-red-600'
|
||||
status === 1 && 'bg-blue-50 text-blue-600' ||
|
||||
status === 2 && 'bg-orange-50 text-orange-600' ||
|
||||
status === 3 && 'bg-purple-50 text-purple-600' ||
|
||||
status === 4 && 'bg-red-50 text-red-600' ||
|
||||
status === 5 && 'bg-green-50 text-green-600' ||
|
||||
status === 6 && 'bg-red-50 text-red-600'
|
||||
}`}>
|
||||
{currentStatus ? currentStatus.label : 'Statut inconnu'}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user