-
Notifications
You must be signed in to change notification settings - Fork 1
#216 form instance assign fields and groups #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kaiyangzheng
merged 33 commits into
main
from
#216-Form-Instance-Assign-Fields-and-Groups
Dec 4, 2024
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
172ccc5
Imported starter code and fixed typescript bugs
DonnyLe b1aee16
working on bugs
DonnyLe f0e0585
Merge branch 'main' into add-text-fields-to-form-template
DonnyLe b85bea4
pdf viewer working (functionality broken tho)
DonnyLe 8629961
fixed text boxes being behind pdf
DonnyLe 45b5e63
fixed coordinate system
DonnyLe b603834
completely broken but replaced react-draggable with react-rnd
DonnyLe b1baa1b
worked on frontend
DonnyLe f09bae1
broken but fixed some bugs
DonnyLe a19dc70
multiple boxes + grouping works
DonnyLe effb4e8
Update AssignInput.tsx
DonnyLe 9cf7152
Made some front-end changes to match figma file
Gayatri-K26 c946d7e
fixed zooming in and added overflow scroll to page
DonnyLe 14d365c
fixed frontend to match figma more
DonnyLe 35fcf80
fixes to make it better accuracy to figma
DonnyLe 5c920c7
Update AssignInput.tsx
DonnyLe 613c2bf
merge
kaiyangzheng bd7bd5e
Clean up form editor and make draggable text work
kaiyangzheng a1457cd
Finish form editor with draggable text
kaiyangzheng 226bd43
fix imports
kaiyangzheng 85dcb66
test
kaiyangzheng c8ea7ad
refactored to support multiple pages and complete styling + fixed bugs
DonnyLe 7806953
Merge branch 'main' into #216-Form-Instance-Assign-Fields-and-Groups
DonnyLe fec3613
prettier fix
DonnyLe ec27296
update name
kaiyangzheng 115ed76
update nav link
kaiyangzheng 4ec01ef
addressed comments
DonnyLe 88c1922
Merge branch 'main' into #216-Form-Instance-Assign-Fields-and-Groups
DonnyLe 725db76
integrated with create template pages
DonnyLe e77a5b5
persist form fields throughout
kaiyangzheng e1595ff
Remove console log
kaiyangzheng 6b8014b
done
kaiyangzheng c14df2f
nvm
kaiyangzheng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
apps/web/src/components/createFormTemplate/createFormTemplateEditor/AssignInput.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Box, Text } from '@chakra-ui/react'; | ||
import { FormEditor } from './FormEditor'; | ||
|
||
export const AssignInput = () => { | ||
return ( | ||
<Box margin="36px" display="flex" flexDirection="column" gap="20px"> | ||
<Box> | ||
<Text fontSize="30px" fontWeight="700" lineHeight="38px"> | ||
Create form template | ||
</Text> | ||
<Text | ||
fontSize="19px" | ||
color="#4B4C4F" | ||
fontFamily="Hanken Grotesk" | ||
fontWeight="500" | ||
lineHeight="26px" | ||
wordBreak="break-word" | ||
> | ||
Select an assignee group and drag to add input fields for each | ||
</Text> | ||
</Box> | ||
<FormEditor | ||
formTemplateName="Authorization Form" | ||
pdfUrl={'http://localhost:3002/test.pdf'} | ||
disableEdit={false} | ||
/> | ||
</Box> | ||
); | ||
}; |
46 changes: 46 additions & 0 deletions
46
apps/web/src/components/createFormTemplate/createFormTemplateEditor/DraggableSignature.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import Draggable, { DraggableEventHandler } from 'react-draggable'; | ||
|
||
export default function DraggableSignature({ | ||
onEnd, | ||
onSet, | ||
onCancel, | ||
url, | ||
}: { | ||
onEnd: DraggableEventHandler; | ||
onSet: () => void; | ||
onCancel: () => void; | ||
url: string; | ||
}) { | ||
const styles = { | ||
container: { | ||
Position: 'absolute', | ||
zIndex: 100000, | ||
border: `2px solid gray`, | ||
}, | ||
controls: { | ||
Position: 'absolute', | ||
right: 0, | ||
display: 'inline-block', | ||
backgroundColor: 'white', | ||
}, | ||
smallButton: { | ||
display: 'inline-block', | ||
cursor: 'pointer', | ||
padding: 4, | ||
}, | ||
}; | ||
return ( | ||
<Draggable onStop={onEnd}> | ||
<div style={styles.container}> | ||
<div style={styles.controls}> | ||
<div style={styles.smallButton} onClick={onSet}> | ||
Set{' '} | ||
</div> | ||
<div style={styles.smallButton} onClick={onCancel}> | ||
Cancel | ||
</div> | ||
</div> | ||
</div> | ||
</Draggable> | ||
); | ||
} |
63 changes: 63 additions & 0 deletions
63
apps/web/src/components/createFormTemplate/createFormTemplateEditor/DraggableText.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Rnd, RndResizeCallback } from 'react-rnd'; | ||
import { DraggableEventHandler } from 'react-draggable'; | ||
import { TextFieldPosition } from './FormEditor'; | ||
import { FaTimes } from 'react-icons/fa'; | ||
|
||
export default function DraggableText({ | ||
onStop, | ||
onResizeStop, | ||
color, | ||
onRemove, | ||
currentPosition, | ||
disableEdit, | ||
}: { | ||
onStop: DraggableEventHandler; | ||
onResizeStop: RndResizeCallback; | ||
initialText: string | null; | ||
color: string; | ||
onRemove: () => void; | ||
currentPosition: TextFieldPosition; | ||
disableEdit: boolean; | ||
}) { | ||
return ( | ||
<Rnd | ||
bounds="parent" | ||
position={{ x: currentPosition.x, y: currentPosition.y }} | ||
size={{ height: currentPosition.height, width: currentPosition.width }} | ||
DonnyLe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
minWidth="50px" | ||
minHeight="40px" | ||
style={{ | ||
position: 'absolute', | ||
zIndex: 100000, | ||
background: `${color}`, | ||
opacity: '10px', | ||
border: `solid 1px grey`, | ||
padding: 4, | ||
}} | ||
onDragStop={onStop} | ||
onResizeStop={onResizeStop} | ||
disableDragging={disableEdit} | ||
> | ||
<div | ||
style={{ | ||
position: 'absolute', | ||
display: 'inline-block', | ||
borderRadius: 4, | ||
}} | ||
> | ||
{!disableEdit && ( | ||
<div | ||
style={{ | ||
display: 'inline-block', | ||
cursor: 'pointer', | ||
padding: 4, | ||
}} | ||
onClick={onRemove} | ||
> | ||
<FaTimes color={'#ef6565'} /> | ||
</div> | ||
)} | ||
</div> | ||
</Rnd> | ||
); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.