All files / components/componentEmploye EmployesSearchAndFilters.tsx

16.66% Statements 1/6
0% Branches 0/6
0% Functions 0/5
16.66% Lines 1/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83                        1x                                                                                                                                            
'use client';
 
interface Props {
  searchTerm: string;
  onSearchChange: (term: string) => void;
  statusFilter: 'all' | 'active' | 'inactive';
  onStatusFilterChange: (status: 'all' | 'active' | 'inactive') => void;
}
 
/**
 * Composant de recherche et filtres pour les employés
 */
export default function EmployesSearchAndFilters({
  searchTerm,
  onSearchChange,
  statusFilter,
  onStatusFilterChange,
}: Props) {
  return (
    <div className="bg-white rounded-lg shadow-md p-6">
      <div className="flex flex-col lg:flex-row lg:items-center lg:justify-between space-y-4 lg:space-y-0 lg:space-x-6">
        {/* Barre de recherche */}
        <div className="flex-1">
          <div className="relative">
            <div className="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
              <span className="text-gray-400">🔍</span>
            </div>
            <input
              type="text"
              className="block w-full pl-10 pr-3 py-2 border border-gray-300 rounded-md leading-5 bg-white placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-gray-900"
              placeholder="Rechercher par nom, prénom, matricule, téléphone ou email..."
              value={searchTerm}
              onChange={(e) => onSearchChange(e.target.value)}
            />
          </div>
        </div>
 
        {/* Filtre par statut */}
        <div className="flex items-center space-x-2">
          <span className="text-sm font-medium text-gray-700">Statut:</span>
          <div className="flex bg-gray-100 rounded-lg p-1">
            <button
              onClick={() => onStatusFilterChange('all')}
              className={`px-3 py-1 text-sm font-medium rounded-md transition-colors ${
                statusFilter === 'all'
                  ? 'bg-white text-blue-600 shadow-sm'
                  : 'text-gray-600 hover:text-gray-800'
              }`}
            >
              Tous
            </button>
            <button
              onClick={() => onStatusFilterChange('active')}
              className={`px-3 py-1 text-sm font-medium rounded-md transition-colors ${
                statusFilter === 'active'
                  ? 'bg-white text-green-600 shadow-sm'
                  : 'text-gray-600 hover:text-gray-800'
              }`}
            >
              Actifs
            </button>
            <button
              onClick={() => onStatusFilterChange('inactive')}
              className={`px-3 py-1 text-sm font-medium rounded-md transition-colors ${
                statusFilter === 'inactive'
                  ? 'bg-white text-red-600 shadow-sm'
                  : 'text-gray-600 hover:text-gray-800'
              }`}
            >
              Inactifs
            </button>
          </div>
        </div>
 
        {/* Statistiques */}
        <div className="flex items-center space-x-4 text-sm text-gray-500">
          <span>Recherche en temps réel</span>
        </div>
      </div>
    </div>
  );
}