check if date field is in use

This commit is contained in:
Ollie Halliday
2023-10-22 17:06:53 +01:00
parent 7afe8cfa18
commit d9161985ad

View File

@ -44,6 +44,8 @@ export const SigningForm = ({ document, recipient, fields }: SigningFormProps) =
const [validateUninsertedFields, setValidateUninsertedFields] = useState(false); const [validateUninsertedFields, setValidateUninsertedFields] = useState(false);
const hasDateField = fields.find((field) => field.type === 'DATE');
const { const {
handleSubmit, handleSubmit,
formState: { isSubmitting }, formState: { isSubmitting },
@ -113,27 +115,29 @@ export const SigningForm = ({ document, recipient, fields }: SigningFormProps) =
/> />
</div> </div>
<div> {hasDateField && (
<Label htmlFor="date-format">Date Format</Label> <div>
<Label htmlFor="date-format">Date Format</Label>
<Select <Select
onValueChange={(value) => { onValueChange={(value) => {
setDateFormat(value); setDateFormat(value);
}} }}
defaultValue={dateFormat} defaultValue={dateFormat}
> >
<SelectTrigger className="bg-background mt-2"> <SelectTrigger className="bg-background mt-2">
<SelectValue /> <SelectValue />
</SelectTrigger> </SelectTrigger>
<SelectContent> <SelectContent>
{DATE_FORMATS.map((format) => ( {DATE_FORMATS.map((format) => (
<SelectItem key={format.key} value={format.value}> <SelectItem key={format.key} value={format.value}>
{format.label} {format.label}
</SelectItem> </SelectItem>
))} ))}
</SelectContent> </SelectContent>
</Select> </Select>
</div> </div>
)}
<div> <div>
<Label htmlFor="Signature">Signature</Label> <Label htmlFor="Signature">Signature</Label>