mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 01:32:38 +00:00
Small different UI improvements
Show the cursor as pointer on stock overview page while hovering the product name cell to highlight that the productcard can be opened Show a waiting cursor and disable all form inputs while doing background XHR calls to highlight that the user should wait Place the search field (to search a table) on all pages to the left most place
This commit is contained in:
parent
ff341d8547
commit
a3617cffb8
@ -160,6 +160,14 @@ input::-webkit-inner-spin-button {
|
|||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cursor-link {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cursor-busy {
|
||||||
|
cursor: wait;
|
||||||
|
}
|
||||||
|
|
||||||
/* Third party component customizations - DataTables */
|
/* Third party component customizations - DataTables */
|
||||||
td {
|
td {
|
||||||
vertical-align: middle !important;
|
vertical-align: middle !important;
|
||||||
|
@ -255,6 +255,26 @@ Grocy.FrontendHelpers.ValidateForm = function(formId)
|
|||||||
$(form).addClass('was-validated');
|
$(form).addClass('was-validated');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy = function(formId = null)
|
||||||
|
{
|
||||||
|
$("body").addClass("cursor-busy");
|
||||||
|
|
||||||
|
if (formId !== null)
|
||||||
|
{
|
||||||
|
$("#" + formId + " :input").attr("disabled", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy = function(formId = null)
|
||||||
|
{
|
||||||
|
$("body").removeClass("cursor-busy");
|
||||||
|
|
||||||
|
if (formId !== null)
|
||||||
|
{
|
||||||
|
$("#" + formId + " :input").attr("disabled", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ShowGenericError = function(message, exception)
|
Grocy.FrontendHelpers.ShowGenericError = function(message, exception)
|
||||||
{
|
{
|
||||||
toastr.error(L(message) + '<br><br>' + L('Click to show technical details'), '', {
|
toastr.error(L(message) + '<br><br>' + L('Click to show technical details'), '', {
|
||||||
|
@ -58,6 +58,8 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
|
|||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
// to prevent that the tooltip stays until clicked anywhere else
|
// to prevent that the tooltip stays until clicked anywhere else
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
var batteryId = $(e.currentTarget).attr('data-battery-id');
|
var batteryId = $(e.currentTarget).attr('data-battery-id');
|
||||||
var batteryName = $(e.currentTarget).attr('data-battery-name');
|
var batteryName = $(e.currentTarget).attr('data-battery-name');
|
||||||
@ -102,18 +104,21 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
|
|||||||
$('#battery-' + batteryId + '-next-charge-time-timeago').attr('datetime', result.next_estimated_charge_time);
|
$('#battery-' + batteryId + '-next-charge-time-timeago').attr('datetime', result.next_estimated_charge_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(L('Tracked charge cycle of battery #1 on #2', batteryName, trackedTime));
|
toastr.success(L('Tracked charge cycle of battery #1 on #2', batteryName, trackedTime));
|
||||||
RefreshContextualTimeago();
|
RefreshContextualTimeago();
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,28 +2,33 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
var jsonData = $('#battery-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("battery-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('add-object/batteries', $('#battery-form').serializeJSON(),
|
Grocy.Api.Post('add-object/batteries', jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/batteries');
|
window.location.href = U('/batteries');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("battery-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('edit-object/batteries/' + Grocy.EditObjectId, $('#battery-form').serializeJSON(),
|
Grocy.Api.Post('edit-object/batteries/' + Grocy.EditObjectId, jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/batteries');
|
window.location.href = U('/batteries');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("battery-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonForm = $('#batterytracking-form').serializeJSON();
|
var jsonForm = $('#batterytracking-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("batterytracking-form");
|
||||||
|
|
||||||
Grocy.Api.Get('batteries/get-battery-details/' + jsonForm.battery_id,
|
Grocy.Api.Get('batteries/get-battery-details/' + jsonForm.battery_id,
|
||||||
function (batteryDetails)
|
function (batteryDetails)
|
||||||
@ -10,6 +11,7 @@
|
|||||||
Grocy.Api.Get('batteries/track-charge-cycle/' + jsonForm.battery_id + '?tracked_time=' + $('#tracked_time').find('input').val(),
|
Grocy.Api.Get('batteries/track-charge-cycle/' + jsonForm.battery_id + '?tracked_time=' + $('#tracked_time').find('input').val(),
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("batterytracking-form");
|
||||||
toastr.success(L('Tracked charge cycle of battery #1 on #2', batteryDetails.battery.name, $('#tracked_time').find('input').val()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoChargeCycle(' + result.charge_cycle_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
toastr.success(L('Tracked charge cycle of battery #1 on #2', batteryDetails.battery.name, $('#tracked_time').find('input').val()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoChargeCycle(' + result.charge_cycle_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
||||||
|
|
||||||
$('#battery_id').val('');
|
$('#battery_id').val('');
|
||||||
@ -22,12 +24,14 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("batterytracking-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("batterytracking-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,28 +2,33 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
var jsonData = $('#chore-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("chore-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('add-object/chores', $('#chore-form').serializeJSON(),
|
Grocy.Api.Post('add-object/chores', jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/chores');
|
window.location.href = U('/chores');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("chore-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('edit-object/chores/' + Grocy.EditObjectId, $('#chore-form').serializeJSON(),
|
Grocy.Api.Post('edit-object/chores/' + Grocy.EditObjectId, jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/chores');
|
window.location.href = U('/chores');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("chore-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -58,6 +58,8 @@ $(document).on('click', '.track-chore-button', function(e)
|
|||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
// to prevent that the tooltip stays until clicked anywhere else
|
// to prevent that the tooltip stays until clicked anywhere else
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
var choreId = $(e.currentTarget).attr('data-chore-id');
|
var choreId = $(e.currentTarget).attr('data-chore-id');
|
||||||
var choreName = $(e.currentTarget).attr('data-chore-name');
|
var choreName = $(e.currentTarget).attr('data-chore-name');
|
||||||
@ -102,18 +104,21 @@ $(document).on('click', '.track-chore-button', function(e)
|
|||||||
$('#chore-' + choreId + '-next-execution-time-timeago').attr('datetime', result.next_estimated_execution_time);
|
$('#chore-' + choreId + '-next-execution-time-timeago').attr('datetime', result.next_estimated_execution_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(L('Tracked execution of chore #1 on #2', choreName, trackedTime));
|
toastr.success(L('Tracked execution of chore #1 on #2', choreName, trackedTime));
|
||||||
RefreshContextualTimeago();
|
RefreshContextualTimeago();
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonForm = $('#choretracking-form').serializeJSON();
|
var jsonForm = $('#choretracking-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("choretracking-form");
|
||||||
|
|
||||||
Grocy.Api.Get('chores/get-chore-details/' + jsonForm.chore_id,
|
Grocy.Api.Get('chores/get-chore-details/' + jsonForm.chore_id,
|
||||||
function (choreDetails)
|
function (choreDetails)
|
||||||
@ -10,6 +11,7 @@
|
|||||||
Grocy.Api.Get('chores/track-chore-execution/' + jsonForm.chore_id + '?tracked_time=' + Grocy.Components.DateTimePicker.GetValue() + "&done_by=" + Grocy.Components.UserPicker.GetValue(),
|
Grocy.Api.Get('chores/track-chore-execution/' + jsonForm.chore_id + '?tracked_time=' + Grocy.Components.DateTimePicker.GetValue() + "&done_by=" + Grocy.Components.UserPicker.GetValue(),
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("choretracking-form");
|
||||||
toastr.success(L('Tracked execution of chore #1 on #2', choreDetails.chore.name, Grocy.Components.DateTimePicker.GetValue()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoChoreExecution(' + result.chore_execution_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
toastr.success(L('Tracked execution of chore #1 on #2', choreDetails.chore.name, Grocy.Components.DateTimePicker.GetValue()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoChoreExecution(' + result.chore_execution_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
||||||
|
|
||||||
$('#chore_id').val('');
|
$('#chore_id').val('');
|
||||||
@ -21,12 +23,14 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("choretracking-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("choretracking-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonForm = $('#consume-form').serializeJSON();
|
var jsonForm = $('#consume-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("consume-form");
|
||||||
|
|
||||||
if ($("#use_specific_stock_entry").is(":checked"))
|
if ($("#use_specific_stock_entry").is(":checked"))
|
||||||
{
|
{
|
||||||
@ -34,6 +35,7 @@
|
|||||||
$("#use_specific_stock_entry").click();
|
$("#use_specific_stock_entry").click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
toastr.success(L('Removed #1 #2 of #3 from stock', jsonForm.amount, Pluralize(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBooking(' + result.booking_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
toastr.success(L('Removed #1 #2 of #3 from stock', jsonForm.amount, Pluralize(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBooking(' + result.booking_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
||||||
|
|
||||||
$('#amount').val(1);
|
$('#amount').val(1);
|
||||||
@ -43,12 +45,14 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -59,6 +63,7 @@ $('#save-mark-as-open-button').on('click', function(e)
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonForm = $('#consume-form').serializeJSON();
|
var jsonForm = $('#consume-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("consume-form");
|
||||||
|
|
||||||
if ($("#use_specific_stock_entry").is(":checked"))
|
if ($("#use_specific_stock_entry").is(":checked"))
|
||||||
{
|
{
|
||||||
@ -84,6 +89,7 @@ $('#save-mark-as-open-button').on('click', function(e)
|
|||||||
$("#use_specific_stock_entry").click();
|
$("#use_specific_stock_entry").click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
toastr.success(L('Marked #1 #2 of #3 as opened', jsonForm.amount, Pluralize(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBooking(' + result.booking_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
toastr.success(L('Marked #1 #2 of #3 as opened', jsonForm.amount, Pluralize(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBooking(' + result.booking_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
||||||
|
|
||||||
$('#amount').val(1);
|
$('#amount').val(1);
|
||||||
@ -93,12 +99,14 @@ $('#save-mark-as-open-button').on('click', function(e)
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("consume-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonData = $('#equipment-form').serializeJSON();
|
var jsonData = $('#equipment-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("equipment-form");
|
||||||
|
|
||||||
if ($("#instruction-manual")[0].files.length > 0)
|
if ($("#instruction-manual")[0].files.length > 0)
|
||||||
{
|
{
|
||||||
var someRandomStuff = Math.random().toString(36).substring(2, 100) + Math.random().toString(36).substring(2, 100);
|
var someRandomStuff = Math.random().toString(36).substring(2, 100) + Math.random().toString(36).substring(2, 100);
|
||||||
@ -28,6 +30,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("equipment-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -39,6 +42,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("equipment-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -54,6 +58,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("equipment-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -71,6 +76,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("equipment-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -82,6 +88,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("equipment-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonForm = $('#inventory-form').serializeJSON();
|
var jsonForm = $('#inventory-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("inventory-form");
|
||||||
|
|
||||||
Grocy.Api.Get('stock/get-product-details/' + jsonForm.product_id,
|
Grocy.Api.Get('stock/get-product-details/' + jsonForm.product_id,
|
||||||
function (productDetails)
|
function (productDetails)
|
||||||
@ -32,6 +33,7 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("inventory-form");
|
||||||
toastr.success(L('Stock amount of #1 is now #2 #3', productDetails.product.name, jsonForm.new_amount, Pluralize(jsonForm.new_amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural)) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBooking(' + result.booking_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
toastr.success(L('Stock amount of #1 is now #2 #3', productDetails.product.name, jsonForm.new_amount, Pluralize(jsonForm.new_amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural)) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBooking(' + result.booking_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
||||||
|
|
||||||
if (addBarcode !== undefined)
|
if (addBarcode !== undefined)
|
||||||
@ -50,12 +52,14 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("inventory-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("inventory-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,15 +2,19 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
var jsonData = $('#location-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("location-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('add-object/locations', $('#location-form').serializeJSON(),
|
Grocy.Api.Post('add-object/locations', jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/locations');
|
window.location.href = U('/locations');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("location-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -24,6 +28,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("location-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var jsonData = $('#product-form').serializeJSON();
|
var jsonData = $('#product-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("product-form");
|
||||||
|
|
||||||
if ($("#product-picture")[0].files.length > 0)
|
if ($("#product-picture")[0].files.length > 0)
|
||||||
{
|
{
|
||||||
var someRandomStuff = Math.random().toString(36).substring(2, 100) + Math.random().toString(36).substring(2, 100);
|
var someRandomStuff = Math.random().toString(36).substring(2, 100) + Math.random().toString(36).substring(2, 100);
|
||||||
@ -35,6 +37,7 @@
|
|||||||
},
|
},
|
||||||
function (xhr)
|
function (xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("product-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -46,6 +49,7 @@
|
|||||||
},
|
},
|
||||||
function (xhr)
|
function (xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("product-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -61,6 +65,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("product-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -78,6 +83,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("product-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -89,6 +95,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("product-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,28 +2,33 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
var jsonData = $('#product-group-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("product-group-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('add-object/product_groups', $('#product-group-form').serializeJSON(),
|
Grocy.Api.Post('add-object/product_groups', jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/productgroups');
|
window.location.href = U('/productgroups');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("product-group-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('edit-object/product_groups/' + Grocy.EditObjectId, $('#product-group-form').serializeJSON(),
|
Grocy.Api.Post('edit-object/product_groups/' + Grocy.EditObjectId, jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/productgroups');
|
window.location.href = U('/productgroups');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("product-group-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonForm = $('#purchase-form').serializeJSON();
|
var jsonForm = $('#purchase-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("purchase-form");
|
||||||
|
|
||||||
Grocy.Api.Get('stock/get-product-details/' + jsonForm.product_id,
|
Grocy.Api.Get('stock/get-product-details/' + jsonForm.product_id,
|
||||||
function(productDetails)
|
function(productDetails)
|
||||||
@ -35,6 +36,7 @@
|
|||||||
function (result) { },
|
function (result) { },
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -54,6 +56,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||||
toastr.success(successMessage);
|
toastr.success(successMessage);
|
||||||
$('#amount').val(0);
|
$('#amount').val(0);
|
||||||
$('#price').val('');
|
$('#price').val('');
|
||||||
@ -65,12 +68,14 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,28 +2,33 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
var jsonData = $('#quantityunit-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("quantityunit-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('add-object/quantity_units', $('#quantityunit-form').serializeJSON(),
|
Grocy.Api.Post('add-object/quantity_units', jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/quantityunits');
|
window.location.href = U('/quantityunits');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("quantityunit-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('edit-object/quantity_units/' + Grocy.EditObjectId, $('#quantityunit-form').serializeJSON(),
|
Grocy.Api.Post('edit-object/quantity_units/' + Grocy.EditObjectId, jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/quantityunits');
|
window.location.href = U('/quantityunits');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("quantityunit-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,13 +2,17 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(),
|
var jsonData = $('#recipe-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("recipe-form");
|
||||||
|
|
||||||
|
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/recipes');
|
window.location.href = U('/recipes');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("recipe-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
var jsonData = $('#recipe-pos-form').serializeJSON({ checkboxUncheckedValue: "0" });
|
var jsonData = $('#recipe-pos-form').serializeJSON({ checkboxUncheckedValue: "0" });
|
||||||
jsonData.recipe_id = Grocy.EditObjectParentId;
|
jsonData.recipe_id = Grocy.EditObjectParentId;
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("recipe-pos-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('add-object/recipes_pos', jsonData,
|
Grocy.Api.Post('add-object/recipes_pos', jsonData,
|
||||||
@ -13,6 +16,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("recipe-pos-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -26,6 +30,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("recipe-pos-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -95,6 +95,8 @@ $(document).on('click', '.recipe-order-missing-button', function(e)
|
|||||||
{
|
{
|
||||||
if (result === true)
|
if (result === true)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
Grocy.Api.Get('recipes/add-not-fulfilled-products-to-shopping-list/' + objectId,
|
Grocy.Api.Get('recipes/add-not-fulfilled-products-to-shopping-list/' + objectId,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
@ -102,6 +104,7 @@ $(document).on('click', '.recipe-order-missing-button', function(e)
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -131,13 +134,17 @@ $("#selectedRecipeConsumeButton").on('click', function(e)
|
|||||||
{
|
{
|
||||||
if (result === true)
|
if (result === true)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
Grocy.Api.Get('recipes/consume-recipe/' + objectId,
|
Grocy.Api.Get('recipes/consume-recipe/' + objectId,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(L('Removed all ingredients of recipe "#1" from stock', objectName));
|
toastr.success(L('Removed all ingredients of recipe "#1" from stock', objectName));
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -61,18 +61,21 @@ $(document).on('click', '.shoppinglist-delete-button', function (e)
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
|
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
Grocy.Api.Get('delete-object/shopping_list/' + shoppingListItemId,
|
Grocy.Api.Get('delete-object/shopping_list/' + shoppingListItemId,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
$('#shoppinglistitem-' + shoppingListItemId + '-row').fadeOut(500, function()
|
$('#shoppinglistitem-' + shoppingListItemId + '-row').fadeOut(500, function()
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
OnListItemRemoved();
|
OnListItemRemoved();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -110,17 +113,21 @@ $(document).on('click', '#clear-shopping-list', function(e)
|
|||||||
{
|
{
|
||||||
if (result === true)
|
if (result === true)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
Grocy.Api.Get('stock/clear-shopping-list',
|
Grocy.Api.Get('stock/clear-shopping-list',
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
$('#shoppinglist-table tbody tr').fadeOut(500, function()
|
$('#shoppinglist-table tbody tr').fadeOut(500, function()
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
OnListItemRemoved();
|
OnListItemRemoved();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,28 +2,33 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
var jsonData = $('#shoppinglist-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("shoppinglist-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('add-object/shopping_list', $('#shoppinglist-form').serializeJSON(),
|
Grocy.Api.Post('add-object/shopping_list', jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/shoppinglist');
|
window.location.href = U('/shoppinglist');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("shoppinglist-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('edit-object/shopping_list/' + Grocy.EditObjectId, $('#shoppinglist-form').serializeJSON(),
|
Grocy.Api.Post('edit-object/shopping_list/' + Grocy.EditObjectId, jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/shoppinglist');
|
window.location.href = U('/shoppinglist');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("shoppinglist-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -81,6 +81,8 @@ $(document).on('click', '.product-consume-button', function(e)
|
|||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
// to prevent that the tooltip stays until clicked anywhere else
|
// to prevent that the tooltip stays until clicked anywhere else
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
var productId = $(e.currentTarget).attr('data-product-id');
|
var productId = $(e.currentTarget).attr('data-product-id');
|
||||||
var productName = $(e.currentTarget).attr('data-product-name');
|
var productName = $(e.currentTarget).attr('data-product-name');
|
||||||
@ -135,18 +137,21 @@ $(document).on('click', '.product-consume-button', function(e)
|
|||||||
$('#product-' + productId + '-next-best-before-date-timeago').attr('datetime', result.next_best_before_date);
|
$('#product-' + productId + '-next-best-before-date-timeago').attr('datetime', result.next_best_before_date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(L('Removed #1 #2 of #3 from stock', consumeAmount, productQuName, productName));
|
toastr.success(L('Removed #1 #2 of #3 from stock', consumeAmount, productQuName, productName));
|
||||||
RefreshContextualTimeago();
|
RefreshContextualTimeago();
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -159,6 +164,8 @@ $(document).on('click', '.product-open-button', function(e)
|
|||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
// to prevent that the tooltip stays until clicked anywhere else
|
// to prevent that the tooltip stays until clicked anywhere else
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
var productId = $(e.currentTarget).attr('data-product-id');
|
var productId = $(e.currentTarget).attr('data-product-id');
|
||||||
var productName = $(e.currentTarget).attr('data-product-name');
|
var productName = $(e.currentTarget).attr('data-product-name');
|
||||||
@ -205,18 +212,21 @@ $(document).on('click', '.product-open-button', function(e)
|
|||||||
button.addClass("disabled");
|
button.addClass("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(L('Marked #1 #2 of #3 as opened', 1, productQuName, productName));
|
toastr.success(L('Marked #1 #2 of #3 as opened', 1, productQuName, productName));
|
||||||
RefreshContextualTimeago();
|
RefreshContextualTimeago();
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,28 +2,33 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
var jsonData = $('#task-category-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("task-category-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('add-object/task_categories', $('#task-category-form').serializeJSON(),
|
Grocy.Api.Post('add-object/task_categories', jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/taskcategories');
|
window.location.href = U('/taskcategories');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("task-category-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('edit-object/task_categories/' + Grocy.EditObjectId, $('#task-category-form').serializeJSON(),
|
Grocy.Api.Post('edit-object/task_categories/' + Grocy.EditObjectId, jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/taskcategories');
|
window.location.href = U('/taskcategories');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("task-category-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
delete jsonData.user_id;
|
delete jsonData.user_id;
|
||||||
jsonData.due_date = Grocy.Components.DateTimePicker.GetValue();
|
jsonData.due_date = Grocy.Components.DateTimePicker.GetValue();
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("task-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('add-object/tasks', jsonData,
|
Grocy.Api.Post('add-object/tasks', jsonData,
|
||||||
@ -16,6 +18,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("task-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -29,6 +32,7 @@
|
|||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("task-form");
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -62,6 +62,8 @@ $(document).on('click', '.do-task-button', function(e)
|
|||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
// to prevent that the tooltip stays until clicked anywhere else
|
// to prevent that the tooltip stays until clicked anywhere else
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
var taskId = $(e.currentTarget).attr('data-task-id');
|
var taskId = $(e.currentTarget).attr('data-task-id');
|
||||||
var taskName = $(e.currentTarget).attr('data-task-name');
|
var taskName = $(e.currentTarget).attr('data-task-name');
|
||||||
@ -84,12 +86,14 @@ $(document).on('click', '.do-task-button', function(e)
|
|||||||
$('.do-task-button[data-task-id="' + taskId + '"]').addClass("disabled");
|
$('.do-task-button[data-task-id="' + taskId + '"]').addClass("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
toastr.success(L('Marked task #1 as completed on #2', taskName, doneTime));
|
toastr.success(L('Marked task #1 as completed on #2', taskName, doneTime));
|
||||||
RefreshContextualTimeago();
|
RefreshContextualTimeago();
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy();
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -2,28 +2,33 @@
|
|||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
var jsonData = $('#user-form').serializeJSON();
|
||||||
|
Grocy.FrontendHelpers.BeginUiBusy("user-form");
|
||||||
|
|
||||||
if (Grocy.EditMode === 'create')
|
if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('users/create', $('#user-form').serializeJSON(),
|
Grocy.Api.Post('users/create', jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/users');
|
window.location.href = U('/users');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("user-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('users/edit/' + Grocy.EditObjectId, $('#user-form').serializeJSON(),
|
Grocy.Api.Post('users/edit/' + Grocy.EditObjectId, jsonData,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
window.location.href = U('/users');
|
window.location.href = U('/users');
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.EndUiBusy("user-form");
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
|
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||||
|
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
||||||
|
<input type="text" class="form-control" id="search">
|
||||||
|
</div>
|
||||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||||
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
||||||
<select class="form-control" id="status-filter">
|
<select class="form-control" id="status-filter">
|
||||||
@ -30,10 +34,6 @@
|
|||||||
<option class="bg-danger" value="overdue">{{ $L('Overdue') }}</option>
|
<option class="bg-danger" value="overdue">{{ $L('Overdue') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
|
||||||
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
|
||||||
<input type="text" class="form-control" id="search">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
|
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||||
|
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
||||||
|
<input type="text" class="form-control" id="search">
|
||||||
|
</div>
|
||||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||||
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
||||||
<select class="form-control" id="status-filter">
|
<select class="form-control" id="status-filter">
|
||||||
@ -30,10 +34,6 @@
|
|||||||
<option class="bg-danger" value="overdue">{{ $L('Overdue') }}</option>
|
<option class="bg-danger" value="overdue">{{ $L('Overdue') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
|
||||||
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
|
||||||
<input type="text" class="form-control" id="search">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -38,6 +38,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
|
<div class="col-xs-12 col-md-4">
|
||||||
|
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
||||||
|
<input type="text" class="form-control" id="search">
|
||||||
|
</div>
|
||||||
<div class="col-xs-12 col-md-4">
|
<div class="col-xs-12 col-md-4">
|
||||||
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
||||||
<select class="form-control" id="status-filter">
|
<select class="form-control" id="status-filter">
|
||||||
@ -45,10 +49,6 @@
|
|||||||
<option class="bg-info" value="belowminstockamount">{{ $L('Below min. stock amount') }}</option>
|
<option class="bg-info" value="belowminstockamount">{{ $L('Below min. stock amount') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-4">
|
|
||||||
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
|
||||||
<input type="text" class="form-control" id="search">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -32,6 +32,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
|
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||||
|
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
||||||
|
<input type="text" class="form-control" id="search">
|
||||||
|
</div>
|
||||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||||
<label for="location-filter">{{ $L('Filter by location') }}</label> <i class="fas fa-filter"></i>
|
<label for="location-filter">{{ $L('Filter by location') }}</label> <i class="fas fa-filter"></i>
|
||||||
<select class="form-control" id="location-filter">
|
<select class="form-control" id="location-filter">
|
||||||
@ -59,10 +63,6 @@
|
|||||||
<option class="bg-info" value="belowminstockamount">{{ $L('Below min. stock amount') }}</option>
|
<option class="bg-info" value="belowminstockamount">{{ $L('Below min. stock amount') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
|
||||||
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
|
||||||
<input type="text" class="form-control" id="search">
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -107,7 +107,7 @@
|
|||||||
<i class="fas fa-file-alt"></i>
|
<i class="fas fa-file-alt"></i>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="product-name-cell" data-product-id="{{ $currentStockEntry->product_id }}">
|
<td class="product-name-cell cursor-link" data-product-id="{{ $currentStockEntry->product_id }}">
|
||||||
{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }} <i class="fas fa-info text-muted"></i>
|
{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }} <i class="fas fa-info text-muted"></i>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -29,6 +29,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mt-3">
|
<div class="row mt-3">
|
||||||
|
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||||
|
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
||||||
|
<input type="text" class="form-control" id="search">
|
||||||
|
</div>
|
||||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
<div class="col-xs-12 col-md-6 col-xl-3">
|
||||||
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
<label for="status-filter">{{ $L('Filter by status') }}</label> <i class="fas fa-filter"></i>
|
||||||
<select class="form-control" id="status-filter">
|
<select class="form-control" id="status-filter">
|
||||||
@ -37,10 +41,6 @@
|
|||||||
<option class="bg-danger" value="overdue">{{ $L('Overdue') }}</option>
|
<option class="bg-danger" value="overdue">{{ $L('Overdue') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6 col-xl-3">
|
|
||||||
<label for="search">{{ $L('Search') }}</label> <i class="fas fa-search"></i>
|
|
||||||
<input type="text" class="form-control" id="search">
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12 col-md-6 col-xl-3 d-flex align-items-end">
|
<div class="col-xs-12 col-md-6 col-xl-3 d-flex align-items-end">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" type="checkbox" id="show-done-tasks">
|
<input class="form-check-input" type="checkbox" id="show-done-tasks">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user