2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-11 06:10:54 +00:00

Base html

[FR] Notification centre
Fixes #2279
This commit is contained in:
Matthias
2021-11-27 02:22:39 +01:00
parent 82d5952ddd
commit 6b53fd2bd4
6 changed files with 204 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
{% extends "panel.html" %}
{% load i18n %}
{% load inventree_extras %}
{% block label %}history{% endblock %}
{% block heading %}
{% trans "History" %}
{% endblock %}
{% block actions %}
<div class='btn btn-secondary' type='button' id='history-refresh' title='{% trans "Refresh History" %}'>
<span class='fa fa-sync'></span> {% trans "Refresh History" %}
</div>
{% endblock %}
{% block content %}
<div class='row'>
<table class='table table-striped table-condensed' id='history-table'>
</table>
</div>
{% endblock %}

View File

@@ -0,0 +1,25 @@
{% extends "panel.html" %}
{% load i18n %}
{% load inventree_extras %}
{% block label %}inbox{% endblock %}
{% block heading %}
{% trans "Inbox" %}
{% endblock %}
{% block actions %}
<div class='btn btn-secondary' type='button' id='inbox-refresh' title='{% trans "Refresh Inbox" %}'>
<span class='fa fa-sync'></span> {% trans "Refresh Inbox" %}
</div>
{% endblock %}
{% block content %}
<div class='row'>
<table class='table table-striped table-condensed' id='inbox-table'>
</table>
</div>
{% endblock %}

View File

@@ -0,0 +1,119 @@
{% extends "base.html" %}
{% load i18n %}
{% load inventree_extras %}
{% block breadcrumb_list %}
{% endblock %}
{% block page_title %}
{% inventree_title %} | {% trans "Notifications" %}
{% endblock %}
{% block sidebar %}
{% include "InvenTree/notifications/sidebar.html" %}
{% endblock %}
{% block content %}
{% include "InvenTree/notifications/inbox.html" %}
{% include "InvenTree/notifications/history.html" %}
{% endblock %}
{% block js_ready %}
{{ block.super }}
$("#inbox-table").inventreeTable({
url: "{% url 'api-part-parameter-template-list' %}",
queryParams: {
ordering: 'name',
},
formatNoMatches: function() { return '{% trans "No part parameter templates found" %}'; },
columns: [
{
field: 'pk',
title: '{% trans "ID" %}',
visible: false,
switchable: false,
},
{
field: 'name',
title: '{% trans "Name" %}',
sortable: 'true',
},
{
field: 'units',
title: '{% trans "Units" %}',
sortable: 'true',
},
{
formatter: function(value, row, index, field) {
var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
var html = "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>";
return html;
}
}
]
});
$("#inbox-table").on('click', '.template-edit', function() {
var button = $(this);
var url = "/part/parameter/template/" + button.attr('pk') + "/edit/";
launchModalForm(url, {
success: function() {
$("#inbox-table").bootstrapTable('refresh');
}
});
});
$("#inbox-refresh").on('click', function() {
$("#inbox-table").bootstrapTable('refresh');
});
$("#history-table").inventreeTable({
url: "{% url 'api-part-parameter-template-list' %}",
queryParams: {
ordering: 'name',
},
formatNoMatches: function() { return '{% trans "No part parameter templates found" %}'; },
columns: [
{
field: 'pk',
title: '{% trans "ID" %}',
visible: false,
switchable: false,
},
{
field: 'name',
title: '{% trans "Name" %}',
sortable: 'true',
},
{
field: 'units',
title: '{% trans "Units" %}',
sortable: 'true',
},
{
formatter: function(value, row, index, field) {
var bEdit = "<button title='{% trans "Edit Template" %}' class='template-edit btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-edit'></span></button>";
var bDel = "<button title='{% trans "Delete Template" %}' class='template-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
var html = "<div class='btn-group float-right' role='group'>" + bEdit + bDel + "</div>";
return html;
}
}
]
});
$("#history-refresh").on('click', function() {
$("#history-table").bootstrapTable('refresh');
});
enableSidebar('notifications');
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% load i18n %}
{% load static %}
{% load inventree_extras %}
{% trans "Notifications" as text %}
{% include "sidebar_header.html" with text=text icon='fa-user' %}
{% trans "Inbox" as text %}
{% include "sidebar_item.html" with label='inbox' text=text icon="fa-cog" %}
{% trans "History" as text %}
{% include "sidebar_item.html" with label='history' text=text icon="fa-desktop" %}