Add summary box to page

This commit is contained in:
zandercymatics 2024-05-14 08:07:44 -06:00
parent f1f8a62753
commit aaa9047478
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 36 additions and 16 deletions

View file

@ -15,6 +15,9 @@
.usa-form--extra-large {
max-width: none;
.usa-summary-box {
max-width: 600px;
}
}
.usa-form--text-width {

View file

@ -13,8 +13,34 @@
<p>Well use the information you provide to verify your organizations eligibility for a .gov domain. Well also verify that the domain you request meets our guidelines.</p>
<h2>Time to complete the form</h2>
<p>If you have <a href="{% public_site_url 'domains/before/#information-you%E2%80%99ll-need-to-complete-the-domain-request-form' %}" target="_blank" class="usa-link">all the information you need</a>,
completing your domain request might take around 15 minutes.</p>
completing your domain request might take around 15 minutes.</p>
<h2>How well reach you</h2>
<p>
While reviewing your domain request, we may need to reach out with questions.
Well also email you when we complete our review.
If the contact information below is not correct, visit <a href="#">your profile</a> to make updates.
</p>
<div
class="usa-summary-box"
role="region"
aria-labelledby="contact-information"
>
<div class="usa-summary-box__body">
<h3 class="usa-summary-box__heading">
Your contact information
</h3>
<div class="usa-summary-box__text">
<ul>
<li>Full name: <b>{{ user.contact.full_name }}</b></li>
<li>Organization email: <b>{{ user.contact.email }}</b></li>
<li>Title or role in your organization: <b>{{ user.contact.title }}</b></li>
<li>Phone: <b>{{ user.contact.phone }}</b></li>
</ul>
</div>
</div>
</div>
{% block form_buttons %}
<div class="stepnav">

View file

@ -87,7 +87,7 @@
<button type="submit" name="contact_setup_save_button" class="usa-button usa-button--outline">
Save
</button>
<input type="hidden" name="redirect_to_home" />
<input type="hidden" name="redirect_to_confirmation_page" />
{% endif %}
</div>
{% block form_fields %}{% endblock %}

View file

@ -94,7 +94,6 @@ class ContactProfileSetupView(ContactFormBaseView):
# Update redirect type based on the query parameter if present
redirect_type = request.GET.get("redirect", default_redirect)
# Store the redirect type in the session
self.redirect_type = redirect_type
return super().dispatch(request, *args, **kwargs)
@ -106,8 +105,7 @@ class ContactProfileSetupView(ContactFormBaseView):
case self.RedirectType.BACK_TO_SELF:
return reverse("finish-contact-profile-setup", kwargs={"pk": self.object.pk})
case self.RedirectType.DOMAIN_REQUEST:
# TODO
return reverse("home")
return reverse("domain-request:")
case _:
return reverse("home")
@ -116,19 +114,12 @@ class ContactProfileSetupView(ContactFormBaseView):
redirect_url = self.get_redirect_url()
return redirect_url
# TODO - delete session information
def post(self, request, *args, **kwargs):
"""Form submission posts to this view.
This post method harmonizes using BaseContactView and FormMixin
"""
# Default redirect type
default_redirect = self.RedirectType.BACK_TO_SELF
# Update redirect type based on the query parameter if present
redirect_type = request.GET.get("redirect", default_redirect)
# Store the redirect type in the session
self.redirect_type = redirect_type
# Set the current contact object in cache
self._set_contact(request)
@ -140,7 +131,7 @@ class ContactProfileSetupView(ContactFormBaseView):
if 'contact_setup_save_button' in request.POST:
# Logic for when the 'Save' button is clicked
self.redirect_type = self.RedirectType.BACK_TO_SELF
self.session["should_redirect_to_home"] = "redirect_to_home" in request.POST
self.session["should_redirect"] = "redirect_to_confirmation_page" in request.POST
elif 'contact_setup_submit_button' in request.POST:
# Logic for when the 'Save and continue' button is clicked
if self.redirect_type != self.RedirectType.DOMAIN_REQUEST:
@ -153,7 +144,7 @@ class ContactProfileSetupView(ContactFormBaseView):
def form_valid(self, form):
if self.redirect_type == self.RedirectType.HOME:
if self.redirect_type != self.RedirectType.BACK_TO_SELF:
self.request.user.finished_setup = True
self.request.user.save()
@ -172,7 +163,7 @@ class ContactProfileSetupView(ContactFormBaseView):
context = super().get_context_data(**kwargs)
context["email_sublabel_text"] = self._email_sublabel_text()
if "should_redirect_to_home" in self.session:
if "should_redirect" in self.session:
context["confirm_changes"] = True
return context