fixing ui, logic etc..

This commit is contained in:
Ichsan Kurniawan
2026-04-20 17:13:49 +07:00
parent 6b16bd2dd4
commit 2d0f2fa1f0
9 changed files with 517 additions and 159 deletions
@@ -16,8 +16,8 @@ import {
import { DUMMY_EMPLOYEES, IClient } from '../types';
import { useState } from 'react';
import { useRouter } from 'next/navigation';
import { ConfirmDelete } from '@/components/modal/ConfirmDelete';
import FormClient from './FormClient';
import { ConfirmDeleteWithInput } from '@/components/modal/ConfirmDeleteWithInput';
export default function ClientGrid({ clients, assignments }: { clients: IClient[], assignments: any[] }) {
const router = useRouter();
@@ -172,7 +172,10 @@ export default function ClientGrid({ clients, assignments }: { clients: IClient[
</div>
{action === 'EDIT' && <FormClient data={selectedData} onCancel={handleClose} onSuccess={() => { router.refresh(); handleClose() }} />}
{action === 'DELETE' ? <ConfirmDelete endpoint={`/client/${selectedData?.id}`} onCancel={handleClose} onSuccess={() => { router.refresh(); handleClose() }} /> : null}
{action === 'DELETE' ? <ConfirmDeleteWithInput endpoint={`/client/${selectedData?.id}`} onCancel={handleClose} onSuccess={() => { router.refresh(); handleClose() }}
title={selectedData?.name!} description={`This action cannot be undone. This will permanently delete and remove client ${selectedData?.name} from our servers.`}
titleButton={`I understand the consequences, delete this client`}
/> : null}
</>
);
}