mirror of
https://github.com/grocy/grocy.git
synced 2025-08-28 09:01:14 +00:00
Varios small UI changes / improve UI consistency
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#batteries-table tbody').removeClass("d-none");
|
||||
batteriesTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#batteries-journal-table tbody').removeClass("d-none");
|
||||
batteriesJournalTable.columns.adjust().draw();
|
||||
|
||||
$("#battery-filter").on("change", function()
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#batteries-overview-table tbody').removeClass("d-none");
|
||||
batteriesOverviewTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -61,6 +61,7 @@ $('#battery_id').val('');
|
||||
$('#battery_id_text_input').focus();
|
||||
$('#battery_id_text_input').val('');
|
||||
$('#battery_id_text_input').trigger('change');
|
||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||
|
||||
$('#batterytracking-form input').keyup(function (event)
|
||||
|
@@ -60,6 +60,11 @@ $('#chore-form input').keydown(function(event)
|
||||
$('#name').focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('chore-form');
|
||||
|
||||
setTimeout(function()
|
||||
{
|
||||
$(".input-group-chore-period-type").trigger("change");
|
||||
}, 100);
|
||||
|
||||
$('.input-group-chore-period-type').on('change', function(e)
|
||||
{
|
||||
var periodType = $('#period_type').val();
|
||||
|
@@ -1,4 +1,4 @@
|
||||
var choresTable = $('#chores-table').DataTable({
|
||||
var choresTable = $('#chores-table').DataTable({
|
||||
'paginate': false,
|
||||
'order': [[1, 'asc']],
|
||||
'columnDefs': [
|
||||
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#chores-table tbody').removeClass("d-none");
|
||||
choresTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#chores-journal-table tbody').removeClass("d-none");
|
||||
choresJournalTable.columns.adjust().draw();
|
||||
|
||||
$("#chore-filter").on("change", function()
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#chores-overview-table tbody').removeClass("d-none");
|
||||
choresOverviewTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -58,9 +58,10 @@ $('.combobox').combobox({
|
||||
|
||||
$('#chore_id_text_input').focus();
|
||||
$('#chore_id_text_input').trigger('change');
|
||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||
|
||||
$('#choretracking-form input').keyup(function (event)
|
||||
$('#choretracking-form input').keyup(function(event)
|
||||
{
|
||||
Grocy.FrontendHelpers.ValidateForm('choretracking-form');
|
||||
});
|
||||
|
68
public/viewjs/components/locationpicker.js
Normal file
68
public/viewjs/components/locationpicker.js
Normal file
@@ -0,0 +1,68 @@
|
||||
Grocy.Components.LocationPicker = { };
|
||||
|
||||
Grocy.Components.LocationPicker.GetPicker = function()
|
||||
{
|
||||
return $('#location_id');
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.GetInputElement = function()
|
||||
{
|
||||
return $('#location_id_text_input');
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.GetValue = function()
|
||||
{
|
||||
return $('#location_id').val();
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.SetValue = function(value)
|
||||
{
|
||||
Grocy.Components.LocationPicker.GetInputElement().val(value);
|
||||
Grocy.Components.LocationPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.SetId = function(value)
|
||||
{
|
||||
Grocy.Components.LocationPicker.GetPicker().val(value);
|
||||
Grocy.Components.LocationPicker.GetPicker().data('combobox').refresh();
|
||||
Grocy.Components.LocationPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.LocationPicker.Clear = function()
|
||||
{
|
||||
Grocy.Components.LocationPicker.SetValue('');
|
||||
Grocy.Components.LocationPicker.SetId(null);
|
||||
}
|
||||
|
||||
$('.location-combobox').combobox({
|
||||
appendId: '_text_input',
|
||||
bsVersion: '4',
|
||||
clearIfNoMatch: true
|
||||
});
|
||||
|
||||
var prefillByName = Grocy.Components.LocationPicker.GetPicker().parent().data('prefill-by-name').toString();
|
||||
if (typeof prefillByName !== "undefined")
|
||||
{
|
||||
possibleOptionElement = $("#location_id option:contains('" + prefillByName + "')").first();
|
||||
|
||||
if (possibleOptionElement.length > 0)
|
||||
{
|
||||
$('#location_id').val(possibleOptionElement.val());
|
||||
$('#location_id').data('combobox').refresh();
|
||||
$('#location_id').trigger('change');
|
||||
|
||||
var nextInputElement = $(Grocy.Components.LocationPicker.GetPicker().parent().data('next-input-selector').toString());
|
||||
nextInputElement.focus();
|
||||
}
|
||||
}
|
||||
|
||||
var prefillById = Grocy.Components.LocationPicker.GetPicker().parent().data('prefill-by-id').toString();
|
||||
if (typeof prefillById !== "undefined")
|
||||
{
|
||||
$('#location_id').val(prefillById);
|
||||
$('#location_id').data('combobox').refresh();
|
||||
$('#location_id').trigger('change');
|
||||
|
||||
var nextInputElement = $(Grocy.Components.LocationPicker.GetPicker().parent().data('next-input-selector').toString());
|
||||
nextInputElement.focus();
|
||||
}
|
@@ -21,6 +21,19 @@ Grocy.Components.ProductPicker.SetValue = function(value)
|
||||
Grocy.Components.ProductPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.ProductPicker.SetId = function(value)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().val(value);
|
||||
Grocy.Components.ProductPicker.GetPicker().data('combobox').refresh();
|
||||
Grocy.Components.ProductPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.ProductPicker.Clear = function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
Grocy.Components.ProductPicker.SetId(null);
|
||||
}
|
||||
|
||||
Grocy.Components.ProductPicker.InProductAddWorkflow = function()
|
||||
{
|
||||
return typeof GetUriParam('createdproduct') !== "undefined" || typeof GetUriParam('product') !== "undefined";
|
||||
|
@@ -21,6 +21,19 @@ Grocy.Components.RecipePicker.SetValue = function(value)
|
||||
Grocy.Components.RecipePicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.RecipePicker.SetId = function(value)
|
||||
{
|
||||
Grocy.Components.RecipePicker.GetPicker().val(value);
|
||||
Grocy.Components.RecipePicker.GetPicker().data('combobox').refresh();
|
||||
Grocy.Components.RecipePicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.RecipePicker.Clear = function()
|
||||
{
|
||||
Grocy.Components.RecipePicker.SetValue('');
|
||||
Grocy.Components.RecipePicker.SetId(null);
|
||||
}
|
||||
|
||||
$('.recipe-combobox').combobox({
|
||||
appendId: '_text_input',
|
||||
bsVersion: '4',
|
||||
|
@@ -21,6 +21,19 @@ Grocy.Components.UserPicker.SetValue = function(value)
|
||||
Grocy.Components.UserPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.UserPicker.SetId = function(value)
|
||||
{
|
||||
Grocy.Components.UserPicker.GetPicker().val(value);
|
||||
Grocy.Components.UserPicker.GetPicker().data('combobox').refresh();
|
||||
Grocy.Components.UserPicker.GetInputElement().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.UserPicker.Clear = function()
|
||||
{
|
||||
Grocy.Components.UserPicker.SetValue('');
|
||||
Grocy.Components.UserPicker.SetId(null);
|
||||
}
|
||||
|
||||
$('.user-combobox').combobox({
|
||||
appendId: '_text_input',
|
||||
bsVersion: '4'
|
||||
|
@@ -42,10 +42,10 @@
|
||||
toastr.success(L('Removed #1 #2 of #3 from stock', jsonForm.amount, Pluralize(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBooking(' + result.booking_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
||||
|
||||
$('#amount').val(1);
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_RECIPES)
|
||||
{
|
||||
Grocy.Components.RecipePicker.SetValue('');
|
||||
Grocy.Components.RecipePicker.Clear();
|
||||
}
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||
@@ -103,7 +103,7 @@ $('#save-mark-as-open-button').on('click', function(e)
|
||||
toastr.success(L('Marked #1 #2 of #3 as opened', jsonForm.amount, Pluralize(jsonForm.amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural), productDetails.product.name) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoStockBooking(' + result.booking_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
||||
|
||||
$('#amount').val(1);
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||
},
|
||||
@@ -157,7 +157,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
if ((productDetails.stock_amount || 0) === 0)
|
||||
{
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
Grocy.Components.ProductPicker.Clear();
|
||||
Grocy.FrontendHelpers.ValidateForm('consume-form');
|
||||
Grocy.Components.ProductPicker.ShowCustomError(L('This product is not in stock'));
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
|
@@ -22,6 +22,7 @@
|
||||
}
|
||||
});
|
||||
$('#equipment-table tbody').removeClass("d-none");
|
||||
equipmentTable.columns.adjust().draw();
|
||||
|
||||
equipmentTable.on('select', function(e, dt, type, indexes)
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#locations-table tbody').removeClass("d-none");
|
||||
locationsTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#apikeys-table tbody').removeClass("d-none");
|
||||
apiKeysTable.columns.adjust().draw();
|
||||
|
||||
var createdApiKeyId = GetUriParam('CreatedApiKeyId');
|
||||
if (createdApiKeyId !== undefined)
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#productgroups-table tbody').removeClass("d-none");
|
||||
groupsTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#products-table tbody').removeClass("d-none");
|
||||
productsTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -20,7 +20,7 @@
|
||||
jsonData.amount = amount;
|
||||
jsonData.best_before_date = Grocy.Components.DateTimePicker.GetValue();
|
||||
jsonData.price = price;
|
||||
jsonData.location_id = jsonForm.location_id;
|
||||
jsonData.location_id = Grocy.Components.LocationPicker.GetValue();
|
||||
|
||||
Grocy.Api.Post('stock/products/' + jsonForm.product_id + '/add', jsonData,
|
||||
function(result)
|
||||
@@ -66,7 +66,7 @@
|
||||
toastr.success(successMessage);
|
||||
$('#amount').val(0);
|
||||
$('#price').val('');
|
||||
$('#location_id').val('');
|
||||
Grocy.Components.LocationPicker.Clear();
|
||||
Grocy.Components.DateTimePicker.Clear();
|
||||
Grocy.Components.ProductPicker.SetValue('');
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
@@ -101,7 +101,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
{
|
||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
|
||||
$('#price').val(productDetails.last_price);
|
||||
$('#location_id').val(productDetails.product.location_id);
|
||||
Grocy.Components.LocationPicker.SetId(productDetails.location.id);
|
||||
|
||||
if (productDetails.product.allow_partial_units_in_stock == 1)
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#quantityunits-table tbody').removeClass("d-none");
|
||||
quantityUnitsTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -84,6 +84,7 @@ var recipesPosTables = $('#recipes-pos-table').DataTable({
|
||||
}
|
||||
});
|
||||
$('#recipes-pos-table tbody').removeClass("d-none");
|
||||
recipesPosTables.columns.adjust().draw();
|
||||
|
||||
var recipesIncludesTables = $('#recipes-includes-table').DataTable({
|
||||
'paginate': false,
|
||||
@@ -106,6 +107,7 @@ var recipesIncludesTables = $('#recipes-includes-table').DataTable({
|
||||
}
|
||||
});
|
||||
$('#recipes-includes-table tbody').removeClass("d-none");
|
||||
recipesIncludesTables.columns.adjust().draw();
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('recipe-form');
|
||||
$("#name").focus();
|
||||
|
@@ -24,6 +24,7 @@
|
||||
}
|
||||
});
|
||||
$('#recipes-table tbody').removeClass("d-none");
|
||||
recipesTables.columns.adjust().draw();
|
||||
|
||||
var rowSelect = GetUriParam("row");
|
||||
if (typeof rowSelect !== "undefined")
|
||||
|
@@ -24,6 +24,7 @@
|
||||
}
|
||||
});
|
||||
$('#shoppinglist-table tbody').removeClass("d-none");
|
||||
shoppingListTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#stock-journal-table tbody').removeClass("d-none");
|
||||
stockJournalTable.columns.adjust().draw();
|
||||
|
||||
$("#product-filter").on("change", function()
|
||||
{
|
||||
|
@@ -22,6 +22,7 @@
|
||||
}
|
||||
});
|
||||
$('#stock-overview-table tbody').removeClass("d-none");
|
||||
stockOverviewTable.columns.adjust().draw();
|
||||
|
||||
$("#location-filter").on("change", function()
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#taskcategories-table tbody').removeClass("d-none");
|
||||
categoriesTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -62,4 +62,5 @@ $('#task-form input').keydown(function(event)
|
||||
});
|
||||
|
||||
$('#name').focus();
|
||||
Grocy.Components.DateTimePicker.GetInputElement().trigger('input');
|
||||
Grocy.FrontendHelpers.ValidateForm('task-form');
|
||||
|
@@ -23,6 +23,7 @@
|
||||
}
|
||||
});
|
||||
$('#tasks-table tbody').removeClass("d-none");
|
||||
tasksTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
@@ -19,6 +19,7 @@
|
||||
}
|
||||
});
|
||||
$('#users-table tbody').removeClass("d-none");
|
||||
usersTable.columns.adjust().draw();
|
||||
|
||||
$("#search").on("keyup", function()
|
||||
{
|
||||
|
Reference in New Issue
Block a user