@omersx/bemms 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +203 -2
- package/drizzle.config.ts +11 -0
- package/next.config.ts +51 -0
- package/package.json +99 -3
- package/postcss.config.mjs +7 -0
- package/public/hospital_demo_devices.csv +32 -0
- package/public/icons/icon-192.png +0 -0
- package/public/icons/icon-512.png +0 -0
- package/public/icons/icon-maskable-512.png +0 -0
- package/public/manifest.webmanifest +31 -0
- package/public/sw.js +177 -0
- package/src/app/(auth)/layout.tsx +20 -0
- package/src/app/(auth)/login/page.tsx +135 -0
- package/src/app/(dashboard)/admin/audit-logs/page.tsx +178 -0
- package/src/app/(dashboard)/admin/data/page.tsx +37 -0
- package/src/app/(dashboard)/admin/departments/[deptId]/edit/page.tsx +206 -0
- package/src/app/(dashboard)/admin/departments/[deptId]/page.tsx +71 -0
- package/src/app/(dashboard)/admin/departments/new/page.tsx +6 -0
- package/src/app/(dashboard)/admin/departments/page.tsx +6 -0
- package/src/app/(dashboard)/admin/general/page.tsx +374 -0
- package/src/app/(dashboard)/admin/hospitals/[hospitalId]/edit/page.tsx +304 -0
- package/src/app/(dashboard)/admin/hospitals/[hospitalId]/page.tsx +94 -0
- package/src/app/(dashboard)/admin/hospitals/new/page.tsx +302 -0
- package/src/app/(dashboard)/admin/hospitals/page.tsx +6 -0
- package/src/app/(dashboard)/admin/layout.tsx +49 -0
- package/src/app/(dashboard)/admin/organizations/[orgId]/edit/page.tsx +172 -0
- package/src/app/(dashboard)/admin/organizations/[orgId]/page.tsx +82 -0
- package/src/app/(dashboard)/admin/organizations/new/page.tsx +150 -0
- package/src/app/(dashboard)/admin/organizations/page.tsx +6 -0
- package/src/app/(dashboard)/admin/page.tsx +258 -0
- package/src/app/(dashboard)/admin/roles/page.tsx +153 -0
- package/src/app/(dashboard)/admin/settings/page.tsx +69 -0
- package/src/app/(dashboard)/admin/users/[userId]/edit/page.tsx +153 -0
- package/src/app/(dashboard)/admin/users/[userId]/page.tsx +317 -0
- package/src/app/(dashboard)/admin/users/invite/page.tsx +3 -0
- package/src/app/(dashboard)/admin/users/new/page.tsx +5 -0
- package/src/app/(dashboard)/admin/users/page.tsx +23 -0
- package/src/app/(dashboard)/dashboard/page.tsx +462 -0
- package/src/app/(dashboard)/departments/[deptId]/page.tsx +39 -0
- package/src/app/(dashboard)/departments/new/page.tsx +330 -0
- package/src/app/(dashboard)/departments/page.tsx +52 -0
- package/src/app/(dashboard)/devices/[id]/edit/page.tsx +131 -0
- package/src/app/(dashboard)/devices/[id]/page.tsx +408 -0
- package/src/app/(dashboard)/devices/[id]/qr/page.tsx +54 -0
- package/src/app/(dashboard)/devices/new/page.tsx +382 -0
- package/src/app/(dashboard)/devices/page.tsx +80 -0
- package/src/app/(dashboard)/engineering-team/page.tsx +41 -0
- package/src/app/(dashboard)/layout.tsx +43 -0
- package/src/app/(dashboard)/maintenance/checklists/page.tsx +57 -0
- package/src/app/(dashboard)/maintenance/page.tsx +231 -0
- package/src/app/(dashboard)/maintenance/plans/page.tsx +142 -0
- package/src/app/(dashboard)/maintenance/tasks/[id]/page.tsx +997 -0
- package/src/app/(dashboard)/maintenance/tasks/page.tsx +119 -0
- package/src/app/(dashboard)/more/page.tsx +310 -0
- package/src/app/(dashboard)/my-department/page.tsx +151 -0
- package/src/app/(dashboard)/notifications/notification-list.tsx +103 -0
- package/src/app/(dashboard)/notifications/page.tsx +59 -0
- package/src/app/(dashboard)/profile/page.tsx +27 -0
- package/src/app/(dashboard)/reports/costs/page.tsx +127 -0
- package/src/app/(dashboard)/reports/history/page.tsx +105 -0
- package/src/app/(dashboard)/reports/inventory/page.tsx +116 -0
- package/src/app/(dashboard)/reports/maintenance/page.tsx +136 -0
- package/src/app/(dashboard)/reports/page.tsx +120 -0
- package/src/app/(dashboard)/reports/tickets/page.tsx +139 -0
- package/src/app/(dashboard)/reports/workload/page.tsx +135 -0
- package/src/app/(dashboard)/rounds/[id]/page.tsx +197 -0
- package/src/app/(dashboard)/rounds/history/page.tsx +82 -0
- package/src/app/(dashboard)/rounds/page.tsx +107 -0
- package/src/app/(dashboard)/scan/[code]/page.tsx +154 -0
- package/src/app/(dashboard)/scan/page.tsx +73 -0
- package/src/app/(dashboard)/team/page.tsx +42 -0
- package/src/app/(dashboard)/tickets/[id]/page.tsx +465 -0
- package/src/app/(dashboard)/tickets/create/page.tsx +722 -0
- package/src/app/(dashboard)/tickets/page.tsx +55 -0
- package/src/app/(dashboard)/tickets/triage/page.tsx +161 -0
- package/src/app/api/admin/data/export/route.ts +316 -0
- package/src/app/api/auth/[...nextauth]/route.ts +3 -0
- package/src/app/api/health/route.ts +46 -0
- package/src/app/api/notifications/sse/route.ts +91 -0
- package/src/app/api/notifications/subscribe/route.ts +54 -0
- package/src/app/api/notifications/vapid-key/route.ts +7 -0
- package/src/app/api/reports/export/route.ts +102 -0
- package/src/app/api/tickets/[id]/attachments/route.ts +129 -0
- package/src/app/api/tickets/[id]/live-sync/route.ts +52 -0
- package/src/app/error.tsx +54 -0
- package/src/app/globals.css +89 -0
- package/src/app/layout.tsx +59 -0
- package/src/app/not-found.tsx +32 -0
- package/src/app/page.tsx +5 -0
- package/src/components/admin/add-department-user-dialog.tsx +759 -0
- package/src/components/admin/add-engineer-dialog.tsx +773 -0
- package/src/components/admin/add-user-type-dialog.tsx +89 -0
- package/src/components/admin/audit-log-export.tsx +113 -0
- package/src/components/admin/audit-log-filters.tsx +255 -0
- package/src/components/admin/audit-log-table.tsx +383 -0
- package/src/components/admin/data-management/danger-zone.tsx +301 -0
- package/src/components/admin/data-management/data-management-tabs.tsx +61 -0
- package/src/components/admin/data-management/export-center.tsx +301 -0
- package/src/components/admin/data-management/import-wizard.tsx +558 -0
- package/src/components/admin/settings-forms/features-form.tsx +115 -0
- package/src/components/admin/settings-forms/health-panel.tsx +182 -0
- package/src/components/admin/settings-forms/localization-form.tsx +203 -0
- package/src/components/admin/settings-forms/retention-form.tsx +164 -0
- package/src/components/admin/settings-forms/security-form.tsx +186 -0
- package/src/components/admin/system-settings-tabs.tsx +88 -0
- package/src/components/admin/user-role-dialog.tsx +293 -0
- package/src/components/admin/user-status-dialog.tsx +166 -0
- package/src/components/admin/users-page-client.tsx +514 -0
- package/src/components/dashboard/action-buttons.tsx +93 -0
- package/src/components/dashboard/admin-alerts.tsx +86 -0
- package/src/components/dashboard/availability-alerts.tsx +65 -0
- package/src/components/dashboard/maintenance-due-list.tsx +87 -0
- package/src/components/dashboard/round-widget.tsx +110 -0
- package/src/components/dashboard/stat-card.tsx +38 -0
- package/src/components/dashboard/ticket-list-compact.tsx +86 -0
- package/src/components/departments/department-cards-view.tsx +244 -0
- package/src/components/departments/department-detail-view.tsx +467 -0
- package/src/components/departments/department-visuals.tsx +190 -0
- package/src/components/departments/my-department-view.tsx +333 -0
- package/src/components/devices/change-status-dialog.tsx +146 -0
- package/src/components/devices/device-action-buttons.tsx +125 -0
- package/src/components/devices/device-availability-banner.tsx +59 -0
- package/src/components/devices/device-badges.tsx +55 -0
- package/src/components/devices/device-documents-tab.tsx +93 -0
- package/src/components/devices/device-maintenance-tab.tsx +113 -0
- package/src/components/devices/device-mini-qr.tsx +109 -0
- package/src/components/devices/device-qr-card.tsx +187 -0
- package/src/components/devices/device-signatures-tab.tsx +607 -0
- package/src/components/devices/device-tickets-tab.tsx +139 -0
- package/src/components/devices/device-timelines.tsx +124 -0
- package/src/components/devices/qr-camera-scanner.tsx +167 -0
- package/src/components/devices/qr-code-display.tsx +139 -0
- package/src/components/devices/quick-add-category-dialog.tsx +135 -0
- package/src/components/devices/quick-add-manufacturer-dialog.tsx +212 -0
- package/src/components/devices/transfer-device-dialog.tsx +190 -0
- package/src/components/layout/header.tsx +80 -0
- package/src/components/layout/mobile-nav.tsx +91 -0
- package/src/components/layout/more-item-badge.tsx +15 -0
- package/src/components/layout/nav-badge.tsx +72 -0
- package/src/components/layout/sidebar.tsx +297 -0
- package/src/components/maintenance/maintenance-badges.tsx +579 -0
- package/src/components/maintenance/maintenance-nav.tsx +107 -0
- package/src/components/maintenance/parts-costs-manager.tsx +909 -0
- package/src/components/maintenance/signature-card.tsx +413 -0
- package/src/components/maintenance/task-action-bar.tsx +955 -0
- package/src/components/notifications/notification-bell.tsx +367 -0
- package/src/components/notifications/notification-item.tsx +93 -0
- package/src/components/notifications/notification-preferences.tsx +182 -0
- package/src/components/profile/user-profile-view.tsx +626 -0
- package/src/components/providers/nav-counts-provider.tsx +235 -0
- package/src/components/providers/session-provider.tsx +7 -0
- package/src/components/providers/theme-provider.tsx +124 -0
- package/src/components/pwa/install-prompt.tsx +82 -0
- package/src/components/pwa/sw-register.tsx +43 -0
- package/src/components/reports/export-button.tsx +62 -0
- package/src/components/reports/filter-chips.tsx +47 -0
- package/src/components/reports/summary-cards.tsx +40 -0
- package/src/components/reports/transparency-header.tsx +54 -0
- package/src/components/rounds/department-visit-sheet.tsx +199 -0
- package/src/components/rounds/mention-textarea.tsx +187 -0
- package/src/components/rounds/round-calendar.tsx +233 -0
- package/src/components/rounds/round-department-list.tsx +281 -0
- package/src/components/rounds/round-history-client.tsx +218 -0
- package/src/components/rounds/start-round-card.tsx +184 -0
- package/src/components/shared/confirm-dialog.tsx +67 -0
- package/src/components/shared/data-table.tsx +104 -0
- package/src/components/shared/page-header.tsx +20 -0
- package/src/components/shared/sign-out-button.tsx +52 -0
- package/src/components/shared/status-badge.tsx +42 -0
- package/src/components/shared/table-search.tsx +55 -0
- package/src/components/signatures/sign-action-dialog.tsx +253 -0
- package/src/components/signatures/signature-history.tsx +121 -0
- package/src/components/signatures/signature-status-panel.tsx +164 -0
- package/src/components/team/department-coverage.tsx +141 -0
- package/src/components/team/edit-engineer-dialog.tsx +242 -0
- package/src/components/team/engineer-card.tsx +180 -0
- package/src/components/team/engineer-details-dialog.tsx +432 -0
- package/src/components/team/schedule-calendar.tsx +204 -0
- package/src/components/team/staff-engineer-team-view.tsx +368 -0
- package/src/components/team/team-header-stats.tsx +88 -0
- package/src/components/team/team-page-client.tsx +216 -0
- package/src/components/theme/theme-selector-card.tsx +63 -0
- package/src/components/theme/theme-toggle.tsx +65 -0
- package/src/components/tickets/staff-status-label.tsx +58 -0
- package/src/components/tickets/staff-ticket-card.tsx +109 -0
- package/src/components/tickets/staff-ticket-progress-tracker.tsx +405 -0
- package/src/components/tickets/staff-tickets-view.tsx +182 -0
- package/src/components/tickets/ticket-action-buttons.tsx +873 -0
- package/src/components/tickets/ticket-auto-refresh.tsx +197 -0
- package/src/components/tickets/ticket-badges.tsx +43 -0
- package/src/components/tickets/ticket-card.tsx +197 -0
- package/src/components/tickets/ticket-cards-view.tsx +395 -0
- package/src/components/tickets/ticket-comment-section.tsx +684 -0
- package/src/components/tickets/ticket-dispatch-status.tsx +184 -0
- package/src/components/tickets/ticket-list-auto-refresh.tsx +55 -0
- package/src/components/tickets/ticket-reporter-profile.tsx +235 -0
- package/src/components/tickets/ticket-signatures-panel.tsx +32 -0
- package/src/components/tickets/ticket-timeline.tsx +131 -0
- package/src/components/tickets/ticket-triage-panel.tsx +124 -0
- package/src/components/tickets/tickets-nav.tsx +107 -0
- package/src/components/ui/avatar.tsx +43 -0
- package/src/components/ui/badge.tsx +34 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +77 -0
- package/src/components/ui/checkbox.tsx +31 -0
- package/src/components/ui/dialog.tsx +123 -0
- package/src/components/ui/dropdown-menu.tsx +126 -0
- package/src/components/ui/form.tsx +179 -0
- package/src/components/ui/input.tsx +24 -0
- package/src/components/ui/label.tsx +27 -0
- package/src/components/ui/popover.tsx +34 -0
- package/src/components/ui/progress.tsx +36 -0
- package/src/components/ui/scroll-area.tsx +47 -0
- package/src/components/ui/select.tsx +160 -0
- package/src/components/ui/separator.tsx +25 -0
- package/src/components/ui/sheet.tsx +131 -0
- package/src/components/ui/switch.tsx +30 -0
- package/src/components/ui/table.tsx +121 -0
- package/src/components/ui/tabs.tsx +62 -0
- package/src/components/ui/textarea.tsx +23 -0
- package/src/components/ui/tooltip.tsx +27 -0
- package/src/lib/actions/__tests__/devices.test.ts +176 -0
- package/src/lib/actions/__tests__/signatures.test.ts +303 -0
- package/src/lib/actions/__tests__/tickets.test.ts +243 -0
- package/src/lib/actions/audit-logs.ts +298 -0
- package/src/lib/actions/checklists.ts +429 -0
- package/src/lib/actions/dashboard.ts +358 -0
- package/src/lib/actions/data-management.ts +723 -0
- package/src/lib/actions/departments.ts +369 -0
- package/src/lib/actions/device-categories.ts +117 -0
- package/src/lib/actions/devices.ts +748 -0
- package/src/lib/actions/engineer-rounds.ts +973 -0
- package/src/lib/actions/engineers.ts +285 -0
- package/src/lib/actions/hospitals.ts +148 -0
- package/src/lib/actions/locations.ts +115 -0
- package/src/lib/actions/maintenance-plans.ts +316 -0
- package/src/lib/actions/maintenance-tasks.ts +415 -0
- package/src/lib/actions/manufacturers.ts +132 -0
- package/src/lib/actions/nav-counts.ts +144 -0
- package/src/lib/actions/notifications.ts +136 -0
- package/src/lib/actions/organizations.ts +99 -0
- package/src/lib/actions/qr.ts +147 -0
- package/src/lib/actions/report-history.ts +77 -0
- package/src/lib/actions/reports.ts +192 -0
- package/src/lib/actions/roles.ts +32 -0
- package/src/lib/actions/signature-auth.ts +377 -0
- package/src/lib/actions/signatures.ts +532 -0
- package/src/lib/actions/system-settings.ts +274 -0
- package/src/lib/actions/tickets.ts +1445 -0
- package/src/lib/actions/users.ts +740 -0
- package/src/lib/audit/index.ts +103 -0
- package/src/lib/auth/__tests__/rbac.test.ts +33 -0
- package/src/lib/auth/index.ts +338 -0
- package/src/lib/auth/password.ts +10 -0
- package/src/lib/auth/rbac.ts +103 -0
- package/src/lib/auth/types.ts +57 -0
- package/src/lib/constants/departments.ts +16 -0
- package/src/lib/constants/manufacturers.ts +32 -0
- package/src/lib/db/index.ts +23 -0
- package/src/lib/db/schema/audit-logs.ts +42 -0
- package/src/lib/db/schema/departments.ts +39 -0
- package/src/lib/db/schema/device-categories.ts +38 -0
- package/src/lib/db/schema/devices.ts +195 -0
- package/src/lib/db/schema/engineer-profiles.ts +63 -0
- package/src/lib/db/schema/engineer-rounds.ts +115 -0
- package/src/lib/db/schema/enums.ts +148 -0
- package/src/lib/db/schema/hospitals.ts +34 -0
- package/src/lib/db/schema/index.ts +24 -0
- package/src/lib/db/schema/locations.ts +46 -0
- package/src/lib/db/schema/maintenance-plans.ts +99 -0
- package/src/lib/db/schema/maintenance-records.ts +161 -0
- package/src/lib/db/schema/maintenance-tasks.ts +196 -0
- package/src/lib/db/schema/manufacturers.ts +60 -0
- package/src/lib/db/schema/notifications.ts +48 -0
- package/src/lib/db/schema/organizations.ts +24 -0
- package/src/lib/db/schema/report-history.ts +28 -0
- package/src/lib/db/schema/roles.ts +59 -0
- package/src/lib/db/schema/sessions.ts +46 -0
- package/src/lib/db/schema/signature-events.ts +48 -0
- package/src/lib/db/schema/signature-policies.ts +60 -0
- package/src/lib/db/schema/signatures.ts +87 -0
- package/src/lib/db/schema/tickets.ts +169 -0
- package/src/lib/db/schema/user-assignments.ts +85 -0
- package/src/lib/db/schema/users.ts +39 -0
- package/src/lib/db/seed.ts +131 -0
- package/src/lib/logger/__tests__/logger.test.ts +154 -0
- package/src/lib/logger/formatters.ts +159 -0
- package/src/lib/logger/index.ts +184 -0
- package/src/lib/logger/types.ts +48 -0
- package/src/lib/notifications/create.ts +71 -0
- package/src/lib/notifications/dispatcher.ts +490 -0
- package/src/lib/notifications/index.ts +7 -0
- package/src/lib/notifications/push-sender.ts +128 -0
- package/src/lib/notifications/push.ts +64 -0
- package/src/lib/notifications/triggers.ts +166 -0
- package/src/lib/utils/__tests__/crypto.test.ts +30 -0
- package/src/lib/utils/__tests__/export.test.ts +55 -0
- package/src/lib/utils/__tests__/nav-badge.test.ts +147 -0
- package/src/lib/utils/__tests__/staff-status.test.ts +50 -0
- package/src/lib/utils/attestations.ts +19 -0
- package/src/lib/utils/crypto.ts +18 -0
- package/src/lib/utils/csv-parser.ts +181 -0
- package/src/lib/utils/export.ts +45 -0
- package/src/lib/utils/nav-badge.ts +225 -0
- package/src/lib/utils/sound.ts +152 -0
- package/src/lib/utils/staff-status.ts +115 -0
- package/src/lib/utils.ts +6 -0
- package/src/lib/validators/__tests__/auth.test.ts +127 -0
- package/src/lib/validators/__tests__/data-management.test.ts +182 -0
- package/src/lib/validators/__tests__/devices-profile.test.ts +129 -0
- package/src/lib/validators/__tests__/devices.test.ts +98 -0
- package/src/lib/validators/__tests__/engineer-rounds.test.ts +170 -0
- package/src/lib/validators/__tests__/maintenance.test.ts +178 -0
- package/src/lib/validators/__tests__/signatures.test.ts +154 -0
- package/src/lib/validators/__tests__/system-settings.test.ts +119 -0
- package/src/lib/validators/__tests__/tickets.test.ts +176 -0
- package/src/lib/validators/__tests__/users.test.ts +92 -0
- package/src/lib/validators/auth.ts +32 -0
- package/src/lib/validators/data-management.ts +67 -0
- package/src/lib/validators/departments.ts +14 -0
- package/src/lib/validators/devices.ts +94 -0
- package/src/lib/validators/engineer-rounds.ts +70 -0
- package/src/lib/validators/hospitals.ts +17 -0
- package/src/lib/validators/locations.ts +15 -0
- package/src/lib/validators/maintenance.ts +211 -0
- package/src/lib/validators/organizations.ts +11 -0
- package/src/lib/validators/reports.ts +31 -0
- package/src/lib/validators/signatures.ts +49 -0
- package/src/lib/validators/system-settings.ts +55 -0
- package/src/lib/validators/tickets.ts +125 -0
- package/src/lib/validators/users.ts +43 -0
- package/src/middleware.ts +45 -0
- package/tailwind.config.ts +76 -0
- package/tsconfig.json +28 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PageHeader } from "@/components/shared/page-header";
|
|
2
|
+
import { Button } from "@/components/ui/button";
|
|
3
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
4
|
+
import { StatusBadge } from "@/components/shared/status-badge";
|
|
5
|
+
import Link from "next/link";
|
|
6
|
+
import { getHospitalById } from "@/lib/actions/hospitals";
|
|
7
|
+
import { notFound } from "next/navigation";
|
|
8
|
+
|
|
9
|
+
export default async function HospitalDetailPage({ params }: { params: Promise<{ hospitalId: string }> }) {
|
|
10
|
+
const { hospitalId } = await params;
|
|
11
|
+
const result = await getHospitalById(hospitalId);
|
|
12
|
+
|
|
13
|
+
if (!result.success || !result.data) {
|
|
14
|
+
notFound();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const hospital = result.data;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className="space-y-6">
|
|
21
|
+
<PageHeader title={hospital.name} description="Hospital details">
|
|
22
|
+
<Button variant="outline" asChild>
|
|
23
|
+
<Link href={`/admin/hospitals/${hospital.id}/edit`}>Edit</Link>
|
|
24
|
+
</Button>
|
|
25
|
+
<Button variant="destructive">Archive</Button>
|
|
26
|
+
</PageHeader>
|
|
27
|
+
|
|
28
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
29
|
+
<Card>
|
|
30
|
+
<CardHeader>
|
|
31
|
+
<CardTitle>Basic Information</CardTitle>
|
|
32
|
+
</CardHeader>
|
|
33
|
+
<CardContent className="space-y-4">
|
|
34
|
+
<div>
|
|
35
|
+
<div className="text-sm font-medium text-muted-foreground">Code</div>
|
|
36
|
+
<div>{hospital.code}</div>
|
|
37
|
+
</div>
|
|
38
|
+
<div>
|
|
39
|
+
<div className="text-sm font-medium text-muted-foreground">Organization</div>
|
|
40
|
+
<div>{(hospital as any).organizationName || hospital.organizationId}</div>
|
|
41
|
+
</div>
|
|
42
|
+
<div>
|
|
43
|
+
<div className="text-sm font-medium text-muted-foreground">Status</div>
|
|
44
|
+
<div className="mt-1">
|
|
45
|
+
<StatusBadge status={hospital.status} />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<div>
|
|
49
|
+
<div className="text-sm font-medium text-muted-foreground">Timezone</div>
|
|
50
|
+
<div>{hospital.timezone}</div>
|
|
51
|
+
</div>
|
|
52
|
+
</CardContent>
|
|
53
|
+
</Card>
|
|
54
|
+
|
|
55
|
+
<Card>
|
|
56
|
+
<CardHeader>
|
|
57
|
+
<CardTitle>Location & Contact</CardTitle>
|
|
58
|
+
</CardHeader>
|
|
59
|
+
<CardContent className="space-y-4">
|
|
60
|
+
<div>
|
|
61
|
+
<div className="text-sm font-medium text-muted-foreground">Address</div>
|
|
62
|
+
<div>{hospital.address}</div>
|
|
63
|
+
<div>{hospital.city}, {hospital.country}</div>
|
|
64
|
+
</div>
|
|
65
|
+
<div>
|
|
66
|
+
<div className="text-sm font-medium text-muted-foreground">Phone</div>
|
|
67
|
+
<div>{hospital.phone || "N/A"}</div>
|
|
68
|
+
</div>
|
|
69
|
+
<div>
|
|
70
|
+
<div className="text-sm font-medium text-muted-foreground">Email</div>
|
|
71
|
+
<div>{hospital.email || "N/A"}</div>
|
|
72
|
+
</div>
|
|
73
|
+
</CardContent>
|
|
74
|
+
</Card>
|
|
75
|
+
|
|
76
|
+
<Card>
|
|
77
|
+
<CardHeader>
|
|
78
|
+
<CardTitle>Settings</CardTitle>
|
|
79
|
+
</CardHeader>
|
|
80
|
+
<CardContent className="space-y-4">
|
|
81
|
+
<div>
|
|
82
|
+
<div className="text-sm font-medium text-muted-foreground">Created At</div>
|
|
83
|
+
<div>{new Date(hospital.createdAt || Date.now()).toLocaleDateString()}</div>
|
|
84
|
+
</div>
|
|
85
|
+
<div>
|
|
86
|
+
<div className="text-sm font-medium text-muted-foreground">Updated At</div>
|
|
87
|
+
<div>{new Date(hospital.updatedAt || Date.now()).toLocaleDateString()}</div>
|
|
88
|
+
</div>
|
|
89
|
+
</CardContent>
|
|
90
|
+
</Card>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { PageHeader } from "@/components/shared/page-header";
|
|
4
|
+
import { Button } from "@/components/ui/button";
|
|
5
|
+
import {
|
|
6
|
+
Form,
|
|
7
|
+
FormControl,
|
|
8
|
+
FormField,
|
|
9
|
+
FormItem,
|
|
10
|
+
FormLabel,
|
|
11
|
+
FormMessage,
|
|
12
|
+
} from "@/components/ui/form";
|
|
13
|
+
import { Input } from "@/components/ui/input";
|
|
14
|
+
import {
|
|
15
|
+
Select,
|
|
16
|
+
SelectContent,
|
|
17
|
+
SelectItem,
|
|
18
|
+
SelectTrigger,
|
|
19
|
+
SelectValue,
|
|
20
|
+
} from "@/components/ui/select";
|
|
21
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
22
|
+
import { useForm } from "react-hook-form";
|
|
23
|
+
import * as z from "zod";
|
|
24
|
+
import { useRouter } from "next/navigation";
|
|
25
|
+
import { useEffect, useState } from "react";
|
|
26
|
+
import { createHospital } from "@/lib/actions/hospitals";
|
|
27
|
+
import { getOrganizations } from "@/lib/actions/organizations";
|
|
28
|
+
import { toast } from "sonner";
|
|
29
|
+
import { Loader2 } from "lucide-react";
|
|
30
|
+
|
|
31
|
+
const formSchema = z.object({
|
|
32
|
+
organizationId: z.string().min(1, "Please select an organization"),
|
|
33
|
+
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
34
|
+
code: z.string().min(2, "Code must be at least 2 characters").toUpperCase(),
|
|
35
|
+
address: z.string().optional().or(z.literal("")),
|
|
36
|
+
city: z.string().optional().or(z.literal("")),
|
|
37
|
+
country: z.string().optional().or(z.literal("")),
|
|
38
|
+
phone: z.string().optional().or(z.literal("")),
|
|
39
|
+
email: z.string().email("Invalid email").optional().or(z.literal("")),
|
|
40
|
+
timezone: z.string().min(1, "Please select a timezone"),
|
|
41
|
+
status: z.enum(["active", "inactive"]),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export default function NewHospitalPage() {
|
|
45
|
+
const router = useRouter();
|
|
46
|
+
const [organizations, setOrganizations] = useState<any[]>([]);
|
|
47
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
48
|
+
|
|
49
|
+
const form = useForm<z.infer<typeof formSchema>>({
|
|
50
|
+
resolver: zodResolver(formSchema),
|
|
51
|
+
defaultValues: {
|
|
52
|
+
organizationId: "",
|
|
53
|
+
name: "",
|
|
54
|
+
code: "",
|
|
55
|
+
address: "",
|
|
56
|
+
city: "",
|
|
57
|
+
country: "",
|
|
58
|
+
phone: "",
|
|
59
|
+
email: "",
|
|
60
|
+
timezone: "UTC",
|
|
61
|
+
status: "active",
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
async function loadOrgs() {
|
|
67
|
+
const result = await getOrganizations();
|
|
68
|
+
if (result?.success && result.data && result.data.length > 0) {
|
|
69
|
+
setOrganizations(result.data);
|
|
70
|
+
if (!form.getValues("organizationId")) {
|
|
71
|
+
form.setValue("organizationId", result.data[0].id);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
loadOrgs();
|
|
76
|
+
}, [form]);
|
|
77
|
+
|
|
78
|
+
async function onSubmit(values: z.infer<typeof formSchema>) {
|
|
79
|
+
setIsSubmitting(true);
|
|
80
|
+
try {
|
|
81
|
+
const result = await createHospital(values);
|
|
82
|
+
if (result.success) {
|
|
83
|
+
toast.success("Hospital registered successfully!");
|
|
84
|
+
router.push("/admin/general");
|
|
85
|
+
router.refresh();
|
|
86
|
+
} else {
|
|
87
|
+
toast.error((result as any).error || "Failed to create hospital");
|
|
88
|
+
}
|
|
89
|
+
} catch (err: any) {
|
|
90
|
+
toast.error(err.message || "An unexpected error occurred");
|
|
91
|
+
} finally {
|
|
92
|
+
setIsSubmitting(false);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<div className="space-y-6 max-w-2xl">
|
|
98
|
+
<PageHeader title="Add Hospital" description="Register a new hospital" />
|
|
99
|
+
|
|
100
|
+
<Form {...form}>
|
|
101
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
|
102
|
+
<FormField
|
|
103
|
+
control={form.control}
|
|
104
|
+
name="organizationId"
|
|
105
|
+
render={({ field }) => (
|
|
106
|
+
<FormItem>
|
|
107
|
+
<FormLabel>Organization</FormLabel>
|
|
108
|
+
<Select onValueChange={field.onChange} value={field.value || undefined}>
|
|
109
|
+
<FormControl>
|
|
110
|
+
<SelectTrigger>
|
|
111
|
+
<SelectValue placeholder="Select an organization" />
|
|
112
|
+
</SelectTrigger>
|
|
113
|
+
</FormControl>
|
|
114
|
+
<SelectContent>
|
|
115
|
+
{organizations.map((org) => (
|
|
116
|
+
<SelectItem key={org.id} value={org.id}>
|
|
117
|
+
{org.name}
|
|
118
|
+
</SelectItem>
|
|
119
|
+
))}
|
|
120
|
+
</SelectContent>
|
|
121
|
+
</Select>
|
|
122
|
+
<FormMessage />
|
|
123
|
+
</FormItem>
|
|
124
|
+
)}
|
|
125
|
+
/>
|
|
126
|
+
|
|
127
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
128
|
+
<FormField
|
|
129
|
+
control={form.control}
|
|
130
|
+
name="name"
|
|
131
|
+
render={({ field }) => (
|
|
132
|
+
<FormItem>
|
|
133
|
+
<FormLabel>Name</FormLabel>
|
|
134
|
+
<FormControl>
|
|
135
|
+
<Input placeholder="General Hospital" {...field} />
|
|
136
|
+
</FormControl>
|
|
137
|
+
<FormMessage />
|
|
138
|
+
</FormItem>
|
|
139
|
+
)}
|
|
140
|
+
/>
|
|
141
|
+
|
|
142
|
+
<FormField
|
|
143
|
+
control={form.control}
|
|
144
|
+
name="code"
|
|
145
|
+
render={({ field }) => (
|
|
146
|
+
<FormItem>
|
|
147
|
+
<FormLabel>Code</FormLabel>
|
|
148
|
+
<FormControl>
|
|
149
|
+
<Input placeholder="GEN" {...field} />
|
|
150
|
+
</FormControl>
|
|
151
|
+
<FormMessage />
|
|
152
|
+
</FormItem>
|
|
153
|
+
)}
|
|
154
|
+
/>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<FormField
|
|
158
|
+
control={form.control}
|
|
159
|
+
name="address"
|
|
160
|
+
render={({ field }) => (
|
|
161
|
+
<FormItem>
|
|
162
|
+
<FormLabel>Address</FormLabel>
|
|
163
|
+
<FormControl>
|
|
164
|
+
<Input placeholder="123 Health Ave" {...field} />
|
|
165
|
+
</FormControl>
|
|
166
|
+
<FormMessage />
|
|
167
|
+
</FormItem>
|
|
168
|
+
)}
|
|
169
|
+
/>
|
|
170
|
+
|
|
171
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
172
|
+
<FormField
|
|
173
|
+
control={form.control}
|
|
174
|
+
name="city"
|
|
175
|
+
render={({ field }) => (
|
|
176
|
+
<FormItem>
|
|
177
|
+
<FormLabel>City</FormLabel>
|
|
178
|
+
<FormControl>
|
|
179
|
+
<Input placeholder="Metropolis" {...field} />
|
|
180
|
+
</FormControl>
|
|
181
|
+
<FormMessage />
|
|
182
|
+
</FormItem>
|
|
183
|
+
)}
|
|
184
|
+
/>
|
|
185
|
+
|
|
186
|
+
<FormField
|
|
187
|
+
control={form.control}
|
|
188
|
+
name="country"
|
|
189
|
+
render={({ field }) => (
|
|
190
|
+
<FormItem>
|
|
191
|
+
<FormLabel>Country</FormLabel>
|
|
192
|
+
<FormControl>
|
|
193
|
+
<Input placeholder="USA" {...field} />
|
|
194
|
+
</FormControl>
|
|
195
|
+
<FormMessage />
|
|
196
|
+
</FormItem>
|
|
197
|
+
)}
|
|
198
|
+
/>
|
|
199
|
+
</div>
|
|
200
|
+
|
|
201
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
202
|
+
<FormField
|
|
203
|
+
control={form.control}
|
|
204
|
+
name="phone"
|
|
205
|
+
render={({ field }) => (
|
|
206
|
+
<FormItem>
|
|
207
|
+
<FormLabel>Phone (Optional)</FormLabel>
|
|
208
|
+
<FormControl>
|
|
209
|
+
<Input placeholder="+1 555-0123" {...field} />
|
|
210
|
+
</FormControl>
|
|
211
|
+
<FormMessage />
|
|
212
|
+
</FormItem>
|
|
213
|
+
)}
|
|
214
|
+
/>
|
|
215
|
+
|
|
216
|
+
<FormField
|
|
217
|
+
control={form.control}
|
|
218
|
+
name="email"
|
|
219
|
+
render={({ field }) => (
|
|
220
|
+
<FormItem>
|
|
221
|
+
<FormLabel>Email (Optional)</FormLabel>
|
|
222
|
+
<FormControl>
|
|
223
|
+
<Input placeholder="info@hospital.com" type="email" {...field} />
|
|
224
|
+
</FormControl>
|
|
225
|
+
<FormMessage />
|
|
226
|
+
</FormItem>
|
|
227
|
+
)}
|
|
228
|
+
/>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
232
|
+
<FormField
|
|
233
|
+
control={form.control}
|
|
234
|
+
name="timezone"
|
|
235
|
+
render={({ field }) => (
|
|
236
|
+
<FormItem>
|
|
237
|
+
<FormLabel>Timezone</FormLabel>
|
|
238
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
239
|
+
<FormControl>
|
|
240
|
+
<SelectTrigger>
|
|
241
|
+
<SelectValue placeholder="Select a timezone" />
|
|
242
|
+
</SelectTrigger>
|
|
243
|
+
</FormControl>
|
|
244
|
+
<SelectContent>
|
|
245
|
+
<SelectItem value="UTC">UTC</SelectItem>
|
|
246
|
+
<SelectItem value="America/New_York">Eastern Time (US & Canada)</SelectItem>
|
|
247
|
+
<SelectItem value="America/Chicago">Central Time (US & Canada)</SelectItem>
|
|
248
|
+
<SelectItem value="America/Denver">Mountain Time (US & Canada)</SelectItem>
|
|
249
|
+
<SelectItem value="America/Los_Angeles">Pacific Time (US & Canada)</SelectItem>
|
|
250
|
+
<SelectItem value="Europe/London">London</SelectItem>
|
|
251
|
+
<SelectItem value="Europe/Paris">Paris</SelectItem>
|
|
252
|
+
</SelectContent>
|
|
253
|
+
</Select>
|
|
254
|
+
<FormMessage />
|
|
255
|
+
</FormItem>
|
|
256
|
+
)}
|
|
257
|
+
/>
|
|
258
|
+
|
|
259
|
+
<FormField
|
|
260
|
+
control={form.control}
|
|
261
|
+
name="status"
|
|
262
|
+
render={({ field }) => (
|
|
263
|
+
<FormItem>
|
|
264
|
+
<FormLabel>Status</FormLabel>
|
|
265
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
266
|
+
<FormControl>
|
|
267
|
+
<SelectTrigger>
|
|
268
|
+
<SelectValue placeholder="Select status" />
|
|
269
|
+
</SelectTrigger>
|
|
270
|
+
</FormControl>
|
|
271
|
+
<SelectContent>
|
|
272
|
+
<SelectItem value="active">Active</SelectItem>
|
|
273
|
+
<SelectItem value="inactive">Inactive</SelectItem>
|
|
274
|
+
</SelectContent>
|
|
275
|
+
</Select>
|
|
276
|
+
<FormMessage />
|
|
277
|
+
</FormItem>
|
|
278
|
+
)}
|
|
279
|
+
/>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<div className="flex gap-4">
|
|
283
|
+
<Button type="submit" disabled={isSubmitting} className="gap-2">
|
|
284
|
+
{isSubmitting ? (
|
|
285
|
+
<>
|
|
286
|
+
<Loader2 className="w-4 h-4 animate-spin" />
|
|
287
|
+
Creating Hospital...
|
|
288
|
+
</>
|
|
289
|
+
) : (
|
|
290
|
+
"Create Hospital"
|
|
291
|
+
)}
|
|
292
|
+
</Button>
|
|
293
|
+
<Button type="button" variant="outline" disabled={isSubmitting} onClick={() => router.back()}>
|
|
294
|
+
Cancel
|
|
295
|
+
</Button>
|
|
296
|
+
</div>
|
|
297
|
+
</form>
|
|
298
|
+
</Form>
|
|
299
|
+
</div>
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { usePathname } from "next/navigation";
|
|
5
|
+
import { cn } from "@/lib/utils";
|
|
6
|
+
|
|
7
|
+
const adminNav = [
|
|
8
|
+
{ title: "Dashboard", href: "/admin" },
|
|
9
|
+
{ title: "General", href: "/admin/general" },
|
|
10
|
+
{ title: "Users", href: "/admin/users" },
|
|
11
|
+
{ title: "Roles", href: "/admin/roles" },
|
|
12
|
+
{ title: "System Settings", href: "/admin/settings" },
|
|
13
|
+
{ title: "Export & Import", href: "/admin/data" },
|
|
14
|
+
{ title: "Audit Logs", href: "/admin/audit-logs" },
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export default function AdminLayout({ children }: { children: React.ReactNode }) {
|
|
18
|
+
const pathname = usePathname();
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className="flex flex-col md:flex-row min-h-[calc(100vh-4rem)] gap-6 p-4 md:p-6 lg:p-8">
|
|
22
|
+
<aside className="w-full md:w-64 shrink-0">
|
|
23
|
+
<nav className="flex flex-row md:flex-col gap-1 overflow-x-auto md:overflow-visible pb-2 md:pb-0">
|
|
24
|
+
{adminNav.map((item) => {
|
|
25
|
+
const isActive = pathname === item.href || (pathname.startsWith(item.href) && item.href !== "/admin");
|
|
26
|
+
return (
|
|
27
|
+
<Link
|
|
28
|
+
key={item.href}
|
|
29
|
+
href={item.href}
|
|
30
|
+
className={cn(
|
|
31
|
+
"flex items-center rounded-md px-3 py-2 text-sm font-medium whitespace-nowrap transition-colors",
|
|
32
|
+
isActive
|
|
33
|
+
? "bg-primary text-primary-foreground"
|
|
34
|
+
: "hover:bg-muted text-muted-foreground hover:text-foreground"
|
|
35
|
+
)}
|
|
36
|
+
>
|
|
37
|
+
{item.title}
|
|
38
|
+
</Link>
|
|
39
|
+
);
|
|
40
|
+
})}
|
|
41
|
+
</nav>
|
|
42
|
+
</aside>
|
|
43
|
+
<main className="flex-1 min-w-0">
|
|
44
|
+
{children}
|
|
45
|
+
</main>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { PageHeader } from "@/components/shared/page-header";
|
|
4
|
+
import { Button } from "@/components/ui/button";
|
|
5
|
+
import {
|
|
6
|
+
Form,
|
|
7
|
+
FormControl,
|
|
8
|
+
FormField,
|
|
9
|
+
FormItem,
|
|
10
|
+
FormLabel,
|
|
11
|
+
FormMessage,
|
|
12
|
+
} from "@/components/ui/form";
|
|
13
|
+
import { Input } from "@/components/ui/input";
|
|
14
|
+
import {
|
|
15
|
+
Select,
|
|
16
|
+
SelectContent,
|
|
17
|
+
SelectItem,
|
|
18
|
+
SelectTrigger,
|
|
19
|
+
SelectValue,
|
|
20
|
+
} from "@/components/ui/select";
|
|
21
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
22
|
+
import { useForm } from "react-hook-form";
|
|
23
|
+
import * as z from "zod";
|
|
24
|
+
import { useRouter } from "next/navigation";
|
|
25
|
+
import { useEffect, useState, use } from "react";
|
|
26
|
+
import { getOrganizationById, updateOrganization } from "@/lib/actions/organizations";
|
|
27
|
+
|
|
28
|
+
const formSchema = z.object({
|
|
29
|
+
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
30
|
+
code: z.string().min(2, "Code must be at least 2 characters").toUpperCase(),
|
|
31
|
+
defaultTimezone: z.string().min(1, "Please select a timezone"),
|
|
32
|
+
status: z.enum(["active", "archived"]),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export default function EditOrganizationPage({ params }: { params: Promise<{ orgId: string }> }) {
|
|
36
|
+
const resolvedParams = use(params);
|
|
37
|
+
const router = useRouter();
|
|
38
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
39
|
+
|
|
40
|
+
const form = useForm<z.infer<typeof formSchema>>({
|
|
41
|
+
resolver: zodResolver(formSchema),
|
|
42
|
+
defaultValues: {
|
|
43
|
+
name: "",
|
|
44
|
+
code: "",
|
|
45
|
+
defaultTimezone: "UTC",
|
|
46
|
+
status: "active",
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
async function loadData() {
|
|
52
|
+
const result = await getOrganizationById(resolvedParams.orgId);
|
|
53
|
+
if (result.success && result.data) {
|
|
54
|
+
form.reset({
|
|
55
|
+
name: result.data.name,
|
|
56
|
+
code: result.data.code,
|
|
57
|
+
defaultTimezone: result.data.defaultTimezone || "UTC",
|
|
58
|
+
status: (result.data.status === "archived" ? "archived" : "active") as "active" | "archived",
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
setIsLoading(false);
|
|
62
|
+
}
|
|
63
|
+
loadData();
|
|
64
|
+
}, [resolvedParams.orgId, form]);
|
|
65
|
+
|
|
66
|
+
async function onSubmit(values: z.infer<typeof formSchema>) {
|
|
67
|
+
const result = await updateOrganization(resolvedParams.orgId, values);
|
|
68
|
+
if (result.success) {
|
|
69
|
+
router.push(`/admin/organizations/${resolvedParams.orgId}`);
|
|
70
|
+
} else {
|
|
71
|
+
console.error((result as any).error);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (isLoading) {
|
|
76
|
+
return <div className="p-8 text-center">Loading...</div>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<div className="space-y-6 max-w-2xl">
|
|
81
|
+
<PageHeader title="Edit Organization" description="Update organization details" />
|
|
82
|
+
|
|
83
|
+
<Form {...form}>
|
|
84
|
+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-6">
|
|
85
|
+
<FormField
|
|
86
|
+
control={form.control}
|
|
87
|
+
name="name"
|
|
88
|
+
render={({ field }) => (
|
|
89
|
+
<FormItem>
|
|
90
|
+
<FormLabel>Name</FormLabel>
|
|
91
|
+
<FormControl>
|
|
92
|
+
<Input placeholder="Acme Healthcare" {...field} />
|
|
93
|
+
</FormControl>
|
|
94
|
+
<FormMessage />
|
|
95
|
+
</FormItem>
|
|
96
|
+
)}
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
<FormField
|
|
100
|
+
control={form.control}
|
|
101
|
+
name="code"
|
|
102
|
+
render={({ field }) => (
|
|
103
|
+
<FormItem>
|
|
104
|
+
<FormLabel>Code</FormLabel>
|
|
105
|
+
<FormControl>
|
|
106
|
+
<Input placeholder="ACME" {...field} />
|
|
107
|
+
</FormControl>
|
|
108
|
+
<FormMessage />
|
|
109
|
+
</FormItem>
|
|
110
|
+
)}
|
|
111
|
+
/>
|
|
112
|
+
|
|
113
|
+
<FormField
|
|
114
|
+
control={form.control}
|
|
115
|
+
name="defaultTimezone"
|
|
116
|
+
render={({ field }) => (
|
|
117
|
+
<FormItem>
|
|
118
|
+
<FormLabel>Default Timezone</FormLabel>
|
|
119
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
120
|
+
<FormControl>
|
|
121
|
+
<SelectTrigger>
|
|
122
|
+
<SelectValue placeholder="Select a timezone" />
|
|
123
|
+
</SelectTrigger>
|
|
124
|
+
</FormControl>
|
|
125
|
+
<SelectContent>
|
|
126
|
+
<SelectItem value="UTC">UTC</SelectItem>
|
|
127
|
+
<SelectItem value="America/New_York">Eastern Time (US & Canada)</SelectItem>
|
|
128
|
+
<SelectItem value="America/Chicago">Central Time (US & Canada)</SelectItem>
|
|
129
|
+
<SelectItem value="America/Denver">Mountain Time (US & Canada)</SelectItem>
|
|
130
|
+
<SelectItem value="America/Los_Angeles">Pacific Time (US & Canada)</SelectItem>
|
|
131
|
+
<SelectItem value="Europe/London">London</SelectItem>
|
|
132
|
+
<SelectItem value="Europe/Paris">Paris</SelectItem>
|
|
133
|
+
</SelectContent>
|
|
134
|
+
</Select>
|
|
135
|
+
<FormMessage />
|
|
136
|
+
</FormItem>
|
|
137
|
+
)}
|
|
138
|
+
/>
|
|
139
|
+
|
|
140
|
+
<FormField
|
|
141
|
+
control={form.control}
|
|
142
|
+
name="status"
|
|
143
|
+
render={({ field }) => (
|
|
144
|
+
<FormItem>
|
|
145
|
+
<FormLabel>Status</FormLabel>
|
|
146
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
147
|
+
<FormControl>
|
|
148
|
+
<SelectTrigger>
|
|
149
|
+
<SelectValue placeholder="Select status" />
|
|
150
|
+
</SelectTrigger>
|
|
151
|
+
</FormControl>
|
|
152
|
+
<SelectContent>
|
|
153
|
+
<SelectItem value="active">Active</SelectItem>
|
|
154
|
+
<SelectItem value="archived">Archived</SelectItem>
|
|
155
|
+
</SelectContent>
|
|
156
|
+
</Select>
|
|
157
|
+
<FormMessage />
|
|
158
|
+
</FormItem>
|
|
159
|
+
)}
|
|
160
|
+
/>
|
|
161
|
+
|
|
162
|
+
<div className="flex gap-4">
|
|
163
|
+
<Button type="submit">Save Changes</Button>
|
|
164
|
+
<Button type="button" variant="outline" onClick={() => router.back()}>
|
|
165
|
+
Cancel
|
|
166
|
+
</Button>
|
|
167
|
+
</div>
|
|
168
|
+
</form>
|
|
169
|
+
</Form>
|
|
170
|
+
</div>
|
|
171
|
+
);
|
|
172
|
+
}
|