mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Squashed commit
Fixed some localization strings Reviewed/optimized product deletion handling Add option to hide products from the stock overview page (closes #906) Prefill default_due_days also on the inventory page (closes #591) Added DataTables accent chinese-string plugin (closes #872) Show costs and calories per recipe ingredient (closes #1072) Fixed user permission saving (fixes #1099) User permissions should not have an effect for demo mode (closes #972) Handle QU conversion when consuming a substituation (child) product (fixes #1118) Consume/open any child product when the parent product is not in stock (closes #899) Added a retry camera barcode scanning button to product picker workflow (closes #736)
This commit is contained in:
@@ -745,7 +745,10 @@ $.extend(true, $.fn.dataTable.defaults, {
|
||||
{
|
||||
return JSON.parse(Grocy.UserSettings[settingKey]);
|
||||
}
|
||||
}
|
||||
},
|
||||
'columnDefs': [
|
||||
{ type: 'chinese-string', targets: '_all' }
|
||||
]
|
||||
});
|
||||
|
||||
// serializeJSON defaults
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
],
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#batteries-table tbody').removeClass("d-none");
|
||||
batteriesTable.columns.adjust().draw();
|
||||
|
@@ -4,7 +4,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#batteries-journal-table tbody').removeClass("d-none");
|
||||
batteriesJournalTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#batteries-overview-table tbody').removeClass("d-none");
|
||||
batteriesOverviewTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#chores-table tbody').removeClass("d-none");
|
||||
choresTable.columns.adjust().draw();
|
||||
|
@@ -4,7 +4,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#chores-journal-table tbody').removeClass("d-none");
|
||||
choresJournalTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#chores-overview-table tbody').removeClass("d-none");
|
||||
choresOverviewTable.columns.adjust().draw();
|
||||
|
@@ -172,6 +172,59 @@ $('#product_id_text_input').on('blur', function(e)
|
||||
addProductWorkflowsAdditionalCssClasses = "d-none";
|
||||
}
|
||||
|
||||
var buttons = {
|
||||
cancel: {
|
||||
label: __t('Cancel'),
|
||||
className: 'btn-secondary responsive-button',
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
}
|
||||
},
|
||||
addnewproduct: {
|
||||
label: '<strong>P</strong> ' + __t('Add as new product'),
|
||||
className: 'btn-success add-new-product-dialog-button responsive-button ' + addProductWorkflowsAdditionalCssClasses,
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
window.location.href = U('/product/new?flow=InplaceNewProductWithName&name=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceNewProductWithName"));
|
||||
}
|
||||
},
|
||||
addbarcode: {
|
||||
label: '<strong>B</strong> ' + __t('Add as barcode to existing product'),
|
||||
className: 'btn-info add-new-barcode-dialog-button responsive-button',
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
window.location.href = U(Grocy.CurrentUrlRelative + '?flow=InplaceAddBarcodeToExistingProduct&barcode=' + encodeURIComponent(input));
|
||||
}
|
||||
},
|
||||
addnewproductwithbarcode: {
|
||||
label: '<strong>A</strong> ' + __t('Add as new product and prefill barcode'),
|
||||
className: 'btn-warning add-new-product-with-barcode-dialog-button responsive-button ' + addProductWorkflowsAdditionalCssClasses,
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
window.location.href = U('/product/new?flow=InplaceNewProductWithBarcode&barcode=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceAddBarcodeToExistingProduct&barcode=" + input));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (!Grocy.FeatureFlags.DISABLE_BROWSER_BARCODE_CAMERA_SCANNING)
|
||||
{
|
||||
buttons.retrycamerascanning = {
|
||||
label: '<strong>C</strong> <i class="fas fa-camera"></i>',
|
||||
className: 'btn-primary responsive-button retry-camera-scanning-button',
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
$("#barcodescanner-start-button").click();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Grocy.Components.ProductPicker.PopupOpen = true;
|
||||
bootbox.dialog({
|
||||
message: __t('"%s" could not be resolved to a product, how do you want to proceed?', input),
|
||||
@@ -184,44 +237,7 @@ $('#product_id_text_input').on('blur', function(e)
|
||||
size: 'large',
|
||||
backdrop: true,
|
||||
closeButton: false,
|
||||
buttons: {
|
||||
cancel: {
|
||||
label: __t('Cancel'),
|
||||
className: 'btn-secondary responsive-button',
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
}
|
||||
},
|
||||
addnewproduct: {
|
||||
label: '<strong>P</strong> ' + __t('Add as new product'),
|
||||
className: 'btn-success add-new-product-dialog-button responsive-button ' + addProductWorkflowsAdditionalCssClasses,
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
window.location.href = U('/product/new?flow=InplaceNewProductWithName&name=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceNewProductWithName"));
|
||||
}
|
||||
},
|
||||
addbarcode: {
|
||||
label: '<strong>B</strong> ' + __t('Add as barcode to existing product'),
|
||||
className: 'btn-info add-new-barcode-dialog-button responsive-button',
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
window.location.href = U(Grocy.CurrentUrlRelative + '?flow=InplaceAddBarcodeToExistingProduct&barcode=' + encodeURIComponent(input));
|
||||
}
|
||||
},
|
||||
addnewproductwithbarcode: {
|
||||
label: '<strong>A</strong> ' + __t('Add as new product and prefill barcode'),
|
||||
className: 'btn-warning add-new-product-with-barcode-dialog-button responsive-button ' + addProductWorkflowsAdditionalCssClasses,
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
window.location.href = U('/product/new?flow=InplaceNewProductWithBarcode&barcode=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceAddBarcodeToExistingProduct&barcode=" + input));
|
||||
}
|
||||
}
|
||||
}
|
||||
buttons: buttons
|
||||
}).on('keypress', function(e)
|
||||
{
|
||||
if (e.key === 'B' || e.key === 'b')
|
||||
@@ -236,6 +252,10 @@ $('#product_id_text_input').on('blur', function(e)
|
||||
{
|
||||
$('.add-new-product-with-barcode-dialog-button').not(".d-none").click();
|
||||
}
|
||||
if (e.key === 'c' || e.key === 'C')
|
||||
{
|
||||
$('.retry-camera-scanning-button').not(".d-none").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -249,7 +269,6 @@ $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
||||
}
|
||||
|
||||
// Don't know why the blur event does not fire immediately ... this works...
|
||||
|
||||
Grocy.Components.ProductPicker.GetInputElement().focusout();
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
Grocy.Components.ProductPicker.GetInputElement().blur();
|
||||
|
@@ -11,6 +11,7 @@
|
||||
jsonData.amount = jsonForm.amount;
|
||||
jsonData.exact_amount = $('#consume-exact-amount').is(':checked');
|
||||
jsonData.spoiled = $('#spoiled').is(':checked');
|
||||
jsonData.allow_subproduct_substitution = true;
|
||||
|
||||
if ($("#use_specific_stock_entry").is(":checked"))
|
||||
{
|
||||
@@ -28,7 +29,6 @@
|
||||
}
|
||||
|
||||
var bookingResponse = null;
|
||||
|
||||
Grocy.Api.Get('stock/products/' + jsonForm.product_id,
|
||||
function(productDetails)
|
||||
{
|
||||
@@ -146,6 +146,7 @@ $('#save-mark-as-open-button').on('click', function(e)
|
||||
|
||||
jsonData = {};
|
||||
jsonData.amount = jsonForm.amount;
|
||||
jsonData.allow_subproduct_substitution = true;
|
||||
|
||||
if ($("#use_specific_stock_entry").is(":checked"))
|
||||
{
|
||||
@@ -215,7 +216,7 @@ $("#location_id").on('change', function(e)
|
||||
|
||||
if (locationId)
|
||||
{
|
||||
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries',
|
||||
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries?include_sub_products=true',
|
||||
function(stockEntries)
|
||||
{
|
||||
stockEntries.forEach(stockEntry =>
|
||||
@@ -234,7 +235,7 @@ $("#location_id").on('change', function(e)
|
||||
text: __t("Amount: %1$s; Due on %2$s; Bought on %3$s", stockEntry.amount, moment(stockEntry.best_before_date).format("YYYY-MM-DD"), moment(stockEntry.purchased_date).format("YYYY-MM-DD")) + "; " + openTxt
|
||||
}));
|
||||
|
||||
sumValue = sumValue + parseFloat(stockEntry.amount);
|
||||
sumValue = sumValue + parseFloat(stockEntry.amount_aggregated);
|
||||
|
||||
if (stockEntry.stock_id == stockId)
|
||||
{
|
||||
@@ -302,7 +303,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
$(".input-group-productamountpicker").trigger("change");
|
||||
|
||||
$("#location_id").find("option").remove().end().append("<option></option>");
|
||||
Grocy.Api.Get("stock/products/" + productId + '/locations',
|
||||
Grocy.Api.Get("stock/products/" + productId + '/locations?include_sub_products=true',
|
||||
function(stockLocations)
|
||||
{
|
||||
var setDefault = 0;
|
||||
@@ -369,7 +370,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
$("#tare-weight-handling-info").addClass("d-none");
|
||||
}
|
||||
|
||||
if ((parseFloat(productDetails.stock_amount) || 0) === 0)
|
||||
if ((parseFloat(productDetails.stock_amount_aggregated) || 0) === 0)
|
||||
{
|
||||
Grocy.Components.ProductAmountPicker.Reset();
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
@@ -448,14 +449,14 @@ $("#specific_stock_entry").on("change", function(e)
|
||||
if ($(e.target).val() == "")
|
||||
{
|
||||
sumValue = 0;
|
||||
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries',
|
||||
Grocy.Api.Get("stock/products/" + Grocy.Components.ProductPicker.GetValue() + '/entries?include_sub_products=true',
|
||||
function(stockEntries)
|
||||
{
|
||||
stockEntries.forEach(stockEntry =>
|
||||
{
|
||||
if (stockEntry.location_id == $("#location_id").val() || stockEntry.location_id == "")
|
||||
{
|
||||
sumValue = sumValue + parseFloat(stockEntry.amount);
|
||||
sumValue = sumValue + parseFloat(stockEntry.amount_aggregated);
|
||||
}
|
||||
});
|
||||
$("#display_amount").attr("max", sumValue);
|
||||
|
@@ -2,9 +2,8 @@
|
||||
'order': [[0, 'asc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
{ 'orderData': 2, 'targets': 1 }
|
||||
],
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
].concat($.fn.dataTable.defaults.columnDefs),
|
||||
select: {
|
||||
style: 'single',
|
||||
selector: 'tr td:not(:first-child)'
|
||||
|
@@ -159,6 +159,24 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
Grocy.Components.LocationPicker.SetId(productDetails.location.id);
|
||||
}
|
||||
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
||||
{
|
||||
if (productDetails.product.default_best_before_days.toString() !== '0')
|
||||
{
|
||||
if (productDetails.product.default_best_before_days == -1)
|
||||
{
|
||||
if (!$("#datetimepicker-shortcut").is(":checked"))
|
||||
{
|
||||
$("#datetimepicker-shortcut").click();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.DateTimePicker.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#display_amount').val(productDetails.stock_amount);
|
||||
RefreshLocaleNumberInput();
|
||||
$(".input-group-productamountpicker").trigger("change");
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#locations-table tbody').removeClass("d-none");
|
||||
locationsTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#apikeys-table tbody').removeClass("d-none");
|
||||
apiKeysTable.columns.adjust().draw();
|
||||
|
@@ -291,7 +291,7 @@ var quConversionsTable = $('#qu-conversions-table-products').DataTable({
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
{ 'visible': false, 'targets': 4 }
|
||||
],
|
||||
].concat($.fn.dataTable.defaults.columnDefs),
|
||||
'rowGroup': {
|
||||
dataSrc: 4
|
||||
}
|
||||
@@ -305,7 +305,7 @@ var barcodeTable = $('#barcode-table').DataTable({
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#barcode-table tbody').removeClass("d-none");
|
||||
barcodeTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#productgroups-table tbody').removeClass("d-none");
|
||||
groupsTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#products-table tbody').removeClass("d-none");
|
||||
productsTable.columns.adjust().draw();
|
||||
@@ -36,6 +36,7 @@ $("#clear-filter-button").on("click", function()
|
||||
$("#product-group-filter").val("all");
|
||||
productsTable.column(7).search("").draw();
|
||||
productsTable.search("").draw();
|
||||
$("#show-disabled-products").prop('checked', false);
|
||||
});
|
||||
|
||||
if (typeof GetUriParam("product-group") !== "undefined")
|
||||
@@ -49,58 +50,53 @@ $(document).on('click', '.product-delete-button', function(e)
|
||||
var objectName = $(e.currentTarget).attr('data-product-name');
|
||||
var objectId = $(e.currentTarget).attr('data-product-id');
|
||||
|
||||
Grocy.Api.Get('stock/products/' + objectId,
|
||||
function(productDetails)
|
||||
{
|
||||
var stockAmount = productDetails.stock_amount || '0';
|
||||
|
||||
if (stockAmount.toString() == "0")
|
||||
{
|
||||
bootbox.confirm({
|
||||
message: __t('Are you sure you want to deactivate this product "%s"?', objectName),
|
||||
closeButton: false,
|
||||
buttons: {
|
||||
confirm: {
|
||||
label: __t('Yes'),
|
||||
className: 'btn-success'
|
||||
},
|
||||
cancel: {
|
||||
label: __t('No'),
|
||||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
callback: function(result)
|
||||
{
|
||||
if (result === true)
|
||||
{
|
||||
jsonData = {};
|
||||
jsonData.active = 0;
|
||||
Grocy.Api.Put('objects/products/' + objectId, jsonData,
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/products');
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
bootbox.alert({
|
||||
title: __t('Deactivation not possible'),
|
||||
message: __t('This product cannot be deactivated because it is in stock, please remove the stock amount first.') + '<br><br>' + __t('Stock amount') + ': ' + stockAmount + ' ' + __n(stockAmount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural),
|
||||
closeButton: false
|
||||
});
|
||||
bootbox.confirm({
|
||||
message: __t('Are you sure to delete product "%s"?', objectName) + '<br><br>' + __t('This also removes any stock amount, the journal and all other references of this product - consider disabling this product instead, if you want to keep that and just hide it.'),
|
||||
closeButton: false,
|
||||
buttons: {
|
||||
confirm: {
|
||||
label: __t('Yes'),
|
||||
className: 'btn-success'
|
||||
},
|
||||
cancel: {
|
||||
label: __t('No'),
|
||||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
function(xhr)
|
||||
callback: function(result)
|
||||
{
|
||||
console.error(xhr);
|
||||
if (result === true)
|
||||
{
|
||||
jsonData = {};
|
||||
jsonData.active = 0;
|
||||
Grocy.Api.Delete('objects/products/' + objectId, {},
|
||||
function(result)
|
||||
{
|
||||
window.location.href = U('/products');
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
$("#show-disabled-products").change(function()
|
||||
{
|
||||
if (this.checked)
|
||||
{
|
||||
window.location.href = U('/products?include_disabled');
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href = U('/products');
|
||||
}
|
||||
});
|
||||
|
||||
if (GetUriParam('include_disabled'))
|
||||
{
|
||||
$("#show-disabled-products").prop('checked', true);
|
||||
}
|
||||
|
@@ -139,7 +139,7 @@ var quConversionsTable = $('#qu-conversions-table').DataTable({
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#qu-conversions-table tbody').removeClass("d-none");
|
||||
quConversionsTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#quantityunits-table tbody').removeClass("d-none");
|
||||
quantityUnitsTable.columns.adjust().draw();
|
||||
|
@@ -80,7 +80,7 @@ var recipesPosTables = $('#recipes-pos-table').DataTable({
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
{ 'visible': false, 'targets': 4 }
|
||||
],
|
||||
].concat($.fn.dataTable.defaults.columnDefs),
|
||||
'rowGroup': {
|
||||
dataSrc: 4
|
||||
}
|
||||
@@ -93,7 +93,7 @@ var recipesIncludesTables = $('#recipes-includes-table').DataTable({
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#recipes-includes-table tbody').removeClass("d-none");
|
||||
recipesIncludesTables.columns.adjust().draw();
|
||||
|
@@ -2,9 +2,8 @@
|
||||
'order': [[1, 'asc']],
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
{ 'orderData': 2, 'targets': 1 }
|
||||
],
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
].concat($.fn.dataTable.defaults.columnDefs),
|
||||
select: {
|
||||
style: 'single',
|
||||
selector: 'tr td:not(:first-child)'
|
||||
|
@@ -7,7 +7,7 @@ var shoppingListTable = $('#shoppinglist-table').DataTable({
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
{ 'visible': false, 'targets': 3 }
|
||||
],
|
||||
].concat($.fn.dataTable.defaults.columnDefs),
|
||||
'rowGroup': {
|
||||
dataSrc: 3,
|
||||
startRender: function(rows, group)
|
||||
|
@@ -3,7 +3,7 @@ var locationsTable = $('#shoppinglocations-table').DataTable({
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#shoppinglocations-table tbody').removeClass("d-none");
|
||||
locationsTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
],
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#stockentries-table tbody').removeClass("d-none");
|
||||
stockEntriesTable.columns.adjust().draw();
|
||||
|
@@ -4,7 +4,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#stock-journal-table tbody').removeClass("d-none");
|
||||
stockJournalTable.columns.adjust().draw();
|
||||
|
@@ -4,7 +4,7 @@ var journalSummaryTable = $('#stock-journal-summary-table').DataTable({
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#stock-journal-summary-table tbody').removeClass("d-none");
|
||||
journalSummaryTable.columns.adjust().draw();
|
||||
|
@@ -11,7 +11,7 @@
|
||||
{ 'visible': false, 'targets': 4 },
|
||||
{ 'visible': false, 'targets': 9 },
|
||||
{ 'visible': false, 'targets': 10 }
|
||||
],
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
|
||||
$('#stock-overview-table tbody').removeClass("d-none");
|
||||
@@ -106,7 +106,7 @@ $(document).on('click', '.product-consume-button', function(e)
|
||||
var originalTotalStockAmount = $(e.currentTarget).attr('data-original-total-stock-amount');
|
||||
var wasSpoiled = $(e.currentTarget).hasClass("product-consume-button-spoiled");
|
||||
|
||||
Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount, 'spoiled': wasSpoiled },
|
||||
Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount, 'spoiled': wasSpoiled, 'allow_subproduct_substitution': true },
|
||||
function(bookingResponse)
|
||||
{
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
@@ -162,7 +162,7 @@ $(document).on('click', '.product-open-button', function(e)
|
||||
var amount = $(e.currentTarget).attr('data-open-amount');
|
||||
var button = $(e.currentTarget);
|
||||
|
||||
Grocy.Api.Post('stock/products/' + productId + '/open', { 'amount': amount },
|
||||
Grocy.Api.Post('stock/products/' + productId + '/open', { 'amount': amount, 'allow_subproduct_substitution': true },
|
||||
function(bookingResponse)
|
||||
{
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#taskcategories-table tbody').removeClass("d-none");
|
||||
categoriesTable.columns.adjust().draw();
|
||||
|
@@ -4,7 +4,7 @@
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 },
|
||||
{ 'visible': false, 'targets': 3 }
|
||||
],
|
||||
].concat($.fn.dataTable.defaults.columnDefs),
|
||||
'rowGroup': {
|
||||
dataSrc: 3
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#userentities-table tbody').removeClass("d-none");
|
||||
userentitiesTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#userfields-table tbody').removeClass("d-none");
|
||||
userfieldsTable.columns.adjust().draw();
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#userobjects-table tbody').removeClass("d-none");
|
||||
userobjectsTable.columns.adjust().draw();
|
||||
|
@@ -24,15 +24,16 @@ $('#permission-save').click(
|
||||
{
|
||||
return $(this).data('perm-id');
|
||||
}).toArray();
|
||||
Grocy.Api.Put('users/' + Grocy.EditObjectId + '/permissions', {
|
||||
'permissions': permission_list,
|
||||
}, function(result)
|
||||
{
|
||||
toastr.success(__t("Permissions saved"));
|
||||
}, function(xhr)
|
||||
{
|
||||
toastr.error(__t(JSON.parse(xhr.response).error_message));
|
||||
}
|
||||
|
||||
Grocy.Api.Put('users/' + Grocy.EditObjectId + '/permissions', { 'permissions': permission_list },
|
||||
function(result)
|
||||
{
|
||||
toastr.success(__t("Permissions saved"));
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
toastr.error(JSON.parse(xhr.response).error_message);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -51,5 +52,3 @@ if (Grocy.EditObjectId == Grocy.UserId)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
check_hierachy($("input.permission-cb[name=ADMIN]").is(":checked"), "ADMIN");
|
||||
|
@@ -3,7 +3,7 @@
|
||||
'columnDefs': [
|
||||
{ 'orderable': false, 'targets': 0 },
|
||||
{ 'searchable': false, "targets": 0 }
|
||||
]
|
||||
].concat($.fn.dataTable.defaults.columnDefs)
|
||||
});
|
||||
$('#users-table tbody').removeClass("d-none");
|
||||
usersTable.columns.adjust().draw();
|
||||
|
Reference in New Issue
Block a user