@@ -14,6 +14,7 @@ import {
1414 formEditorTranslateFormFields ,
1515} from '@web/utils/formInstanceUtils' ;
1616import { groupColors } from '@web/utils/formTemplateUtils' ;
17+ import Error from '../Error' ;
1718
1819/**
1920 * The contents of the white box for assigning groups.
@@ -43,7 +44,8 @@ export const AssignGroupsBox = ({
4344 borderColor : 'transparent' ,
4445 } ;
4546
46- const { assignedGroupData, setAssignedGroupData } = useCreateFormInstance ( ) ;
47+ const { assignedGroupData, setAssignedGroupData, formTemplate } =
48+ useCreateFormInstance ( ) ;
4749 const { data : positions } = useQuery ( positionsControllerFindAllOptions ( ) ) ;
4850 const { data : employees } = useQuery ( employeesControllerFindAllOptions ( ) ) ;
4951 const { data : departments } = useQuery (
@@ -54,6 +56,10 @@ export const AssignGroupsBox = ({
5456 } ) ,
5557 ) ;
5658
59+ if ( ! formTemplate ) {
60+ return < Error > </ Error > ;
61+ }
62+
5763 return (
5864 < Flex
5965 flexDirection = { 'row' }
@@ -113,7 +119,7 @@ export const AssignGroupsBox = ({
113119 >
114120 Preview Only
115121 </ Text >
116- < Box width = "500px" >
122+ < Box minW = "500px" >
117123 < FormEditor
118124 formTemplateName = { name ?? '' }
119125 pdfFile = { pdfFile }
@@ -122,9 +128,11 @@ export const AssignGroupsBox = ({
122128 formFields = { formEditorTranslateFormFields ( fieldGroups ) }
123129 setFormFields = { ( ) => { } }
124130 setFieldGroups = { ( ) => { } }
125- scale = { 0.625 }
126- documentWidth = { 500 }
127131 showNav = { false }
132+ formTemplateDimensions = { {
133+ width : formTemplate ?. pageWidth ,
134+ height : formTemplate ?. pageHeight ,
135+ } }
128136 />
129137 </ Box >
130138 </ Flex >
0 commit comments