2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Merge branch 'inventree:master' into matmair/issue2279

This commit is contained in:
Matthias Mair
2021-12-08 18:27:57 +01:00
committed by GitHub
75 changed files with 3065 additions and 338 deletions

View File

@ -0,0 +1,73 @@
{% extends "skeleton.html" %}
{% load static %}
{% load i18n %}
{% block head %}
<meta http-equiv="refresh" content="30">
{% endblock %}
{% block page_title %}
{% trans 'Site is in Maintenance' %}
{% endblock %}
{% block body_class %}login-screen{% endblock %}
{% block body %}
<!--
Background Image Attribution: https://unsplash.com/photos/Ixvv3YZkd7w
-->
<div class='container-fluid'>
<div class='notification-area' id='alerts'>
<!-- Div for displayed alerts -->
</div>
</div>
<div class='main body-wrapper login-screen d-flex'>
<div class='login-container'>
<div class="row">
<div class='container-fluid'>
<div class='clearfix content-heading login-header d-flex flex-wrap'>
<img class="pull-left" src="{% static 'img/inventree.png' %}" width="60" height="60"/>
{% include "spacer.html" %}
<span class='float-right'><h3>{% block body_title %}{% trans 'Site is in Maintenance' %}{% endblock %}</h3></span>
</div>
</div>
<div class='container-fluid'>
<hr>
{% block content %}
{% trans 'The site is currently in maintenance and should be up again soon!' %}
{% endblock %}
</div>
</div>
</div>
{% block extra_body %}
{% endblock %}
</div>
{% endblock %}
{% block js_base %}
<script type='text/javascript'>
$(document).ready(function () {
// notifications
{% if messages %}
{% for message in messages %}
showAlertOrCache(
'{{ message }}',
true,
{
style: 'info',
}
);
{% endfor %}
{% endif %}
inventreeDocReady();
});
</script>
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,13 @@
{% load i18n %}
{% load plugin_extras %}
<h4>{% trans "Settings" %}</h4>
{% plugin_globalsettings plugin_key as plugin_settings %}
<table class='table table-striped table-condensed'>
<tbody>
{% for setting in plugin_settings %}
{% include "InvenTree/settings/setting.html" with key=setting%}
{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,25 @@
{% load i18n %}
{% load inventree_extras %}
<h4>{% trans "URLs" %}</h4>
{% define plugin.base_url as base %}
<p>{% blocktrans %}The Base-URL for this plugin is <a href="/{{ base }}" target="_blank"><strong>{{ base }}</strong></a>.{% endblocktrans %}</p>
<table class='table table-striped table-condensed'>
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th>{% trans "URL" %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for key, entry in plugin.urlpatterns.reverse_dict.items %}{% if key %}
<tr>
<td>{{key}}</td>
<td>{{entry.1}}</td>
<td><a class="btn btn-primary btn-small" href="/{{ base }}{{entry.1}}" target="_blank">{% trans 'open in new tab' %}</a></td>
</tr>
{% endif %}{% endfor %}
</tbody>
</table>

View File

@ -0,0 +1,146 @@
{% extends "panel.html" %}
{% load i18n %}
{% load inventree_extras %}
{% load plugin_extras %}
{% block label %}plugin{% endblock %}
{% block heading %}
{% trans "Plugin Settings" %}
{% endblock %}
{% block content %}
<div class='alert alert-block alert-danger'>
{% trans "Changing the settings below require you to immediatly restart InvenTree. Do not change this while under active usage." %}
</div>
<div class='table-responsive'>
<table class='table table-striped table-condensed'>
<tbody>
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_URL" %}
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_NAVIGATION" %}
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_GLOBALSETTING"%}
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_APP"%}
</tbody>
</table>
</div>
<div class='panel-heading'>
<div class='d-flex flex-wrap'>
<h4>{% trans "Plugin list" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% url 'admin:plugin_pluginconfig_changelist' as url %}
{% include "admin_button.html" with url=url %}
<button class="btn btn-success" id="install-plugin" title="{% trans 'Install Plugin' %}"><span class='fas fa-plus-circle'></span> {% trans "Install Plugin" %}</button>
</div>
</div>
</div>
<div class='table-responsive'>
<table class='table table-striped table-condensed'>
<thead>
<tr>
<th>{% trans "Admin" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Author" %}</th>
<th>{% trans "Date" %}</th>
<th>{% trans "Version" %}</th>
</tr>
</thead>
<tbody>
{% plugin_list as pl_list %}
{% for plugin_key, plugin in pl_list.items %}
{% mixin_enabled plugin 'urls' as urls %}
{% mixin_enabled plugin 'settings' as settings %}
<tr>
<td>
{% if user.is_staff and perms.plugin.change_pluginconfig %}
{% url 'admin:plugin_pluginconfig_change' plugin.pk as url %}
{% include "admin_button.html" with url=url %}
{% endif %}
</td>
<td>{{ plugin.human_name }}<span class="text-muted"> - {{plugin_key}}</span>
{% define plugin.registered_mixins as mixin_list %}
{% if mixin_list %}
{% for mixin in mixin_list %}
<a class='sidebar-selector' id='select-plugin-{{plugin_key}}' data-bs-parent="#sidebar">
<span class='badge bg-dark badge-right'>{% blocktrans with name=mixin.human_name %}has {{name}}{% endblocktrans %}</span>
</a>
{% endfor %}
{% endif %}
{% if plugin.website %}
<a href="{{ plugin.website }}"><i class="fas fa-globe"></i></a>
{% endif %}
</td>
<td>{{ plugin.author }}</td>
<td>{{ plugin.pub_date }}</td>
<td>{% if plugin.version %}{{ plugin.version }}{% endif %}</td>
</tr>
{% endfor %}
{% inactive_plugin_list as in_pl_list %}
{% if in_pl_list %}
<tr><td colspan="5"></td></tr>
<tr><td colspan="5"><h6>{% trans 'Inactive plugins' %}</h6></td></tr>
{% for plugin_key, plugin in in_pl_list.items %}
<tr>
<td>
{% if user.is_staff and perms.plugin.change_pluginconfig %}
{% url 'admin:plugin_pluginconfig_change' plugin.pk as url %}
{% include "admin_button.html" with url=url %}
{% endif %}
</td>
<td>{{plugin.name}}<span class="text-muted"> - {{plugin.key}}</span></td>
<td colspan="3"></td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
{% plugin_errors as pl_errors %}
{% if pl_errors %}
<div class='panel-heading'>
<div class='d-flex flex-wrap'>
<h4>{% trans "Plugin Error Stack" %}</h4>
{% include "spacer.html" %}
</div>
</div>
<div class='table-responsive'>
<table class='table table-striped table-condensed'>
<thead>
<tr>
<th>{% trans "Stage" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Message" %}</th>
</tr>
</thead>
<tbody>
{% for stage, errors in pl_errors.items %}
{% for error_detail in errors %}
{% for name, message in error_detail.items %}
<tr>
<td>{{ stage }}</td>
<td>{{ name }}</td>
<td>{{ message }}</td>
</tr>
{% endfor %}
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,137 @@
{% extends "panel.html" %}
{% load i18n %}
{% load inventree_extras %}
{% load plugin_extras %}
{% block label %}plugin-{{plugin_key}}{% endblock %}
{% block heading %}
{% blocktrans with name=plugin.human_name %}Plugin details for {{name}}{% endblocktrans %}
{% endblock %}
{% block content %}
<div class="row">
<div class="col">
<h4>{% trans "Plugin information" %}</h4>
<div class='table-responsive'>
<table class='table table-striped table-condensed'>
<col width='25'>
<tr>
<td></td>
<td>{% trans "Name" %}</td>
<td>{{ plugin.human_name }}{% include "clip.html" %}</td>
</tr>
<tr>
<td><span class='fas fa-user'></span></span></td>
<td>{% trans "Author" %}</td>
<td>{{ plugin.author }}{% include "clip.html" %}</td>
</tr>
<tr>
<td></td>
<td>{% trans "Description" %}</td>
<td>{{ plugin.description }}{% include "clip.html" %}</td>
</tr>
<tr>
<td><span class='fas fa-calendar-alt'></span></td>
<td>{% trans "Date" %}</td>
<td>{{ plugin.pub_date }}{% include "clip.html" %}</td>
</tr>
<tr>
<td><span class='fas fa-hashtag'></span></td>
<td>{% trans "Version" %}</td>
<td>
{% if plugin.version %}
{{ plugin.version }}{% include "clip.html" %}
{% else %}
{% trans 'no version information supplied' %}
{% endif %}
</td>
</tr>
{% if plugin.website %}
<tr>
<td><span class='fas fa-globe'></span></td>
<td>{% trans "Website" %}</td>
<td>{{ plugin.website }}{% include "clip.html" %}</td>
</tr>
{% endif %}
{% if plugin.license %}
<tr>
<td><span class='fas fa-balance-scale'></span></td>
<td>{% trans "License" %}</td>
<td>{{ plugin.license }}{% include "clip.html" %}</td>
</tr>
{% endif %}
</table>
</div>
{% if plugin.is_package == False %}
<p>{% trans 'The code information is pulled from the latest git commit for this plugin. It might not reflect official version numbers or information but the actual code running.' %}</p>
{% endif %}
</div>
<div class="col">
<h4>{% trans "Package information" %}</h4>
<div class='table-responsive'>
<table class='table table-striped table-condensed'>
<col width='25'>
<tr>
<td></td>
<td>{% trans "Installation method" %}</td>
<td>
{% if plugin.is_package %}
{% trans "This plugin was installed as a package" %}
{% else %}
{% trans "This plugin was found in a local InvenTree path" %}
{% endif %}
</td>
</tr>
<tr>
<td></td>
<td>{% trans "Installation path" %}</td>
<td>{{ plugin.package_path }}</td>
</tr>
{% if plugin.is_package == False %}
<tr>
<td><span class='fas fa-user'></span></td>
<td>{% trans "Commit Author" %}</td><td>{{ plugin.package.author }} - {{ plugin.package.mail }}{% include "clip.html" %}</td>
</tr>
<tr>
<td><span class='fas fa-calendar-alt'></span></td>
<td>{% trans "Commit Date" %}</td><td>{{ plugin.package.date }}{% include "clip.html" %}</td>
</tr>
<tr>
<td><span class='fas fa-code-branch'></span></td>
<td>{% trans "Commit Hash" %}</td><td>{{ plugin.package.hash }}{% include "clip.html" %}</td>
</tr>
<tr>
<td><span class='fas fa-envelope'></span></td>
<td>{% trans "Commit Message" %}</td><td>{{ plugin.package.message }}{% include "clip.html" %}</td>
</tr>
{% endif %}
<tr>
<td><span class='text-{{plugin.sign_color}} fas fa-check'></span></td>
<td>{% trans "Sign Status" %}</td>
<td class="bg-{{plugin.sign_color}}">{% if plugin.package.verified %}{{ plugin.package.verified }}: {% endif%}{{ plugin.sign_state.msg }}</td>
</tr>
<tr>
<td><span class='text-{{plugin.sign_color}} fas fa-key'></span></td>
<td>{% trans "Sign Key" %}</td>
<td class="bg-{{plugin.sign_color}}">{{ plugin.package.key }}{% include "clip.html" %}</td>
</tr>
</table>
</div>
</div>
</div>
{% mixin_enabled plugin 'globalsettings' as globalsettings %}
{% if globalsettings %}
{% include 'InvenTree/settings/mixins/settings.html' %}
{% endif %}
{% mixin_enabled plugin 'urls' as urls %}
{% if urls %}
{% include 'InvenTree/settings/mixins/urls.html' %}
{% endif %}
{% endblock %}

View File

@ -3,6 +3,7 @@
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% load plugin_extras %}
{% block breadcrumb_list %}
{% endblock %}
@ -38,6 +39,14 @@
{% include "InvenTree/settings/build.html" %}
{% include "InvenTree/settings/po.html" %}
{% include "InvenTree/settings/so.html" %}
{% include "InvenTree/settings/plugin.html" %}
{% plugin_list as pl_list %}
{% for plugin_key, plugin in pl_list.items %}
{% if plugin.registered_mixins %}
{% include "InvenTree/settings/plugin_settings.html" %}
{% endif %}
{% endfor %}
{% endif %}
@ -313,6 +322,10 @@ $("#import-part").click(function() {
launchModalForm("{% url 'api-part-import' %}?reset", {});
});
$("#install-plugin").click(function() {
installPlugin();
});
enableSidebar('settings');
{% endblock %}

View File

@ -1,6 +1,7 @@
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% load plugin_extras %}
{% trans "User Settings" as text %}
{% include "sidebar_header.html" with text=text icon='fa-user' %}
@ -46,4 +47,15 @@
{% trans "Sales Orders" as text %}
{% include "sidebar_item.html" with label='sales-order' text=text icon="fa-truck" %}
{% include "sidebar_header.html" with text="Plugin Settings" %}
{% include "sidebar_item.html" with label='plugin' text="Plugin" icon="fa-plug" %}
{% plugin_list as pl_list %}
{% for plugin_key, plugin in pl_list.items %}
{% if plugin.registered_mixins %}
{% include "sidebar_item.html" with label='plugin-'|add:plugin_key text=plugin.human_name %}
{% endif %}
{% endfor %}
{% endif %}

View File

@ -1,4 +1,4 @@
{% load i18n %}
<button id='admin-button' title='{% trans "View in administration panel" %}' type='button' class='btn btn-primary' url='{{ url }}'>
<button id='admin-button' title='{% trans "View in administration panel" %}' type='button' class='btn btn-primary admin-button' url='{{ url }}'>
<span class='fas fa-user-shield'></span>
</button>

View File

@ -178,6 +178,7 @@
<script type='text/javascript' src="{% i18n_static 'part.js' %}"></script>
<script type='text/javascript' src="{% i18n_static 'report.js' %}"></script>
<script type='text/javascript' src="{% i18n_static 'stock.js' %}"></script>
<script type='text/javascript' src="{% i18n_static 'plugin.js' %}"></script>
<script type='text/javascript' src="{% i18n_static 'tables.js' %}"></script>
<script type='text/javascript' src="{% i18n_static 'table_filters.js' %}"></script>

View File

@ -0,0 +1,26 @@
{% load i18n %}
{% load inventree_extras %}
/* globals
constructForm,
*/
/* exported
installPlugin,
*/
function installPlugin() {
constructForm(`/api/plugin/install/`, {
method: 'POST',
title: '{% trans "Install Plugin" %}',
fields: {
packagename: {},
url: {},
confirm: {},
},
onSuccess: function(data) {
msg = '{% trans "The Plugin was installed" %}';
showMessage(msg, {style: 'success', details: data.result, timeout: 30000});
}
});
}

View File

@ -308,9 +308,17 @@ function getAvailableTableFilters(tableKey) {
// Filters for PurchaseOrderLineItem table
if (tableKey == 'purchaseorderlineitem') {
return {
completed: {
pending: {
type: 'bool',
title: '{% trans "Completed" %}',
title: '{% trans "Pending" %}',
},
received: {
type: 'bool',
title: '{% trans "Received" %}',
},
order_status: {
title: '{% trans "Order status" %}',
options: purchaseOrderCodes,
},
};
}

View File

@ -1,9 +1,11 @@
{% load static %}
{% load inventree_extras %}
{% load plugin_extras %}
{% load i18n %}
{% settings_value 'BARCODE_ENABLE' as barcodes %}
{% settings_value 'STICKY_HEADER' user=request.user as sticky %}
{% navigation_enabled as plugin_nav %}
{% inventree_demo_mode as demo %}
<nav class="navbar {% if sticky %}fixed-top{% endif %} navbar-expand-lg navbar-light">
@ -57,6 +59,29 @@
</ul>
</li>
{% endif %}
{% if plugin_nav %}
{% plugin_list as pl_list %}
{% for plugin_key, plugin in pl_list.items %}
{% mixin_enabled plugin 'navigation' as navigation %}
{% if navigation %}
<li class='nav-item dropdown'>
<a class='nav-link dropdown-toggle' data-bs-toggle="dropdown" aria-expanded="false" href='#'>
<span class='{{plugin.navigation_icon}} icon-header'></span>{{plugin.navigation_name}}
</a>
<ul class='dropdown-menu'>
{% for nav_item in plugin.navigation %}
{% safe_url nav_item.link as nav_link %}
{% if nav_link %}
<li><a href="{{ nav_link }}" class="dropdown-item"><span class='{{nav_item.icon}} icon-header'></span>{{nav_item.name}}</a>
{% endif %}
{% endfor %}
</ul>
</li>
{% endif %}
{% endfor %}
{% endif %}
</ul>
</div>
{% if demo %}

View File

@ -0,0 +1,99 @@
{% load static %}
{% load i18n %}
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="57x57" href="{% static 'img/favicon/apple-icon-57x57.png' %}">
<link rel="apple-touch-icon" sizes="60x60" href="{% static 'img/favicon/apple-icon-60x60.png' %}">
<link rel="apple-touch-icon" sizes="72x72" href="{% static 'img/favicon/apple-icon-72x72.png' %}">
<link rel="apple-touch-icon" sizes="76x76" href="{% static 'img/favicon/apple-icon-76x76.png' %}">
<link rel="apple-touch-icon" sizes="114x114" href="{% static 'img/favicon/apple-icon-114x114.png' %}">
<link rel="apple-touch-icon" sizes="120x120" href="{% static 'img/favicon/apple-icon-120x120.png' %}">
<link rel="apple-touch-icon" sizes="144x144" href="{% static 'img/favicon/apple-icon-144x144.png' %}">
<link rel="apple-touch-icon" sizes="152x152" href="{% static 'img/favicon/apple-icon-152x152.png' %}">
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'img/favicon/apple-icon-180x180.png' %}">
<link rel="icon" type="image/png" sizes="192x192" href="{% static 'img/favicon/android-icon-192x192.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'img/favicon/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="96x96" href="{% static 'img/favicon/favicon-96x96.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'img/favicon/favicon-16x16.png' %}">
<link rel="manifest" href="{% static 'img/favicon/manifest.json' %}">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="{% static 'img/favicon/ms-icon-144x144.png' %}">
<meta name="theme-color" content="#ffffff">
<!-- CSS -->
<link rel="stylesheet" href="{% static 'bootstrap/css/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'fontawesome/css/brands.css' %}">
<link rel="stylesheet" href="{% static 'fontawesome/css/solid.css' %}">
<link rel="stylesheet" href="{% static 'select2/css/select2.css' %}">
<link rel="stylesheet" href="{% static 'select2/css/select2-bootstrap-5-theme.css' %}">
<link rel="stylesheet" href="{% static 'css/inventree.css' %}">
{% block head_css %}
{% endblock %}
<style>
{% block css %}
{% endblock %}
</style>
{% block head %}
{% endblock %}
<title>
{% block page_title %}
{% endblock %}
</title>
</head>
<body class='{% block body_class %}{% endblock %}'>
{% block body %}
{% endblock %}
<!-- Scripts -->
<script type="text/javascript" src="{% static 'script/jquery_3.3.1_jquery.min.js' %}"></script>
<script type='text/javascript' src="{% static 'script/jquery-ui/jquery-ui.min.js' %}"></script>
<script type="text/javascript" src="{% static 'bootstrap/js/bootstrap.bundle.min.js' %}"></script>
{% block body_scripts_general %}
{% endblock %}
<!-- 3rd party general js -->
<script type="text/javascript" src="{% static 'fullcalendar/main.js' %}"></script>
<script type="text/javascript" src="{% static 'fullcalendar/locales-all.js' %}"></script>
<script type="text/javascript" src="{% static 'select2/js/select2.full.js' %}"></script>
<script type='text/javascript' src="{% static 'script/moment.js' %}"></script>
<script type='text/javascript' src="{% static 'script/chart.min.js' %}"></script>
<script type='text/javascript' src="{% static 'script/clipboard.min.js' %}"></script>
<script type='text/javascript' src="{% static 'script/randomColor.min.js' %}"></script>
<!-- general InvenTree -->
<script type='text/javascript' src="{% static 'script/inventree/inventree.js' %}"></script>
<script type='text/javascript' src="{% static 'script/inventree/notification.js' %}"></script>
{% block body_scripts_inventree %}
{% endblock %}
<!-- fontawesome -->
<script type='text/javascript' src="{% static 'fontawesome/js/solid.js' %}"></script>
<script type='text/javascript' src="{% static 'fontawesome/js/brands.js' %}"></script>
<script type='text/javascript' src="{% static 'fontawesome/js/fontawesome.js' %}"></script>
{% block js_load %}
{% endblock %}
{% block js_base %}
{% endblock %}
{% block js %}
{% endblock %}
</body>
</html>