aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMR Lemon <matt@matthewlemon>2020-05-01 15:51:59 +0100
committerMR Lemon <matt@matthewlemon>2020-05-01 15:51:59 +0100
commit089eb10d5023e92969b72561baca32a9d730f0c6 (patch)
treeef713fe89690129dfea07239be97634a6fcd062d
parent18a273f684946d2a6ad99ae579339f787bfaa0c2 (diff)
making progress with the form wizard
-rw-r--r--config/settings/base.py1
-rw-r--r--ctrack/organisations/forms.py26
-rw-r--r--ctrack/organisations/templates/organisations/org_create_wizard_form.html37
3 files changed, 42 insertions, 22 deletions
diff --git a/config/settings/base.py b/config/settings/base.py
index fd3f502..e1d7763 100644
--- a/config/settings/base.py
+++ b/config/settings/base.py
@@ -81,6 +81,7 @@ THIRD_PARTY_APPS = [
"allauth",
"allauth.account",
"allauth.socialaccount",
+ "formtools",
]
LOCAL_APPS = [
diff --git a/ctrack/organisations/forms.py b/ctrack/organisations/forms.py
index ab92e64..0903649 100644
--- a/ctrack/organisations/forms.py
+++ b/ctrack/organisations/forms.py
@@ -9,26 +9,11 @@ from ctrack.organisations.models import Organisation, Address
class OrganisationCreateForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
- cancel_redirect = reverse("organisations:list")
- self.helper = FormHelper(self)
- self.helper.layout = Layout(
- Fieldset(
- "",
- Field("name", css_class="form-control"),
- "submode",
- "oes",
- "designation_type",
- "registered_company_name",
- "registered_company_number",
- "updated_by",
- "comments",
- "active"
- ),
- ButtonHolder(
- Submit("submit", "Submit", css_class="btn-primary"),
- Button("cancel", "Cancel", onclick=f"location.href='{cancel_redirect}';", css_class="btn-danger")
- )
- )
+ self.fields["name"].widget.attrs["class"] = "form-control"
+ self.fields["submode"].widget.attrs["class"] = "form-control"
+ self.fields["oes"].widget.attrs["class"] = "form-check-input"
+ self.fields["designation_type"].widget.attrs["class"] = "form-control"
+ self.fields["registered_company_name"].widget.attrs["class"] = "form-control"
class Meta:
model = Organisation
@@ -43,6 +28,7 @@ class OrganisationCreateForm(forms.ModelForm):
"updated_by": "Name of staff member/inspector creating this record",
"active": "Is this company an active participant in the NIS compliance regime?",
"designation_type": "This is probably defined in the Reguation",
+ "registered_company_name": "Probably different from the Organisation name"
}
diff --git a/ctrack/organisations/templates/organisations/org_create_wizard_form.html b/ctrack/organisations/templates/organisations/org_create_wizard_form.html
index 9305d1b..8faa1a3 100644
--- a/ctrack/organisations/templates/organisations/org_create_wizard_form.html
+++ b/ctrack/organisations/templates/organisations/org_create_wizard_form.html
@@ -11,9 +11,14 @@
{% block content %}
<div class="container mt-3">
+ <div class="row">
+ <div class="col-md-12 pl-0 my-2">
+ <h4>Create a new Organisation</h4>
+ </div>
+ </div>
<div class="row">
<div class="col-md-12 pl-0 my-2">
- <h4>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</h4>
+ <p>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</p>
</div>
</div>
<div class="row">
@@ -27,7 +32,35 @@
{{ form }}
{% endfor %}
{% else %}
- {{ wizard.form }}
+ <div class="form-group required">
+ <label for="name">Name:</label>
+ {{ wizard.form.name }}
+ </div>
+ <div class="row">
+ <div class="col-md-6">
+ <div class="form-group">
+ <label for="submode">Sub mode:</label>
+ {{ wizard.form.submode }}
+ </div>
+ </div>
+ <div class="col-md-6">
+ <div class="form-group">
+ <label for="designation_type">Designation Type:</label>
+ {{ wizard.form.designation_type }}
+ <small class="form-text text-muted">{{ wizard.form.designation_type.help_text }}</small>
+ </div>
+ </div>
+ </div>
+ <div class="form-check">
+ {{ wizard.form.oes }}
+ <label class="form-check-label" for="oes">OES</label>
+ </div>
+ <div class="form-group">
+ <label for="registered_company_name">Registered Company Name:</label>
+ {{ wizard.form.registered_company_name }}
+ <small class="form-text text-muted">{{ wizard.form.registered_company_name.help_text }}</small>
+ </div>
+{# {{ wizard.form }}#}
{% endif %}
{% if wizard.steps.prev %}
<button name="wizard_goto_step" type="submit" value="{{ wizard.steps.first }}">First Step</button>