mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
show delete button only selective
This commit is contained in:
parent
cefc4af861
commit
a653f322b3
@ -29,7 +29,7 @@ function updateNotificationTables() {
|
|||||||
// this allows the global notification panel to update the tables
|
// this allows the global notification panel to update the tables
|
||||||
window.updateNotifications = updateNotificationTables
|
window.updateNotifications = updateNotificationTables
|
||||||
|
|
||||||
function loadNotificationTable(table, options={}) {
|
function loadNotificationTable(table, options={}, enableDelete=false) {
|
||||||
|
|
||||||
var params = options.params || {};
|
var params = options.params || {};
|
||||||
var read = typeof(params.read) === 'undefined' ? true : params.read;
|
var read = typeof(params.read) === 'undefined' ? true : params.read;
|
||||||
@ -90,7 +90,11 @@ function loadNotificationTable(table, options={}) {
|
|||||||
{
|
{
|
||||||
formatter: function(value, row, index, field) {
|
formatter: function(value, row, index, field) {
|
||||||
var bRead = getReadEditButton(row.pk, row.read)
|
var bRead = getReadEditButton(row.pk, row.read)
|
||||||
|
if (enableDelete) {
|
||||||
var bDel = "<button title='{% trans "Delete Notification" %}' class='notification-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
|
var bDel = "<button title='{% trans "Delete Notification" %}' class='notification-delete btn btn-outline-secondary' type='button' pk='" + row.pk + "'><span class='fas fa-trash-alt icon-red'></span></button>";
|
||||||
|
} else {
|
||||||
|
var bDel = '';
|
||||||
|
}
|
||||||
var html = "<div class='btn-group float-right' role='group'>" + bRead + bDel + "</div>";
|
var html = "<div class='btn-group float-right' role='group'>" + bRead + bDel + "</div>";
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
@ -121,7 +125,7 @@ loadNotificationTable("#history-table", {
|
|||||||
name: 'history',
|
name: 'history',
|
||||||
url: '{% url 'api-notifications-list' %}',
|
url: '{% url 'api-notifications-list' %}',
|
||||||
no_matches: function() { return '{% trans "No notification history found" %}'; },
|
no_matches: function() { return '{% trans "No notification history found" %}'; },
|
||||||
});
|
}, true);
|
||||||
|
|
||||||
$("#history-refresh").on('click', function() {
|
$("#history-refresh").on('click', function() {
|
||||||
$("#history-table").bootstrapTable('refresh');
|
$("#history-table").bootstrapTable('refresh');
|
||||||
|
Loading…
Reference in New Issue
Block a user