-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b689758
commit da09277
Showing
12 changed files
with
346 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 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 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
103 changes: 103 additions & 0 deletions
103
dear_petition/petition/migrations/0061_client_alter_generatedpetition_form_type_and_more.py
This file contains 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,103 @@ | ||
# Generated by Django 4.2.9 on 2024-05-26 17:02 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("petition", "0060_alter_contact_user"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Client", | ||
fields=[ | ||
( | ||
"contact_ptr", | ||
models.OneToOneField( | ||
auto_created=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
parent_link=True, | ||
primary_key=True, | ||
serialize=False, | ||
to="petition.contact", | ||
), | ||
), | ||
("dob", models.DateField(blank=True, null=True)), | ||
], | ||
bases=("petition.contact",), | ||
), | ||
migrations.AlterField( | ||
model_name="generatedpetition", | ||
name="form_type", | ||
field=models.CharField( | ||
choices=[ | ||
("AOC-CR-281", "AOC-CR-281"), | ||
("AOC-CR-285", "AOC-CR-285"), | ||
("AOC-CR-287", "AOC-CR-287"), | ||
("AOC-CR-288", "AOC-CR-288"), | ||
("AOC-CR-293", "AOC-CR-293"), | ||
("AOC-CR-297", "AOC-CR-297"), | ||
("AOC-CR-298", "AOC-CR-298"), | ||
("Addendum 3B", "Addendum 3B"), | ||
], | ||
max_length=255, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="petition", | ||
name="agencies", | ||
field=models.ManyToManyField(related_name="+", to="petition.contact"), | ||
), | ||
migrations.AlterField( | ||
model_name="petition", | ||
name="form_type", | ||
field=models.CharField( | ||
choices=[ | ||
("AOC-CR-281", "AOC-CR-281"), | ||
("AOC-CR-285", "AOC-CR-285"), | ||
("AOC-CR-287", "AOC-CR-287"), | ||
("AOC-CR-288", "AOC-CR-288"), | ||
("AOC-CR-293", "AOC-CR-293"), | ||
("AOC-CR-297", "AOC-CR-297"), | ||
("AOC-CR-298", "AOC-CR-298"), | ||
("Addendum 3B", "Addendum 3B"), | ||
], | ||
max_length=255, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="petitiondocument", | ||
name="agencies", | ||
field=models.ManyToManyField(related_name="+", to="petition.contact"), | ||
), | ||
migrations.AlterField( | ||
model_name="petitiondocument", | ||
name="form_type", | ||
field=models.CharField( | ||
choices=[ | ||
("AOC-CR-281", "AOC-CR-281"), | ||
("AOC-CR-285", "AOC-CR-285"), | ||
("AOC-CR-287", "AOC-CR-287"), | ||
("AOC-CR-288", "AOC-CR-288"), | ||
("AOC-CR-293", "AOC-CR-293"), | ||
("AOC-CR-297", "AOC-CR-297"), | ||
("AOC-CR-298", "AOC-CR-298"), | ||
("Addendum 3B", "Addendum 3B"), | ||
], | ||
max_length=255, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="batch", | ||
name="client", | ||
field=models.ForeignKey( | ||
limit_choices_to={"category": "client"}, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="batches", | ||
to="petition.client", | ||
), | ||
), | ||
] |
This file contains 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 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 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 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 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,34 @@ | ||
import { useController } from 'react-hook-form'; | ||
import { AnimatePresence } from 'framer-motion'; | ||
import { InputWrapper, InputStyled, ActualInputStyled, InputErrors } from './Input.styled'; | ||
|
||
const FormDateInput = ({ className, label, errors, inputProps, ...restProps }) => { | ||
const { field, fieldState } = useController(inputProps); | ||
const { error: inputError } = fieldState; | ||
const error = inputError ? ( | ||
<p>Invalid date</p> | ||
) : ( | ||
// eslint-disable-next-line react/no-array-index-key | ||
errors?.map((errMsg, i) => <p key={`${i}${errMsg}`}>{errMsg}</p>) | ||
); | ||
return ( | ||
<InputWrapper className={className}> | ||
<InputStyled>{label}</InputStyled> | ||
<ActualInputStyled type="date" {...field} {...restProps} /> | ||
{error && ( | ||
<AnimatePresence> | ||
<InputErrors | ||
initial={{ opacity: 0, y: -25 }} | ||
animate={{ opacity: 1, y: 0 }} | ||
exit={{ opacity: 0, y: '50' }} | ||
positionTransition | ||
> | ||
{error} | ||
</InputErrors> | ||
</AnimatePresence> | ||
)} | ||
</InputWrapper> | ||
); | ||
}; | ||
|
||
export default FormDateInput; |
This file contains 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
Oops, something went wrong.