2026-05-26 15:48:01 +05:30
|
|
|
import { useState, useEffect, useCallback } from 'react';
|
|
|
|
|
import { AxiosError } from 'axios';
|
|
|
|
|
import { BytescaleUploader } from '@/components/BytescaleUploader/BytescaleUploader';
|
|
|
|
|
|
|
|
|
|
import { getDepartmentsApi, createDepartmentApi, updateDepartmentApi } from '@/api/department';
|
|
|
|
|
|
|
|
|
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
|
|
|
|
|
|
|
|
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
|
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
|
|
|
|
|
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter } from '@/components/ui/dialog';
|
|
|
|
|
|
|
|
|
|
import { Input } from '@/components/ui/input';
|
|
|
|
|
import { Textarea } from '@/components/ui/textarea';
|
|
|
|
|
import { Switch } from '@/components/ui/switch';
|
|
|
|
|
import { Label } from '@/components/ui/label';
|
|
|
|
|
import { Badge } from '@/components/ui/badge';
|
|
|
|
|
|
|
|
|
|
import { Loader2, RefreshCw, Plus, Pencil, Eye, ChevronLeft, ChevronRight } from 'lucide-react';
|
2026-03-16 17:55:33 +05:30
|
|
|
|
|
|
|
|
interface Department {
|
|
|
|
|
departmentId: string;
|
|
|
|
|
name: string;
|
2026-04-14 17:33:21 +05:30
|
|
|
image?: string;
|
2026-03-16 17:55:33 +05:30
|
|
|
para1: string;
|
|
|
|
|
para2: string;
|
|
|
|
|
para3: string;
|
|
|
|
|
facilities: string;
|
|
|
|
|
services: string;
|
2026-05-11 00:04:22 +05:30
|
|
|
isActive: boolean;
|
|
|
|
|
sortOrder: number;
|
2026-03-16 17:55:33 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function DepartmentPage() {
|
|
|
|
|
const [departments, setDepartments] = useState<Department[]>([]);
|
|
|
|
|
const [loading, setLoading] = useState(true);
|
2026-05-26 15:48:01 +05:30
|
|
|
const [error, setError] = useState('');
|
2026-03-16 17:55:33 +05:30
|
|
|
|
|
|
|
|
const [openModal, setOpenModal] = useState(false);
|
|
|
|
|
const [editing, setEditing] = useState<Department | null>(null);
|
|
|
|
|
|
2026-03-26 14:38:23 +05:30
|
|
|
const [viewOpen, setViewOpen] = useState(false);
|
|
|
|
|
const [viewData, setViewData] = useState<Department | null>(null);
|
|
|
|
|
|
2026-05-26 15:48:01 +05:30
|
|
|
const [searchText, setSearchText] = useState('');
|
2026-03-17 17:28:18 +05:30
|
|
|
|
2026-04-08 16:30:50 +05:30
|
|
|
const [currentPage, setCurrentPage] = useState(1);
|
|
|
|
|
const itemsPerPage = 10;
|
|
|
|
|
|
2026-03-16 17:55:33 +05:30
|
|
|
const [form, setForm] = useState<Department>({
|
2026-05-26 15:48:01 +05:30
|
|
|
departmentId: '',
|
|
|
|
|
name: '',
|
|
|
|
|
image: '',
|
|
|
|
|
para1: '',
|
|
|
|
|
para2: '',
|
|
|
|
|
para3: '',
|
|
|
|
|
facilities: '',
|
|
|
|
|
services: '',
|
2026-05-11 00:04:22 +05:30
|
|
|
isActive: true,
|
|
|
|
|
sortOrder: 0,
|
2026-03-16 17:55:33 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const fetchDepartments = useCallback(async () => {
|
|
|
|
|
setLoading(true);
|
2026-05-26 15:48:01 +05:30
|
|
|
setError('');
|
2026-03-16 17:55:33 +05:30
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const res = await getDepartmentsApi();
|
|
|
|
|
setDepartments(res?.data || []);
|
|
|
|
|
} catch (err) {
|
|
|
|
|
if (err instanceof AxiosError) {
|
2026-05-26 15:48:01 +05:30
|
|
|
setError(err.response?.data?.message || 'Failed to load departments');
|
2026-03-16 17:55:33 +05:30
|
|
|
} else {
|
2026-05-26 15:48:01 +05:30
|
|
|
setError('Something went wrong');
|
2026-03-16 17:55:33 +05:30
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false);
|
|
|
|
|
}
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchDepartments();
|
|
|
|
|
}, [fetchDepartments]);
|
|
|
|
|
|
2026-04-08 16:30:50 +05:30
|
|
|
const filteredDepartments = departments.filter(
|
|
|
|
|
(dep) =>
|
|
|
|
|
dep.name.toLowerCase().includes(searchText.toLowerCase()) ||
|
2026-05-26 15:48:01 +05:30
|
|
|
dep.departmentId.toLowerCase().includes(searchText.toLowerCase())
|
2026-04-08 16:30:50 +05:30
|
|
|
);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setCurrentPage(1);
|
|
|
|
|
}, [searchText]);
|
|
|
|
|
|
|
|
|
|
const totalPages = Math.ceil(filteredDepartments.length / itemsPerPage);
|
|
|
|
|
const indexOfLastItem = currentPage * itemsPerPage;
|
|
|
|
|
const indexOfFirstItem = indexOfLastItem - itemsPerPage;
|
2026-05-26 15:48:01 +05:30
|
|
|
const currentItems = filteredDepartments.slice(indexOfFirstItem, indexOfLastItem);
|
2026-03-17 17:28:18 +05:30
|
|
|
|
2026-03-26 14:38:23 +05:30
|
|
|
function handleChange(e: any) {
|
2026-05-26 15:48:01 +05:30
|
|
|
const value = e.target.type === 'number' ? Number(e.target.value) : e.target.value;
|
|
|
|
|
setForm({ ...form, [e.target.name]: value });
|
2026-03-26 14:38:23 +05:30
|
|
|
}
|
|
|
|
|
|
2026-05-11 10:52:30 +05:30
|
|
|
const handleToggleStatus = async (dep: Department) => {
|
|
|
|
|
try {
|
2026-05-26 15:48:01 +05:30
|
|
|
const { departmentId, ...updateData } = dep;
|
2026-05-11 10:52:30 +05:30
|
|
|
await updateDepartmentApi(departmentId, {
|
|
|
|
|
...updateData,
|
|
|
|
|
isActive: !dep.isActive,
|
|
|
|
|
} as any);
|
|
|
|
|
fetchDepartments();
|
|
|
|
|
} catch (error) {
|
2026-05-26 15:48:01 +05:30
|
|
|
console.error('Failed to toggle status', error);
|
2026-05-11 10:52:30 +05:30
|
|
|
}
|
|
|
|
|
};
|
2026-03-16 17:55:33 +05:30
|
|
|
|
|
|
|
|
function openAdd() {
|
|
|
|
|
setEditing(null);
|
|
|
|
|
setForm({
|
2026-05-26 15:48:01 +05:30
|
|
|
departmentId: '',
|
|
|
|
|
name: '',
|
|
|
|
|
image: '',
|
|
|
|
|
para1: '',
|
|
|
|
|
para2: '',
|
|
|
|
|
para3: '',
|
|
|
|
|
facilities: '',
|
|
|
|
|
services: '',
|
2026-05-11 00:04:22 +05:30
|
|
|
isActive: true,
|
|
|
|
|
sortOrder: 0,
|
2026-03-16 17:55:33 +05:30
|
|
|
});
|
|
|
|
|
setOpenModal(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function openEdit(dep: Department) {
|
|
|
|
|
setEditing(dep);
|
2026-05-11 00:04:22 +05:30
|
|
|
setForm({
|
|
|
|
|
...dep,
|
|
|
|
|
isActive: dep.isActive ?? true,
|
|
|
|
|
sortOrder: dep.sortOrder ?? 0,
|
|
|
|
|
});
|
2026-03-16 17:55:33 +05:30
|
|
|
setOpenModal(true);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-26 14:38:23 +05:30
|
|
|
function openView(dep: Department) {
|
|
|
|
|
setViewData(dep);
|
|
|
|
|
setViewOpen(true);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-16 17:55:33 +05:30
|
|
|
async function handleSubmit() {
|
|
|
|
|
try {
|
|
|
|
|
if (editing) {
|
2026-05-26 15:48:01 +05:30
|
|
|
const { departmentId, ...updateData } = form;
|
2026-05-11 10:52:30 +05:30
|
|
|
await updateDepartmentApi(editing.departmentId, form as any);
|
2026-03-16 17:55:33 +05:30
|
|
|
} else {
|
|
|
|
|
await createDepartmentApi(form);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setOpenModal(false);
|
|
|
|
|
fetchDepartments();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="p-6 space-y-6">
|
2026-04-08 16:30:50 +05:30
|
|
|
<div className="flex flex-col md:flex-row md:justify-between md:items-center gap-4">
|
|
|
|
|
<h1 className="text-3xl font-bold">Departments</h1>
|
2026-03-16 17:55:33 +05:30
|
|
|
|
2026-03-17 17:28:18 +05:30
|
|
|
<div className="flex flex-wrap gap-3">
|
|
|
|
|
<Input
|
|
|
|
|
placeholder="Search department..."
|
|
|
|
|
value={searchText}
|
|
|
|
|
onChange={(e) => setSearchText(e.target.value)}
|
2026-04-08 16:30:50 +05:30
|
|
|
className="w-[250px] text-base"
|
2026-03-17 17:28:18 +05:30
|
|
|
/>
|
|
|
|
|
|
2026-05-26 15:48:01 +05:30
|
|
|
<Button variant="outline" onClick={fetchDepartments} disabled={loading} className="text-base">
|
2026-04-08 16:30:50 +05:30
|
|
|
<RefreshCw className="mr-2 h-5 w-5" />
|
2026-03-16 17:55:33 +05:30
|
|
|
Refresh
|
|
|
|
|
</Button>
|
|
|
|
|
|
2026-04-08 16:30:50 +05:30
|
|
|
<Button onClick={openAdd} className="text-base">
|
|
|
|
|
<Plus className="mr-2 h-5 w-5" />
|
2026-03-16 17:55:33 +05:30
|
|
|
Add Department
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-05-26 15:48:01 +05:30
|
|
|
{error && <div className="p-4 text-red-600 bg-red-50 border rounded-md text-base">{error}</div>}
|
2026-03-16 17:55:33 +05:30
|
|
|
|
|
|
|
|
<Card>
|
|
|
|
|
<CardHeader>
|
2026-04-08 16:30:50 +05:30
|
|
|
<CardTitle className="text-xl">Department List</CardTitle>
|
2026-03-16 17:55:33 +05:30
|
|
|
</CardHeader>
|
|
|
|
|
|
2026-04-08 16:30:50 +05:30
|
|
|
<CardContent className="p-0 sm:p-6 space-y-4">
|
|
|
|
|
<div className="rounded-md border overflow-x-auto overflow-y-auto max-h-[650px] relative">
|
2026-05-11 10:52:30 +05:30
|
|
|
<Table className="w-full min-w-[700px] table-fixed border-separate border-spacing-0">
|
2026-04-08 16:30:50 +05:30
|
|
|
<TableHeader className="sticky top-0 z-20 bg-background shadow-sm">
|
2026-03-16 17:55:33 +05:30
|
|
|
<TableRow>
|
2026-05-26 15:48:01 +05:30
|
|
|
<TableHead className="w-[100px] bg-background text-sm font-bold">Priority</TableHead>
|
|
|
|
|
<TableHead className="w-[300px] bg-background text-sm font-bold">Name</TableHead>
|
|
|
|
|
<TableHead className="w-[80px] bg-background text-sm font-bold">Status (Active)</TableHead>
|
|
|
|
|
<TableHead className="w-[80px] bg-background text-right text-sm font-bold">Actions</TableHead>
|
2026-03-16 17:55:33 +05:30
|
|
|
</TableRow>
|
|
|
|
|
</TableHeader>
|
|
|
|
|
|
|
|
|
|
<TableBody>
|
|
|
|
|
{loading ? (
|
|
|
|
|
<TableRow>
|
2026-05-11 10:52:30 +05:30
|
|
|
<TableCell colSpan={4} className="text-center py-10">
|
2026-04-08 16:30:50 +05:30
|
|
|
<Loader2 className="h-8 w-8 animate-spin mx-auto" />
|
2026-03-16 17:55:33 +05:30
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
2026-04-08 16:30:50 +05:30
|
|
|
) : currentItems.length === 0 ? (
|
2026-03-16 17:55:33 +05:30
|
|
|
<TableRow>
|
2026-05-26 15:48:01 +05:30
|
|
|
<TableCell colSpan={4} className="text-center text-muted-foreground py-10 text-base">
|
2026-03-16 17:55:33 +05:30
|
|
|
No departments found
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
) : (
|
2026-04-08 16:30:50 +05:30
|
|
|
currentItems.map((dep) => (
|
2026-05-26 15:48:01 +05:30
|
|
|
<TableRow key={dep.departmentId} className="hover:bg-muted/50">
|
|
|
|
|
<TableCell className="font-mono text-sm">{dep.sortOrder}</TableCell>
|
2026-03-16 17:55:33 +05:30
|
|
|
|
2026-03-26 14:38:23 +05:30
|
|
|
<TableCell>
|
2026-05-26 15:48:01 +05:30
|
|
|
<div className="font-semibold text-base truncate" title={dep.name}>
|
2026-04-08 16:30:50 +05:30
|
|
|
{dep.name}
|
|
|
|
|
</div>
|
2026-05-26 15:48:01 +05:30
|
|
|
<div className="text-xs text-muted-foreground">{dep.departmentId}</div>
|
2026-03-16 17:55:33 +05:30
|
|
|
</TableCell>
|
2026-03-26 14:38:23 +05:30
|
|
|
<TableCell>
|
2026-05-11 10:52:30 +05:30
|
|
|
<div className="flex items-center gap-2">
|
2026-05-26 15:48:01 +05:30
|
|
|
<Switch checked={dep.isActive} onCheckedChange={() => handleToggleStatus(dep)} />
|
|
|
|
|
<Badge variant={dep.isActive ? 'default' : 'secondary'}>
|
|
|
|
|
{dep.isActive ? 'Active' : 'Hidden'}
|
2026-05-11 10:52:30 +05:30
|
|
|
</Badge>
|
2026-03-26 14:38:23 +05:30
|
|
|
</div>
|
2026-03-16 17:55:33 +05:30
|
|
|
</TableCell>
|
|
|
|
|
|
2026-04-08 16:30:50 +05:30
|
|
|
<TableCell className="text-right">
|
|
|
|
|
<div className="flex justify-end gap-2">
|
2026-05-26 15:48:01 +05:30
|
|
|
<Button size="icon" variant="ghost" className="h-9 w-9" onClick={() => openView(dep)}>
|
2026-04-08 16:30:50 +05:30
|
|
|
<Eye className="h-4 w-4" />
|
|
|
|
|
</Button>
|
|
|
|
|
|
2026-05-26 15:48:01 +05:30
|
|
|
<Button size="icon" variant="ghost" className="h-9 w-9" onClick={() => openEdit(dep)}>
|
2026-04-08 16:30:50 +05:30
|
|
|
<Pencil className="h-4 w-4" />
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2026-03-16 17:55:33 +05:30
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
))
|
|
|
|
|
)}
|
|
|
|
|
</TableBody>
|
|
|
|
|
</Table>
|
|
|
|
|
</div>
|
2026-04-08 16:30:50 +05:30
|
|
|
|
|
|
|
|
{!loading && filteredDepartments.length > 0 && (
|
|
|
|
|
<div className="flex items-center justify-between px-2 py-6 border-t">
|
|
|
|
|
<div className="text-base text-muted-foreground">
|
2026-05-26 15:48:01 +05:30
|
|
|
Showing <span className="font-semibold">{indexOfFirstItem + 1}</span> to{' '}
|
|
|
|
|
<span className="font-semibold">{Math.min(indexOfLastItem, filteredDepartments.length)}</span> of{' '}
|
|
|
|
|
<span className="font-semibold">{filteredDepartments.length}</span> departments
|
2026-04-08 16:30:50 +05:30
|
|
|
</div>
|
|
|
|
|
<div className="flex items-center gap-6">
|
|
|
|
|
<div className="text-base font-semibold">
|
|
|
|
|
Page {currentPage} of {totalPages}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="flex gap-2">
|
|
|
|
|
<Button
|
|
|
|
|
variant="outline"
|
|
|
|
|
size="icon"
|
|
|
|
|
className="h-10 w-10"
|
2026-05-26 15:48:01 +05:30
|
|
|
onClick={() => setCurrentPage((prev) => Math.max(prev - 1, 1))}
|
2026-04-08 16:30:50 +05:30
|
|
|
disabled={currentPage === 1}
|
|
|
|
|
>
|
|
|
|
|
<ChevronLeft className="h-5 w-5" />
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
variant="outline"
|
|
|
|
|
size="icon"
|
|
|
|
|
className="h-10 w-10"
|
2026-05-26 15:48:01 +05:30
|
|
|
onClick={() => setCurrentPage((prev) => Math.min(prev + 1, totalPages))}
|
2026-04-08 16:30:50 +05:30
|
|
|
disabled={currentPage === totalPages || totalPages === 0}
|
|
|
|
|
>
|
|
|
|
|
<ChevronRight className="h-5 w-5" />
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-03-16 17:55:33 +05:30
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
<Dialog open={openModal} onOpenChange={setOpenModal}>
|
2026-03-26 14:38:23 +05:30
|
|
|
<DialogContent className="w-full !max-w-5xl max-h-[90vh] overflow-y-auto">
|
2026-03-16 17:55:33 +05:30
|
|
|
<DialogHeader>
|
2026-05-26 15:48:01 +05:30
|
|
|
<DialogTitle>{editing ? 'Edit Department' : 'Add Department'}</DialogTitle>
|
2026-03-16 17:55:33 +05:30
|
|
|
</DialogHeader>
|
|
|
|
|
|
2026-03-26 14:38:23 +05:30
|
|
|
<div className="space-y-4">
|
2026-04-14 17:33:21 +05:30
|
|
|
<div className="space-y-2">
|
|
|
|
|
<label className="text-sm font-semibold">Department Image</label>
|
|
|
|
|
<BytescaleUploader
|
|
|
|
|
value={form.image}
|
|
|
|
|
folderPath="/departments"
|
2026-05-26 15:48:01 +05:30
|
|
|
onChange={(url) => setForm({ ...form, image: url })}
|
2026-04-14 17:33:21 +05:30
|
|
|
/>
|
|
|
|
|
</div>
|
2026-03-16 17:55:33 +05:30
|
|
|
<Input
|
|
|
|
|
name="departmentId"
|
|
|
|
|
value={form.departmentId}
|
|
|
|
|
onChange={handleChange}
|
2026-03-17 13:11:00 +05:30
|
|
|
disabled={!!editing}
|
2026-03-26 14:38:23 +05:30
|
|
|
placeholder="Department ID"
|
2026-03-16 17:55:33 +05:30
|
|
|
/>
|
|
|
|
|
|
2026-05-26 15:48:01 +05:30
|
|
|
<Input name="name" value={form.name} onChange={handleChange} placeholder="Department Name" />
|
2026-03-16 17:55:33 +05:30
|
|
|
|
2026-05-26 15:48:01 +05:30
|
|
|
<Textarea name="para1" value={form.para1} onChange={handleChange} placeholder="Para1" />
|
|
|
|
|
<Textarea name="para2" value={form.para2} onChange={handleChange} placeholder="Para2" />
|
|
|
|
|
<Textarea name="para3" value={form.para3} onChange={handleChange} placeholder="Para3" />
|
|
|
|
|
<Textarea name="facilities" value={form.facilities} onChange={handleChange} placeholder="Facilities" />
|
|
|
|
|
<Textarea name="services" value={form.services} onChange={handleChange} placeholder="Services" />
|
2026-05-11 00:04:22 +05:30
|
|
|
|
|
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 border-t pt-4">
|
|
|
|
|
<div className="flex items-center justify-between p-3 border rounded-md">
|
|
|
|
|
<Label htmlFor="isActive" className="text-base cursor-pointer">
|
|
|
|
|
Active Visibility
|
|
|
|
|
</Label>
|
|
|
|
|
<Switch
|
|
|
|
|
id="isActive"
|
|
|
|
|
checked={form.isActive}
|
2026-05-26 15:48:01 +05:30
|
|
|
onCheckedChange={(val) => setForm({ ...form, isActive: val })}
|
2026-05-11 00:04:22 +05:30
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="space-y-1">
|
2026-05-26 15:48:01 +05:30
|
|
|
<Label htmlFor="sortOrder">Sort Priority (Lower numbers show first)</Label>
|
2026-05-11 00:04:22 +05:30
|
|
|
<Input
|
|
|
|
|
id="sortOrder"
|
|
|
|
|
name="sortOrder"
|
|
|
|
|
type="number"
|
|
|
|
|
value={form.sortOrder}
|
|
|
|
|
onChange={handleChange}
|
|
|
|
|
placeholder="0"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-03-16 17:55:33 +05:30
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<DialogFooter>
|
|
|
|
|
<Button variant="outline" onClick={() => setOpenModal(false)}>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
2026-05-26 15:48:01 +05:30
|
|
|
<Button onClick={handleSubmit}>{editing ? 'Save Changes' : 'Create'}</Button>
|
2026-03-16 17:55:33 +05:30
|
|
|
</DialogFooter>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
2026-03-26 14:38:23 +05:30
|
|
|
|
|
|
|
|
<Dialog open={viewOpen} onOpenChange={setViewOpen}>
|
|
|
|
|
<DialogContent className="w-full !max-w-5xl max-h-[90vh] overflow-y-auto">
|
|
|
|
|
<DialogHeader>
|
|
|
|
|
<DialogTitle>Department Details</DialogTitle>
|
|
|
|
|
</DialogHeader>
|
|
|
|
|
{viewData && (
|
|
|
|
|
<div className="space-y-4 text-sm">
|
2026-05-11 00:04:22 +05:30
|
|
|
<div className="flex gap-4 items-center border-b pb-4">
|
2026-05-26 15:48:01 +05:30
|
|
|
<Badge variant={viewData.isActive ? 'default' : 'secondary'}>
|
|
|
|
|
{viewData.isActive ? 'ACTIVE' : 'HIDDEN'}
|
2026-05-11 00:04:22 +05:30
|
|
|
</Badge>
|
|
|
|
|
<p>
|
|
|
|
|
<b>Sort Order:</b> {viewData.sortOrder}
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<b>ID:</b> {viewData.departmentId}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2026-03-26 14:38:23 +05:30
|
|
|
<p>
|
|
|
|
|
<b>Name:</b> {viewData.name}
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<b>Para1:</b>
|
|
|
|
|
<br />
|
|
|
|
|
{viewData.para1}
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<b>Para2:</b>
|
|
|
|
|
<br />
|
|
|
|
|
{viewData.para2}
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<b>Para3:</b>
|
|
|
|
|
<br />
|
|
|
|
|
{viewData.para3}
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<b>Facilities:</b>
|
|
|
|
|
<br />
|
|
|
|
|
{viewData.facilities}
|
|
|
|
|
</p>
|
|
|
|
|
<p>
|
|
|
|
|
<b>Services:</b>
|
|
|
|
|
<br />
|
|
|
|
|
{viewData.services}
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
<DialogFooter>
|
|
|
|
|
<Button onClick={() => setViewOpen(false)}>Close</Button>
|
|
|
|
|
</DialogFooter>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
2026-03-16 17:55:33 +05:30
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|