mirror of
https://github.com/grocy/grocy.git
synced 2026-04-09 14:06:16 +02:00
viewjs: Wrap in fuctions
This commit's contents were auto-generated. They wrap all viewjs
in functions and define a common prologue.
New file contents:
```js
function VIEWNAMEView(Grocy, scope = null)
{
var $scope = $;
if(scope != null)
{
$scope = $(scope).find;
}
// original contents indented with \t
}
```
This commit is contained in:
parent
151722ea38
commit
fd61d1ef62
|
|
@ -1,10 +1,20 @@
|
||||||
$('[data-toggle="collapse-next"]').on("click", function(e)
|
function aboutView(Grocy, scope = null)
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('[data-toggle="collapse-next"]').on("click", function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(this).parent().next().collapse("toggle");
|
$(this).parent().next().collapse("toggle");
|
||||||
});
|
});
|
||||||
|
|
||||||
if ((typeof GetUriParam("tab") !== "undefined" && GetUriParam("tab") === "changelog"))
|
if ((typeof GetUriParam("tab") !== "undefined" && GetUriParam("tab") === "changelog"))
|
||||||
{
|
{
|
||||||
$(".nav-tabs a[href='#changelog']").tab("show");
|
$(".nav-tabs a[href='#changelog']").tab("show");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,31 @@
|
||||||
Grocy.Use("barcodescanner");
|
function barcodescannertestingView(Grocy, scope = null)
|
||||||
Grocy.BarCodeScannerTestingHitCount = 0;
|
|
||||||
Grocy.BarCodeScannerTestingMissCount = 0;
|
|
||||||
|
|
||||||
$("#scanned_barcode").on("blur", function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
Grocy.Use("barcodescanner");
|
||||||
|
Grocy.BarCodeScannerTestingHitCount = 0;
|
||||||
|
Grocy.BarCodeScannerTestingMissCount = 0;
|
||||||
|
|
||||||
|
$("#scanned_barcode").on("blur", function(e)
|
||||||
|
{
|
||||||
OnBarcodeScanned($("#scanned_barcode").val());
|
OnBarcodeScanned($("#scanned_barcode").val());
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#scanned_barcode").keydown(function(event)
|
$("#scanned_barcode").keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
OnBarcodeScanned($("#scanned_barcode").val());
|
OnBarcodeScanned($("#scanned_barcode").val());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#expected_barcode").on("keyup", function(e)
|
$("#expected_barcode").on("keyup", function(e)
|
||||||
{
|
{
|
||||||
if ($("#expected_barcode").val().length > 1)
|
if ($("#expected_barcode").val().length > 1)
|
||||||
{
|
{
|
||||||
$("#scanned_barcode").removeAttr("disabled");
|
$("#scanned_barcode").removeAttr("disabled");
|
||||||
|
|
@ -30,27 +38,27 @@ $("#expected_barcode").on("keyup", function(e)
|
||||||
$("#barcodescanner-start-button").attr("disabled", "");
|
$("#barcodescanner-start-button").attr("disabled", "");
|
||||||
$("#barcodescanner-start-button").addClass("disabled");
|
$("#barcodescanner-start-button").addClass("disabled");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#expected_barcode").focus();
|
$("#expected_barcode").focus();
|
||||||
setTimeout(function()
|
setTimeout(function()
|
||||||
{
|
{
|
||||||
$("#barcodescanner-start-button").attr("disabled", "");
|
$("#barcodescanner-start-button").attr("disabled", "");
|
||||||
$("#barcodescanner-start-button").addClass("disabled");
|
$("#barcodescanner-start-button").addClass("disabled");
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
if (GetUriParam("barcode") !== undefined)
|
if (GetUriParam("barcode") !== undefined)
|
||||||
{
|
{
|
||||||
$("#expected_barcode").val(GetUriParam("barcode"));
|
$("#expected_barcode").val(GetUriParam("barcode"));
|
||||||
setTimeout(function()
|
setTimeout(function()
|
||||||
{
|
{
|
||||||
$("#expected_barcode").keyup();
|
$("#expected_barcode").keyup();
|
||||||
$("#scanned_barcode").focus();
|
$("#scanned_barcode").focus();
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
function OnBarcodeScanned(barcode)
|
function OnBarcodeScanned(barcode)
|
||||||
{
|
{
|
||||||
if (barcode.length === 0)
|
if (barcode.length === 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -84,14 +92,16 @@ function OnBarcodeScanned(barcode)
|
||||||
$("#scanned_barcode").focus();
|
$("#scanned_barcode").focus();
|
||||||
}
|
}
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
||||||
{
|
{
|
||||||
if (target !== "#scanned_barcode")
|
if (target !== "#scanned_barcode")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OnBarcodeScanned(barcode);
|
OnBarcodeScanned(barcode);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,38 @@
|
||||||
var batteriesTable = $('#batteries-table').DataTable({
|
function batteriesView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var batteriesTable = $('#batteries-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 },
|
{ 'searchable': false, "targets": 0 },
|
||||||
{ "type": "num", "targets": 4 }
|
{ "type": "num", "targets": 4 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#batteries-table tbody').removeClass("d-none");
|
$('#batteries-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(batteriesTable, null, function()
|
Grocy.FrontendHelpers.InitDataTable(batteriesTable, null, function()
|
||||||
{
|
{
|
||||||
$("#search").val("");
|
$("#search").val("");
|
||||||
batteriesTable.search("").draw();
|
batteriesTable.search("").draw();
|
||||||
$("#show-disabled").prop('checked', false);
|
$("#show-disabled").prop('checked', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete battery "%s"?',
|
'Are you sure to delete battery "%s"?',
|
||||||
'.battery-delete-button',
|
'.battery-delete-button',
|
||||||
'data-battery-name',
|
'data-battery-name',
|
||||||
'data-battery-id',
|
'data-battery-id',
|
||||||
'objects/batteries/',
|
'objects/batteries/',
|
||||||
'/batteries'
|
'/batteries'
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#show-disabled").change(function()
|
$("#show-disabled").change(function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
window.location.href = U('/batteries?include_disabled');
|
window.location.href = U('/batteries?include_disabled');
|
||||||
|
|
@ -33,9 +41,11 @@ $("#show-disabled").change(function()
|
||||||
{
|
{
|
||||||
window.location.href = U('/batteries');
|
window.location.href = U('/batteries');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GetUriParam('include_disabled'))
|
if (GetUriParam('include_disabled'))
|
||||||
{
|
{
|
||||||
$("#show-disabled").prop('checked', true);
|
$("#show-disabled").prop('checked', true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,31 @@
|
||||||
var batteriesJournalTable = $('#batteries-journal-table').DataTable({
|
function batteriesjournalView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var batteriesJournalTable = $('#batteries-journal-table').DataTable({
|
||||||
'paginate': true,
|
'paginate': true,
|
||||||
'order': [[2, 'desc']],
|
'order': [[2, 'desc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#batteries-journal-table tbody').removeClass("d-none");
|
$('#batteries-journal-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(batteriesJournalTable);
|
Grocy.FrontendHelpers.InitDataTable(batteriesJournalTable);
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#battery-filter", 1, batteriesJournalTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#battery-filter", 1, batteriesJournalTable);
|
||||||
|
|
||||||
if (typeof GetUriParam("battery") !== "undefined")
|
if (typeof GetUriParam("battery") !== "undefined")
|
||||||
{
|
{
|
||||||
$("#battery-filter").val(GetUriParam("battery"));
|
$("#battery-filter").val(GetUriParam("battery"));
|
||||||
$("#battery-filter").trigger("change");
|
$("#battery-filter").trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '.undo-battery-execution-button', function(e)
|
$(document).on('click', '.undo-battery-execution-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var element = $(e.currentTarget);
|
var element = $(e.currentTarget);
|
||||||
|
|
@ -37,4 +45,6 @@ $(document).on('click', '.undo-battery-execution-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
Grocy.Use("batterycard");
|
function batteriesoverviewView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
var batteriesOverviewTable = $('#batteries-overview-table').DataTable({
|
Grocy.Use("batterycard");
|
||||||
|
|
||||||
|
var batteriesOverviewTable = $('#batteries-overview-table').DataTable({
|
||||||
'order': [[4, 'asc']],
|
'order': [[4, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
|
|
@ -8,14 +16,14 @@ var batteriesOverviewTable = $('#batteries-overview-table').DataTable({
|
||||||
{ "type": "html", "targets": 3 },
|
{ "type": "html", "targets": 3 },
|
||||||
{ "type": "html", "targets": 4 }
|
{ "type": "html", "targets": 4 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#batteries-overview-table tbody').removeClass("d-none");
|
$('#batteries-overview-table tbody').removeClass("d-none");
|
||||||
|
|
||||||
Grocy.FrontendHelpers.InitDataTable(batteriesOverviewTable);
|
Grocy.FrontendHelpers.InitDataTable(batteriesOverviewTable);
|
||||||
Grocy.FrontendHelpers.MakeStatusFilter(batteriesOverviewTable, 5);
|
Grocy.FrontendHelpers.MakeStatusFilter(batteriesOverviewTable, 5);
|
||||||
|
|
||||||
$(document).on('click', '.track-charge-cycle-button', function(e)
|
$(document).on('click', '.track-charge-cycle-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -78,16 +86,16 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".battery-name-cell", function(e)
|
$(document).on("click", ".battery-name-cell", function(e)
|
||||||
{
|
{
|
||||||
Grocy.Components.BatteryCard.Refresh($(e.currentTarget).attr("data-battery-id"));
|
Grocy.Components.BatteryCard.Refresh($(e.currentTarget).attr("data-battery-id"));
|
||||||
$("#batteriesoverview-batterycard-modal").modal("show");
|
$("#batteriesoverview-batterycard-modal").modal("show");
|
||||||
});
|
});
|
||||||
|
|
||||||
function RefreshStatistics()
|
function RefreshStatistics()
|
||||||
{
|
{
|
||||||
var nextXDays = $("#info-due-batteries").data("next-x-days");
|
var nextXDays = $("#info-due-batteries").data("next-x-days");
|
||||||
Grocy.Api.Get('batteries',
|
Grocy.Api.Get('batteries',
|
||||||
function(result)
|
function(result)
|
||||||
|
|
@ -117,6 +125,8 @@ function RefreshStatistics()
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
Grocy.Use("numberpicker");
|
function batteriessettingsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
$("#batteries_due_soon_days").val(Grocy.UserSettings.batteries_due_soon_days);
|
Grocy.Use("numberpicker");
|
||||||
|
|
||||||
RefreshLocaleNumberInput();
|
$("#batteries_due_soon_days").val(Grocy.UserSettings.batteries_due_soon_days);
|
||||||
|
|
||||||
|
RefreshLocaleNumberInput();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,18 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function batteryformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("numberpicker");
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-battery-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-battery-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -64,15 +72,15 @@ $('#save-battery-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#battery-form input').keyup(function(event)
|
$('#battery-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('battery-form');
|
Grocy.FrontendHelpers.ValidateForm('battery-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#battery-form input').keydown(function(event)
|
$('#battery-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -86,8 +94,10 @@ $('#battery-form input').keydown(function(event)
|
||||||
$('#save-battery-button').click();
|
$('#save-battery-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('battery-form');
|
Grocy.FrontendHelpers.ValidateForm('battery-form');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,16 @@
|
||||||
Grocy.Use("batterycard");
|
function batterytrackingView(Grocy, scope = null)
|
||||||
Grocy.Use("datetimepicker");
|
|
||||||
|
|
||||||
$('#save-batterytracking-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
Grocy.Use("batterycard");
|
||||||
|
Grocy.Use("datetimepicker");
|
||||||
|
|
||||||
|
$('#save-batterytracking-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -44,10 +52,10 @@ $('#save-batterytracking-button').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#battery_id').on('change', function(e)
|
$('#battery_id').on('change', function(e)
|
||||||
{
|
{
|
||||||
var input = $('#battery_id_text_input').val().toString();
|
var input = $('#battery_id_text_input').val().toString();
|
||||||
$('#battery_id_text_input').val(input);
|
$('#battery_id_text_input').val(input);
|
||||||
$('#battery_id').data('combobox').refresh();
|
$('#battery_id').data('combobox').refresh();
|
||||||
|
|
@ -59,27 +67,27 @@ $('#battery_id').on('change', function(e)
|
||||||
$('#tracked_time').find('input').focus();
|
$('#tracked_time').find('input').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.combobox').combobox({
|
$('.combobox').combobox({
|
||||||
appendId: '_text_input',
|
appendId: '_text_input',
|
||||||
bsVersion: '4'
|
bsVersion: '4'
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#battery_id').val('');
|
$('#battery_id').val('');
|
||||||
$('#battery_id_text_input').focus();
|
$('#battery_id_text_input').focus();
|
||||||
$('#battery_id_text_input').val('');
|
$('#battery_id_text_input').val('');
|
||||||
$('#battery_id_text_input').trigger('change');
|
$('#battery_id_text_input').trigger('change');
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
|
||||||
|
|
||||||
$('#batterytracking-form input').keyup(function(event)
|
|
||||||
{
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||||
});
|
|
||||||
|
|
||||||
$('#batterytracking-form input').keydown(function(event)
|
$('#batterytracking-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#batterytracking-form input').keydown(function(event)
|
||||||
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -93,11 +101,13 @@ $('#batterytracking-form input').keydown(function(event)
|
||||||
$('#save-batterytracking-button').click();
|
$('#save-batterytracking-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#tracked_time').find('input').on('keypress', function(e)
|
$('#tracked_time').find('input').on('keypress', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,27 @@
|
||||||
/* global fullcalendarEventSources */
|
function calendarView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
import { Calendar } from '@fullcalendar/core';
|
/* global fullcalendarEventSources */
|
||||||
import dayGridPlugin from '@fullcalendar/daygrid';
|
|
||||||
import bootstrapPlugin from '@fullcalendar/bootstrap';
|
|
||||||
import listPlugin from '@fullcalendar/list';
|
|
||||||
import timeGridPlugin from '@fullcalendar/timegrid';
|
|
||||||
import { QrCodeImgHtml } from "../helpers/qrcode";
|
|
||||||
|
|
||||||
import '@fullcalendar/core/main.css';
|
import { Calendar } from '@fullcalendar/core';
|
||||||
import '@fullcalendar/daygrid/main.css';
|
import dayGridPlugin from '@fullcalendar/daygrid';
|
||||||
import '@fullcalendar/timegrid/main.css';
|
import bootstrapPlugin from '@fullcalendar/bootstrap';
|
||||||
import '@fullcalendar/list/main.css';
|
import listPlugin from '@fullcalendar/list';
|
||||||
import '@fullcalendar/bootstrap/main.css';
|
import timeGridPlugin from '@fullcalendar/timegrid';
|
||||||
|
import { QrCodeImgHtml } from "../helpers/qrcode";
|
||||||
|
|
||||||
var calendarOptions = {
|
import '@fullcalendar/core/main.css';
|
||||||
|
import '@fullcalendar/daygrid/main.css';
|
||||||
|
import '@fullcalendar/timegrid/main.css';
|
||||||
|
import '@fullcalendar/list/main.css';
|
||||||
|
import '@fullcalendar/bootstrap/main.css';
|
||||||
|
|
||||||
|
var calendarOptions = {
|
||||||
plugins: [bootstrapPlugin, dayGridPlugin, listPlugin, timeGridPlugin],
|
plugins: [bootstrapPlugin, dayGridPlugin, listPlugin, timeGridPlugin],
|
||||||
themeSystem: "bootstrap",
|
themeSystem: "bootstrap",
|
||||||
header: {
|
header: {
|
||||||
|
|
@ -39,25 +47,25 @@ var calendarOptions = {
|
||||||
{
|
{
|
||||||
window.location.href = info.link;
|
window.location.href = info.link;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (__t('fullcalendar_locale').replace(" ", "") !== "" && __t('fullcalendar_locale') != 'x')
|
if (__t('fullcalendar_locale').replace(" ", "") !== "" && __t('fullcalendar_locale') != 'x')
|
||||||
{
|
{
|
||||||
$.getScript(U('/js/locales/fullcalendar-core/' + __t('fullcalendar_locale') + '.js'));
|
$.getScript(U('/js/locales/fullcalendar-core/' + __t('fullcalendar_locale') + '.js'));
|
||||||
calendarOptions.locale = __t('fullcalendar_locale');
|
calendarOptions.locale = __t('fullcalendar_locale');
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstDay = null;
|
var firstDay = null;
|
||||||
if (!Grocy.CalendarFirstDayOfWeek.isEmpty())
|
if (!Grocy.CalendarFirstDayOfWeek.isEmpty())
|
||||||
{
|
{
|
||||||
firstDay = parseInt(Grocy.CalendarFirstDayOfWeek);
|
firstDay = parseInt(Grocy.CalendarFirstDayOfWeek);
|
||||||
}
|
}
|
||||||
|
|
||||||
var calendar = new Calendar(document.getElementById("calendar"), calendarOptions);
|
var calendar = new Calendar(document.getElementById("calendar"), calendarOptions);
|
||||||
calendar.render();
|
calendar.render();
|
||||||
|
|
||||||
$("#ical-button").on("click", function(e)
|
$("#ical-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
Grocy.Api.Get('calendar/ical/sharing-link',
|
Grocy.Api.Get('calendar/ical/sharing-link',
|
||||||
|
|
@ -75,10 +83,10 @@ $("#ical-button").on("click", function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).one("resize", function()
|
$(window).one("resize", function()
|
||||||
{
|
{
|
||||||
// Automatically switch the calendar to "basicDay" view on small screens
|
// Automatically switch the calendar to "basicDay" view on small screens
|
||||||
// and to "month" otherwise
|
// and to "month" otherwise
|
||||||
if ($(window).width() < 768)
|
if ($(window).width() < 768)
|
||||||
|
|
@ -89,4 +97,6 @@ $(window).one("resize", function()
|
||||||
{
|
{
|
||||||
calendar.changeView("dayGridMonth");
|
calendar.changeView("dayGridMonth");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,16 @@
|
||||||
Grocy.Use("numberpicker");
|
function choreformView(Grocy, scope = null)
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-chore-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-chore-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -73,15 +81,15 @@ $('#save-chore-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#chore-form input').keyup(function(event)
|
$('#chore-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#chore-form input').keydown(function(event)
|
$('#chore-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -95,23 +103,23 @@ $('#chore-form input').keydown(function(event)
|
||||||
$('#save-chore-button').click();
|
$('#save-chore-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var checkboxValues = $("#period_config").val().split(",");
|
var checkboxValues = $("#period_config").val().split(",");
|
||||||
for (var i = 0; i < checkboxValues.length; i++)
|
for (var i = 0; i < checkboxValues.length; i++)
|
||||||
{
|
{
|
||||||
if (!checkboxValues[i].isEmpty())
|
if (!checkboxValues[i].isEmpty())
|
||||||
{
|
{
|
||||||
$("#" + checkboxValues[i]).prop('checked', true);
|
$("#" + checkboxValues[i]).prop('checked', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
||||||
|
|
||||||
setTimeout(function()
|
setTimeout(function()
|
||||||
{
|
{
|
||||||
$(".input-group-chore-period-type").trigger("change");
|
$(".input-group-chore-period-type").trigger("change");
|
||||||
$(".input-group-chore-assignment-type").trigger("change");
|
$(".input-group-chore-assignment-type").trigger("change");
|
||||||
|
|
||||||
|
|
@ -120,10 +128,10 @@ setTimeout(function()
|
||||||
$("#consume_product_on_execution").click();
|
$("#consume_product_on_execution").click();
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
$('.input-group-chore-period-type').on('change', function(e)
|
$('.input-group-chore-period-type').on('change', function(e)
|
||||||
{
|
{
|
||||||
var periodType = $('#period_type').val();
|
var periodType = $('#period_type').val();
|
||||||
var periodDays = $('#period_days').val();
|
var periodDays = $('#period_days').val();
|
||||||
var periodInterval = $('#period_interval').val();
|
var periodInterval = $('#period_interval').val();
|
||||||
|
|
@ -170,10 +178,10 @@ $('.input-group-chore-period-type').on('change', function(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.input-group-chore-assignment-type').on('change', function(e)
|
$('.input-group-chore-assignment-type').on('change', function(e)
|
||||||
{
|
{
|
||||||
var assignmentType = $('#assignment_type').val();
|
var assignmentType = $('#assignment_type').val();
|
||||||
|
|
||||||
$('#chore-period-assignment-info').text("");
|
$('#chore-period-assignment-info').text("");
|
||||||
|
|
@ -204,10 +212,10 @@ $('.input-group-chore-assignment-type').on('change', function(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#consume_product_on_execution").on("click", function()
|
$("#consume_product_on_execution").on("click", function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.Enable();
|
Grocy.Components.ProductPicker.Enable();
|
||||||
|
|
@ -220,10 +228,10 @@ $("#consume_product_on_execution").on("click", function()
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm("chore-form");
|
Grocy.FrontendHelpers.ValidateForm("chore-form");
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
var productId = $(e.target).val();
|
var productId = $(e.target).val();
|
||||||
|
|
||||||
if (productId)
|
if (productId)
|
||||||
|
|
@ -239,4 +247,6 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,37 @@
|
||||||
var choresTable = $('#chores-table').DataTable({
|
function choresView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var choresTable = $('#chores-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#chores-table tbody').removeClass("d-none");
|
$('#chores-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(choresTable, null, function()
|
Grocy.FrontendHelpers.InitDataTable(choresTable, null, function()
|
||||||
{
|
{
|
||||||
$("#search").val("");
|
$("#search").val("");
|
||||||
choresTable.search("").draw();
|
choresTable.search("").draw();
|
||||||
$("#show-disabled").prop('checked', false);
|
$("#show-disabled").prop('checked', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete chore "%s"?',
|
'Are you sure to delete chore "%s"?',
|
||||||
'.core-delete-button',
|
'.core-delete-button',
|
||||||
'data-chore-name',
|
'data-chore-name',
|
||||||
'data-chore-id',
|
'data-chore-id',
|
||||||
'objects/chores/',
|
'objects/chores/',
|
||||||
'/chroes'
|
'/chroes'
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#show-disabled").change(function()
|
$("#show-disabled").change(function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
window.location.href = U('/chores?include_disabled');
|
window.location.href = U('/chores?include_disabled');
|
||||||
|
|
@ -32,9 +40,11 @@ $("#show-disabled").change(function()
|
||||||
{
|
{
|
||||||
window.location.href = U('/chores');
|
window.location.href = U('/chores');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GetUriParam('include_disabled'))
|
if (GetUriParam('include_disabled'))
|
||||||
{
|
{
|
||||||
$("#show-disabled").prop('checked', true);
|
$("#show-disabled").prop('checked', true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,31 @@
|
||||||
var choresJournalTable = $('#chores-journal-table').DataTable({
|
function choresjournalView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var choresJournalTable = $('#chores-journal-table').DataTable({
|
||||||
'paginate': true,
|
'paginate': true,
|
||||||
'order': [[2, 'desc']],
|
'order': [[2, 'desc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#chores-journal-table tbody').removeClass("d-none");
|
$('#chores-journal-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(choresJournalTable);
|
Grocy.FrontendHelpers.InitDataTable(choresJournalTable);
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#chore-filter", 1, choresJournalTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#chore-filter", 1, choresJournalTable);
|
||||||
|
|
||||||
if (typeof GetUriParam("chore") !== "undefined")
|
if (typeof GetUriParam("chore") !== "undefined")
|
||||||
{
|
{
|
||||||
$("#chore-filter").val(GetUriParam("chore"));
|
$("#chore-filter").val(GetUriParam("chore"));
|
||||||
$("#chore-filter").trigger("change");
|
$("#chore-filter").trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '.undo-chore-execution-button', function(e)
|
$(document).on('click', '.undo-chore-execution-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var element = $(e.currentTarget);
|
var element = $(e.currentTarget);
|
||||||
|
|
@ -37,4 +45,6 @@ $(document).on('click', '.undo-chore-execution-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
Grocy.Use("chorecard");
|
function choresoverviewView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
var choresOverviewTable = $('#chores-overview-table').DataTable({
|
Grocy.Use("chorecard");
|
||||||
|
|
||||||
|
var choresOverviewTable = $('#chores-overview-table').DataTable({
|
||||||
'order': [[2, 'asc']],
|
'order': [[2, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
|
|
@ -9,14 +17,14 @@ var choresOverviewTable = $('#chores-overview-table').DataTable({
|
||||||
{ "type": "html", "targets": 2 },
|
{ "type": "html", "targets": 2 },
|
||||||
{ "type": "html", "targets": 3 }
|
{ "type": "html", "targets": 3 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#chores-overview-table tbody').removeClass("d-none");
|
$('#chores-overview-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(choresOverviewTable);
|
Grocy.FrontendHelpers.InitDataTable(choresOverviewTable);
|
||||||
Grocy.FrontendHelpers.MakeValueFilter("status", 5, choresOverviewTable);
|
Grocy.FrontendHelpers.MakeValueFilter("status", 5, choresOverviewTable);
|
||||||
Grocy.FrontendHelpers.MakeValueFilter("user", 6, choresOverviewTable, "");
|
Grocy.FrontendHelpers.MakeValueFilter("user", 6, choresOverviewTable, "");
|
||||||
|
|
||||||
$("#user-filter").on("change", function()
|
$("#user-filter").on("change", function()
|
||||||
{
|
{
|
||||||
var user = $(this).val();
|
var user = $(this).val();
|
||||||
if (user !== null && !user.isEmpty())
|
if (user !== null && !user.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
@ -26,10 +34,10 @@ $("#user-filter").on("change", function()
|
||||||
{
|
{
|
||||||
RemoveUriParam("user")
|
RemoveUriParam("user")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.track-chore-button', function(e)
|
$(document).on('click', '.track-chore-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -125,16 +133,16 @@ $(document).on('click', '.track-chore-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".chore-name-cell", function(e)
|
$(document).on("click", ".chore-name-cell", function(e)
|
||||||
{
|
{
|
||||||
Grocy.Components.ChoreCard.Refresh($(e.currentTarget).attr("data-chore-id"));
|
Grocy.Components.ChoreCard.Refresh($(e.currentTarget).attr("data-chore-id"));
|
||||||
$("#choresoverview-chorecard-modal").modal("show");
|
$("#choresoverview-chorecard-modal").modal("show");
|
||||||
});
|
});
|
||||||
|
|
||||||
function RefreshStatistics()
|
function RefreshStatistics()
|
||||||
{
|
{
|
||||||
var nextXDays = $("#info-due-chores").data("next-x-days");
|
var nextXDays = $("#info-due-chores").data("next-x-days");
|
||||||
Grocy.Api.Get('chores',
|
Grocy.Api.Get('chores',
|
||||||
function(result)
|
function(result)
|
||||||
|
|
@ -171,12 +179,14 @@ function RefreshStatistics()
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetUriParam("user") !== undefined)
|
if (GetUriParam("user") !== undefined)
|
||||||
{
|
{
|
||||||
$("#user-filter").val("xx" + GetUriParam("user") + "xx");
|
$("#user-filter").val("xx" + GetUriParam("user") + "xx");
|
||||||
$("#user-filter").trigger("change");
|
$("#user-filter").trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
Grocy.Use("numberpicker");
|
function choressettingsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
$("#chores_due_soon_days").val(Grocy.UserSettings.chores_due_soon_days);
|
Grocy.Use("numberpicker");
|
||||||
|
|
||||||
RefreshLocaleNumberInput();
|
$("#chores_due_soon_days").val(Grocy.UserSettings.chores_due_soon_days);
|
||||||
|
|
||||||
|
RefreshLocaleNumberInput();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
Grocy.Use("chorecard");
|
function choretrackingView(Grocy, scope = null)
|
||||||
Grocy.Use("datetimepicker");
|
|
||||||
Grocy.Use("userpicker");
|
|
||||||
|
|
||||||
$('#save-choretracking-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
Grocy.Use("chorecard");
|
||||||
|
Grocy.Use("datetimepicker");
|
||||||
|
Grocy.Use("userpicker");
|
||||||
|
|
||||||
|
$('#save-choretracking-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -44,10 +52,10 @@ $('#save-choretracking-button').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#chore_id').on('change', function(e)
|
$('#chore_id').on('change', function(e)
|
||||||
{
|
{
|
||||||
var input = $('#chore_id_text_input').val().toString();
|
var input = $('#chore_id_text_input').val().toString();
|
||||||
$('#chore_id_text_input').val(input);
|
$('#chore_id_text_input').val(input);
|
||||||
$('#chore_id').data('combobox').refresh();
|
$('#chore_id').data('combobox').refresh();
|
||||||
|
|
@ -79,25 +87,25 @@ $('#chore_id').on('change', function(e)
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().focus();
|
Grocy.Components.DateTimePicker.GetInputElement().focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.combobox').combobox({
|
$('.combobox').combobox({
|
||||||
appendId: '_text_input',
|
appendId: '_text_input',
|
||||||
bsVersion: '4'
|
bsVersion: '4'
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#chore_id_text_input').focus();
|
$('#chore_id_text_input').focus();
|
||||||
$('#chore_id_text_input').trigger('change');
|
$('#chore_id_text_input').trigger('change');
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
|
||||||
|
|
||||||
$('#choretracking-form input').keyup(function(event)
|
|
||||||
{
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||||
});
|
|
||||||
|
|
||||||
$('#choretracking-form input').keydown(function(event)
|
$('#choretracking-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#choretracking-form input').keydown(function(event)
|
||||||
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -111,9 +119,11 @@ $('#choretracking-form input').keydown(function(event)
|
||||||
$('#save-choretracking-button').click();
|
$('#save-choretracking-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,21 @@
|
||||||
import { BoolVal } from '../helpers/extensions';
|
function consumeView(Grocy, scope = null)
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
|
||||||
|
|
||||||
Grocy.Use("productamountpicker");
|
|
||||||
Grocy.Use("productcard");
|
|
||||||
Grocy.Use("productpicker");
|
|
||||||
Grocy.Use("recipepicker");
|
|
||||||
|
|
||||||
$('#save-consume-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { BoolVal } from '../helpers/extensions';
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("productamountpicker");
|
||||||
|
Grocy.Use("productcard");
|
||||||
|
Grocy.Use("productpicker");
|
||||||
|
Grocy.Use("recipepicker");
|
||||||
|
|
||||||
|
$('#save-consume-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -147,10 +155,10 @@ $('#save-consume-button').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#save-mark-as-open-button').on('click', function(e)
|
$('#save-mark-as-open-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -214,10 +222,10 @@ $('#save-mark-as-open-button').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
var sumValue = 0;
|
var sumValue = 0;
|
||||||
$("#location_id").on('change', function(e)
|
$("#location_id").on('change', function(e)
|
||||||
{
|
{
|
||||||
var locationId = $(e.target).val();
|
var locationId = $(e.target).val();
|
||||||
sumValue = 0;
|
sumValue = 0;
|
||||||
var stockId = null;
|
var stockId = null;
|
||||||
|
|
@ -299,10 +307,10 @@ $("#location_id").on('change', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
if (BoolVal(Grocy.UserSettings.scan_mode_consume_enabled))
|
if (BoolVal(Grocy.UserSettings.scan_mode_consume_enabled))
|
||||||
{
|
{
|
||||||
Grocy.UISound.BarcodeScannerBeep();
|
Grocy.UISound.BarcodeScannerBeep();
|
||||||
|
|
@ -455,35 +463,35 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount));
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_consume_amount));
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
|
||||||
|
|
||||||
$('#display_amount').on('focus', function(e)
|
|
||||||
{
|
|
||||||
$(this).select();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#price').on('focus', function(e)
|
|
||||||
{
|
|
||||||
$(this).select();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('#consume-form input').keyup(function(event)
|
|
||||||
{
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
});
|
|
||||||
|
|
||||||
$('#consume-form select').change(function(event)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
|
$(this).select();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#price').on('focus', function(e)
|
||||||
|
{
|
||||||
|
$(this).select();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#consume-form input').keyup(function(event)
|
||||||
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#consume-form input').keydown(function(event)
|
$('#consume-form select').change(function(event)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#consume-form input').keydown(function(event)
|
||||||
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -497,10 +505,10 @@ $('#consume-form input').keydown(function(event)
|
||||||
$('#save-consume-button').click();
|
$('#save-consume-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#specific_stock_entry").on("change", function(e)
|
$("#specific_stock_entry").on("change", function(e)
|
||||||
{
|
{
|
||||||
if ($(e.target).val() == "")
|
if ($(e.target).val() == "")
|
||||||
{
|
{
|
||||||
sumValue = 0;
|
sumValue = 0;
|
||||||
|
|
@ -530,10 +538,10 @@ $("#specific_stock_entry").on("change", function(e)
|
||||||
{
|
{
|
||||||
$("#display_amount").attr("max", $('option:selected', this).attr('amount'));
|
$("#display_amount").attr("max", $('option:selected', this).attr('amount'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#use_specific_stock_entry").on("change", function()
|
$("#use_specific_stock_entry").on("change", function()
|
||||||
{
|
{
|
||||||
var value = $(this).is(":checked");
|
var value = $(this).is(":checked");
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
|
|
@ -550,15 +558,15 @@ $("#use_specific_stock_entry").on("change", function()
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm("consume-form");
|
Grocy.FrontendHelpers.ValidateForm("consume-form");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#qu_id").on("change", function()
|
$("#qu_id").on("change", function()
|
||||||
{
|
{
|
||||||
RefreshForm();
|
RefreshForm();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GetUriParam("embedded") !== undefined)
|
if (GetUriParam("embedded") !== undefined)
|
||||||
{
|
{
|
||||||
var locationId = GetUriParam('locationId');
|
var locationId = GetUriParam('locationId');
|
||||||
|
|
||||||
if (typeof locationId === 'undefined')
|
if (typeof locationId === 'undefined')
|
||||||
|
|
@ -573,21 +581,21 @@ if (GetUriParam("embedded") !== undefined)
|
||||||
$("#use_specific_stock_entry").click();
|
$("#use_specific_stock_entry").click();
|
||||||
$("#use_specific_stock_entry").trigger('change');
|
$("#use_specific_stock_entry").trigger('change');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default input field
|
// Default input field
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
|
|
||||||
$(document).on("change", "#scan-mode", function(e)
|
$(document).on("change", "#scan-mode", function(e)
|
||||||
{
|
{
|
||||||
if ($(this).prop("checked"))
|
if ($(this).prop("checked"))
|
||||||
{
|
{
|
||||||
Grocy.UISound.AskForPermission();
|
Grocy.UISound.AskForPermission();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#scan-mode-button").on("click", function(e)
|
$("#scan-mode-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
$("#scan-mode").click();
|
$("#scan-mode").click();
|
||||||
$("#scan-mode-button").toggleClass("btn-success").toggleClass("btn-danger");
|
$("#scan-mode-button").toggleClass("btn-success").toggleClass("btn-danger");
|
||||||
|
|
@ -599,12 +607,12 @@ $("#scan-mode-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
$("#scan-mode-status").text(__t("off"));
|
$("#scan-mode-status").text(__t("off"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#consume-exact-amount').on('change', RefreshForm);
|
$('#consume-exact-amount').on('change', RefreshForm);
|
||||||
var current_productDetails;
|
var current_productDetails;
|
||||||
function RefreshForm()
|
function RefreshForm()
|
||||||
{
|
{
|
||||||
var productDetails = current_productDetails;
|
var productDetails = current_productDetails;
|
||||||
if (!productDetails)
|
if (!productDetails)
|
||||||
{
|
{
|
||||||
|
|
@ -640,4 +648,5 @@ function RefreshForm()
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm("consume-form");
|
Grocy.FrontendHelpers.ValidateForm("consume-form");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
import { ResizeResponsiveEmbeds } from "../helpers/embeds";
|
function equipmentView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
var equipmentTable = $('#equipment-table').DataTable({
|
import { ResizeResponsiveEmbeds } from "../helpers/embeds";
|
||||||
|
|
||||||
|
var equipmentTable = $('#equipment-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
|
|
@ -15,21 +23,21 @@ var equipmentTable = $('#equipment-table').DataTable({
|
||||||
this.api().row({ order: 'current' }, 0).select();
|
this.api().row({ order: 'current' }, 0).select();
|
||||||
DisplayEquipment($('#equipment-table tbody tr:eq(0)').data("equipment-id"));
|
DisplayEquipment($('#equipment-table tbody tr:eq(0)').data("equipment-id"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#equipment-table tbody').removeClass("d-none");
|
$('#equipment-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(equipmentTable);
|
Grocy.FrontendHelpers.InitDataTable(equipmentTable);
|
||||||
|
|
||||||
equipmentTable.on('select', function(e, dt, type, indexes)
|
equipmentTable.on('select', function(e, dt, type, indexes)
|
||||||
{
|
{
|
||||||
if (type === 'row')
|
if (type === 'row')
|
||||||
{
|
{
|
||||||
var selectedEquipmentId = $(equipmentTable.row(indexes[0]).node()).data("equipment-id");
|
var selectedEquipmentId = $(equipmentTable.row(indexes[0]).node()).data("equipment-id");
|
||||||
DisplayEquipment(selectedEquipmentId)
|
DisplayEquipment(selectedEquipmentId)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function DisplayEquipment(id)
|
function DisplayEquipment(id)
|
||||||
{
|
{
|
||||||
Grocy.Api.Get('objects/equipment/' + id,
|
Grocy.Api.Get('objects/equipment/' + id,
|
||||||
function(equipmentItem)
|
function(equipmentItem)
|
||||||
{
|
{
|
||||||
|
|
@ -63,30 +71,32 @@ function DisplayEquipment(id)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete equipment "%s"?',
|
'Are you sure to delete equipment "%s"?',
|
||||||
'.equipment-delete-button',
|
'.equipment-delete-button',
|
||||||
'data-equipment-name',
|
'data-equipment-name',
|
||||||
'data-equipment-id',
|
'data-equipment-id',
|
||||||
'objects/equipment/',
|
'objects/equipment/',
|
||||||
'/equipment'
|
'/equipment'
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#selectedEquipmentInstructionManualToggleFullscreenButton").on('click', function(e)
|
$("#selectedEquipmentInstructionManualToggleFullscreenButton").on('click', function(e)
|
||||||
{
|
{
|
||||||
$("#selectedEquipmentInstructionManualCard").toggleClass("fullscreen");
|
$("#selectedEquipmentInstructionManualCard").toggleClass("fullscreen");
|
||||||
$("#selectedEquipmentInstructionManualCard .card-header").toggleClass("fixed-top");
|
$("#selectedEquipmentInstructionManualCard .card-header").toggleClass("fixed-top");
|
||||||
$("#selectedEquipmentInstructionManualCard .card-body").toggleClass("mt-5");
|
$("#selectedEquipmentInstructionManualCard .card-body").toggleClass("mt-5");
|
||||||
$("body").toggleClass("fullscreen-card");
|
$("body").toggleClass("fullscreen-card");
|
||||||
ResizeResponsiveEmbeds(true);
|
ResizeResponsiveEmbeds(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#selectedEquipmentDescriptionToggleFullscreenButton").on('click', function(e)
|
$("#selectedEquipmentDescriptionToggleFullscreenButton").on('click', function(e)
|
||||||
{
|
{
|
||||||
$("#selectedEquipmentDescriptionCard").toggleClass("fullscreen");
|
$("#selectedEquipmentDescriptionCard").toggleClass("fullscreen");
|
||||||
$("#selectedEquipmentDescriptionCard .card-header").toggleClass("fixed-top");
|
$("#selectedEquipmentDescriptionCard .card-header").toggleClass("fixed-top");
|
||||||
$("#selectedEquipmentDescriptionCard .card-body").toggleClass("mt-5");
|
$("#selectedEquipmentDescriptionCard .card-body").toggleClass("mt-5");
|
||||||
$("body").toggleClass("fullscreen-card");
|
$("body").toggleClass("fullscreen-card");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,18 @@
|
||||||
import { RandomString } from '../helpers/extensions';
|
function equipmentformView(Grocy, scope = null)
|
||||||
import { ResizeResponsiveEmbeds } from '../helpers/embeds';
|
|
||||||
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-equipment-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { RandomString } from '../helpers/extensions';
|
||||||
|
import { ResizeResponsiveEmbeds } from '../helpers/embeds';
|
||||||
|
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-equipment-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -111,15 +119,15 @@ $('#save-equipment-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#equipment-form input').keyup(function(event)
|
$('#equipment-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('equipment-form');
|
Grocy.FrontendHelpers.ValidateForm('equipment-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#equipment-form input').keydown(function(event)
|
$('#equipment-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -133,29 +141,31 @@ $('#equipment-form input').keydown(function(event)
|
||||||
$('#save-equipment-button').click();
|
$('#save-equipment-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.DeleteInstructionManualOnSave = false;
|
Grocy.DeleteInstructionManualOnSave = false;
|
||||||
$('#delete-current-instruction-manual-button').on('click', function(e)
|
$('#delete-current-instruction-manual-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
Grocy.DeleteInstructionManualOnSave = true;
|
Grocy.DeleteInstructionManualOnSave = true;
|
||||||
$("#current-equipment-instruction-manual").addClass("d-none");
|
$("#current-equipment-instruction-manual").addClass("d-none");
|
||||||
$("#delete-current-instruction-manual-on-save-hint").removeClass("d-none");
|
$("#delete-current-instruction-manual-on-save-hint").removeClass("d-none");
|
||||||
$("#delete-current-instruction-manual-button").addClass("disabled");
|
$("#delete-current-instruction-manual-button").addClass("disabled");
|
||||||
$("#instruction-manual-label").addClass("d-none");
|
$("#instruction-manual-label").addClass("d-none");
|
||||||
$("#instruction-manual-label-none").removeClass("d-none");
|
$("#instruction-manual-label-none").removeClass("d-none");
|
||||||
});
|
});
|
||||||
ResizeResponsiveEmbeds();
|
ResizeResponsiveEmbeds();
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('equipment-form');
|
Grocy.FrontendHelpers.ValidateForm('equipment-form');
|
||||||
|
|
||||||
$("#instruction-manual").on("change", function(e)
|
$("#instruction-manual").on("change", function(e)
|
||||||
{
|
{
|
||||||
$("#instruction-manual-label").removeClass("d-none");
|
$("#instruction-manual-label").removeClass("d-none");
|
||||||
$("#instruction-manual-label-none").addClass("d-none");
|
$("#instruction-manual-label-none").addClass("d-none");
|
||||||
$("#delete-current-instruction-manual-on-save-hint").addClass("d-none");
|
$("#delete-current-instruction-manual-on-save-hint").addClass("d-none");
|
||||||
$("#current-instruction-manuale").addClass("d-none");
|
$("#current-instruction-manuale").addClass("d-none");
|
||||||
Grocy.DeleteProductPictureOnSave = false;
|
Grocy.DeleteProductPictureOnSave = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,27 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function inventoryView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("datetimepicker");
|
|
||||||
if (Grocy.UserSettings.show_purchased_date_on_purchase)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("datetimepicker");
|
||||||
|
if (Grocy.UserSettings.show_purchased_date_on_purchase)
|
||||||
|
{
|
||||||
Grocy.Use("datetimepicker2");
|
Grocy.Use("datetimepicker2");
|
||||||
}
|
}
|
||||||
Grocy.Use("locationpicker");
|
Grocy.Use("locationpicker");
|
||||||
Grocy.Use("numberpicker");
|
Grocy.Use("numberpicker");
|
||||||
Grocy.Use("productpicker");
|
Grocy.Use("productpicker");
|
||||||
Grocy.Use("productamountpicker");
|
Grocy.Use("productamountpicker");
|
||||||
Grocy.Use("productcard");
|
Grocy.Use("productcard");
|
||||||
Grocy.Use("shoppinglocationpicker");
|
Grocy.Use("shoppinglocationpicker");
|
||||||
|
|
||||||
$('#save-inventory-button').on('click', function(e)
|
$('#save-inventory-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -137,10 +145,10 @@ $('#save-inventory-button').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
var productId = $(e.target).val();
|
var productId = $(e.target).val();
|
||||||
|
|
||||||
if (productId)
|
if (productId)
|
||||||
|
|
@ -243,28 +251,28 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#display_amount').val('');
|
$('#display_amount').val('');
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker.InAnyFlow() === false && GetUriParam("embedded") === undefined)
|
if (Grocy.Components.ProductPicker.InAnyFlow() === false && GetUriParam("embedded") === undefined)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker.InProductModifyWorkflow())
|
if (Grocy.Components.ProductPicker.InProductModifyWorkflow())
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#display_amount').on('focus', function(e)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
|
|
@ -273,15 +281,15 @@ $('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#inventory-form input').keyup(function(event)
|
$('#inventory-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#inventory-form input').keydown(function(event)
|
$('#inventory-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -295,27 +303,27 @@ $('#inventory-form input').keydown(function(event)
|
||||||
$('#save-inventory-button').click();
|
$('#save-inventory-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('#qu_id').on('change', function(e)
|
$('#qu_id').on('change', function(e)
|
||||||
{
|
{
|
||||||
$('#display_amount').attr('data-not-equal', parseFloat($('#display_amount').attr('data-stock-amount')) * parseFloat($("#qu_id option:selected").attr("data-qu-factor")));
|
$('#display_amount').attr('data-not-equal', parseFloat($('#display_amount').attr('data-stock-amount')) * parseFloat($("#qu_id option:selected").attr("data-qu-factor")));
|
||||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
Grocy.FrontendHelpers.ValidateForm('inventory-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#display_amount').on('keyup', function(e)
|
$('#display_amount').on('keyup', function(e)
|
||||||
{
|
{
|
||||||
var productId = Grocy.Components.ProductPicker.GetValue();
|
var productId = Grocy.Components.ProductPicker.GetValue();
|
||||||
var newAmount = parseInt($('#amount').val());
|
var newAmount = parseInt($('#amount').val());
|
||||||
|
|
||||||
|
|
@ -371,6 +379,8 @@ $('#display_amount').on('keyup', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#display_amount").attr("min", "0");
|
$("#display_amount").attr("min", "0");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,24 @@
|
||||||
$(document).on("click", ".print-all-locations-button", function(e)
|
function locationcontentsheetView(Grocy, scope = null)
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on("click", ".print-all-locations-button", function(e)
|
||||||
|
{
|
||||||
$(".page").removeClass("d-print-none").removeClass("no-page-break");
|
$(".page").removeClass("d-print-none").removeClass("no-page-break");
|
||||||
$(".print-timestamp").text(moment().format("l LT"));
|
$(".print-timestamp").text(moment().format("l LT"));
|
||||||
window.print();
|
window.print();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".print-single-location-button", function(e)
|
$(document).on("click", ".print-single-location-button", function(e)
|
||||||
{
|
{
|
||||||
$(".page").addClass("d-print-none");
|
$(".page").addClass("d-print-none");
|
||||||
$(e.currentTarget).closest(".page").removeClass("d-print-none").addClass("no-page-break");
|
$(e.currentTarget).closest(".page").removeClass("d-print-none").addClass("no-page-break");
|
||||||
$(".print-timestamp").text(moment().format("l LT"));
|
$(".print-timestamp").text(moment().format("l LT"));
|
||||||
window.print();
|
window.print();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function locationformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-location-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-location-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -63,15 +71,15 @@ $('#save-location-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#location-form input').keyup(function(event)
|
$('#location-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('location-form');
|
Grocy.FrontendHelpers.ValidateForm('location-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#location-form input').keydown(function(event)
|
$('#location-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -85,8 +93,10 @@ $('#location-form input').keydown(function(event)
|
||||||
$('#save-location-button').click();
|
$('#save-location-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
Grocy.FrontendHelpers.ValidateForm('location-form');
|
Grocy.FrontendHelpers.ValidateForm('location-form');
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,27 @@
|
||||||
var locationsTable = $('#locations-table').DataTable({
|
function locationsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var locationsTable = $('#locations-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#locations-table tbody').removeClass("d-none");
|
$('#locations-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(locationsTable);
|
Grocy.FrontendHelpers.InitDataTable(locationsTable);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete location "%s"?',
|
'Are you sure to delete location "%s"?',
|
||||||
'.location-delete-button',
|
'.location-delete-button',
|
||||||
'data-location-name',
|
'data-location-name',
|
||||||
'data-location-id',
|
'data-location-id',
|
||||||
'objects/locations/',
|
'objects/locations/',
|
||||||
'/locations'
|
'/locations'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,17 @@
|
||||||
$('#username').focus();
|
function loginView(Grocy, scope = null)
|
||||||
|
|
||||||
if (GetUriParam('invalid') === 'true')
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#username').focus();
|
||||||
|
|
||||||
|
if (GetUriParam('invalid') === 'true')
|
||||||
|
{
|
||||||
$('#login-error').text(__t('Invalid credentials, please try again'));
|
$('#login-error').text(__t('Invalid credentials, please try again'));
|
||||||
$('#login-error').removeClass('d-none');
|
$('#login-error').removeClass('d-none');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,40 @@
|
||||||
import { QrCodeImgHtml } from "../helpers/qrcode";
|
function manageapikeysView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
var apiKeysTable = $('#apikeys-table').DataTable({
|
import { QrCodeImgHtml } from "../helpers/qrcode";
|
||||||
|
|
||||||
|
var apiKeysTable = $('#apikeys-table').DataTable({
|
||||||
'order': [[4, 'desc']],
|
'order': [[4, 'desc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#apikeys-table tbody').removeClass("d-none");
|
$('#apikeys-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(apiKeysTable);
|
Grocy.FrontendHelpers.InitDataTable(apiKeysTable);
|
||||||
|
|
||||||
var createdApiKeyId = GetUriParam('CreatedApiKeyId');
|
var createdApiKeyId = GetUriParam('CreatedApiKeyId');
|
||||||
if (createdApiKeyId !== undefined)
|
if (createdApiKeyId !== undefined)
|
||||||
{
|
{
|
||||||
animateCSS("#apiKeyRow_" + createdApiKeyId, "pulse");
|
animateCSS("#apiKeyRow_" + createdApiKeyId, "pulse");
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete API key "%s"?',
|
'Are you sure to delete API key "%s"?',
|
||||||
'.apikey-delete-button',
|
'.apikey-delete-button',
|
||||||
'data-apikey-apikey',
|
'data-apikey-apikey',
|
||||||
'data-apikey-id',
|
'data-apikey-id',
|
||||||
'objects/api_keys/',
|
'objects/api_keys/',
|
||||||
'/manageapikeys'
|
'/manageapikeys'
|
||||||
);
|
);
|
||||||
|
|
||||||
function QrCodeForApiKey(apiKeyType, apiKey)
|
function QrCodeForApiKey(apiKeyType, apiKey)
|
||||||
{
|
{
|
||||||
var content = U('/api') + '|' + apiKey;
|
var content = U('/api') + '|' + apiKey;
|
||||||
if (apiKeyType === 'special-purpose-calendar-ical')
|
if (apiKeyType === 'special-purpose-calendar-ical')
|
||||||
{
|
{
|
||||||
|
|
@ -34,14 +42,16 @@ function QrCodeForApiKey(apiKeyType, apiKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
return QrCodeImgHtml(content);
|
return QrCodeImgHtml(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.apikey-show-qr-button').on('click', function()
|
$('.apikey-show-qr-button').on('click', function()
|
||||||
{
|
{
|
||||||
var qrcodeHtml = QrCodeForApiKey($(this).data('apikey-type'), $(this).data('apikey-key'));
|
var qrcodeHtml = QrCodeForApiKey($(this).data('apikey-type'), $(this).data('apikey-key'));
|
||||||
bootbox.alert({
|
bootbox.alert({
|
||||||
title: __t('API key'),
|
title: __t('API key'),
|
||||||
message: "<p class='text-center'>" + qrcodeHtml + "</p>",
|
message: "<p class='text-center'>" + qrcodeHtml + "</p>",
|
||||||
closeButton: false
|
closeButton: false
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,49 @@
|
||||||
/* global fullcalendarEventSources, internalRecipes, recipesResolved */
|
function mealplanView(Grocy, scope = null)
|
||||||
|
|
||||||
import { Calendar } from '@fullcalendar/core';
|
|
||||||
import dayGridPlugin from '@fullcalendar/daygrid';
|
|
||||||
import bootstrapPlugin from '@fullcalendar/bootstrap';
|
|
||||||
import momentPlugin from '@fullcalendar/moment/main';
|
|
||||||
import { toMoment } from '@fullcalendar/moment/main';
|
|
||||||
|
|
||||||
import '@fullcalendar/core/main.css';
|
|
||||||
import '@fullcalendar/daygrid/main.css';
|
|
||||||
import '@fullcalendar/bootstrap/main.css';
|
|
||||||
|
|
||||||
Grocy.Use("numberpicker");
|
|
||||||
Grocy.Use("productamountpicker");
|
|
||||||
Grocy.Use("recipepicker");
|
|
||||||
|
|
||||||
var setLocale = false;
|
|
||||||
if (__t('fullcalendar_locale').replace(" ", "") !== "" && __t('fullcalendar_locale') != 'x')
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* global fullcalendarEventSources, internalRecipes, recipesResolved */
|
||||||
|
|
||||||
|
import { Calendar } from '@fullcalendar/core';
|
||||||
|
import dayGridPlugin from '@fullcalendar/daygrid';
|
||||||
|
import bootstrapPlugin from '@fullcalendar/bootstrap';
|
||||||
|
import momentPlugin from '@fullcalendar/moment/main';
|
||||||
|
import { toMoment } from '@fullcalendar/moment/main';
|
||||||
|
|
||||||
|
import '@fullcalendar/core/main.css';
|
||||||
|
import '@fullcalendar/daygrid/main.css';
|
||||||
|
import '@fullcalendar/bootstrap/main.css';
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
Grocy.Use("productamountpicker");
|
||||||
|
Grocy.Use("recipepicker");
|
||||||
|
|
||||||
|
var setLocale = false;
|
||||||
|
if (__t('fullcalendar_locale').replace(" ", "") !== "" && __t('fullcalendar_locale') != 'x')
|
||||||
|
{
|
||||||
setLocale = true;
|
setLocale = true;
|
||||||
$.getScript(U('/js/locales/fullcalendar-core/' + __t('fullcalendar_locale') + '.js'));
|
$.getScript(U('/js/locales/fullcalendar-core/' + __t('fullcalendar_locale') + '.js'));
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstRender = true;
|
var firstRender = true;
|
||||||
Grocy.IsMealPlanEntryEditAction = false;
|
Grocy.IsMealPlanEntryEditAction = false;
|
||||||
Grocy.MealPlanEntryEditObjectId = -1;
|
Grocy.MealPlanEntryEditObjectId = -1;
|
||||||
|
|
||||||
var firstDay = null;
|
var firstDay = null;
|
||||||
if (!Grocy.CalendarFirstDayOfWeek.isEmpty())
|
if (!Grocy.CalendarFirstDayOfWeek.isEmpty())
|
||||||
{
|
{
|
||||||
firstDay = parseInt(Grocy.CalendarFirstDayOfWeek);
|
firstDay = parseInt(Grocy.CalendarFirstDayOfWeek);
|
||||||
}
|
}
|
||||||
if (!Grocy.MealPlanFirstDayOfWeek.isEmpty())
|
if (!Grocy.MealPlanFirstDayOfWeek.isEmpty())
|
||||||
{
|
{
|
||||||
firstDay = parseInt(Grocy.MealPlanFirstDayOfWeek);
|
firstDay = parseInt(Grocy.MealPlanFirstDayOfWeek);
|
||||||
}
|
}
|
||||||
|
|
||||||
var calendar = new Calendar(document.getElementById("calendar"), {
|
var calendar = new Calendar(document.getElementById("calendar"), {
|
||||||
plugins: [dayGridPlugin, bootstrapPlugin, momentPlugin],
|
plugins: [dayGridPlugin, bootstrapPlugin, momentPlugin],
|
||||||
themeSystem: "bootstrap",
|
themeSystem: "bootstrap",
|
||||||
header: {
|
header: {
|
||||||
|
|
@ -297,23 +305,23 @@ var calendar = new Calendar(document.getElementById("calendar"), {
|
||||||
elem.find(".recipe-consume-button").addClass("d-none");
|
elem.find(".recipe-consume-button").addClass("d-none");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// render the calendar.
|
// render the calendar.
|
||||||
calendar.render();
|
calendar.render();
|
||||||
if (setLocale)
|
if (setLocale)
|
||||||
{
|
{
|
||||||
calendar.setOption("locale", __t('fullcalendar_locale'));
|
calendar.setOption("locale", __t('fullcalendar_locale'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// this triggers a re-render, so we can't do that in the callback;
|
// this triggers a re-render, so we can't do that in the callback;
|
||||||
// but it works here no problem.
|
// but it works here no problem.
|
||||||
if (GetUriParam("week") !== undefined)
|
if (GetUriParam("week") !== undefined)
|
||||||
{
|
{
|
||||||
calendar.gotoDate(GetUriParam("week"));
|
calendar.gotoDate(GetUriParam("week"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on("click", ".add-recipe-button", function(e)
|
$(document).on("click", ".add-recipe-button", function(e)
|
||||||
{
|
{
|
||||||
var day = $(this).parent().parent().data("date");
|
var day = $(this).parent().parent().data("date");
|
||||||
|
|
||||||
$("#add-recipe-modal-title").text(__t("Add recipe on %s", day.toString()));
|
$("#add-recipe-modal-title").text(__t("Add recipe on %s", day.toString()));
|
||||||
|
|
@ -322,10 +330,10 @@ $(document).on("click", ".add-recipe-button", function(e)
|
||||||
$("#add-recipe-modal").modal("show");
|
$("#add-recipe-modal").modal("show");
|
||||||
Grocy.FrontendHelpers.ValidateForm("add-recipe-form");
|
Grocy.FrontendHelpers.ValidateForm("add-recipe-form");
|
||||||
Grocy.IsMealPlanEntryEditAction = false;
|
Grocy.IsMealPlanEntryEditAction = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".add-note-button", function(e)
|
$(document).on("click", ".add-note-button", function(e)
|
||||||
{
|
{
|
||||||
var day = $(this).parent().parent().parent().data("date");
|
var day = $(this).parent().parent().parent().data("date");
|
||||||
|
|
||||||
$("#add-note-modal-title").text(__t("Add note on %s", day.toString()));
|
$("#add-note-modal-title").text(__t("Add note on %s", day.toString()));
|
||||||
|
|
@ -334,10 +342,10 @@ $(document).on("click", ".add-note-button", function(e)
|
||||||
$("#add-note-modal").modal("show");
|
$("#add-note-modal").modal("show");
|
||||||
Grocy.FrontendHelpers.ValidateForm("add-note-form");
|
Grocy.FrontendHelpers.ValidateForm("add-note-form");
|
||||||
Grocy.IsMealPlanEntryEditAction = false;
|
Grocy.IsMealPlanEntryEditAction = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".add-product-button", function(e)
|
$(document).on("click", ".add-product-button", function(e)
|
||||||
{
|
{
|
||||||
var day = $(this).parent().parent().parent().data("date");
|
var day = $(this).parent().parent().parent().data("date");
|
||||||
|
|
||||||
$("#add-product-modal-title").text(__t("Add product on %s", day.toString()));
|
$("#add-product-modal-title").text(__t("Add product on %s", day.toString()));
|
||||||
|
|
@ -346,10 +354,10 @@ $(document).on("click", ".add-product-button", function(e)
|
||||||
$("#add-product-modal").modal("show");
|
$("#add-product-modal").modal("show");
|
||||||
Grocy.FrontendHelpers.ValidateForm("add-product-form");
|
Grocy.FrontendHelpers.ValidateForm("add-product-form");
|
||||||
Grocy.IsMealPlanEntryEditAction = false;
|
Grocy.IsMealPlanEntryEditAction = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".edit-meal-plan-entry-button", function(e)
|
$(document).on("click", ".edit-meal-plan-entry-button", function(e)
|
||||||
{
|
{
|
||||||
var mealPlanEntry = JSON.parse($(this).parents(".fc-h-event:first").attr("data-meal-plan-entry"));
|
var mealPlanEntry = JSON.parse($(this).parents(".fc-h-event:first").attr("data-meal-plan-entry"));
|
||||||
|
|
||||||
if (mealPlanEntry.type == "recipe")
|
if (mealPlanEntry.type == "recipe")
|
||||||
|
|
@ -380,25 +388,25 @@ $(document).on("click", ".edit-meal-plan-entry-button", function(e)
|
||||||
}
|
}
|
||||||
Grocy.IsMealPlanEntryEditAction = true;
|
Grocy.IsMealPlanEntryEditAction = true;
|
||||||
Grocy.MealPlanEntryEditObjectId = mealPlanEntry.id;
|
Grocy.MealPlanEntryEditObjectId = mealPlanEntry.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#add-recipe-modal").on("shown.bs.modal", function(e)
|
$("#add-recipe-modal").on("shown.bs.modal", function(e)
|
||||||
{
|
{
|
||||||
Grocy.Components.RecipePicker.GetInputElement().focus();
|
Grocy.Components.RecipePicker.GetInputElement().focus();
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#add-note-modal").on("shown.bs.modal", function(e)
|
$("#add-note-modal").on("shown.bs.modal", function(e)
|
||||||
{
|
{
|
||||||
$("#note").focus();
|
$("#note").focus();
|
||||||
})
|
})
|
||||||
|
|
||||||
$("#add-product-modal").on("shown.bs.modal", function(e)
|
$("#add-product-modal").on("shown.bs.modal", function(e)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).on("click", ".remove-recipe-button, .remove-note-button, .remove-product-button", function(e)
|
$(document).on("click", ".remove-recipe-button, .remove-note-button, .remove-product-button", function(e)
|
||||||
{
|
{
|
||||||
var mealPlanEntry = JSON.parse($(this).parents(".fc-h-event:first").attr("data-meal-plan-entry"));
|
var mealPlanEntry = JSON.parse($(this).parents(".fc-h-event:first").attr("data-meal-plan-entry"));
|
||||||
|
|
||||||
Grocy.Api.Delete('objects/meal_plan/' + mealPlanEntry.id.toString(), {},
|
Grocy.Api.Delete('objects/meal_plan/' + mealPlanEntry.id.toString(), {},
|
||||||
|
|
@ -411,10 +419,10 @@ $(document).on("click", ".remove-recipe-button, .remove-note-button, .remove-pro
|
||||||
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)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#save-add-recipe-button').on('click', function(e)
|
$('#save-add-recipe-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -453,10 +461,10 @@ $('#save-add-recipe-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#save-add-note-button').on('click', function(e)
|
$('#save-add-note-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -499,10 +507,10 @@ $('#save-add-note-button').on('click', function(e)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#save-add-product-button').on('click', function(e)
|
$('#save-add-product-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -549,10 +557,10 @@ $('#save-add-product-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#add-recipe-form input').keydown(function(event)
|
$('#add-recipe-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -566,10 +574,10 @@ $('#add-recipe-form input').keydown(function(event)
|
||||||
$("#save-add-recipe-button").click();
|
$("#save-add-recipe-button").click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#add-product-form input').keydown(function(event)
|
$('#add-product-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -583,10 +591,10 @@ $('#add-product-form input').keydown(function(event)
|
||||||
$("#save-add-product-button").click();
|
$("#save-add-product-button").click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("keydown", "#servings", function(event)
|
$(document).on("keydown", "#servings", function(event)
|
||||||
{
|
{
|
||||||
if (event.key === 13) //Enter
|
if (event.key === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -600,10 +608,10 @@ $(document).on("keydown", "#servings", function(event)
|
||||||
$("#save-add-recipe-button").click();
|
$("#save-add-recipe-button").click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.recipe-order-missing-button', function(e)
|
$(document).on('click', '.recipe-order-missing-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();
|
||||||
|
|
@ -664,10 +672,10 @@ $(document).on('click', '.recipe-order-missing-button', function(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.product-consume-button', function(e)
|
$(document).on('click', '.product-consume-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -704,10 +712,10 @@ $(document).on('click', '.product-consume-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.recipe-consume-button', function(e)
|
$(document).on('click', '.recipe-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();
|
||||||
|
|
@ -762,10 +770,10 @@ $(document).on('click', '.recipe-consume-button', function(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".recipe-popup-button", function(e)
|
$(document).on("click", ".recipe-popup-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();
|
||||||
|
|
@ -799,10 +807,10 @@ $(document).on("click", ".recipe-popup-button", function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).one("resize", function()
|
$(window).one("resize", function()
|
||||||
{
|
{
|
||||||
// Automatically switch the calendar to "basicDay" view on small screens
|
// Automatically switch the calendar to "basicDay" view on small screens
|
||||||
// and to "basicWeek" otherwise
|
// and to "basicWeek" otherwise
|
||||||
if ($(window).width() < 768)
|
if ($(window).width() < 768)
|
||||||
|
|
@ -813,10 +821,10 @@ $(window).one("resize", function()
|
||||||
{
|
{
|
||||||
calendar.changeView("dayGridWeek");
|
calendar.changeView("dayGridWeek");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
var productId = $(e.target).val();
|
var productId = $(e.target).val();
|
||||||
|
|
||||||
if (productId)
|
if (productId)
|
||||||
|
|
@ -840,10 +848,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.RecipePicker.GetPicker().on('change', function(e)
|
Grocy.Components.RecipePicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
var recipeId = $(e.target).val();
|
var recipeId = $(e.target).val();
|
||||||
|
|
||||||
if (recipeId)
|
if (recipeId)
|
||||||
|
|
@ -861,4 +869,6 @@ Grocy.Components.RecipePicker.GetPicker().on('change', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,22 @@
|
||||||
/* global SwaggerUIBundle, SwaggerUIStandalonePreset */
|
function openapiuiView(Grocy, scope = null)
|
||||||
function HideTopbarPlugin()
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* global SwaggerUIBundle, SwaggerUIStandalonePreset */
|
||||||
|
function HideTopbarPlugin()
|
||||||
|
{
|
||||||
return {
|
return {
|
||||||
components: {
|
components: {
|
||||||
Topbar: function() { return null }
|
Topbar: function() { return null }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const swaggerUi = SwaggerUIBundle({
|
const swaggerUi = SwaggerUIBundle({
|
||||||
url: Grocy.OpenApi.SpecUrl,
|
url: Grocy.OpenApi.SpecUrl,
|
||||||
dom_id: '#swagger-ui',
|
dom_id: '#swagger-ui',
|
||||||
deepLinking: true,
|
deepLinking: true,
|
||||||
|
|
@ -22,6 +30,8 @@ const swaggerUi = SwaggerUIBundle({
|
||||||
],
|
],
|
||||||
layout: 'StandaloneLayout',
|
layout: 'StandaloneLayout',
|
||||||
docExpansion: "list"
|
docExpansion: "list"
|
||||||
});
|
});
|
||||||
|
|
||||||
window.ui = swaggerUi;
|
window.ui = swaggerUi;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function productbarcodeformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use('barcodescanner');
|
|
||||||
Grocy.Use("productamountpicker");
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-barcode-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use('barcodescanner');
|
||||||
|
Grocy.Use("productamountpicker");
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-barcode-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -53,25 +61,25 @@ $('#save-barcode-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#barcode').on('keyup', function(e)
|
$('#barcode').on('keyup', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#qu_id').on('change', function(e)
|
$('#qu_id').on('change', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#display_amount').on('keyup', function(e)
|
$('#display_amount').on('keyup', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#barcode-form input').keydown(function(event)
|
$('#barcode-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -85,27 +93,29 @@ $('#barcode-form input').keydown(function(event)
|
||||||
$('#save-barcode-button').click();
|
$('#save-barcode-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductAmountPicker.Reload(Grocy.EditObjectProduct.id, Grocy.EditObjectProduct.qu_id_purchase);
|
Grocy.Components.ProductAmountPicker.Reload(Grocy.EditObjectProduct.id, Grocy.EditObjectProduct.qu_id_purchase);
|
||||||
if (Grocy.EditMode == "edit")
|
if (Grocy.EditMode == "edit")
|
||||||
{
|
{
|
||||||
$("#display_amount").val(Grocy.EditObject.amount);
|
$("#display_amount").val(Grocy.EditObject.amount);
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
Grocy.Components.ProductAmountPicker.SetQuantityUnit(Grocy.EditObject.qu_id);
|
Grocy.Components.ProductAmountPicker.SetQuantityUnit(Grocy.EditObject.qu_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
Grocy.FrontendHelpers.ValidateForm('barcode-form');
|
||||||
$('#barcode').focus();
|
$('#barcode').focus();
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
Grocy.Components.UserfieldsForm.Load()
|
Grocy.Components.UserfieldsForm.Load()
|
||||||
|
|
||||||
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
$(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
|
||||||
{
|
{
|
||||||
if (target !== "#barcode")
|
if (target !== "#barcode")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#barcode").val(barcode);
|
$("#barcode").val(barcode);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
import { BoolVal } from '../helpers/extensions';
|
function productformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("numberpicker");
|
|
||||||
Grocy.Use("shoppinglocationpicker");
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
function saveProductPicture(result, location, jsonData)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { BoolVal } from '../helpers/extensions';
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
Grocy.Use("shoppinglocationpicker");
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
function saveProductPicture(result, location, jsonData)
|
||||||
|
{
|
||||||
var productId = Grocy.EditObjectId || result.created_object_id;
|
var productId = Grocy.EditObjectId || result.created_object_id;
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Save(() =>
|
Grocy.Components.UserfieldsForm.Save(() =>
|
||||||
|
|
@ -81,10 +89,10 @@ function saveProductPicture(result, location, jsonData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.save-product-button').on('click', function(e)
|
$('.save-product-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonData = $('#product-form').serializeJSON();
|
var jsonData = $('#product-form').serializeJSON();
|
||||||
|
|
@ -143,10 +151,10 @@ $('.save-product-button').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Grocy.EditMode == "edit")
|
if (Grocy.EditMode == "edit")
|
||||||
{
|
{
|
||||||
Grocy.Api.Get('stock/products/' + Grocy.EditObjectId,
|
Grocy.Api.Get('stock/products/' + Grocy.EditObjectId,
|
||||||
function(productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
|
|
@ -160,22 +168,22 @@ if (Grocy.EditMode == "edit")
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetUriParam("flow") == "InplaceNewProductWithName")
|
if (GetUriParam("flow") == "InplaceNewProductWithName")
|
||||||
{
|
{
|
||||||
$('#name').val(GetUriParam("name"));
|
$('#name').val(GetUriParam("name"));
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetUriParam("flow") !== undefined || GetUriParam("returnto") !== undefined)
|
if (GetUriParam("flow") !== undefined || GetUriParam("returnto") !== undefined)
|
||||||
{
|
{
|
||||||
$("#save-hint").addClass("d-none");
|
$("#save-hint").addClass("d-none");
|
||||||
$(".save-product-button[data-location='return']").addClass("d-none");
|
$(".save-product-button[data-location='return']").addClass("d-none");
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.input-group-qu').on('change', function(e)
|
$('.input-group-qu').on('change', function(e)
|
||||||
{
|
{
|
||||||
var quIdPurchase = $("#qu_id_purchase").val();
|
var quIdPurchase = $("#qu_id_purchase").val();
|
||||||
var quIdStock = $("#qu_id_stock").val();
|
var quIdStock = $("#qu_id_stock").val();
|
||||||
var factor = $('#qu_factor_purchase_to_stock').val();
|
var factor = $('#qu_factor_purchase_to_stock').val();
|
||||||
|
|
@ -194,10 +202,10 @@ $('.input-group-qu').on('change', function(e)
|
||||||
$("#quick_consume_qu_info").text($("#qu_id_stock option:selected").text());
|
$("#quick_consume_qu_info").text($("#qu_id_stock option:selected").text());
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#product-form input').keyup(function(event)
|
$('#product-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||||
$(".input-group-qu").trigger("change");
|
$(".input-group-qu").trigger("change");
|
||||||
$("#product-form select").trigger("select");
|
$("#product-form select").trigger("select");
|
||||||
|
|
@ -215,15 +223,15 @@ $('#product-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
$("#barcode-add-button").addClass("disabled");
|
$("#barcode-add-button").addClass("disabled");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#location_id').change(function(event)
|
$('#location_id').change(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#product-form input').keydown(function(event)
|
$('#product-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -237,10 +245,10 @@ $('#product-form input').keydown(function(event)
|
||||||
$('#save-product-button').click();
|
$('#save-product-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#enable_tare_weight_handling").on("click", function()
|
$("#enable_tare_weight_handling").on("click", function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
$("#tare_weight").removeAttr("disabled");
|
$("#tare_weight").removeAttr("disabled");
|
||||||
|
|
@ -251,28 +259,28 @@ $("#enable_tare_weight_handling").on("click", function()
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm("product-form");
|
Grocy.FrontendHelpers.ValidateForm("product-form");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#product-picture").on("change", function(e)
|
$("#product-picture").on("change", function(e)
|
||||||
{
|
{
|
||||||
$("#product-picture-label").removeClass("d-none");
|
$("#product-picture-label").removeClass("d-none");
|
||||||
$("#product-picture-label-none").addClass("d-none");
|
$("#product-picture-label-none").addClass("d-none");
|
||||||
$("#delete-current-product-picture-on-save-hint").addClass("d-none");
|
$("#delete-current-product-picture-on-save-hint").addClass("d-none");
|
||||||
$("#current-product-picture").addClass("d-none");
|
$("#current-product-picture").addClass("d-none");
|
||||||
Grocy.DeleteProductPictureOnSave = false;
|
Grocy.DeleteProductPictureOnSave = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.DeleteProductPictureOnSave = false;
|
Grocy.DeleteProductPictureOnSave = false;
|
||||||
$("#delete-current-product-picture-button").on("click", function(e)
|
$("#delete-current-product-picture-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
Grocy.DeleteProductPictureOnSave = true;
|
Grocy.DeleteProductPictureOnSave = true;
|
||||||
$("#current-product-picture").addClass("d-none");
|
$("#current-product-picture").addClass("d-none");
|
||||||
$("#delete-current-product-picture-on-save-hint").removeClass("d-none");
|
$("#delete-current-product-picture-on-save-hint").removeClass("d-none");
|
||||||
$("#product-picture-label").addClass("d-none");
|
$("#product-picture-label").addClass("d-none");
|
||||||
$("#product-picture-label-none").removeClass("d-none");
|
$("#product-picture-label-none").removeClass("d-none");
|
||||||
});
|
});
|
||||||
|
|
||||||
var quConversionsTable = $('#qu-conversions-table-products').DataTable({
|
var quConversionsTable = $('#qu-conversions-table-products').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
"orderFixed": [[4, 'asc']],
|
"orderFixed": [[4, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
|
|
@ -284,11 +292,11 @@ var quConversionsTable = $('#qu-conversions-table-products').DataTable({
|
||||||
enable: true,
|
enable: true,
|
||||||
dataSrc: 4
|
dataSrc: 4
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#qu-conversions-table-products tbody').removeClass("d-none");
|
$('#qu-conversions-table-products tbody').removeClass("d-none");
|
||||||
quConversionsTable.columns.adjust().draw();
|
quConversionsTable.columns.adjust().draw();
|
||||||
|
|
||||||
var barcodeTable = $('#barcode-table').DataTable({
|
var barcodeTable = $('#barcode-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
"orderFixed": [[1, 'asc']],
|
"orderFixed": [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
|
|
@ -297,18 +305,18 @@ var barcodeTable = $('#barcode-table').DataTable({
|
||||||
{ 'visible': false, 'targets': 5 },
|
{ 'visible': false, 'targets': 5 },
|
||||||
{ 'visible': false, 'targets': 6 }
|
{ 'visible': false, 'targets': 6 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#barcode-table tbody').removeClass("d-none");
|
$('#barcode-table tbody').removeClass("d-none");
|
||||||
barcodeTable.columns.adjust().draw();
|
barcodeTable.columns.adjust().draw();
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$("#name").trigger("keyup");
|
$("#name").trigger("keyup");
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
$('.input-group-qu').trigger('change');
|
$('.input-group-qu').trigger('change');
|
||||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||||
|
|
||||||
$(document).on('click', '.stockentry-grocycode-product-label-print', function(e)
|
$(document).on('click', '.stockentry-grocycode-product-label-print', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
|
|
@ -320,10 +328,10 @@ $(document).on('click', '.stockentry-grocycode-product-label-print', function(e)
|
||||||
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.qu-conversion-delete-button', function(e)
|
$(document).on('click', '.qu-conversion-delete-button', function(e)
|
||||||
{
|
{
|
||||||
var objectId = $(e.currentTarget).attr('data-qu-conversion-id');
|
var objectId = $(e.currentTarget).attr('data-qu-conversion-id');
|
||||||
|
|
||||||
bootbox.confirm({
|
bootbox.confirm({
|
||||||
|
|
@ -357,10 +365,10 @@ $(document).on('click', '.qu-conversion-delete-button', function(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.barcode-delete-button', function(e)
|
$(document).on('click', '.barcode-delete-button', function(e)
|
||||||
{
|
{
|
||||||
var objectId = $(e.currentTarget).attr('data-barcode-id');
|
var objectId = $(e.currentTarget).attr('data-barcode-id');
|
||||||
|
|
||||||
bootbox.confirm({
|
bootbox.confirm({
|
||||||
|
|
@ -394,10 +402,10 @@ $(document).on('click', '.barcode-delete-button', function(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#qu_id_stock').change(function(e)
|
$('#qu_id_stock').change(function(e)
|
||||||
{
|
{
|
||||||
// Preset QU purchase with stock QU if unset
|
// Preset QU purchase with stock QU if unset
|
||||||
var quIdStock = $('#qu_id_stock');
|
var quIdStock = $('#qu_id_stock');
|
||||||
var quIdPurchase = $('#qu_id_purchase');
|
var quIdPurchase = $('#qu_id_purchase');
|
||||||
|
|
@ -407,10 +415,10 @@ $('#qu_id_stock').change(function(e)
|
||||||
quIdPurchase[0].selectedIndex = quIdStock[0].selectedIndex;
|
quIdPurchase[0].selectedIndex = quIdStock[0].selectedIndex;
|
||||||
Grocy.FrontendHelpers.ValidateForm('product-form');
|
Grocy.FrontendHelpers.ValidateForm('product-form');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#allow_label_per_unit').on('change', function()
|
$('#allow_label_per_unit').on('change', function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
$('#label-option-per-unit').prop("disabled", false);
|
$('#label-option-per-unit').prop("disabled", false);
|
||||||
|
|
@ -423,20 +431,20 @@ $('#allow_label_per_unit').on('change', function()
|
||||||
}
|
}
|
||||||
$('#label-option-per-unit').prop("disabled", true);
|
$('#label-option-per-unit').prop("disabled", true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).on("message", function(e)
|
$(window).on("message", function(e)
|
||||||
{
|
{
|
||||||
var data = e.originalEvent.data;
|
var data = e.originalEvent.data;
|
||||||
|
|
||||||
if (data.Message === "ProductBarcodesChanged" || data.Message === "ProductQUConversionChanged")
|
if (data.Message === "ProductBarcodesChanged" || data.Message === "ProductQUConversionChanged")
|
||||||
{
|
{
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Grocy.EditMode == "create" && GetUriParam("copy-of") != undefined)
|
if (Grocy.EditMode == "create" && GetUriParam("copy-of") != undefined)
|
||||||
{
|
{
|
||||||
Grocy.Api.Get('objects/products/' + GetUriParam("copy-of"),
|
Grocy.Api.Get('objects/products/' + GetUriParam("copy-of"),
|
||||||
function(sourceProduct)
|
function(sourceProduct)
|
||||||
{
|
{
|
||||||
|
|
@ -491,9 +499,9 @@ if (Grocy.EditMode == "create" && GetUriParam("copy-of") != undefined)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (Grocy.EditMode === 'create')
|
else if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
if (Grocy.UserSettings.product_presets_location_id.toString() !== '-1')
|
if (Grocy.UserSettings.product_presets_location_id.toString() !== '-1')
|
||||||
{
|
{
|
||||||
$("#location_id").val(Grocy.UserSettings.product_presets_location_id);
|
$("#location_id").val(Grocy.UserSettings.product_presets_location_id);
|
||||||
|
|
@ -508,6 +516,8 @@ else if (Grocy.EditMode === 'create')
|
||||||
{
|
{
|
||||||
$("select.input-group-qu").val(Grocy.UserSettings.product_presets_qu_id);
|
$("select.input-group-qu").val(Grocy.UserSettings.product_presets_qu_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm("product-form");
|
Grocy.FrontendHelpers.ValidateForm("product-form");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function productgroupformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-product-group-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-product-group-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -49,15 +57,15 @@ $('#save-product-group-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#product-group-form input').keyup(function(event)
|
$('#product-group-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('product-group-form');
|
Grocy.FrontendHelpers.ValidateForm('product-group-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#product-group-form input').keydown(function(event)
|
$('#product-group-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -71,8 +79,10 @@ $('#product-group-form input').keydown(function(event)
|
||||||
$('#save-product-group-button').click();
|
$('#save-product-group-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('product-group-form');
|
Grocy.FrontendHelpers.ValidateForm('product-group-form');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,37 @@
|
||||||
var groupsTable = $('#productgroups-table').DataTable({
|
function productgroupsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var groupsTable = $('#productgroups-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#productgroups-table tbody').removeClass("d-none");
|
$('#productgroups-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(groupsTable);
|
Grocy.FrontendHelpers.InitDataTable(groupsTable);
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete product group "%s"?',
|
'Are you sure to delete product group "%s"?',
|
||||||
'.product-group-delete-button',
|
'.product-group-delete-button',
|
||||||
'data-group-name',
|
'data-group-name',
|
||||||
'data-group-id',
|
'data-group-id',
|
||||||
'objects/product_groups/',
|
'objects/product_groups/',
|
||||||
'/productgroups'
|
'/productgroups'
|
||||||
);
|
);
|
||||||
|
|
||||||
$(window).on("message", function(e)
|
$(window).on("message", function(e)
|
||||||
{
|
{
|
||||||
var data = e.originalEvent.data;
|
var data = e.originalEvent.data;
|
||||||
|
|
||||||
if (data.Message === "CloseAllModals")
|
if (data.Message === "CloseAllModals")
|
||||||
{
|
{
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,12 @@
|
||||||
var productsTable = $('#products-table').DataTable({
|
function productsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var productsTable = $('#products-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
|
|
@ -6,24 +14,24 @@
|
||||||
{ 'visible': false, 'targets': 7 },
|
{ 'visible': false, 'targets': 7 },
|
||||||
{ "type": "html-num-fmt", "targets": 3 }
|
{ "type": "html-num-fmt", "targets": 3 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#products-table tbody').removeClass("d-none");
|
$('#products-table tbody').removeClass("d-none");
|
||||||
|
|
||||||
Grocy.FrontendHelpers.InitDataTable(productsTable, null, function()
|
Grocy.FrontendHelpers.InitDataTable(productsTable, null, function()
|
||||||
{
|
{
|
||||||
$("#search").val("");
|
$("#search").val("");
|
||||||
productsTable.search("").draw();
|
productsTable.search("").draw();
|
||||||
$("#show-disabled").prop('checked', false);
|
$("#show-disabled").prop('checked', false);
|
||||||
})
|
})
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#product-group-filter", 6, productsTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#product-group-filter", 6, productsTable);
|
||||||
if (typeof GetUriParam("product-group") !== "undefined")
|
if (typeof GetUriParam("product-group") !== "undefined")
|
||||||
{
|
{
|
||||||
$("#product-group-filter").val(GetUriParam("product-group"));
|
$("#product-group-filter").val(GetUriParam("product-group"));
|
||||||
$("#product-group-filter").trigger("change");
|
$("#product-group-filter").trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
(objectId, objectName) =>
|
(objectId, objectName) =>
|
||||||
{
|
{
|
||||||
return __t('Are you sure to delete product "%s"?', objectName) +
|
return __t('Are you sure to delete product "%s"?', objectName) +
|
||||||
|
|
@ -35,10 +43,10 @@ Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'data-product-id',
|
'data-product-id',
|
||||||
'objects/products/',
|
'objects/products/',
|
||||||
'/products'
|
'/products'
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#show-disabled").change(function()
|
$("#show-disabled").change(function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
window.location.href = U('/products?include_disabled');
|
window.location.href = U('/products?include_disabled');
|
||||||
|
|
@ -47,24 +55,24 @@ $("#show-disabled").change(function()
|
||||||
{
|
{
|
||||||
window.location.href = U('/products');
|
window.location.href = U('/products');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GetUriParam('include_disabled'))
|
if (GetUriParam('include_disabled'))
|
||||||
{
|
{
|
||||||
$("#show-disabled").prop('checked', true);
|
$("#show-disabled").prop('checked', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$(".merge-products-button").on("click", function(e)
|
$(".merge-products-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
var productId = $(e.currentTarget).attr("data-product-id");
|
var productId = $(e.currentTarget).attr("data-product-id");
|
||||||
$("#merge-products-keep").val(productId);
|
$("#merge-products-keep").val(productId);
|
||||||
$("#merge-products-remove").val("");
|
$("#merge-products-remove").val("");
|
||||||
$("#merge-products-modal").modal("show");
|
$("#merge-products-modal").modal("show");
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#merge-products-save-button").on("click", function()
|
$("#merge-products-save-button").on("click", function()
|
||||||
{
|
{
|
||||||
var productIdToKeep = $("#merge-products-keep").val();
|
var productIdToKeep = $("#merge-products-keep").val();
|
||||||
var productIdToRemove = $("#merge-products-remove").val();
|
var productIdToRemove = $("#merge-products-remove").val();
|
||||||
|
|
||||||
|
|
@ -78,4 +86,6 @@ $("#merge-products-save-button").on("click", function()
|
||||||
Grocy.FrontendHelpers.ShowGenericError('Error while merging products', xhr.response);
|
Grocy.FrontendHelpers.ShowGenericError('Error while merging products', xhr.response);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,29 @@
|
||||||
import { BoolVal } from '../helpers/extensions';
|
function purchaseView(Grocy, scope = null)
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
|
||||||
|
|
||||||
Grocy.Use("datetimepicker");
|
|
||||||
if (Grocy.UserSettings.show_purchased_date_on_purchase)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { BoolVal } from '../helpers/extensions';
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("datetimepicker");
|
||||||
|
if (Grocy.UserSettings.show_purchased_date_on_purchase)
|
||||||
|
{
|
||||||
Grocy.Use("datetimepicker2");
|
Grocy.Use("datetimepicker2");
|
||||||
}
|
}
|
||||||
Grocy.Use("locationpicker");
|
Grocy.Use("locationpicker");
|
||||||
Grocy.Use("numberpicker");
|
Grocy.Use("numberpicker");
|
||||||
Grocy.Use("productamountpicker");
|
Grocy.Use("productamountpicker");
|
||||||
Grocy.Use("productcard");
|
Grocy.Use("productcard");
|
||||||
Grocy.Use("shoppinglocationpicker");
|
Grocy.Use("shoppinglocationpicker");
|
||||||
|
|
||||||
var CurrentProductDetails;
|
var CurrentProductDetails;
|
||||||
|
|
||||||
$('#save-purchase-button').on('click', function(e)
|
$('#save-purchase-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -221,10 +229,10 @@ $('#save-purchase-button').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker !== undefined)
|
if (Grocy.Components.ProductPicker !== undefined)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
||||||
|
|
@ -408,15 +416,15 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount));
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount));
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker)
|
if (Grocy.Components.ProductPicker)
|
||||||
{
|
{
|
||||||
if (Grocy.Components.ProductPicker.InAnyFlow() === false && GetUriParam("embedded") === undefined)
|
if (Grocy.Components.ProductPicker.InAnyFlow() === false && GetUriParam("embedded") === undefined)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
|
|
@ -430,10 +438,10 @@ if (Grocy.Components.ProductPicker)
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#display_amount').on('focus', function(e)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
|
|
@ -442,20 +450,20 @@ $('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#price').on('focus', function(e)
|
$('#price').on('focus', function(e)
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#purchase-form input').keyup(function(event)
|
$('#purchase-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#purchase-form input').keydown(function(event)
|
$('#purchase-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -469,10 +477,10 @@ $('#purchase-form input').keydown(function(event)
|
||||||
$('#save-purchase-button').click();
|
$('#save-purchase-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Grocy.Components.DateTimePicker)
|
if (Grocy.Components.DateTimePicker)
|
||||||
{
|
{
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
|
|
@ -482,10 +490,10 @@ if (Grocy.Components.DateTimePicker)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Grocy.Components.DateTimePicker2)
|
if (Grocy.Components.DateTimePicker2)
|
||||||
{
|
{
|
||||||
Grocy.Components.DateTimePicker2.GetInputElement().on('change', function(e)
|
Grocy.Components.DateTimePicker2.GetInputElement().on('change', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
|
|
@ -497,31 +505,31 @@ if (Grocy.Components.DateTimePicker2)
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker2.GetInputElement().trigger("input");
|
Grocy.Components.DateTimePicker2.GetInputElement().trigger("input");
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#price').on('keyup', function(e)
|
$('#price').on('keyup', function(e)
|
||||||
{
|
{
|
||||||
refreshPriceHint();
|
refreshPriceHint();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#price-type-unit-price').on('change', function(e)
|
$('#price-type-unit-price').on('change', function(e)
|
||||||
{
|
{
|
||||||
refreshPriceHint();
|
refreshPriceHint();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#price-type-total-price').on('change', function(e)
|
$('#price-type-total-price').on('change', function(e)
|
||||||
{
|
{
|
||||||
refreshPriceHint();
|
refreshPriceHint();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#display_amount').on('change', function(e)
|
$('#display_amount').on('change', function(e)
|
||||||
{
|
{
|
||||||
refreshPriceHint();
|
refreshPriceHint();
|
||||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
function refreshPriceHint()
|
function refreshPriceHint()
|
||||||
{
|
{
|
||||||
if ($('#amount').val() == 0 || $('#price').val() == 0)
|
if ($('#amount').val() == 0 || $('#price').val() == 0)
|
||||||
{
|
{
|
||||||
$('#price-hint').text("");
|
$('#price-hint').text("");
|
||||||
|
|
@ -548,18 +556,18 @@ function refreshPriceHint()
|
||||||
{
|
{
|
||||||
$('#price-hint').text("");
|
$('#price-hint').text("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#scan-mode").on("change", function(e)
|
$("#scan-mode").on("change", function(e)
|
||||||
{
|
{
|
||||||
if ($(this).prop("checked"))
|
if ($(this).prop("checked"))
|
||||||
{
|
{
|
||||||
Grocy.UISound.AskForPermission();
|
Grocy.UISound.AskForPermission();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#scan-mode-button").on("click", function(e)
|
$("#scan-mode-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
$("#scan-mode").click();
|
$("#scan-mode").click();
|
||||||
$("#scan-mode-button").toggleClass("btn-success").toggleClass("btn-danger");
|
$("#scan-mode-button").toggleClass("btn-success").toggleClass("btn-danger");
|
||||||
|
|
@ -571,12 +579,14 @@ $("#scan-mode-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
$("#scan-mode-status").text(__t("off"));
|
$("#scan-mode-status").text(__t("off"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#qu_id').on('change', function(e)
|
$('#qu_id').on('change', function(e)
|
||||||
{
|
{
|
||||||
var priceTypeUnitPrice = $("#price-type-unit-price");
|
var priceTypeUnitPrice = $("#price-type-unit-price");
|
||||||
var priceTypeUnitPriceLabel = $("[for=" + priceTypeUnitPrice.attr("id") + "]");
|
var priceTypeUnitPriceLabel = $("[for=" + priceTypeUnitPrice.attr("id") + "]");
|
||||||
priceTypeUnitPriceLabel.text($("#qu_id option:selected").text() + " " + __t("price"));
|
priceTypeUnitPriceLabel.text($("#qu_id option:selected").text() + " " + __t("price"));
|
||||||
refreshPriceHint();
|
refreshPriceHint();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,18 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function quantityunitconversionformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("numberpicker");
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-quconversion-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-quconversion-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -127,16 +135,16 @@ $('#save-quconversion-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#quconversion-form input').keyup(function(event)
|
$('#quconversion-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
$('.input-group-qu').trigger('change');
|
$('.input-group-qu').trigger('change');
|
||||||
Grocy.FrontendHelpers.ValidateForm('quconversion-form');
|
Grocy.FrontendHelpers.ValidateForm('quconversion-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#quconversion-form input').keydown(function(event)
|
$('#quconversion-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -150,10 +158,10 @@ $('#quconversion-form input').keydown(function(event)
|
||||||
$('#save-quconversion-button').click();
|
$('#save-quconversion-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#create_inverse").on("change", function()
|
$("#create_inverse").on("change", function()
|
||||||
{
|
{
|
||||||
var value = $(this).is(":checked");
|
var value = $(this).is(":checked");
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
|
|
@ -164,10 +172,10 @@ $("#create_inverse").on("change", function()
|
||||||
{
|
{
|
||||||
$('#qu-conversion-inverse-info').addClass('d-none');
|
$('#qu-conversion-inverse-info').addClass('d-none');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.input-group-qu').on('change', function(e)
|
$('.input-group-qu').on('change', function(e)
|
||||||
{
|
{
|
||||||
var fromQuId = $("#from_qu_id").val();
|
var fromQuId = $("#from_qu_id").val();
|
||||||
var toQuId = $("#to_qu_id").val();
|
var toQuId = $("#to_qu_id").val();
|
||||||
var factor = $('#factor').val();
|
var factor = $('#factor').val();
|
||||||
|
|
@ -200,14 +208,16 @@ $('.input-group-qu').on('change', function(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('quconversion-form');
|
Grocy.FrontendHelpers.ValidateForm('quconversion-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$('.input-group-qu').trigger('change');
|
$('.input-group-qu').trigger('change');
|
||||||
$('#from_qu_id').focus();
|
$('#from_qu_id').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('quconversion-form');
|
Grocy.FrontendHelpers.ValidateForm('quconversion-form');
|
||||||
|
|
||||||
if (GetUriParam("qu-unit") !== undefined)
|
if (GetUriParam("qu-unit") !== undefined)
|
||||||
{
|
{
|
||||||
$("#from_qu_id").attr("disabled", "");
|
$("#from_qu_id").attr("disabled", "");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function quantityunitformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('.save-quantityunit-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('.save-quantityunit-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonData = $('#quantityunit-form').serializeJSON();
|
var jsonData = $('#quantityunit-form').serializeJSON();
|
||||||
|
|
@ -93,10 +101,10 @@ $('.save-quantityunit-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#quantityunit-form input').keyup(function(event)
|
$('#quantityunit-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
if (!$("#name").val().isEmpty())
|
if (!$("#name").val().isEmpty())
|
||||||
{
|
{
|
||||||
$("#qu-conversion-headline-info").text(__t('1 %s is the same as...', $("#name").val()));
|
$("#qu-conversion-headline-info").text(__t('1 %s is the same as...', $("#name").val()));
|
||||||
|
|
@ -116,10 +124,10 @@ $('#quantityunit-form input').keyup(function(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('quantityunit-form');
|
Grocy.FrontendHelpers.ValidateForm('quantityunit-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#quantityunit-form input').keydown(function(event)
|
$('#quantityunit-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -133,34 +141,34 @@ $('#quantityunit-form input').keydown(function(event)
|
||||||
$('#save-quantityunit-button').click();
|
$('#save-quantityunit-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var quConversionsTable = $('#qu-conversions-table').DataTable({
|
var quConversionsTable = $('#qu-conversions-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#qu-conversions-table tbody').removeClass("d-none");
|
$('#qu-conversions-table tbody').removeClass("d-none");
|
||||||
quConversionsTable.columns.adjust().draw();
|
quConversionsTable.columns.adjust().draw();
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$("#name").trigger("keyup");
|
$("#name").trigger("keyup");
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('quantityunit-form');
|
Grocy.FrontendHelpers.ValidateForm('quantityunit-form');
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to remove this conversion?',
|
'Are you sure to remove this conversion?',
|
||||||
'.qu-conversion-delete-button',
|
'.qu-conversion-delete-button',
|
||||||
'data-qu-conversion-id',
|
'data-qu-conversion-id',
|
||||||
'data-qu-conversion-id',
|
'data-qu-conversion-id',
|
||||||
'objects/quantity_unit_conversions/',
|
'objects/quantity_unit_conversions/',
|
||||||
() => window.location.reload(),
|
() => window.location.reload(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#test-quantityunit-plural-forms-button").on("click", function(e)
|
$("#test-quantityunit-plural-forms-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
Grocy.QuantityUnitEditFormRedirectUri = "stay";
|
Grocy.QuantityUnitEditFormRedirectUri = "stay";
|
||||||
|
|
@ -176,4 +184,6 @@ $("#test-quantityunit-plural-forms-button").on("click", function(e)
|
||||||
Grocy.FrontendHelpers.EndUiBusy("quantityunit-form");
|
Grocy.FrontendHelpers.EndUiBusy("quantityunit-form");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,30 @@
|
||||||
Grocy.Use("numberpicker");
|
function quantityunitpluraltestingView(Grocy, scope = null)
|
||||||
|
|
||||||
$("#qu_id").change(function(event)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
|
||||||
|
$("#qu_id").change(function(event)
|
||||||
|
{
|
||||||
RefreshQuPluralTestingResult();
|
RefreshQuPluralTestingResult();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#amount").keyup(function(event)
|
$("#amount").keyup(function(event)
|
||||||
{
|
{
|
||||||
RefreshQuPluralTestingResult();
|
RefreshQuPluralTestingResult();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#amount").change(function(event)
|
$("#amount").change(function(event)
|
||||||
{
|
{
|
||||||
RefreshQuPluralTestingResult();
|
RefreshQuPluralTestingResult();
|
||||||
});
|
});
|
||||||
|
|
||||||
function RefreshQuPluralTestingResult()
|
function RefreshQuPluralTestingResult()
|
||||||
{
|
{
|
||||||
var singularForm = $("#qu_id option:selected").data("singular-form");
|
var singularForm = $("#qu_id option:selected").data("singular-form");
|
||||||
var pluralForm = $("#qu_id option:selected").data("plural-form");
|
var pluralForm = $("#qu_id option:selected").data("plural-form");
|
||||||
var amount = $("#amount").val();
|
var amount = $("#amount").val();
|
||||||
|
|
@ -28,12 +36,14 @@ function RefreshQuPluralTestingResult()
|
||||||
|
|
||||||
animateCSS("h2", "shake");
|
animateCSS("h2", "shake");
|
||||||
$("#result").text(__n(amount, singularForm, pluralForm));
|
$("#result").text(__n(amount, singularForm, pluralForm));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetUriParam("qu") !== undefined)
|
if (GetUriParam("qu") !== undefined)
|
||||||
{
|
{
|
||||||
$("#qu_id").val(GetUriParam("qu"));
|
$("#qu_id").val(GetUriParam("qu"));
|
||||||
$("#qu_id").trigger("change");
|
$("#qu_id").trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#amount").focus();
|
$("#amount").focus();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,26 @@
|
||||||
var quantityUnitsTable = $('#quantityunits-table').DataTable({
|
function quantityunitsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var quantityUnitsTable = $('#quantityunits-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#quantityunits-table tbody').removeClass("d-none");
|
$('#quantityunits-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(quantityUnitsTable);
|
Grocy.FrontendHelpers.InitDataTable(quantityUnitsTable);
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete quantity unit "%s"?',
|
'Are you sure to delete quantity unit "%s"?',
|
||||||
'.quantityunit-delete-button',
|
'.quantityunit-delete-button',
|
||||||
'data-quantityunit-name',
|
'data-quantityunit-name',
|
||||||
'data-quantityunit-id',
|
'data-quantityunit-id',
|
||||||
'objects/quantity_units/',
|
'objects/quantity_units/',
|
||||||
'/quantityunits'
|
'/quantityunits'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function recipeformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("numberpicker");
|
|
||||||
Grocy.Use("recipepicker");
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
function saveRecipePicture(result, location, jsonData)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
Grocy.Use("recipepicker");
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
function saveRecipePicture(result, location, jsonData)
|
||||||
|
{
|
||||||
var recipeId = Grocy.EditObjectId || result.created_object_id;
|
var recipeId = Grocy.EditObjectId || result.created_object_id;
|
||||||
Grocy.Components.UserfieldsForm.Save(() =>
|
Grocy.Components.UserfieldsForm.Save(() =>
|
||||||
{
|
{
|
||||||
|
|
@ -28,10 +36,10 @@ function saveRecipePicture(result, location, jsonData)
|
||||||
window.location.href = U(location + recipeId);
|
window.location.href = U(location + recipeId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.save-recipe').on('click', function(e)
|
$('.save-recipe').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var jsonData = $('#recipe-form').serializeJSON();
|
var jsonData = $('#recipe-form').serializeJSON();
|
||||||
|
|
@ -77,9 +85,9 @@ $('.save-recipe').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
var recipesPosTables = $('#recipes-pos-table').DataTable({
|
var recipesPosTables = $('#recipes-pos-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
"orderFixed": [[4, 'asc']],
|
"orderFixed": [[4, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
|
|
@ -91,30 +99,30 @@ var recipesPosTables = $('#recipes-pos-table').DataTable({
|
||||||
enable: true,
|
enable: true,
|
||||||
dataSrc: 4
|
dataSrc: 4
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#recipes-pos-table tbody').removeClass("d-none");
|
$('#recipes-pos-table tbody').removeClass("d-none");
|
||||||
recipesPosTables.columns.adjust().draw();
|
recipesPosTables.columns.adjust().draw();
|
||||||
|
|
||||||
var recipesIncludesTables = $('#recipes-includes-table').DataTable({
|
var recipesIncludesTables = $('#recipes-includes-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#recipes-includes-table tbody').removeClass("d-none");
|
$('#recipes-includes-table tbody').removeClass("d-none");
|
||||||
recipesIncludesTables.columns.adjust().draw();
|
recipesIncludesTables.columns.adjust().draw();
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('recipe-form');
|
|
||||||
$("#name").focus();
|
|
||||||
|
|
||||||
$('#recipe-form input').keyup(function(event)
|
|
||||||
{
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('recipe-form');
|
Grocy.FrontendHelpers.ValidateForm('recipe-form');
|
||||||
});
|
$("#name").focus();
|
||||||
|
|
||||||
$('#recipe-form input').keydown(function(event)
|
$('#recipe-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.ValidateForm('recipe-form');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#recipe-form input').keydown(function(event)
|
||||||
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -128,35 +136,35 @@ $('#recipe-form input').keydown(function(event)
|
||||||
$('#save-recipe-button').click();
|
$('#save-recipe-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete recipe ingredient "%s"?',
|
'Are you sure to delete recipe ingredient "%s"?',
|
||||||
'.recipe-pos-delete-button',
|
'.recipe-pos-delete-button',
|
||||||
'data-recipe-pos-name',
|
'data-recipe-pos-name',
|
||||||
'data-recipe-pos-id',
|
'data-recipe-pos-id',
|
||||||
'objects/recipes_pos/',
|
'objects/recipes_pos/',
|
||||||
() => window.postMessage(WindowMessageBag("IngredientsChanged"), Grocy.BaseUrl)
|
() => window.postMessage(WindowMessageBag("IngredientsChanged"), Grocy.BaseUrl)
|
||||||
);
|
);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to remove the included recipe "%s"?',
|
'Are you sure to remove the included recipe "%s"?',
|
||||||
'.recipe-include-delete-button',
|
'.recipe-include-delete-button',
|
||||||
'data-recipe-include-name',
|
'data-recipe-include-name',
|
||||||
'data-recipe-include-id',
|
'data-recipe-include-id',
|
||||||
'objects/recipes_nesting/',
|
'objects/recipes_nesting/',
|
||||||
() => window.postMessage(WindowMessageBag("IngredientsChanged"), Grocy.BaseUrl)
|
() => window.postMessage(WindowMessageBag("IngredientsChanged"), Grocy.BaseUrl)
|
||||||
);
|
);
|
||||||
|
|
||||||
$(document).on('click', '.recipe-pos-show-note-button', function(e)
|
$(document).on('click', '.recipe-pos-show-note-button', function(e)
|
||||||
{
|
{
|
||||||
var note = $(e.currentTarget).attr('data-recipe-pos-note');
|
var note = $(e.currentTarget).attr('data-recipe-pos-note');
|
||||||
|
|
||||||
bootbox.alert(note);
|
bootbox.alert(note);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.recipe-pos-edit-button', function(e)
|
$(document).on('click', '.recipe-pos-edit-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var productId = $(e.currentTarget).attr("data-product-id");
|
var productId = $(e.currentTarget).attr("data-product-id");
|
||||||
|
|
@ -178,10 +186,10 @@ $(document).on('click', '.recipe-pos-edit-button', function(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.recipe-include-edit-button', function(e)
|
$(document).on('click', '.recipe-include-edit-button', function(e)
|
||||||
{
|
{
|
||||||
var id = $(e.currentTarget).attr('data-recipe-include-id');
|
var id = $(e.currentTarget).attr('data-recipe-include-id');
|
||||||
var recipeId = $(e.currentTarget).attr('data-recipe-included-recipe-id');
|
var recipeId = $(e.currentTarget).attr('data-recipe-included-recipe-id');
|
||||||
var recipeServings = $(e.currentTarget).attr('data-recipe-included-recipe-servings');
|
var recipeServings = $(e.currentTarget).attr('data-recipe-included-recipe-servings');
|
||||||
|
|
@ -202,10 +210,10 @@ $(document).on('click', '.recipe-include-edit-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#recipe-pos-add-button").on("click", function(e)
|
$("#recipe-pos-add-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
bootbox.dialog({
|
bootbox.dialog({
|
||||||
|
|
@ -224,10 +232,10 @@ $("#recipe-pos-add-button").on("click", function(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#recipe-include-add-button").on("click", function(e)
|
$("#recipe-include-add-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
Grocy.Api.Put('objects/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(),
|
Grocy.Api.Put('objects/recipes/' + Grocy.EditObjectId, $('#recipe-form').serializeJSON(),
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
|
|
@ -243,10 +251,10 @@ $("#recipe-include-add-button").on("click", function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#save-recipe-include-button').on('click', function(e)
|
$('#save-recipe-include-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -293,31 +301,31 @@ $('#save-recipe-include-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#recipe-picture").on("change", function(e)
|
$("#recipe-picture").on("change", function(e)
|
||||||
{
|
{
|
||||||
$("#recipe-picture-label").removeClass("d-none");
|
$("#recipe-picture-label").removeClass("d-none");
|
||||||
$("#recipe-picture-label-none").addClass("d-none");
|
$("#recipe-picture-label-none").addClass("d-none");
|
||||||
$("#delete-current-recipe-picture-on-save-hint").addClass("d-none");
|
$("#delete-current-recipe-picture-on-save-hint").addClass("d-none");
|
||||||
$("#current-recipe-picture").addClass("d-none");
|
$("#current-recipe-picture").addClass("d-none");
|
||||||
Grocy.DeleteRecipePictureOnSave = false;
|
Grocy.DeleteRecipePictureOnSave = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.DeleteRecipePictureOnSave = false;
|
Grocy.DeleteRecipePictureOnSave = false;
|
||||||
$("#delete-current-recipe-picture-button").on("click", function(e)
|
$("#delete-current-recipe-picture-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
Grocy.DeleteRecipePictureOnSave = true;
|
Grocy.DeleteRecipePictureOnSave = true;
|
||||||
$("#current-recipe-picture").addClass("d-none");
|
$("#current-recipe-picture").addClass("d-none");
|
||||||
$("#delete-current-recipe-picture-on-save-hint").removeClass("d-none");
|
$("#delete-current-recipe-picture-on-save-hint").removeClass("d-none");
|
||||||
$("#recipe-picture-label").addClass("d-none");
|
$("#recipe-picture-label").addClass("d-none");
|
||||||
$("#recipe-picture-label-none").removeClass("d-none");
|
$("#recipe-picture-label-none").removeClass("d-none");
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
|
|
||||||
$(window).on("message", function(e)
|
$(window).on("message", function(e)
|
||||||
{
|
{
|
||||||
var data = e.originalEvent.data;
|
var data = e.originalEvent.data;
|
||||||
|
|
||||||
if (data.Message === "IngredientsChanged")
|
if (data.Message === "IngredientsChanged")
|
||||||
|
|
@ -333,4 +341,6 @@ $(window).on("message", function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,21 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function recipeposformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("numberpicker");
|
|
||||||
Grocy.Use("productamountpicker");
|
|
||||||
Grocy.Use("productcard");
|
|
||||||
|
|
||||||
Grocy.RecipePosFormInitialLoadDone = false;
|
|
||||||
|
|
||||||
$('#save-recipe-pos-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
Grocy.Use("productamountpicker");
|
||||||
|
Grocy.Use("productcard");
|
||||||
|
|
||||||
|
Grocy.RecipePosFormInitialLoadDone = false;
|
||||||
|
|
||||||
|
$('#save-recipe-pos-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -51,10 +59,10 @@ $('#save-recipe-pos-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
var productId = $(e.target).val();
|
var productId = $(e.target).val();
|
||||||
|
|
||||||
if (productId)
|
if (productId)
|
||||||
|
|
@ -93,23 +101,23 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
|
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
|
||||||
|
|
||||||
if (Grocy.Components.ProductPicker.InProductAddWorkflow() === false)
|
if (Grocy.Components.ProductPicker.InProductAddWorkflow() === false)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
}
|
}
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||||
|
|
||||||
if (Grocy.EditMode == "create")
|
if (Grocy.EditMode == "create")
|
||||||
{
|
{
|
||||||
Grocy.RecipePosFormInitialLoadDone = true;
|
Grocy.RecipePosFormInitialLoadDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#display_amount').on('focus', function(e)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
if (Grocy.Components.ProductPicker.GetValue().length === 0)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
|
|
@ -118,20 +126,20 @@ $('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#recipe-pos-form input').keyup(function(event)
|
$('#recipe-pos-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
|
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#qu_id').change(function(event)
|
$('#qu_id').change(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
|
Grocy.FrontendHelpers.ValidateForm('recipe-pos-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#recipe-pos-form input').keydown(function(event)
|
$('#recipe-pos-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -145,10 +153,10 @@ $('#recipe-pos-form input').keydown(function(event)
|
||||||
$('#save-recipe-pos-button').click();
|
$('#save-recipe-pos-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#only_check_single_unit_in_stock").on("change", function()
|
$("#only_check_single_unit_in_stock").on("change", function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
$("#display_amount").attr("min", Grocy.DefaultMinAmount);
|
$("#display_amount").attr("min", Grocy.DefaultMinAmount);
|
||||||
|
|
@ -162,9 +170,11 @@ $("#only_check_single_unit_in_stock").on("change", function()
|
||||||
Grocy.Components.ProductAmountPicker.AllowAnyQuEnabled = false;
|
Grocy.Components.ProductAmountPicker.AllowAnyQuEnabled = false;
|
||||||
Grocy.FrontendHelpers.ValidateForm("recipe-pos-form");
|
Grocy.FrontendHelpers.ValidateForm("recipe-pos-form");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($("#only_check_single_unit_in_stock").prop("checked"))
|
if ($("#only_check_single_unit_in_stock").prop("checked"))
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductAmountPicker.AllowAnyQu(true);
|
Grocy.Components.ProductAmountPicker.AllowAnyQu(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
Grocy.Use("numberpicker");
|
function recipesView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
var recipesTables = $('#recipes-table').DataTable({
|
Grocy.Use("numberpicker");
|
||||||
|
|
||||||
|
var recipesTables = $('#recipes-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
|
|
@ -15,9 +23,9 @@ var recipesTables = $('#recipes-table').DataTable({
|
||||||
{
|
{
|
||||||
this.api().row({ order: 'current' }, 0).select();
|
this.api().row({ order: 'current' }, 0).select();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#recipes-table tbody').removeClass("d-none");
|
$('#recipes-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(recipesTables,
|
Grocy.FrontendHelpers.InitDataTable(recipesTables,
|
||||||
function()
|
function()
|
||||||
{
|
{
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
|
|
@ -36,14 +44,14 @@ Grocy.FrontendHelpers.InitDataTable(recipesTables,
|
||||||
$("#status-filter").trigger("change");
|
$("#status-filter").trigger("change");
|
||||||
})
|
})
|
||||||
|
|
||||||
if ((typeof GetUriParam("tab") !== "undefined" && GetUriParam("tab") === "gallery") || window.localStorage.getItem("recipes_last_tab_id") == "gallery-tab")
|
if ((typeof GetUriParam("tab") !== "undefined" && GetUriParam("tab") === "gallery") || window.localStorage.getItem("recipes_last_tab_id") == "gallery-tab")
|
||||||
{
|
{
|
||||||
$(".nav-tabs a[href='#gallery']").tab("show");
|
$(".nav-tabs a[href='#gallery']").tab("show");
|
||||||
}
|
}
|
||||||
|
|
||||||
var recipe = GetUriParam("recipe");
|
var recipe = GetUriParam("recipe");
|
||||||
if (typeof recipe !== "undefined")
|
if (typeof recipe !== "undefined")
|
||||||
{
|
{
|
||||||
$("#recipes-table tr").removeClass("selected");
|
$("#recipes-table tr").removeClass("selected");
|
||||||
var rowId = "#recipe-row-" + recipe;
|
var rowId = "#recipe-row-" + recipe;
|
||||||
$(rowId).addClass("selected")
|
$(rowId).addClass("selected")
|
||||||
|
|
@ -56,25 +64,25 @@ if (typeof recipe !== "undefined")
|
||||||
// Scroll to recipe card on mobile
|
// Scroll to recipe card on mobile
|
||||||
$("#selectedRecipeCard")[0].scrollIntoView();
|
$("#selectedRecipeCard")[0].scrollIntoView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetUriParam("search") !== undefined)
|
if (GetUriParam("search") !== undefined)
|
||||||
{
|
{
|
||||||
$("#search").val(GetUriParam("search"));
|
$("#search").val(GetUriParam("search"));
|
||||||
setTimeout(function()
|
setTimeout(function()
|
||||||
{
|
{
|
||||||
$("#search").keyup();
|
$("#search").keyup();
|
||||||
}, 50);
|
}, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("a[data-toggle='tab']").on("shown.bs.tab", function(e)
|
$("a[data-toggle='tab']").on("shown.bs.tab", function(e)
|
||||||
{
|
{
|
||||||
var tabId = $(e.target).attr("id");
|
var tabId = $(e.target).attr("id");
|
||||||
window.localStorage.setItem("recipes_last_tab_id", tabId);
|
window.localStorage.setItem("recipes_last_tab_id", tabId);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#status-filter").on("change", function()
|
$("#status-filter").on("change", function()
|
||||||
{
|
{
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
if (value === "all")
|
if (value === "all")
|
||||||
{
|
{
|
||||||
|
|
@ -99,18 +107,18 @@ $("#status-filter").on("change", function()
|
||||||
$('.recipe-gallery-item').not('.recipe-notenoughinstock').addClass('d-none');
|
$('.recipe-gallery-item').not('.recipe-notenoughinstock').addClass('d-none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete recipe "%s"?',
|
'Are you sure to delete recipe "%s"?',
|
||||||
'.recipe-delete',
|
'.recipe-delete',
|
||||||
'data-recipe-name',
|
'data-recipe-name',
|
||||||
'data-recipe-id',
|
'data-recipe-id',
|
||||||
'objects/recipes/',
|
'objects/recipes/',
|
||||||
'/recipes'
|
'/recipes'
|
||||||
);
|
);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeYesNoBox(
|
Grocy.FrontendHelpers.MakeYesNoBox(
|
||||||
(e) =>
|
(e) =>
|
||||||
{
|
{
|
||||||
var objectName = $(e.currentTarget).attr('data-recipe-name');
|
var objectName = $(e.currentTarget).attr('data-recipe-name');
|
||||||
|
|
@ -147,9 +155,9 @@ Grocy.FrontendHelpers.MakeYesNoBox(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeYesNoBox(
|
Grocy.FrontendHelpers.MakeYesNoBox(
|
||||||
(e) =>
|
(e) =>
|
||||||
{
|
{
|
||||||
var objectName = $(e.currentTarget).attr('data-recipe-name');
|
var objectName = $(e.currentTarget).attr('data-recipe-name');
|
||||||
|
|
@ -180,10 +188,10 @@ Grocy.FrontendHelpers.MakeYesNoBox(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
recipesTables.on('select', function(e, dt, type, indexes)
|
recipesTables.on('select', function(e, dt, type, indexes)
|
||||||
{
|
{
|
||||||
if (type === 'row')
|
if (type === 'row')
|
||||||
{
|
{
|
||||||
var selectedRecipeId = $(recipesTables.row(indexes[0]).node()).data("recipe-id");
|
var selectedRecipeId = $(recipesTables.row(indexes[0]).node()).data("recipe-id");
|
||||||
|
|
@ -193,17 +201,17 @@ recipesTables.on('select', function(e, dt, type, indexes)
|
||||||
window.location.href = U('/recipes?recipe=' + selectedRecipeId.toString());
|
window.location.href = U('/recipes?recipe=' + selectedRecipeId.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".recipe-gallery-item").on("click", function(e)
|
$(".recipe-gallery-item").on("click", function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
window.location.href = U('/recipes?tab=gallery&recipe=' + $(this).data("recipe-id"));
|
window.location.href = U('/recipes?tab=gallery&recipe=' + $(this).data("recipe-id"));
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".recipe-fullscreen").on('click', function(e)
|
$(".recipe-fullscreen").on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
$("#selectedRecipeCard").toggleClass("fullscreen");
|
$("#selectedRecipeCard").toggleClass("fullscreen");
|
||||||
|
|
@ -219,10 +227,10 @@ $(".recipe-fullscreen").on('click', function(e)
|
||||||
{
|
{
|
||||||
window.history.replaceState(null, null, " ");
|
window.history.replaceState(null, null, " ");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".recipe-print").on('click', function(e)
|
$(".recipe-print").on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
$("#selectedRecipeCard").removeClass("fullscreen");
|
$("#selectedRecipeCard").removeClass("fullscreen");
|
||||||
|
|
@ -232,10 +240,10 @@ $(".recipe-print").on('click', function(e)
|
||||||
|
|
||||||
window.history.replaceState(null, null, " ");
|
window.history.replaceState(null, null, " ");
|
||||||
window.print();
|
window.print();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#servings-scale').keyup(function(event)
|
$('#servings-scale').keyup(function(event)
|
||||||
{
|
{
|
||||||
var data = {};
|
var data = {};
|
||||||
data.desired_servings = $(this).val();
|
data.desired_servings = $(this).val();
|
||||||
|
|
||||||
|
|
@ -249,19 +257,21 @@ $('#servings-scale').keyup(function(event)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".missing-recipe-pos-select-button", function(e)
|
$(document).on("click", ".missing-recipe-pos-select-button", function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var checkbox = $(this).find(".form-check-input");
|
var checkbox = $(this).find(".form-check-input");
|
||||||
checkbox.prop("checked", !checkbox.prop("checked"));
|
checkbox.prop("checked", !checkbox.prop("checked"));
|
||||||
|
|
||||||
$(this).toggleClass("list-group-item-primary");
|
$(this).toggleClass("list-group-item-primary");
|
||||||
});
|
});
|
||||||
|
|
||||||
if (window.location.hash === "#fullscreen")
|
if (window.location.hash === "#fullscreen")
|
||||||
{
|
{
|
||||||
$("#selectedRecipeToggleFullscreenButton").click();
|
$("#selectedRecipeToggleFullscreenButton").click();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,18 @@
|
||||||
import { BoolVal } from '../helpers/extensions';
|
function recipessettingsView(Grocy, scope = null)
|
||||||
|
|
||||||
if (BoolVal(Grocy.UserSettings.recipe_ingredients_group_by_product_group))
|
|
||||||
{
|
{
|
||||||
$("#recipe_ingredients_group_by_product_group").prop("checked", true);
|
var $scope = $;
|
||||||
}
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
RefreshLocaleNumberInput();
|
import { BoolVal } from '../helpers/extensions';
|
||||||
|
|
||||||
|
if (BoolVal(Grocy.UserSettings.recipe_ingredients_group_by_product_group))
|
||||||
|
{
|
||||||
|
$("#recipe_ingredients_group_by_product_group").prop("checked", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshLocaleNumberInput();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,20 @@
|
||||||
// this needs to be explicitly imported for some reason,
|
function shoppinglistView(Grocy, scope = null)
|
||||||
// otherwise rollup complains.
|
{
|
||||||
import bwipjs from '../../node_modules/bwip-js/dist/bwip-js.mjs';
|
var $scope = $;
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
Grocy.Use("calendarcard");
|
// this needs to be explicitly imported for some reason,
|
||||||
Grocy.Use("productcard");
|
// otherwise rollup complains.
|
||||||
|
import bwipjs from '../../node_modules/bwip-js/dist/bwip-js.mjs';
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
var shoppingListTable = $('#shoppinglist-table').DataTable({
|
Grocy.Use("calendarcard");
|
||||||
|
Grocy.Use("productcard");
|
||||||
|
|
||||||
|
var shoppingListTable = $('#shoppinglist-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
"orderFixed": [[3, 'asc']],
|
"orderFixed": [[3, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
|
|
@ -25,12 +33,12 @@ var shoppingListTable = $('#shoppinglist-table').DataTable({
|
||||||
enable: true,
|
enable: true,
|
||||||
dataSrc: 3
|
dataSrc: 3
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#shoppinglist-table tbody').removeClass("d-none");
|
$('#shoppinglist-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(shoppingListTable);
|
Grocy.FrontendHelpers.InitDataTable(shoppingListTable);
|
||||||
Grocy.FrontendHelpers.MakeStatusFilter(shoppingListTable, 4);
|
Grocy.FrontendHelpers.MakeStatusFilter(shoppingListTable, 4);
|
||||||
|
|
||||||
var shoppingListPrintShadowTable = $('#shopping-list-print-shadow-table').DataTable({
|
var shoppingListPrintShadowTable = $('#shopping-list-print-shadow-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
"orderFixed": [[2, 'asc']],
|
"orderFixed": [[2, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
|
|
@ -41,27 +49,27 @@ var shoppingListPrintShadowTable = $('#shopping-list-print-shadow-table').DataTa
|
||||||
enable: true,
|
enable: true,
|
||||||
dataSrc: 2
|
dataSrc: 2
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Grocy.FrontendHelpers.InitDataTable(shoppingListPrintShadowTable);
|
Grocy.FrontendHelpers.InitDataTable(shoppingListPrintShadowTable);
|
||||||
|
|
||||||
|
|
||||||
$("#selected-shopping-list").on("change", function()
|
$("#selected-shopping-list").on("change", function()
|
||||||
{
|
{
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
window.location.href = U('/shoppinglist?list=' + value);
|
window.location.href = U('/shoppinglist?list=' + value);
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete shopping list "%s"?',
|
'Are you sure to delete shopping list "%s"?',
|
||||||
'#delete-selected-shopping-list',
|
'#delete-selected-shopping-list',
|
||||||
() => $("#selected-shopping-list option:selected").text(),
|
() => $("#selected-shopping-list option:selected").text(),
|
||||||
() => $("#selected-shopping-list").val(),
|
() => $("#selected-shopping-list").val(),
|
||||||
'objects/shopping_lists/',
|
'objects/shopping_lists/',
|
||||||
'/shoppinglist'
|
'/shoppinglist'
|
||||||
);
|
);
|
||||||
|
|
||||||
$(document).on('click', '.shoppinglist-delete-button', function(e)
|
$(document).on('click', '.shoppinglist-delete-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -87,19 +95,19 @@ $(document).on('click', '.shoppinglist-delete-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".product-name-cell", function(e)
|
$(document).on("click", ".product-name-cell", function(e)
|
||||||
{
|
{
|
||||||
if ($(e.currentTarget).attr("data-product-id") != "")
|
if ($(e.currentTarget).attr("data-product-id") != "")
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||||
$("#shoppinglist-productcard-modal").modal("show");
|
$("#shoppinglist-productcard-modal").modal("show");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '#add-products-below-min-stock-amount', function(e)
|
$(document).on('click', '#add-products-below-min-stock-amount', function(e)
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('stock/shoppinglist/add-missing-products', { "list_id": $("#selected-shopping-list").val() },
|
Grocy.Api.Post('stock/shoppinglist/add-missing-products', { "list_id": $("#selected-shopping-list").val() },
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
|
|
@ -110,10 +118,10 @@ $(document).on('click', '#add-products-below-min-stock-amount', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '#add-overdue-expired-products', function(e)
|
$(document).on('click', '#add-overdue-expired-products', function(e)
|
||||||
{
|
{
|
||||||
Grocy.Api.Post('stock/shoppinglist/add-overdue-products', { "list_id": $("#selected-shopping-list").val() },
|
Grocy.Api.Post('stock/shoppinglist/add-overdue-products', { "list_id": $("#selected-shopping-list").val() },
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
|
|
@ -133,9 +141,9 @@ $(document).on('click', '#add-overdue-expired-products', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeYesNoBox(
|
Grocy.FrontendHelpers.MakeYesNoBox(
|
||||||
() => __t('Are you sure to empty shopping list "%s"?', $("#selected-shopping-list option:selected").text()),
|
() => __t('Are you sure to empty shopping list "%s"?', $("#selected-shopping-list option:selected").text()),
|
||||||
'#clear-shopping-list',
|
'#clear-shopping-list',
|
||||||
(result) =>
|
(result) =>
|
||||||
|
|
@ -162,10 +170,10 @@ Grocy.FrontendHelpers.MakeYesNoBox(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', function(e)
|
$(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -187,28 +195,28 @@ $(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', fu
|
||||||
{
|
{
|
||||||
$("#shopping-list-stock-add-workflow-skip-button").addClass("d-none");
|
$("#shopping-list-stock-add-workflow-skip-button").addClass("d-none");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.ShoppingListToStockWorkflowAll = false;
|
Grocy.ShoppingListToStockWorkflowAll = false;
|
||||||
Grocy.ShoppingListToStockWorkflowCount = 0;
|
Grocy.ShoppingListToStockWorkflowCount = 0;
|
||||||
Grocy.ShoppingListToStockWorkflowCurrent = 0;
|
Grocy.ShoppingListToStockWorkflowCurrent = 0;
|
||||||
$(document).on('click', '#add-all-items-to-stock-button', function(e)
|
$(document).on('click', '#add-all-items-to-stock-button', function(e)
|
||||||
{
|
{
|
||||||
Grocy.ShoppingListToStockWorkflowAll = true;
|
Grocy.ShoppingListToStockWorkflowAll = true;
|
||||||
Grocy.ShoppingListToStockWorkflowCount = $(".shopping-list-stock-add-workflow-list-item-button").length;
|
Grocy.ShoppingListToStockWorkflowCount = $(".shopping-list-stock-add-workflow-list-item-button").length;
|
||||||
Grocy.ShoppingListToStockWorkflowCurrent++;
|
Grocy.ShoppingListToStockWorkflowCurrent++;
|
||||||
$(".shopping-list-stock-add-workflow-list-item-button").first().click();
|
$(".shopping-list-stock-add-workflow-list-item-button").first().click();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#shopping-list-stock-add-workflow-modal").on("hidden.bs.modal", function(e)
|
$("#shopping-list-stock-add-workflow-modal").on("hidden.bs.modal", function(e)
|
||||||
{
|
{
|
||||||
Grocy.ShoppingListToStockWorkflowAll = false;
|
Grocy.ShoppingListToStockWorkflowAll = false;
|
||||||
Grocy.ShoppingListToStockWorkflowCount = 0;
|
Grocy.ShoppingListToStockWorkflowCount = 0;
|
||||||
Grocy.ShoppingListToStockWorkflowCurrent = 0;
|
Grocy.ShoppingListToStockWorkflowCurrent = 0;
|
||||||
})
|
})
|
||||||
|
|
||||||
$(window).on("message", function(e)
|
$(window).on("message", function(e)
|
||||||
{
|
{
|
||||||
var data = e.originalEvent.data;
|
var data = e.originalEvent.data;
|
||||||
|
|
||||||
if (data.Message === "AfterItemAdded")
|
if (data.Message === "AfterItemAdded")
|
||||||
|
|
@ -234,17 +242,17 @@ $(window).on("message", function(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '#shopping-list-stock-add-workflow-skip-button', function(e)
|
$(document).on('click', '#shopping-list-stock-add-workflow-skip-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
window.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
|
window.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.order-listitem-button', function(e)
|
$(document).on('click', '.order-listitem-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -299,19 +307,19 @@ $(document).on('click', '.order-listitem-button', function(e)
|
||||||
shoppingListTable.rows().invalidate().draw(false);
|
shoppingListTable.rows().invalidate().draw(false);
|
||||||
|
|
||||||
$("#status-filter").trigger("change");
|
$("#status-filter").trigger("change");
|
||||||
});
|
});
|
||||||
|
|
||||||
function OnListItemRemoved()
|
function OnListItemRemoved()
|
||||||
{
|
{
|
||||||
if ($(".shopping-list-stock-add-workflow-list-item-button").length === 0)
|
if ($(".shopping-list-stock-add-workflow-list-item-button").length === 0)
|
||||||
{
|
{
|
||||||
$("#add-all-items-to-stock-button").addClass("disabled");
|
$("#add-all-items-to-stock-button").addClass("disabled");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OnListItemRemoved();
|
OnListItemRemoved();
|
||||||
|
|
||||||
$(document).on("click", "#print-shopping-list-button", function(e)
|
$(document).on("click", "#print-shopping-list-button", function(e)
|
||||||
{
|
{
|
||||||
var dialogHtml = ' \
|
var dialogHtml = ' \
|
||||||
<div class="text-center"><h5>' + __t('Print options') + '</h5><hr></div> \
|
<div class="text-center"><h5>' + __t('Print options') + '</h5><hr></div> \
|
||||||
<div class="custom-control custom-checkbox"> \
|
<div class="custom-control custom-checkbox"> \
|
||||||
|
|
@ -458,10 +466,10 @@ $(document).on("click", "#print-shopping-list-button", function(e)
|
||||||
className: "d-print-none",
|
className: "d-print-none",
|
||||||
buttons: printButtons
|
buttons: printButtons
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#description").on("summernote.change", function()
|
$("#description").on("summernote.change", function()
|
||||||
{
|
{
|
||||||
$("#save-description-button").removeClass("disabled");
|
$("#save-description-button").removeClass("disabled");
|
||||||
|
|
||||||
if ($("#description").summernote("isEmpty"))
|
if ($("#description").summernote("isEmpty"))
|
||||||
|
|
@ -472,10 +480,10 @@ $("#description").on("summernote.change", function()
|
||||||
{
|
{
|
||||||
$("#clear-description-button").removeClass("disabled");
|
$("#clear-description-button").removeClass("disabled");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", "#save-description-button", function(e)
|
$(document).on("click", "#save-description-button", function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
|
|
@ -489,33 +497,33 @@ $(document).on("click", "#save-description-button", function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", "#clear-description-button", function(e)
|
$(document).on("click", "#clear-description-button", function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
$("#description").summernote("reset");
|
$("#description").summernote("reset");
|
||||||
$("#save-description-button").click();
|
$("#save-description-button").click();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#description").trigger("summernote.change");
|
$("#description").trigger("summernote.change");
|
||||||
$("#save-description-button").addClass("disabled");
|
$("#save-description-button").addClass("disabled");
|
||||||
|
|
||||||
$(window).on("message", function(e)
|
$(window).on("message", function(e)
|
||||||
{
|
{
|
||||||
var data = e.originalEvent.data;
|
var data = e.originalEvent.data;
|
||||||
|
|
||||||
if (data.Message === "ShoppingListChanged")
|
if (data.Message === "ShoppingListChanged")
|
||||||
{
|
{
|
||||||
window.location.href = U('/shoppinglist?list=' + data.Payload);
|
window.location.href = U('/shoppinglist?list=' + data.Payload);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var dummyCanvas = document.createElement("canvas");
|
var dummyCanvas = document.createElement("canvas");
|
||||||
$("img.barcode").each(function()
|
$("img.barcode").each(function()
|
||||||
{
|
{
|
||||||
var img = $(this);
|
var img = $(this);
|
||||||
var barcode = img.attr("data-barcode").replace(/\D/g, "");
|
var barcode = img.attr("data-barcode").replace(/\D/g, "");
|
||||||
|
|
||||||
|
|
@ -537,9 +545,11 @@ $("img.barcode").each(function()
|
||||||
});
|
});
|
||||||
|
|
||||||
img.attr("src", dummyCanvas.toDataURL("image/png"));
|
img.attr("src", dummyCanvas.toDataURL("image/png"));
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($(window).width() < 768 || !Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK)
|
if ($(window).width() < 768 || !Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK)
|
||||||
{
|
{
|
||||||
$("#filter-container").removeClass("border-bottom");
|
$("#filter-container").removeClass("border-bottom");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function shoppinglistformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-shopping-list-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-shopping-list-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -53,15 +61,15 @@ $('#save-shopping-list-button').on('click', function(e)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#shopping-list-form input').keyup(function(event)
|
$('#shopping-list-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('shopping-list-form');
|
Grocy.FrontendHelpers.ValidateForm('shopping-list-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#shopping-list-form input').keydown(function(event)
|
$('#shopping-list-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -75,8 +83,10 @@ $('#shopping-list-form input').keydown(function(event)
|
||||||
$('#save-shopping-list-button').click();
|
$('#save-shopping-list-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('shopping-list-form');
|
Grocy.FrontendHelpers.ValidateForm('shopping-list-form');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,20 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function shoppinglistitemformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("productamountpicker");
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
Grocy.ShoppingListItemFormInitialLoadDone = false;
|
|
||||||
|
|
||||||
$('#save-shoppinglist-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("productamountpicker");
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
Grocy.ShoppingListItemFormInitialLoadDone = false;
|
||||||
|
|
||||||
|
$('#save-shoppinglist-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -146,10 +154,10 @@ $('#save-shoppinglist-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
var productId = $(e.target).val();
|
var productId = $(e.target).val();
|
||||||
|
|
||||||
if (productId)
|
if (productId)
|
||||||
|
|
@ -186,33 +194,33 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
|
|
||||||
$("#note").trigger("input");
|
$("#note").trigger("input");
|
||||||
$("#product_id").trigger("input");
|
$("#product_id").trigger("input");
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
|
||||||
|
|
||||||
if (Grocy.EditMode === "edit")
|
|
||||||
{
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Grocy.EditMode == "create")
|
|
||||||
{
|
|
||||||
Grocy.ShoppingListItemFormInitialLoadDone = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#display_amount').on('focus', function(e)
|
|
||||||
{
|
|
||||||
$(this).select();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#shoppinglist-form input').keyup(function(event)
|
|
||||||
{
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||||
});
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
|
|
||||||
$('#shoppinglist-form input').keydown(function(event)
|
if (Grocy.EditMode === "edit")
|
||||||
{
|
{
|
||||||
|
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Grocy.EditMode == "create")
|
||||||
|
{
|
||||||
|
Grocy.ShoppingListItemFormInitialLoadDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#display_amount').on('focus', function(e)
|
||||||
|
{
|
||||||
|
$(this).select();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#shoppinglist-form input').keyup(function(event)
|
||||||
|
{
|
||||||
|
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#shoppinglist-form input').keydown(function(event)
|
||||||
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -226,23 +234,23 @@ $('#shoppinglist-form input').keydown(function(event)
|
||||||
$('#save-shoppinglist-button').click();
|
$('#save-shoppinglist-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GetUriParam("list") !== undefined)
|
if (GetUriParam("list") !== undefined)
|
||||||
{
|
{
|
||||||
$("#shopping_list_id").val(GetUriParam("list"));
|
$("#shopping_list_id").val(GetUriParam("list"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetUriParam("amount") !== undefined)
|
if (GetUriParam("amount") !== undefined)
|
||||||
{
|
{
|
||||||
$("#display_amount").val(parseFloat(GetUriParam("amount")));
|
$("#display_amount").val(parseFloat(GetUriParam("amount")));
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetUriParam("embedded") !== undefined)
|
if (GetUriParam("embedded") !== undefined)
|
||||||
{
|
{
|
||||||
if (GetUriParam("product") !== undefined)
|
if (GetUriParam("product") !== undefined)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||||
|
|
@ -252,20 +260,22 @@ if (GetUriParam("embedded") !== undefined)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var eitherRequiredFields = $("#product_id,#product_id_text_input,#note");
|
var eitherRequiredFields = $("#product_id,#product_id_text_input,#note");
|
||||||
eitherRequiredFields.prop('required', "");
|
eitherRequiredFields.prop('required', "");
|
||||||
eitherRequiredFields.on('input', function()
|
eitherRequiredFields.on('input', function()
|
||||||
{
|
{
|
||||||
eitherRequiredFields.not(this).prop('required', !$(this).val().length);
|
eitherRequiredFields.not(this).prop('required', !$(this).val().length);
|
||||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (GetUriParam("product-name") != null)
|
if (GetUriParam("product-name") != null)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,23 @@
|
||||||
import { BoolVal } from '../helpers/extensions';
|
function shoppinglistsettingsView(Grocy, scope = null)
|
||||||
|
|
||||||
if (BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled))
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { BoolVal } from '../helpers/extensions';
|
||||||
|
|
||||||
|
if (BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled))
|
||||||
|
{
|
||||||
$("#shopping-list-to-stock-workflow-auto-submit-when-prefilled").prop("checked", true);
|
$("#shopping-list-to-stock-workflow-auto-submit-when-prefilled").prop("checked", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BoolVal(Grocy.UserSettings.shopping_list_show_calendar))
|
if (BoolVal(Grocy.UserSettings.shopping_list_show_calendar))
|
||||||
{
|
{
|
||||||
$("#shopping-list-show-calendar").prop("checked", true);
|
$("#shopping-list-show-calendar").prop("checked", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function shoppinglocationformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-shopping-location-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-shopping-location-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -63,15 +71,15 @@ $('#save-shopping-location-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#shoppinglocation-form input').keyup(function(event)
|
$('#shoppinglocation-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');
|
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#shoppinglocation-form input').keydown(function(event)
|
$('#shoppinglocation-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -85,8 +93,10 @@ $('#shoppinglocation-form input').keydown(function(event)
|
||||||
$('#save-shopping-location-button').click();
|
$('#save-shopping-location-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');
|
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,27 @@
|
||||||
var locationsTable = $('#shoppinglocations-table').DataTable({
|
function shoppinglocationsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var locationsTable = $('#shoppinglocations-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#shoppinglocations-table tbody').removeClass("d-none");
|
$('#shoppinglocations-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(locationsTable);
|
Grocy.FrontendHelpers.InitDataTable(locationsTable);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete store "%s"?',
|
'Are you sure to delete store "%s"?',
|
||||||
'.shoppinglocation-delete-button',
|
'.shoppinglocation-delete-button',
|
||||||
'data-shoppinglocation-name',
|
'data-shoppinglocation-name',
|
||||||
'data-shoppinglocation-id',
|
'data-shoppinglocation-id',
|
||||||
'objects/shopping_locations/',
|
'objects/shopping_locations/',
|
||||||
'/shoppinglocations'
|
'/shoppinglocations'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,26 @@
|
||||||
Grocy.Use("productcard");
|
function stockentriesView(Grocy, scope = null)
|
||||||
Grocy.Use("productpicker");
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
var stockEntriesTable = $('#stockentries-table').DataTable({
|
Grocy.Use("productcard");
|
||||||
|
Grocy.Use("productpicker");
|
||||||
|
|
||||||
|
var stockEntriesTable = $('#stockentries-table').DataTable({
|
||||||
'order': [[2, 'asc']],
|
'order': [[2, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#stockentries-table tbody').removeClass("d-none");
|
$('#stockentries-table tbody').removeClass("d-none");
|
||||||
stockEntriesTable.columns.adjust().draw();
|
stockEntriesTable.columns.adjust().draw();
|
||||||
|
|
||||||
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
|
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
|
||||||
{
|
{
|
||||||
var productId = Grocy.Components.ProductPicker.GetValue();
|
var productId = Grocy.Components.ProductPicker.GetValue();
|
||||||
|
|
||||||
if ((isNaN(productId) || productId == "" || productId == data[1]))
|
if ((isNaN(productId) || productId == "" || productId == data[1]))
|
||||||
|
|
@ -21,26 +29,26 @@ $.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#clear-filter-button").on("click", function()
|
$("#clear-filter-button").on("click", function()
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductPicker.Clear();
|
Grocy.Components.ProductPicker.Clear();
|
||||||
stockEntriesTable.draw();
|
stockEntriesTable.draw();
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
stockEntriesTable.draw();
|
stockEntriesTable.draw();
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetInputElement().on('keyup', function(e)
|
Grocy.Components.ProductPicker.GetInputElement().on('keyup', function(e)
|
||||||
{
|
{
|
||||||
stockEntriesTable.draw();
|
stockEntriesTable.draw();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.stock-consume-button', function(e)
|
$(document).on('click', '.stock-consume-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -86,10 +94,10 @@ $(document).on('click', '.stock-consume-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.product-open-button', function(e)
|
$(document).on('click', '.product-open-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -119,16 +127,16 @@ $(document).on('click', '.product-open-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".stock-name-cell", function(e)
|
$(document).on("click", ".stock-name-cell", function(e)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-stock-id"));
|
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-stock-id"));
|
||||||
$("#stockentry-productcard-modal").modal("show");
|
$("#stockentry-productcard-modal").modal("show");
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.stockentry-grocycode-stockentry-label-print', function(e)
|
$(document).on('click', '.stockentry-grocycode-stockentry-label-print', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
|
|
@ -140,10 +148,10 @@ $(document).on('click', '.stockentry-grocycode-stockentry-label-print', function
|
||||||
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function RefreshStockEntryRow(stockRowId)
|
function RefreshStockEntryRow(stockRowId)
|
||||||
{
|
{
|
||||||
Grocy.Api.Get("stock/entry/" + stockRowId,
|
Grocy.Api.Get("stock/entry/" + stockRowId,
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
|
|
@ -255,22 +263,24 @@ function RefreshStockEntryRow(stockRowId)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(window).on("message", function(e)
|
$(window).on("message", function(e)
|
||||||
{
|
{
|
||||||
var data = e.originalEvent.data;
|
var data = e.originalEvent.data;
|
||||||
|
|
||||||
if (data.Message === "StockEntryChanged")
|
if (data.Message === "StockEntryChanged")
|
||||||
{
|
{
|
||||||
RefreshStockEntryRow(data.Payload);
|
RefreshStockEntryRow(data.Payload);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||||
|
|
||||||
$(document).on("click", ".product-name-cell", function(e)
|
$(document).on("click", ".product-name-cell", function(e)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||||
$("#productcard-modal").modal("show");
|
$("#productcard-modal").modal("show");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,21 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function stockentryformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("datetimepicker");
|
|
||||||
Grocy.Use("datetimepicker2");
|
|
||||||
Grocy.Use("locationpicker");
|
|
||||||
Grocy.Use("numberpicker");
|
|
||||||
Grocy.Use("shoppinglocationpicker");
|
|
||||||
|
|
||||||
$('#save-stockentry-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("datetimepicker");
|
||||||
|
Grocy.Use("datetimepicker2");
|
||||||
|
Grocy.Use("locationpicker");
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
Grocy.Use("shoppinglocationpicker");
|
||||||
|
|
||||||
|
$('#save-stockentry-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -58,17 +66,17 @@ $('#save-stockentry-button').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
|
||||||
|
|
||||||
$('#stockentry-form input').keyup(function(event)
|
|
||||||
{
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||||
});
|
|
||||||
|
|
||||||
$('#stockentry-form input').keydown(function(event)
|
$('#stockentry-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
|
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#stockentry-form input').keydown(function(event)
|
||||||
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -82,29 +90,29 @@ $('#stockentry-form input').keydown(function(event)
|
||||||
$('#save-stockentry-button').click();
|
$('#save-stockentry-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
Grocy.Components.DateTimePicker.GetInputElement().on('change', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker2.GetInputElement().on('change', function(e)
|
Grocy.Components.DateTimePicker2.GetInputElement().on('change', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.DateTimePicker2.GetInputElement().on('keypress', function(e)
|
Grocy.Components.DateTimePicker2.GetInputElement().on('keypress', function(e)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
Grocy.FrontendHelpers.ValidateForm('stockentry-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Api.Get('stock/products/' + Grocy.EditObjectProductId,
|
Grocy.Api.Get('stock/products/' + Grocy.EditObjectProductId,
|
||||||
function(productDetails)
|
function(productDetails)
|
||||||
{
|
{
|
||||||
$('#amount_qu_unit').text(productDetails.quantity_unit_stock.name);
|
$('#amount_qu_unit').text(productDetails.quantity_unit_stock.name);
|
||||||
|
|
@ -113,11 +121,13 @@ Grocy.Api.Get('stock/products/' + Grocy.EditObjectProductId,
|
||||||
{
|
{
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#amount").on("focus", function(e)
|
$("#amount").on("focus", function(e)
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
$("#amount").focus();
|
$("#amount").focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm("stockentry-form");
|
Grocy.FrontendHelpers.ValidateForm("stockentry-form");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,35 @@
|
||||||
var stockJournalTable = $('#stock-journal-table').DataTable({
|
function stockjournalView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var stockJournalTable = $('#stock-journal-table').DataTable({
|
||||||
'paginate': true,
|
'paginate': true,
|
||||||
'order': [[3, 'desc']],
|
'order': [[3, 'desc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#stock-journal-table tbody').removeClass("d-none");
|
$('#stock-journal-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(stockJournalTable);
|
Grocy.FrontendHelpers.InitDataTable(stockJournalTable);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#product-filter", 1, stockJournalTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#product-filter", 1, stockJournalTable);
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#transaction-type-filter", 4, stockJournalTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#transaction-type-filter", 4, stockJournalTable);
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#location-filter", 5, stockJournalTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#location-filter", 5, stockJournalTable);
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#user-filter", 6, stockJournalTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#user-filter", 6, stockJournalTable);
|
||||||
|
|
||||||
if (typeof GetUriParam("product") !== "undefined")
|
if (typeof GetUriParam("product") !== "undefined")
|
||||||
{
|
{
|
||||||
$("#product-filter").val(GetUriParam("product"));
|
$("#product-filter").val(GetUriParam("product"));
|
||||||
$("#product-filter").trigger("change");
|
$("#product-filter").trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '.undo-stock-booking-button', function(e)
|
$(document).on('click', '.undo-stock-booking-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
var bookingId = $(e.currentTarget).attr('data-booking-id');
|
var bookingId = $(e.currentTarget).attr('data-booking-id');
|
||||||
|
|
@ -48,4 +56,6 @@ $(document).on('click', '.undo-stock-booking-button', function(e)
|
||||||
toastr.error(__t(JSON.parse(xhr.response).error_message));
|
toastr.error(__t(JSON.parse(xhr.response).error_message));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,24 @@
|
||||||
var journalSummaryTable = $('#stock-journal-summary-table').DataTable({
|
function stockjournalsummaryView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var journalSummaryTable = $('#stock-journal-summary-table').DataTable({
|
||||||
'paginate': true,
|
'paginate': true,
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#stock-journal-summary-table tbody').removeClass("d-none");
|
$('#stock-journal-summary-table tbody').removeClass("d-none");
|
||||||
|
|
||||||
Grocy.FrontendHelpers.InitDataTable(journalSummaryTable);
|
Grocy.FrontendHelpers.InitDataTable(journalSummaryTable);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#product-filter", 1, journalSummaryTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#product-filter", 1, journalSummaryTable);
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#transaction-type-filter", 2, journalSummaryTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#transaction-type-filter", 2, journalSummaryTable);
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#user-filter", 3, journalSummaryTable);
|
Grocy.FrontendHelpers.MakeFilterForColumn("#user-filter", 3, journalSummaryTable);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
Grocy.Use("productcard");
|
function stockoverviewView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
var stockOverviewTable = $('#stock-overview-table').DataTable({
|
Grocy.Use("productcard");
|
||||||
|
|
||||||
|
var stockOverviewTable = $('#stock-overview-table').DataTable({
|
||||||
'order': [[5, 'asc']],
|
'order': [[5, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
|
|
@ -24,16 +32,16 @@ var stockOverviewTable = $('#stock-overview-table').DataTable({
|
||||||
{ "type": "html-num-fmt", "targets": 12 },
|
{ "type": "html-num-fmt", "targets": 12 },
|
||||||
{ "type": "num", "targets": 13 }
|
{ "type": "num", "targets": 13 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#stock-overview-table tbody').removeClass("d-none");
|
$('#stock-overview-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(stockOverviewTable);
|
Grocy.FrontendHelpers.InitDataTable(stockOverviewTable);
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#location-filter", 6, stockOverviewTable, null, false, (value) => "xx" + value + "xx");
|
Grocy.FrontendHelpers.MakeFilterForColumn("#location-filter", 6, stockOverviewTable, null, false, (value) => "xx" + value + "xx");
|
||||||
Grocy.FrontendHelpers.MakeFilterForColumn("#product-group-filter", 8, stockOverviewTable, null, false, (value) => "xx" + value + "xx");
|
Grocy.FrontendHelpers.MakeFilterForColumn("#product-group-filter", 8, stockOverviewTable, null, false, (value) => "xx" + value + "xx");
|
||||||
Grocy.FrontendHelpers.MakeStatusFilter(stockOverviewTable, 7);
|
Grocy.FrontendHelpers.MakeStatusFilter(stockOverviewTable, 7);
|
||||||
|
|
||||||
$(document).on('click', '.stockentry-grocycode-product-label-print', function(e)
|
$(document).on('click', '.stockentry-grocycode-product-label-print', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
|
|
||||||
|
|
@ -45,10 +53,10 @@ $(document).on('click', '.stockentry-grocycode-product-label-print', function(e)
|
||||||
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
Grocy.FrontendHelpers.RunWebhook(Grocy.Webhooks.labelprinter, labelData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.product-consume-button', function(e)
|
$(document).on('click', '.product-consume-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -103,10 +111,10 @@ $(document).on('click', '.product-consume-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.product-open-button', function(e)
|
$(document).on('click', '.product-open-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -151,16 +159,16 @@ $(document).on('click', '.product-open-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on("click", ".product-name-cell", function(e)
|
$(document).on("click", ".product-name-cell", function(e)
|
||||||
{
|
{
|
||||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||||
$("#stockoverview-productcard-modal").modal("show");
|
$("#stockoverview-productcard-modal").modal("show");
|
||||||
});
|
});
|
||||||
|
|
||||||
function RefreshStatistics()
|
function RefreshStatistics()
|
||||||
{
|
{
|
||||||
Grocy.Api.Get('stock',
|
Grocy.Api.Get('stock',
|
||||||
function(result)
|
function(result)
|
||||||
{
|
{
|
||||||
|
|
@ -198,11 +206,11 @@ function RefreshStatistics()
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
|
|
||||||
function RefreshProductRow(productId)
|
function RefreshProductRow(productId)
|
||||||
{
|
{
|
||||||
productId = productId.toString();
|
productId = productId.toString();
|
||||||
|
|
||||||
Grocy.Api.Get('stock/products/' + productId,
|
Grocy.Api.Get('stock/products/' + productId,
|
||||||
|
|
@ -315,10 +323,10 @@ function RefreshProductRow(productId)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(window).on("message", function(e)
|
$(window).on("message", function(e)
|
||||||
{
|
{
|
||||||
var data = e.originalEvent.data;
|
var data = e.originalEvent.data;
|
||||||
|
|
||||||
if (data.Message === "ProductChanged")
|
if (data.Message === "ProductChanged")
|
||||||
|
|
@ -326,4 +334,6 @@ $(window).on("message", function(e)
|
||||||
RefreshProductRow(data.Payload);
|
RefreshProductRow(data.Payload);
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,48 @@
|
||||||
import { BoolVal } from '../helpers/extensions';
|
function stocksettingsView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("numberpicker");
|
|
||||||
|
|
||||||
$("#product_presets_location_id").val(Grocy.UserSettings.product_presets_location_id);
|
|
||||||
$("#product_presets_product_group_id").val(Grocy.UserSettings.product_presets_product_group_id);
|
|
||||||
$("#product_presets_qu_id").val(Grocy.UserSettings.product_presets_qu_id);
|
|
||||||
$("#stock_due_soon_days").val(Grocy.UserSettings.stock_due_soon_days);
|
|
||||||
$("#stock_default_purchase_amount").val(Grocy.UserSettings.stock_default_purchase_amount);
|
|
||||||
$("#stock_default_consume_amount").val(Grocy.UserSettings.stock_default_consume_amount);
|
|
||||||
$("#stock_decimal_places_amounts").val(Grocy.UserSettings.stock_decimal_places_amounts);
|
|
||||||
$("#stock_decimal_places_prices").val(Grocy.UserSettings.stock_decimal_places_prices);
|
|
||||||
|
|
||||||
if (BoolVal(Grocy.UserSettings.show_icon_on_stock_overview_page_when_product_is_on_shopping_list))
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { BoolVal } from '../helpers/extensions';
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
|
||||||
|
$("#product_presets_location_id").val(Grocy.UserSettings.product_presets_location_id);
|
||||||
|
$("#product_presets_product_group_id").val(Grocy.UserSettings.product_presets_product_group_id);
|
||||||
|
$("#product_presets_qu_id").val(Grocy.UserSettings.product_presets_qu_id);
|
||||||
|
$("#stock_due_soon_days").val(Grocy.UserSettings.stock_due_soon_days);
|
||||||
|
$("#stock_default_purchase_amount").val(Grocy.UserSettings.stock_default_purchase_amount);
|
||||||
|
$("#stock_default_consume_amount").val(Grocy.UserSettings.stock_default_consume_amount);
|
||||||
|
$("#stock_decimal_places_amounts").val(Grocy.UserSettings.stock_decimal_places_amounts);
|
||||||
|
$("#stock_decimal_places_prices").val(Grocy.UserSettings.stock_decimal_places_prices);
|
||||||
|
|
||||||
|
if (BoolVal(Grocy.UserSettings.show_icon_on_stock_overview_page_when_product_is_on_shopping_list))
|
||||||
|
{
|
||||||
$("#show_icon_on_stock_overview_page_when_product_is_on_shopping_list").prop("checked", true);
|
$("#show_icon_on_stock_overview_page_when_product_is_on_shopping_list").prop("checked", true);
|
||||||
}
|
}
|
||||||
if (BoolVal(Grocy.UserSettings.show_purchased_date_on_purchase))
|
if (BoolVal(Grocy.UserSettings.show_purchased_date_on_purchase))
|
||||||
{
|
{
|
||||||
$("#show_purchased_date_on_purchase").prop("checked", true);
|
$("#show_purchased_date_on_purchase").prop("checked", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BoolVal(Grocy.UserSettings.show_warning_on_purchase_when_due_date_is_earlier_than_next))
|
if (BoolVal(Grocy.UserSettings.show_warning_on_purchase_when_due_date_is_earlier_than_next))
|
||||||
{
|
{
|
||||||
$("#show_warning_on_purchase_when_due_date_is_earlier_than_next").prop("checked", true);
|
$("#show_warning_on_purchase_when_due_date_is_earlier_than_next").prop("checked", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
|
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
|
||||||
{
|
{
|
||||||
$("#stock_default_consume_amount_use_quick_consume_amount").prop("checked", true);
|
$("#stock_default_consume_amount_use_quick_consume_amount").prop("checked", true);
|
||||||
$("#stock_default_consume_amount").attr("disabled", "");
|
$("#stock_default_consume_amount").attr("disabled", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
|
|
||||||
$("#stock_default_consume_amount_use_quick_consume_amount").on("click", function()
|
$("#stock_default_consume_amount_use_quick_consume_amount").on("click", function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
$("#stock_default_consume_amount").attr("disabled", "");
|
$("#stock_default_consume_amount").attr("disabled", "");
|
||||||
|
|
@ -43,4 +51,6 @@ $("#stock_default_consume_amount_use_quick_consume_amount").on("click", function
|
||||||
{
|
{
|
||||||
$("#stock_default_consume_amount").removeAttr("disabled");
|
$("#stock_default_consume_amount").removeAttr("disabled");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,27 @@
|
||||||
var categoriesTable = $('#taskcategories-table').DataTable({
|
function taskcategoriesView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var categoriesTable = $('#taskcategories-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#taskcategories-table tbody').removeClass("d-none");
|
$('#taskcategories-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(categoriesTable);
|
Grocy.FrontendHelpers.InitDataTable(categoriesTable);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete task category "%s"?',
|
'Are you sure to delete task category "%s"?',
|
||||||
'.task-category-delete-button',
|
'.task-category-delete-button',
|
||||||
'data-category-name',
|
'data-category-name',
|
||||||
'data-category-id',
|
'data-category-id',
|
||||||
'objects/task_categories/',
|
'objects/task_categories/',
|
||||||
'/taskcategories'
|
'/taskcategories'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,15 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function taskcategoryformView(Grocy, scope = null)
|
||||||
|
|
||||||
$('#save-task-category-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
$('#save-task-category-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -61,15 +69,15 @@ $('#save-task-category-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#task-category-form input').keyup(function(event)
|
$('#task-category-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('task-category-form');
|
Grocy.FrontendHelpers.ValidateForm('task-category-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#task-category-form input').keydown(function(event)
|
$('#task-category-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -83,8 +91,10 @@ $('#task-category-form input').keydown(function(event)
|
||||||
$('#save-task-category-button').click();
|
$('#save-task-category-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('task-category-form');
|
Grocy.FrontendHelpers.ValidateForm('task-category-form');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,18 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function taskformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("datetimepicker");
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-task-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("datetimepicker");
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-task-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -68,15 +76,15 @@ $('#save-task-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#task-form input').keyup(function(event)
|
$('#task-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('task-form');
|
Grocy.FrontendHelpers.ValidateForm('task-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#task-form input').keydown(function(event)
|
$('#task-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -90,9 +98,11 @@ $('#task-form input').keydown(function(event)
|
||||||
$('#save-task-button').click();
|
$('#save-task-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||||
Grocy.FrontendHelpers.ValidateForm('task-form');
|
Grocy.FrontendHelpers.ValidateForm('task-form');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
Grocy.Use("userpicker");
|
function tasksView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
var tasksTable = $('#tasks-table').DataTable({
|
Grocy.Use("userpicker");
|
||||||
|
|
||||||
|
var tasksTable = $('#tasks-table').DataTable({
|
||||||
'order': [[2, 'asc']],
|
'order': [[2, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
|
|
@ -12,18 +20,18 @@ var tasksTable = $('#tasks-table').DataTable({
|
||||||
enable: true,
|
enable: true,
|
||||||
dataSrc: 3
|
dataSrc: 3
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#tasks-table tbody').removeClass("d-none");
|
$('#tasks-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(tasksTable, null, function()
|
Grocy.FrontendHelpers.InitDataTable(tasksTable, null, function()
|
||||||
{
|
{
|
||||||
$("#search").val("");
|
$("#search").val("");
|
||||||
$("#search").trigger("keyup");
|
$("#search").trigger("keyup");
|
||||||
$("#show-done-tasks").trigger('checked', false);
|
$("#show-done-tasks").trigger('checked', false);
|
||||||
});
|
});
|
||||||
Grocy.FrontendHelpers.MakeStatusFilter(tasksTable, 5);
|
Grocy.FrontendHelpers.MakeStatusFilter(tasksTable, 5);
|
||||||
|
|
||||||
$(document).on('click', '.do-task-button', function(e)
|
$(document).on('click', '.do-task-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -65,10 +73,10 @@ $(document).on('click', '.do-task-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('click', '.undo-task-button', function(e)
|
$(document).on('click', '.undo-task-button', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
// Remove the focus from the current button
|
// Remove the focus from the current button
|
||||||
|
|
@ -90,9 +98,9 @@ $(document).on('click', '.undo-task-button', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete task "%s"?',
|
'Are you sure to delete task "%s"?',
|
||||||
'.delete-task-button',
|
'.delete-task-button',
|
||||||
'data-task-name',
|
'data-task-name',
|
||||||
|
|
@ -106,10 +114,10 @@ Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
$("#task-" + objectId + "-row").remove();
|
$("#task-" + objectId + "-row").remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$("#show-done-tasks").change(function()
|
$("#show-done-tasks").change(function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
window.location.href = U('/tasks?include_done');
|
window.location.href = U('/tasks?include_done');
|
||||||
|
|
@ -118,15 +126,15 @@ $("#show-done-tasks").change(function()
|
||||||
{
|
{
|
||||||
window.location.href = U('/tasks');
|
window.location.href = U('/tasks');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GetUriParam('include_done'))
|
if (GetUriParam('include_done'))
|
||||||
{
|
{
|
||||||
$("#show-done-tasks").prop('checked', true);
|
$("#show-done-tasks").prop('checked', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function RefreshStatistics()
|
function RefreshStatistics()
|
||||||
{
|
{
|
||||||
var nextXDays = $("#info-due-tasks").data("next-x-days");
|
var nextXDays = $("#info-due-tasks").data("next-x-days");
|
||||||
Grocy.Api.Get('tasks',
|
Grocy.Api.Get('tasks',
|
||||||
function(result)
|
function(result)
|
||||||
|
|
@ -156,6 +164,8 @@ function RefreshStatistics()
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,15 @@
|
||||||
Grocy.Use("numberpicker");
|
function taskssettingsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
$("#tasks_due_soon_days").val(Grocy.UserSettings.tasks_due_soon_days);
|
Grocy.Use("numberpicker");
|
||||||
|
|
||||||
RefreshLocaleNumberInput();
|
$("#tasks_due_soon_days").val(Grocy.UserSettings.tasks_due_soon_days);
|
||||||
|
|
||||||
|
RefreshLocaleNumberInput();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function transferView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("productpicker");
|
|
||||||
Grocy.Use("productamountpicker");
|
|
||||||
Grocy.Use("productcard");
|
|
||||||
|
|
||||||
$('#save-transfer-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("productpicker");
|
||||||
|
Grocy.Use("productamountpicker");
|
||||||
|
Grocy.Use("productcard");
|
||||||
|
|
||||||
|
$('#save-transfer-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -141,10 +149,10 @@ $('#save-transfer-button').on('click', function(e)
|
||||||
console.error(xhr);
|
console.error(xhr);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
$("#specific_stock_entry").find("option").remove().end().append("<option></option>");
|
$("#specific_stock_entry").find("option").remove().end().append("<option></option>");
|
||||||
if ($("#use_specific_stock_entry").is(":checked") && GetUriParam("stockId") == null)
|
if ($("#use_specific_stock_entry").is(":checked") && GetUriParam("stockId") == null)
|
||||||
{
|
{
|
||||||
|
|
@ -289,15 +297,15 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_transfer_amount));
|
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_transfer_amount));
|
||||||
$(".input-group-productamountpicker").trigger("change");
|
$(".input-group-productamountpicker").trigger("change");
|
||||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||||
RefreshLocaleNumberInput();
|
RefreshLocaleNumberInput();
|
||||||
|
|
||||||
$("#location_id_from").on('change', function(e)
|
$("#location_id_from").on('change', function(e)
|
||||||
{
|
{
|
||||||
var locationId = $(e.target).val();
|
var locationId = $(e.target).val();
|
||||||
var sumValue = 0;
|
var sumValue = 0;
|
||||||
var stockId = null;
|
var stockId = null;
|
||||||
|
|
@ -357,10 +365,10 @@ $("#location_id_from").on('change', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#location_id_to").on('change', function(e)
|
$("#location_id_to").on('change', function(e)
|
||||||
{
|
{
|
||||||
var locationId = $(e.target).val();
|
var locationId = $(e.target).val();
|
||||||
|
|
||||||
if (locationId == $("#location_id_from").val())
|
if (locationId == $("#location_id_from").val())
|
||||||
|
|
@ -368,30 +376,30 @@ $("#location_id_to").on('change', function(e)
|
||||||
$("#location_id_to").parent().find(".invalid-feedback").text(__t('This cannot be the same as the "From" location'));
|
$("#location_id_to").parent().find(".invalid-feedback").text(__t('This cannot be the same as the "From" location'));
|
||||||
$("#location_id_to").val("");
|
$("#location_id_to").val("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#qu_id").on('change', function(e)
|
$("#qu_id").on('change', function(e)
|
||||||
{
|
{
|
||||||
$("#display_amount").attr("max", parseFloat($('#display_amount').attr("data-stock-amount")) * $("#qu_id option:selected").attr("data-qu-factor"));
|
$("#display_amount").attr("max", parseFloat($('#display_amount').attr("data-stock-amount")) * $("#qu_id option:selected").attr("data-qu-factor"));
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#display_amount').on('focus', function(e)
|
$('#display_amount').on('focus', function(e)
|
||||||
{
|
{
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#transfer-form input').keyup(function(event)
|
$('#transfer-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#transfer-form select').change(function(event)
|
$('#transfer-form select').change(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
Grocy.FrontendHelpers.ValidateForm('transfer-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#transfer-form input').keydown(function(event)
|
$('#transfer-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -405,10 +413,10 @@ $('#transfer-form input').keydown(function(event)
|
||||||
$('#save-transfer-button').click();
|
$('#save-transfer-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#specific_stock_entry").on("change", function(e)
|
$("#specific_stock_entry").on("change", function(e)
|
||||||
{
|
{
|
||||||
if ($(e.target).val() == "")
|
if ($(e.target).val() == "")
|
||||||
{
|
{
|
||||||
var sumValue = 0;
|
var sumValue = 0;
|
||||||
|
|
@ -438,10 +446,10 @@ $("#specific_stock_entry").on("change", function(e)
|
||||||
{
|
{
|
||||||
$("#display_amount").attr("max", $('option:selected', this).attr('amount'));
|
$("#display_amount").attr("max", $('option:selected', this).attr('amount'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#use_specific_stock_entry").on("change", function()
|
$("#use_specific_stock_entry").on("change", function()
|
||||||
{
|
{
|
||||||
var value = $(this).is(":checked");
|
var value = $(this).is(":checked");
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
|
|
@ -458,11 +466,11 @@ $("#use_specific_stock_entry").on("change", function()
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm("transfer-form");
|
Grocy.FrontendHelpers.ValidateForm("transfer-form");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (GetUriParam("embedded") !== undefined)
|
if (GetUriParam("embedded") !== undefined)
|
||||||
{
|
{
|
||||||
var locationId = GetUriParam('locationId');
|
var locationId = GetUriParam('locationId');
|
||||||
|
|
||||||
if (typeof locationId === 'undefined')
|
if (typeof locationId === 'undefined')
|
||||||
|
|
@ -479,7 +487,9 @@ if (GetUriParam("embedded") !== undefined)
|
||||||
$("#use_specific_stock_entry").trigger('change');
|
$("#use_specific_stock_entry").trigger('change');
|
||||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default input field
|
// Default input field
|
||||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,27 @@
|
||||||
var userentitiesTable = $('#userentities-table').DataTable({
|
function userentitiesView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var userentitiesTable = $('#userentities-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#userentities-table tbody').removeClass("d-none");
|
$('#userentities-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(userentitiesTable);
|
Grocy.FrontendHelpers.InitDataTable(userentitiesTable);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete userentity "%s"?',
|
'Are you sure to delete userentity "%s"?',
|
||||||
'.userentity-delete-button',
|
'.userentity-delete-button',
|
||||||
'data-userentity-name',
|
'data-userentity-name',
|
||||||
'data-userentity-id',
|
'data-userentity-id',
|
||||||
'objects/userentities/',
|
'objects/userentities/',
|
||||||
'/userentities'
|
'/userentities'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,15 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function userentityformView(Grocy, scope = null)
|
||||||
|
|
||||||
$('#save-userentity-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
$('#save-userentity-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -56,20 +64,20 @@ $('#save-userentity-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#userentity-form input').keyup(function(event)
|
$('#userentity-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('userentity-form');
|
Grocy.FrontendHelpers.ValidateForm('userentity-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#userentity-form select').change(function(event)
|
$('#userentity-form select').change(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('userentity-form');
|
Grocy.FrontendHelpers.ValidateForm('userentity-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#userentity-form input').keydown(function(event)
|
$('#userentity-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -83,10 +91,10 @@ $('#userentity-form input').keydown(function(event)
|
||||||
$('#save-userentity-button').click();
|
$('#save-userentity-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#show_in_sidebar_menu").on("click", function()
|
$("#show_in_sidebar_menu").on("click", function()
|
||||||
{
|
{
|
||||||
if (this.checked)
|
if (this.checked)
|
||||||
{
|
{
|
||||||
$("#icon_css_class").removeAttr("disabled");
|
$("#icon_css_class").removeAttr("disabled");
|
||||||
|
|
@ -95,11 +103,13 @@ $("#show_in_sidebar_menu").on("click", function()
|
||||||
{
|
{
|
||||||
$("#icon_css_class").attr("disabled", "");
|
$("#icon_css_class").attr("disabled", "");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
Grocy.FrontendHelpers.ValidateForm('userentity-form');
|
Grocy.FrontendHelpers.ValidateForm('userentity-form');
|
||||||
|
|
||||||
// Click twice to trigger on-click but not change the actual checked state
|
// Click twice to trigger on-click but not change the actual checked state
|
||||||
$("#show_in_sidebar_menu").click();
|
$("#show_in_sidebar_menu").click();
|
||||||
$("#show_in_sidebar_menu").click();
|
$("#show_in_sidebar_menu").click();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function userfieldformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("numberpicker");
|
|
||||||
|
|
||||||
$('#save-userfield-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("numberpicker");
|
||||||
|
|
||||||
|
$('#save-userfield-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -62,20 +70,20 @@ $('#save-userfield-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#userfield-form input').keyup(function(event)
|
$('#userfield-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('userfield-form');
|
Grocy.FrontendHelpers.ValidateForm('userfield-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#userfield-form select').change(function(event)
|
$('#userfield-form select').change(function(event)
|
||||||
{
|
{
|
||||||
Grocy.FrontendHelpers.ValidateForm('userfield-form');
|
Grocy.FrontendHelpers.ValidateForm('userfield-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#userfield-form input').keydown(function(event)
|
$('#userfield-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -89,10 +97,10 @@ $('#userfield-form input').keydown(function(event)
|
||||||
$('#save-userfield-button').click();
|
$('#save-userfield-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#type").on("change", function(e)
|
$("#type").on("change", function(e)
|
||||||
{
|
{
|
||||||
var value = $(this).val();
|
var value = $(this).val();
|
||||||
|
|
||||||
if (value === "preset-list" || value === "preset-checklist")
|
if (value === "preset-list" || value === "preset-checklist")
|
||||||
|
|
@ -105,16 +113,18 @@ $("#type").on("change", function(e)
|
||||||
$("#config").parent().addClass("d-none");
|
$("#config").parent().addClass("d-none");
|
||||||
$("#config-hint").text("");
|
$("#config-hint").text("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#entity').focus();
|
$('#entity').focus();
|
||||||
|
|
||||||
if (typeof GetUriParam("entity") !== "undefined" && !GetUriParam("entity").isEmpty())
|
if (typeof GetUriParam("entity") !== "undefined" && !GetUriParam("entity").isEmpty())
|
||||||
{
|
{
|
||||||
$("#entity").val(GetUriParam("entity"));
|
$("#entity").val(GetUriParam("entity"));
|
||||||
$("#entity").trigger("change");
|
$("#entity").trigger("change");
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#type").trigger("change");
|
$("#type").trigger("change");
|
||||||
Grocy.FrontendHelpers.ValidateForm('userfield-form');
|
Grocy.FrontendHelpers.ValidateForm('userfield-form');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,30 @@
|
||||||
var userfieldsTable = $('#userfields-table').DataTable({
|
function userfieldsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var userfieldsTable = $('#userfields-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#userfields-table tbody').removeClass("d-none");
|
$('#userfields-table tbody').removeClass("d-none");
|
||||||
|
|
||||||
Grocy.FrontendHelpers.InitDataTable(userfieldsTable, null, function()
|
Grocy.FrontendHelpers.InitDataTable(userfieldsTable, null, function()
|
||||||
{
|
{
|
||||||
$("#search").val("");
|
$("#search").val("");
|
||||||
$("#entity-filter").val("all");
|
$("#entity-filter").val("all");
|
||||||
userfieldsTable.column(1).search("").draw();
|
userfieldsTable.column(1).search("").draw();
|
||||||
userfieldsTable.search("").draw();
|
userfieldsTable.search("").draw();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#entity-filter").on("change", function()
|
$("#entity-filter").on("change", function()
|
||||||
{
|
{
|
||||||
var value = $("#entity-filter option:selected").text();
|
var value = $("#entity-filter option:selected").text();
|
||||||
if (value === __t("All"))
|
if (value === __t("All"))
|
||||||
{
|
{
|
||||||
|
|
@ -25,20 +33,22 @@ $("#entity-filter").on("change", function()
|
||||||
|
|
||||||
userfieldsTable.column(1).search(value).draw();
|
userfieldsTable.column(1).search(value).draw();
|
||||||
$("#new-userfield-button").attr("href", U("/userfield/new?embedded&entity=" + value));
|
$("#new-userfield-button").attr("href", U("/userfield/new?embedded&entity=" + value));
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete user field "%s"?',
|
'Are you sure to delete user field "%s"?',
|
||||||
'.userfield-delete-button',
|
'.userfield-delete-button',
|
||||||
'data-userfield-name',
|
'data-userfield-name',
|
||||||
'data-userfield-id',
|
'data-userfield-id',
|
||||||
'objects/userfields/',
|
'objects/userfields/',
|
||||||
'/userfields'
|
'/userfields'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (GetUriParam("entity") != undefined && !GetUriParam("entity").isEmpty())
|
if (GetUriParam("entity") != undefined && !GetUriParam("entity").isEmpty())
|
||||||
{
|
{
|
||||||
$("#entity-filter").val(GetUriParam("entity"));
|
$("#entity-filter").val(GetUriParam("entity"));
|
||||||
$("#entity-filter").trigger("change");
|
$("#entity-filter").trigger("change");
|
||||||
$("#name").focus();
|
$("#name").focus();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,15 @@
|
||||||
Grocy.Use("userfieldsform");
|
function userformView(Grocy, scope = null)
|
||||||
|
|
||||||
function SaveUserPicture(result, jsonData)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
function SaveUserPicture(result, jsonData)
|
||||||
|
{
|
||||||
Grocy.Components.UserfieldsForm.Save(() =>
|
Grocy.Components.UserfieldsForm.Save(() =>
|
||||||
{
|
{
|
||||||
if (Object.prototype.hasOwnProperty.call(jsonData, "picture_file_name") && !Grocy.DeleteUserPictureOnSave)
|
if (Object.prototype.hasOwnProperty.call(jsonData, "picture_file_name") && !Grocy.DeleteUserPictureOnSave)
|
||||||
|
|
@ -23,10 +31,10 @@ function SaveUserPicture(result, jsonData)
|
||||||
window.location.href = U('/users');
|
window.location.href = U('/users');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#save-user-button').on('click', function(e)
|
$('#save-user-button').on('click', function(e)
|
||||||
{
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -82,10 +90,10 @@ $('#save-user-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#user-form input').keyup(function(event)
|
$('#user-form input').keyup(function(event)
|
||||||
{
|
{
|
||||||
var element = document.getElementById("password_confirm");
|
var element = document.getElementById("password_confirm");
|
||||||
if ($("#password").val() !== $("#password_confirm").val())
|
if ($("#password").val() !== $("#password_confirm").val())
|
||||||
{
|
{
|
||||||
|
|
@ -97,10 +105,10 @@ $('#user-form input').keyup(function(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.ValidateForm('user-form');
|
Grocy.FrontendHelpers.ValidateForm('user-form');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#user-form input').keydown(function(event)
|
$('#user-form input').keydown(function(event)
|
||||||
{
|
{
|
||||||
if (event.keyCode === 13) //Enter
|
if (event.keyCode === 13) //Enter
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
@ -114,35 +122,37 @@ $('#user-form input').keydown(function(event)
|
||||||
$('#save-user-button').click();
|
$('#save-user-button').click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (GetUriParam("changepw") === "true")
|
if (GetUriParam("changepw") === "true")
|
||||||
{
|
{
|
||||||
$('#password').focus();
|
$('#password').focus();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#username').focus();
|
$('#username').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#user-picture").on("change", function(e)
|
$("#user-picture").on("change", function(e)
|
||||||
{
|
{
|
||||||
$("#user-picture-label").removeClass("d-none");
|
$("#user-picture-label").removeClass("d-none");
|
||||||
$("#user-picture-label-none").addClass("d-none");
|
$("#user-picture-label-none").addClass("d-none");
|
||||||
$("#delete-current-user-picture-on-save-hint").addClass("d-none");
|
$("#delete-current-user-picture-on-save-hint").addClass("d-none");
|
||||||
$("#current-user-picture").addClass("d-none");
|
$("#current-user-picture").addClass("d-none");
|
||||||
Grocy.DeleteUserePictureOnSave = false;
|
Grocy.DeleteUserePictureOnSave = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.DeleteUserPictureOnSave = false;
|
Grocy.DeleteUserPictureOnSave = false;
|
||||||
$("#delete-current-user-picture-button").on("click", function(e)
|
$("#delete-current-user-picture-button").on("click", function(e)
|
||||||
{
|
{
|
||||||
Grocy.DeleteUserPictureOnSave = true;
|
Grocy.DeleteUserPictureOnSave = true;
|
||||||
$("#current-user-picture").addClass("d-none");
|
$("#current-user-picture").addClass("d-none");
|
||||||
$("#delete-current-user-picture-on-save-hint").removeClass("d-none");
|
$("#delete-current-user-picture-on-save-hint").removeClass("d-none");
|
||||||
$("#user-picture-label").addClass("d-none");
|
$("#user-picture-label").addClass("d-none");
|
||||||
$("#user-picture-label-none").removeClass("d-none");
|
$("#user-picture-label-none").removeClass("d-none");
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
Grocy.FrontendHelpers.ValidateForm('user-form');
|
Grocy.FrontendHelpers.ValidateForm('user-form');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
import { WindowMessageBag } from '../helpers/messagebag';
|
function userobjectformView(Grocy, scope = null)
|
||||||
|
|
||||||
Grocy.Use("userfieldsform");
|
|
||||||
|
|
||||||
$('#save-userobject-button').on('click', function(e)
|
|
||||||
{
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
import { WindowMessageBag } from '../helpers/messagebag';
|
||||||
|
|
||||||
|
Grocy.Use("userfieldsform");
|
||||||
|
|
||||||
|
$('#save-userobject-button').on('click', function(e)
|
||||||
|
{
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if ($(".combobox-menu-visible").length)
|
if ($(".combobox-menu-visible").length)
|
||||||
|
|
@ -65,7 +73,9 @@ $('#save-userobject-button').on('click', function(e)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Grocy.Components.UserfieldsForm.Load();
|
Grocy.Components.UserfieldsForm.Load();
|
||||||
$("#userfields-form").removeClass("border").removeClass("border-info").removeClass("p-2").find("h2").addClass("d-none");
|
$("#userfields-form").removeClass("border").removeClass("border-info").removeClass("p-2").find("h2").addClass("d-none");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,27 @@
|
||||||
var userobjectsTable = $('#userobjects-table').DataTable({
|
function userobjectsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var userobjectsTable = $('#userobjects-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#userobjects-table tbody').removeClass("d-none");
|
$('#userobjects-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(userobjectsTable);
|
Grocy.FrontendHelpers.InitDataTable(userobjectsTable);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete this userobject?',
|
'Are you sure to delete this userobject?',
|
||||||
'.userobject-delete-button',
|
'.userobject-delete-button',
|
||||||
'data-userobject-id',
|
'data-userobject-id',
|
||||||
'data-userobject-id',
|
'data-userobject-id',
|
||||||
'objects/userobjects/',
|
'objects/userobjects/',
|
||||||
() => window.location.reload()
|
() => window.location.reload()
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,27 @@
|
||||||
$('input.permission-cb').click(
|
function userpermissionsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('input.permission-cb').click(
|
||||||
function()
|
function()
|
||||||
{
|
{
|
||||||
check_hierachy(this.checked, this.name);
|
check_hierachy(this.checked, this.name);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
function check_hierachy(checked, name)
|
function check_hierachy(checked, name)
|
||||||
{
|
{
|
||||||
var disabled = checked;
|
var disabled = checked;
|
||||||
$('#permission-sub-' + name).find('input.permission-cb')
|
$('#permission-sub-' + name).find('input.permission-cb')
|
||||||
.prop('checked', disabled)
|
.prop('checked', disabled)
|
||||||
.attr('disabled', disabled);
|
.attr('disabled', disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#permission-save').click(
|
$('#permission-save').click(
|
||||||
function()
|
function()
|
||||||
{
|
{
|
||||||
var permission_list = $('input.permission-cb')
|
var permission_list = $('input.permission-cb')
|
||||||
|
|
@ -36,10 +44,10 @@ $('#permission-save').click(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (Grocy.EditObjectId == Grocy.UserId)
|
if (Grocy.EditObjectId == Grocy.UserId)
|
||||||
{
|
{
|
||||||
$('input.permission-cb[name=ADMIN]').click(function()
|
$('input.permission-cb[name=ADMIN]').click(function()
|
||||||
{
|
{
|
||||||
var element = this;
|
var element = this;
|
||||||
|
|
@ -70,4 +78,6 @@ if (Grocy.EditObjectId == Grocy.UserId)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,27 @@
|
||||||
var usersTable = $('#users-table').DataTable({
|
function usersView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
|
var usersTable = $('#users-table').DataTable({
|
||||||
'order': [[1, 'asc']],
|
'order': [[1, 'asc']],
|
||||||
'columnDefs': [
|
'columnDefs': [
|
||||||
{ 'orderable': false, 'targets': 0 },
|
{ 'orderable': false, 'targets': 0 },
|
||||||
{ 'searchable': false, "targets": 0 }
|
{ 'searchable': false, "targets": 0 }
|
||||||
].concat($.fn.dataTable.defaults.columnDefs)
|
].concat($.fn.dataTable.defaults.columnDefs)
|
||||||
});
|
});
|
||||||
$('#users-table tbody').removeClass("d-none");
|
$('#users-table tbody').removeClass("d-none");
|
||||||
Grocy.FrontendHelpers.InitDataTable(usersTable);
|
Grocy.FrontendHelpers.InitDataTable(usersTable);
|
||||||
|
|
||||||
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
|
||||||
'Are you sure to delete user "%s"?',
|
'Are you sure to delete user "%s"?',
|
||||||
'.user-delete-button',
|
'.user-delete-button',
|
||||||
'data-user-username',
|
'data-user-username',
|
||||||
'data-user-id',
|
'data-user-id',
|
||||||
'users/',
|
'users/',
|
||||||
'/users'
|
'/users'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,13 @@
|
||||||
$("#locale").val(Grocy.UserSettings.locale);
|
function usersettingsView(Grocy, scope = null)
|
||||||
|
{
|
||||||
|
var $scope = $;
|
||||||
|
if (scope != null)
|
||||||
|
{
|
||||||
|
$scope = $(scope).find;
|
||||||
|
}
|
||||||
|
|
||||||
RefreshLocaleNumberInput();
|
$("#locale").val(Grocy.UserSettings.locale);
|
||||||
|
|
||||||
|
RefreshLocaleNumberInput();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user