Add buttons to company page

This commit is contained in:
Oliver Walters 2019-06-19 00:01:30 +10:00
parent c0e66dd9a0
commit 7effe3af9d
2 changed files with 26 additions and 33 deletions

View File

@ -24,6 +24,14 @@ InvenTree | Company - {{ company.name }}
<div class='media-body'>
<h4>{{ company.name }}</h4>
<p>{{ company.description }}</p>
<div class='btn-group'>
<button type='button' class='btn btn-default btn-glyph' id='company-edit' title='Edit company information'>
<span class='glyphicon glyphicon-cog'/>
</button>
<button type='button' class='btn btn-default btn-glyph' id='company-delete' title='Edit company information'>
<span class='glyphicon glyphicon-trash'/>
</button>
</div>
</div>
</div>
</div>
@ -77,6 +85,22 @@ InvenTree | Company - {{ company.name }}
{% block js_ready %}
$('#company-edit').click(function() {
launchModalForm(
"{% url 'company-edit' company.id %}",
{
reload: true
});
});
$('#company-delete').click(function() {
launchModalForm(
"{% url 'company-delete' company.id %}",
{
redirect: "{% url 'company-index' %}"
});
});
enableDragAndDrop(
"#company-thumb",
"{% url 'company-image' company.id %}",

View File

@ -4,24 +4,7 @@
{% include 'company/tabs.html' with tab='details' %}
<div class='row'>
<div class='col-sm-6'>
<h4>Company Details</h4>
</div>
<div class='col-sm-6'>
<h3>
<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='edit-company' title='Edit company'>Edit</a></li>
<li><a href="#" id='delete-company' title='Delete company'>Delete</a></li>
</ul>
</div>
</h3>
</div>
</div>
<hr>
<table class='table table-striped'>
@ -45,19 +28,5 @@
{% endblock %}
{% block js_ready %}
{{ block.super }}
$('#edit-company').click(function() {
launchModalForm(
"{% url 'company-edit' company.id %}",
{
reload: true
});
});
$('#delete-company').click(function() {
launchModalForm(
"{% url 'company-delete' company.id %}",
{
redirect: "{% url 'company-index' %}"
});
});
{% endblock %}