mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1333 from SchrodingersGat/cleaner-homepage
Cleaner homepage
This commit is contained in:
commit
d426e376c4
@ -50,6 +50,16 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.index-bg {
|
||||||
|
width: 100%;
|
||||||
|
object-fit: fill;
|
||||||
|
opacity: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.index-action-selected {
|
||||||
|
background-color: #EEEEF5;
|
||||||
|
}
|
||||||
|
|
||||||
.markdownx .row {
|
.markdownx .row {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
@ -487,6 +497,14 @@
|
|||||||
background-color: #f33;
|
background-color: #f33;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.badge-orange {
|
||||||
|
background-color: #fcba03;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-green {
|
||||||
|
background-color: #1A1;
|
||||||
|
}
|
||||||
|
|
||||||
.part-thumb {
|
.part-thumb {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
|
@ -184,6 +184,8 @@ class SupplierPartList(generics.ListCreateAPIView):
|
|||||||
'manufacturer__name',
|
'manufacturer__name',
|
||||||
'description',
|
'description',
|
||||||
'MPN',
|
'MPN',
|
||||||
|
'part__name',
|
||||||
|
'part__description',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-times-circle icon-header'></span>
|
|
||||||
{% trans "BOM Waiting Validation" %}<span class='badge' id='bom-invalid-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='bom-invalid-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-calendar-times icon-header'></span>
|
|
||||||
{% trans "Overdue Builds" %}<span class='badge' id='build-overdue-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='build-overdue-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-cogs icon-header'></span>
|
|
||||||
{% trans "Pending Builds" %}<span class='badge' id='build-pending-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='build-pending-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-calendar-times icon-header'></span>
|
|
||||||
{% trans "Expired Stock" %}<span class='badge' id='expired-stock-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='expired-stock-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,5 +1,6 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
{% load static %}
|
||||||
{% load inventree_extras %}
|
{% load inventree_extras %}
|
||||||
{% block page_title %}
|
{% block page_title %}
|
||||||
InvenTree | {% trans "Index" %}
|
InvenTree | {% trans "Index" %}
|
||||||
@ -9,50 +10,96 @@ InvenTree | {% trans "Index" %}
|
|||||||
<h3>InvenTree</h3>
|
<h3>InvenTree</h3>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class='col-sm-4'>
|
<div class='col-sm-3' id='item-panel'>
|
||||||
{% if roles.part.view %}
|
<ul class='list-group' id='action-item-list'>
|
||||||
{% include "InvenTree/latest_parts.html" with collapse_id="latest_parts" %}
|
</ul>
|
||||||
{% include "InvenTree/bom_invalid.html" with collapse_id="bom_invalid" %}
|
|
||||||
{% include "InvenTree/starred_parts.html" with collapse_id="starred" %}
|
|
||||||
{% endif %}
|
|
||||||
{% if roles.build.view %}
|
|
||||||
{% include "InvenTree/build_pending.html" with collapse_id="build_pending" %}
|
|
||||||
{% include "InvenTree/build_overdue.html" with collapse_id="build_overdue" %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
<div class='col-sm-4'>
|
<div class='col-sm-9' id='details-panel'>
|
||||||
{% if roles.stock.view %}
|
<ul class='list-group' id='detail-item-list'>
|
||||||
{% include "InvenTree/low_stock.html" with collapse_id="order" %}
|
<li class='list-group-item'>
|
||||||
{% settings_value "STOCK_ENABLE_EXPIRY" as expiry %}
|
<div class='container'>
|
||||||
{% if expiry %}
|
<img class='index-bg' src='{% static "img/inventree.png" %}'>
|
||||||
{% include "InvenTree/expired_stock.html" with collapse_id="expired" %}
|
|
||||||
{% include "InvenTree/stale_stock.html" with collapse_id="stale" %}
|
|
||||||
{% endif %}
|
|
||||||
{% include "InvenTree/required_stock_build.html" with collapse_id="stock_to_build" %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
<div class='col-sm-4'>
|
</li>
|
||||||
{% if roles.purchase_order.view %}
|
</ul>
|
||||||
{% include "InvenTree/po_outstanding.html" with collapse_id="po_outstanding" %}
|
|
||||||
{% endif %}
|
|
||||||
{% include "InvenTree/po_overdue.html" with collapse_id="po_overdue" %}
|
|
||||||
{% if roles.sales_order.view %}
|
|
||||||
{% include "InvenTree/so_outstanding.html" with collapse_id="so_outstanding" %}
|
|
||||||
{% include "InvenTree/so_overdue.html" with collapse_id="so_overdue" %}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js_load %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block js_ready %}
|
{% block js_ready %}
|
||||||
|
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
loadSimplePartTable("#latest-parts-table", "{% url 'api-part-list' %}", {
|
function addHeaderTitle(title) {
|
||||||
|
// Add a header block to the action list
|
||||||
|
$("#action-item-list").append(
|
||||||
|
`<li class='list-group-item'><b>${title}</b></li>`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addHeaderAction(label, title, icon, options) {
|
||||||
|
// Add an action block to the action list
|
||||||
|
$("#action-item-list").append(
|
||||||
|
`<li class='list-group-item' id='action-${label}'>
|
||||||
|
<a href='#'>
|
||||||
|
<span class='fas ${icon}'></span>
|
||||||
|
${title}
|
||||||
|
</a>
|
||||||
|
<span class='badge' id='badge-${label}'>
|
||||||
|
<span class='fas fa-spin fa-spinner'></span>
|
||||||
|
</span>
|
||||||
|
</li>`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add a detail item to the detail item-panel
|
||||||
|
$("#detail-item-list").append(
|
||||||
|
`<li class='list-group-item' id='detail-${label}'>
|
||||||
|
<h4>${title}</h4>
|
||||||
|
<table class='table table-condensed table-striped' id='table-${label}'></table>
|
||||||
|
</li>`
|
||||||
|
);
|
||||||
|
|
||||||
|
$(`#detail-${label}`).hide();
|
||||||
|
|
||||||
|
$(`#action-${label}`).click(function() {
|
||||||
|
|
||||||
|
// Hide all child elements
|
||||||
|
$('#detail-item-list').children('li').each(function() {
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Show the one we want
|
||||||
|
$(`#detail-${label}`).fadeIn();
|
||||||
|
|
||||||
|
// Remove css class from all action items
|
||||||
|
$("#action-item-list").children('li').each(function() {
|
||||||
|
$(this).removeClass('index-action-selected');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add css class to the action we are interested in
|
||||||
|
$(`#action-${label}`).addClass('index-action-selected');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Connect a callback to the table
|
||||||
|
$(`#table-${label}`).on('load-success.bs.table', function() {
|
||||||
|
var count = $(`#table-${label}`).bootstrapTable('getData').length;
|
||||||
|
|
||||||
|
$(`#badge-${label}`).html(count);
|
||||||
|
|
||||||
|
if (count > 0) {
|
||||||
|
$(`#badge-${label}`).addClass('badge-orange');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
{% if roles.part.view %}
|
||||||
|
addHeaderTitle('{% trans "Parts" %}');
|
||||||
|
addHeaderAction('starred-parts', '{% trans "Starred Parts" %}', 'fa-star');
|
||||||
|
addHeaderAction('latest-parts', '{% trans "Latest Parts" %}', 'fa-newspaper');
|
||||||
|
addHeaderAction('bom-validation', '{% trans "BOM Waiting Validation" %}', 'fa-times-circle');
|
||||||
|
|
||||||
|
|
||||||
|
loadSimplePartTable("#table-latest-parts", "{% url 'api-part-list' %}", {
|
||||||
params: {
|
params: {
|
||||||
ordering: "-creation_date",
|
ordering: "-creation_date",
|
||||||
limit: 10,
|
limit: 10,
|
||||||
@ -60,21 +107,71 @@ loadSimplePartTable("#latest-parts-table", "{% url 'api-part-list' %}", {
|
|||||||
name: 'latest_parts',
|
name: 'latest_parts',
|
||||||
});
|
});
|
||||||
|
|
||||||
loadSimplePartTable("#starred-parts-table", "{% url 'api-part-list' %}", {
|
loadSimplePartTable("#table-starred-parts", "{% url 'api-part-list' %}", {
|
||||||
params: {
|
params: {
|
||||||
"starred": true,
|
"starred": true,
|
||||||
},
|
},
|
||||||
name: 'starred_parts',
|
name: 'starred_parts',
|
||||||
});
|
});
|
||||||
|
|
||||||
loadSimplePartTable("#bom-invalid-table", "{% url 'api-part-list' %}", {
|
loadSimplePartTable("#table-bom-validation", "{% url 'api-part-list' %}", {
|
||||||
params: {
|
params: {
|
||||||
"bom_valid": false,
|
"bom_valid": false,
|
||||||
},
|
},
|
||||||
name: 'bom_invalid_parts',
|
name: 'bom_invalid_parts',
|
||||||
});
|
});
|
||||||
|
|
||||||
loadBuildTable("#build-pending-table", {
|
{% endif %}
|
||||||
|
|
||||||
|
{% if roles.stock.view %}
|
||||||
|
addHeaderTitle('{% trans "Stock" %}');
|
||||||
|
addHeaderAction('low-stock', '{% trans "Low Stock" %}', 'fa-shopping-cart');
|
||||||
|
addHeaderAction('stock-to-build', '{% trans "Required for Build Orders" %}', 'fa-bullhorn');
|
||||||
|
{% settings_value "STOCK_ENABLE_EXPIRY" as expiry %}
|
||||||
|
{% if expiry %}
|
||||||
|
addHeaderAction('expired-stock', '{% trans "Expired Stock" %}', 'fa-calendar-times');
|
||||||
|
addHeaderAction('stale-stock', '{% trans "Stale Stock" %}', 'fa-stopwatch');
|
||||||
|
|
||||||
|
loadStockTable($("#table-expired-stock"), {
|
||||||
|
params: {
|
||||||
|
expired: true,
|
||||||
|
location_detail: true,
|
||||||
|
part_detail: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
loadStockTable($("#table-stale-stock"), {
|
||||||
|
params: {
|
||||||
|
stale: true,
|
||||||
|
expired: false,
|
||||||
|
location_detail: true,
|
||||||
|
part_detail: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
loadSimplePartTable("#table-low-stock", "{% url 'api-part-list' %}", {
|
||||||
|
params: {
|
||||||
|
low_stock: true,
|
||||||
|
},
|
||||||
|
name: "low_stock_parts",
|
||||||
|
});
|
||||||
|
|
||||||
|
loadSimplePartTable("#table-stock-to-build", "{% url 'api-part-list' %}", {
|
||||||
|
params: {
|
||||||
|
stock_to_build: true,
|
||||||
|
},
|
||||||
|
name: "to_build_parts",
|
||||||
|
});
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if roles.build.view %}
|
||||||
|
addHeaderTitle('{% trans "Build Orders" %}');
|
||||||
|
addHeaderAction('build-pending', '{% trans "Build Orders In Progress" %}', 'fa-cogs');
|
||||||
|
addHeaderAction('build-overdue', '{% trans "Overdue Build Orders" %}', 'fa-calendar-times');
|
||||||
|
|
||||||
|
loadBuildTable("#table-build-pending", {
|
||||||
url: "{% url 'api-build-list' %}",
|
url: "{% url 'api-build-list' %}",
|
||||||
params: {
|
params: {
|
||||||
part_detail: true,
|
part_detail: true,
|
||||||
@ -83,7 +180,7 @@ loadBuildTable("#build-pending-table", {
|
|||||||
disableFilters: true,
|
disableFilters: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
loadBuildTable("#build-overdue-table", {
|
loadBuildTable("#table-build-overdue", {
|
||||||
url: "{% url 'api-build-list' %}",
|
url: "{% url 'api-build-list' %}",
|
||||||
params: {
|
params: {
|
||||||
part_detail: true,
|
part_detail: true,
|
||||||
@ -91,39 +188,14 @@ loadBuildTable("#build-overdue-table", {
|
|||||||
},
|
},
|
||||||
disableFilters: true,
|
disableFilters: true,
|
||||||
});
|
});
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
loadStockTable($("#expired-stock-table"), {
|
{% if roles.purchase_order.view %}
|
||||||
params: {
|
addHeaderTitle('{% trans "Purchase Orders" %}');
|
||||||
expired: true,
|
addHeaderAction('po-outstanding', '{% trans "Outstanding Purchase Orders" %}', 'fa-sign-in-alt');
|
||||||
location_detail: true,
|
addHeaderAction('po-overdue', '{% trans "Overdue Purchase Orders" %}', 'fa-calendar-times');
|
||||||
part_detail: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
loadStockTable($("#stale-stock-table"), {
|
loadPurchaseOrderTable("#table-po-outstanding", {
|
||||||
params: {
|
|
||||||
stale: true,
|
|
||||||
expired: false,
|
|
||||||
location_detail: true,
|
|
||||||
part_detail: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
loadSimplePartTable("#low-stock-table", "{% url 'api-part-list' %}", {
|
|
||||||
params: {
|
|
||||||
low_stock: true,
|
|
||||||
},
|
|
||||||
name: "low_stock_parts",
|
|
||||||
});
|
|
||||||
|
|
||||||
loadSimplePartTable("#stock-to-build-table", "{% url 'api-part-list' %}", {
|
|
||||||
params: {
|
|
||||||
stock_to_build: true,
|
|
||||||
},
|
|
||||||
name: "to_build_parts",
|
|
||||||
});
|
|
||||||
|
|
||||||
loadPurchaseOrderTable("#po-outstanding-table", {
|
|
||||||
url: "{% url 'api-po-list' %}",
|
url: "{% url 'api-po-list' %}",
|
||||||
params: {
|
params: {
|
||||||
supplier_detail: true,
|
supplier_detail: true,
|
||||||
@ -131,7 +203,7 @@ loadPurchaseOrderTable("#po-outstanding-table", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
loadPurchaseOrderTable("#po-overdue-table", {
|
loadPurchaseOrderTable("#table-po-overdue", {
|
||||||
url: "{% url 'api-po-list' %}",
|
url: "{% url 'api-po-list' %}",
|
||||||
params: {
|
params: {
|
||||||
supplier_detail: true,
|
supplier_detail: true,
|
||||||
@ -139,7 +211,14 @@ loadPurchaseOrderTable("#po-overdue-table", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
loadSalesOrderTable("#so-outstanding-table", {
|
{% endif %}
|
||||||
|
|
||||||
|
{% if roles.sales_order.view %}
|
||||||
|
addHeaderTitle('{% trans "Sales Orders" %}');
|
||||||
|
addHeaderAction('so-outstanding', '{% trans "Outstanding Sales Orders" %}', 'fa-sign-out-alt');
|
||||||
|
addHeaderAction('so-overdue', '{% trans "Overdue Sales Orders" %}', 'fa-calendar-times');
|
||||||
|
|
||||||
|
loadSalesOrderTable("#table-so-outstanding", {
|
||||||
url: "{% url 'api-so-list' %}",
|
url: "{% url 'api-so-list' %}",
|
||||||
params: {
|
params: {
|
||||||
customer_detail: true,
|
customer_detail: true,
|
||||||
@ -147,7 +226,7 @@ loadSalesOrderTable("#so-outstanding-table", {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
loadSalesOrderTable("#so-overdue-table", {
|
loadSalesOrderTable("#table-so-overdue", {
|
||||||
url: "{% url 'api-so-list' %}",
|
url: "{% url 'api-so-list' %}",
|
||||||
params: {
|
params: {
|
||||||
overdue: true,
|
overdue: true,
|
||||||
@ -155,20 +234,6 @@ loadSalesOrderTable("#so-overdue-table", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="latest-parts" %}
|
{% endif %}
|
||||||
{% include "InvenTree/index/on_load.html" with label="starred-parts" %}
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="bom-invalid" %}
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="build-pending" %}
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="build-overdue" %}
|
|
||||||
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="expired-stock" %}
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="stale-stock" %}
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="low-stock" %}
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="stock-to-build" %}
|
|
||||||
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="po-outstanding" %}
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="po-overdue" %}
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="so-outstanding" %}
|
|
||||||
{% include "InvenTree/index/on_load.html" with label="so-overdue" %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,5 +0,0 @@
|
|||||||
$("#{{ label }}-table").on('load-success.bs.table', function() {
|
|
||||||
var count = $("#{{ label }}-table").bootstrapTable('getData').length;
|
|
||||||
|
|
||||||
$("#{{ label }}-count").html(count);
|
|
||||||
});
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-newspaper icon-header'></span>
|
|
||||||
{% trans "Latest Parts" %}<span class='badge' id='latest-parts-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='latest-parts-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-shopping-cart icon-header'></span>
|
|
||||||
{% trans "Low Stock" %}<span class='badge' id='low-stock-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='low-stock-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-sign-in-alt icon-header'></span>
|
|
||||||
{% trans "Outstanding Purchase Orders" %}<span class='badge' id='po-outstanding-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='po-outstanding-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-calendar-times icon-header'></span>
|
|
||||||
{% trans "Overdue Purchase Orders" %}<span class='badge' id='po-overdue-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='po-overdue-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-bullhorn icon-header'></span>
|
|
||||||
{% trans "Require Stock To Complete Build" %}<span class='badge' id='stock-to-build-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='stock-to-build-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -9,98 +9,123 @@ InvenTree | {% trans "Search Results" %}
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h3>{% trans "Search Results" %}</h3>
|
<h3>
|
||||||
|
{% trans "Search Results" %}
|
||||||
|
</h3>
|
||||||
|
|
||||||
<div>
|
<div class="container" style='width: 100%'>
|
||||||
{% include "search_form.html" with query_text=query %}
|
{% include "search_form.html" with query_text=query %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br><br>
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
{% if query %}
|
{% if query %}
|
||||||
|
|
||||||
<div id='no-search-results'>
|
|
||||||
<h4><i>{% trans "No results found for " %}'{{ query }}'</i></h4>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% include "InvenTree/search_part_category.html" with collapse_id="categories" %}
|
|
||||||
|
|
||||||
{% include "InvenTree/search_parts.html" with collapse_id='parts' %}
|
|
||||||
|
|
||||||
{% include "InvenTree/search_company.html" with collapse_id='companies' %}
|
|
||||||
|
|
||||||
{% include "InvenTree/search_supplier_parts.html" with collapse_id='supplier_parts' %}
|
|
||||||
|
|
||||||
{% include "InvenTree/search_stock_location.html" with collapse_id="locations" %}
|
|
||||||
|
|
||||||
{% include "InvenTree/search_stock_items.html" with collapse_id="stock" %}
|
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<div id='empty-search-query'>
|
<div id='empty-search-query'>
|
||||||
<h4><i>{% trans "Enter a search query" %}</i></h4>
|
<h4><i>{% trans "Enter a search query" %}</i></h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
<div class='col-sm-3' id='item-panel'>
|
||||||
|
<ul class='list-group' id='search-item-list'>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class='col-sm-9' id='details-panel'>
|
||||||
|
<ul class='list-group' id='search-result-list'>
|
||||||
|
<li class='list-group-item'>
|
||||||
|
<div class='container'>
|
||||||
|
<img class='index-bg' src='{% static "img/inventree.png" %}'>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% block js_load %}
|
|
||||||
{{ block.super }}
|
|
||||||
<script type='text/javascript' src="{% static 'script/inventree/part.js' %}"></script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block js_ready %}
|
{% block js_ready %}
|
||||||
{{ block.super }}
|
{{ block.super }}
|
||||||
|
|
||||||
function onSearchResults(table, output) {
|
function addItemTitle(title) {
|
||||||
|
// Add header block to the results list
|
||||||
$(table).on('load-success.bs.table', function() {
|
$('#search-item-list').append(
|
||||||
|
`<li class='list-group-item'><b>${title}</b></li>`
|
||||||
var panel = $(output).closest('.panel-group');
|
);
|
||||||
|
|
||||||
var n = $(table).bootstrapTable('getData').length;
|
|
||||||
|
|
||||||
var text = '';
|
|
||||||
if (n == 0) {
|
|
||||||
text = '<i>No results</i>'
|
|
||||||
|
|
||||||
$(panel).hide();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
text = n + ' result';
|
|
||||||
|
|
||||||
if (n > 1) {
|
|
||||||
text += 's';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(panel).show();
|
function addItem(label, title, icon, options) {
|
||||||
|
// Add a search itme to the action list
|
||||||
|
$('#search-item-list').append(
|
||||||
|
`<li class='list-group-item' id='search-item-${label}'>
|
||||||
|
<a href='#'>
|
||||||
|
<span class='fas ${icon}'></span>
|
||||||
|
${title}
|
||||||
|
</a>
|
||||||
|
<span class='badge' id='badge-${label}'>
|
||||||
|
<span class='fas fa-spin fa-spinner'></span>
|
||||||
|
</span>
|
||||||
|
</li>`
|
||||||
|
);
|
||||||
|
|
||||||
var collapse = panel.find('.panel-collapse');
|
// Add a results table
|
||||||
|
$('#search-result-list').append(
|
||||||
|
`<li class='list-group-item' id='search-result-${label}'>
|
||||||
|
<h4>${title}</h4>
|
||||||
|
<table class='table table-condensed table-striped' id='table-${label}'></table>
|
||||||
|
</li>`
|
||||||
|
);
|
||||||
|
|
||||||
collapse.collapse('show');
|
// Hide the results table
|
||||||
|
$(`#search-result-${label}`).hide();
|
||||||
|
|
||||||
$("#no-search-results").hide();
|
// Add callback when the action is clicked
|
||||||
|
$(`#search-item-${label}`).click(function() {
|
||||||
|
|
||||||
|
// Hide all childs
|
||||||
|
$('#search-result-list').children('li').each(function() {
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Show the one we want
|
||||||
|
$(`#search-result-${label}`).fadeIn();
|
||||||
|
|
||||||
|
// Remove css class from all action items
|
||||||
|
$("#search-item-list").children('li').each(function() {
|
||||||
|
$(this).removeClass('index-action-selected');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add css class to the action we are interested in
|
||||||
|
$(`#search-item-${label}`).addClass('index-action-selected');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Connect a callback to the table
|
||||||
|
$(`#table-${label}`).on('load-success.bs.table', function() {
|
||||||
|
var count = $(`#table-${label}`).bootstrapTable('getData').length;
|
||||||
|
|
||||||
|
$(`#badge-${label}`).html(count);
|
||||||
|
|
||||||
|
if (count > 0) {
|
||||||
|
$(`#badge-${label}`).addClass('badge-orange');
|
||||||
}
|
}
|
||||||
|
|
||||||
$(output).html(`<i>${text}</i>`);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchResults("#category-results-table", "#category-results-count");
|
{% if roles.part.view %}
|
||||||
|
addItemTitle('{% trans "Part" %}');
|
||||||
|
|
||||||
onSearchResults("#location-results-table", "#location-results-count");
|
addItem('part', '{% trans "Parts" %}', 'fa-shapes');
|
||||||
|
|
||||||
onSearchResults("#stock-results-table", "#stock-results-count");
|
loadPartTable("#table-part",
|
||||||
|
"{% url 'api-part-list' %}",
|
||||||
|
{
|
||||||
|
params: {
|
||||||
|
search: "{{ query }}",
|
||||||
|
},
|
||||||
|
checkbox: false,
|
||||||
|
disableFilters: true,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
onSearchResults('#part-results-table', '#part-result-count');
|
addItem('category', '{% trans "Part Categories" %}', 'fa-sitemap');
|
||||||
|
|
||||||
onSearchResults('#company-results-table', '#company-result-count');
|
$("#table-category").inventreeTable({
|
||||||
|
|
||||||
onSearchResults('#supplier-part-results-table', '#supplier-part-result-count');
|
|
||||||
|
|
||||||
$("#category-results-table").inventreeTable({
|
|
||||||
url: "{% url 'api-part-category-list' %}",
|
url: "{% url 'api-part-category-list' %}",
|
||||||
queryParams: {
|
queryParams: {
|
||||||
search: "{{ query }}",
|
search: "{{ query }}",
|
||||||
@ -120,7 +145,29 @@ InvenTree | {% trans "Search Results" %}
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#stock-results-table').inventreeTable({
|
addItem('supplier-part', '{% trans "Supplier Parts" %}', 'fa-pallet');
|
||||||
|
|
||||||
|
loadSupplierPartTable(
|
||||||
|
"#table-supplier-part",
|
||||||
|
"{% url 'api-supplier-part-list' %}",
|
||||||
|
{
|
||||||
|
params: {
|
||||||
|
search: "{{ query }}",
|
||||||
|
part_detail: true,
|
||||||
|
supplier_detail: true,
|
||||||
|
manufacturer_detail: true
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if roles.stock.view %}
|
||||||
|
addItemTitle('{% trans "Stock" %}');
|
||||||
|
|
||||||
|
addItem('stock', '{% trans "Stock Items" %}', 'fa-boxes');
|
||||||
|
|
||||||
|
$('#table-stock').inventreeTable({
|
||||||
url: "{% url 'api-stock-list' %}",
|
url: "{% url 'api-stock-list' %}",
|
||||||
queryParams: {
|
queryParams: {
|
||||||
search: "{{ query }}",
|
search: "{{ query }}",
|
||||||
@ -199,8 +246,9 @@ InvenTree | {% trans "Search Results" %}
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addItem('location', '{% trans "Stock Locations" %}', 'fa-map-marker-alt');
|
||||||
|
|
||||||
$("#location-results-table").inventreeTable({
|
$("#table-location").inventreeTable({
|
||||||
url: "{% url 'api-location-list' %}",
|
url: "{% url 'api-location-list' %}",
|
||||||
queryParams: {
|
queryParams: {
|
||||||
search: "{{ query }}",
|
search: "{{ query }}",
|
||||||
@ -220,36 +268,48 @@ InvenTree | {% trans "Search Results" %}
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
loadPartTable("#part-results-table",
|
{% if roles.purchase_order.view or roles.sales_order.view %}
|
||||||
"{% url 'api-part-list' %}",
|
addItemTitle('{% trans "Company" %}');
|
||||||
{
|
|
||||||
params: {
|
{% if roles.purchase_order.view %}
|
||||||
search: "{{ query }}",
|
addItem('supplier', '{% trans "Suppliers" %}', 'fa-building');
|
||||||
},
|
|
||||||
checkbox: false,
|
loadCompanyTable('#table-supplier', "{% url 'api-company-list' %}", {
|
||||||
disableFilters: true,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
loadCompanyTable('#company-results-table', "{% url 'api-company-list' %}", {
|
|
||||||
params: {
|
params: {
|
||||||
search: "{{ query }}",
|
search: "{{ query }}",
|
||||||
|
is_supplier: "true",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
loadSupplierPartTable(
|
addItem('manufacturer', '{% trans "Manufacturers" %}', 'fa-industry');
|
||||||
"#supplier-part-results-table",
|
|
||||||
"{% url 'api-supplier-part-list' %}",
|
loadCompanyTable('#table-manufacturer', "{% url 'api-company-list' %}", {
|
||||||
{
|
|
||||||
params: {
|
params: {
|
||||||
search: "{{ query }}",
|
search: "{{ query }}",
|
||||||
part_detail: true,
|
is_manufacturer: "true",
|
||||||
supplier_detail: true,
|
|
||||||
manufacturer_detail: true
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if roles.sales_order.view %}
|
||||||
|
addItem('customer', '{% trans "Customers" %}', 'fa-user-tie');
|
||||||
|
|
||||||
|
loadCompanyTable('#table-customer', "{% url 'api-company-list' %}", {
|
||||||
|
params: {
|
||||||
|
search: "{{ query }}",
|
||||||
|
is_customer: "true",
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,14 +0,0 @@
|
|||||||
{% extends "collapse.html" %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<h4>Companies</h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_heading %}
|
|
||||||
<h4><span id='company-result-count'>{% include "InvenTree/searching.html" %}</span></h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='company-results-table'>
|
|
||||||
</table>
|
|
||||||
{% endblock %}
|
|
@ -1,14 +0,0 @@
|
|||||||
{% extends "collapse.html" %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<h4>Part Categories</h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_heading %}
|
|
||||||
<h4><span id='category-results-count'>{% include "InvenTree/searching.html" %}</span></h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='category-results-table'>
|
|
||||||
</table>
|
|
||||||
{% endblock %}
|
|
@ -1,21 +0,0 @@
|
|||||||
{% extends "collapse.html" %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<h4>Parts</h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_heading %}
|
|
||||||
<h4><span id='part-result-count'>{% include "InvenTree/searching.html" %}</span></h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
<div id='button-toolbar'>
|
|
||||||
<div class='button-toolbar container-fluid' style='float: right;'>
|
|
||||||
<button class='btn btn-default'>Hello</button>
|
|
||||||
<div class='filter-list' id='filter-list-parts'></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='part-results-table'>
|
|
||||||
</table>
|
|
||||||
{% endblock %}
|
|
@ -1,16 +0,0 @@
|
|||||||
{% extends "collapse.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<h4>{% trans "Stock Items" %}</h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_heading %}
|
|
||||||
<h4><span id='stock-results-count'>{% include "InvenTree/searching.html" %}</span></h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='stock-results-table'>
|
|
||||||
</table>
|
|
||||||
{% endblock %}
|
|
@ -1,16 +0,0 @@
|
|||||||
{% extends "collapse.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<h4>{% trans "Stock Locations" %}</h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_heading %}
|
|
||||||
<h4><span id='location-results-count'>{% include "InvenTree/searching.html" %}</span></h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='location-results-table'>
|
|
||||||
</table>
|
|
||||||
{% endblock %}
|
|
@ -1,14 +0,0 @@
|
|||||||
{% extends "collapse.html" %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<h4>Supplier Parts</h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_heading %}
|
|
||||||
<h4><span id='supplier-part-result-count'>{% include "InvenTree/searching.html" %}</span></h4>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='supplier-part-results-table'>
|
|
||||||
</table>
|
|
||||||
{% endblock %}
|
|
@ -1,3 +0,0 @@
|
|||||||
{% load i18n %}
|
|
||||||
|
|
||||||
<span class='fas fa-spin fa-spinner'></span> <i>{% trans "Searching" %}</i>
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-sign-out-alt icon-header'></span>
|
|
||||||
{% trans "Outstanding Sales Orders" %}<span class='badge' id='so-outstanding-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='so-outstanding-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-calendar-times icon-header'></span>
|
|
||||||
{% trans "Overdue Sales Orders" %}<span class='badge' id='so-overdue-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='so-overdue-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-stopwatch icon-header'></span>
|
|
||||||
{% trans "Stale Stock" %}<span class='badge' id='stale-stock-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='stale-stock-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "collapse_index.html" %}
|
|
||||||
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block collapse_title %}
|
|
||||||
<span class='fas fa-star icon-header'></span>
|
|
||||||
{% trans "Starred Parts" %}<span class='badge' id='starred-parts-count'><span class='fas fa-spin fa-spinner'></span></span>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block collapse_content %}
|
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='starred-parts-table'>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
Loading…
Reference in New Issue
Block a user