Added few functions

This commit is contained in:
2026-02-16 14:43:02 +01:00
parent 0c908a21ac
commit 1ec4c935c9
31 changed files with 352 additions and 35 deletions

View File

@@ -5,6 +5,7 @@ import { createPortal } from 'react-dom';
import { useNotification } from './NotificationProvider';
import ConfirmModal from './ConfirmModal';
import ParticipationEditModal from './ParticipationEditModal';
import { getParticipationRef } from '@/lib/participation-ref';
interface Participation {
id: string;
@@ -59,9 +60,6 @@ const STATUT_CONFIG: Record<string, { label: string; className: string; dot: str
},
};
function getRefNum(id: string) {
return `PART-${id.slice(-8).toUpperCase()}`;
}
export default function ParticipationFinanciereList() {
const { showNotification } = useNotification();
@@ -204,7 +202,7 @@ export default function ParticipationFinanciereList() {
const filteredParticipations = participations.filter((p) => {
const search = searchTerm.toLowerCase();
const ref = getRefNum(p.id).toLowerCase();
const ref = getParticipationRef(p.id).toLowerCase();
const chauffeurName = p.trajet.chauffeur
? `${p.trajet.chauffeur.prenom} ${p.trajet.chauffeur.nom}`.toLowerCase()
: '';
@@ -500,7 +498,7 @@ export default function ParticipationFinanciereList() {
</thead>
<tbody className="bg-white divide-y divide-gray-200">
{filteredParticipations.map((p) => {
const ref = getRefNum(p.id);
const ref = getParticipationRef(p.id);
const chauffeur = p.trajet.chauffeur;
const montant = p.montant != null ? `${p.montant.toFixed(2).replace('.', ',')}` : '—';
const statutConfig = STATUT_CONFIG[p.statut] || STATUT_CONFIG.en_attente;
@@ -619,7 +617,7 @@ export default function ParticipationFinanciereList() {
{/* Vue mobile - Cartes */}
<div className="md:hidden divide-y divide-gray-200">
{filteredParticipations.map((p) => {
const ref = getRefNum(p.id);
const ref = getParticipationRef(p.id);
const chauffeur = p.trajet.chauffeur;
const montant = p.montant != null ? `${p.montant.toFixed(2).replace('.', ',')}` : '—';
const statutConfig = STATUT_CONFIG[p.statut] || STATUT_CONFIG.en_attente;