@@ -14,7 +14,7 @@ import {
14
14
} from '@/components/ui/form'
15
15
import { useForm } from 'react-hook-form'
16
16
import { zodResolver } from '@hookform/resolvers/zod'
17
- import { FormSchema } from '@/modules/adminRegistrationApplications/constants/formSchema '
17
+ import { FormSchema } from '@/modules/adminRegistrationApplications/constants/formValidationSchema '
18
18
import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card'
19
19
import { useTranslation } from 'react-i18next'
20
20
import { LoadingSpinner } from '@/components/ui/loadingSpinner'
@@ -30,6 +30,8 @@ import {
30
30
DialogTrigger ,
31
31
} from '@/components/ui/dialog'
32
32
import { DialogDescription } from '@radix-ui/react-dialog'
33
+ import PrivateRoute from '@/app/hocs/isAuth'
34
+ import { Permission } from '@/constants/permissions'
33
35
34
36
const Page = ( { params } : { params : { slug : string ; id : string } } ) => {
35
37
const { t } = useTranslation ( )
@@ -49,15 +51,7 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
49
51
const fetchDetails = ( ) => {
50
52
getAdminRegistrationApplication ( params . id )
51
53
. then ( ( response ) => {
52
- if ( response . data . isSuccess ) {
53
- setAdminRegistrationApplicationDetails ( response . data . response )
54
- } else {
55
- toast ( {
56
- title : t ( 'error' ) ,
57
- description : t ( 'applicationError' ) ,
58
- variant : 'destructive' ,
59
- } )
60
- }
54
+ setAdminRegistrationApplicationDetails ( response . response )
61
55
} )
62
56
. catch ( ( ) => {
63
57
toast ( {
@@ -68,19 +62,21 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
68
62
} )
69
63
. finally ( ( ) => setIsLoading ( false ) )
70
64
}
71
-
65
+
72
66
fetchDetails ( )
73
67
} , [ params . id , t , toast ] )
68
+
74
69
75
70
return (
71
+ // <PrivateRoute requiredPermissions={[Permission.APPLICATION_DETAIL]}>
76
72
< div className = "p-6 bg-white dark:bg-gray-800 rounded-md shadow-md text-black dark:text-white" >
77
73
{ isLoading && < LoadingSpinner /> }
78
74
{ ! isLoading && adminRegistrationApplicationDetails && (
79
75
< Form { ...form } >
80
76
< form className = "space-y-6" >
81
77
< div className = "flex justify-between items-center mb-6" >
82
78
< h1 className = "text-2xl font-bold" >
83
- { t ( 'applicationDetailsTitle ' ) }
79
+ { t ( 'adminRegistrationApplications.detailsTitle ' ) }
84
80
</ h1 >
85
81
{ adminRegistrationApplicationDetails . status === 'COMPLETED' && (
86
82
< div className = "flex space-x-8 ml-auto" >
@@ -157,7 +153,7 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
157
153
name = "reason"
158
154
render = { ( { field } ) => (
159
155
< FormItem className = "sm:col-span-2" >
160
- < FormLabel > { t ( 'reason' ) } </ FormLabel >
156
+ < FormLabel > { t ( 'adminRegistrationApplications. reason' ) } </ FormLabel >
161
157
< FormControl >
162
158
< Input
163
159
{ ...field }
@@ -194,7 +190,7 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
194
190
name = "status"
195
191
render = { ( { field } ) => (
196
192
< FormItem className = "sm:col-span-1" >
197
- < FormLabel > { t ( 'applicationStatus ' ) } </ FormLabel >
193
+ < FormLabel > { t ( 'adminRegistrationApplications.status ' ) } </ FormLabel >
198
194
< FormControl >
199
195
< Input
200
196
{ ...field }
@@ -236,7 +232,7 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
236
232
name = "createdUser"
237
233
render = { ( { field } ) => (
238
234
< FormItem className = "sm:col-span-1" >
239
- < FormLabel > { t ( 'applicationCreatedUser ' ) } </ FormLabel >
235
+ < FormLabel > { t ( 'adminRegistrationApplications.createdUser ' ) } </ FormLabel >
240
236
< FormControl >
241
237
< Input
242
238
{ ...field }
@@ -255,7 +251,7 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
255
251
name = "createDate"
256
252
render = { ( { field } ) => (
257
253
< FormItem className = "sm:col-span-1" >
258
- < FormLabel > { t ( 'createDate ' ) } </ FormLabel >
254
+ < FormLabel > { t ( 'adminRegistrationApplications.createdAt ' ) } </ FormLabel >
259
255
< FormControl >
260
256
< Input
261
257
{ ...field }
@@ -296,7 +292,7 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
296
292
name = "updateDate"
297
293
render = { ( { field } ) => (
298
294
< FormItem className = "sm:col-span-1" >
299
- < FormLabel > { t ( 'updateDate ' ) } </ FormLabel >
295
+ < FormLabel > { t ( 'adminRegistrationApplications.updatedAt ' ) } </ FormLabel >
300
296
< FormControl >
301
297
< Input
302
298
{ ...field }
@@ -434,6 +430,7 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
434
430
</ Form >
435
431
) }
436
432
</ div >
433
+ // </PrivateRoute>
437
434
)
438
435
}
439
436
0 commit comments