mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 10:16:13 +02:00
Modify domain request wizard to show portfolio views
This commit is contained in:
parent
2f009ee15c
commit
f1ab40a3a0
7 changed files with 139 additions and 43 deletions
|
@ -22,7 +22,7 @@ from registrar.views.report_views import (
|
||||||
ExportDataTypeUser,
|
ExportDataTypeUser,
|
||||||
)
|
)
|
||||||
|
|
||||||
from registrar.views.domain_request import Step
|
from registrar.views.domain_request import Step, PortfolioDomainRequestStep
|
||||||
from registrar.views.domain_requests_json import get_domain_requests_json
|
from registrar.views.domain_requests_json import get_domain_requests_json
|
||||||
from registrar.views.transfer_user import TransferUserView
|
from registrar.views.transfer_user import TransferUserView
|
||||||
from registrar.views.utility.api_views import (
|
from registrar.views.utility.api_views import (
|
||||||
|
@ -58,6 +58,15 @@ for step, view in [
|
||||||
(Step.ADDITIONAL_DETAILS, views.AdditionalDetails),
|
(Step.ADDITIONAL_DETAILS, views.AdditionalDetails),
|
||||||
(Step.REQUIREMENTS, views.Requirements),
|
(Step.REQUIREMENTS, views.Requirements),
|
||||||
(Step.REVIEW, views.Review),
|
(Step.REVIEW, views.Review),
|
||||||
|
|
||||||
|
# Portfolio steps
|
||||||
|
(PortfolioDomainRequestStep.REQUESTING_ENTITY, views.RequestingEntity),
|
||||||
|
# (PortfolioDomainRequestStep.CURRENT_SITES, views.CurrentSites),
|
||||||
|
# (PortfolioDomainRequestStep.DOTGOV_DOMAIN, views.DotgovDomain),
|
||||||
|
# (PortfolioDomainRequestStep.PURPOSE, views.Purpose),
|
||||||
|
# (PortfolioDomainRequestStep.ADDITIONAL_DETAILS, views.AdditionalDetails),
|
||||||
|
# (PortfolioDomainRequestStep.REQUIREMENTS, views.Requirements),
|
||||||
|
# (PortfolioDomainRequestStep.REVIEW, views.Review),
|
||||||
]:
|
]:
|
||||||
domain_request_urls.append(path(f"{step}/", view.as_view(), name=step))
|
domain_request_urls.append(path(f"{step}/", view.as_view(), name=step))
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,15 @@ from registrar.utility.constants import BranchChoices
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class RequestingEntityForm(RegistrarForm):
|
||||||
|
is_policy_acknowledged = forms.BooleanField(
|
||||||
|
label="I read and agree to the requirements for operating a .gov domain.",
|
||||||
|
error_messages={
|
||||||
|
"required": ("Check the box if you read and agree to the requirements for operating a .gov domain.")
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class OrganizationTypeForm(RegistrarForm):
|
class OrganizationTypeForm(RegistrarForm):
|
||||||
generic_org_type = forms.ChoiceField(
|
generic_org_type = forms.ChoiceField(
|
||||||
# use the long names in the domain request form
|
# use the long names in the domain request form
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
{% extends 'domain_request_form.html' %}
|
||||||
|
{% load field_helpers url_helpers %}
|
||||||
|
|
||||||
|
{% block form_instructions %}
|
||||||
|
<p>🛸🛸🛸🛸 Placeholder content 🛸🛸🛸🛸</p>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block form_fields %}
|
||||||
|
<fieldset class="usa-fieldset">
|
||||||
|
<legend>
|
||||||
|
<h2>Are you from the polaris star system?</h2>
|
||||||
|
</legend>
|
||||||
|
|
||||||
|
{% input_with_errors forms.0.is_policy_acknowledged %}
|
||||||
|
</fieldset>
|
||||||
|
{% endblock %}
|
|
@ -19,5 +19,9 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block form_fields %}
|
{% block form_fields %}
|
||||||
{% include "includes/request_review_steps.html" with is_editable=True %}
|
{% if portfolio %}
|
||||||
|
{% include "includes/portfolio_request_review_steps.html" with is_editable=True %}
|
||||||
|
{% else %}
|
||||||
|
{% include "includes/request_review_steps.html" with is_editable=True %}
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if step == Step.REQUESTING_ENTITY %}
|
{% if step == Step.REQUESTING_ENTITY %}
|
||||||
|
|
||||||
{% if domain_request.organization_name %}
|
{% if domain_request.organization_name %}
|
||||||
{% with title=form_titles|get_item:step value=domain_request %}
|
{% with title=form_titles|get_item:step value=domain_request %}
|
||||||
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=is_editable edit_link=domain_request_url address='true' %}
|
{% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=is_editable edit_link=domain_request_url address='true' %}
|
||||||
|
|
|
@ -75,9 +75,10 @@ class PortfolioDomainRequestStep(StrEnum):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Portfolio
|
# Portfolio
|
||||||
REQUESTING_ENTITY = "organization_name"
|
REQUESTING_ENTITY = "requesting_entity"
|
||||||
CURRENT_SITES = "current_sites"
|
CURRENT_SITES = "current_sites"
|
||||||
DOTGOV_DOMAIN = "dotgov_domain"
|
DOTGOV_DOMAIN = "dotgov_domain"
|
||||||
PURPOSE = "purpose"
|
PURPOSE = "purpose"
|
||||||
ADDITIONAL_DETAILS = "additional_details"
|
ADDITIONAL_DETAILS = "additional_details"
|
||||||
REQUIREMENTS = "requirements"
|
REQUIREMENTS = "requirements"
|
||||||
|
REVIEW = "review"
|
||||||
|
|
|
@ -43,9 +43,11 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
although not without consulting the base implementation, first.
|
although not without consulting the base implementation, first.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
StepEnum: Step = Step # type: ignore
|
StepEnum: Step | PortfolioDomainRequestStep = Step # type: ignore
|
||||||
template_name = ""
|
template_name = ""
|
||||||
|
|
||||||
|
is_portfolio = False
|
||||||
|
|
||||||
# uniquely namespace the wizard in urls.py
|
# uniquely namespace the wizard in urls.py
|
||||||
# (this is not seen _in_ urls, only for Django's internal naming)
|
# (this is not seen _in_ urls, only for Django's internal naming)
|
||||||
# NB: this is included here for reference. Do not change it without
|
# NB: this is included here for reference. Do not change it without
|
||||||
|
@ -188,8 +190,32 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
else:
|
else:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
def mark_as_portfolio_wizard(self):
|
||||||
|
"""Swaps the wizard over to the "portfolio" view"""
|
||||||
|
self.is_portfolio = True
|
||||||
|
self.StepEnum = PortfolioDomainRequestStep # type: ignore
|
||||||
|
self.TITLES = {
|
||||||
|
self.StepEnum.REQUESTING_ENTITY: _("Requesting entity"),
|
||||||
|
self.StepEnum.CURRENT_SITES: _("Current websites"),
|
||||||
|
self.StepEnum.DOTGOV_DOMAIN: _(".gov domain"),
|
||||||
|
self.StepEnum.PURPOSE: _("Purpose of your domain"),
|
||||||
|
self.StepEnum.ADDITIONAL_DETAILS: _("Additional details"),
|
||||||
|
self.StepEnum.REQUIREMENTS: _("Requirements for operating a .gov domain"),
|
||||||
|
self.StepEnum.REVIEW: _("Review and submit your domain request"),
|
||||||
|
}
|
||||||
|
self.WIZARD_CONDITIONS = {}
|
||||||
|
|
||||||
|
# Regenerate the steps helper
|
||||||
|
print("look, da fuq")
|
||||||
|
print(self.storage)
|
||||||
|
self.steps = StepsHelper(self)
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
"""This method handles GET requests."""
|
"""This method handles GET requests."""
|
||||||
|
|
||||||
|
if not self.is_portfolio and self.request.user.is_org_user(request):
|
||||||
|
self.mark_as_portfolio_wizard()
|
||||||
|
|
||||||
current_url = resolve(request.path_info).url_name
|
current_url = resolve(request.path_info).url_name
|
||||||
|
|
||||||
# if user visited via an "edit" url, associate the id of the
|
# if user visited via an "edit" url, associate the id of the
|
||||||
|
@ -211,6 +237,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
# intro page.
|
# intro page.
|
||||||
return render(request, "domain_request_intro.html", {})
|
return render(request, "domain_request_intro.html", {})
|
||||||
else:
|
else:
|
||||||
|
print(f"look at these steps: {self.steps}")
|
||||||
return self.goto(self.steps.first)
|
return self.goto(self.steps.first)
|
||||||
|
|
||||||
# refresh step_history to ensure we don't erroneously unlock unfinished
|
# refresh step_history to ensure we don't erroneously unlock unfinished
|
||||||
|
@ -219,6 +246,9 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
context = self.get_context_data()
|
context = self.get_context_data()
|
||||||
self.steps.current = current_url
|
self.steps.current = current_url
|
||||||
context["forms"] = self.get_forms()
|
context["forms"] = self.get_forms()
|
||||||
|
print(f"storage is: {self.storage}")
|
||||||
|
print(f"steps are: {self.steps}")
|
||||||
|
print(f"context is: {context}")
|
||||||
|
|
||||||
# if pending requests exist and user does not have approved domains,
|
# if pending requests exist and user does not have approved domains,
|
||||||
# present message that domain request cannot be submitted
|
# present message that domain request cannot be submitted
|
||||||
|
@ -334,42 +364,63 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
# and is used to determine how steps appear in the side nav.
|
# and is used to determine how steps appear in the side nav.
|
||||||
# It is worth noting that any step assigned "false" here will be EXCLUDED
|
# It is worth noting that any step assigned "false" here will be EXCLUDED
|
||||||
# from the list of "unlocked" steps.
|
# from the list of "unlocked" steps.
|
||||||
|
if self.is_portfolio:
|
||||||
history_dict = {
|
history_dict = {
|
||||||
"generic_org_type": self.domain_request.generic_org_type is not None,
|
"requesting_entity": self.domain_request.is_policy_acknowledged is not None,
|
||||||
"tribal_government": self.domain_request.tribe_name is not None,
|
"current_sites": (
|
||||||
"organization_federal": self.domain_request.federal_type is not None,
|
self.domain_request.current_websites.exists() or self.domain_request.requested_domain is not None
|
||||||
"organization_election": self.domain_request.is_election_board is not None,
|
),
|
||||||
"organization_contact": (
|
"dotgov_domain": self.domain_request.requested_domain is not None,
|
||||||
self.domain_request.federal_agency is not None
|
"purpose": self.domain_request.purpose is not None,
|
||||||
or self.domain_request.organization_name is not None
|
"other_contacts": (
|
||||||
or self.domain_request.address_line1 is not None
|
self.domain_request.other_contacts.exists()
|
||||||
or self.domain_request.city is not None
|
or self.domain_request.no_other_contacts_rationale is not None
|
||||||
or self.domain_request.state_territory is not None
|
),
|
||||||
or self.domain_request.zipcode is not None
|
"additional_details": (
|
||||||
or self.domain_request.urbanization is not None
|
# Additional details is complete as long as "has anything else" and "has cisa rep" are not None
|
||||||
),
|
(
|
||||||
"about_your_organization": self.domain_request.about_your_organization is not None,
|
self.domain_request.has_anything_else_text is not None
|
||||||
"senior_official": self.domain_request.senior_official is not None,
|
and self.domain_request.has_cisa_representative is not None
|
||||||
"current_sites": (
|
)
|
||||||
self.domain_request.current_websites.exists() or self.domain_request.requested_domain is not None
|
),
|
||||||
),
|
"review": self.domain_request.is_policy_acknowledged is not None,
|
||||||
"dotgov_domain": self.domain_request.requested_domain is not None,
|
}
|
||||||
"purpose": self.domain_request.purpose is not None,
|
else:
|
||||||
"other_contacts": (
|
history_dict = {
|
||||||
self.domain_request.other_contacts.exists()
|
"generic_org_type": self.domain_request.generic_org_type is not None,
|
||||||
or self.domain_request.no_other_contacts_rationale is not None
|
"tribal_government": self.domain_request.tribe_name is not None,
|
||||||
),
|
"organization_federal": self.domain_request.federal_type is not None,
|
||||||
"additional_details": (
|
"organization_election": self.domain_request.is_election_board is not None,
|
||||||
# Additional details is complete as long as "has anything else" and "has cisa rep" are not None
|
"organization_contact": (
|
||||||
(
|
self.domain_request.federal_agency is not None
|
||||||
self.domain_request.has_anything_else_text is not None
|
or self.domain_request.organization_name is not None
|
||||||
and self.domain_request.has_cisa_representative is not None
|
or self.domain_request.address_line1 is not None
|
||||||
)
|
or self.domain_request.city is not None
|
||||||
),
|
or self.domain_request.state_territory is not None
|
||||||
"requirements": self.domain_request.is_policy_acknowledged is not None,
|
or self.domain_request.zipcode is not None
|
||||||
"review": self.domain_request.is_policy_acknowledged is not None,
|
or self.domain_request.urbanization is not None
|
||||||
}
|
),
|
||||||
|
"about_your_organization": self.domain_request.about_your_organization is not None,
|
||||||
|
"senior_official": self.domain_request.senior_official is not None,
|
||||||
|
"current_sites": (
|
||||||
|
self.domain_request.current_websites.exists() or self.domain_request.requested_domain is not None
|
||||||
|
),
|
||||||
|
"dotgov_domain": self.domain_request.requested_domain is not None,
|
||||||
|
"purpose": self.domain_request.purpose is not None,
|
||||||
|
"other_contacts": (
|
||||||
|
self.domain_request.other_contacts.exists()
|
||||||
|
or self.domain_request.no_other_contacts_rationale is not None
|
||||||
|
),
|
||||||
|
"additional_details": (
|
||||||
|
# Additional details is complete as long as "has anything else" and "has cisa rep" are not None
|
||||||
|
(
|
||||||
|
self.domain_request.has_anything_else_text is not None
|
||||||
|
and self.domain_request.has_cisa_representative is not None
|
||||||
|
)
|
||||||
|
),
|
||||||
|
"requirements": self.domain_request.is_policy_acknowledged is not None,
|
||||||
|
"review": self.domain_request.is_policy_acknowledged is not None,
|
||||||
|
}
|
||||||
return [key for key, value in history_dict.items() if value]
|
return [key for key, value in history_dict.items() if value]
|
||||||
|
|
||||||
def get_context_data(self):
|
def get_context_data(self):
|
||||||
|
@ -420,7 +471,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
return request_step_list(self)
|
return request_step_list(self)
|
||||||
|
|
||||||
def goto(self, step):
|
def goto(self, step):
|
||||||
if step == "generic_org_type":
|
if step == "generic_org_type" or step == "requesting_entity":
|
||||||
# We need to avoid creating a new domain request if the user
|
# We need to avoid creating a new domain request if the user
|
||||||
# clicks the back button
|
# clicks the back button
|
||||||
self.request.session["new_request"] = False
|
self.request.session["new_request"] = False
|
||||||
|
@ -443,6 +494,8 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs) -> HttpResponse:
|
def post(self, request, *args, **kwargs) -> HttpResponse:
|
||||||
"""This method handles POST requests."""
|
"""This method handles POST requests."""
|
||||||
|
if not self.is_portfolio and self.request.user.is_org_user(request):
|
||||||
|
self.mark_as_portfolio_wizard()
|
||||||
|
|
||||||
# which button did the user press?
|
# which button did the user press?
|
||||||
button: str = request.POST.get("submit_button", "")
|
button: str = request.POST.get("submit_button", "")
|
||||||
|
@ -456,7 +509,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView):
|
||||||
if self.request.session["new_request"] is True:
|
if self.request.session["new_request"] is True:
|
||||||
# This will trigger the domain_request getter into creating a new DomainRequest
|
# This will trigger the domain_request getter into creating a new DomainRequest
|
||||||
del self.storage
|
del self.storage
|
||||||
|
print(f"what are the steps? {self.steps}")
|
||||||
return self.goto(self.steps.first)
|
return self.goto(self.steps.first)
|
||||||
|
|
||||||
# if accessing this class directly, redirect to the first step
|
# if accessing this class directly, redirect to the first step
|
||||||
|
@ -518,7 +571,12 @@ class PortfolioDomainRequestWizard(DomainRequestWizard):
|
||||||
self.steps = StepsHelper(self)
|
self.steps = StepsHelper(self)
|
||||||
self._domain_request = None # for caching
|
self._domain_request = None # for caching
|
||||||
|
|
||||||
|
# Portfolio pages
|
||||||
|
class RequestingEntity(DomainRequestWizard):
|
||||||
|
template_name = "domain_request_requesting_entity.html"
|
||||||
|
forms = [forms.RequestingEntityForm]
|
||||||
|
|
||||||
|
# Non-portfolio pages
|
||||||
class OrganizationType(DomainRequestWizard):
|
class OrganizationType(DomainRequestWizard):
|
||||||
template_name = "domain_request_org_type.html"
|
template_name = "domain_request_org_type.html"
|
||||||
forms = [forms.OrganizationTypeForm]
|
forms = [forms.OrganizationTypeForm]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue