diff options
Diffstat (limited to 'app/dispatch/templates')
6 files changed, 213 insertions, 90 deletions
diff --git a/app/dispatch/templates/dispatch/companies/list.html b/app/dispatch/templates/dispatch/companies/list.html index e08837b..97e54f7 100644 --- a/app/dispatch/templates/dispatch/companies/list.html +++ b/app/dispatch/templates/dispatch/companies/list.html @@ -11,32 +11,40 @@ <a href="{% url 'customer_new' %}" class="btn green">Add Customer</a> </div> </div> -<table class="striped bordered"> - <thead> - <tr> - <th>Name</th> - <th>Address</th> - <th>Phone</th> - <th>Email</th> - </tr> - </thead> - <tbody> - {% for customer in object_list %} - <tr> - <td>{{ customer.name }}</td> - <td>{{ customer.address }}</td> - <td>{{ customer.phone_number }}</td> - <td>{{ customer.email_address }}</td> - <td class="right-align"> - {% if user.is_superuser %} - <a href="{% url 'customer_edit' customer.id %}" class="btn orange">Edit</a> - {% endif %} - <a href="{% url 'customer_detail' customer.id %}" class="btn blue">View</a> - </td> - </tr> - {% empty %} - <tr><td colspan="4">No customers yet.</td></tr> - {% endfor %} - </tbody> -</table> + +<div class="row"> +<div class="col s12"> + <table class="striped bordered"> + <thead> + <tr> + <th>Name</th> + <th>Address</th> + <th>Phone</th> + <th>Email</th> + </tr> + </thead> + <tbody> + {% for customer in object_list %} + <tr> + <td>{{ customer.name }}</td> + <td>{{ customer.address }}</td> + <td>{{ customer.phone_number }}</td> + <td>{{ customer.email_address }}</td> + <td class="right-align"> + {% if user.is_superuser %} + <a href="{% url 'customer_edit' customer.id %}" class="btn orange">Edit</a> + {% endif %} + <a href="{% url 'customer_detail' customer.id %}" class="btn blue">View</a> + </td> + </tr> + {% empty %} + <tr><td colspan="4">No customers yet.</td></tr> + {% endfor %} + </tbody> + </table> +</div> +</div> + +{% include "dispatch/paginator.html" %} + {% endblock %} diff --git a/app/dispatch/templates/dispatch/drivers/list.html b/app/dispatch/templates/dispatch/drivers/list.html index 8b7508b..c87f99f 100644 --- a/app/dispatch/templates/dispatch/drivers/list.html +++ b/app/dispatch/templates/dispatch/drivers/list.html @@ -8,28 +8,36 @@ <h1>Drivers</h1> </div> </div> -<table class="striped bordered"> - <thead> - <tr> - <th>First Name</th> - <th>Last Name</th> - <th>Email</th> - </tr> - </thead> - <tbody> - {% for driver in object_list %} - <tr> - <td>{{ driver.first_name }}</td> - <td>{{ driver.last_name }}</td> - <td>{{ driver.email }}</td> - <td class="right-align"> - <a href="{% url 'driver_details' driver.id %}" class="btn orange">Edit</a> - <a href="{% url 'driver_summary' driver.id %}" class="btn blue">View</a> - </td> - </tr> - {% empty %} - <tr><td colspan="4">No drivers yet.</td></tr> - {% endfor %} - </tbody> -</table> + +<div class="row"> +<div class="col s12"> + <table class="striped bordered"> + <thead> + <tr> + <th>First Name</th> + <th>Last Name</th> + <th>Email</th> + </tr> + </thead> + <tbody> + {% for driver in object_list %} + <tr> + <td>{{ driver.first_name }}</td> + <td>{{ driver.last_name }}</td> + <td>{{ driver.email }}</td> + <td class="right-align"> + <a href="{% url 'driver_details' driver.id %}" class="btn orange">Edit</a> + <a href="{% url 'driver_summary' driver.id %}" class="btn blue">View</a> + </td> + </tr> + {% empty %} + <tr><td colspan="4">No drivers yet.</td></tr> + {% endfor %} + </tbody> + </table> +</div> +</div> + +{% include "dispatch/paginator.html" %} + {% endblock %} diff --git a/app/dispatch/templates/dispatch/invoice/detail-table.html b/app/dispatch/templates/dispatch/invoice/detail-table.html index 508ab31..d09ba76 100644 --- a/app/dispatch/templates/dispatch/invoice/detail-table.html +++ b/app/dispatch/templates/dispatch/invoice/detail-table.html @@ -4,9 +4,11 @@ Invoice #{{object.invoice_id}} </h4> </div> + {% if object.paid %} <div class="col s6 right-align"> <h4>PAID</h4> </div> + {% endif %} </div> <div class="row"> <div class="col s6"> diff --git a/app/dispatch/templates/dispatch/invoice/detail.html b/app/dispatch/templates/dispatch/invoice/detail.html index 850c427..c66e545 100644 --- a/app/dispatch/templates/dispatch/invoice/detail.html +++ b/app/dispatch/templates/dispatch/invoice/detail.html @@ -5,7 +5,7 @@ {% block content %} <div class="row hide-print"> <div class="col s12 m6"> - <h1>Invoice for {{object.invoice_date}} by {{object.owner}}</h1> + <h1>Invoice for {{object.invoice_date}} by <a href="{% url 'driver_summary' object.owner.pk %}">{{object.owner}}</a></h1> </div> <div class="col s12 m6"> <div class="right-align"> diff --git a/app/dispatch/templates/dispatch/invoice/list.html b/app/dispatch/templates/dispatch/invoice/list.html index d98fb5a..d30c8d8 100644 --- a/app/dispatch/templates/dispatch/invoice/list.html +++ b/app/dispatch/templates/dispatch/invoice/list.html @@ -8,44 +8,67 @@ <h1>Invoices</h1> </div> </div> -<table class="striped bordered"> - <thead> + +<div class="row"> + <div class="col s12"> + <div class="right-align"> + {% if request.GET.paid == '1' %} + <a class="btn orange" href="?paid=0">Show Unpaid Invoices</a> + {% else %} + <a class="btn green" href="?paid=1">Show Paid Invoices</a> + {% endif %} + </div> + </div> +</div> + +<div class="row"> +<div class="col s12"> + <table class="striped bordered"> + <thead> + <tr> + <!-- <th>User</th> --> + <th>Owner</th> + <th>Bill To</th> + <th>Invoice ID</th> + <th>Invoice Date</th> + <th>Due Date</th> + <th>Amount</th> + <th>Paid</th> + <th></th> + </tr> + </thead> + <tbody> + {% for invoice in object_list %} <tr> - <th>User</th> - <th>Owner</th> - <th>Bill To</th> - <th>Invoice ID</th> - <th>Invoice Date</th> - <th>Due Date</th> - <th>Amount</th> - <th></th> + <!-- <td>{{invoice.user}}</td> --> + <td>{{invoice.owner}}</td> + <td>{{invoice.bill_to}}</td> + <td>{{invoice.invoice_id}}</td> + <td>{{invoice.invoice_date}}</td> + <td>{{invoice.due_date}}</td> + <td>{{invoice.total}}</td> + <td>{{invoice.paid}}</td> + <td><a class="btn green" href="{% url 'invoice_detail' invoice.pk %}">View</a></td> </tr> - </thead> - <tbody> - {% for invoice in object_list %} - <tr> - <td>{{invoice.user}}</td> - <td>{{invoice.owner}}</td> - <td>{{invoice.bill_to}}</td> - <td>{{invoice.invoice_id}}</td> - <td>{{invoice.invoice_date}}</td> - <td>{{invoice.due_date}}</td> - <td>{{invoice.total}}</td> - <td><a class="btn green" href="{% url 'invoice_detail' invoice.pk %}">View</a></td> - </tr> - {% empty %} - <tr> - <td>No Invoices Found</td> - <td></td> - <td></td> - <td></td> - <td></td> - <td></td> - <td></td> - <td></td> - </tr> - {% endfor %} + {% empty %} + <tr> + <td>No Invoices Found</td> + <td></td> + <td></td> + <td></td> + <td></td> + <td></td> + <td></td> + <td></td> + </tr> + {% endfor %} + + </tbody> + </table> +</div> +</div> + +{% include "dispatch/paginator.html" %} + - </tbody> -</table> {% endblock %} diff --git a/app/dispatch/templates/dispatch/paginator.html b/app/dispatch/templates/dispatch/paginator.html new file mode 100644 index 0000000..82f5d3c --- /dev/null +++ b/app/dispatch/templates/dispatch/paginator.html @@ -0,0 +1,82 @@ +{% load custom_tags %} +{% echo "blue" as paginate_classes %} +{% if is_paginated %} +<div class="row"> + <div class="col s12 "> + <ul class="pagination"> + {% if page_obj.has_previous %} + <li> + <a href="#" onClick="insertParam('page', {{page_obj.previous_page_number}})"> + <i class="material-icons">chevron_left</i> + </a> + </li> + {% else %} + <li class="disabled"> + <a href="#"> + <i class="material-icons">chevron_left</i> + </a> + </li> + {% endif %} + {% load dynamic_key %} + {% for number in page_obj.paginator.num_pages|endRange:1 %} + + {% if page_obj.number == number %} + <li class="active {{paginate_classes}}"> + <a href="#" onClick="insertParam('page', {{number}})">{{number}}</a> + </li> + {% else %} + <li class="waves-effect"> + <a onClick="insertParam('page', {{number}})">{{number}}</a> + </li> + {% endif %} + + {% endfor %} + + {% if page_obj.has_next %} + <li> + <a href="#" onClick="insertParam('page', {{page_obj.next_page_number}})"> + <i class="material-icons">chevron_right</i> + </a> + </li> + {% else %} + <li class="disabled"> + <a href="#"> + <i class="material-icons">chevron_right</i> + </a> + </li> + {% endif %} + </ul> + </div> +</div> +{% endif %} + + + <script> + +// Shamelessly stolen from here: +// https://stackoverflow.com/questions/486896/adding-a-parameter-to-the-url-with-javascript +function insertParam(key, value) +{ + key = encodeURI(key); value = encodeURI(value); + + var kvp = document.location.search.substr(1).split('&'); + + var i=kvp.length; var x; while(i--) + { + x = kvp[i].split('='); + + if (x[0]==key) + { + x[1] = value; + kvp[i] = x.join('='); + break; + } + } + + if(i<0) {kvp[kvp.length] = [key,value].join('=');} + + //this will reload the page, it's likely better to store this until finished + document.location.search = kvp.join('&'); +} + + </script> |
