Initial commit
This commit is contained in:
100
components/chantiers/ChantierMenuActions.tsx
Normal file
100
components/chantiers/ChantierMenuActions.tsx
Normal file
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* Menu d'actions pour les chantiers - Actions prioritaires BTP
|
||||
*/
|
||||
|
||||
import React, { useRef } from 'react';
|
||||
import { Button } from 'primereact/button';
|
||||
import { Menu } from 'primereact/menu';
|
||||
import { MenuItem } from 'primereact/menuitem';
|
||||
import { ChantierActif } from '../../hooks/useDashboard';
|
||||
|
||||
interface ChantierMenuActionsProps {
|
||||
chantier: ChantierActif;
|
||||
onAction: (action: string, chantier: ChantierActif) => void;
|
||||
}
|
||||
|
||||
const ChantierMenuActions: React.FC<ChantierMenuActionsProps> = ({
|
||||
chantier,
|
||||
onAction
|
||||
}) => {
|
||||
const menuRef = useRef<Menu>(null);
|
||||
|
||||
// Actions prioritaires pour le workflow BTP
|
||||
const menuItems: MenuItem[] = [
|
||||
{
|
||||
label: 'Gestion chantier',
|
||||
items: [
|
||||
{
|
||||
label: 'Suspendre le chantier',
|
||||
icon: 'pi pi-pause',
|
||||
command: () => onAction('suspend', chantier)
|
||||
},
|
||||
{
|
||||
label: 'Clôturer le chantier',
|
||||
icon: 'pi pi-check-circle',
|
||||
command: () => onAction('close', chantier)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
{
|
||||
label: 'Communication',
|
||||
items: [
|
||||
{
|
||||
label: 'Notification client',
|
||||
icon: 'pi pi-send',
|
||||
command: () => onAction('notify-client', chantier)
|
||||
},
|
||||
{
|
||||
label: 'Rapport de synthèse',
|
||||
icon: 'pi pi-file-pdf',
|
||||
command: () => onAction('generate-report', chantier)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
{
|
||||
label: 'Financier',
|
||||
items: [
|
||||
{
|
||||
label: 'Facture intermédiaire',
|
||||
icon: 'pi pi-euro',
|
||||
command: () => onAction('generate-invoice', chantier)
|
||||
},
|
||||
{
|
||||
label: 'Créer un avenant',
|
||||
icon: 'pi pi-file-plus',
|
||||
command: () => onAction('create-amendment', chantier)
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
const toggleMenu = (event: React.MouseEvent) => {
|
||||
menuRef.current?.toggle(event);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button
|
||||
icon="pi pi-ellipsis-v"
|
||||
className="p-button-text p-button-rounded p-button-sm"
|
||||
onClick={toggleMenu}
|
||||
aria-label="Plus d'actions"
|
||||
style={{ color: '#6B7280' }}
|
||||
/>
|
||||
<Menu
|
||||
ref={menuRef}
|
||||
model={menuItems}
|
||||
popup
|
||||
style={{ minWidth: '250px' }}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChantierMenuActions;
|
||||
Reference in New Issue
Block a user