mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-19 02:49:21 +02:00
Adding biz logic in
This commit is contained in:
parent
cfce03ac8d
commit
7f42ecb867
4 changed files with 112 additions and 15 deletions
|
@ -32,6 +32,11 @@
|
||||||
border-left: none;
|
border-left: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.incomplete {
|
||||||
|
color: red;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
legend.float-left-tablet + button.float-right-tablet {
|
legend.float-left-tablet + button.float-right-tablet {
|
||||||
margin-top: .5rem;
|
margin-top: .5rem;
|
||||||
@include at-media('tablet') {
|
@include at-media('tablet') {
|
||||||
|
|
|
@ -84,6 +84,13 @@
|
||||||
value="save_and_return"
|
value="save_and_return"
|
||||||
class="usa-button usa-button--outline"
|
class="usa-button usa-button--outline"
|
||||||
>Save and return to manage your domains</button>
|
>Save and return to manage your domains</button>
|
||||||
|
<!-- {% elif form_is_not_complete %}
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
name="submit_button"
|
||||||
|
value="save_and_return"
|
||||||
|
class="usa-button usa-button--outline"
|
||||||
|
>Return to manage your domains</button> -->
|
||||||
{% else %}
|
{% else %}
|
||||||
<a
|
<a
|
||||||
href="#toggle-submit-domain-request"
|
href="#toggle-submit-domain-request"
|
||||||
|
@ -108,6 +115,16 @@
|
||||||
{% 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 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 %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- <div
|
||||||
|
class="usa-modal"
|
||||||
|
id="toggle-incomplete-domain-request"
|
||||||
|
aria-labelledby="You can’t submit this request because it’s incomplete."
|
||||||
|
aria-describedby="You can’t submit this request because it’s incomplete."
|
||||||
|
data-force-action
|
||||||
|
>
|
||||||
|
{% include 'includes/modal.html' with modal_heading=modal_heading|safe modal_description="You can’t submit this request because it’s incomplete. Click return to request and complete the sections that are missing information." modal_button=modal_button|safe %}
|
||||||
|
</div> -->
|
||||||
|
|
||||||
{% block after_form_content %}{% endblock %}
|
{% block after_form_content %}{% endblock %}
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
{% if step == Step.TRIBAL_GOVERNMENT %}
|
{% if step == Step.TRIBAL_GOVERNMENT %}
|
||||||
{% namespaced_url 'domain-request' step as domain_request_url %}
|
{% 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:"<span class='incomplete'>Incomplete</span>"|safe %}
|
||||||
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %}
|
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% if domain_request.federally_recognized_tribe %}<p>Federally-recognized tribe</p>{% endif %}
|
{% if domain_request.federally_recognized_tribe %}<p>Federally-recognized tribe</p>{% endif %}
|
||||||
|
|
|
@ -374,25 +374,100 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
}
|
}
|
||||||
return [key for key, value in history_dict.items() if value]
|
return [key for key, value in history_dict.items() if value]
|
||||||
|
|
||||||
|
|
||||||
|
def _form_complete(self):
|
||||||
|
# So in theory each part of the form individually should be already doing the check, correct?
|
||||||
|
# In theory, that means we just only need to check for the title pages that are completed which is
|
||||||
|
# Technically some of these don't even show up at all depending on which "state" its in or chosen
|
||||||
|
|
||||||
|
# If we choose Federal -> check "Federal government branch (has defaults)
|
||||||
|
# If we choose Interstate -> check "About your organization"
|
||||||
|
# If we choose State -> check "Election office" (has default)
|
||||||
|
# If we choose Tribal -> check "Tribal name" and "Election office"
|
||||||
|
# County -> "Election office"
|
||||||
|
# City -> "Election office"
|
||||||
|
# Special district -> "Election office" and "About your organization"
|
||||||
|
# School district -> clears common
|
||||||
|
|
||||||
|
|
||||||
|
if (
|
||||||
|
# (self.domain_request.tribe_name is None)
|
||||||
|
(self.domain_request.generic_org_type is None)
|
||||||
|
or (self.domain_request.tribe_name is None)
|
||||||
|
or (self.domain_request.federal_type is None)
|
||||||
|
or (self.domain_request.is_election_board is None)
|
||||||
|
or (
|
||||||
|
self.domain_request.federal_agency is None
|
||||||
|
or self.domain_request.organization_name is None
|
||||||
|
or self.domain_request.address_line1 is None
|
||||||
|
or self.domain_request.city is None
|
||||||
|
or self.domain_request.state_territory is None
|
||||||
|
or self.domain_request.zipcode is None
|
||||||
|
or self.domain_request.urbanization is None
|
||||||
|
) # organization contact
|
||||||
|
or (self.domain_request.about_your_organization is None)
|
||||||
|
or (self.domain_request.authorizing_official is None)
|
||||||
|
or (
|
||||||
|
self.domain_request.current_websites.exists() or self.domain_request.requested_domain is None
|
||||||
|
) # for current_sites
|
||||||
|
or (self.domain_request.requested_domain is None) # for dotgov_domain
|
||||||
|
or (self.domain_request.purpose is None)
|
||||||
|
or (self.domain_request.submitter is None) # your_contact
|
||||||
|
or (self.domain_request.other_contacts is None)
|
||||||
|
or (
|
||||||
|
(self.domain_request.anything_else is None and self.domain_request.cisa_representative_email)
|
||||||
|
or self.domain_request.is_policy_acknowledged is None
|
||||||
|
) # additional detail
|
||||||
|
or (self.domain_request.is_policy_acknowledged is None) # review
|
||||||
|
):
|
||||||
|
# print("!!!!!! self.domain_request.tribe_name is", self.domain_request.tribe_name)
|
||||||
|
# context = self.get_context_data()
|
||||||
|
# context["forms"] = self.get_forms()
|
||||||
|
# context["form_is_not_complete"] = False
|
||||||
|
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
# print("!!!!!! self.domain_request.tribe_name is", self.domain_request.tribe_name)
|
||||||
|
return True
|
||||||
|
|
||||||
|
# return None
|
||||||
|
|
||||||
def get_context_data(self):
|
def get_context_data(self):
|
||||||
"""Define context for access on all wizard pages."""
|
"""Define context for access on all wizard pages."""
|
||||||
# Build the submit button that we'll pass to the modal.
|
# Build the submit button that we'll pass to the modal.
|
||||||
modal_button = '<button type="submit" ' 'class="usa-button" ' ">Submit request</button>"
|
modal_button = '<button type="submit" ' 'class="usa-button" ' ">Submit request</button>"
|
||||||
# Concatenate the modal header that we'll pass to the modal.
|
# Concatenate the modal header that we'll pass to the modal.
|
||||||
if self.domain_request.requested_domain:
|
|
||||||
modal_heading = "You are about to submit a domain request for " + str(self.domain_request.requested_domain)
|
|
||||||
else:
|
|
||||||
modal_heading = "You are about to submit an incomplete request"
|
|
||||||
|
|
||||||
return {
|
# TODO: Still need to log!
|
||||||
|
context_stuff = {}
|
||||||
|
print("!!!!!!!!! before form complete")
|
||||||
|
print("!!!!!!!!! self.form_complete is", self._form_complete())
|
||||||
|
if self._form_complete():
|
||||||
|
print("!!!!!!!in form complete section")
|
||||||
|
context_stuff = {
|
||||||
"form_titles": self.TITLES,
|
"form_titles": self.TITLES,
|
||||||
"steps": self.steps,
|
"steps": self.steps,
|
||||||
# Add information about which steps should be unlocked
|
# Add information about which steps should be unlocked
|
||||||
"visited": self.storage.get("step_history", []),
|
"visited": self.storage.get("step_history", []),
|
||||||
"is_federal": self.domain_request.is_federal(),
|
"is_federal": self.domain_request.is_federal(),
|
||||||
"modal_button": modal_button,
|
"modal_button": modal_button,
|
||||||
"modal_heading": modal_heading,
|
"modal_heading": "You are about to submit a domain request for "
|
||||||
|
+ str(self.domain_request.requested_domain),
|
||||||
}
|
}
|
||||||
|
else: # form is not complete
|
||||||
|
print("!!!!!!! form is not complete")
|
||||||
|
context_stuff = {
|
||||||
|
"form_titles": self.TITLES,
|
||||||
|
"steps": self.steps,
|
||||||
|
# Add information about which steps should be unlocked
|
||||||
|
"visited": self.storage.get("step_history", []),
|
||||||
|
"is_federal": self.domain_request.is_federal(),
|
||||||
|
# "modal_button": We'll have to set some kind of go back button
|
||||||
|
# And fix wording in text for domain_request_form
|
||||||
|
"modal_heading": "You can’t submit this request",
|
||||||
|
}
|
||||||
|
|
||||||
|
return context_stuff
|
||||||
|
|
||||||
def get_step_list(self) -> list:
|
def get_step_list(self) -> list:
|
||||||
"""Dynamically generated list of steps in the form wizard."""
|
"""Dynamically generated list of steps in the form wizard."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue