Apply accentNeutralise() to all DataTable search inputs (fixes #2982)

This commit is contained in:
Bernd Bestel 2026-09-03 16:59:18 +02:00
parent 0cf4d557af
commit b6ee94341a
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
29 changed files with 295 additions and 294 deletions

View File

@ -50,6 +50,7 @@
### General
- Optimized that table dropdown filters now search accent insensitive
- Fixed that it wasn't possible to log in using passwords containing non-latin characters
### API

View File

@ -9,7 +9,7 @@
$('#batteries-table tbody').removeClass("d-none");
batteriesTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -17,17 +17,17 @@ $("#search").on("keyup", Delay(function()
value = "";
}
batteriesTable.search(value).draw();
batteriesTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
batteriesTable.search("").draw();
$("#show-disabled").prop('checked', false);
});
$(document).on('click', '.battery-delete-button', function(e)
$(document).on('click', '.battery-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-battery-name');
var objectId = $(e.currentTarget).attr('data-battery-id');
@ -45,16 +45,16 @@ $(document).on('click', '.battery-delete-button', function(e)
}
},
closeButton: false,
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/batteries/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/batteries');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -64,7 +64,7 @@ $(document).on('click', '.battery-delete-button', function(e)
});
});
$("#show-disabled").change(function()
$("#show-disabled").change(function ()
{
if (this.checked)
{

View File

@ -8,7 +8,7 @@
$('#batteries-journal-table tbody').removeClass("d-none");
batteriesJournalTable.columns.adjust().draw();
$("#battery-filter").on("change", function()
$("#battery-filter").on("change", function ()
{
var value = $(this).val();
if (value === "all")
@ -23,7 +23,7 @@ $("#battery-filter").on("change", function()
window.location.reload();
});
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -31,10 +31,10 @@ $("#search").on("keyup", Delay(function()
value = "";
}
batteriesJournalTable.search(value).draw();
batteriesJournalTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
$("#battery-filter").val("all");
@ -45,7 +45,7 @@ $("#clear-filter-button").on("click", function()
window.location.reload();
});
$("#daterange-filter").on("change", function()
$("#daterange-filter").on("change", function ()
{
UpdateUriParam("months", $(this).val());
window.location.reload();
@ -61,7 +61,7 @@ if (typeof GetUriParam("months") !== "undefined")
$("#daterange-filter").val(GetUriParam("months"));
}
$(document).on('click', '.undo-battery-execution-button', function(e)
$(document).on('click', '.undo-battery-execution-button', function (e)
{
e.preventDefault();
@ -69,7 +69,7 @@ $(document).on('click', '.undo-battery-execution-button', function(e)
var chargeCycleId = $(e.currentTarget).attr('data-charge-cycle-id');
Grocy.Api.Post('batteries/charge-cycles/' + chargeCycleId.toString() + '/undo', {},
function(result)
function (result)
{
element.closest("tr").addClass("text-muted");
element.parent().siblings().find("span.name-anchor").addClass("text-strike-through").after("<br>" + __t("Undone on") + " " + moment().format("YYYY-MM-DD HH:mm:ss") + " <time class='timeago timeago-contextual' datetime='" + moment().format("YYYY-MM-DD HH:mm:ss") + "'></time>");
@ -77,7 +77,7 @@ $(document).on('click', '.undo-battery-execution-button', function(e)
RefreshContextualTimeago("#charge-cycle-" + chargeCycleId + "-row");
toastr.success(__t("Charge cycle successfully undone"));
},
function(xhr)
function (xhr)
{
console.error(xhr);
}

View File

@ -10,7 +10,7 @@
$('#batteries-overview-table tbody').removeClass("d-none");
batteriesOverviewTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -18,10 +18,10 @@ $("#search").on("keyup", Delay(function()
value = "";
}
batteriesOverviewTable.search(value).draw();
batteriesOverviewTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
$("#status-filter").val("all");
@ -29,7 +29,7 @@ $("#clear-filter-button").on("click", function()
batteriesOverviewTable.search("").draw();
});
$("#status-filter").on("change", function()
$("#status-filter").on("change", function ()
{
var value = $(this).val();
if (value === "all")
@ -40,17 +40,17 @@ $("#status-filter").on("change", function()
// Transfer CSS classes of selected element to dropdown element (for background)
$(this).attr("class", $("#" + $(this).attr("id") + " option[value='" + value + "']").attr("class") + " form-control");
batteriesOverviewTable.column(batteriesOverviewTable.colReorder.transpose(5)).search(value).draw();
batteriesOverviewTable.column(batteriesOverviewTable.colReorder.transpose(5)).search(value.accentNeutralise()).draw();
});
$(".status-filter-message").on("click", function()
$(".status-filter-message").on("click", function ()
{
var value = $(this).data("status-filter");
$("#status-filter").val(value);
$("#status-filter").trigger("change");
});
$(document).on('click', '.track-charge-cycle-button', function(e)
$(document).on('click', '.track-charge-cycle-button', function (e)
{
e.preventDefault();
@ -61,10 +61,10 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
Grocy.Api.Post('batteries/' + batteryId + '/charge', { 'tracked_time': trackedTime },
function()
function ()
{
Grocy.Api.Get('batteries/' + batteryId,
function(result)
function (result)
{
var batteryRow = $('#battery-' + batteryId + '-row');
var nextXDaysThreshold = moment().add($("#info-due-soon-batteries").data("next-x-days"), "days");
@ -97,14 +97,14 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
RefreshContextualTimeago("#battery-" + batteryId + "-row");
RefreshStatistics();
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
@ -112,12 +112,12 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
);
});
$(document).on('click', '.battery-grocycode-label-print', function(e)
$(document).on('click', '.battery-grocycode-label-print', function (e)
{
e.preventDefault();
var batteryId = $(e.currentTarget).attr('data-battery-id');
Grocy.Api.Get('batteries/' + batteryId + '/printlabel', function(labelData)
Grocy.Api.Get('batteries/' + batteryId + '/printlabel', function (labelData)
{
if (Grocy.Webhooks.labelprinter !== undefined)
{
@ -130,7 +130,7 @@ function RefreshStatistics()
{
var nextXDays = $("#info-due-soon-batteries").data("next-x-days");
Grocy.Api.Get('batteries',
function(result)
function (result)
{
var dueTodayCount = 0;
var dueSoonCount = 0;
@ -162,7 +162,7 @@ function RefreshStatistics()
$("#info-due-soon-batteries").html('<span class="d-block d-md-none">' + dueSoonCount + ' <i class="fa-solid fa-clock"></i></span><span class="d-none d-md-block">' + __n(dueSoonCount, '%s battery is due to be charged', '%s batteries are due to be charged') + ' ' + __n(nextXDays, 'within the next day', 'within the next %s days'));
$("#info-overdue-batteries").html('<span class="d-block d-md-none">' + overdueCount + ' <i class="fa-solid fa-times-circle"></i></span><span class="d-none d-md-block">' + __n(overdueCount, '%s battery is overdue to be charged', '%s batteries are overdue to be charged'));
},
function(xhr)
function (xhr)
{
console.error(xhr);
}

View File

@ -8,7 +8,7 @@
$('#chores-table tbody').removeClass("d-none");
choresTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,17 +16,17 @@ $("#search").on("keyup", Delay(function()
value = "";
}
choresTable.search(value).draw();
choresTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
choresTable.search("").draw();
$("#show-disabled").prop('checked', false);
});
$(document).on('click', '.chore-delete-button', function(e)
$(document).on('click', '.chore-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-chore-name');
var objectId = $(e.currentTarget).attr('data-chore-id');
@ -44,16 +44,16 @@ $(document).on('click', '.chore-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/chores/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/chores');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -63,7 +63,7 @@ $(document).on('click', '.chore-delete-button', function(e)
});
});
$("#show-disabled").change(function()
$("#show-disabled").change(function ()
{
if (this.checked)
{
@ -80,7 +80,7 @@ if (GetUriParam('include_disabled'))
$("#show-disabled").prop('checked', true);
}
$(".merge-chores-button").on("click", function(e)
$(".merge-chores-button").on("click", function (e)
{
var choreId = $(e.currentTarget).attr("data-chore-id");
$("#merge-chores-keep").val(choreId);
@ -88,7 +88,7 @@ $(".merge-chores-button").on("click", function(e)
$("#merge-chores-modal").modal("show");
});
$("#merge-chores-save-button").on("click", function(e)
$("#merge-chores-save-button").on("click", function (e)
{
e.preventDefault();
@ -101,11 +101,11 @@ $("#merge-chores-save-button").on("click", function(e)
var choreIdToRemove = $("#merge-chores-remove").val();
Grocy.Api.Post("chores/" + choreIdToKeep.toString() + "/merge/" + choreIdToRemove.toString(), {},
function(result)
function (result)
{
window.location.href = U('/chores');
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.ShowGenericError('Error while merging', xhr.response);
}

View File

@ -9,7 +9,7 @@
$('#chores-journal-table tbody').removeClass("d-none");
choresJournalTable.columns.adjust().draw();
$("#chore-filter").on("change", function()
$("#chore-filter").on("change", function ()
{
var value = $(this).val();
if (value === "all")
@ -24,13 +24,13 @@ $("#chore-filter").on("change", function()
window.location.reload();
});
$("#daterange-filter").on("change", function()
$("#daterange-filter").on("change", function ()
{
UpdateUriParam("months", $(this).val());
window.location.reload();
});
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -38,10 +38,10 @@ $("#search").on("keyup", Delay(function()
value = "";
}
choresJournalTable.search(value).draw();
choresJournalTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
$("#daterange-filter").val("24");
@ -66,7 +66,7 @@ if (typeof GetUriParam("months") !== "undefined")
$("#daterange-filter").val(GetUriParam("months"));
}
$(document).on('click', '.undo-chore-execution-button', function(e)
$(document).on('click', '.undo-chore-execution-button', function (e)
{
e.preventDefault();
@ -74,7 +74,7 @@ $(document).on('click', '.undo-chore-execution-button', function(e)
var executionId = $(e.currentTarget).attr('data-execution-id');
Grocy.Api.Post('chores/executions/' + executionId.toString() + '/undo', {},
function(result)
function (result)
{
element.closest("tr").addClass("text-muted");
element.parent().siblings().find("span.name-anchor").addClass("text-strike-through").after("<br>" + __t("Undone on") + " " + moment().format("YYYY-MM-DD HH:mm:ss") + " <time class='timeago timeago-contextual' datetime='" + moment().format("YYYY-MM-DD HH:mm:ss") + "'></time>");
@ -82,7 +82,7 @@ $(document).on('click', '.undo-chore-execution-button', function(e)
RefreshContextualTimeago("#chore-execution-" + executionId + "-row");
toastr.success(__t("Chore execution successfully undone"));
},
function(xhr)
function (xhr)
{
console.error(xhr);
}

View File

@ -11,7 +11,7 @@
$('#chores-overview-table tbody').removeClass("d-none");
choresOverviewTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -19,10 +19,10 @@ $("#search").on("keyup", Delay(function()
value = "";
}
choresOverviewTable.search(value).draw();
choresOverviewTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#status-filter").on("change", function()
$("#status-filter").on("change", function ()
{
var value = $(this).val();
if (value === "all")
@ -33,10 +33,10 @@ $("#status-filter").on("change", function()
// Transfer CSS classes of selected element to dropdown element (for background)
$(this).attr("class", $("#" + $(this).attr("id") + " option[value='" + value + "']").attr("class") + " form-control");
choresOverviewTable.column(choresOverviewTable.colReorder.transpose(5)).search(value).draw();
choresOverviewTable.column(choresOverviewTable.colReorder.transpose(5)).search(value.accentNeutralise()).draw();
});
$("#user-filter").on("change", function()
$("#user-filter").on("change", function ()
{
var value = $(this).val();
if (value === "all")
@ -47,7 +47,7 @@ $("#user-filter").on("change", function()
// Transfer CSS classes of selected element to dropdown element (for background)
$(this).attr("class", $("#" + $(this).attr("id") + " option[value='" + value + "']").attr("class") + " form-control");
choresOverviewTable.column(choresOverviewTable.colReorder.transpose(6)).search(value).draw();
choresOverviewTable.column(choresOverviewTable.colReorder.transpose(6)).search(value.accentNeutralise()).draw();
if (value)
{
@ -55,7 +55,7 @@ $("#user-filter").on("change", function()
}
});
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
$("#status-filter").val("all");
@ -66,21 +66,21 @@ $("#clear-filter-button").on("click", function()
RemoveUriParam("user");
});
$(".status-filter-message").on("click", function()
$(".status-filter-message").on("click", function ()
{
var value = $(this).data("status-filter");
$("#status-filter").val(value);
$("#status-filter").trigger("change");
});
$(".user-filter-message").on("click", function()
$(".user-filter-message").on("click", function ()
{
var value = $(this).data("user-filter");
$("#user-filter").val(value);
$("#user-filter").trigger("change");
});
$(document).on('click', '.track-chore-button', function(e)
$(document).on('click', '.track-chore-button', function (e)
{
e.preventDefault();
@ -92,7 +92,7 @@ $(document).on('click', '.track-chore-button', function(e)
var now = $(e.currentTarget).hasClass("now");
Grocy.Api.Get('chores/' + choreId,
function(choreDetails)
function (choreDetails)
{
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
if ((skipped || !now) && choreDetails.next_estimated_execution_time != null)
@ -113,10 +113,10 @@ $(document).on('click', '.track-chore-button', function(e)
}
Grocy.Api.Post('chores/' + choreId + '/execute', { 'tracked_time': trackedTime, 'skipped': skipped },
function()
function ()
{
Grocy.Api.Get('chores/' + choreId,
function(result)
function (result)
{
var choreRow = $('#chore-' + choreId + '-row');
var nextXDaysThreshold = moment().add($("#info-due-soon-chores").data("next-x-days"), "days");
@ -177,7 +177,7 @@ $(document).on('click', '.track-chore-button', function(e)
RefreshStatistics();
// Delay due to delayed/animated set of new timestamps above
setTimeout(function()
setTimeout(function ()
{
RefreshContextualTimeago("#chore-" + choreId + "-row");
@ -186,21 +186,21 @@ $(document).on('click', '.track-chore-button', function(e)
$(".input-group-filter").trigger("change");
}, Grocy.FormFocusDelay);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy("choretracking-form");
console.error(xhr);
@ -208,12 +208,12 @@ $(document).on('click', '.track-chore-button', function(e)
);
});
$(document).on('click', '.chore-grocycode-label-print', function(e)
$(document).on('click', '.chore-grocycode-label-print', function (e)
{
e.preventDefault();
var choreId = $(e.currentTarget).attr('data-chore-id');
Grocy.Api.Get('chores/' + choreId + '/printlabel', function(labelData)
Grocy.Api.Get('chores/' + choreId + '/printlabel', function (labelData)
{
if (Grocy.Webhooks.labelprinter !== undefined)
{
@ -226,7 +226,7 @@ function RefreshStatistics()
{
var nextXDays = $("#info-due-soon-chores").data("next-x-days");
Grocy.Api.Get('chores',
function(result)
function (result)
{
var dueTodayCount = 0;
var dueSoonCount = 0;
@ -265,20 +265,20 @@ function RefreshStatistics()
$("#info-overdue-chores").html('<span class="d-block d-md-none">' + overdueCount + ' <i class="fa-solid fa-times-circle"></i></span><span class="d-none d-md-block">' + __n(overdueCount, '%s chore is overdue to be done', '%s chores are overdue to be done'));
$("#info-assigned-to-me-chores").html('<span class="d-block d-md-none">' + assignedToMeCount + ' <i class="fa-solid fa-exclamation-circle"></i></span><span class="d-none d-md-block">' + __n(assignedToMeCount, '%s chore is assigned to me', '%s chores are assigned to me'));
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
);
}
$(document).on("click", ".reschedule-chore-button", function(e)
$(document).on("click", ".reschedule-chore-button", function (e)
{
e.preventDefault();
var choreId = $(e.currentTarget).attr("data-chore-id");
Grocy.EditObjectId = choreId;
Grocy.Api.Get("chores/" + choreId, function(choreDetails)
Grocy.Api.Get("chores/" + choreId, function (choreDetails)
{
var prefillDate = choreDetails.next_estimated_execution_time || moment().format("YYYY-MM-DD HH:mm:ss");
if (choreDetails.chore.rescheduled_date)
@ -316,7 +316,7 @@ $(document).on("click", ".reschedule-chore-button", function(e)
});
});
$("#reschedule-chore-save-button").on("click", function(e)
$("#reschedule-chore-save-button").on("click", function (e)
{
e.preventDefault();
@ -326,45 +326,45 @@ $("#reschedule-chore-save-button").on("click", function(e)
}
Grocy.Api.Put('objects/chores/' + Grocy.EditObjectId, { "rescheduled_date": Grocy.Components.DateTimePicker.GetValue(), "rescheduled_next_execution_assigned_to_user_id": Grocy.Components.UserPicker.GetValue() },
function(result)
function (result)
{
Grocy.Api.Post('chores/executions/calculate-next-assignments', { "chore_id": Grocy.EditObjectId },
function(result)
function (result)
{
window.location.reload();
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response);
}
);
});
$("#reschedule-chore-clear-button").on("click", function(e)
$("#reschedule-chore-clear-button").on("click", function (e)
{
e.preventDefault();
Grocy.Api.Put('objects/chores/' + Grocy.EditObjectId, { "rescheduled_date": null, "rescheduled_next_execution_assigned_to_user_id": null },
function(result)
function (result)
{
Grocy.Api.Post('chores/executions/calculate-next-assignments', { "chore_id": Grocy.EditObjectId },
function(result)
function (result)
{
window.location.reload();
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response);
}

View File

@ -104,7 +104,7 @@ $("#search").on("keyup", Delay(function ()
value = "";
}
equipmentTable.search(value).draw();
equipmentTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function ()

View File

@ -8,7 +8,7 @@
$('#locations-table tbody').removeClass("d-none");
locationsTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
locationsTable.search(value).draw();
locationsTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
locationsTable.search("").draw();
});
$(document).on('click', '.location-delete-button', function(e)
$(document).on('click', '.location-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-location-name');
var objectId = $(e.currentTarget).attr('data-location-id');
@ -43,16 +43,16 @@ $(document).on('click', '.location-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/locations/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/locations');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -62,7 +62,7 @@ $(document).on('click', '.location-delete-button', function(e)
});
});
$("#show-disabled").change(function()
$("#show-disabled").change(function ()
{
if (this.checked)
{

View File

@ -8,7 +8,7 @@
$('#apikeys-table tbody').removeClass("d-none");
apiKeysTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
apiKeysTable.search(value).draw();
apiKeysTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
apiKeysTable.search("").draw();
});
$(document).on('click', '.apikey-delete-button', function(e)
$(document).on('click', '.apikey-delete-button', function (e)
{
var button = $(e.currentTarget);
var objectName = button.attr('data-apikey-key');
@ -51,16 +51,16 @@ $(document).on('click', '.apikey-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/api_keys/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/manageapikeys');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -70,7 +70,7 @@ $(document).on('click', '.apikey-delete-button', function(e)
});
});
$(".apikey-show-qr-button").on("click", function()
$(".apikey-show-qr-button").on("click", function ()
{
var button = $(this);
var apiKey = button.data("apikey-key");
@ -89,20 +89,20 @@ $(".apikey-show-qr-button").on("click", function()
});
});
$("#add-api-key-button").on("click", function(e)
$("#add-api-key-button").on("click", function (e)
{
$("#add-api-key-modal").modal("show");
});
$("#add-api-key-modal").on("shown.bs.modal", function(e)
$("#add-api-key-modal").on("shown.bs.modal", function (e)
{
setTimeout(function()
setTimeout(function ()
{
$("#description").focus();
}, Grocy.FormFocusDelay);
});
$("#new-api-key-button").on("click", function(e)
$("#new-api-key-button").on("click", function (e)
{
window.location.href = U("/manageapikeys/new?description=" + encodeURIComponent($("#description").val()));
});

View File

@ -16,7 +16,7 @@ $("#search").on("keyup", Delay(function ()
value = "";
}
sessionsTable.search(value).draw();
sessionsTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function ()

View File

@ -8,7 +8,7 @@
$('#mealplansections-table tbody').removeClass("d-none");
mealplanSectionsTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
mealplanSectionsTable.search(value).draw();
mealplanSectionsTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
mealplanSectionsTable.search("").draw();
});
$(document).on('click', '.mealplansection-delete-button', function(e)
$(document).on('click', '.mealplansection-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-mealplansection-name');
var objectId = $(e.currentTarget).attr('data-mealplansection-id');
@ -43,16 +43,16 @@ $(document).on('click', '.mealplansection-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/meal_plan_sections/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/mealplansections');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}

View File

@ -8,7 +8,7 @@
$('#productgroups-table tbody').removeClass("d-none");
groupsTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
groupsTable.search(value).draw();
groupsTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
groupsTable.search("").draw();
});
$(document).on('click', '.product-group-delete-button', function(e)
$(document).on('click', '.product-group-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-group-name');
var objectId = $(e.currentTarget).attr('data-group-id');
@ -43,16 +43,16 @@ $(document).on('click', '.product-group-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/product_groups/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/productgroups');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -61,7 +61,7 @@ $(document).on('click', '.product-group-delete-button', function(e)
}
});
});
$(window).on("message", function(e)
$(window).on("message", function (e)
{
var data = e.originalEvent.data;
@ -71,7 +71,7 @@ $(window).on("message", function(e)
}
});
$("#show-disabled").change(function()
$("#show-disabled").change(function ()
{
if (this.checked)
{

View File

@ -20,7 +20,7 @@ $("#search").on("keyup", Delay(function ()
value = "";
}
productsTable.search(value).draw();
productsTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#product-group-filter").on("change", function ()
@ -32,7 +32,7 @@ $("#product-group-filter").on("change", function ()
}
else
{
productsTable.column(productsTable.colReorder.transpose(6)).search("^" + $.fn.dataTable.util.escapeRegex(value) + "$", true, false).draw();
productsTable.column(productsTable.colReorder.transpose(6)).search("^" + $.fn.dataTable.util.escapeRegex(value.accentNeutralise()) + "$", true, false).draw();
}
});

View File

@ -8,7 +8,7 @@
$('#qu-conversions-resolved-table tbody').removeClass("d-none");
quConversionsResolvedTable.columns.adjust().draw();
$("#quantity-unit-filter").on("change", function()
$("#quantity-unit-filter").on("change", function ()
{
var value = $("#quantity-unit-filter option:selected").text();
if (value === __t("All"))
@ -16,10 +16,10 @@ $("#quantity-unit-filter").on("change", function()
value = "";
}
quConversionsResolvedTable.column([quConversionsResolvedTable.colReorder.transpose(1), quConversionsResolvedTable.colReorder.transpose(2)]).search(value).draw();
quConversionsResolvedTable.column([quConversionsResolvedTable.colReorder.transpose(1), quConversionsResolvedTable.colReorder.transpose(2)]).search(value.accentNeutralise()).draw();
});
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#quantity-unit-filter").val("all");
quConversionsResolvedTable.column([quConversionsResolvedTable.colReorder.transpose(1), quConversionsResolvedTable.colReorder.transpose(2)]).search("").draw();

View File

@ -8,7 +8,7 @@
$('#quantityunits-table tbody').removeClass("d-none");
quantityUnitsTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
quantityUnitsTable.search(value).draw();
quantityUnitsTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
quantityUnitsTable.search("").draw();
});
$(document).on('click', '.quantityunit-delete-button', function(e)
$(document).on('click', '.quantityunit-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-quantityunit-name');
var objectId = $(e.currentTarget).attr('data-quantityunit-id');
@ -43,16 +43,16 @@ $(document).on('click', '.quantityunit-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/quantity_units/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/quantityunits');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -62,7 +62,7 @@ $(document).on('click', '.quantityunit-delete-button', function(e)
});
});
$("#show-disabled").change(function()
$("#show-disabled").change(function ()
{
if (this.checked)
{

View File

@ -11,7 +11,7 @@
style: 'single',
selector: 'tr td:not(:first-child)'
},
'initComplete': function()
'initComplete': function ()
{
this.api().row({ order: 'current' }, 0).select();
}
@ -44,7 +44,7 @@ if (typeof recipe !== "undefined")
if (GetUriParam("search") !== undefined)
{
$("#search").val(GetUriParam("search"));
setTimeout(function()
setTimeout(function ()
{
$("#search").keyup();
}, 50);
@ -53,23 +53,23 @@ if (GetUriParam("search") !== undefined)
if (GetUriParam("status") !== undefined)
{
$("#status-filter").val(GetUriParam("status"));
setTimeout(function()
setTimeout(function ()
{
$("#status-filter").trigger("change");
}, 50);
}
$("a[data-toggle='tab']").on("shown.bs.tab", function(e)
$("a[data-toggle='tab']").on("shown.bs.tab", function (e)
{
var tabId = $(e.target).attr("id");
window.localStorage.setItem("recipes_last_tab_id", tabId);
});
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
recipesTables.search(value).draw();
recipesTables.search(value.accentNeutralise()).draw();
if (!value)
{
@ -84,7 +84,7 @@ $("#search").on("keyup", Delay(function()
$(".recipe-gallery-item .card-title-search:not(:contains_case_insensitive(" + value + "))").parent().parent().parent().addClass("d-none");
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
$("#status-filter").val("all");
@ -92,7 +92,7 @@ $("#clear-filter-button").on("click", function()
$("#status-filter").trigger("change");
});
$("#status-filter").on("change", function()
$("#status-filter").on("change", function ()
{
var value = $(this).val();
if (value === "all")
@ -100,7 +100,7 @@ $("#status-filter").on("change", function()
value = "";
}
recipesTables.column(recipesTables.colReorder.transpose(6)).search(value).draw();
recipesTables.column(recipesTables.colReorder.transpose(6)).search(value.accentNeutralise()).draw();
$('.recipe-gallery-item').removeClass('d-none');
if (value !== "")
@ -129,7 +129,7 @@ $("#status-filter").on("change", function()
}
});
$(".recipe-delete").on('click', function(e)
$(".recipe-delete").on('click', function (e)
{
e.preventDefault();
@ -149,16 +149,16 @@ $(".recipe-delete").on('click', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/recipes/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/recipes');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -168,25 +168,25 @@ $(".recipe-delete").on('click', function(e)
});
});
$(".recipe-copy").on('click', function(e)
$(".recipe-copy").on('click', function (e)
{
e.preventDefault();
var objectId = $(e.currentTarget).attr('data-recipe-id');
Grocy.Api.Post("recipes/" + objectId.toString() + "/copy", {},
function(result)
function (result)
{
window.location.href = U('/recipes?recipe=' + result.created_object_id.toString());
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response);
}
);
});
$(document).on('click', '.recipe-shopping-list', function(e)
$(document).on('click', '.recipe-shopping-list', function (e)
{
var objectName = $(e.currentTarget).attr('data-recipe-name');
var objectId = $(e.currentTarget).attr('data-recipe-id');
@ -204,24 +204,24 @@ $(document).on('click', '.recipe-shopping-list', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.FrontendHelpers.BeginUiBusy();
var excludedProductIds = new Array();
$(".missing-recipe-pos-product-checkbox:checkbox:not(:checked)").each(function()
$(".missing-recipe-pos-product-checkbox:checkbox:not(:checked)").each(function ()
{
excludedProductIds.push($(this).data("product-id"));
});
Grocy.Api.Post('recipes/' + objectId + '/add-not-fulfilled-products-to-shoppinglist', { "excludedProductIds": excludedProductIds },
function(result)
function (result)
{
window.location.reload();
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
@ -232,7 +232,7 @@ $(document).on('click', '.recipe-shopping-list', function(e)
});
});
$(".recipe-consume").on('click', function(e)
$(".recipe-consume").on('click', function (e)
{
var objectName = $(e.currentTarget).attr('data-recipe-name');
var objectId = $(e.currentTarget).attr('data-recipe-id');
@ -251,19 +251,19 @@ $(".recipe-consume").on('click', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.FrontendHelpers.BeginUiBusy();
Grocy.Api.Post('recipes/' + objectId + '/consume', {},
function(result)
function (result)
{
Grocy.FrontendHelpers.EndUiBusy();
toastr.success(__t('Removed all in stock ingredients needed by recipe \"%s\" from stock', objectName));
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
Grocy.FrontendHelpers.ShowGenericError("A server error occured while processing your request", xhr.response);
@ -274,7 +274,7 @@ $(".recipe-consume").on('click', function(e)
});
});
recipesTables.on('select', function(e, dt, type, indexes)
recipesTables.on('select', function (e, dt, type, indexes)
{
if (type === 'row')
{
@ -302,7 +302,7 @@ recipesTables.on('select', function(e, dt, type, indexes)
cancel: {
label: __t('Close'),
className: 'btn-secondary responsive-button',
callback: function()
callback: function ()
{
$(".modal").last().modal("hide");
}
@ -313,7 +313,7 @@ recipesTables.on('select', function(e, dt, type, indexes)
}
});
$(".recipe-gallery-item").on("click", function(e)
$(".recipe-gallery-item").on("click", function (e)
{
e.preventDefault();
@ -336,7 +336,7 @@ $(".recipe-gallery-item").on("click", function(e)
cancel: {
label: __t('Close'),
className: 'btn-secondary responsive-button',
callback: function()
callback: function ()
{
$(".modal").last().modal("hide");
}
@ -346,12 +346,12 @@ $(".recipe-gallery-item").on("click", function(e)
}
});
$(".recipe-edit-button").on("click", function(e)
$(".recipe-edit-button").on("click", function (e)
{
e.stopPropagation();
});
$(".recipe-fullscreen").on('click', function(e)
$(".recipe-fullscreen").on('click', function (e)
{
e.preventDefault();
@ -374,7 +374,7 @@ $(".recipe-fullscreen").on('click', function(e)
}
});
$(".recipe-print").on('click', function(e)
$(".recipe-print").on('click', function (e)
{
e.preventDefault();
@ -387,24 +387,24 @@ $(".recipe-print").on('click', function(e)
window.print();
});
$('#servings-scale').keyup(function(event)
$('#servings-scale').keyup(function (event)
{
var data = {};
data.desired_servings = $(this).val();
Grocy.Api.Put('objects/recipes/' + $(this).data("recipe-id"), data,
function(result)
function (result)
{
window.location.reload();
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
);
});
$(document).on("click", ".missing-recipe-pos-select-button", function(e)
$(document).on("click", ".missing-recipe-pos-select-button", function (e)
{
e.preventDefault();
@ -414,7 +414,7 @@ $(document).on("click", ".missing-recipe-pos-select-button", function(e)
$(this).toggleClass("list-group-item-primary");
});
$(document).on("click", ".missing-recipe-pos-product-checkbox", function(e)
$(document).on("click", ".missing-recipe-pos-product-checkbox", function (e)
{
e.stopPropagation();
@ -427,12 +427,12 @@ if (window.location.hash === "#fullscreen")
$("#selectedRecipeToggleFullscreenButton").click();
}
$(document).on('click', '.recipe-grocycode-label-print', function(e)
$(document).on('click', '.recipe-grocycode-label-print', function (e)
{
e.preventDefault();
var recipeId = $(e.currentTarget).attr('data-recipe-id');
Grocy.Api.Get('recipes/' + recipeId + '/printlabel', function(labelData)
Grocy.Api.Get('recipes/' + recipeId + '/printlabel', function (labelData)
{
if (Grocy.Webhooks.labelprinter !== undefined)
{
@ -441,14 +441,14 @@ $(document).on('click', '.recipe-grocycode-label-print', function(e)
});
});
$(document).on('click', '.ingredient-done-button', function(e)
$(document).on('click', '.ingredient-done-button', function (e)
{
e.preventDefault();
$(e.currentTarget).parent().toggleClass("text-strike-through").toggleClass("text-muted");
});
$(document).on("click", ".add-to-mealplan-button", function(e)
$(document).on("click", ".add-to-mealplan-button", function (e)
{
Grocy.Components.DateTimePicker.Init(true);
Grocy.Components.DateTimePicker.SetValue(moment().format("YYYY-MM-DD"));
@ -461,7 +461,7 @@ $(document).on("click", ".add-to-mealplan-button", function(e)
$("#recipe_servings").focus();
});
$('#save-add-to-mealplan-button').on('click', function(e)
$('#save-add-to-mealplan-button').on('click', function (e)
{
e.preventDefault();
@ -474,19 +474,19 @@ $('#save-add-to-mealplan-button').on('click', function(e)
formData.day = Grocy.Components.DateTimePicker.GetValue();
Grocy.Api.Post('objects/meal_plan', formData,
function(result)
function (result)
{
toastr.success(__t("Successfully added the recipe to the meal plan"));
$("#add-to-mealplan-modal").modal("hide");
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response);
}
);
});
$('#add-to-mealplan-form input').keydown(function(event)
$('#add-to-mealplan-form input').keydown(function (event)
{
if (event.keyCode === 13) // Enter
{

View File

@ -43,7 +43,7 @@ $("#search").on("keyup", Delay(function ()
value = "";
}
shoppingListTable.search(value).draw();
shoppingListTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function ()
@ -65,7 +65,7 @@ $("#status-filter").on("change", function ()
// Transfer CSS classes of selected element to dropdown element (for background)
$(this).attr("class", $("#" + $(this).attr("id") + " option[value='" + value + "']").attr("class") + " form-control");
shoppingListTable.column(shoppingListTable.colReorder.transpose(4)).search(value).draw();
shoppingListTable.column(shoppingListTable.colReorder.transpose(4)).search(value.accentNeutralise()).draw();
});
$("#selected-shopping-list").on("change", function ()

View File

@ -8,7 +8,7 @@ var locationsTable = $('#shoppinglocations-table').DataTable({
$('#shoppinglocations-table tbody').removeClass("d-none");
locationsTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
locationsTable.search(value).draw();
locationsTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
locationsTable.search("").draw();
});
$(document).on('click', '.shoppinglocation-delete-button', function(e)
$(document).on('click', '.shoppinglocation-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-shoppinglocation-name');
var objectId = $(e.currentTarget).attr('data-shoppinglocation-id');
@ -43,16 +43,16 @@ $(document).on('click', '.shoppinglocation-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/shopping_locations/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/shoppinglocations');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -62,7 +62,7 @@ $(document).on('click', '.shoppinglocation-delete-button', function(e)
});
});
$("#show-disabled").change(function()
$("#show-disabled").change(function ()
{
if (this.checked)
{

View File

@ -15,7 +15,7 @@
$('#stockentries-table tbody').removeClass("d-none");
stockEntriesTable.columns.adjust().draw();
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
$.fn.dataTable.ext.search.push(function (settings, data, dataIndex)
{
var productId = Grocy.Components.ProductPicker.GetValue();
@ -27,7 +27,7 @@ $.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
return false;
});
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#location-filter").val("all");
$("#location-filter").trigger("change");
@ -40,7 +40,7 @@ $("#clear-filter-button").on("click", function()
stockEntriesTable.draw();
});
$("#location-filter").on("change", function()
$("#location-filter").on("change", function ()
{
var value = $(this).val();
var text = $("#location-filter option:selected").text();
@ -49,20 +49,20 @@ $("#location-filter").on("change", function()
text = "";
}
stockEntriesTable.column(stockEntriesTable.colReorder.transpose(5)).search(text).draw();
stockEntriesTable.column(stockEntriesTable.colReorder.transpose(5)).search(text.accentNeutralise()).draw();
});
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
Grocy.Components.ProductPicker.GetPicker().on('change', function (e)
{
stockEntriesTable.draw();
});
Grocy.Components.ProductPicker.GetInputElement().on('keyup', function(e)
Grocy.Components.ProductPicker.GetInputElement().on('keyup', function (e)
{
stockEntriesTable.draw();
});
$(document).on('click', '.stock-consume-button', function(e)
$(document).on('click', '.stock-consume-button', function (e)
{
e.preventDefault();
@ -77,10 +77,10 @@ $(document).on('click', '.stock-consume-button', function(e)
var wasSpoiled = $(e.currentTarget).hasClass("stock-consume-button-spoiled");
Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount, 'spoiled': wasSpoiled, 'location_id': locationId, 'stock_entry_id': specificStockEntryId, 'exact_amount': true },
function(bookingResponse)
function (bookingResponse)
{
Grocy.Api.Get('stock/products/' + productId,
function(result)
function (result)
{
var toastMessage = __t('Removed %1$s of %2$s from stock', consumeAmount.toLocaleString({ minimumFractionDigits: 0, maximumFractionDigits: Grocy.UserSettings.stock_decimal_places_amounts }) + " " + __n(consumeAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural, true), result.product.name);
if (wasSpoiled)
@ -94,14 +94,14 @@ $(document).on('click', '.stock-consume-button', function(e)
toastr.success(toastMessage);
Grocy.GetTopmostWindow().postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", productId)), Grocy.BaseUrl);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
@ -109,7 +109,7 @@ $(document).on('click', '.stock-consume-button', function(e)
);
});
$(document).on('click', '.product-open-button', function(e)
$(document).on('click', '.product-open-button', function (e)
{
e.preventDefault();
@ -122,10 +122,10 @@ $(document).on('click', '.product-open-button', function(e)
var button = $(e.currentTarget);
Grocy.Api.Post('stock/products/' + productId + '/open', { 'amount': openAmount, 'stock_entry_id': specificStockEntryId },
function(bookingResponse)
function (bookingResponse)
{
Grocy.Api.Get('stock/products/' + productId,
function(result)
function (result)
{
button.addClass("disabled");
Grocy.FrontendHelpers.EndUiBusy();
@ -139,14 +139,14 @@ $(document).on('click', '.product-open-button', function(e)
RefreshStockEntryRow(stockRowId);
Grocy.GetTopmostWindow().postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", productId)), Grocy.BaseUrl);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
}
);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
@ -154,12 +154,12 @@ $(document).on('click', '.product-open-button', function(e)
);
});
$(document).on('click', '.stockentry-grocycode-label-print', function(e)
$(document).on('click', '.stockentry-grocycode-label-print', function (e)
{
e.preventDefault();
var stockId = $(e.currentTarget).attr('data-stock-id');
Grocy.Api.Get('stock/entry/' + stockId + '/printlabel', function(labelData)
Grocy.Api.Get('stock/entry/' + stockId + '/printlabel', function (labelData)
{
if (Grocy.Webhooks.labelprinter !== undefined)
{
@ -171,7 +171,7 @@ $(document).on('click', '.stockentry-grocycode-label-print', function(e)
function RefreshStockEntryRow(stockRowId)
{
Grocy.Api.Get("stock/entry/" + stockRowId,
function(result)
function (result)
{
var stockRow = $('#stock-' + stockRowId + '-row');
@ -183,7 +183,7 @@ function RefreshStockEntryRow(stockRowId)
if (result == null || result.amount == 0)
{
animateCSS("#stock-" + stockRowId + "-row", "fadeOut", function()
animateCSS("#stock-" + stockRowId + "-row", "fadeOut", function ()
{
$("#stock-" + stockRowId + "-row").addClass("d-none");
});
@ -225,21 +225,21 @@ function RefreshStockEntryRow(stockRowId)
var locationName = "";
Grocy.Api.Get("objects/locations/" + result.location_id,
function(locationResult)
function (locationResult)
{
locationName = locationResult.name;
$('#stock-' + stockRowId + '-location').attr('data-location-id', result.location_id);
$('#stock-' + stockRowId + '-location').text(locationName);
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
);
Grocy.Api.Get("stock/products/" + result.product_id,
function(productDetails)
function (productDetails)
{
if (!result.price)
{
@ -254,7 +254,7 @@ function RefreshStockEntryRow(stockRowId)
$(".product-open-button[data-stockrow-id='" + stockRowId + "']").addClass("disabled");
}
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -268,14 +268,14 @@ function RefreshStockEntryRow(stockRowId)
{
var shoppingLocationName = "";
Grocy.Api.Get("objects/shopping_locations/" + result.shopping_location_id,
function(shoppingLocationResult)
function (shoppingLocationResult)
{
shoppingLocationName = shoppingLocationResult.name;
$('#stock-' + stockRowId + '-shopping-location').attr('data-shopping-location-id', result.location_id);
$('#stock-' + stockRowId + '-shopping-location').text(shoppingLocationName);
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -298,13 +298,13 @@ function RefreshStockEntryRow(stockRowId)
}
// Needs to be delayed because of the animation above the date-text would be wrong if fired immediately...
setTimeout(function()
setTimeout(function ()
{
RefreshContextualTimeago("#stock-" + stockRowId + "-row");
RefreshLocaleNumberDisplay("#stock-" + stockRowId + "-row");
}, Grocy.FormFocusDelay);
},
function(xhr)
function (xhr)
{
Grocy.FrontendHelpers.EndUiBusy();
console.error(xhr);
@ -312,13 +312,13 @@ function RefreshStockEntryRow(stockRowId)
);
}
$(window).on("message", function(e)
$(window).on("message", function (e)
{
var data = e.originalEvent.data;
if (data.Message == "ProductChanged")
{
$(".stock-consume-button[data-product-id='" + data.Payload + "']").each(function()
$(".stock-consume-button[data-product-id='" + data.Payload + "']").each(function ()
{
RefreshStockEntryRow($(this).attr("data-stockrow-id"));
});
@ -330,12 +330,12 @@ Grocy.Components.ProductPicker.GetPicker().trigger('change');
function UndoStockBookingEntry(bookingId, stockRowId, productId)
{
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
function(result)
function (result)
{
Grocy.GetTopmostWindow().postMessage(WindowMessageBag("BroadcastMessage", WindowMessageBag("ProductChanged", productId)), Grocy.BaseUrl);
toastr.success(__t("Booking successfully undone"));
},
function(xhr)
function (xhr)
{
console.error(xhr);
}

View File

@ -8,7 +8,7 @@
$('#stock-journal-table tbody').removeClass("d-none");
stockJournalTable.columns.adjust().draw();
$("#product-filter").on("change", function()
$("#product-filter").on("change", function ()
{
var value = $(this).val();
if (value === "all")
@ -23,7 +23,7 @@ $("#product-filter").on("change", function()
window.location.reload();
});
$("#transaction-type-filter").on("change", function()
$("#transaction-type-filter").on("change", function ()
{
var value = $(this).val();
var text = $("#transaction-type-filter option:selected").text();
@ -32,10 +32,10 @@ $("#transaction-type-filter").on("change", function()
text = "";
}
stockJournalTable.column(stockJournalTable.colReorder.transpose(4)).search(text).draw();
stockJournalTable.column(stockJournalTable.colReorder.transpose(4)).search(text.accentNeutralise()).draw();
});
$("#location-filter").on("change", function()
$("#location-filter").on("change", function ()
{
var value = $(this).val();
var text = $("#location-filter option:selected").text();
@ -44,10 +44,10 @@ $("#location-filter").on("change", function()
text = "";
}
stockJournalTable.column(stockJournalTable.colReorder.transpose(5)).search(text).draw();
stockJournalTable.column(stockJournalTable.colReorder.transpose(5)).search(text.accentNeutralise()).draw();
});
$("#user-filter").on("change", function()
$("#user-filter").on("change", function ()
{
var value = $(this).val();
var text = $("#user-filter option:selected").text();
@ -56,16 +56,16 @@ $("#user-filter").on("change", function()
text = "";
}
stockJournalTable.column(stockJournalTable.colReorder.transpose(6)).search(text).draw();
stockJournalTable.column(stockJournalTable.colReorder.transpose(6)).search(text.accentNeutralise()).draw();
});
$("#daterange-filter").on("change", function()
$("#daterange-filter").on("change", function ()
{
UpdateUriParam("months", $(this).val());
window.location.reload();
});
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -73,10 +73,10 @@ $("#search").on("keyup", Delay(function()
value = "";
}
stockJournalTable.search(value).draw();
stockJournalTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
$("#transaction-type-filter").val("all");
@ -104,7 +104,7 @@ if (typeof GetUriParam("months") !== "undefined")
$("#daterange-filter").val(GetUriParam("months"));
}
$(document).on('click', '.undo-stock-booking-button', function(e)
$(document).on('click', '.undo-stock-booking-button', function (e)
{
e.preventDefault();
@ -118,7 +118,7 @@ $(document).on('click', '.undo-stock-booking-button', function(e)
}
Grocy.Api.Post('stock/bookings/' + bookingId.toString() + '/undo', {},
function(result)
function (result)
{
correspondingBookingsRoot.addClass("text-muted");
correspondingBookingsRoot.find("span.name-anchor").addClass("text-strike-through").after("<br>" + __t("Undone on") + " " + moment().format("YYYY-MM-DD HH:mm:ss") + " <time class='timeago timeago-contextual' datetime='" + moment().format("YYYY-MM-DD HH:mm:ss") + "'></time>");
@ -126,7 +126,7 @@ $(document).on('click', '.undo-stock-booking-button', function(e)
RefreshContextualTimeago("#stock-booking-" + bookingId + "-row");
toastr.success(__t("Booking successfully undone"));
},
function(xhr)
function (xhr)
{
console.error(xhr);
toastr.error(__t(JSON.parse(xhr.response).error_message));
@ -134,12 +134,12 @@ $(document).on('click', '.undo-stock-booking-button', function(e)
);
});
$(document).on('click', '.product-grocycode-label-print', function(e)
$(document).on('click', '.product-grocycode-label-print', function (e)
{
e.preventDefault();
var productId = $(e.currentTarget).attr('data-product-id');
Grocy.Api.Get('stock/products/' + productId + '/printlabel', function(labelData)
Grocy.Api.Get('stock/products/' + productId + '/printlabel', function (labelData)
{
if (Grocy.Webhooks.labelprinter !== undefined)
{

View File

@ -8,7 +8,7 @@ var journalSummaryTable = $('#stock-journal-summary-table').DataTable({
$('#stock-journal-summary-table tbody').removeClass("d-none");
journalSummaryTable.columns.adjust().draw();
$("#product-filter").on("change", function()
$("#product-filter").on("change", function ()
{
var value = $(this).val();
var text = $("#product-filter option:selected").text();
@ -18,11 +18,11 @@ $("#product-filter").on("change", function()
}
else
{
journalSummaryTable.column(journalSummaryTable.colReorder.transpose(1)).search("^" + $.fn.dataTable.util.escapeRegex(text) + "$", true, false).draw();
journalSummaryTable.column(journalSummaryTable.colReorder.transpose(1)).search("^" + $.fn.dataTable.util.escapeRegex(text.accentNeutralise()) + "$", true, false).draw();
}
});
$("#transaction-type-filter").on("change", function()
$("#transaction-type-filter").on("change", function ()
{
var value = $(this).val();
var text = $("#transaction-type-filter option:selected").text();
@ -31,10 +31,10 @@ $("#transaction-type-filter").on("change", function()
text = "";
}
journalSummaryTable.column(journalSummaryTable.colReorder.transpose(2)).search(text).draw();
journalSummaryTable.column(journalSummaryTable.colReorder.transpose(2)).search(text.accentNeutralise()).draw();
});
$("#user-filter").on("change", function()
$("#user-filter").on("change", function ()
{
var value = $(this).val();
var text = $("#user-filter option:selected").text();
@ -43,10 +43,10 @@ $("#user-filter").on("change", function()
text = "";
}
journalSummaryTable.column(journalSummaryTable.colReorder.transpose(3)).search(text).draw();
journalSummaryTable.column(journalSummaryTable.colReorder.transpose(3)).search(text.accentNeutralise()).draw();
});
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -54,10 +54,10 @@ $("#search").on("keyup", Delay(function()
value = "";
}
journalSummaryTable.search(value).draw();
journalSummaryTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
$("#transaction-type-filter").val("all");

View File

@ -49,7 +49,7 @@ $("#location-filter").on("change", function ()
value = "xx" + value + "xx";
}
stockOverviewTable.column(stockOverviewTable.colReorder.transpose(6)).search(value).draw();
stockOverviewTable.column(stockOverviewTable.colReorder.transpose(6)).search(value.accentNeutralise()).draw();
});
$("#product-group-filter").on("change", function ()
@ -64,7 +64,7 @@ $("#product-group-filter").on("change", function ()
value = "xx" + value + "xx";
}
stockOverviewTable.column(stockOverviewTable.colReorder.transpose(8)).search(value).draw();
stockOverviewTable.column(stockOverviewTable.colReorder.transpose(8)).search(value.accentNeutralise()).draw();
});
$("#status-filter").on("change", function ()
@ -78,7 +78,7 @@ $("#status-filter").on("change", function ()
// Transfer CSS classes of selected element to dropdown element (for background)
$(this).attr("class", $("#" + $(this).attr("id") + " option[value='" + value + "']").attr("class") + " form-control");
stockOverviewTable.column(stockOverviewTable.colReorder.transpose(7)).search(value).draw();
stockOverviewTable.column(stockOverviewTable.colReorder.transpose(7)).search(value.accentNeutralise()).draw();
});
$(".status-filter-message").on("click", function ()
@ -108,7 +108,7 @@ $("#search").on("keyup", Delay(function ()
value = "";
}
stockOverviewTable.search(value).draw();
stockOverviewTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$(document).on('click', '.product-grocycode-label-print', function (e)

View File

@ -8,7 +8,7 @@
$('#taskcategories-table tbody').removeClass("d-none");
categoriesTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
categoriesTable.search(value).draw();
categoriesTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
categoriesTable.search("").draw();
});
$(document).on('click', '.task-category-delete-button', function(e)
$(document).on('click', '.task-category-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-category-name');
var objectId = $(e.currentTarget).attr('data-category-id');
@ -43,16 +43,16 @@ $(document).on('click', '.task-category-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/task_categories/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/taskcategories');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -62,7 +62,7 @@ $(document).on('click', '.task-category-delete-button', function(e)
});
});
$("#show-disabled").change(function()
$("#show-disabled").change(function ()
{
if (this.checked)
{

View File

@ -17,7 +17,7 @@ $("#search").on("keyup", Delay(function ()
value = "";
}
tasksTable.search(value).draw();
tasksTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#status-filter").on("change", function ()
@ -31,7 +31,7 @@ $("#status-filter").on("change", function ()
// Transfer CSS classes of selected element to dropdown element (for background)
$(this).attr("class", $("#" + $(this).attr("id") + " option[value='" + value + "']").attr("class") + " form-control");
tasksTable.column(tasksTable.colReorder.transpose(5)).search(value).draw();
tasksTable.column(tasksTable.colReorder.transpose(5)).search(value.accentNeutralise()).draw();
});
$("#user-filter").on("change", function ()
@ -46,7 +46,7 @@ $("#user-filter").on("change", function ()
"^" + $.fn.dataTable.util.escapeRegex(value) + "$"
}
tasksTable.column(tasksTable.colReorder.transpose(4)).search(value, true, false).draw();
tasksTable.column(tasksTable.colReorder.transpose(4)).search(value.accentNeutralise(), true, false).draw();
});
$("#category-filter").on("change", function ()
@ -57,7 +57,7 @@ $("#category-filter").on("change", function ()
value = "";
}
tasksTable.column(tasksTable.colReorder.transpose(3)).search(value).draw();
tasksTable.column(tasksTable.colReorder.transpose(3)).search(value.accentNeutralise()).draw();
});
$("#clear-filter-button").on("click", function ()

View File

@ -8,7 +8,7 @@
$('#userentities-table tbody').removeClass("d-none");
userentitiesTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
userentitiesTable.search(value).draw();
userentitiesTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
userentitiesTable.search("").draw();
});
$(document).on('click', '.userentity-delete-button', function(e)
$(document).on('click', '.userentity-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-userentity-name');
var objectId = $(e.currentTarget).attr('data-userentity-id');
@ -43,16 +43,16 @@ $(document).on('click', '.userentity-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/userentities/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/userentities');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}

View File

@ -8,7 +8,7 @@
$('#userfields-table tbody').removeClass("d-none");
userfieldsTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,10 +16,10 @@ $("#search").on("keyup", Delay(function()
value = "";
}
userfieldsTable.search(value).draw();
userfieldsTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#entity-filter").on("change", function()
$("#entity-filter").on("change", function ()
{
var value = $("#entity-filter option:selected").text();
if (value === __t("All"))
@ -27,11 +27,11 @@ $("#entity-filter").on("change", function()
value = "";
}
userfieldsTable.column(userfieldsTable.colReorder.transpose(1)).search(value).draw();
userfieldsTable.column(userfieldsTable.colReorder.transpose(1)).search(value.accentNeutralise()).draw();
$("#new-userfield-button").attr("href", U("/userfield/new?embedded&entity=" + value));
});
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
$("#entity-filter").val("all");
@ -39,7 +39,7 @@ $("#clear-filter-button").on("click", function()
userfieldsTable.search("").draw();
});
$(document).on('click', '.userfield-delete-button', function(e)
$(document).on('click', '.userfield-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-userfield-name');
var objectId = $(e.currentTarget).attr('data-userfield-id');
@ -57,16 +57,16 @@ $(document).on('click', '.userfield-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/userfields/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/userfields');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}
@ -80,7 +80,7 @@ if (GetUriParam("entity"))
{
$("#entity-filter").val(GetUriParam("entity"));
$("#entity-filter").trigger("change");
setTimeout(function()
setTimeout(function ()
{
$("#name").focus();
}, Grocy.FormFocusDelay);

View File

@ -8,7 +8,7 @@
$('.userobjects-table tbody').removeClass("d-none");
userobjectsTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
userobjectsTable.search(value).draw();
userobjectsTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
userobjectsTable.search("").draw();
});
$(document).on('click', '.userobject-delete-button', function(e)
$(document).on('click', '.userobject-delete-button', function (e)
{
var objectId = $(e.currentTarget).attr('data-userobject-id');
@ -42,16 +42,16 @@ $(document).on('click', '.userobject-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('objects/userobjects/' + objectId, {},
function(result)
function (result)
{
window.location.reload();
},
function(xhr)
function (xhr)
{
console.error(xhr);
}

View File

@ -8,7 +8,7 @@
$('#users-table tbody').removeClass("d-none");
usersTable.columns.adjust().draw();
$("#search").on("keyup", Delay(function()
$("#search").on("keyup", Delay(function ()
{
var value = $(this).val();
if (value === "all")
@ -16,16 +16,16 @@ $("#search").on("keyup", Delay(function()
value = "";
}
usersTable.search(value).draw();
usersTable.search(value.accentNeutralise()).draw();
}, Grocy.FormFocusDelay));
$("#clear-filter-button").on("click", function()
$("#clear-filter-button").on("click", function ()
{
$("#search").val("");
usersTable.search("").draw();
});
$(document).on('click', '.user-delete-button', function(e)
$(document).on('click', '.user-delete-button', function (e)
{
var objectName = $(e.currentTarget).attr('data-user-username');
var objectId = $(e.currentTarget).attr('data-user-id');
@ -43,16 +43,16 @@ $(document).on('click', '.user-delete-button', function(e)
className: 'btn-danger'
}
},
callback: function(result)
callback: function (result)
{
if (result === true)
{
Grocy.Api.Delete('users/' + objectId, {},
function(result)
function (result)
{
window.location.href = U('/users');
},
function(xhr)
function (xhr)
{
console.error(xhr);
}