Item table fixes

This commit is contained in:
2020-04-06 02:00:14 +01:00
parent de210caa36
commit d351d9eb7b
3 changed files with 36 additions and 74 deletions

View File

@@ -2,55 +2,41 @@
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<div class="row"> <h4>{{ object.name|default:"New Event" }}</h4>
<div class="col-sm-8">
<h4>{{ object.name|default:"New Event" }}</h4>
</div>
<div class="col-sm-4 text-right">
<button type="button" class="close" data-dismiss="modal"><span
aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
</div>
</div>
</div> </div>
<form class="form-horizontal" id="item-form"> <form id="item-form">
<div class="modal-body"> <div class="modal-body">
<div class="form-group"> <div class="form-group form-row">
<label for="item_name" class="col-sm-2 control-label">Item Name</label> <label for="item_name" class="col-sm-2 control-label">Item Name</label>
<div class="col-sm-10"> <div class="col-sm-10">
<input type="text" placeholder="Item Name" class="form-control" required maxlength="255" <input type="text" placeholder="Item Name" class="form-control" required maxlength="255"
id="item_name"/> id="item_name"/>
</div> </div>
</div> </div>
<div class="form-group form-row">
<div class="form-group">
<label for="item_description" class="col-sm-2 control-label">Description</label> <label for="item_description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10"> <div class="col-sm-10">
<textarea type="text" placeholder="Description" class="form-control" <textarea type="text" placeholder="Description" class="form-control"
id="item_description" rows="8"></textarea> id="item_description" rows="8"></textarea>
</div> </div>
</div> </div>
<div class="form-row">
<div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group form-row">
<label for="item_quantity" class="col-sm-4 control-label">Quantity</label> <label for="item_quantity" class="col-sm-4 control-label">Quantity</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input type="number" placeholder="Quantity" class="form-control" required <input type="number" placeholder="Quantity" class="form-control" required
min="1" id="item_quantity"/> min="1" id="item_quantity"/>
</div> </div>
</div> </div>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
<div class="form-group"> <div class="form-group form-row">
<label for="item_cost" class="col-sm-4 control-label">Cost</label> <label for="item_cost" class="col-sm-4 control-label">Cost</label>
<div class="col-sm-8"> <div class="col-sm-8">
<div class="input-group"> <div class="input-group">
<div class="input-group-addon">£</div> <div class="input-group-prepend"><span class="input-group-text">£</span></div>
<input type="number" placeholder="Cost" class="form-control" required <input type="number" placeholder="Cost" class="form-control" required
min="-99999999.99" max="99999999.99" step="0.01" min="-99999999.99" max="99999999.99" step="0.01"
id="item_cost"/> id="item_cost"/>
@@ -60,12 +46,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="modal-barter"> <div class="modal-footer">
<div class="col-sm-12"> <input type="submit" class="btn btn-primary">
<div class="pull-right">
<input type="submit" class="btn btn-primary">
</div>
</div>
</div> </div>
</form> </form>
</div> </div>

View File

@@ -1,11 +1,10 @@
<tr id="item-{{item.pk}}" data-pk="{{item.pk}}" class="item_row"> <tr id="item-{{item.pk}}" data-pk="{{item.pk}}" class="item_row">
<td> <th scope="row">
<span class="name">{{ item.name }}</span> <span class="name">{{ item.name }}</span>
<div class="item-description"> <div class="item-description">
<em class="description">{{item.description|linebreaksbr}}</em> <em class="description">{{item.description|linebreaksbr}}</em>
</div> </div>
</td> </th>
{% if perms.RIGS.view_event %} {% if perms.RIGS.view_event %}
<td>£&nbsp;<span class="cost">{{item.cost|floatformat:2}}</span></td> <td>£&nbsp;<span class="cost">{{item.cost|floatformat:2}}</span></td>
{% endif %} {% endif %}
@@ -14,16 +13,18 @@
<td>£&nbsp;<span class="sub-total" data-subtotal="{{item.total_cost}}">{{item.total_cost|floatformat:2}}</span></td> <td>£&nbsp;<span class="sub-total" data-subtotal="{{item.total_cost}}">{{item.total_cost|floatformat:2}}</span></td>
{% endif %} {% endif %}
{% if edit %} {% if edit %}
<td class="vert-align text-right"> <td class="vert-align text-right">
<button type="button" class="item-edit btn btn-xs btn-default" <div class="btn-group" role="group" aria-label="Action buttons">
data-pk="{{item.pk}}" <button type="button" class="item-edit btn btn-xs btn-warning"
data-toggle="modal" data-target="#itemModal"> data-pk="{{item.pk}}"
<span class="fas fa-edit"></span> data-toggle="modal" data-target="#itemModal">
</button> <span class="fas fa-edit"></span>
<button type="button" class="item-delete btn btn-xs btn-danger" </button>
data-pk="{{item.pk}}"> <button type="button" class="item-delete btn btn-xs btn-danger"
<span class="fas fa-remove"></span> data-pk="{{item.pk}}">
</button> <span class="fas fa-times-circle"></span>
</td> </button>
</div>
</td>
{% endif %} {% endif %}
</tr> </tr>

View File

@@ -2,22 +2,22 @@
<table class="table table-hover" id="item-table" {% if edit %}data-orderurl="{#% url 'item_order' %#}"{% endif %}> <table class="table table-hover" id="item-table" {% if edit %}data-orderurl="{#% url 'item_order' %#}"{% endif %}>
<thead> <thead>
<tr> <tr>
<td>Item</td> <th scope="col">Item</th>
{% if perms.RIGS.view_event %} {% if perms.RIGS.view_event %}
<td>Price</td> <th scope="col">Price</th>
{% endif %} {% endif %}
<td>Quantity</td> <th scope="col">Quantity</th>
{% if perms.RIGS.view_event %} {% if perms.RIGS.view_event %}
<td>Sub-total</td> <th scope="col">Sub-total</th>
{% endif %} {% endif %}
{% if edit %} {% if edit %}
<td class="text-right"> <th scope="col" class="text-right align-self-start">
<button type="button" class="btn btn-default btn-xs item-add" <button type="button" class="btn btn-success btn-xs item-add"
data-toggle="modal" data-toggle="modal"
data-target="#itemModal"> data-target="#itemModal">
<span class="fas fa-plus"></span> <i class="fas fa-plus"></i> Add Item
</button> </button>
</td> </th>
{% endif %} {% endif %}
</tr> </tr>
</thead> </thead>
@@ -27,7 +27,7 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
{% if perms.RIGS.view_event %} {% if perms.RIGS.view_event %}
<tbart> <tfoot>
<tr> <tr>
<td rowspan="3" colspan="2"></td> <td rowspan="3" colspan="2"></td>
<td>Total (ex. VAT)</td> <td>Total (ex. VAT)</td>
@@ -47,31 +47,10 @@
<td>Total</td> <td>Total</td>
<td colspan="2">£ <span id="total">{{object.total|default:0|floatformat:2}}</span></td> <td colspan="2">£ <span id="total">{{object.total|default:0|floatformat:2}}</span></td>
</tr> </tr>
</tbart> </tfoot>
{% endif %} {% endif %}
</table> </table>
</div> </div>
<table class="hidden invisible"> <table class="hidden invisible">
<tr id="new-item-row" class="item_row"> {% include 'item_row.html' %}
<td>
<span class="name"></span>
<div class="item-description">
<em class="description"></em>
</div>
</td>
<td>£&nbsp;<span class="cost"></span></td>
<td class="quantity"></td>
<td>£&nbsp;<span class="sub-total"></span></td>
{% if edit %}
<td class="vert-align text-right">
<button type="button" class="item-edit btn btn-xs btn-default"
data-toggle="modal" data-target="#itemModal">
<i class="fas fa-edit"></i>
</button>
<button type="button" class="item-delete btn btn-xs btn-danger">
<i class="fas fa-times-circle"></i>
</button>
</td>
{% endif %}
</tr>
</table> </table>