5
5
Grid ,
6
6
Group ,
7
7
Text ,
8
+ Table ,
8
9
Stepper ,
10
+ Modal ,
9
11
Button ,
10
12
Box ,
11
13
Badge ,
@@ -16,6 +18,7 @@ import {
16
18
List ,
17
19
Divider ,
18
20
} from "@mantine/core" ;
21
+ import { useDisclosure } from '@mantine/hooks' ;
19
22
import { AppHeader } from "../../components/AppHeader/appHeader" ;
20
23
import { IconInfoCircle } from "@tabler/icons-react" ;
21
24
import { IconPhoto , IconExternalLink , IconArrowRight } from '@tabler/icons-react' ;
@@ -29,9 +32,10 @@ export function IntakeDetail() {
29
32
const [ activeTab , setActiveTab ] = useState ( "" ) ; // Track active tab
30
33
const [ data , setData ] = useState ( [ ] ) ; // Stubbed dynamic data
31
34
const [ detail , setDetail ] = useState ( "" ) ;
32
-
35
+ const [ mutableUrl , setmutableUrl ] = useState ( "" )
33
36
const params = useParams ( )
34
37
const navigate = useNavigate ( ) ;
38
+ const [ modalOpen , { open, close } ] = useDisclosure ( false ) ;
35
39
36
40
const nextStep = ( ) =>
37
41
setActiveStep ( ( current ) => ( current < overallSteps . length - 1 ? current + 1 : current ) ) ;
@@ -42,7 +46,7 @@ export function IntakeDetail() {
42
46
console . log ( 'success' , res )
43
47
setData ( res ?. surveys )
44
48
setDetail ( res ?. detail )
45
-
49
+ setmutableUrl ( res ?. mutable_url )
46
50
if ( res ?. surveys ?. [ 0 ] ?. title ) {
47
51
setActiveTab ( res . surveys [ 0 ] . title ) ; // Default to first tab
48
52
}
@@ -128,6 +132,41 @@ export function IntakeDetail() {
128
132
) ;
129
133
}
130
134
135
+ const renderTable = ( ) => {
136
+ const tab = {
137
+ caption : 'Survey Details' ,
138
+ head : [ 'Field' , 'Value' ] ,
139
+ body : detail
140
+ ? Object . entries ( detail ) . map ( ( [ key , value ] ) => [ key , value || "No value" ] )
141
+ : [ ] ,
142
+ }
143
+
144
+ return (
145
+ < Table . ScrollContainer h = { 400 } >
146
+ < Table
147
+ stickyHeader
148
+ striped
149
+ data = { tab }
150
+ />
151
+ </ Table . ScrollContainer >
152
+ ) ;
153
+ }
154
+
155
+ const viewParentIntake = ( ) => {
156
+
157
+ // // Open a new window or tab
158
+ // const newWindow = window.open('', '_blank');
159
+ //
160
+ // if (newWindow) {
161
+ // // Write the HTML content to the new window
162
+ // newWindow.document.open();
163
+ // newWindow.document.write(detail?.summary);
164
+ // newWindow.document.close();
165
+ // } else {
166
+ // console.error('Unable to open a new window. Please check your browser settings.');
167
+ // }
168
+ }
169
+
131
170
const { projectInfo, tabs, overallSteps, tabLinks, user } = data ;
132
171
133
172
const renderContent = ( ) => {
@@ -314,16 +353,23 @@ export function IntakeDetail() {
314
353
{ /* </List.Item>*/ }
315
354
{ /*</List>*/ }
316
355
</ Blockquote >
317
-
318
356
< Divider label = "Universal Intake submissions" labelPosition = "center" my = "md" />
319
-
357
+ < Modal size = "xl" opened = { modalOpen } onClose = { close } title = "Universal Intake Submission I" >
358
+ { modalOpen && renderTable ( ) }
359
+ </ Modal >
320
360
< Card shadow = "sm" p = "lg" my = "lg" >
321
361
< Timeline active = { 1 } lineWidth = { 3 } bulletSize = { 18 } >
322
362
< Timeline . Item title = "Universal Intake submission I" >
323
- < Text c = "dimmed" size = "sm" > View prior survey submission < Text variant = "link" component = "span" inherit > here</ Text > </ Text >
363
+ < Group spacing = "xs" align = "center" >
364
+ < Text c = "dimmed" size = "sm" > View prior survey submission:</ Text >
365
+ < Button onClick = { open } variant = "light" size = "xs" > View</ Button >
366
+ </ Group >
324
367
</ Timeline . Item >
325
368
< Timeline . Item title = "Universal Intake submission II" >
326
- < Text c = "dimmed" size = "sm" > View or Edit prior survey submission< Text variant = "link" component = "span" inherit > here</ Text > </ Text >
369
+ < Group spacing = "xs" align = "center" >
370
+ < Text c = "dimmed" size = "sm" > View or Edit prior survey submission:</ Text >
371
+ < Button component = "a" href = { mutableUrl } variant = "light" size = "xs" > View</ Button >
372
+ </ Group >
327
373
</ Timeline . Item >
328
374
< Timeline . Item title = "Complete additional surveys required for requested services" lineVariant = "dashed" >
329
375
< Text c = "dimmed" size = "sm" > Please complete each intake for the requested services below</ Text >
0 commit comments