Skip to content

Commit 7ba0851

Browse files
authored
[PT2025BMHW-112][SuperAdminUI] feat: Implement Edit Tenant functionality (#144)
1 parent ed48710 commit 7ba0851

File tree

3 files changed

+245
-251
lines changed

3 files changed

+245
-251
lines changed

Frontend/apps/superadmin/src/components/tenants/TenantFormDialog.tsx

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
import {
2-
Alert,
3-
Button,
4-
features,
5-
Icon,
6-
Input,
7-
Modal,
8-
MultiStepForm,
9-
Spinner,
10-
Textarea,
11-
ToastContainer,
12-
useFormValidation,
13-
useMultiStepForm,
14-
useToast,
15-
ValidationRules,
16-
type CreateTenantRequest,
17-
type Step,
18-
type Tenant,
19-
type ToastProps,
2+
Alert,
3+
Button,
4+
features,
5+
Icon,
6+
Input,
7+
Modal,
8+
MultiStepForm,
9+
Spinner,
10+
Textarea,
11+
ToastContainer,
12+
useFormValidation,
13+
useMultiStepForm,
14+
useToast,
15+
ValidationRules,
16+
type CreateTenantRequest,
17+
type Step,
18+
type Tenant,
19+
type ToastProps,
2020
} from '@ngo-platform/shared';
2121
import { useQueryClient } from '@tanstack/react-query';
2222
import { useEffect, useState, type FC } from 'react';
23-
2423
interface TenantFormDialogProps {
2524
isOpen: boolean;
2625
onClose: () => void;
@@ -55,7 +54,7 @@ export const TenantFormDialog: FC<TenantFormDialogProps> = ({
5554

5655
// Fetch full details in edit mode to ensure we have all fields
5756
const { data: tenantDetails, isLoading: isLoadingDetails } = features.useTenant(
58-
(mode === 'edit' && initialData?.id) ? initialData.id : '',
57+
mode === 'edit' && initialData?.id ? initialData.id : '',
5958
);
6059

6160
const [formData, setFormData] = useState<TenantFormData>({
@@ -225,9 +224,9 @@ export const TenantFormDialog: FC<TenantFormDialogProps> = ({
225224
tenantId = result.id;
226225
success('Tenant created successfully', `${formData.name} has been added to the platform`);
227226
} else {
228-
if (!initialData?.id) throw new Error("Tenant ID missing for update");
227+
if (!initialData?.id) throw new Error('Tenant ID missing for update');
229228

230-
const updateRequest = {
229+
const updateRequest = {
231230
id: initialData.id,
232231
name: formData.name,
233232
email: formData.email,

0 commit comments

Comments
 (0)