grocy/js/viewjs/locations.js
Katharina Bogad 2a7fbbecf8 Fix bugs
2021-06-24 22:18:19 +02:00

34 lines
802 B
JavaScript

function locationsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = (selector) => $(scope).find(selector);
}
// preload some views.
Grocy.PreloadView("locationform");
var locationsTable = $scope('#locations-table').DataTable({
'order': [[1, 'asc']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
].concat($.fn.dataTable.defaults.columnDefs)
});
$scope('#locations-table tbody').removeClass("d-none");
Grocy.FrontendHelpers.InitDataTable(locationsTable,);
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'Are you sure to delete location "%s"?',
'.location-delete-button',
'data-location-name',
'data-location-id',
'objects/locations/',
'/locations'
);
}
window.locationsView = locationsView