From 12d1f9fd979c11b9e3a3a89b1595b07569b88f79 Mon Sep 17 00:00:00 2001
From: workmai <iain.workman@lightsource.ca>
Date: Thu, 4 Oct 2018 12:14:39 -0600
Subject: Initial commit of the coding assignment base project

---
 .../admin_templates/source_components.html         | 45 +++++++++++++
 .../templates/procurement/documentation.html       | 76 ++++++++++++++++++++++
 .../procurement/includes/supplier_list.html        | 37 +++++++++++
 .../templates/procurement/source_components.html   | 61 +++++++++++++++++
 4 files changed, 219 insertions(+)
 create mode 100644 procurement/templates/procurement/admin_templates/source_components.html
 create mode 100644 procurement/templates/procurement/documentation.html
 create mode 100644 procurement/templates/procurement/includes/supplier_list.html
 create mode 100644 procurement/templates/procurement/source_components.html

(limited to 'procurement/templates')

diff --git a/procurement/templates/procurement/admin_templates/source_components.html b/procurement/templates/procurement/admin_templates/source_components.html
new file mode 100644
index 0000000..2deae1e
--- /dev/null
+++ b/procurement/templates/procurement/admin_templates/source_components.html
@@ -0,0 +1,45 @@
+{% extends "admin/base_site.html" %}
+{% load i18n admin_modify  %}
+{% block extrahead %}{{ block.super }}
+    <!-- Bootstrap Core CSS -->
+    <link href="/static/prebuilt/bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
+    <!-- Lightsource Custom Styles -->
+    <link href="/static/custom/css/lightsource-styles.css" rel="stylesheet" type="text/css">
+    {% for stylesheet in module_stylesheets %}
+    <link href="/static/{{ stylesheet }}" rel="stylesheet" type="text/css">
+    {% endfor %}
+{% url 'admin:jsi18n' as jsi18nurl %}
+{% endblock %}
+{% block extrastyle %}{{ block.super }}
+{% endblock %}
+{% block bodyclass %}{{ opts.app_label }}-{{ opts.object_name.lower }} change-form{% endblock %}
+{% block breadcrumbs %}{% if not is_popup %}
+<div class="breadcrumbs">  
+     <a href="../../">{% trans "Home" %}</a> ›
+     <a href="../">{{ opts.app_label|capfirst|escape }}</a> ›
+     {% trans 'Source Components' %}</div>
+{% endif %}{% endblock %}
+
+{% block content %}
+                <div class="col-lg-8">
+                    
+                    <!-- /.panel -->
+                {% if supplier_results != None %}
+                    {% include "suppliers/includes/supplier_list.html" %}
+                {% endif %}
+                </div>
+
+    <!-- jQuery -->
+    <script src="/static/prebuilt/bower_components/jquery/dist/jquery.min.js"></script>
+    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
+    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
+
+    <!-- Bootstrap Core JavaScript -->
+    <script src="/static/prebuilt/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
+
+    <!-- Custom Theme JavaScript -->
+    <script src="/static/prebuilt/dist/js/sb-admin-2.js"></script>
+    {% for script in module_javascripts %}
+    <script src="/static/{{ script }}"></script>
+    {% endfor %}
+{% endblock %}
\ No newline at end of file
diff --git a/procurement/templates/procurement/documentation.html b/procurement/templates/procurement/documentation.html
new file mode 100644
index 0000000..4775890
--- /dev/null
+++ b/procurement/templates/procurement/documentation.html
@@ -0,0 +1,76 @@
+{% extends 'base.html' %}
+
+{% block main_content_area %}
+    <div class="col-lg-4">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                Documentation
+            </div>
+            <!-- /.panel-heading -->
+            <div class="panel-body">
+                <div class="list-group">
+                    <a href="#introduction" class="list-group-item">
+                        <i class="fa fa-info-circle fa-fw"></i> Introduction
+                    </a>
+                    <a href="#adding-data" class="list-group-item">
+                        <i class="fa fa-database fa-fw"></i> Adding Data
+                    </a>
+                    <a href="#supplier-list" class="list-group-item">
+                        <i class="fa fa-th-list fa-fw"></i> Supplier List
+                    </a>
+                    <a href="#api" class="list-group-item">
+                        <i class="fa fa-bolt fa-fw"></i> API
+                    </a>
+                </div>
+                <!-- /.list-group -->
+            </div>
+            <!-- /.panel-body -->
+        </div>
+        <!-- /.panel -->
+    </div>
+
+    <div class="col-lg-8">
+        <div class="panel panel-default">
+            <div class="panel-body">
+                <h2><a name="introduction"></a>Introduction</h2>
+                <p>
+                    This is a very simple component and supplier management system. The intention function of the system
+                    is to maintain a list of components, and the suppliers who are authorised to supply them. Administrative
+                    staff maintain the list of suppliers, components and their associations, while general staff simply
+                    use the from page to look up a component, and see its list of suppliers.
+                </p>
+                <p>
+                    The system is written in Python (v3.6), using the Django framework (v2.1.2). Documentation for Django
+                    is available <a href="https://www.djangoproject.com/">here</a>.
+                </p>
+
+
+                <h2><a name="adding-data"></a>Adding Data</h2>
+                <p>
+                    You can manage the components and suppliers using the
+                    <a href="{% url 'admin:index' %}">django admin panel</a>.
+                </p>
+
+                <h2><a name="supplier-list"></a>Supplier List</h2>
+                <p>
+                    Components and their approved Suppliers can be located under
+                    <a href="{% url 'component-search' %}">source components</a>. From this page you may search for a
+                    component, and then click the Find Suppliers button to display its Suppliers
+                </p>
+
+                <h2><a name="api"></a>API</h2>
+                <p>
+                    A simple REST api is integrated into the system, using the <a href="https://www.django-rest-framework.org/">Django Rest Framework</a>.
+                    It provides a means of querying <a href="{% url 'api-component-list' %}">all components</a> or, by providing an id
+                    in the url, <a href="{% url 'api-component-retrieve' pk=1 %}">a specific component</a>.
+                </p>
+            </div>
+            <!-- /.panel-body -->
+        </div>
+        <!-- /.panel -->
+    </div>
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/procurement/templates/procurement/includes/supplier_list.html b/procurement/templates/procurement/includes/supplier_list.html
new file mode 100644
index 0000000..028e62c
--- /dev/null
+++ b/procurement/templates/procurement/includes/supplier_list.html
@@ -0,0 +1,37 @@
+
+<!-- Supplier Results -->
+<div class="panel panel-default">
+    <div class="panel-heading">
+        Approved Suppliers for {{ component }}
+    </div>
+    <!-- /.panel-heading -->
+    <div class="panel-body">
+        <div class="table-responsive">
+            <table class="table">
+                <thead>
+                <tr>
+                    <th>Company</th>
+                    <th>Representative</th>
+                    <th>Email</th>
+                </tr>
+                </thead>
+                <tbody>
+                {% for supplier in supplier_results %}
+                    <tr>
+                        <td>{{ supplier.name }}</td>
+                        <td>{{ supplier.representative_name }}</td>
+                        <td>{{ supplier.representative_email }}</td>
+                    </tr>
+                {% empty %}
+                    <tr>
+                        <td colspan="3">No authorized suppliers found.</td>
+                    </tr>
+                {% endfor %}
+                </tbody>
+            </table>
+        </div>
+        <!-- /.table-responsive -->
+    </div>
+    <!-- /.panel-body -->
+</div>
+<!-- / Supplier Results Panel -->
\ No newline at end of file
diff --git a/procurement/templates/procurement/source_components.html b/procurement/templates/procurement/source_components.html
new file mode 100644
index 0000000..3eebf84
--- /dev/null
+++ b/procurement/templates/procurement/source_components.html
@@ -0,0 +1,61 @@
+{% extends 'base.html' %}
+{% load static %}
+
+{% block additional_css %}
+    <link href="{% static 'procurement/css/suppliers.css' %}" rel="stylesheet" type="text/css">
+    <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
+{% endblock %}
+
+{% block main_content_area %}
+    <div class="col-lg-8">
+        <div class="panel panel-default">
+            <div class="panel-body">
+                <form id="find-suppliers" method="post">
+                    <div class="form-group">
+                        {% csrf_token %}
+                        {{ form }}
+                    </div>
+                    <div class="form-group">
+                        <input type="submit" value="Find Suppliers" id="find-suppliers-button" class="btn btn-primary">
+                    </div>
+                </form>
+            </div>
+            <!-- /.panel-body -->
+        </div>
+        <!-- /.panel -->
+        {% if supplier_results != None %}
+            {% include 'procurement/includes/supplier_list.html' %}
+        {% endif %}
+    </div>
+
+
+    <div class="col-lg-4">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                Searching Procurement Records
+            </div>
+            <!-- /.panel-heading -->
+            <div class="panel-body">
+                <div class="list-group">
+                    <span class="list-group-item">
+                        <span class="record-list"><i class="fa fa-parachute-box fa-fw"></i> {{ supplier_count }} Suppliers</span>
+                        <span class="record-updated text-muted small"><em>{{ suppliers_last_updated }}</em></span>
+                    </span>
+                    <span class="list-group-item">
+                        <span class="record-list"><i class="fa fa-cog fa-fw"></i> {{ component_count }} Components</span>
+                        <span class="record-updated text-muted small"><em>{{ components_last_updated }}</em></span>
+                    </span>
+                </div>
+                <!-- /.list-group -->
+            </div>
+            <!-- /.panel-body -->
+        </div>
+        <!-- /.panel -->
+    </div>
+
+{% endblock %}
+
+{%  block additional_js %}
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
+    <script src="{%  static 'procurement/js/component_search.js' %}"></script>
+{% endblock %}
\ No newline at end of file
-- 
cgit v1.1