mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-24 00:42:17 +00:00
Fixed frontend for updating existing items
This commit is contained in:
@@ -62,7 +62,7 @@
|
||||
{% endif %}
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
setupItemTable($("#{{ form.items_json.id_for_label }}").val());
|
||||
});
|
||||
</script>
|
||||
@@ -77,9 +77,10 @@
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% include 'form_errors.html' %}
|
||||
<form class="form-horizontal" role="form" method="POST">{% csrf_token %}
|
||||
<form class="form-horizontal itemised_form" role="form" method="POST">{% csrf_token %}
|
||||
{% render_field form.is_rig style="display: none" %}
|
||||
<input type="hidden" name="{{ form.items_json.name }}" id="{{ form.items_json.id_for_label }}" value="{{ form.items_json.value }}" />
|
||||
<input type="hidden" name="{{ form.items_json.name }}" id="{{ form.items_json.id_for_label }}"
|
||||
value="{{ form.items_json.value }}"/>
|
||||
|
||||
{# New rig buttons #}
|
||||
{% if not object.pk %}
|
||||
@@ -335,7 +336,67 @@
|
||||
<div class="modal fade" id="itemModal" role="dialog" aria-labelledby="itemModal" aria-hidded="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span
|
||||
aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
||||
</div>
|
||||
<form class="form-horizontal" id="item-form">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="item_name" class="col-sm-2 control-label">Item Name</label>
|
||||
|
||||
<div class="col-sm-10">
|
||||
<input type="text" placeholder="Item Name" class="form-control" required maxlength="255"
|
||||
id="item_name"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="item_description" class="col-sm-2 control-label">Description</label>
|
||||
|
||||
<div class="col-sm-10">
|
||||
<textarea type="text" placeholder="Description" class="form-control"
|
||||
id="item_description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="item_quantity" class="col-sm-4 control-label">Quantity</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<input type="number" placeholder="Quantity" class="form-control" required
|
||||
min="1" id="item_quantity"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="item_cost" class="col-sm-4 control-label">Cost</label>
|
||||
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">£</div>
|
||||
<input type="number" placeholder="Cost" class="form-control" required
|
||||
min="-99999999.99" max="99999999.99" step="0.01"
|
||||
id="item_cost"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="col-sm-12">
|
||||
<div class="pull-right">
|
||||
<input type="submit" class="btn btn-primary">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<tr id="item-{{item.pk}}" data-url="{% url 'api_secure' item.pk %}" data-pk="{{item.pk}}">
|
||||
<tr id="item-{{item.pk}}" data-url="{% url 'api_secure' item.pk %}" data-pk="{{item.pk}}" class="item_row">
|
||||
<td>
|
||||
{{ item.name }}
|
||||
<span class="name">{{ item.name }}</span>
|
||||
{% if item.description %}
|
||||
<br />
|
||||
<em>{{item.description|linebreaksbr}}</em>
|
||||
<div class="description">
|
||||
<em>{{item.description|linebreaksbr}}</em>
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>£ {{item.cost}}</td>
|
||||
<td>{{item.quantity}}</td>
|
||||
<td class="sub-total" data-subtotal="{{item.total_cost}}">£ {{item.total_cost}}</td>
|
||||
<td>£ <span class="cost">{{item.cost|floatformat:2}}</span></td>
|
||||
<td class="quantity">{{item.quantity}}</td>
|
||||
<td>£ <span class="sub-total" data-subtotal="{{item.total_cost}}">{{item.total_cost|floatformat:2}}</span></td>
|
||||
{% if edit %}
|
||||
<td class="vert-align text-right">
|
||||
<button type="button" class="item-edit btn btn-xs btn-default"
|
||||
|
||||
Reference in New Issue
Block a user