diff --git a/public/viewjs/batteries.js b/public/viewjs/batteries.js
index 79232da6..3097c391 100644
--- a/public/viewjs/batteries.js
+++ b/public/viewjs/batteries.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
batteriesTable.search(value).draw();
});
@@ -52,7 +52,7 @@ $(document).on('click', '.battery-delete-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/batteries/' + objectId,
+ Grocy.Api.Delete('delete-object/batteries/' + objectId,
function(result)
{
window.location.href = U('/batteries');
diff --git a/public/viewjs/batteriesjournal.js b/public/viewjs/batteriesjournal.js
index 98b79f2e..aeacc0b8 100644
--- a/public/viewjs/batteriesjournal.js
+++ b/public/viewjs/batteriesjournal.js
@@ -28,7 +28,7 @@ $("#battery-filter").on("change", function()
{
text = "";
}
-
+
batteriesJournalTable.column(1).search(text).draw();
});
@@ -39,7 +39,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
batteriesJournalTable.search(value).draw();
});
@@ -56,7 +56,7 @@ $(document).on('click', '.undo-battery-execution-button', function(e)
var element = $(e.currentTarget);
var chargeCycleId = $(e.currentTarget).attr('data-charge-cycle-id');
- Grocy.Api.Get('batteries/undo-charge-cycle/' + chargeCycleId.toString(),
+ Grocy.Api.Post('batteries/' + chargeCycleId.toString() + '/undo',
function(result)
{
element.closest("tr").addClass("text-muted");
diff --git a/public/viewjs/batteriesoverview.js b/public/viewjs/batteriesoverview.js
index a4d095b0..5689e58b 100644
--- a/public/viewjs/batteriesoverview.js
+++ b/public/viewjs/batteriesoverview.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
batteriesOverviewTable.search(value).draw();
});
@@ -41,7 +41,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");
-
+
batteriesOverviewTable.column(4).search(value).draw();
});
@@ -61,15 +61,15 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
document.activeElement.blur();
Grocy.FrontendHelpers.BeginUiBusy();
-
+
var batteryId = $(e.currentTarget).attr('data-battery-id');
var batteryName = $(e.currentTarget).attr('data-battery-name');
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
- Grocy.Api.Get('batteries/track-charge-cycle/' + batteryId + '?tracked_time=' + trackedTime,
+ Grocy.Api.Post('batteries/' + batteryId + '/charged?tracked_time=' + trackedTime,
function()
{
- Grocy.Api.Get('batteries/get-battery-details/' + batteryId,
+ Grocy.Api.Get('batteries/' + batteryId,
function(result)
{
var batteryRow = $('#battery-' + batteryId + '-row');
@@ -128,7 +128,7 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
function RefreshStatistics()
{
var nextXDays = $("#info-due-batteries").data("next-x-days");
- Grocy.Api.Get('batteries/get-current',
+ Grocy.Api.Get('batteries',
function(result)
{
var dueCount = 0;
@@ -146,7 +146,7 @@ function RefreshStatistics()
dueCount++;
}
});
-
+
$("#info-due-batteries").text(Pluralize(dueCount, L('#1 battery is due to be charged within the next #2 days', dueCount, nextXDays), L('#1 batteries are due to be charged within the next #2 days', dueCount, nextXDays)));
$("#info-overdue-batteries").text(Pluralize(overdueCount, L('#1 battery is overdue to be charged', overdueCount), L('#1 batteries are overdue to be charged', overdueCount)));
},
diff --git a/public/viewjs/batterytracking.js b/public/viewjs/batterytracking.js
index 2047e406..958cbe99 100644
--- a/public/viewjs/batterytracking.js
+++ b/public/viewjs/batterytracking.js
@@ -5,10 +5,10 @@
var jsonForm = $('#batterytracking-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("batterytracking-form");
- Grocy.Api.Get('batteries/get-battery-details/' + jsonForm.battery_id,
+ Grocy.Api.Get('batteries/' + jsonForm.battery_id,
function (batteryDetails)
{
- Grocy.Api.Get('batteries/track-charge-cycle/' + jsonForm.battery_id + '?tracked_time=' + $('#tracked_time').find('input').val(),
+ Grocy.Api.Post('batteries/' + jsonForm.battery_id + '/charge?tracked_time=' + $('#tracked_time').find('input').val(),
function(result)
{
Grocy.FrontendHelpers.EndUiBusy("batterytracking-form");
@@ -73,7 +73,7 @@ $('#batterytracking-form input').keydown(function(event)
if (event.keyCode === 13) //Enter
{
event.preventDefault();
-
+
if (document.getElementById('batterytracking-form').checkValidity() === false) //There is at least one validation error
{
return false;
@@ -92,7 +92,7 @@ $('#tracked_time').find('input').on('keypress', function (e)
function UndoChargeCycle(chargeCycleId)
{
- Grocy.Api.Get('batteries/undo-charge-cycle/' + chargeCycleId.toString(),
+ Grocy.Api.Post('batteries' + chargeCycleId.toString() + '/undo',
function(result)
{
toastr.success(L("Charge cycle successfully undone"));
diff --git a/public/viewjs/chores.js b/public/viewjs/chores.js
index 6cc6fcbb..e3666826 100644
--- a/public/viewjs/chores.js
+++ b/public/viewjs/chores.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
choresTable.search(value).draw();
});
@@ -52,7 +52,7 @@ $(document).on('click', '.chore-delete-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/chores/' + objectId,
+ Grocy.Api.Delete('delete-object/chores/' + objectId,
function(result)
{
window.location.href = U('/chores');
diff --git a/public/viewjs/choresjournal.js b/public/viewjs/choresjournal.js
index 2d7e382c..51b7a2ed 100644
--- a/public/viewjs/choresjournal.js
+++ b/public/viewjs/choresjournal.js
@@ -28,7 +28,7 @@ $("#chore-filter").on("change", function()
{
text = "";
}
-
+
choresJournalTable.column(1).search(text).draw();
});
@@ -39,7 +39,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
choresJournalTable.search(value).draw();
});
@@ -56,7 +56,7 @@ $(document).on('click', '.undo-chore-execution-button', function(e)
var element = $(e.currentTarget);
var executionId = $(e.currentTarget).attr('data-execution-id');
- Grocy.Api.Get('chores/undo-chore-execution/' + executionId.toString(),
+ Grocy.Api.Post('chores/' + executionId.toString() + '/undo',
function(result)
{
element.closest("tr").addClass("text-muted");
diff --git a/public/viewjs/choresoverview.js b/public/viewjs/choresoverview.js
index a786edf0..fb51e4f5 100644
--- a/public/viewjs/choresoverview.js
+++ b/public/viewjs/choresoverview.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
choresOverviewTable.search(value).draw();
});
@@ -41,7 +41,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");
-
+
choresOverviewTable.column(4).search(value).draw();
});
@@ -61,15 +61,15 @@ $(document).on('click', '.track-chore-button', function(e)
document.activeElement.blur();
Grocy.FrontendHelpers.BeginUiBusy();
-
+
var choreId = $(e.currentTarget).attr('data-chore-id');
var choreName = $(e.currentTarget).attr('data-chore-name');
var trackedTime = moment().format('YYYY-MM-DD HH:mm:ss');
- Grocy.Api.Get('chores/track-chore-execution/' + choreId + '?tracked_time=' + trackedTime,
+ Grocy.Api.Post('chores/' + choreId + '/execute?tracked_time=' + trackedTime,
function()
{
- Grocy.Api.Get('chores/get-chore-details/' + choreId,
+ Grocy.Api.Get('chores/' + choreId,
function(result)
{
var choreRow = $('#chore-' + choreId + '-row');
@@ -128,7 +128,7 @@ $(document).on('click', '.track-chore-button', function(e)
function RefreshStatistics()
{
var nextXDays = $("#info-due-chores").data("next-x-days");
- Grocy.Api.Get('chores/get-current',
+ Grocy.Api.Get('chores',
function(result)
{
var dueCount = 0;
@@ -146,7 +146,7 @@ function RefreshStatistics()
dueCount++;
}
});
-
+
$("#info-due-chores").text(Pluralize(dueCount, L('#1 chore is due to be done within the next #2 days', dueCount, nextXDays), L('#1 chores are due to be done within the next #2 days', dueCount, nextXDays)));
$("#info-overdue-chores").text(Pluralize(overdueCount, L('#1 chore is overdue to be done', overdueCount), L('#1 chores are overdue to be done', overdueCount)));
},
diff --git a/public/viewjs/choretracking.js b/public/viewjs/choretracking.js
index 548af50f..709cd88b 100644
--- a/public/viewjs/choretracking.js
+++ b/public/viewjs/choretracking.js
@@ -5,10 +5,10 @@
var jsonForm = $('#choretracking-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("choretracking-form");
- Grocy.Api.Get('chores/get-chore-details/' + jsonForm.chore_id,
+ Grocy.Api.Get('chores/' + jsonForm.chore_id,
function (choreDetails)
{
- Grocy.Api.Get('chores/track-chore-execution/' + jsonForm.chore_id + '?tracked_time=' + Grocy.Components.DateTimePicker.GetValue() + "&done_by=" + Grocy.Components.UserPicker.GetValue(),
+ Grocy.Api.Post('chores/' + jsonForm.chore_id + '/execute?tracked_time=' + Grocy.Components.DateTimePicker.GetValue() + "&done_by=" + Grocy.Components.UserPicker.GetValue(),
function(result)
{
Grocy.FrontendHelpers.EndUiBusy("choretracking-form");
@@ -89,7 +89,7 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
function UndoChoreExecution(executionId)
{
- Grocy.Api.Get('chores/undo-chore-execution/' + executionId.toString(),
+ Grocy.Api.Post('chores/' + executionId.toString() + '/undo',
function(result)
{
toastr.success(L("Chore execution successfully undone"));
diff --git a/public/viewjs/components/batterycard.js b/public/viewjs/components/batterycard.js
index 3a059e6a..3880b364 100644
--- a/public/viewjs/components/batterycard.js
+++ b/public/viewjs/components/batterycard.js
@@ -2,7 +2,7 @@ Grocy.Components.BatteryCard = { };
Grocy.Components.BatteryCard.Refresh = function(batteryId)
{
- Grocy.Api.Get('batteries/get-battery-details/' + batteryId,
+ Grocy.Api.Get('batteries/' + batteryId,
function(batteryDetails)
{
$('#batterycard-battery-name').text(batteryDetails.battery.name);
@@ -10,7 +10,7 @@ Grocy.Components.BatteryCard.Refresh = function(batteryId)
$('#batterycard-battery-last-charged').text((batteryDetails.last_charged || L('never')));
$('#batterycard-battery-last-charged-timeago').text($.timeago(batteryDetails.last_charged || ''));
$('#batterycard-battery-charge-cycles-count').text((batteryDetails.charge_cycles_count || '0'));
-
+
$('#batterycard-battery-edit-button').attr("href", U("/battery/" + batteryDetails.battery.id.toString()));
$('#batterycard-battery-edit-button').removeClass("disabled");
diff --git a/public/viewjs/components/chorecard.js b/public/viewjs/components/chorecard.js
index 09069bc8..9ee9b967 100644
--- a/public/viewjs/components/chorecard.js
+++ b/public/viewjs/components/chorecard.js
@@ -2,7 +2,7 @@ Grocy.Components.ChoreCard = { };
Grocy.Components.ChoreCard.Refresh = function(choreId)
{
- Grocy.Api.Get('chores/get-chore-details/' + choreId,
+ Grocy.Api.Get('chores/' + choreId,
function(choreDetails)
{
$('#chorecard-chore-name').text(choreDetails.chore.name);
@@ -10,7 +10,7 @@ Grocy.Components.ChoreCard.Refresh = function(choreId)
$('#chorecard-chore-last-tracked-timeago').text($.timeago(choreDetails.last_tracked || ''));
$('#chorecard-chore-tracked-count').text((choreDetails.tracked_count || '0'));
$('#chorecard-chore-last-done-by').text((choreDetails.last_done_by.display_name || L('Unknown')));
-
+
$('#chorecard-chore-edit-button').attr("href", U("/chore/" + choreDetails.chore.id.toString()));
$('#chorecard-chore-edit-button').removeClass("disabled");
diff --git a/public/viewjs/components/productcard.js b/public/viewjs/components/productcard.js
index f6467a4d..d83ce546 100644
--- a/public/viewjs/components/productcard.js
+++ b/public/viewjs/components/productcard.js
@@ -2,7 +2,7 @@ Grocy.Components.ProductCard = { };
Grocy.Components.ProductCard.Refresh = function(productId)
{
- Grocy.Api.Get('stock/get-product-details/' + productId,
+ Grocy.Api.Get('stock/' + productId,
function(productDetails)
{
var stockAmount = productDetails.stock_amount || '0';
@@ -58,7 +58,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
}
);
- Grocy.Api.Get('stock/get-product-price-history/' + productId,
+ Grocy.Api.Get('stock/' + productId + '/pricehistory',
function(priceHistoryDataPoints)
{
if (priceHistoryDataPoints.length > 0)
diff --git a/public/viewjs/consume.js b/public/viewjs/consume.js
index 32025657..6d14c4f3 100644
--- a/public/viewjs/consume.js
+++ b/public/viewjs/consume.js
@@ -16,17 +16,17 @@
spoiled = 1;
}
- var apiUrl = 'stock/consume-product/' + jsonForm.product_id + '/' + jsonForm.amount + '?spoiled=' + spoiled;
+ var apiUrl = 'stock/' + jsonForm.product_id + '/consume/' + jsonForm.amount + '?spoiled=' + spoiled;
if ($("#use_specific_stock_entry").is(":checked"))
{
apiUrl += "&stock_entry_id=" + jsonForm.specific_stock_entry;
}
- Grocy.Api.Get('stock/get-product-details/' + jsonForm.product_id,
+ Grocy.Api.Get('stock/' + jsonForm.product_id,
function(productDetails)
{
- Grocy.Api.Get(apiUrl,
+ Grocy.Api.Post(apiUrl,
function(result)
{
$("#specific_stock_entry").find("option").remove().end().append("");
@@ -70,17 +70,17 @@ $('#save-mark-as-open-button').on('click', function(e)
jsonForm.amount = 1;
}
- var apiUrl = 'stock/open-product/' + jsonForm.product_id + '/' + jsonForm.amount;
+ var apiUrl = 'stock/' + jsonForm.product_id + '/open/' + jsonForm.amount;
if ($("#use_specific_stock_entry").is(":checked"))
{
apiUrl += "&stock_entry_id=" + jsonForm.specific_stock_entry;
}
- Grocy.Api.Get('stock/get-product-details/' + jsonForm.product_id,
+ Grocy.Api.Get('stock/' + jsonForm.product_id,
function(productDetails)
{
- Grocy.Api.Get(apiUrl,
+ Grocy.Api.Post(apiUrl,
function(result)
{
$("#specific_stock_entry").find("option").remove().end().append("");
@@ -121,12 +121,12 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
}
var productId = $(e.target).val();
-
+
if (productId)
{
Grocy.Components.ProductCard.Refresh(productId);
- Grocy.Api.Get('stock/get-product-details/' + productId,
+ Grocy.Api.Get('stock/' + productId,
function(productDetails)
{
$('#amount').attr('max', productDetails.stock_amount);
@@ -161,7 +161,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
}
);
- Grocy.Api.Get("stock/get-product-stock-entries/" + productId,
+ Grocy.Api.Get("stock/" + productId,
function (stockEntries)
{
stockEntries.forEach(stockEntry =>
@@ -213,7 +213,7 @@ $('#consume-form input').keydown(function(event)
if (event.keyCode === 13) //Enter
{
event.preventDefault();
-
+
if (document.getElementById('consume-form').checkValidity() === false) //There is at least one validation error
{
return false;
@@ -249,7 +249,7 @@ $("#use_specific_stock_entry").on("change", function()
function UndoStockBooking(bookingId)
{
- Grocy.Api.Get('stock/undo-booking/' + bookingId.toString(),
+ Grocy.Api.Post('booking/' + bookingId.toString() + '/undo',
function(result)
{
toastr.success(L("Booking successfully undone"));
diff --git a/public/viewjs/equipment.js b/public/viewjs/equipment.js
index 436c381b..0ac99eca 100644
--- a/public/viewjs/equipment.js
+++ b/public/viewjs/equipment.js
@@ -73,7 +73,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
equipmentTable.search(value).draw();
});
@@ -98,7 +98,7 @@ $(document).on('click', '.equipment-delete-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/equipment/' + objectId,
+ Grocy.Api.Delete('delete-object/equipment/' + objectId,
function(result)
{
window.location.href = U('/equipment');
diff --git a/public/viewjs/inventory.js b/public/viewjs/inventory.js
index 1a4d69b7..af647d70 100644
--- a/public/viewjs/inventory.js
+++ b/public/viewjs/inventory.js
@@ -5,10 +5,10 @@
var jsonForm = $('#inventory-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("inventory-form");
- Grocy.Api.Get('stock/get-product-details/' + jsonForm.product_id,
+ Grocy.Api.Get('stock/' + jsonForm.product_id,
function (productDetails)
{
- Grocy.Api.Get('stock/inventory-product/' + jsonForm.product_id + '/' + jsonForm.new_amount + '?bestbeforedate=' + Grocy.Components.DateTimePicker.GetValue(),
+ Grocy.Api.Post('stock/' + jsonForm.product_id + '/inventory/' + jsonForm.new_amount + '?bestbeforedate=' + Grocy.Components.DateTimePicker.GetValue(),
function(result)
{
var addBarcode = GetUriParam('addbarcodetoselection');
@@ -24,7 +24,7 @@
productDetails.product.barcode += ',' + addBarcode;
}
- Grocy.Api.Get('edit-object/products/' + productDetails.product.id, productDetails.product,
+ Grocy.Api.Post('edit-object/products/' + productDetails.product.id, productDetails.product,
function (result) { },
function(xhr)
{
@@ -73,7 +73,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
Grocy.Components.ProductCard.Refresh(productId);
- Grocy.Api.Get('stock/get-product-details/' + productId,
+ Grocy.Api.Get('stock/' + productId,
function(productDetails)
{
$('#new_amount').attr('not-equal', productDetails.stock_amount);
@@ -123,7 +123,7 @@ $('#inventory-form input').keydown(function(event)
if (event.keyCode === 13) //Enter
{
event.preventDefault();
-
+
if (document.getElementById('inventory-form').checkValidity() === false) //There is at least one validation error
{
return false;
@@ -139,7 +139,7 @@ $('#new_amount').on('keypress', function(e)
{
$('#new_amount').trigger('change');
});
-
+
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
{
Grocy.FrontendHelpers.ValidateForm('inventory-form');
@@ -154,14 +154,14 @@ $('#new_amount').on('keyup', function(e)
{
var productId = Grocy.Components.ProductPicker.GetValue();
var newAmount = parseInt($('#new_amount').val());
-
+
if (productId)
{
- Grocy.Api.Get('stock/get-product-details/' + productId,
+ Grocy.Api.Get('stock/' + productId,
function(productDetails)
{
var productStockAmount = parseInt(productDetails.stock_amount || '0');
-
+
if (newAmount > productStockAmount)
{
var amountToAdd = newAmount - productDetails.stock_amount;
@@ -193,7 +193,7 @@ $('#new_amount').on('keyup', function(e)
function UndoStockBooking(bookingId)
{
- Grocy.Api.Get('stock/undo-booking/' + bookingId.toString(),
+ Grocy.Api.Get('booking/' + bookingId.toString() + '/undo',
function(result)
{
toastr.success(L("Booking successfully undone"));
diff --git a/public/viewjs/locations.js b/public/viewjs/locations.js
index 2d17a685..9e12f71e 100644
--- a/public/viewjs/locations.js
+++ b/public/viewjs/locations.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
locationsTable.search(value).draw();
});
@@ -52,7 +52,7 @@ $(document).on('click', '.location-delete-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/locations/' + objectId,
+ Grocy.Api.Delete('delete-object/locations/' + objectId,
function(result)
{
window.location.href = U('/locations');
diff --git a/public/viewjs/manageapikeys.js b/public/viewjs/manageapikeys.js
index 869793d0..427b1b08 100644
--- a/public/viewjs/manageapikeys.js
+++ b/public/viewjs/manageapikeys.js
@@ -33,7 +33,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
apiKeysTable.search(value).draw();
});
@@ -58,7 +58,7 @@ $(document).on('click', '.apikey-delete-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/api_keys/' + objectId,
+ Grocy.Api.Delete('delete-object/api_keys/' + objectId,
function(result)
{
window.location.href = U('/manageapikeys');
diff --git a/public/viewjs/productgroups.js b/public/viewjs/productgroups.js
index b35a2aff..bea06e55 100644
--- a/public/viewjs/productgroups.js
+++ b/public/viewjs/productgroups.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
groupsTable.search(value).draw();
});
@@ -52,7 +52,7 @@ $(document).on('click', '.product-group-delete-button', function(e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/product_groups/' + objectId,
+ Grocy.Api.Delete('delete-object/product_groups/' + objectId,
function(result)
{
window.location.href = U('/productgroups');
diff --git a/public/viewjs/products.js b/public/viewjs/products.js
index 9b81e238..1b35f08b 100644
--- a/public/viewjs/products.js
+++ b/public/viewjs/products.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
productsTable.search(value).draw();
});
@@ -36,7 +36,7 @@ $(document).on('click', '.product-delete-button', function (e)
var objectName = $(e.currentTarget).attr('data-product-name');
var objectId = $(e.currentTarget).attr('data-product-id');
- Grocy.Api.Get('stock/get-product-details/' + objectId,
+ Grocy.Api.Get('stock/' + objectId,
function(productDetails)
{
var stockAmount = productDetails.stock_amount || '0';
@@ -59,7 +59,7 @@ $(document).on('click', '.product-delete-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/products/' + objectId,
+ Grocy.Api.Delete('delete-object/products/' + objectId,
function (result)
{
window.location.href = U('/products');
diff --git a/public/viewjs/purchase.js b/public/viewjs/purchase.js
index c3bf5a1d..bc5048f4 100644
--- a/public/viewjs/purchase.js
+++ b/public/viewjs/purchase.js
@@ -5,7 +5,7 @@
var jsonForm = $('#purchase-form').serializeJSON();
Grocy.FrontendHelpers.BeginUiBusy("purchase-form");
- Grocy.Api.Get('stock/get-product-details/' + jsonForm.product_id,
+ Grocy.Api.Get('stock/' + jsonForm.product_id,
function(productDetails)
{
var amount = jsonForm.amount * productDetails.product.qu_factor_purchase_to_stock;
@@ -16,7 +16,7 @@
price = parseFloat(jsonForm.price).toFixed(2);
}
- Grocy.Api.Get('stock/add-product/' + jsonForm.product_id + '/' + amount + '?bestbeforedate=' + Grocy.Components.DateTimePicker.GetValue() + '&price=' + price,
+ Grocy.Api.Post('stock/' + jsonForm.product_id + '/add/' + amount + '?bestbeforedate=' + Grocy.Components.DateTimePicker.GetValue() + '&price=' + price,
function(result)
{
var addBarcode = GetUriParam('addbarcodetoselection');
@@ -89,12 +89,12 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
Grocy.Components.ProductCard.Refresh(productId);
- Grocy.Api.Get('stock/get-product-details/' + productId,
+ Grocy.Api.Get('stock/' + productId,
function(productDetails)
{
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
$('#price').val(productDetails.last_price);
-
+
if (productDetails.product.default_best_before_days.toString() !== '0')
{
if (productDetails.product.default_best_before_days == -1)
@@ -163,7 +163,7 @@ $('#purchase-form input').keydown(function(event)
if (event.keyCode === 13) //Enter
{
event.preventDefault();
-
+
if (document.getElementById('purchase-form').checkValidity() === false) //There is at least one validation error
{
return false;
@@ -197,7 +197,7 @@ if (GetUriParam("flow") === "shoppinglistitemtostock")
function UndoStockBooking(bookingId)
{
- Grocy.Api.Get('stock/undo-booking/' + bookingId.toString(),
+ Grocy.Api.Get('sbooking/' + bookingId.toString() + '/undo',
function(result)
{
toastr.success(L("Booking successfully undone"));
diff --git a/public/viewjs/quantityunits.js b/public/viewjs/quantityunits.js
index e0067d30..21d01064 100644
--- a/public/viewjs/quantityunits.js
+++ b/public/viewjs/quantityunits.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
quantityUnitsTable.search(value).draw();
});
@@ -52,7 +52,7 @@ $(document).on('click', '.quantityunit-delete-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/quantity_units/' + objectId,
+ Grocy.Api.Delete('delete-object/quantity_units/' + objectId,
function(result)
{
window.location.href = U('/quantityunits');
diff --git a/public/viewjs/recipeform.js b/public/viewjs/recipeform.js
index 630e5ff3..6248284f 100644
--- a/public/viewjs/recipeform.js
+++ b/public/viewjs/recipeform.js
@@ -80,7 +80,7 @@ $('#recipe-form input').keydown(function (event)
if (event.keyCode === 13) //Enter
{
event.preventDefault();
-
+
if (document.getElementById('recipe-form').checkValidity() === false) //There is at least one validation error
{
return false;
@@ -114,7 +114,7 @@ $(document).on('click', '.recipe-pos-delete-button', function(e)
if (result === true)
{
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { });
- Grocy.Api.Get('delete-object/recipes_pos/' + objectId,
+ Grocy.Api.Delete('delete-object/recipes_pos/' + objectId,
function(result)
{
window.location.href = U('/recipe/' + Grocy.EditObjectId);
@@ -151,7 +151,7 @@ $(document).on('click', '.recipe-include-delete-button', function(e)
if (result === true)
{
Grocy.Api.Post('edit-object/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(), function() { }, function() { });
- Grocy.Api.Get('delete-object/recipes_nestings/' + objectId,
+ Grocy.Api.Delete('delete-object/recipes_nestings/' + objectId,
function(result)
{
window.location.href = U('/recipe/' + Grocy.EditObjectId);
diff --git a/public/viewjs/recipeposform.js b/public/viewjs/recipeposform.js
index bf1fcdd2..dd125a27 100644
--- a/public/viewjs/recipeposform.js
+++ b/public/viewjs/recipeposform.js
@@ -44,8 +44,8 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
if (productId)
{
Grocy.Components.ProductCard.Refresh(productId);
-
- Grocy.Api.Get('stock/get-product-details/' + productId,
+
+ Grocy.Api.Get('stock/' + productId,
function (productDetails)
{
if (!$("#only_check_single_unit_in_stock").is(":checked"))
@@ -93,7 +93,7 @@ $('#recipe-pos-form input').keydown(function(event)
if (event.keyCode === 13) //Enter
{
event.preventDefault();
-
+
if (document.getElementById('recipe-pos-form').checkValidity() === false) //There is at least one validation error
{
return false;
diff --git a/public/viewjs/recipes.js b/public/viewjs/recipes.js
index f86d217a..24446afe 100644
--- a/public/viewjs/recipes.js
+++ b/public/viewjs/recipes.js
@@ -38,7 +38,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
recipesTables.search(value).draw();
});
@@ -63,7 +63,7 @@ $("#selectedRecipeDeleteButton").on('click', function(e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/recipes/' + objectId,
+ Grocy.Api.Delete('delete-object/recipes/' + objectId,
function(result)
{
window.location.href = U('/recipes');
@@ -101,7 +101,7 @@ $(document).on('click', '.recipe-order-missing-button', function(e)
{
Grocy.FrontendHelpers.BeginUiBusy();
- Grocy.Api.Get('recipes/add-not-fulfilled-products-to-shopping-list/' + objectId,
+ Grocy.Api.Post('recipes/' + objectId + '/shoppinglist',
function(result)
{
window.location.href = U('/recipes');
@@ -140,7 +140,7 @@ $("#selectedRecipeConsumeButton").on('click', function(e)
{
Grocy.FrontendHelpers.BeginUiBusy();
- Grocy.Api.Get('recipes/consume-recipe/' + objectId,
+ Grocy.Api.Get('recipes/' + objectId + '/consume',
function(result)
{
Grocy.FrontendHelpers.EndUiBusy();
diff --git a/public/viewjs/shoppinglist.js b/public/viewjs/shoppinglist.js
index db6bf1f6..9e29ec4b 100644
--- a/public/viewjs/shoppinglist.js
+++ b/public/viewjs/shoppinglist.js
@@ -32,7 +32,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
shoppingListTable.search(value).draw();
});
@@ -46,7 +46,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(4).search(value).draw();
});
@@ -60,11 +60,11 @@ $(".status-filter-button").on("click", function()
$(document).on('click', '.shoppinglist-delete-button', function (e)
{
e.preventDefault();
-
+
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
Grocy.FrontendHelpers.BeginUiBusy();
- Grocy.Api.Get('delete-object/shopping_list/' + shoppingListItemId,
+ Grocy.Api.Delete('delete-object/shopping_list/' + shoppingListItemId,
function(result)
{
$('#shoppinglistitem-' + shoppingListItemId + '-row').fadeOut(500, function()
@@ -84,7 +84,7 @@ $(document).on('click', '.shoppinglist-delete-button', function (e)
$(document).on('click', '#add-products-below-min-stock-amount', function(e)
{
- Grocy.Api.Get('stock/add-missing-products-to-shoppinglist',
+ Grocy.Api.Post('stock/shoppinglist',
function(result)
{
window.location.href = U('/shoppinglist');
@@ -116,7 +116,7 @@ $(document).on('click', '#clear-shopping-list', function(e)
{
Grocy.FrontendHelpers.BeginUiBusy();
- Grocy.Api.Get('stock/clear-shopping-list',
+ Grocy.Api.Post('stock/clearshoppinglist',
function(result)
{
$('#shoppinglist-table tbody tr').fadeOut(500, function()
@@ -140,7 +140,7 @@ $(document).on('click', '#clear-shopping-list', function(e)
$(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', function(e)
{
e.preventDefault();
-
+
var href = $(e.currentTarget).attr('href');
$("#shopping-list-stock-add-workflow-purchase-form-frame").attr("src", href);
@@ -179,7 +179,7 @@ $("#shopping-list-stock-add-workflow-modal").on("hidden.bs.modal", function(e)
$(window).on("message", function(e)
{
var data = e.originalEvent.data;
-
+
if (data.Message === "AfterItemAdded")
{
$(".shoppinglist-delete-button[data-shoppinglist-id='" + data.Payload + "']").click();
@@ -212,7 +212,7 @@ $(window).on("message", function(e)
$(document).on('click', '#shopping-list-stock-add-workflow-skip-button', function(e)
{
e.preventDefault();
-
+
window.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
});
diff --git a/public/viewjs/shoppinglistform.js b/public/viewjs/shoppinglistform.js
index ead9c1ec..361875dc 100644
--- a/public/viewjs/shoppinglistform.js
+++ b/public/viewjs/shoppinglistform.js
@@ -42,8 +42,8 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
if (productId)
{
Grocy.Components.ProductCard.Refresh(productId);
-
- Grocy.Api.Get('stock/get-product-details/' + productId,
+
+ Grocy.Api.Get('stock/' + productId,
function (productDetails)
{
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
@@ -63,7 +63,7 @@ Grocy.Components.ProductPicker.GetInputElement().focus();
if (Grocy.EditMode === "edit")
{
- Grocy.Components.ProductPicker.GetPicker().trigger('change');
+ Grocy.Components.ProductPicker.GetPicker().trigger('change');
}
$('#amount').on('focus', function(e)
@@ -88,7 +88,7 @@ $('#shoppinglist-form input').keydown(function (event)
if (event.keyCode === 13) //Enter
{
event.preventDefault();
-
+
if (document.getElementById('shoppinglist-form').checkValidity() === false) //There is at least one validation error
{
return false;
diff --git a/public/viewjs/stockjournal.js b/public/viewjs/stockjournal.js
index 8ac12b4e..6fa2270c 100644
--- a/public/viewjs/stockjournal.js
+++ b/public/viewjs/stockjournal.js
@@ -28,7 +28,7 @@ $("#product-filter").on("change", function()
{
text = "";
}
-
+
stockJournalTable.column(1).search(text).draw();
});
@@ -39,7 +39,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
stockJournalTable.search(value).draw();
});
@@ -56,7 +56,7 @@ $(document).on('click', '.undo-stock-booking-button', function(e)
var element = $(e.currentTarget);
var bookingId = $(e.currentTarget).attr('data-booking-id');
- Grocy.Api.Get('stock/undo-booking/' + bookingId.toString(),
+ Grocy.Api.Get('booking/' + bookingId.toString() + '/undo',
function(result)
{
element.closest("tr").addClass("text-muted");
diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js
index 69cd2039..4d95fd9f 100644
--- a/public/viewjs/stockoverview.js
+++ b/public/viewjs/stockoverview.js
@@ -30,7 +30,7 @@ $("#location-filter").on("change", function()
{
value = "";
}
-
+
stockOverviewTable.column(4).search(value).draw();
});
@@ -41,7 +41,7 @@ $("#product-group-filter").on("change", function()
{
value = "";
}
-
+
stockOverviewTable.column(6).search(value).draw();
});
@@ -55,7 +55,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(5).search(value).draw();
});
@@ -73,7 +73,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
stockOverviewTable.search(value).draw();
});
@@ -86,16 +86,16 @@ $(document).on('click', '.product-consume-button', function(e)
document.activeElement.blur();
Grocy.FrontendHelpers.BeginUiBusy();
-
+
var productId = $(e.currentTarget).attr('data-product-id');
var productName = $(e.currentTarget).attr('data-product-name');
var productQuName = $(e.currentTarget).attr('data-product-qu-name');
var consumeAmount = $(e.currentTarget).attr('data-consume-amount');
- Grocy.Api.Get('stock/consume-product/' + productId + '/' + consumeAmount,
+ Grocy.Api.Post('stock/' + productId + '/consume/' + consumeAmount,
function()
{
- Grocy.Api.Get('stock/get-product-details/' + productId,
+ Grocy.Api.Get('stock/' + productId,
function(result)
{
var productRow = $('#product-' + productId + '-row');
@@ -122,7 +122,7 @@ $(document).on('click', '.product-consume-button', function(e)
{
$(this).remove();
});
- }
+ }
else
{
$('#product-' + productId + '-amount').parent().effect('highlight', { }, 500);
@@ -183,16 +183,16 @@ $(document).on('click', '.product-open-button', function(e)
document.activeElement.blur();
Grocy.FrontendHelpers.BeginUiBusy();
-
+
var productId = $(e.currentTarget).attr('data-product-id');
var productName = $(e.currentTarget).attr('data-product-name');
var productQuName = $(e.currentTarget).attr('data-product-qu-name');
var button = $(e.currentTarget);
- Grocy.Api.Get('stock/open-product/' + productId + '/1',
+ Grocy.Api.Get('stock/' + productId + 'open/1',
function()
{
- Grocy.Api.Get('stock/get-product-details/' + productId,
+ Grocy.Api.Get('stock/' + productId,
function(result)
{
var productRow = $('#product-' + productId + '-row');
@@ -257,7 +257,7 @@ $(document).on("click", ".product-name-cell", function(e)
function RefreshStatistics()
{
- Grocy.Api.Get('stock/get-current-stock',
+ Grocy.Api.Get('stock',
function(result)
{
var amountSum = 0;
@@ -273,7 +273,7 @@ function RefreshStatistics()
);
var nextXDays = $("#info-expiring-products").data("next-x-days");
- Grocy.Api.Get('stock/get-current-volatil-stock?expiring_days=' + nextXDays,
+ Grocy.Api.Get('stock/volatil?expiring_days=' + nextXDays,
function(result)
{
$("#info-expiring-products").text(Pluralize(result.expiring_products.length, L('#1 product expires within the next #2 days', result.expiring_products.length, nextXDays), L('#1 products expiring within the next #2 days', result.expiring_products.length, nextXDays)));
diff --git a/public/viewjs/taskcategories.js b/public/viewjs/taskcategories.js
index 8429be5e..caec76b7 100644
--- a/public/viewjs/taskcategories.js
+++ b/public/viewjs/taskcategories.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
categoriesTable.search(value).draw();
});
@@ -52,7 +52,7 @@ $(document).on('click', '.task-category-delete-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/task_categories/' + objectId,
+ Grocy.Api.Delete('delete-object/task_categories/' + objectId,
function(result)
{
window.location.href = U('/taskcategories');
diff --git a/public/viewjs/tasks.js b/public/viewjs/tasks.js
index f072444c..2f14b50d 100644
--- a/public/viewjs/tasks.js
+++ b/public/viewjs/tasks.js
@@ -31,7 +31,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
tasksTable.search(value).draw();
});
@@ -45,7 +45,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(5).search(value).draw();
});
@@ -65,12 +65,12 @@ $(document).on('click', '.do-task-button', function(e)
document.activeElement.blur();
Grocy.FrontendHelpers.BeginUiBusy();
-
+
var taskId = $(e.currentTarget).attr('data-task-id');
var taskName = $(e.currentTarget).attr('data-task-name');
var doneTime = moment().format('YYYY-MM-DD HH:mm:ss');
- Grocy.Api.Get('tasks/mark-task-as-completed/' + taskId + '?done_time=' + doneTime,
+ Grocy.Api.Get('tasks/' + taskId + '/complete?done_time=' + doneTime,
function()
{
if (!$("#show-done-tasks").is(":checked"))
@@ -123,7 +123,7 @@ $(document).on('click', '.delete-task-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('delete-object/tasks/' + objectId,
+ Grocy.Api.Delete('delete-object/tasks/' + objectId,
function(result)
{
$('#task-' + objectId + '-row').fadeOut(500, function ()
@@ -161,7 +161,7 @@ if (GetUriParam('include_done'))
function RefreshStatistics()
{
var nextXDays = $("#info-due-tasks").data("next-x-days");
- Grocy.Api.Get('tasks/get-current',
+ Grocy.Api.Get('tasks',
function(result)
{
var dueCount = 0;
@@ -179,7 +179,7 @@ function RefreshStatistics()
dueCount++;
}
});
-
+
$("#info-due-tasks").text(Pluralize(dueCount, L('#1 task is due to be done within the next #2 days', dueCount, nextXDays), L('#1 tasks are due to be done within the next #2 days', dueCount, nextXDays)));
$("#info-overdue-tasks").text(Pluralize(overdueCount, L('#1 task is overdue to be done', overdueCount), L('#1 tasks are overdue to be done', overdueCount)));
},
diff --git a/public/viewjs/users.js b/public/viewjs/users.js
index 01603509..24440fab 100644
--- a/public/viewjs/users.js
+++ b/public/viewjs/users.js
@@ -27,7 +27,7 @@ $("#search").on("keyup", function()
{
value = "";
}
-
+
usersTable.search(value).draw();
});
@@ -52,7 +52,7 @@ $(document).on('click', '.user-delete-button', function (e)
{
if (result === true)
{
- Grocy.Api.Get('users/delete/' + objectId,
+ Grocy.Api.Delete('users/delete/' + objectId,
function(result)
{
window.location.href = U('/users');
diff --git a/routes.php b/routes.php
index 43f37dbd..334f01c0 100644
--- a/routes.php
+++ b/routes.php
@@ -102,7 +102,7 @@ $app->group('/api', function()
$this->get('/users/get', '\Grocy\Controllers\UsersApiController:GetUsers');
$this->post('/users/create', '\Grocy\Controllers\UsersApiController:CreateUser');
$this->post('/users/edit/{userId}', '\Grocy\Controllers\UsersApiController:EditUser');
- $this->get('/users/delete/{userId}', '\Grocy\Controllers\UsersApiController:DeleteUser');
+ $this->delete('/users/delete/{userId}', '\Grocy\Controllers\UsersApiController:DeleteUser');
// User
$this->get('/user/settings/{settingKey}', '\Grocy\Controllers\UsersApiController:GetUserSetting');