-
Notifications
You must be signed in to change notification settings - Fork 0
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
244 feature add signature input in create form template flow #272
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
Warnings: | ||
|
||
- You are about to drop the column `employeeId` on the `Signature` table. All the data in the column will be lost. | ||
|
||
*/ | ||
-- DropForeignKey | ||
ALTER TABLE "Signature" DROP CONSTRAINT "Signature_employeeId_fkey"; | ||
|
||
-- AlterTable | ||
ALTER TABLE "Signature" DROP COLUMN "employeeId"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { useRef, useState } from 'react'; | ||
import { Document, Page, pdfjs } from 'react-pdf'; | ||
import { Box, Text, Button } from '@chakra-ui/react'; | ||
import { TextIcon, PlusSign } from 'apps/web/src/static/icons'; | ||
import { TextIcon, PlusSign, SignatureIcon } from 'apps/web/src/static/icons'; | ||
import { DraggableData, DraggableEvent } from 'react-draggable'; | ||
import PagingControl from './PagingControl'; | ||
import { v4 as uuidv4 } from 'uuid'; | ||
|
@@ -50,6 +50,7 @@ export const FormEditor = ({ | |
const [totalPages, setTotalPages] = useState(0); | ||
const documentRef = useRef<HTMLDivElement>(null); | ||
const [groupNum, setGroupNum] = useState(fieldGroups.size); | ||
const [signatureFieldId, setSignatureFieldId] = useState<string | null>(null); | ||
|
||
//colors for group buttons: colors[0] = border/text color, colors[1] = background color | ||
const groupColors = [ | ||
|
@@ -133,6 +134,24 @@ export const FormEditor = ({ | |
} | ||
}; | ||
|
||
const handleSetSignature = () => { | ||
const newFieldId = uuidv4(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic is valid, I would create a new component other than DraggableText to represent signatures, especially with the new designs for signature boxes: https://www.figma.com/design/xTNJRHyohsIf714Ba1eWFY/Hi-fi-Wireframes?node-id=5741-1908&m=dev |
||
setSignatureFieldId(newFieldId); | ||
setFormFields({ | ||
...formFields, | ||
[pageNum]: new Map([ | ||
...formFields[pageNum], | ||
[ | ||
newFieldId, | ||
{ | ||
position: { x: 0, y: 0, width: 150, height: 50 }, | ||
groupId: currentGroup, | ||
}, | ||
], | ||
]), | ||
}); | ||
}; | ||
|
||
return ( | ||
<Box | ||
background="white" | ||
|
@@ -233,6 +252,23 @@ export const FormEditor = ({ | |
> | ||
<div>{TextIcon}</div> | ||
</Button> | ||
|
||
<Button | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Selecting this should disable the text box input and make the background of the signature button darker. Not sure if I'm looking at it wrong, but the screenshots look off, as the Text button is still selected. |
||
position="relative" | ||
width="40px" | ||
height="40px" | ||
backgroundColor="#1367EA" | ||
borderRadius="4px" | ||
display="flex" | ||
justifyContent="center" | ||
alignItems="center" | ||
isDisabled={fieldGroups.size == 0 || disableEdit} | ||
border="1px solid #1367EA" | ||
onClick={() => handleSetSignature()} | ||
> | ||
<div>{SignatureIcon}</div> | ||
</Button> | ||
|
||
</Box> | ||
<Box | ||
height="474px" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't have to make a new migration - i would delete this folder. I think this comes from running yarn prisma migrate dev, which automatically generates a new migration. I think yarn prisma migrate reset to run the migrations + seedings should be fine