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:
Katharina Bogad 2021-06-22 22:38:55 +02:00
parent 151722ea38
commit fd61d1ef62
68 changed files with 9280 additions and 8609 deletions

View File

@ -1,4 +1,12 @@
$('[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();
$(this).parent().next().collapse("toggle");
@ -8,3 +16,5 @@ if ((typeof GetUriParam("tab") !== "undefined" && GetUriParam("tab") === "change
{
$(".nav-tabs a[href='#changelog']").tab("show");
}
}

View File

@ -1,4 +1,12 @@
Grocy.Use("barcodescanner");
function barcodescannertestingView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("barcodescanner");
Grocy.BarCodeScannerTestingHitCount = 0;
Grocy.BarCodeScannerTestingMissCount = 0;
@ -95,3 +103,5 @@ $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
OnBarcodeScanned(barcode);
});
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -39,3 +47,5 @@ if (GetUriParam('include_disabled'))
{
$("#show-disabled").prop('checked', true);
}
}

View File

@ -1,4 +1,12 @@
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,
'order': [[2, 'desc']],
'columnDefs': [
@ -38,3 +46,5 @@ $(document).on('click', '.undo-battery-execution-button', function(e)
}
);
});
}

View File

@ -1,4 +1,12 @@
Grocy.Use("batterycard");
function batteriesoverviewView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("batterycard");
var batteriesOverviewTable = $('#batteries-overview-table').DataTable({
'order': [[4, 'asc']],
@ -120,3 +128,5 @@ function RefreshStatistics()
}
RefreshStatistics();
}

View File

@ -1,5 +1,15 @@
Grocy.Use("numberpicker");
function batteriessettingsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("numberpicker");
$("#batteries_due_soon_days").val(Grocy.UserSettings.batteries_due_soon_days);
RefreshLocaleNumberInput();
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function batteryformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("numberpicker");
Grocy.Use("userfieldsform");
@ -91,3 +99,5 @@ $('#battery-form input').keydown(function(event)
Grocy.Components.UserfieldsForm.Load();
$('#name').focus();
Grocy.FrontendHelpers.ValidateForm('battery-form');
}

View File

@ -1,4 +1,12 @@
Grocy.Use("batterycard");
function batterytrackingView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("batterycard");
Grocy.Use("datetimepicker");
$('#save-batterytracking-button').on('click', function(e)
@ -101,3 +109,5 @@ $('#tracked_time').find('input').on('keypress', function(e)
});
}

View File

@ -1,4 +1,12 @@
/* global fullcalendarEventSources */
function calendarView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
/* global fullcalendarEventSources */
import { Calendar } from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
@ -90,3 +98,5 @@ $(window).one("resize", function()
calendar.changeView("dayGridMonth");
}
});
}

View File

@ -1,4 +1,12 @@
Grocy.Use("numberpicker");
function choreformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("numberpicker");
Grocy.Use("userfieldsform");
$('#save-chore-button').on('click', function(e)
@ -240,3 +248,5 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
);
}
});
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -38,3 +46,5 @@ if (GetUriParam('include_disabled'))
{
$("#show-disabled").prop('checked', true);
}
}

View File

@ -1,4 +1,12 @@
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,
'order': [[2, 'desc']],
'columnDefs': [
@ -38,3 +46,5 @@ $(document).on('click', '.undo-chore-execution-button', function(e)
}
);
});
}

View File

@ -1,4 +1,12 @@
Grocy.Use("chorecard");
function choresoverviewView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("chorecard");
var choresOverviewTable = $('#chores-overview-table').DataTable({
'order': [[2, 'asc']],
@ -180,3 +188,5 @@ if (GetUriParam("user") !== undefined)
}
RefreshStatistics();
}

View File

@ -1,5 +1,15 @@
Grocy.Use("numberpicker");
function choressettingsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("numberpicker");
$("#chores_due_soon_days").val(Grocy.UserSettings.chores_due_soon_days);
RefreshLocaleNumberInput();
}

View File

@ -1,4 +1,12 @@
Grocy.Use("chorecard");
function choretrackingView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("chorecard");
Grocy.Use("datetimepicker");
Grocy.Use("userpicker");
@ -117,3 +125,5 @@ Grocy.Components.DateTimePicker.GetInputElement().on('keypress', function(e)
{
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
});
}

View File

@ -1,4 +1,12 @@
import { BoolVal } from '../helpers/extensions';
function consumeView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { BoolVal } from '../helpers/extensions';
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("productamountpicker");
@ -641,3 +649,4 @@ function RefreshForm()
Grocy.FrontendHelpers.ValidateForm("consume-form");
}
}

View File

@ -1,4 +1,12 @@
import { ResizeResponsiveEmbeds } from "../helpers/embeds";
function equipmentView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { ResizeResponsiveEmbeds } from "../helpers/embeds";
var equipmentTable = $('#equipment-table').DataTable({
'order': [[1, 'asc']],
@ -90,3 +98,5 @@ $("#selectedEquipmentDescriptionToggleFullscreenButton").on('click', function(e)
$("#selectedEquipmentDescriptionCard .card-body").toggleClass("mt-5");
$("body").toggleClass("fullscreen-card");
});
}

View File

@ -1,4 +1,12 @@
import { RandomString } from '../helpers/extensions';
function equipmentformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { RandomString } from '../helpers/extensions';
import { ResizeResponsiveEmbeds } from '../helpers/embeds';
Grocy.Use("userfieldsform");
@ -159,3 +167,5 @@ $("#instruction-manual").on("change", function(e)
$("#current-instruction-manuale").addClass("d-none");
Grocy.DeleteProductPictureOnSave = false;
});
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function inventoryView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("datetimepicker");
if (Grocy.UserSettings.show_purchased_date_on_purchase)
@ -374,3 +382,5 @@ $('#display_amount').on('keyup', function(e)
});
$("#display_amount").attr("min", "0");
}

View File

@ -1,4 +1,12 @@
$(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");
$(".print-timestamp").text(moment().format("l LT"));
@ -12,3 +20,5 @@ $(document).on("click", ".print-single-location-button", function(e)
$(".print-timestamp").text(moment().format("l LT"));
window.print();
});
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function locationformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("userfieldsform");
@ -90,3 +98,5 @@ $('#location-form input').keydown(function(event)
Grocy.Components.UserfieldsForm.Load();
Grocy.FrontendHelpers.ValidateForm('location-form');
$('#name').focus();
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -16,3 +24,4 @@ Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'objects/locations/',
'/locations'
);
}

View File

@ -1,7 +1,17 @@
$('#username').focus();
function loginView(Grocy, scope = null)
{
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').removeClass('d-none');
}
}

View File

@ -1,4 +1,12 @@
import { QrCodeImgHtml } from "../helpers/qrcode";
function manageapikeysView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { QrCodeImgHtml } from "../helpers/qrcode";
var apiKeysTable = $('#apikeys-table').DataTable({
'order': [[4, 'desc']],
@ -45,3 +53,5 @@ $('.apikey-show-qr-button').on('click', function()
closeButton: false
});
})
}

View File

@ -1,4 +1,12 @@
/* global fullcalendarEventSources, internalRecipes, recipesResolved */
function mealplanView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
/* global fullcalendarEventSources, internalRecipes, recipesResolved */
import { Calendar } from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
@ -862,3 +870,5 @@ Grocy.Components.RecipePicker.GetPicker().on('change', function(e)
);
}
});
}

View File

@ -1,4 +1,12 @@
/* global SwaggerUIBundle, SwaggerUIStandalonePreset */
function openapiuiView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
/* global SwaggerUIBundle, SwaggerUIStandalonePreset */
function HideTopbarPlugin()
{
return {
@ -25,3 +33,5 @@ const swaggerUi = SwaggerUIBundle({
});
window.ui = swaggerUi;
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function productbarcodeformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use('barcodescanner');
Grocy.Use("productamountpicker");
@ -109,3 +117,5 @@ $(document).on("Grocy.BarcodeScanned", function(e, barcode, target)
$("#barcode").val(barcode);
});
}

View File

@ -1,4 +1,12 @@
import { BoolVal } from '../helpers/extensions';
function productformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { BoolVal } from '../helpers/extensions';
Grocy.Use("numberpicker");
Grocy.Use("shoppinglocationpicker");
@ -511,3 +519,5 @@ else if (Grocy.EditMode === 'create')
}
Grocy.FrontendHelpers.ValidateForm("product-form");
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function productgroupformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("userfieldsform");
@ -76,3 +84,5 @@ $('#product-group-form input').keydown(function(event)
Grocy.Components.UserfieldsForm.Load();
$('#name').focus();
Grocy.FrontendHelpers.ValidateForm('product-group-form');
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -25,3 +33,5 @@ $(window).on("message", function(e)
window.location.reload();
}
});
}

View File

@ -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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -79,3 +87,5 @@ $("#merge-products-save-button").on("click", function()
}
);
});
}

View File

@ -1,4 +1,12 @@
import { BoolVal } from '../helpers/extensions';
function purchaseView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { BoolVal } from '../helpers/extensions';
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("datetimepicker");
@ -580,3 +588,5 @@ $('#qu_id').on('change', function(e)
priceTypeUnitPriceLabel.text($("#qu_id option:selected").text() + " " + __t("price"));
refreshPriceHint();
});
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function quantityunitconversionformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("numberpicker");
Grocy.Use("userfieldsform");
@ -211,3 +219,5 @@ if (GetUriParam("qu-unit") !== undefined)
{
$("#from_qu_id").attr("disabled", "");
}
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function quantityunitformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("userfieldsform");
@ -177,3 +185,5 @@ $("#test-quantityunit-plural-forms-button").on("click", function(e)
}
});
});
}

View File

@ -1,4 +1,12 @@
Grocy.Use("numberpicker");
function quantityunitpluraltestingView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("numberpicker");
$("#qu_id").change(function(event)
{
@ -37,3 +45,5 @@ if (GetUriParam("qu") !== undefined)
}
$("#amount").focus();
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -15,3 +23,4 @@ Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'objects/quantity_units/',
'/quantityunits'
);
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function recipeformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("numberpicker");
Grocy.Use("recipepicker");
@ -334,3 +342,5 @@ $(window).on("message", function(e)
);
}
});
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function recipeposformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("numberpicker");
Grocy.Use("productamountpicker");
@ -168,3 +176,5 @@ if ($("#only_check_single_unit_in_stock").prop("checked"))
{
Grocy.Components.ProductAmountPicker.AllowAnyQu(true);
}
}

View File

@ -1,4 +1,12 @@
Grocy.Use("numberpicker");
function recipesView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("numberpicker");
var recipesTables = $('#recipes-table').DataTable({
'order': [[1, 'asc']],
@ -265,3 +273,5 @@ if (window.location.hash === "#fullscreen")
{
$("#selectedRecipeToggleFullscreenButton").click();
}
}

View File

@ -1,4 +1,12 @@
import { BoolVal } from '../helpers/extensions';
function recipessettingsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { BoolVal } from '../helpers/extensions';
if (BoolVal(Grocy.UserSettings.recipe_ingredients_group_by_product_group))
{
@ -6,3 +14,5 @@ if (BoolVal(Grocy.UserSettings.recipe_ingredients_group_by_product_group))
}
RefreshLocaleNumberInput();
}

View File

@ -1,3 +1,11 @@
function shoppinglistView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
// this needs to be explicitly imported for some reason,
// otherwise rollup complains.
import bwipjs from '../../node_modules/bwip-js/dist/bwip-js.mjs';
@ -543,3 +551,5 @@ if ($(window).width() < 768 || !Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK)
{
$("#filter-container").removeClass("border-bottom");
}
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function shoppinglistformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("userfieldsform");
@ -80,3 +88,5 @@ $('#shopping-list-form input').keydown(function(event)
Grocy.Components.UserfieldsForm.Load();
$('#name').focus();
Grocy.FrontendHelpers.ValidateForm('shopping-list-form');
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function shoppinglistitemformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("productamountpicker");
Grocy.Use("userfieldsform");
@ -269,3 +277,5 @@ if (GetUriParam("product-name") != null)
}
Grocy.Components.UserfieldsForm.Load();
}

View File

@ -1,4 +1,12 @@
import { BoolVal } from '../helpers/extensions';
function shoppinglistsettingsView(Grocy, scope = null)
{
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))
{
@ -11,3 +19,5 @@ if (BoolVal(Grocy.UserSettings.shopping_list_show_calendar))
}
RefreshLocaleNumberInput();
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function shoppinglocationformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("userfieldsform");
@ -90,3 +98,5 @@ $('#shoppinglocation-form input').keydown(function(event)
Grocy.Components.UserfieldsForm.Load();
$('#name').focus();
Grocy.FrontendHelpers.ValidateForm('shoppinglocation-form');
}

View File

@ -1,3 +1,11 @@
function shoppinglocationsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
var locationsTable = $('#shoppinglocations-table').DataTable({
'order': [[1, 'asc']],
'columnDefs': [
@ -16,3 +24,4 @@ Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'objects/shopping_locations/',
'/shoppinglocations'
);
}

View File

@ -1,4 +1,12 @@
Grocy.Use("productcard");
function stockentriesView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("productcard");
Grocy.Use("productpicker");
var stockEntriesTable = $('#stockentries-table').DataTable({
@ -274,3 +282,5 @@ $(document).on("click", ".product-name-cell", function(e)
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
$("#productcard-modal").modal("show");
});
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function stockentryformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("datetimepicker");
Grocy.Use("datetimepicker2");
@ -121,3 +129,5 @@ $("#amount").on("focus", function(e)
});
$("#amount").focus();
Grocy.FrontendHelpers.ValidateForm("stockentry-form");
}

View File

@ -1,4 +1,12 @@
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,
'order': [[3, 'desc']],
'columnDefs': [
@ -49,3 +57,5 @@ $(document).on('click', '.undo-stock-booking-button', function(e)
}
);
});
}

View File

@ -1,3 +1,11 @@
function stockjournalsummaryView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
var journalSummaryTable = $('#stock-journal-summary-table').DataTable({
'paginate': true,
'order': [[1, 'asc']],
@ -13,3 +21,4 @@ Grocy.FrontendHelpers.InitDataTable(journalSummaryTable);
Grocy.FrontendHelpers.MakeFilterForColumn("#product-filter", 1, journalSummaryTable);
Grocy.FrontendHelpers.MakeFilterForColumn("#transaction-type-filter", 2, journalSummaryTable);
Grocy.FrontendHelpers.MakeFilterForColumn("#user-filter", 3, journalSummaryTable);
}

View File

@ -1,4 +1,12 @@
Grocy.Use("productcard");
function stockoverviewView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("productcard");
var stockOverviewTable = $('#stock-overview-table').DataTable({
'order': [[5, 'asc']],
@ -327,3 +335,5 @@ $(window).on("message", function(e)
RefreshStatistics();
}
});
}

View File

@ -1,4 +1,12 @@
import { BoolVal } from '../helpers/extensions';
function stocksettingsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { BoolVal } from '../helpers/extensions';
Grocy.Use("numberpicker");
@ -44,3 +52,5 @@ $("#stock_default_consume_amount_use_quick_consume_amount").on("click", function
$("#stock_default_consume_amount").removeAttr("disabled");
}
});
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -16,3 +24,4 @@ Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'objects/task_categories/',
'/taskcategories'
);
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function taskcategoryformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
$('#save-task-category-button').on('click', function(e)
{
@ -88,3 +96,5 @@ $('#task-category-form input').keydown(function(event)
Grocy.Components.UserfieldsForm.Load();
$('#name').focus();
Grocy.FrontendHelpers.ValidateForm('task-category-form');
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function taskformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("datetimepicker");
Grocy.Use("userfieldsform");
@ -96,3 +104,5 @@ Grocy.Components.UserfieldsForm.Load();
$('#name').focus();
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
Grocy.FrontendHelpers.ValidateForm('task-form');
}

View File

@ -1,4 +1,12 @@
Grocy.Use("userpicker");
function tasksView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("userpicker");
var tasksTable = $('#tasks-table').DataTable({
'order': [[2, 'asc']],
@ -159,3 +167,5 @@ function RefreshStatistics()
}
RefreshStatistics();
}

View File

@ -1,5 +1,15 @@
Grocy.Use("numberpicker");
function taskssettingsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("numberpicker");
$("#tasks_due_soon_days").val(Grocy.UserSettings.tasks_due_soon_days);
RefreshLocaleNumberInput();
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function transferView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("productpicker");
Grocy.Use("productamountpicker");
@ -483,3 +491,5 @@ if (GetUriParam("embedded") !== undefined)
// Default input field
Grocy.Components.ProductPicker.GetInputElement().focus();
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -16,3 +24,4 @@ Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'objects/userentities/',
'/userentities'
);
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function userentityformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
$('#save-userentity-button').on('click', function(e)
{
@ -103,3 +111,5 @@ Grocy.FrontendHelpers.ValidateForm('userentity-form');
// Click twice to trigger on-click but not change the actual checked state
$("#show_in_sidebar_menu").click();
$("#show_in_sidebar_menu").click();
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function userfieldformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("numberpicker");
@ -118,3 +126,5 @@ if (typeof GetUriParam("entity") !== "undefined" && !GetUriParam("entity").isEmp
$("#type").trigger("change");
Grocy.FrontendHelpers.ValidateForm('userfield-form');
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -42,3 +50,5 @@ if (GetUriParam("entity") != undefined && !GetUriParam("entity").isEmpty())
$("#entity-filter").trigger("change");
$("#name").focus();
}
}

View File

@ -1,4 +1,12 @@
Grocy.Use("userfieldsform");
function userformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
Grocy.Use("userfieldsform");
function SaveUserPicture(result, jsonData)
{
@ -146,3 +154,5 @@ $("#delete-current-user-picture-button").on("click", function(e)
Grocy.Components.UserfieldsForm.Load();
Grocy.FrontendHelpers.ValidateForm('user-form');
}

View File

@ -1,4 +1,12 @@
import { WindowMessageBag } from '../helpers/messagebag';
function userobjectformView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
import { WindowMessageBag } from '../helpers/messagebag';
Grocy.Use("userfieldsform");
@ -69,3 +77,5 @@ $('#save-userobject-button').on('click', function(e)
Grocy.Components.UserfieldsForm.Load();
$("#userfields-form").removeClass("border").removeClass("border-info").removeClass("p-2").find("h2").addClass("d-none");
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -16,3 +24,4 @@ Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'objects/userobjects/',
() => window.location.reload()
);
}

View File

@ -1,3 +1,11 @@
function userpermissionsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
$('input.permission-cb').click(
function()
{
@ -71,3 +79,5 @@ if (Grocy.EditObjectId == Grocy.UserId)
}
})
}
}

View File

@ -1,4 +1,12 @@
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']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
@ -16,3 +24,4 @@ Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'users/',
'/users'
);
}

View File

@ -1,3 +1,13 @@
function usersettingsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
$("#locale").val(Grocy.UserSettings.locale);
RefreshLocaleNumberInput();
}