fix: Corriger la réinitialisation des filtres sur page staff/contrats
This commit is contained in:
parent
6dffd2ed45
commit
3728653595
3 changed files with 18 additions and 4 deletions
|
|
@ -235,7 +235,13 @@ export type ContractsGridHandle = {
|
|||
getCountMultiMois: () => number | null;
|
||||
};
|
||||
|
||||
function ContractsGridImpl({ initialData, activeOrgId }: { initialData: Contract[]; activeOrgId?: string | null }, ref: React.ForwardedRef<ContractsGridHandle>) {
|
||||
type ContractsGridProps = {
|
||||
initialData: Contract[];
|
||||
activeOrgId?: string | null;
|
||||
onFiltersReset?: () => void;
|
||||
};
|
||||
|
||||
function ContractsGridImpl({ initialData, activeOrgId, onFiltersReset }: ContractsGridProps, ref: React.ForwardedRef<ContractsGridHandle>) {
|
||||
const [rows, setRows] = useState<Contract[]>(initialData || []);
|
||||
const [showRaw, setShowRaw] = useState(false);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
|
@ -2062,6 +2068,7 @@ function ContractsGridImpl({ initialData, activeOrgId }: { initialData: Contract
|
|||
setEtatPaieFilter(null);
|
||||
setDpaeFilter(null);
|
||||
setSignatureFilter(null);
|
||||
setMultiMoisFilter(null);
|
||||
setStartFrom(null);
|
||||
setStartTo(null);
|
||||
setEndFrom(null);
|
||||
|
|
@ -2069,6 +2076,8 @@ function ContractsGridImpl({ initialData, activeOrgId }: { initialData: Contract
|
|||
setSortField('start_date');
|
||||
setSortOrder('desc');
|
||||
setRows(initialData || []);
|
||||
// Notifier le parent que les filtres ont été réinitialisés
|
||||
onFiltersReset?.();
|
||||
}}
|
||||
>
|
||||
Réinitialiser
|
||||
|
|
|
|||
|
|
@ -366,7 +366,12 @@ export default function StaffContractsPageClient({ initialData, activeOrgId }: {
|
|||
</div>
|
||||
|
||||
<div className="rounded-2xl border bg-white p-4">
|
||||
<ContractsGrid ref={gridRef} initialData={initialData} activeOrgId={activeOrgId} />
|
||||
<ContractsGrid
|
||||
ref={gridRef}
|
||||
initialData={initialData}
|
||||
activeOrgId={activeOrgId}
|
||||
onFiltersReset={() => setActiveFilter(null)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -2061,7 +2061,7 @@ export default function ContractEditor({
|
|||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div className={hasUnsavedChanges ? 'relative rounded-full p-1 bg-gradient-to-r from-green-400 via-yellow-400 to-green-400 bg-[length:200%_100%] animate-[gradient_3s_linear_infinite] shadow-lg' : ''}>
|
||||
<div>
|
||||
<style jsx>{`
|
||||
@keyframes gradient {
|
||||
0% { background-position: 0% 50%; }
|
||||
|
|
@ -2074,7 +2074,7 @@ export default function ContractEditor({
|
|||
disabled={isSaving || !hasUnsavedChanges}
|
||||
className={`rounded-full transition-all duration-200 px-6 py-6 text-base font-semibold w-full ${
|
||||
hasUnsavedChanges
|
||||
? 'bg-green-600 hover:bg-green-700 text-black'
|
||||
? 'bg-gradient-to-r from-green-400 via-yellow-300 to-green-400 bg-[length:200%_100%] animate-[gradient_2.5s_linear_infinite] hover:shadow-xl text-black shadow-lg'
|
||||
: 'bg-slate-300 text-slate-500 cursor-not-allowed hover:cursor-not-allowed shadow-lg'
|
||||
}`}
|
||||
>
|
||||
|
|
|
|||
Loading…
Reference in a new issue