Merge remote-tracking branch 'inventree/master'

This commit is contained in:
Oliver Walters 2019-08-15 19:54:21 +10:00
commit dd33209b1c
5 changed files with 51 additions and 21 deletions

View File

@ -23,6 +23,30 @@ InvenTree | Build - {{ build }}
</div>
<div class='media-body'>
<h4>Build Details</h4>
<p>
<div class='btn-row'>
<div class='btn-group'>
<button type='button' class='btn btn-default btn-glyph' id='build-edit' title='Edit Build'>
<span class='glyphicon glyphicon-edit'/>
</button>
{% if build.is_active %}
<button type='button' class='btn btn-default btn-glyph' id='build-complete' title="Complete Build">
<span class='glyphicon glyphicon-send'/>
</button>
<button type='button' class='btn btn-default btn-glyph' id='build-cancel'>
<span class='glyphicon glyphicon-remove'/>
</button>
{% endif %}
{% if build.status == BuildStatus.CANCELLED %}
<button type='button' class='btn btn-default btn-glyph' id='build-delete' title='Delete Build'>
<span class='glyphicon glyphicon-trash'/>
</button>
{% endif %}
</div>
</div>
</p>
<table class='table table-striped table-condensed'>
<tr>
<td>{{ build.title }}</td>
@ -53,23 +77,6 @@ InvenTree | Build - {{ build }}
</div>
</div>
</div>
<div class='col-sm-6'>
<h3>
<div style='float: right;'>
<div class="dropdown" 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">
<li><a href='#' id='build-edit' title='Edit build'>Edit build</a></li>
{% if build.is_active %}
<li><a href='#' id='build-complete' title='Complete Build'>Complete Build</a></li>
<li><a href='#' id='build-cancel' title='Cancel build'>Cancel build</a></li>
{% endif %}
</ul>
</div>
</div>
</h3>
</div>
</div>
<hr>
@ -109,5 +116,14 @@ InvenTree | Build - {{ build }}
}
);
});
$("#build-delete").on('click', function() {
launchModalForm(
"{% url 'build-delete' build.id %}",
{
redirect: "{% url 'build-index' %}",
}
);
});
{% endblock %}

View File

@ -0,0 +1,5 @@
{% extends "modal_delete_form.html" %}
{% block pre_form_content %}
Are you sure you want to delete this build?
{% endblock %}

View File

@ -3,6 +3,6 @@
<a href="{% url 'build-detail' build.id %}">Details</a>
</li>
<li{% if tab == 'allocate' %} class='active'{% endif %}>
<a href="{% url 'build-allocate' build.id %}">Parts</a>
<a href="{% url 'build-allocate' build.id %}">Assign Parts</a>
</li>
</ul>

View File

@ -17,9 +17,10 @@ build_item_urls = [
]
build_detail_urls = [
url(r'^edit/?', views.BuildUpdate.as_view(), name='build-edit'),
url(r'^allocate/?', views.BuildAllocate.as_view(), name='build-allocate'),
url(r'^cancel/?', views.BuildCancel.as_view(), name='build-cancel'),
url(r'^edit/', views.BuildUpdate.as_view(), name='build-edit'),
url(r'^allocate/', views.BuildAllocate.as_view(), name='build-allocate'),
url(r'^cancel/', views.BuildCancel.as_view(), name='build-cancel'),
url(r'^delete/', views.BuildDelete.as_view(), name='build-delete'),
url(r'^complete/?', views.BuildComplete.as_view(), name='build-complete'),
url(r'^auto-allocate/?', views.BuildAutoAllocate.as_view(), name='build-auto-allocate'),
url(r'^unallocate/', views.BuildUnallocate.as_view(), name='build-unallocate'),

View File

@ -397,6 +397,14 @@ class BuildUpdate(AjaxUpdateView):
}
class BuildDelete(AjaxDeleteView):
""" View to delete a build """
model = Build
ajax_template_name = 'build/delete_build.html'
ajax_form_title = 'Delete Build'
class BuildItemDelete(AjaxDeleteView):
""" View to 'unallocate' a BuildItem.
Really we are deleting the BuildItem object from the database.