diff --git a/src/registrar/assets/sass/_theme/_forms.scss b/src/registrar/assets/sass/_theme/_forms.scss index b5229fae1..c025bdb29 100644 --- a/src/registrar/assets/sass/_theme/_forms.scss +++ b/src/registrar/assets/sass/_theme/_forms.scss @@ -81,4 +81,4 @@ legend.float-left-tablet + button.float-right-tablet { background-color: var(--body-fg); color: var(--close-button-hover-bg); } -} \ No newline at end of file +} diff --git a/src/registrar/models/domain_request.py b/src/registrar/models/domain_request.py index 2501cdc87..d4bdeea66 100644 --- a/src/registrar/models/domain_request.py +++ b/src/registrar/models/domain_request.py @@ -938,3 +938,131 @@ class DomainRequest(TimeStampedModel): for field in opts.many_to_many: data[field.name] = field.value_from_object(self) return data + + def _is_federal_complete(self): + # Federal -> "Federal government branch" page can't be empty + Federal Agency selection can't be None + return not (self.federal_type is None or self.federal_agency is None) + + def _is_interstate_complete(self): + # Interstate -> "About your organization" page can't be empty + return self.about_your_organization is not None + + def _is_state_or_territory_complete(self): + # State -> ""Election office" page can't be empty + return self.is_election_board is not None + + def _is_tribal_complete(self): + # Tribal -> "Tribal name" and "Election office" page can't be empty + return self.tribe_name is not None and self.is_election_board is not None + + def _is_county_complete(self): + # County -> "Election office" page can't be empty + return self.is_election_board is not None + + def _is_city_complete(self): + # City -> "Election office" page can't be empty + return self.is_election_board is not None + + def _is_special_district_complete(self): + # Special District -> "Election office" and "About your organization" page can't be empty + return self.is_election_board is not None and self.about_your_organization is not None + + def _is_organization_name_and_address_complete(self): + return not ( + self.organization_name is None + and self.address_line1 is None + and self.city is None + and self.state_territory is None + and self.zipcode is None + ) + + def _is_authorizing_official_complete(self): + return self.authorizing_official is not None + + def _is_requested_domain_complete(self): + return self.requested_domain is not None + + def _is_purpose_complete(self): + return self.purpose is not None + + def _is_submitter_complete(self): + return self.submitter is not None + + def _has_other_contacts_and_filled(self): + # Other Contacts Radio button is Yes and if all required fields are filled + return ( + self.has_other_contacts() + and self.other_contacts.filter( + first_name__isnull=False, + last_name__isnull=False, + title__isnull=False, + email__isnull=False, + phone__isnull=False, + ).exists() + ) + + def _has_no_other_contacts_gives_rationale(self): + # Other Contacts Radio button is No and a rationale is provided + return self.has_other_contacts() is False and self.no_other_contacts_rationale is not None + + def _is_other_contacts_complete(self): + if self._has_other_contacts_and_filled() or self._has_no_other_contacts_gives_rationale(): + return True + return False + + def _cisa_rep_and_email_check(self): + # Has a CISA rep + email is NOT empty or NOT an empty string OR doesn't have CISA rep + return ( + self.has_cisa_representative is True + and self.cisa_representative_email is not None + and self.cisa_representative_email != "" + ) or self.has_cisa_representative is False + + def _anything_else_radio_button_and_text_field_check(self): + # Anything else boolean is True + filled text field and it's not an empty string OR the boolean is No + return ( + self.has_anything_else_text is True and self.anything_else is not None and self.anything_else != "" + ) or self.has_anything_else_text is False + + def _is_additional_details_complete(self): + return self._cisa_rep_and_email_check() and self._anything_else_radio_button_and_text_field_check() + + def _is_policy_acknowledgement_complete(self): + return self.is_policy_acknowledged is not None + + def _is_general_form_complete(self): + return ( + self._is_organization_name_and_address_complete() + and self._is_authorizing_official_complete() + and self._is_requested_domain_complete() + and self._is_purpose_complete() + and self._is_submitter_complete() + and self._is_other_contacts_complete() + and self._is_additional_details_complete() + and self._is_policy_acknowledgement_complete() + ) + + def _form_complete(self): + match self.generic_org_type: + case DomainRequest.OrganizationChoices.FEDERAL: + is_complete = self._is_federal_complete() + case DomainRequest.OrganizationChoices.INTERSTATE: + is_complete = self._is_interstate_complete() + case DomainRequest.OrganizationChoices.STATE_OR_TERRITORY: + is_complete = self._is_state_or_territory_complete() + case DomainRequest.OrganizationChoices.TRIBAL: + is_complete = self._is_tribal_complete() + case DomainRequest.OrganizationChoices.COUNTY: + is_complete = self._is_county_complete() + case DomainRequest.OrganizationChoices.CITY: + is_complete = self._is_city_complete() + case DomainRequest.OrganizationChoices.SPECIAL_DISTRICT: + is_complete = self._is_special_district_complete() + case _: + # NOTE: Shouldn't happen, this is only if somehow they didn't choose an org type + is_complete = False + + if not is_complete or not self._is_general_form_complete(): + return False + + return True diff --git a/src/registrar/templates/domain_request_form.html b/src/registrar/templates/domain_request_form.html index cde12ad80..17948a110 100644 --- a/src/registrar/templates/domain_request_form.html +++ b/src/registrar/templates/domain_request_form.html @@ -105,7 +105,7 @@ aria-describedby="Are you sure you want to submit a domain request?" data-force-action > - {% include 'includes/modal.html' with modal_heading=modal_heading|safe modal_description="Once you submit this request, you won’t be able to edit it until we review it. You’ll only be able to withdraw your request." modal_button=modal_button|safe %} + {% include 'includes/modal.html' with is_domain_request_form=True review_form_is_complete=review_form_is_complete modal_heading=modal_heading|safe modal_description=modal_description|safe modal_button=modal_button|safe %} {% block after_form_content %}{% endblock %} diff --git a/src/registrar/templates/domain_request_review.html b/src/registrar/templates/domain_request_review.html index 5f359e95f..1f21683a5 100644 --- a/src/registrar/templates/domain_request_review.html +++ b/src/registrar/templates/domain_request_review.html @@ -25,11 +25,11 @@ {% if step == Step.ORGANIZATION_TYPE %} {% namespaced_url 'domain-request' step as domain_request_url %} {% if domain_request.generic_org_type is not None %} - {% with title=form_titles|get_item:step value=domain_request.get_generic_org_type_display|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.get_generic_org_type_display|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete" %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -37,7 +37,7 @@ {% if step == Step.TRIBAL_GOVERNMENT %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.tribe_name|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.tribe_name|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% if domain_request.federally_recognized_tribe %}
Federally-recognized tribe
{% endif %} @@ -47,7 +47,7 @@ {% if step == Step.ORGANIZATION_FEDERAL %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.get_federal_type_display|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.get_federal_type_display|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -66,7 +66,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url address='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value='Incomplete' %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -74,7 +74,7 @@ {% if step == Step.ABOUT_YOUR_ORGANIZATION %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.about_your_organization|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.about_your_organization|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -86,7 +86,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete" %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -107,7 +107,7 @@ {% if step == Step.DOTGOV_DOMAIN %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete"|safe%} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} @@ -123,7 +123,7 @@ {% if step == Step.PURPOSE %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.purpose|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.purpose|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -135,7 +135,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete" %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -148,7 +148,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' list='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value=domain_request.no_other_contacts_rationale|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.no_other_contacts_rationale|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -157,7 +157,7 @@ {% if step == Step.ADDITIONAL_DETAILS %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title sub_header_text='CISA regional representative' value=domain_request.cisa_representative_email heading_level=heading_level editable=True edit_link=domain_request_url custom_text_for_value_none='No' %} {% endwith %} diff --git a/src/registrar/templates/includes/modal.html b/src/registrar/templates/includes/modal.html index 8e6cb66d5..b0b316a2f 100644 --- a/src/registrar/templates/includes/modal.html +++ b/src/registrar/templates/includes/modal.html @@ -18,12 +18,18 @@