Skip to content

Commit

Permalink
fe: add document type fields to schema and add inputs to NewAdopterForm
Browse files Browse the repository at this point in the history
  • Loading branch information
samu9 committed Feb 21, 2025
1 parent 2d5b254 commit 3546199
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
44 changes: 33 additions & 11 deletions frontend/src/components/adopter/NewAdopterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,24 @@ const NewAdopterForm = (props: Props) => {
className="w-64"
/>
</div>
<ControlledInputText
fieldName="fiscal_code"
label="Codice fiscale"
uppercase
className="w-64"
/>
<ControlledInputDate
fieldName="birth_date"
label="Data di nascita"
className="w-64"
/>
<div className="flex gap-2">
<ControlledInputText
fieldName="fiscal_code"
label="Codice fiscale"
uppercase
className="w-64"
/>
<ControlledInputDate
fieldName="birth_date"
label="Data di nascita"
className="w-64"
/>
</div>
<div className="flex gap-2">
<UncontrolledProvinceDropdown
onChange={(value) => setProvinciaNascita(value)}
className="w-64"
label="Provincia di nascita"
/>
<ControlledDropdown
label="Comune di nascita"
Expand Down Expand Up @@ -109,6 +112,25 @@ const NewAdopterForm = (props: Props) => {
className="w-64"
/>
</div>

<div className="flex gap-2">
<ControlledDropdown
label="Tipo documento"
optionLabel="name"
optionValue="id"
options={[
{ name: "Carta di identità", id: "id" },
{ name: "Patente di guida", id: "dl" },
]}
fieldName="document_type"
className="w-64"
/>
<ControlledInputText
fieldName="document_number"
label="Numero documento"
className="w-64"
/>
</div>
<ControlledInputText
fieldName="phone"
label="Telefono"
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/models/adopter.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const newAdopterSchema = z.object({
fiscal_code: z.string().min(16).max(16),
residence_city_code: z.string().min(4).max(4),
phone: z.string().min(9),
document_type: z.string().length(2),
document_number: z.string(),
})

export type NewAdopter = z.infer<typeof newAdopterSchema>
Expand Down

0 comments on commit 3546199

Please sign in to comment.