Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2019-06-18 23:26:48 +10:00
commit d4391f99bb
8 changed files with 84 additions and 68 deletions

View File

@ -61,12 +61,12 @@ InvenTree | {{ order }}
<hr>
<div class='btn-group' style='float: right;'>
<div id='order-toolbar-buttons' class='btn-group' style='float: right;'>
<button type='button' class='btn btn-primary' id='edit-order'>Edit Order</button>
{% if order.status == OrderStatus.PENDING and order.lines.count > 0 %}
<button type='button' class='btn btn-primary' id='place-order'>Place Order</button>
{% elif order.status == OrderStatus.PLACED %}
<button type='button' class='btn btn-primary' id='receive-order'>Receive Order</button>
<button type='button' class='btn btn-primary' id='receive-order'>Receive Items</button>
{% endif %}
<button type='button' class='btn btn-primary' id='export-order' title='Export order to file'>Export</button>
</div>
@ -77,7 +77,7 @@ InvenTree | {{ order }}
<button type='button' class='btn btn-default' id='new-po-line'>Add Line Item</button>
{% endif %}
<table class='table table-striped table-condensed' id='po-lines-table'>
<table class='table table-striped table-condensed' id='po-lines-table' data-toolbar='#order-toolbar-buttons'>
<thead>
<tr>
<th data-sortable='true'>Line</th>

View File

@ -158,7 +158,11 @@ class PurchaseOrderExport(AjaxView):
export_format = request.GET.get('format', 'csv')
filename = str(order) + '.' + export_format
filename = '{order} - {company}.{fmt}'.format(
order=str(order),
company=order.supplier.name,
fmt=export_format
)
filedata = order.export_to_file(format=export_format)

View File

@ -102,6 +102,7 @@ class EditPartForm(HelperForm):
'units',
'minimum_stock',
'notes',
'active',
]

View File

@ -4,31 +4,6 @@
{% include 'part/tabs.html' with tab='detail' %}
<div class='row'>
<div class='col-sm-6'>
</div>
<div class='col-sm-6'>
<div class="btn-group" style="float: right;">
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Options
<span class="caret"></span></button>
<ul class="dropdown-menu">
{% if part.active %}
<li><a href="#" id='edit-part' title='Edit part'>Edit</a></li>
{% if part.purchaseable %}
<li><a href='#' id='order-part' title='Order part'>Order</a></li>
{% endif %}
<li><a href='#' id='duplicate-part' title='Duplicate Part'>Duplicate</a></li>
<hr>
<li><a href="#" id='deactivate-part' title='Deactivate part'>Deactivate</a></li>
{% else %}
<li><a href="#" id='activate-part' title='Activate part'>Activate</a></li>
<li><a href='#' id='delete-part' title='Delete part'>Delete</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
<div class='row'>
<div class='col-sm-6'>
<h4>Part Details</h4>
@ -194,31 +169,6 @@
},
);
});
$("#duplicate-part").click(function() {
launchModalForm(
"{% url 'part-duplicate' part.id %}",
{
follow: true,
}
);
});
$("#order-part").click(function() {
launchModalForm("/order/purchase-order/order-parts/", {
data: {
part: {{ part.id }},
},
});
});
$("#edit-part").click(function() {
launchModalForm(
"{% url 'part-edit' part.id %}",
{
reload: true,
});
});
$('#activate-part').click(function() {
showQuestionDialog(
@ -264,14 +214,5 @@
}
);
});
$('#delete-part').click(function() {
launchModalForm(
"{% url 'part-delete' part.id %}",
{
redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %}
});
});
{% endblock %}

View File

@ -46,9 +46,27 @@
</button>
{% if part.is_template == False %}
{% include "qr_button.html" %}
{% if part.active %}
<button type='button' class='btn btn-default btn-glyph' id='price-button' title='Show pricing information'>
<span id='part-price-icon' class='part-price glyphicon glyphicon-usd'/>
</button>
{% if part.purchaseable %}
<button type='button' class='btn btn-default btn-glyph' id='part-order' title='Order part'>
<span id='part-order-icon' class='part-order glyphicon glyphicon-shopping-cart'/>
</button>
{% endif %}
{% endif %}
{% endif %}
<button type='button' class='btn btn-default btn-glyph' id='part-duplicate' title='Duplicate part'>
<span id='part-duplicate-icon' class='part-duplicate glyphicon glyphicon-duplicate'/>
</button>
<button type='button' class='btn btn-default btn-glyph' id='part-edit' title='Edit part'>
<span id='part-edit-icon' class='glyphicon glyphicon-cog part-cog'/>
</button>
{% if not part.active %}
<button type='button' class='btn btn-default btn-glyph' id='part-delete' title='Delete part'>
<span id='part-delete-icon' class='glyphicon glyphicon-trash' style='color: #a11;'/>
</button>
{% endif %}
</div>
</p>
@ -170,9 +188,6 @@
});
});
$('#toggle-starred').click(function() {
});
$("#part-thumb").click(function() {
launchModalForm(
"{% url 'part-image' part.id %}",
@ -182,4 +197,41 @@
);
});
$("#part-edit").click(function() {
launchModalForm(
"{% url 'part-edit' part.id %}",
{
reload: true,
}
);
});
$("#part-order").click(function() {
launchModalForm("/order/purchase-order/order-parts/", {
data: {
part: {{ part.id }},
},
});
});
$("#part-duplicate").click(function() {
launchModalForm(
"{% url 'part-duplicate' part.id %}",
{
follow: true,
}
);
});
{% if not part.active %}
$("#part-delete").click(function() {
launchModalForm(
"{% url 'part-delete' part.id %}",
{
redirect: {% if part.category %}"{% url 'category-detail' part.category.id %}"{% else %}"{% url 'part-index' %}"{% endif %}
}
);
});
{% endif %}
{% endblock %}

View File

@ -446,6 +446,7 @@ class PartDetail(DetailView):
part = self.get_object()
context['starred'] = part.isStarredBy(self.request.user)
context['disabled'] = not part.active
context['OrderStatus'] = OrderStatus

View File

@ -43,6 +43,22 @@ function partialMatcher(params, data) {
}
function attachToggle(modal) {
/* Attach 'bootstrap-toggle' functionality to any checkbox in the modal.
* This is simple for visual improvement,
* and also larger toggle style buttons are easier to press!
*/
$(modal).find("input[type='checkbox']").each(function(x) {
$(this).bootstrapToggle({
size: 'small',
onstyle: 'success',
offstyle: 'warning',
});
});
}
function attachSelect(modal) {
/* Attach 'select2' functionality to any drop-down list in the modal.
* Provides search filtering for dropdown items
@ -351,6 +367,7 @@ function injectModalForm(modal, form_html) {
*/
$(modal).find('.modal-form-content').html(form_html);
attachSelect(modal);
attachToggle(modal);
}

View File

@ -1,3 +1,3 @@
<div>
<input field='{{ field }}' class='slidey' type="checkbox" data-onstyle="success" data-size='small' data-toggle="toggle" {% if disabled %}disabled="disabled" {% endif %}{% if state %}checked="checked"{% endif %}>
<input field='{{ field }}' class='slidey' type="checkbox" data-offstyle='warning' data-onstyle="success" data-size='small' data-toggle="toggle" {% if disabled %}disabled="disabled" {% endif %}{% if state %}checked="checked"{% endif %}>
</div>