WIP for rego form, 2

This commit is contained in:
Tobias 2018-09-29 13:29:32 +12:00
parent d651776016
commit 74dc779999
6 changed files with 36 additions and 29 deletions

View file

@ -1,4 +1,4 @@
<ul> <ul class="list-unstyled">
{% for category in categories %} {% for category in categories %}
{% if not category in exclude %} {% if not category in exclude %}
<li><a href="{% url "product_category" category.id %}">{{ category.name }}</a></li> <li><a href="{% url "product_category" category.id %}">{{ category.name }}</a></li>

View file

@ -1,21 +1,16 @@
{% if discounts %} {% if discounts %}
<div class="panel-success"> <div class="my-4">
<h3 class="panel-heading">Discounts and Complimentary Items</h3> <h2>Discounts and Complimentary Items</h2>
<div class="panel-body"> <p>The following discounts and complimentary items are available to you. If you wish to take advantage of this offer, you must choose your items below. This discounts will be applied automatically when you check out.</p>
<blockquote> {% regroup discounts by discount.description as discounts_grouped %}
<p>The following discounts and complimentary items are available to you. If you wish to take advantage of this offer, you must choose your items below. This discounts will be applied automatically when you check out.</p> {% for discount_type in discounts_grouped %}
{% regroup discounts by discount.description as discounts_grouped %} <h3>{{ discount_type.grouper }}</h3>
{% for discount_type in discounts_grouped %} <ul>
<h4>{{ discount_type.grouper }}</h4> {% for discount in discount_type.list %}
<ul> <li>{{ discount.quantity }} &times; {{ discount.clause }}</li>
{% for discount in discount_type.list %} {% endfor %}
<li>{{ discount.quantity }} &times; {{ discount.clause }}</li> </ul>
{% endfor %} {% endfor %}
</ul>
{% endfor %}
</blockquote>
<hr />
</div>
</div> </div>
{% endif %} {% endif %}

View file

@ -19,13 +19,13 @@
{% endblock %} {% endblock %}
{% block content %} {% block proposals_body %}
<div class="btn-group"> <div class="btn-group">
<button id="voucher-form-button" class="btn btn-info" onclick="showVoucherForm()">Enter voucher code</button> <button id="voucher-form-button" class="btn" onclick="showVoucherForm()">Enter voucher code</button>
</div> </div>
<form class="form-horizontal" method="post" action=""> <form class="form-horizontal my-4" method="post" action="">
{% csrf_token %} {% csrf_token %}
<fieldset id="voucher-form" style="display: none;"> <fieldset id="voucher-form" style="display: none;">
@ -46,16 +46,15 @@
{% endif %} {% endif %}
<h2>{{ category.name }}</h2> <h1>{{ category.name }}</h1>
<blockquote>{{ category.description|safe }}</blockquote> <blockquote>{{ category.description|safe }}</blockquote>
<fieldset> <fieldset>
{% if discounts %} {% if discounts %}
{% include "registrasion/discount_list.html" with discounts=discounts %} {% include "registrasion/discount_list.html" with discounts=discounts %}
{% endif %} {% endif %}
<h3>Make a selection</h3> <h2>Make a selection</h2>
{% include "_form_snippet.html" with form=form %} {% include "_form_snippet.html" with form=form %}
<br /> <br />

View file

@ -47,18 +47,15 @@
</div> </div>
{% endif %} {% endif %}
<div class="mb-4"> <div class="my-4">
<h3>Add to your selection</h3> <h3>Add to your selection</h3>
<p>You can add these items now, or you can come back and add them in a later purchase.</p> <p>You can add these items now, or you can come back and add them in a later purchase.</p>
{% missing_categories as missing %}
{% if missing %} {% if missing %}
<div class="alert-warning"> {% missing_categories as missing %}
<p class="label-warning">
<strong>You have <em>not</em> selected anything from the following <strong>You have <em>not</em> selected anything from the following
categories. If your ticket includes any of these, you still need to categories. If your ticket includes any of these, you still need to
make a selection: make a selection:
</strong> </strong>
</p>
{% include "registrasion/_category_list.html" with categories=missing %} {% include "registrasion/_category_list.html" with categories=missing %}
</div> </div>

View file

@ -0,0 +1,12 @@
from django import template
register = template.Library()
@register.filter
def has_required_fields(form):
for field in form:
if field.field.required:
return True
return False

View file

@ -250,6 +250,10 @@ main.container-fluid {
border: 1px $primary solid; border: 1px $primary solid;
color: $primary; color: $primary;
padding: 5rem 6rem ; padding: 5rem 6rem ;
.text-info {
color: $primary !important;
}
} }
.col-form-label, .form-check-label { .col-form-label, .form-check-label {