mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 12:26:15 +02:00
54 lines
1.1 KiB
JavaScript
54 lines
1.1 KiB
JavaScript
function choresView(Grocy, scope = null)
|
|
{
|
|
var $scope = $;
|
|
if (scope != null)
|
|
{
|
|
$scope = (scope) => $(scope).find(scope);
|
|
}
|
|
|
|
var choresTable = $scope('#chores-table').DataTable({
|
|
'order': [[1, 'asc']],
|
|
'columnDefs': [
|
|
{ 'orderable': false, 'targets': 0 },
|
|
{ 'searchable': false, "targets": 0 }
|
|
].concat($.fn.dataTable.defaults.columnDefs)
|
|
});
|
|
$scope('#chores-table tbody').removeClass("d-none");
|
|
Grocy.FrontendHelpers.InitDataTable(choresTable, null, function()
|
|
{
|
|
$scope("#search").val("");
|
|
choresTable.search("").draw();
|
|
$scope("#show-disabled").prop('checked', false);
|
|
});
|
|
|
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
|
'Are you sure to delete chore "%s"?',
|
|
'.core-delete-button',
|
|
'data-chore-name',
|
|
'data-chore-id',
|
|
'objects/chores/',
|
|
'/chroes'
|
|
);
|
|
|
|
$("#show-disabled").change(function()
|
|
{
|
|
if (this.checked)
|
|
{
|
|
window.location.href = U('/chores?include_disabled');
|
|
}
|
|
else
|
|
{
|
|
window.location.href = U('/chores');
|
|
}
|
|
});
|
|
|
|
if (Grocy.GetUriParam('include_disabled'))
|
|
{
|
|
$scope("#show-disabled").prop('checked', true);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
window.choresView = choresView
|