initialisation du projet
This commit is contained in:
77
frontend/src/pages/Employe.jsx
Normal file
77
frontend/src/pages/Employe.jsx
Normal file
@@ -0,0 +1,77 @@
|
||||
import { useState } from 'react'
|
||||
|
||||
export default function Employe() {
|
||||
const [code, setCode] = useState('')
|
||||
const [gain, setGain] = useState(null)
|
||||
|
||||
const handleSearch = (e) => {
|
||||
e.preventDefault()
|
||||
// TODO: connecter au backend
|
||||
setGain({
|
||||
code,
|
||||
lot: 'Thé signature (100g)',
|
||||
client: 'Jean Dupont',
|
||||
email: 'jean.dupont@email.com',
|
||||
status: 'PENDING',
|
||||
})
|
||||
}
|
||||
|
||||
const handleDeliver = () => {
|
||||
// TODO: connecter au backend
|
||||
setGain({ ...gain, status: 'DELIVERED' })
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 p-6">
|
||||
<div className="max-w-lg mx-auto">
|
||||
<h1 className="text-2xl font-bold text-gray-800 mb-1">Espace Employé</h1>
|
||||
<p className="text-gray-500 mb-6">Vérifier et remettre un lot</p>
|
||||
|
||||
<form onSubmit={handleSearch} className="flex gap-2 mb-6">
|
||||
<input
|
||||
type="text"
|
||||
value={code}
|
||||
onChange={(e) => setCode(e.target.value)}
|
||||
required
|
||||
placeholder="Code ticket (TTT-XXXXX)"
|
||||
className="flex-1 border border-gray-300 rounded-lg px-4 py-2.5 focus:outline-none focus:ring-2 focus:ring-green-500 font-mono"
|
||||
/>
|
||||
<button
|
||||
type="submit"
|
||||
className="bg-green-700 hover:bg-green-800 text-white font-semibold px-5 py-2.5 rounded-lg transition-colors"
|
||||
>
|
||||
Rechercher
|
||||
</button>
|
||||
</form>
|
||||
|
||||
{gain && (
|
||||
<div className="bg-white rounded-xl shadow p-6 space-y-3">
|
||||
<div className="flex justify-between items-start">
|
||||
<div>
|
||||
<p className="font-bold text-gray-800 text-lg">{gain.lot}</p>
|
||||
<p className="text-sm text-gray-500 font-mono">{gain.code}</p>
|
||||
</div>
|
||||
<span className={`text-xs font-semibold px-3 py-1 rounded-full ${gain.status === 'DELIVERED' ? 'bg-green-100 text-green-800' : 'bg-yellow-100 text-yellow-800'}`}>
|
||||
{gain.status === 'DELIVERED' ? 'Remis' : 'À remettre'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="border-t pt-3">
|
||||
<p className="text-sm text-gray-600"><span className="font-medium">Client :</span> {gain.client}</p>
|
||||
<p className="text-sm text-gray-600"><span className="font-medium">Email :</span> {gain.email}</p>
|
||||
</div>
|
||||
|
||||
{gain.status === 'PENDING' && (
|
||||
<button
|
||||
onClick={handleDeliver}
|
||||
className="w-full bg-green-700 hover:bg-green-800 text-white font-semibold py-2.5 rounded-lg transition-colors mt-2"
|
||||
>
|
||||
Confirmer la remise du lot
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user