mirror of
https://github.com/ichsankurnia/hats-app.git
synced 2026-12-06 20:46:29 +00:00
fixing ui, logic etc..
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
// app/clients/components/assignment-table.tsx
|
||||
import { Card, Card900 } from '@/components/ui/card';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import Link from 'next/link';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { BookOpenCheck } from 'lucide-react';
|
||||
import { BookOpenCheck, MoreVertical } from 'lucide-react';
|
||||
import BadgeStatus from '@/components/ui/badge-status';
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { IProjectAssignment } from '../type.assignment';
|
||||
|
||||
export default function AssignmentTable({ data }: { data: any[] }) {
|
||||
export default function AssignmentTable({ data }: { data: IProjectAssignment[] }) {
|
||||
if (data.length === 0) {
|
||||
return <Card900 className="py-12 text-center border-2 border-dashed rounded-xl">
|
||||
return <Card className="py-12 text-center border-2 border-dashed rounded-xl">
|
||||
<BookOpenCheck className="w-12 h-12 mx-auto text-muted-foreground opacity-20" />
|
||||
<h3 className="text-lg font-medium">No project assignment found</h3>
|
||||
</Card900>
|
||||
</Card>
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -22,69 +24,97 @@ export default function AssignmentTable({ data }: { data: any[] }) {
|
||||
<TableRow>
|
||||
<TableHead className="min-w-[150px]">Client</TableHead>
|
||||
<TableHead className="min-w-[120px]">End User</TableHead>
|
||||
<TableHead className="min-w-[200px]">IM Name</TableHead>
|
||||
<TableHead>IM Code</TableHead>
|
||||
<TableHead className="min-w-[200px]">Description</TableHead>
|
||||
<TableHead>IM Year</TableHead>
|
||||
<TableHead>IM Start</TableHead>
|
||||
<TableHead>IM End</TableHead>
|
||||
<TableHead className="min-w-[200px]">Project Name</TableHead>
|
||||
<TableHead>Project Code</TableHead>
|
||||
<TableHead className="min-w-[200px]">Description</TableHead>
|
||||
<TableHead>Year</TableHead>
|
||||
<TableHead>Proj Start</TableHead>
|
||||
<TableHead>Proj End</TableHead>
|
||||
<TableHead className="min-w-[180px]">Work Order</TableHead>
|
||||
<TableHead className="min-w-[150px]">Work Order</TableHead>
|
||||
<TableHead>WO Code</TableHead>
|
||||
<TableHead>WO Start</TableHead>
|
||||
<TableHead>WO End</TableHead>
|
||||
<TableHead>Last Status</TableHead>
|
||||
<TableHead>Date Status Changed</TableHead>
|
||||
<TableHead className="min-w-[200px]">Status Remarks</TableHead>
|
||||
<TableHead className="w-[50px]"></TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{data.map((item, idx) => {
|
||||
const { client, assignment, wo } = item;
|
||||
const latestStatus = wo?.statusHistory?.[0] || assignment.statusHistory?.[0];
|
||||
{data.map((assignment, idx) => {
|
||||
const isProject = assignment.project?.code
|
||||
|
||||
return (
|
||||
<TableRow key={`${assignment.id}-${wo?.id || idx}`} className="hover:bg-accent/30">
|
||||
<TableCell className="font-bold text-primary">{client.name}</TableCell>
|
||||
<TableCell>{client.endUser}</TableCell>
|
||||
<TableRow key={idx} className="hover:bg-accent/30">
|
||||
<TableCell className="font-medium">
|
||||
<Link href={`/assignments/${assignment.id}`} className="hover:underline text-blue-600 dark:text-blue-400">
|
||||
{assignment.name}
|
||||
<Link href={`client-detail/${assignment.project?.client?.id}`} className="hover:underline text-blue-500 hover:text-his">
|
||||
{assignment.project?.client?.name}
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell className="font-mono text-xs">{assignment.code || '-'}</TableCell>
|
||||
<TableCell className="max-w-[250px] truncate text-xs" title={assignment.description}>
|
||||
{assignment.description}
|
||||
<TableCell className="font-bold text-primary">{assignment.project?.client?.end_user_name}</TableCell>
|
||||
<TableCell className="font-medium">{assignment.im_name}</TableCell>
|
||||
<TableCell>{assignment.im_code || ''}</TableCell>
|
||||
<TableCell className="max-w-[300px] truncate" title={assignment.im_description}>
|
||||
{assignment.im_description}
|
||||
</TableCell>
|
||||
<TableCell>{assignment.year || '-'}</TableCell>
|
||||
<TableCell className="whitespace-nowrap text-xs">
|
||||
{assignment.startDate ? new Date(assignment.startDate).toLocaleDateString() : '-'}
|
||||
<TableCell>{assignment.im_year || ''}</TableCell>
|
||||
<TableCell className="whitespace-nowrap">
|
||||
{assignment.im_start_date ? new Date(assignment.im_start_date).toLocaleDateString() : ''}
|
||||
</TableCell>
|
||||
<TableCell className="whitespace-nowrap text-xs">
|
||||
{assignment.endDate ? new Date(assignment.endDate).toLocaleDateString() : '-'}
|
||||
<TableCell className="whitespace-nowrap">
|
||||
{assignment.im_end_date ? new Date(assignment.im_end_date).toLocaleDateString() : ''}
|
||||
</TableCell>
|
||||
<TableCell className="font-medium">{wo?.name || '-'}</TableCell>
|
||||
<TableCell className="font-mono text-xs">{wo?.code || '-'}</TableCell>
|
||||
<TableCell className="whitespace-nowrap text-xs">
|
||||
{wo?.startDate ? new Date(wo.startDate).toLocaleDateString() : '-'}
|
||||
<TableCell className="font-medium">
|
||||
<Link href={`client-detail/${assignment.project?.client?.id}/project-detail/${assignment.project?.id}`} className='text-blue-500 hover:text-his duration-300'>
|
||||
{assignment.project?.name}
|
||||
</Link>
|
||||
</TableCell>
|
||||
<TableCell className="whitespace-nowrap text-xs">
|
||||
{wo?.endDate ? new Date(wo.endDate).toLocaleDateString() : '-'}
|
||||
<TableCell>{assignment.project?.code || ''}</TableCell>
|
||||
<TableCell className="max-w-[300px] truncate" title={assignment.project?.description}>
|
||||
{assignment.project?.description}
|
||||
</TableCell>
|
||||
<TableCell>{assignment.project?.year || ''}</TableCell>
|
||||
<TableCell className="whitespace-nowrap">
|
||||
{assignment.project?.start_date ? new Date(assignment.project?.start_date).toLocaleDateString() : ''}
|
||||
</TableCell>
|
||||
<TableCell className="whitespace-nowrap">
|
||||
{assignment.project?.end_date ? new Date(assignment.project?.end_date).toLocaleDateString() : ''}
|
||||
</TableCell>
|
||||
<TableCell>{assignment.wo_name || ''}</TableCell>
|
||||
<TableCell>{assignment.wo_code || ''}</TableCell>
|
||||
<TableCell className="whitespace-nowrap">
|
||||
{assignment.wo_start_date ? new Date(assignment.wo_start_date).toLocaleDateString() : ''}
|
||||
</TableCell>
|
||||
<TableCell className="whitespace-nowrap">
|
||||
{assignment.wo_end_date ? new Date(assignment.wo_end_date).toLocaleDateString() : ''}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Badge variant="outline" className={cn(
|
||||
"text-[10px] px-2 py-0 h-5",
|
||||
(wo?.status || assignment.status) === 'Active' ? 'text-green-600 border-green-200 bg-green-50' :
|
||||
(wo?.status || assignment.status) === 'Completed' ? 'text-blue-600 border-blue-200 bg-blue-50' :
|
||||
'text-orange-600 border-orange-200 bg-orange-50'
|
||||
)}>
|
||||
{wo?.status || assignment.status}
|
||||
</Badge>
|
||||
<BadgeStatus status={assignment.project?.status || assignment.project_status.name} />
|
||||
</TableCell>
|
||||
<TableCell className="whitespace-nowrap text-xs">
|
||||
{latestStatus ? new Date(latestStatus.date).toLocaleDateString() : '-'}
|
||||
</TableCell>
|
||||
<TableCell className="text-xs italic text-muted-foreground">
|
||||
{latestStatus?.note || '-'}
|
||||
<TableCell>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" className="h-8 w-8">
|
||||
<MoreVertical className="w-4 h-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem asChild>
|
||||
<Link href={`client-detail/${assignment.project?.client?.id}/${assignment.id}`}>View Assignment Details</Link>
|
||||
</DropdownMenuItem>
|
||||
{assignment.project?.code ?
|
||||
<DropdownMenuItem asChild>
|
||||
<Link href={`client-detail/${assignment.project?.client?.id}/project-detail/${assignment.project?.id}`}>View Project Details</Link>
|
||||
</DropdownMenuItem>
|
||||
:
|
||||
null
|
||||
}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
|
||||
@@ -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}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
"use client"
|
||||
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { MultiSelect } from '@/components/ui/multi-select'; // Assuming this is a custom component
|
||||
import { Search } from 'lucide-react';
|
||||
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
|
||||
import { type FC, useEffect, useState } from 'react';
|
||||
import { STATUS_LIST } from '../type.assignment';
|
||||
import {
|
||||
Select, SelectContent, SelectItem, SelectTrigger, SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import useDebounce from '@/hooks/useDebounce';
|
||||
|
||||
type Props = {};
|
||||
|
||||
const FilterComponent: FC<Props> = ({ }) => {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
const currentQuery = searchParams?.get('q') || '';
|
||||
const currentStatus = searchParams?.get('status');
|
||||
const currentSort = searchParams?.get('sort') || '';
|
||||
|
||||
const [searchText, setSearchText] = useState(currentQuery);
|
||||
|
||||
const [debouncedSearchText] = useDebounce(searchText, 500);
|
||||
|
||||
useEffect(() => {
|
||||
const params = new URLSearchParams(searchParams!);
|
||||
|
||||
if (debouncedSearchText) {
|
||||
params.set('q', debouncedSearchText);
|
||||
} else {
|
||||
params.delete('q');
|
||||
}
|
||||
|
||||
router.replace(`${pathname}?${params.toString()}`, { scroll: false });
|
||||
}, [debouncedSearchText, pathname, router]); // Remove searchParams from dependency array to prevent infinite loops
|
||||
|
||||
const handleStatusChange = (val: any[]) => {
|
||||
const params = new URLSearchParams(searchParams!);
|
||||
|
||||
if (val && val.length > 0) {
|
||||
params.set('status', val.join(','));
|
||||
} else {
|
||||
params.delete('status');
|
||||
}
|
||||
|
||||
router.replace(`${pathname}?${params.toString()}`, { scroll: false });
|
||||
};
|
||||
|
||||
const handleSortChange = (val: string) => {
|
||||
const params = new URLSearchParams(searchParams!);
|
||||
|
||||
if (val && val !== 'default') {
|
||||
params.set('sort', val);
|
||||
} else {
|
||||
params.delete('sort');
|
||||
}
|
||||
|
||||
router.replace(`${pathname}?${params.toString()}`, { scroll: false });
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='flex flex-col sm:flex-row justify-between items-center gap-5'>
|
||||
<div className='flex flex-col sm:flex-row items-center gap-5 w-full sm:w-auto'>
|
||||
<div className="relative w-full sm:w-64">
|
||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
|
||||
<Input
|
||||
placeholder="Search..."
|
||||
className="pl-10 w-full bg-white dark:bg-zinc-900"
|
||||
value={searchText} // ✅ Controlled by local state for snappy typing
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<MultiSelect
|
||||
className='w-full sm:w-72 dark:bg-zinc-900'
|
||||
placeholder='Select status'
|
||||
value={currentStatus ? currentStatus.split(',') : []}
|
||||
onChange={handleStatusChange}
|
||||
options={STATUS_LIST.map((item) => ({ label: item, value: item }))}
|
||||
maxCount={1}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Select value={currentSort} onValueChange={handleSortChange}>
|
||||
<SelectTrigger className="w-full md:w-max bg-white dark:bg-zinc-900">
|
||||
<SelectValue placeholder="Sort by" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="default">Default</SelectItem>
|
||||
<SelectItem value="latest">Latest</SelectItem>
|
||||
<SelectItem value="oldest">Oldest</SelectItem>
|
||||
<SelectItem value="participants_desc">Most Participants</SelectItem>
|
||||
<SelectItem value="participants_asc">Fewest Participants</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default FilterComponent;
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useState, type FC } from 'react';
|
||||
import { useMemo, useState, type FC } from 'react';
|
||||
import {
|
||||
AlertDialog, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle
|
||||
} from "@/components/ui/alert-dialog"
|
||||
@@ -12,6 +12,14 @@ import { IUser } from '@/app/admin/administration/user/component/type';
|
||||
import { LazyImage } from '@/components/ui/lazy-image';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { IProjectAssignment } from '../type.assignment';
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, } from "@/components/ui/form";
|
||||
import * as Yup from 'yup'
|
||||
import { yupResolver } from '@hookform/resolvers/yup';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { serverApiCall } from '@/lib/server-api';
|
||||
import { toast } from 'sonner';
|
||||
import { DatePicker } from '@/components/ui/datepicker';
|
||||
import { MultiSelectCustomSelection } from '@/components/ui/multi-select-custom-ui';
|
||||
|
||||
type Props = {
|
||||
data: IProjectAssignment
|
||||
@@ -20,31 +28,69 @@ type Props = {
|
||||
onSuccess?: VoidFunction;
|
||||
};
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
start_date: Yup.date().required('Start date is required'),
|
||||
end_date: Yup.date().nullable().min(Yup.ref('startDate'), 'End date cannot be before start date').default(null),
|
||||
user_id: Yup.array().of(Yup.number().required("Each item must be a number")).min(1, 'One user must be add').required()
|
||||
});
|
||||
|
||||
type FormDataType = Yup.InferType<typeof validationSchema>;
|
||||
|
||||
|
||||
const ManageEmployee: FC<Props> = ({ title, onCancel, onSuccess }) => {
|
||||
const [selectedEmployeeIds, setSelectedEmployeeIds] = useState<number[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
|
||||
const { data, isLoading: isLoadingFetchUser } = useFetchWithAxios('/user')
|
||||
|
||||
const form = useForm<FormDataType>({
|
||||
resolver: yupResolver(validationSchema),
|
||||
defaultValues: {},
|
||||
});
|
||||
|
||||
const toggleEmployee = (empId: number) => {
|
||||
setSelectedEmployeeIds(prev =>
|
||||
prev.includes(empId) ? prev.filter(i => i !== empId) : [...prev, empId]
|
||||
);
|
||||
};
|
||||
|
||||
const handleAssignEmployee = async () => {
|
||||
setIsLoading(true)
|
||||
onSuccess!()
|
||||
}
|
||||
const onSubmit = async (payload: FormDataType) => {
|
||||
setIsLoading(true);
|
||||
|
||||
let newPayload: any = { ...payload }
|
||||
|
||||
let res: any
|
||||
if (data) {
|
||||
res = await serverApiCall('PUT', `/project-assignment/assign-user/${data.id}`, newPayload)
|
||||
} else {
|
||||
res = await serverApiCall('POST', '/project-assignment/assign-user', newPayload)
|
||||
}
|
||||
|
||||
setIsLoading(false)
|
||||
if (res.success) {
|
||||
toast.success('Client saved successfully')
|
||||
onSuccess!()
|
||||
} else {
|
||||
toast.error(`Fail to save client`, { description: `(${res.code || '-'}) ${res.message}` })
|
||||
}
|
||||
};
|
||||
|
||||
const mappedUsers = useMemo(() => {
|
||||
return data?.user?.map((item: IUser) => ({
|
||||
label: item.fullname,
|
||||
value: item.id,
|
||||
originalData: item
|
||||
})) || []
|
||||
}, [data])
|
||||
|
||||
return (
|
||||
<>
|
||||
<AlertDialog open={true}>
|
||||
<AlertDialogContent className="max-w-md">
|
||||
<AlertDialogContent className='max-h-[90vh] overflow-y-auto overflow-x-hidden'>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Manage Team</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
Assign or remove employees for <strong>{title}</strong>
|
||||
Assign employees for <strong>{title}</strong>
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<div className="grid gap-4 py-4 max-h-[400px] overflow-y-auto pr-2">
|
||||
@@ -57,35 +103,68 @@ const ManageEmployee: FC<Props> = ({ title, onCancel, onSuccess }) => {
|
||||
<Skeleton className='h-10 w-full' />
|
||||
</div>
|
||||
:
|
||||
data?.user?.map((emp: IUser) => (
|
||||
<div
|
||||
key={emp.id}
|
||||
className={cn(
|
||||
"flex items-center gap-4 p-3 rounded-xl border-2 transition-all cursor-pointer",
|
||||
selectedEmployeeIds.includes(emp.id) ? "border-primary bg-primary/5" : "border-transparent hover:bg-accent"
|
||||
)}
|
||||
onClick={() => toggleEmployee(emp.id)}
|
||||
>
|
||||
<div className="relative">
|
||||
<LazyImage src={emp.avatar} alt={emp.fullname} className="w-10 h-10 rounded-full object-cover" />
|
||||
{selectedEmployeeIds.includes(emp.id) &&
|
||||
<div className="absolute -top-1 -right-1 w-4 h-4 bg-primary rounded-full flex items-center justify-center text-white border-2 border-background">
|
||||
<Check className="w-2 h-2" />
|
||||
</div>
|
||||
}
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||
<div className="grid grid-cols-1 gap-4 mb-6">
|
||||
<FormField control={form.control} name='user_id'
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>Employee to Assign <span className='text-red-600 font-bold'>*</span></FormLabel>
|
||||
<FormControl>
|
||||
<MultiSelectCustomSelection options={mappedUsers} value={field.value} onChange={field.onChange} placeholder='Select user to assign'
|
||||
// --- CUSTOM DROPDOWN OPTIONS ---
|
||||
renderOption={(option, isSelected) => {
|
||||
const user = option.originalData as IUser;
|
||||
return (
|
||||
<div className="flex items-center justify-between w-full py-1">
|
||||
<div className="flex items-center gap-3">
|
||||
<LazyImage className='w-10 h-10 rounded-full border border-border' alt={user.fullname} src={user.avatar} />
|
||||
<div className="flex flex-col">
|
||||
<span className={`text-sm ${isSelected ? 'font-bold text-primary' : ''}`}>
|
||||
{user.fullname}
|
||||
</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{user.role.name}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{isSelected && <div className="h-4 w-4 bg-his rounded-full animate-pulse" />}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField control={form.control} name='start_date' render={({ field }) => (
|
||||
<FormItem className="flex flex-col">
|
||||
<FormLabel>Start Date</FormLabel>
|
||||
<DatePicker date={field.value} setDate={field.onChange} />
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)} />
|
||||
|
||||
<FormField control={form.control} name='end_date' render={({ field }) => (
|
||||
<FormItem className="flex flex-col">
|
||||
<FormLabel>End Date</FormLabel>
|
||||
<DatePicker date={field.value as Date | undefined} setDate={field.onChange} />
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)} />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<p className="font-bold text-sm truncate">{emp.fullname}</p>
|
||||
<p className="text-xs text-muted-foreground truncate">{emp.position}</p>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel onClick={onCancel} disabled={isLoading} type='button'>Cancel</AlertDialogCancel>
|
||||
<Button type="submit" disabled={isLoading}>
|
||||
{isLoading && <Loader2 className='animate-spin' />}
|
||||
Save Changes
|
||||
</Button>
|
||||
</AlertDialogFooter>
|
||||
</form>
|
||||
</Form>
|
||||
}
|
||||
</div>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel onClick={onCancel} disabled={isLoading}>Cancel</AlertDialogCancel>
|
||||
<Button type='submit' disabled={isLoading}>{isLoading ? <Loader2 /> : null} Save Changes</Button>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user