From 396a332f545e5b5547ce4a426c842f98291ba752 Mon Sep 17 00:00:00 2001 From: jeanetteobr Date: Tue, 31 Dec 2024 06:07:51 +0000 Subject: [PATCH] Update to community response notification signup form. --- apps/notifications/forms.py | 19 +--- ...lter_communityresponsesubscriber_fields.py | 56 +++++++++ apps/notifications/models.py | 106 ++++++++++++++++-- .../notifications/notification_signup.html | 8 +- apps/notifications/tests/factories.py | 9 +- .../styles/includes/notification_signup.scss | 4 + 6 files changed, 169 insertions(+), 33 deletions(-) create mode 100644 apps/notifications/migrations/0009_alter_communityresponsesubscriber_fields.py diff --git a/apps/notifications/forms.py b/apps/notifications/forms.py index 032b5b94..1ab1728a 100644 --- a/apps/notifications/forms.py +++ b/apps/notifications/forms.py @@ -98,25 +98,18 @@ def about_you_fields(self): about_you_field_names = [ "first_name", "last_name", - "organization_name", - "title", - ] - return [self[name] for name in self.fields if name in about_you_field_names] - - def contact_information_fields(self): - contact_info_field_names = [ "email_address", "cell_phone", ] - return [self[name] for name in self.fields if name in contact_info_field_names] + return [self[name] for name in self.fields if name in about_you_field_names] def organization_info_fields(self): organization_info_field_names = [ - "organization_street_address", - "organization_po_box", + "organization_name", + "organization_type", "organization_zip_code", - "organization_zip_codes_served", "organization_community_members_served", + "organization_mission_statement", ] return [ self[name] for name in self.fields if name in organization_info_field_names @@ -126,10 +119,6 @@ def form_sections(self): """Return the sections of this form, including a header, and the fields in the section.""" return [ {"header": "About You", "fields": self.about_you_fields()}, - { - "header": "Contact Information", - "fields": self.contact_information_fields(), - }, { "header": "Organization Information", "fields": self.organization_info_fields(), diff --git a/apps/notifications/migrations/0009_alter_communityresponsesubscriber_fields.py b/apps/notifications/migrations/0009_alter_communityresponsesubscriber_fields.py new file mode 100644 index 00000000..54cc9393 --- /dev/null +++ b/apps/notifications/migrations/0009_alter_communityresponsesubscriber_fields.py @@ -0,0 +1,56 @@ +# Generated by Django 3.2.23 on 2024-12-31 05:42 + +from django.db import migrations, models +import phonenumber_field.modelfields + + +class Migration(migrations.Migration): + + dependencies = [ + ('notifications', '0008_coderedcodebluesubscriber_fields_are_optional'), + ] + + operations = [ + migrations.RemoveField( + model_name='communityresponsesubscriber', + name='organization_po_box', + ), + migrations.RemoveField( + model_name='communityresponsesubscriber', + name='organization_street_address', + ), + migrations.RemoveField( + model_name='communityresponsesubscriber', + name='organization_zip_codes_served', + ), + migrations.AddField( + model_name='communityresponsesubscriber', + name='organization_mission_statement', + field=models.CharField(default='', max_length=255, verbose_name='Mission Statement'), + ), + migrations.AddField( + model_name='communityresponsesubscriber', + name='organization_type', + field=models.CharField(blank=True, choices=[("('Arts and Culture', 'Arts and Culture')", 'Arts Culture'), ("('Block Captain', 'Block Captain')", 'Block Captain'), ("('Civic Engagement/Elected Official', 'Civic Engagement/Elected Official')", 'Civic Engagement Elected Official'), ("('Disabilities and Access and Functional Needs', 'Disabilities and Access and Functional Needs')", 'Disabilities Access Functional Needs'), ("('Education (Schools/Colleges/Universities)', 'Education (Schools/Colleges/Universities)')", 'Education'), ("('Free Library of Philadelphia', 'Free Library of Philadelphia')", 'Free Library Of Philadelphia'), ("('General Community Services', 'General Community Services')", 'General Community Services'), ("('Healthcare', 'Healthcare')", 'Healthcare'), ("('Immigrante/Refugee/Communities that speak languages other than English', 'Immigrante/Refugee/Communities that speak languages other than English')", 'Immigrant Refugee Communities'), ("('Live Bird Market', 'Live Bird Market')", 'Live Bird Market'), ("('Mental/Behavioral Health', 'Mental/Behavioral Health')", 'Mental Behavioral Health'), ("('Older Adults', 'Older Adults')", 'Older Adults'), ("('Housing/Homeless Services', 'Housing/Homeless Services')", 'Housing Homeless Services'), ("('RCO/CDC/NAC', 'RCO/CDC/NAC')", 'Rco Cdc Nac'), ("('Recreational', 'Recreational')", 'Recreational'), ("('Religious/Faith-based', 'Religious/Faith-based')", 'Religious Faith Based'), ("('Workers', 'Workers')", 'Workers'), ("('Youth', 'Youth')", 'Youth'), ("('Unaffiliated Community Leader', 'Unaffiliated Community Leader')", 'Unaffiliated Community Leader')], default='', max_length=150, verbose_name='Organization Type*'), + ), + migrations.AlterField( + model_name='communityresponsesubscriber', + name='cell_phone', + field=phonenumber_field.modelfields.PhoneNumberField(max_length=128, region=None, verbose_name='Cell Phone'), + ), + migrations.AlterField( + model_name='communityresponsesubscriber', + name='first_name', + field=models.CharField(default='', max_length=255, verbose_name='First Name'), + ), + migrations.AlterField( + model_name='communityresponsesubscriber', + name='last_name', + field=models.CharField(default='', max_length=255, verbose_name='Last Name'), + ), + migrations.AlterField( + model_name='communityresponsesubscriber', + name='organization_community_members_served', + field=models.CharField(choices=[('Children/Youth', 'Children/Youth'), ('Older Adults', 'Older Adults'), ('Marginalized racial or ethnic group', 'Marginalized racial or ethnic group'), ('Immigrant', 'Immigrant'), ('refugee or undocumented communities', 'refugee or undocumented communities'), ('Gender non-conforming/non-binary', 'Gender non-conforming/non-binary'), ('LGBTQ+', 'LGBTQ+'), ('Unemployed', 'Unemployed'), ('Uninsured/Underinsured', 'Uninsured/Underinsured'), ('Experiencing homelessness', 'Experiencing homelessness'), ('Low-income communities', 'Low-income communities'), ('People with disabilities', 'People with disabilities'), ('People who are homebound', 'People who are homebound'), ('Living with a mental illness', 'Living with a mental illness'), ('Living with a substance use disorder', 'Living with a substance use disorder'), ('Chronically ill', 'Chronically ill'), ('Returning citizens', 'Returning citizens'), ('Currently incarcerated', 'Currently incarcerated'), ('Faith communities', 'Faith communities'), ('Minimal to no digital access', 'Minimal to no digital access'), ('Pregnant', 'Pregnant'), ('Single parent', 'Single parent'), ('Veterans', 'Veterans'), ('Limited English proficient', 'Limited English proficient'), ('Caregiver dependent', 'Caregiver dependent'), ('No access to private vehicle', 'No access to private vehicle'), ('Dependent on prescription medications', 'Dependent on prescription medications'), ('Living in a congregate setting', 'Living in a congregate setting'), ('Students', 'Students'), ('Survivors of violence or abuse', 'Survivors of violence or abuse'), ('Essential worker', 'Essential worker'), ('General public', 'General public'), ('Other', 'Other'), ('All of these', 'All of these')], max_length=100, verbose_name='Community Members Served'), + ), + ] diff --git a/apps/notifications/models.py b/apps/notifications/models.py index 5c0c2bba..335e0710 100644 --- a/apps/notifications/models.py +++ b/apps/notifications/models.py @@ -339,13 +339,91 @@ class COMMUNITY_MEMBERS_CHOICES(models.TextChoices): "All of these", ) + class ORGANIZATION_TYPE_CHOICES(models.TextChoices): + ARTS_CULTURE = ( + "Arts and Culture", + "Arts and Culture", + ), + BLOCK_CAPTAIN = ( + "Block Captain", + "Block Captain", + ), + CIVIC_ENGAGEMENT_ELECTED_OFFICIAL = ( + "Civic Engagement/Elected Official", + "Civic Engagement/Elected Official", + ), + DISABILITIES_ACCESS_FUNCTIONAL_NEEDS = ( + "Disabilities and Access and Functional Needs", + "Disabilities and Access and Functional Needs", + ), + EDUCATION = ( + "Education (Schools/Colleges/Universities)", + "Education (Schools/Colleges/Universities)", + ), + FREE_LIBRARY_OF_PHILADELPHIA = ( + "Free Library of Philadelphia", + "Free Library of Philadelphia", + ), + GENERAL_COMMUNITY_SERVICES = ( + "General Community Services", + "General Community Services", + ), + HEALTHCARE = ( + "Healthcare", + "Healthcare", + ), + IMMIGRANT_REFUGEE_COMMUNITIES = ( + "Immigrante/Refugee/Communities that speak languages other than English", + "Immigrante/Refugee/Communities that speak languages other than English", + ), + LIVE_BIRD_MARKET = ( + "Live Bird Market", + "Live Bird Market", + ), + MENTAL_BEHAVIORAL_HEALTH = ( + "Mental/Behavioral Health", + "Mental/Behavioral Health", + ), + OLDER_ADULTS = ( + "Older Adults", + "Older Adults", + ), + HOUSING_HOMELESS_SERVICES = ( + "Housing/Homeless Services", + "Housing/Homeless Services", + ), + RCO_CDC_NAC = ( + "RCO/CDC/NAC", + "RCO/CDC/NAC", + ), + RECREATIONAL = ( + "Recreational", + "Recreational", + ), + RELIGIOUS_FAITH_BASED = ( + "Religious/Faith-based", + "Religious/Faith-based", + ), + WORKERS = ( + "Workers", + "Workers", + ), + YOUTH = ( + "Youth", + "Youth", + ), + UNAFFILIATED_COMMUNITY_LEADER = ( + "Unaffiliated Community Leader", + "Unaffiliated Community Leader", + ), + first_name = models.CharField( - "First Name*", + "First Name", max_length=255, default="", ) last_name = models.CharField( - "Last Name*", + "Last Name", max_length=255, default="", ) @@ -361,13 +439,14 @@ class COMMUNITY_MEMBERS_CHOICES(models.TextChoices): ) email_address = models.EmailField("Email Address*") - cell_phone = PhoneNumberField("Cell Phone*") + cell_phone = PhoneNumberField("Cell Phone") - organization_street_address = models.CharField( - "Street Address of Organization*", max_length=255 - ) - organization_po_box = models.CharField( - "Organization PO Box", max_length=255, blank=True + organization_type = models.CharField( + "Organization Type*", + max_length=150, + default="", + choices=ORGANIZATION_TYPE_CHOICES.choices, + blank=True, ) organization_zip_code = models.CharField( "Zip Code of Organization*", @@ -375,15 +454,18 @@ class COMMUNITY_MEMBERS_CHOICES(models.TextChoices): default="", validators=[zipcode_validator], ) - organization_zip_codes_served = models.CharField( - "Zip Codes Served by Your Organization*", max_length=255, default="" - ) organization_community_members_served = models.CharField( - "Community Members Served by Your Organization*", + "Community Members Served", max_length=100, choices=COMMUNITY_MEMBERS_CHOICES.choices, ) + organization_mission_statement = models.CharField( + "Mission Statement", + max_length=255, + default="", + ) + class Meta: verbose_name_plural = "Community Response Subscribers" diff --git a/apps/notifications/templates/notifications/notification_signup.html b/apps/notifications/templates/notifications/notification_signup.html index fcc56388..7b698629 100644 --- a/apps/notifications/templates/notifications/notification_signup.html +++ b/apps/notifications/templates/notifications/notification_signup.html @@ -30,7 +30,13 @@
{{ form_section.header }}
{% for field in form_section.fields %}
- +
{% if field|widget_class == "Select" %}
diff --git a/apps/notifications/tests/factories.py b/apps/notifications/tests/factories.py index de4ec75e..f54cef90 100644 --- a/apps/notifications/tests/factories.py +++ b/apps/notifications/tests/factories.py @@ -31,18 +31,17 @@ class Meta: first_name = factory.faker.Faker("first_name") last_name = factory.faker.Faker("last_name") organization_name = factory.faker.Faker("company") + organization_type = random.choice( + [str(l) for l in CommunityResponseSubscriber.ORGANIZATION_TYPE_CHOICES] + ) title = factory.faker.Faker("job") email_address = factory.faker.Faker("email") cell_phone = factory.faker.Faker("phone_number") - organization_street_address = factory.faker.Faker("street_address") - organization_po_box = random.randint(0, 9999) organization_zip_code = factory.faker.Faker("postcode") - organization_zip_codes_served = ", ".join( - [str(random.randint(11111, 99999)) for i in range(0, random.randint(0, 5))] - ) organization_community_members_served = random.choice( [str(l) for l in CommunityResponseSubscriber.COMMUNITY_MEMBERS_CHOICES] ) + organization_mission_statement = factory.faker.Faker("text") class InternalEmployeeAlertSubscriberFactory(factory.django.DjangoModelFactory): diff --git a/hip/static/styles/includes/notification_signup.scss b/hip/static/styles/includes/notification_signup.scss index c749df82..83b0b233 100644 --- a/hip/static/styles/includes/notification_signup.scss +++ b/hip/static/styles/includes/notification_signup.scss @@ -5,3 +5,7 @@ @include headers; @include paragraphs; } + +.required { + color: red; +} \ No newline at end of file