@@ -15,7 +15,6 @@ import { zodResolver } from '@hookform/resolvers/zod'
15
15
import { Card , CardContent , CardHeader , CardTitle } from '@/components/ui/card'
16
16
import { useTranslation } from 'react-i18next'
17
17
import { LoadingSpinner } from '@/components/ui/loadingSpinner'
18
- import { Toaster } from '@/components/ui/toaster'
19
18
import { useToast } from '@/components/ui/use-toast'
20
19
import { formatPhoneNumber } from '@/lib/formatPhoneNumber'
21
20
import PrivateRoute from '@/app/hocs/isAuth'
@@ -73,25 +72,23 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
73
72
< PrivateRoute requiredPermissions = { [ Permission . EVACUATION_DETAIL ] } >
74
73
< div className = "p-6 bg-white dark:bg-gray-800 rounded-md shadow-md text-black dark:text-white" >
75
74
{ isLoading && < LoadingSpinner /> }
76
- { error && < Toaster /> }
77
75
{ ! isLoading && ! error && emergencyEvacuationApplicationDetails && (
78
76
< Form { ...form } >
79
77
< form className = "space-y-6" >
80
78
< h1 className = "text-2xl font-bold mb-6" >
81
79
{ t ( 'emergencyEvacuationApplications.detailsTitle' ) }
82
80
</ h1 >
83
-
84
81
< Card className = "mb-6" >
85
82
< CardHeader >
86
83
< CardTitle > { t ( 'applicationInformation' ) } </ CardTitle >
87
84
</ CardHeader >
88
85
< CardContent >
89
- < div className = "grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-6" >
86
+ < div className = "grid grid-cols-1 gap-y-6 sm:grid-cols-3 sm:gap-x-6" >
90
87
< FormField
91
88
control = { control }
92
89
name = "referenceNumber"
93
90
render = { ( { field } ) => (
94
- < FormItem className = "sm:col-span-2 " >
91
+ < FormItem className = "sm:col-span-1 " >
95
92
< FormLabel > { t ( 'referenceNumber' ) } </ FormLabel >
96
93
< FormControl >
97
94
< Input
@@ -158,64 +155,92 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
158
155
</ FormItem >
159
156
) }
160
157
/>
161
- { emergencyEvacuationApplicationDetails . isInPerson ? null : (
162
- < >
163
- < FormField
164
- control = { control }
165
- name = "applicantNameSurname"
166
- render = { ( { field } ) => (
167
- < FormItem className = "sm:col-span-1" >
168
- < FormLabel >
169
- { t (
170
- 'emergencyEvacuationApplications.applicantNameSurname' ,
171
- ) }
172
- </ FormLabel >
173
- < FormControl >
174
- < Input
175
- { ...field }
176
- disabled
177
- defaultValue = {
178
- emergencyEvacuationApplicationDetails . applicantFirstName ??
179
- '' +
180
- emergencyEvacuationApplicationDetails . applicantLastName ??
181
- ''
182
- }
183
- />
184
- </ FormControl >
185
- </ FormItem >
186
- ) }
187
- />
188
- < FormField
189
- control = { control }
190
- name = "applicantPhoneNumber"
191
- render = { ( { field } ) => (
192
- < FormItem className = "sm:col-span-1" >
193
- < FormLabel >
194
- { t (
195
- 'emergencyEvacuationApplications.applicantPhoneNumber' ,
196
- ) }
197
- </ FormLabel >
198
- < FormControl >
199
- < Input
200
- { ...field }
201
- disabled
202
- defaultValue = {
203
- emergencyEvacuationApplicationDetails
204
- ?. applicantPhoneNumber ?. countryCode &&
205
- emergencyEvacuationApplicationDetails
206
- ?. applicantPhoneNumber ?. lineNumber
207
- ? formatPhoneNumber (
208
- emergencyEvacuationApplicationDetails . applicantPhoneNumber ,
209
- )
210
- : ''
211
- }
212
- />
213
- </ FormControl >
214
- </ FormItem >
215
- ) }
216
- />
217
- </ >
218
- ) }
158
+ < FormField
159
+ control = { control }
160
+ name = "isInPerson"
161
+ render = { ( { field } ) => (
162
+ < FormItem className = "sm:col-span-3" >
163
+ < div className = "flex items-center" >
164
+ < FormLabel className = "mr-2" >
165
+ { t ( 'emergencyEvacuationApplications.isInPerson' ) }
166
+ </ FormLabel >
167
+ < FormControl >
168
+ < Checkbox
169
+ { ...field }
170
+ disabled
171
+ checked = {
172
+ emergencyEvacuationApplicationDetails . isInPerson
173
+ }
174
+ />
175
+ </ FormControl >
176
+ </ div >
177
+ </ FormItem >
178
+ ) }
179
+ />
180
+ </ div >
181
+ { ! emergencyEvacuationApplicationDetails . isInPerson && (
182
+ < div className = "grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-6 my-6" >
183
+ < FormField
184
+ control = { control }
185
+ name = "applicantNameSurname"
186
+ render = { ( { field } ) => (
187
+ < FormItem className = "col-span-1" >
188
+ < FormLabel >
189
+ { t (
190
+ 'emergencyEvacuationApplications.applicantNameSurname' ,
191
+ ) }
192
+ </ FormLabel >
193
+ < FormControl >
194
+ < Input
195
+ { ...field }
196
+ disabled
197
+ defaultValue = {
198
+ ( emergencyEvacuationApplicationDetails . applicantFirstName ??
199
+ '' ) +
200
+ ( emergencyEvacuationApplicationDetails . applicantFirstName &&
201
+ emergencyEvacuationApplicationDetails . applicantLastName
202
+ ? ' '
203
+ : '' ) +
204
+ ( emergencyEvacuationApplicationDetails . applicantLastName ??
205
+ '' )
206
+ }
207
+ />
208
+ </ FormControl >
209
+ </ FormItem >
210
+ ) }
211
+ />
212
+ < FormField
213
+ control = { control }
214
+ name = "applicantPhoneNumber"
215
+ render = { ( { field } ) => (
216
+ < FormItem className = "col-span-1" >
217
+ < FormLabel >
218
+ { t (
219
+ 'emergencyEvacuationApplications.applicantPhoneNumber' ,
220
+ ) }
221
+ </ FormLabel >
222
+ < FormControl >
223
+ < Input
224
+ { ...field }
225
+ disabled
226
+ defaultValue = {
227
+ emergencyEvacuationApplicationDetails
228
+ ?. applicantPhoneNumber ?. countryCode &&
229
+ emergencyEvacuationApplicationDetails
230
+ ?. applicantPhoneNumber ?. lineNumber
231
+ ? formatPhoneNumber (
232
+ emergencyEvacuationApplicationDetails . applicantPhoneNumber ,
233
+ )
234
+ : ''
235
+ }
236
+ />
237
+ </ FormControl >
238
+ </ FormItem >
239
+ ) }
240
+ />
241
+ </ div >
242
+ ) }
243
+ < div className = "grid grid-cols-1 gap-y-6 sm:grid-cols-2 sm:gap-x-6" >
219
244
< FormField
220
245
control = { control }
221
246
name = "sourcecityAndDistrict"
@@ -247,19 +272,27 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
247
272
/>
248
273
< FormField
249
274
control = { control }
250
- name = "address "
275
+ name = "targetCityAndDistrict "
251
276
render = { ( { field } ) => (
252
277
< FormItem className = "sm:col-span-1" >
253
278
< FormLabel >
254
- { t ( 'emergencyEvacuationApplications.address' ) }
279
+ { t (
280
+ 'emergencyEvacuationApplications.targetCityAndDistrict' ,
281
+ ) }
255
282
</ FormLabel >
256
283
< FormControl >
257
284
< Input
258
285
{ ...field }
259
286
disabled
260
287
defaultValue = {
261
- emergencyEvacuationApplicationDetails . address ??
262
- ''
288
+ ( emergencyEvacuationApplicationDetails . targetCity ??
289
+ '' ) +
290
+ ( emergencyEvacuationApplicationDetails . targetCity &&
291
+ emergencyEvacuationApplicationDetails . targetDistrict
292
+ ? ' / '
293
+ : '' ) +
294
+ ( emergencyEvacuationApplicationDetails . targetDistrict ??
295
+ '' )
263
296
}
264
297
/>
265
298
</ FormControl >
@@ -268,27 +301,19 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
268
301
/>
269
302
< FormField
270
303
control = { control }
271
- name = "targetCityAndDistrict "
304
+ name = "address "
272
305
render = { ( { field } ) => (
273
- < FormItem className = "sm:col-span-1 " >
306
+ < FormItem className = "sm:col-span-2 " >
274
307
< FormLabel >
275
- { t (
276
- 'emergencyEvacuationApplications.targetCityAndDistrict' ,
277
- ) }
308
+ { t ( 'emergencyEvacuationApplications.address' ) }
278
309
</ FormLabel >
279
310
< FormControl >
280
311
< Input
281
312
{ ...field }
282
313
disabled
283
314
defaultValue = {
284
- ( emergencyEvacuationApplicationDetails . targetCity ??
285
- '' ) +
286
- ( emergencyEvacuationApplicationDetails . targetCity &&
287
- emergencyEvacuationApplicationDetails . targetDistrict
288
- ? ' / '
289
- : '' ) +
290
- ( emergencyEvacuationApplicationDetails . targetDistrict ??
291
- '' )
315
+ emergencyEvacuationApplicationDetails . address ??
316
+ ''
292
317
}
293
318
/>
294
319
</ FormControl >
@@ -316,23 +341,24 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
316
341
/>
317
342
< FormField
318
343
control = { control }
319
- name = "isInPerson "
344
+ name = "confirmedSeatCount "
320
345
render = { ( { field } ) => (
321
346
< FormItem className = "sm:col-span-1" >
322
- < div className = "flex items-center" >
323
- < FormLabel className = "mr-2" >
324
- { t ( 'emergencyEvacuationApplications.isInPerson' ) }
325
- </ FormLabel >
326
- < FormControl >
327
- < Checkbox
328
- { ...field }
329
- disabled
330
- checked = {
331
- emergencyEvacuationApplicationDetails . isInPerson
332
- }
333
- />
334
- </ FormControl >
335
- </ div >
347
+ < FormLabel >
348
+ { t (
349
+ 'emergencyEvacuationApplications.confirmedSeatCount' ,
350
+ ) }
351
+ </ FormLabel >
352
+ < FormControl >
353
+ < Input
354
+ { ...field }
355
+ disabled
356
+ defaultValue = {
357
+ emergencyEvacuationApplicationDetails . seatingCount ??
358
+ ''
359
+ }
360
+ />
361
+ </ FormControl >
336
362
</ FormItem >
337
363
) }
338
364
/>
@@ -404,34 +430,11 @@ const Page = ({ params }: { params: { slug: string; id: string } }) => {
404
430
</ FormItem >
405
431
) }
406
432
/>
407
- < FormField
408
- control = { control }
409
- name = "confirmedSeatCount"
410
- render = { ( { field } ) => (
411
- < FormItem className = "sm:col-span-1" >
412
- < FormLabel >
413
- { t (
414
- 'emergencyEvacuationApplications.confirmedSeatCount' ,
415
- ) }
416
- </ FormLabel >
417
- < FormControl >
418
- < Input
419
- { ...field }
420
- disabled
421
- defaultValue = {
422
- // emergencyEvacuationApplicationDetails.confirmedSeatCount ??
423
- ''
424
- }
425
- />
426
- </ FormControl >
427
- </ FormItem >
428
- ) }
429
- />
430
433
< FormField
431
434
control = { control }
432
435
name = "operatorNotes"
433
436
render = { ( { field } ) => (
434
- < FormItem className = "sm:col-span-1 " >
437
+ < FormItem className = "sm:col-span-2 " >
435
438
< FormLabel >
436
439
{ t ( 'emergencyEvacuationApplications.notes' ) }
437
440
</ FormLabel >
0 commit comments