mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Refactor Company detail view
This commit is contained in:
parent
b6227f7d28
commit
c1c0a262b2
@ -1,38 +0,0 @@
|
|||||||
{% extends "company/company_base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block menubar %}
|
|
||||||
{% include "company/navbar.html" with tab="assigned" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block heading %}
|
|
||||||
{% trans "Assigned Stock" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block details %}
|
|
||||||
|
|
||||||
<div id='button-toolbar'>
|
|
||||||
<div class='filter-list' id='filter-list-stock'>
|
|
||||||
<!-- An empty div in which the filter list will be constructed -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='stock-table' data-toolbar='#button-toolbar'></table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js_ready %}
|
|
||||||
{{ block.super }}
|
|
||||||
|
|
||||||
loadStockTable($("#stock-table"), {
|
|
||||||
params: {
|
|
||||||
customer: {{ company.id }},
|
|
||||||
part_detail: true,
|
|
||||||
location_detail: true,
|
|
||||||
},
|
|
||||||
url: "{% url 'api-stock-list' %}",
|
|
||||||
filterKey: "customerstock",
|
|
||||||
});
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -71,6 +71,17 @@
|
|||||||
<td><a href="{{ company.website }}">{{ company.website }}</a>{% include "clip.html"%}</td>
|
<td><a href="{{ company.website }}">{{ company.website }}</a>{% include "clip.html"%}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<tr>
|
||||||
|
<td><span class='fas fa-dollar-sign'></span></td>
|
||||||
|
<td>{% trans "Currency" %}</td>
|
||||||
|
<td>
|
||||||
|
{% if company.currency %}
|
||||||
|
{{ company.currency }}
|
||||||
|
{% else %}
|
||||||
|
<i>{% trans "Uses default currency" %}</i>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
{% if company.address %}
|
{% if company.address %}
|
||||||
<tr>
|
<tr>
|
||||||
<td><span class='fas fa-map-marked-alt'></span></td>
|
<td><span class='fas fa-map-marked-alt'></span></td>
|
||||||
@ -99,6 +110,22 @@
|
|||||||
<td>{{ company.contact }}{% include "clip.html"%}</td>
|
<td>{{ company.contact }}{% include "clip.html"%}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><span class='fas fa-industry'></span></td>
|
||||||
|
<td>{%trans "Manufacturer" %}</td>
|
||||||
|
<td>{% include "yesnolabel.html" with value=company.is_manufacturer %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><span class='fas fa-building'></span></td>
|
||||||
|
<td>{% trans "Supplier" %}</td>
|
||||||
|
<td>{% include 'yesnolabel.html' with value=company.is_supplier %}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><span class='fas fa-user-tie'></span></td>
|
||||||
|
<td>{% trans "Customer" %}</td>
|
||||||
|
<td>{% include 'yesnolabel.html' with value=company.is_customer %}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -1,79 +1,430 @@
|
|||||||
{% extends "company/company_base.html" %}
|
{% extends "company/company_base.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load markdownify %}
|
||||||
|
|
||||||
{% block menubar %}
|
{% block menubar %}
|
||||||
{% include 'company/navbar.html' with tab='details' %}
|
{% include 'company/navbar.html' with tab='details' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block heading %}
|
{% block page_content %}
|
||||||
{% trans "Company Details" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block details %}
|
<div class='panel panel-default panel-inventree panel-hidden' id='panel-supplier-parts'>
|
||||||
<div class='row'>
|
<div class='panel-heading'>
|
||||||
<div class='col-sm-6'>
|
<h4>{% trans "Supplier Parts" %}</h4>
|
||||||
<table class='table table-striped'>
|
</div>
|
||||||
<col width='25'>
|
<div class='panel-content'>
|
||||||
<col>
|
{% if roles.purchase_order.change %}
|
||||||
<tr>
|
<div id='button-toolbar'>
|
||||||
<td><span class='fas fa-font'></span></td>
|
<div class='button-toolbar container-fluid'>
|
||||||
<td>{% trans "Company Name" %}</td>
|
<div class='btn-group' role='group'>
|
||||||
<td>{{ company.name }}{% include "clip.html"%}</td>
|
{% if roles.purchase_order.add %}
|
||||||
</tr>
|
<button class="btn btn-success" id='supplier-part-create' title='{% trans "Create new supplier part" %}'>
|
||||||
{% if company.description %}
|
<span class='fas fa-plus-circle'></span> {% trans "New Supplier Part" %}
|
||||||
<tr>
|
</button>
|
||||||
<td><span class='fas fa-info'></span></td>
|
|
||||||
<td>{% trans "Description" %}</td>
|
|
||||||
<td>{{ company.description }}{% include "clip.html"%}</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
<tr>
|
|
||||||
<td><span class='fas fa-globe'></span></td>
|
|
||||||
<td>{% trans "Website" %}</td>
|
|
||||||
<td>
|
|
||||||
{% if company.website %}<a href='{{ company.website }}'>{{ company.website }}</a>{% include "clip.html"%}
|
|
||||||
{% else %}<i>{% trans "No website specified" %}</i>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
<div class='btn-group'>
|
||||||
</tr>
|
<div class="dropdown" style="float: right;">
|
||||||
<tr>
|
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %}
|
||||||
<td><span class='fas fa-dollar-sign'></span></td>
|
<span class="caret"></span>
|
||||||
<td>{% trans "Currency" %}</td>
|
</button>
|
||||||
<td>
|
<ul class="dropdown-menu">
|
||||||
{% if company.currency %}{{ company.currency }}
|
{% if roles.purchase_order.add %}
|
||||||
{% else %}<i>{% trans "Uses default currency" %}</i>
|
<li><a href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
{% if roles.purchase_order.delete %}
|
||||||
</tr>
|
<li><a href='#' id='multi-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class='filter-list' id='filter-list-supplier-part'>
|
||||||
|
<!-- Empty div (will be filled out with available BOM filters) -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<table class='table table-striped table-condensed' id='part-table' data-toolbar='#button-toolbar'>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-sm-6'>
|
</div>
|
||||||
<table class='table table-striped'>
|
|
||||||
<col width='25'>
|
|
||||||
<col>
|
|
||||||
<tr>
|
|
||||||
<td><span class='fas fa-industry'></span></td>
|
|
||||||
<td>{% trans "Manufacturer" %}</td>
|
|
||||||
<td>{% include "yesnolabel.html" with value=company.is_manufacturer %}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><span class='fas fa-building'></span></td>
|
|
||||||
<td>{% trans "Supplier" %}</td>
|
|
||||||
<td>{% include 'yesnolabel.html' with value=company.is_supplier %}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><span class='fas fa-user-tie'></span></td>
|
|
||||||
<td>{% trans "Customer" %}</td>
|
|
||||||
<td>{% include 'yesnolabel.html' with value=company.is_customer %}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
<div class='panel panel-default panel-inventree panel-hidden' id='panel-manufacturer-parts'>
|
||||||
|
<div class='panel-heading'>
|
||||||
|
<h4>{% trans "Manufacturer Parts" %}</h4>
|
||||||
|
</div>
|
||||||
|
<div class='panel-content'>
|
||||||
|
{% if roles.purchase_order.change %}
|
||||||
|
<div id='button-toolbar'>
|
||||||
|
<div class='button-toolbar container-fluid'>
|
||||||
|
<div class='btn-group role='group'>
|
||||||
|
{% if roles.purchase_order.add %}
|
||||||
|
<button class="btn btn-success" id='manufacturer-part-create' title='{% trans "Create new manufacturer part" %}'>
|
||||||
|
<span class='fas fa-plus-circle'></span> {% trans "New Manufacturer Part" %}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
<div class='btn-group'>
|
||||||
|
<div class="dropdown" style="float: right;">
|
||||||
|
<button class="btn btn-primary dropdown-toggle" id='table-options', type="button" data-toggle="dropdown">{% trans "Options" %}
|
||||||
|
<span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
{% if roles.purchase_order.add %}
|
||||||
|
<li><a href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% if roles.purchase_order.delete %}
|
||||||
|
<li><a href='#' id='multi-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class='filter-list' id='filter-list-supplier-part'>
|
||||||
|
<!-- Empty div (will be filled out with available BOM filters) -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<table class='table table-striped table-condensed' id='part-table' data-toolbar='#button-toolbar'>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='panel panel-default panel-inventree panel-hidden' id='panel-company-stock'>
|
||||||
|
<div class='panel-heading'>
|
||||||
|
<h4>{% trans "Supplier Stock" %}</h4>
|
||||||
|
</div>
|
||||||
|
<div class='panel-content'>
|
||||||
|
{% include "stock_table.html" %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='panel panel-default panel-inventree panel-hidden' id='panel-purchase-orders'>
|
||||||
|
<div class='panel-heading'>
|
||||||
|
<h4>{% trans "Purchase Orders" %}</h4>
|
||||||
|
</div>
|
||||||
|
<div class='panel-content'>
|
||||||
|
{% if roles.purchase_order.add %}
|
||||||
|
<div id='button-bar'>
|
||||||
|
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||||
|
<button class='btn btn-primary' type='button' id='company-order2' title='{% trans "Create new purchase order" %}'>
|
||||||
|
<span class='fas fa-plus-circle'></span> {% trans "New Purchase Order" %}</button>
|
||||||
|
<div class='filter-list' id='filter-list-purchaseorder'>
|
||||||
|
<!-- Empty div -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<table class='table table-striped table-condensed po-table' id='purchase-order-table' data-toolbar='#button-bar'>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='panel panel-default panel-inventree panel-hidden' id='panel-sales-orders'>
|
||||||
|
<div class='panel-heading'>
|
||||||
|
<h4>{% trans "Sales Orders" %}</h4>
|
||||||
|
</div>
|
||||||
|
<div class='panel-content'>
|
||||||
|
{% if roles.sales_order.add %}
|
||||||
|
<div id='button-bar'>
|
||||||
|
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||||
|
<button class='btn btn-primary' type='button' id='new-sales-order' title='{% trans "Create new sales order" %}'>
|
||||||
|
<div class='fas fa-plus-circle'></div> {% trans "New Sales Order" %}
|
||||||
|
</button>
|
||||||
|
<div class='filter-list' id='filter-list-salesorder'>
|
||||||
|
<!-- Empty div -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<table class='table table-striped table-condensed po-table' id='sales-order-table' data-toolbar='#button-bar'>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='panel panel-default panel-inventree panel-hidden' id='panel-assigned-stock'>
|
||||||
|
<div class='panel-heading'>
|
||||||
|
<h4>{% trans "Assigned Stock" %}</h4>
|
||||||
|
</div>
|
||||||
|
<div class='panel-content'>
|
||||||
|
<div id='button-toolbar'>
|
||||||
|
<div class='filter-list' id='filter-list-stock'>
|
||||||
|
<!-- An empty div in which the filter list will be constructed -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class='table table-striped table-condensed' id='assigned-stock-table' data-toolbar='#button-toolbar'></table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='panel panel-default panel-inventree panel-hidden' id='panel-company-notes'>
|
||||||
|
<div class='panel-heading'>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-sm-6'>
|
||||||
|
<h4>{% trans "Company Notes" %}</h4>
|
||||||
|
</div>
|
||||||
|
<div class='col-sm-6'>
|
||||||
|
<div class='btn-group float-right'>
|
||||||
|
<button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-small btn-default'>
|
||||||
|
<span class='fas fa-edit'>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class='panel-content'>
|
||||||
|
{{ company.notes | markdownify }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js_ready %}
|
{% block js_ready %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
|
$('#edit-notes').click(function() {
|
||||||
|
constructForm('{% url "api-company-detail" company.pk %}', {
|
||||||
|
fields: {
|
||||||
|
notes: {
|
||||||
|
multiline: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: '{% trans "Edit Notes" %}',
|
||||||
|
reload: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
loadStockTable($("#assigned-stock-table"), {
|
||||||
|
params: {
|
||||||
|
customer: {{ company.id }},
|
||||||
|
part_detail: true,
|
||||||
|
location_detail: true,
|
||||||
|
},
|
||||||
|
url: "{% url 'api-stock-list' %}",
|
||||||
|
filterKey: "customerstock",
|
||||||
|
});
|
||||||
|
|
||||||
|
{% if company.is_customer %}
|
||||||
|
loadSalesOrderTable("#sales-order-table", {
|
||||||
|
url: "{% url 'api-so-list' %}",
|
||||||
|
params: {
|
||||||
|
customer: {{ company.id }},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#new-sales-order").click(function() {
|
||||||
|
|
||||||
|
createSalesOrder({
|
||||||
|
customer: {{ company.pk }},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if company.is_supplier %}
|
||||||
|
loadPurchaseOrderTable("#purchase-order-table", {
|
||||||
|
url: "{% url 'api-po-list' %}",
|
||||||
|
params: {
|
||||||
|
supplier: {{ company.id }},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function newOrder() {
|
||||||
|
createPurchaseOrder({
|
||||||
|
supplier: {{ company.pk }},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#company-order").click(function() {
|
||||||
|
newOrder();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#company-order2").click(function() {
|
||||||
|
newOrder();
|
||||||
|
});
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
loadStockTable($('#stock-table'), {
|
||||||
|
url: "{% url 'api-stock-list' %}",
|
||||||
|
params: {
|
||||||
|
company: {{ company.id }},
|
||||||
|
part_detail: true,
|
||||||
|
supplier_part_detail: true,
|
||||||
|
location_detail: true,
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
'#stock-options',
|
||||||
|
],
|
||||||
|
filterKey: "companystock",
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#stock-export").click(function() {
|
||||||
|
launchModalForm("{% url 'stock-export-options' %}", {
|
||||||
|
submit_text: '{% trans "Export" %}',
|
||||||
|
success: function(response) {
|
||||||
|
var url = "{% url 'stock-export' %}";
|
||||||
|
|
||||||
|
url += "?format=" + response.format;
|
||||||
|
url += "&supplier={{ company.id }}";
|
||||||
|
|
||||||
|
location.href = url;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
{% if company.is_manufacturer %}
|
||||||
|
|
||||||
|
$("#manufacturer-part-create").click(function () {
|
||||||
|
|
||||||
|
constructForm('{% url "api-manufacturer-part-list" %}', {
|
||||||
|
fields: {
|
||||||
|
part: {},
|
||||||
|
manufacturer: {
|
||||||
|
value: {{ company.pk }},
|
||||||
|
},
|
||||||
|
MPN: {
|
||||||
|
icon: 'fa-hashtag',
|
||||||
|
},
|
||||||
|
description: {},
|
||||||
|
link: {
|
||||||
|
icon: 'fa-link',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
method: 'POST',
|
||||||
|
title: '{% trans "Add Manufacturer Part" %}',
|
||||||
|
onSuccess: function() {
|
||||||
|
$("#part-table").bootstrapTable("refresh");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
loadManufacturerPartTable(
|
||||||
|
"#part-table",
|
||||||
|
"{% url 'api-manufacturer-part-list' %}",
|
||||||
|
{
|
||||||
|
params: {
|
||||||
|
part_detail: true,
|
||||||
|
manufacturer_detail: true,
|
||||||
|
manufacturer: {{ company.id }},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
linkButtonsToSelection($("#manufacturer-table"), ['#table-options']);
|
||||||
|
|
||||||
|
$("#multi-part-delete").click(function() {
|
||||||
|
var selections = $("#part-table").bootstrapTable("getSelections");
|
||||||
|
|
||||||
|
deleteManufacturerParts(selections, {
|
||||||
|
onSuccess: function() {
|
||||||
|
$("#part-table").bootstrapTable("refresh");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#multi-part-order").click(function() {
|
||||||
|
var selections = $("#part-table").bootstrapTable("getSelections");
|
||||||
|
|
||||||
|
var parts = [];
|
||||||
|
|
||||||
|
selections.forEach(function(item) {
|
||||||
|
parts.push(item.part);
|
||||||
|
});
|
||||||
|
|
||||||
|
launchModalForm("/order/purchase-order/order-parts/", {
|
||||||
|
data: {
|
||||||
|
parts: parts,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if company.is_supplier %}
|
||||||
|
|
||||||
|
$("#supplier-part-create").click(function () {
|
||||||
|
launchModalForm(
|
||||||
|
"{% url 'supplier-part-create' %}",
|
||||||
|
{
|
||||||
|
data: {
|
||||||
|
supplier: {{ company.id }},
|
||||||
|
},
|
||||||
|
reload: true,
|
||||||
|
secondary: [
|
||||||
|
{
|
||||||
|
field: 'part',
|
||||||
|
label: '{% trans "New Part" %}',
|
||||||
|
title: '{% trans "Create new Part" %}',
|
||||||
|
url: "{% url 'part-create' %}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'supplier',
|
||||||
|
label: "{% trans 'New Supplier' %}",
|
||||||
|
title: "{% trans 'Create new Supplier' %}",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
loadSupplierPartTable(
|
||||||
|
"#part-table",
|
||||||
|
"{% url 'api-supplier-part-list' %}",
|
||||||
|
{
|
||||||
|
params: {
|
||||||
|
part_detail: true,
|
||||||
|
supplier_detail: true,
|
||||||
|
manufacturer_detail: true,
|
||||||
|
supplier: {{ company.id }},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
$("#multi-part-delete").click(function() {
|
||||||
|
var selections = $("#part-table").bootstrapTable("getSelections");
|
||||||
|
|
||||||
|
var parts = [];
|
||||||
|
|
||||||
|
selections.forEach(function(item) {
|
||||||
|
parts.push(item.pk);
|
||||||
|
});
|
||||||
|
|
||||||
|
var url = "{% url 'supplier-part-delete' %}"
|
||||||
|
|
||||||
|
launchModalForm(url, {
|
||||||
|
data: {
|
||||||
|
parts: parts,
|
||||||
|
},
|
||||||
|
reload: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#multi-part-order").click(function() {
|
||||||
|
var selections = $("#part-table").bootstrapTable("getSelections");
|
||||||
|
|
||||||
|
var parts = [];
|
||||||
|
|
||||||
|
selections.forEach(function(item) {
|
||||||
|
parts.push(item.part);
|
||||||
|
});
|
||||||
|
|
||||||
|
launchModalForm("/order/purchase-order/order-parts/", {
|
||||||
|
data: {
|
||||||
|
parts: parts,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
attachNavCallbacks({
|
||||||
|
panelClass: 'company',
|
||||||
|
default: 'company-stock'
|
||||||
|
});
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,119 +0,0 @@
|
|||||||
{% extends "company/company_base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% load i18n %}
|
|
||||||
{% load inventree_extras %}
|
|
||||||
|
|
||||||
{% block menubar %}
|
|
||||||
{% include 'company/navbar.html' with tab='manufacturer_parts' %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block heading %}
|
|
||||||
{% trans "Manufacturer Parts" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block details %}
|
|
||||||
|
|
||||||
{% if roles.purchase_order.change %}
|
|
||||||
<div id='button-toolbar'>
|
|
||||||
<div class='button-toolbar container-fluid'>
|
|
||||||
<div class='btn-group role='group'>
|
|
||||||
{% if roles.purchase_order.add %}
|
|
||||||
<button class="btn btn-success" id='manufacturer-part-create' title='{% trans "Create new manufacturer part" %}'>
|
|
||||||
<span class='fas fa-plus-circle'></span> {% trans "New Manufacturer Part" %}
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
<div class='btn-group'>
|
|
||||||
<div class="dropdown" style="float: right;">
|
|
||||||
<button class="btn btn-primary dropdown-toggle" id='table-options', type="button" data-toggle="dropdown">{% trans "Options" %}
|
|
||||||
<span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
{% if roles.purchase_order.add %}
|
|
||||||
<li><a href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% if roles.purchase_order.delete %}
|
|
||||||
<li><a href='#' id='multi-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class='filter-list' id='filter-list-supplier-part'>
|
|
||||||
<!-- Empty div (will be filled out with available BOM filters) -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
<table class='table table-striped table-condensed' id='part-table' data-toolbar='#button-toolbar'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
{% block js_ready %}
|
|
||||||
{{ block.super }}
|
|
||||||
|
|
||||||
$("#manufacturer-part-create").click(function () {
|
|
||||||
|
|
||||||
constructForm('{% url "api-manufacturer-part-list" %}', {
|
|
||||||
fields: {
|
|
||||||
part: {},
|
|
||||||
manufacturer: {
|
|
||||||
value: {{ company.pk }},
|
|
||||||
},
|
|
||||||
MPN: {
|
|
||||||
icon: 'fa-hashtag',
|
|
||||||
},
|
|
||||||
description: {},
|
|
||||||
link: {
|
|
||||||
icon: 'fa-link',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
method: 'POST',
|
|
||||||
title: '{% trans "Add Manufacturer Part" %}',
|
|
||||||
onSuccess: function() {
|
|
||||||
$("#part-table").bootstrapTable("refresh");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
loadManufacturerPartTable(
|
|
||||||
"#part-table",
|
|
||||||
"{% url 'api-manufacturer-part-list' %}",
|
|
||||||
{
|
|
||||||
params: {
|
|
||||||
part_detail: true,
|
|
||||||
manufacturer_detail: true,
|
|
||||||
manufacturer: {{ company.id }},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
linkButtonsToSelection($("#manufacturer-table"), ['#table-options']);
|
|
||||||
|
|
||||||
$("#multi-part-delete").click(function() {
|
|
||||||
var selections = $("#part-table").bootstrapTable("getSelections");
|
|
||||||
|
|
||||||
deleteManufacturerParts(selections, {
|
|
||||||
onSuccess: function() {
|
|
||||||
$("#part-table").bootstrapTable("refresh");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#multi-part-order").click(function() {
|
|
||||||
var selections = $("#part-table").bootstrapTable("getSelections");
|
|
||||||
|
|
||||||
var parts = [];
|
|
||||||
|
|
||||||
selections.forEach(function(item) {
|
|
||||||
parts.push(item.part);
|
|
||||||
});
|
|
||||||
|
|
||||||
launchModalForm("/order/purchase-order/order-parts/", {
|
|
||||||
data: {
|
|
||||||
parts: parts,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,49 +0,0 @@
|
|||||||
{% extends "company/company_base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block menubar %}
|
|
||||||
{% include "company/navbar.html" with tab='stock' %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block heading %}
|
|
||||||
{% trans "Supplier Stock" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block details %}
|
|
||||||
|
|
||||||
{% include "stock_table.html" %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
{% block js_ready %}
|
|
||||||
{{ block.super }}
|
|
||||||
|
|
||||||
loadStockTable($('#stock-table'), {
|
|
||||||
url: "{% url 'api-stock-list' %}",
|
|
||||||
params: {
|
|
||||||
company: {{ company.id }},
|
|
||||||
part_detail: true,
|
|
||||||
supplier_part_detail: true,
|
|
||||||
location_detail: true,
|
|
||||||
},
|
|
||||||
buttons: [
|
|
||||||
'#stock-options',
|
|
||||||
],
|
|
||||||
filterKey: "companystock",
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#stock-export").click(function() {
|
|
||||||
launchModalForm("{% url 'stock-export-options' %}", {
|
|
||||||
submit_text: '{% trans "Export" %}',
|
|
||||||
success: function(response) {
|
|
||||||
var url = "{% url 'stock-export' %}";
|
|
||||||
|
|
||||||
url += "?format=" + response.format;
|
|
||||||
url += "&supplier={{ company.id }}";
|
|
||||||
|
|
||||||
location.href = url;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,127 +0,0 @@
|
|||||||
{% extends "company/company_base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% load i18n %}
|
|
||||||
{% load inventree_extras %}
|
|
||||||
|
|
||||||
{% block menubar %}
|
|
||||||
{% include 'company/navbar.html' with tab='supplier_parts' %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block heading %}
|
|
||||||
{% trans "Supplier Parts" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block details %}
|
|
||||||
{% if roles.purchase_order.change %}
|
|
||||||
<div id='button-toolbar'>
|
|
||||||
<div class='button-toolbar container-fluid'>
|
|
||||||
<div class='btn-group' role='group'>
|
|
||||||
{% if roles.purchase_order.add %}
|
|
||||||
<button class="btn btn-success" id='supplier-part-create' title='{% trans "Create new supplier part" %}'>
|
|
||||||
<span class='fas fa-plus-circle'></span> {% trans "New Supplier Part" %}
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
<div class='btn-group'>
|
|
||||||
<div class="dropdown" style="float: right;">
|
|
||||||
<button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">{% trans "Options" %}
|
|
||||||
<span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
{% if roles.purchase_order.add %}
|
|
||||||
<li><a href='#' id='multi-part-order' title='{% trans "Order parts" %}'>{% trans "Order Parts" %}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% if roles.purchase_order.delete %}
|
|
||||||
<li><a href='#' id='multi-part-delete' title='{% trans "Delete parts" %}'>{% trans "Delete Parts" %}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class='filter-list' id='filter-list-supplier-part'>
|
|
||||||
<!-- Empty div (will be filled out with available BOM filters) -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='part-table' data-toolbar='#button-toolbar'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
{% block js_ready %}
|
|
||||||
{{ block.super }}
|
|
||||||
|
|
||||||
$("#supplier-part-create").click(function () {
|
|
||||||
launchModalForm(
|
|
||||||
"{% url 'supplier-part-create' %}",
|
|
||||||
{
|
|
||||||
data: {
|
|
||||||
supplier: {{ company.id }},
|
|
||||||
},
|
|
||||||
reload: true,
|
|
||||||
secondary: [
|
|
||||||
{
|
|
||||||
field: 'part',
|
|
||||||
label: '{% trans "New Part" %}',
|
|
||||||
title: '{% trans "Create new Part" %}',
|
|
||||||
url: "{% url 'part-create' %}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'supplier',
|
|
||||||
label: "{% trans 'New Supplier' %}",
|
|
||||||
title: "{% trans 'Create new Supplier' %}",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
loadSupplierPartTable(
|
|
||||||
"#part-table",
|
|
||||||
"{% url 'api-supplier-part-list' %}",
|
|
||||||
{
|
|
||||||
params: {
|
|
||||||
part_detail: true,
|
|
||||||
supplier_detail: true,
|
|
||||||
manufacturer_detail: true,
|
|
||||||
supplier: {{ company.id }},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$("#multi-part-delete").click(function() {
|
|
||||||
var selections = $("#part-table").bootstrapTable("getSelections");
|
|
||||||
|
|
||||||
var parts = [];
|
|
||||||
|
|
||||||
selections.forEach(function(item) {
|
|
||||||
parts.push(item.pk);
|
|
||||||
});
|
|
||||||
|
|
||||||
var url = "{% url 'supplier-part-delete' %}"
|
|
||||||
|
|
||||||
launchModalForm(url, {
|
|
||||||
data: {
|
|
||||||
parts: parts,
|
|
||||||
},
|
|
||||||
reload: true,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#multi-part-order").click(function() {
|
|
||||||
var selections = $("#part-table").bootstrapTable("getSelections");
|
|
||||||
|
|
||||||
var parts = [];
|
|
||||||
|
|
||||||
selections.forEach(function(item) {
|
|
||||||
parts.push(item.part);
|
|
||||||
});
|
|
||||||
|
|
||||||
launchModalForm("/order/purchase-order/order-parts/", {
|
|
||||||
data: {
|
|
||||||
parts: parts,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -9,16 +9,9 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class='list-group-item {% if tab == "details" %}active{% endif %}' title='{% trans "Company Details" %}'>
|
|
||||||
<a href='{% url "company-detail" company.id %}'>
|
|
||||||
<span class='fas fa-info-circle sidebar-icon'></span>
|
|
||||||
{% trans "Details" %}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
{% if company.is_manufacturer %}
|
{% if company.is_manufacturer %}
|
||||||
<li class='list-group-item {% if tab == "manufacturer_parts" %}active{% endif %}' title='{% trans "Manufactured Parts" %}'>
|
<li class='list-group-item' title='{% trans "Manufactured Parts" %}'>
|
||||||
<a href='{% url "company-detail-manufacturer-parts" company.id %}'>
|
<a href='#' id='select-manufacturer-parts' class='nav-toggle'>
|
||||||
<span class='fas fa-industry sidebar-icon'></span>
|
<span class='fas fa-industry sidebar-icon'></span>
|
||||||
{% trans "Manufactured Parts" %}
|
{% trans "Manufactured Parts" %}
|
||||||
</a>
|
</a>
|
||||||
@ -26,8 +19,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if company.is_supplier or company.is_manufacturer %}
|
{% if company.is_supplier or company.is_manufacturer %}
|
||||||
<li class='list-group-item {% if tab == "supplier_parts" %}active{% endif %}' title='{% trans "Supplied Parts" %}'>
|
<li class='list-group-item' title='{% trans "Supplied Parts" %}'>
|
||||||
<a href='{% url "company-detail-supplier-parts" company.id %}'>
|
<a href='#' id='select-supplier-parts' class='nav-toggle'>
|
||||||
<span class='fas fa-building sidebar-icon'></span>
|
<span class='fas fa-building sidebar-icon'></span>
|
||||||
{% trans "Supplied Parts" %}
|
{% trans "Supplied Parts" %}
|
||||||
</a>
|
</a>
|
||||||
@ -35,8 +28,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if company.is_manufacturer or company.is_supplier %}
|
{% if company.is_manufacturer or company.is_supplier %}
|
||||||
<li class='list-group-item {% if tab == "stock" %}active{% endif %}' title='{% trans "Stock Items" %}'>
|
<li class='list-group-item' title='{% trans "Stock Items" %}'>
|
||||||
<a href='{% url "company-detail-stock" company.id %}'>
|
<a href='#' id='select-company-stock' class='nav-toggle'>
|
||||||
<span class='fas fa-boxes sidebar-icon'></span>
|
<span class='fas fa-boxes sidebar-icon'></span>
|
||||||
{% trans "Stock" %}
|
{% trans "Stock" %}
|
||||||
</a>
|
</a>
|
||||||
@ -44,8 +37,8 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if company.is_supplier %}
|
{% if company.is_supplier %}
|
||||||
<li class='list-group-item {% if tab == "po" %}active{% endif %}' title='{% trans "Sales Orders" %}'>
|
<li class='list-group-item' title='{% trans "Purchase Orders" %}'>
|
||||||
<a href='{% url "company-detail-purchase-orders" company.id %}'>
|
<a href='#' id='select-purchase-orders' class='nav-toggle'>
|
||||||
<span class='fas fa-shopping-cart sidebar-icon'></span>
|
<span class='fas fa-shopping-cart sidebar-icon'></span>
|
||||||
{% trans "Purchase Orders" %}
|
{% trans "Purchase Orders" %}
|
||||||
</a>
|
</a>
|
||||||
@ -53,22 +46,22 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if company.is_customer %}
|
{% if company.is_customer %}
|
||||||
<li class='list-group-item {% if tab == "so" %}active{% endif %}' title='{% trans "Sales Orders" %}'>
|
<li class='list-group-item' title='{% trans "Sales Orders" %}'>
|
||||||
<a href='{% url "company-detail-sales-orders" company.id %}'>
|
<a href='#' id='select-sales-orders' class='nav-toggle'>
|
||||||
<span class='fas fa-truck sidebar-icon'></span>
|
<span class='fas fa-truck sidebar-icon'></span>
|
||||||
{% trans "Sales Orders" %}
|
{% trans "Sales Orders" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class='list-group-item {% if tab == "assigned" %}active{% endif %}' title='{% trans "Assigned Stock" %}'>
|
<li class='list-group-item' title='{% trans "Assigned Stock" %}'>
|
||||||
<a href='{% url "company-detail-assigned-stock" company.id %}'>
|
<a href='#' id='select-assigned-stock' class='nav-toggle'>
|
||||||
<span class='fas fa-sign-out-alt sidebar-icon'></span>
|
<span class='fas fa-sign-out-alt sidebar-icon'></span>
|
||||||
{% trans "Assigned Stock" %}
|
{% trans "Assigned Stock" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li class='list-group-item {% if tab == "notes" %}active{% endif %}' titl='{% trans "Notes" %}'>
|
<li class='list-group-item' title='{% trans "Notes" %}'>
|
||||||
<a href='{% url "company-notes" company.id %}'>
|
<a href='#' id='select-company-notes' class='nav-toggle'>
|
||||||
<span class='fas fa-clipboard sidebar-icon'></span>
|
<span class='fas fa-clipboard sidebar-icon'></span>
|
||||||
{% trans "Notes" %}
|
{% trans "Notes" %}
|
||||||
</a>
|
</a>
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
{% extends "company/company_base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% load i18n %}
|
|
||||||
{% load markdownify %}
|
|
||||||
|
|
||||||
{% block menubar %}
|
|
||||||
{% include 'company/navbar.html' with tab='notes' %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block heading %}
|
|
||||||
{% trans "Company Notes" %}
|
|
||||||
{% if not editing %}
|
|
||||||
<button title='{% trans "Edit notes" %}' class='btn btn-default' id='edit-notes'><span class='fas fa-edit'></span></button>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block details %}
|
|
||||||
{% if editing %}
|
|
||||||
<form method='POST'>
|
|
||||||
{% csrf_token %}
|
|
||||||
|
|
||||||
{{ form }}
|
|
||||||
<hr>
|
|
||||||
<button type="submit" class='btn btn-default'>{% trans "Save" %}</button>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{{ form.media }}
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
{{ company.notes | markdownify }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js_ready %}
|
|
||||||
{{ block.super }}
|
|
||||||
|
|
||||||
{% if editing %}
|
|
||||||
{% else %}
|
|
||||||
$("#edit-notes").click(function() {
|
|
||||||
location.href = "{% url 'company-notes' company.id %}?edit=1";
|
|
||||||
});
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,56 +0,0 @@
|
|||||||
{% extends "company/company_base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block menubar %}
|
|
||||||
{% include 'company/navbar.html' with tab='po' %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block heading %}
|
|
||||||
{% trans "Purchase Orders" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block details %}
|
|
||||||
|
|
||||||
{% if roles.purchase_order.add %}
|
|
||||||
<div id='button-bar'>
|
|
||||||
<div class='button-toolbar container-fluid' style='float: right;'>
|
|
||||||
<button class='btn btn-primary' type='button' id='company-order2' title='{% trans "Create new purchase order" %}'>
|
|
||||||
<span class='fas fa-plus-circle'></span> {% trans "New Purchase Order" %}</button>
|
|
||||||
<div class='filter-list' id='filter-list-purchaseorder'>
|
|
||||||
<!-- Empty div -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed po-table' id='purchase-order-table' data-toolbar='#button-bar'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js_ready %}
|
|
||||||
{{ block.super }}
|
|
||||||
|
|
||||||
loadPurchaseOrderTable("#purchase-order-table", {
|
|
||||||
url: "{% url 'api-po-list' %}",
|
|
||||||
params: {
|
|
||||||
supplier: {{ company.id }},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function newOrder() {
|
|
||||||
createPurchaseOrder({
|
|
||||||
supplier: {{ company.pk }},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#company-order").click(function() {
|
|
||||||
newOrder();
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#company-order2").click(function() {
|
|
||||||
newOrder();
|
|
||||||
});
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,51 +0,0 @@
|
|||||||
{% extends "company/company_base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block menubar %}
|
|
||||||
{% include 'company/navbar.html' with tab='so' %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block heading %}
|
|
||||||
{% trans "Sales Orders" %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block details %}
|
|
||||||
|
|
||||||
{% if roles.sales_order.add %}
|
|
||||||
<div id='button-bar'>
|
|
||||||
<div class='button-toolbar container-fluid' style='float: right;'>
|
|
||||||
<button class='btn btn-primary' type='button' id='new-sales-order' title='{% trans "Create new sales order" %}'>
|
|
||||||
<div class='fas fa-plus-circle'></div> {% trans "New Sales Order" %}
|
|
||||||
</button>
|
|
||||||
<div class='filter-list' id='filter-list-salesorder'>
|
|
||||||
<!-- Empty div -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed po-table' id='sales-order-table' data-toolbar='#button-bar'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js_ready %}
|
|
||||||
{{ block.super }}
|
|
||||||
|
|
||||||
loadSalesOrderTable("#sales-order-table", {
|
|
||||||
url: "{% url 'api-so-list' %}",
|
|
||||||
params: {
|
|
||||||
customer: {{ company.id }},
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#new-sales-order").click(function() {
|
|
||||||
|
|
||||||
createSalesOrder({
|
|
||||||
customer: {{ company.pk }},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -8,15 +8,6 @@ from . import views
|
|||||||
|
|
||||||
|
|
||||||
company_detail_urls = [
|
company_detail_urls = [
|
||||||
# url(r'orders/?', views.CompanyDetail.as_view(template_name='company/orders.html'), name='company-detail-orders'),
|
|
||||||
|
|
||||||
url(r'^supplier-parts/', views.CompanyDetail.as_view(template_name='company/detail_supplier_part.html'), name='company-detail-supplier-parts'),
|
|
||||||
url(r'^manufacturer-parts/', views.CompanyDetail.as_view(template_name='company/detail_manufacturer_part.html'), name='company-detail-manufacturer-parts'),
|
|
||||||
url(r'^stock/', views.CompanyDetail.as_view(template_name='company/detail_stock.html'), name='company-detail-stock'),
|
|
||||||
url(r'^purchase-orders/', views.CompanyDetail.as_view(template_name='company/purchase_orders.html'), name='company-detail-purchase-orders'),
|
|
||||||
url(r'^assigned-stock/', views.CompanyDetail.as_view(template_name='company/assigned_stock.html'), name='company-detail-assigned-stock'),
|
|
||||||
url(r'^sales-orders/', views.CompanyDetail.as_view(template_name='company/sales_orders.html'), name='company-detail-sales-orders'),
|
|
||||||
url(r'^notes/', views.CompanyNotes.as_view(), name='company-notes'),
|
|
||||||
|
|
||||||
url(r'^thumb-download/', views.CompanyImageDownloadFromURL.as_view(), name='company-image-download'),
|
url(r'^thumb-download/', views.CompanyImageDownloadFromURL.as_view(), name='company-image-download'),
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ Django views for interacting with Company app
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.views.generic import DetailView, ListView, UpdateView
|
from django.views.generic import DetailView, ListView
|
||||||
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.forms import HiddenInput
|
from django.forms import HiddenInput
|
||||||
@ -113,28 +113,6 @@ class CompanyIndex(InvenTreeRoleMixin, ListView):
|
|||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
class CompanyNotes(UpdateView):
|
|
||||||
""" View for editing the 'notes' field of a Company object.
|
|
||||||
"""
|
|
||||||
|
|
||||||
context_object_name = 'company'
|
|
||||||
template_name = 'company/notes.html'
|
|
||||||
model = Company
|
|
||||||
fields = ['notes']
|
|
||||||
permission_required = 'company.view_company'
|
|
||||||
|
|
||||||
def get_success_url(self):
|
|
||||||
return reverse('company-notes', kwargs={'pk': self.get_object().id})
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
|
|
||||||
ctx = super().get_context_data(**kwargs)
|
|
||||||
|
|
||||||
ctx['editing'] = str2bool(self.request.GET.get('edit', ''))
|
|
||||||
|
|
||||||
return ctx
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyDetail(DetailView):
|
class CompanyDetail(DetailView):
|
||||||
""" Detail view for Company object """
|
""" Detail view for Company object """
|
||||||
context_obect_name = 'company'
|
context_obect_name = 'company'
|
||||||
|
@ -36,15 +36,38 @@ function activatePanel(panelName, options={}) {
|
|||||||
|
|
||||||
var panelClass = options.name || 'unknown';
|
var panelClass = options.name || 'unknown';
|
||||||
|
|
||||||
// Save the selected panel
|
|
||||||
localStorage.setItem(`inventree-selected-panel-${panelClass}`, panelName);
|
|
||||||
|
|
||||||
// First, cause any other panels to "fade out"
|
// First, cause any other panels to "fade out"
|
||||||
$('.panel-visible').hide();
|
$('.panel-visible').hide();
|
||||||
$('.panel-visible').removeClass('panel-visible');
|
$('.panel-visible').removeClass('panel-visible');
|
||||||
|
|
||||||
// Find the target panel
|
// Find the target panel
|
||||||
var panel = `#panel-${panelName}`;
|
var panel = `#panel-${panelName}`;
|
||||||
|
var select = `#select-${panelName}`;
|
||||||
|
|
||||||
|
// Check that the selected panel (and select) exist
|
||||||
|
if ($(panel).length && $(select).length) {
|
||||||
|
// Yep, both are displayed
|
||||||
|
} else {
|
||||||
|
// Either the select or the panel are not displayed!
|
||||||
|
// Iterate through the available 'select' elements until one matches
|
||||||
|
panelName = null;
|
||||||
|
|
||||||
|
console.log("no match for panel:", panelName);
|
||||||
|
|
||||||
|
$('.nav-toggle').each(function(item) {
|
||||||
|
var panel_name = $(this).attr('id').replace('select-', '');
|
||||||
|
|
||||||
|
console.log("checking:", panel_name);
|
||||||
|
|
||||||
|
if ($(`#panel-${panel_name}`).length && (panelName == null)) {
|
||||||
|
console.log("found match -", panel_name);
|
||||||
|
panelName = panel_name;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the selected panel
|
||||||
|
localStorage.setItem(`inventree-selected-panel-${panelClass}`, panelName);
|
||||||
|
|
||||||
// Display the panel
|
// Display the panel
|
||||||
$(panel).addClass('panel-visible');
|
$(panel).addClass('panel-visible');
|
||||||
|
Loading…
Reference in New Issue
Block a user