mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Unified product-/chore-/battery-card modal handling
This commit is contained in:
@@ -114,12 +114,6 @@ $(document).on('click', '.track-charge-cycle-button', function(e)
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on("click", ".battery-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.BatteryCard.Refresh($(e.currentTarget).attr("data-battery-id"));
|
||||
$("#batteriesoverview-batterycard-modal").modal("show");
|
||||
});
|
||||
|
||||
$(document).on('click', '.battery-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
@@ -210,12 +210,6 @@ $(document).on('click', '.track-chore-button', function(e)
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on("click", ".chore-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ChoreCard.Refresh($(e.currentTarget).attr("data-chore-id"));
|
||||
$("#choresoverview-chorecard-modal").modal("show");
|
||||
});
|
||||
|
||||
$(document).on('click', '.chore-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
@@ -24,3 +24,9 @@ Grocy.Components.BatteryCard.Refresh = function(batteryId)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
$(document).on("click", ".batterycard-trigger", function(e)
|
||||
{
|
||||
Grocy.Components.BatteryCard.Refresh($(e.currentTarget).attr("data-battery-id"));
|
||||
$("#batterycard-modal").modal("show");
|
||||
});
|
||||
|
@@ -48,3 +48,9 @@ Grocy.Components.ChoreCard.Refresh = function(choreId)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
$(document).on("click", ".chorecard-trigger", function(e)
|
||||
{
|
||||
Grocy.Components.ChoreCard.Refresh($(e.currentTarget).attr("data-chore-id"));
|
||||
$("#chorecard-modal").modal("show");
|
||||
});
|
||||
|
@@ -265,3 +265,13 @@ $("#productcard-product-description").on("hidden.bs.collapse", function()
|
||||
{
|
||||
$(".expandable-text").find("a[data-toggle='collapse']").text(__t("Show more"));
|
||||
})
|
||||
|
||||
$(document).on("click", ".productcard-trigger", function(e)
|
||||
{
|
||||
var productId = $(e.currentTarget).attr("data-product-id");
|
||||
if (productId != "")
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh(productId);
|
||||
$("#productcard-modal").modal("show");
|
||||
}
|
||||
});
|
||||
|
@@ -264,7 +264,7 @@ $(".calendar").each(function()
|
||||
|
||||
element.html('\
|
||||
<div> \
|
||||
<h5 class="text-truncate mb-1 cursor-link display-product-button ' + additionalTitleCssClasses + '" data-toggle="tooltip" title="' + __t("Display product") + '" data-product-id="' + productDetails.product.id.toString() + '">' + productDetails.product.name + '</h5> \
|
||||
<h5 class="text-truncate mb-1 cursor-link productcard-trigger ' + additionalTitleCssClasses + '" data-toggle="tooltip" title="' + __t("Display product") + '" data-product-id="' + productDetails.product.id.toString() + '">' + productDetails.product.name + '</h5> \
|
||||
<h5 class="small text-truncate mb-1"><span class="locale-number locale-number-quantity-amount">' + mealPlanEntry.product_amount + "</span> " + __n(mealPlanEntry.product_amount, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural, true) + '</h5> \
|
||||
<h5 class="small timeago-contextual text-truncate mb-1">' + fulfillmentIconHtml + " " + fulfillmentInfoHtml + '</h5> \
|
||||
' + costsAndCaloriesPerServing + ' \
|
||||
@@ -951,14 +951,6 @@ $(document).on("click", ".display-recipe-button", function(e)
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on("click", ".display-product-button", function(e)
|
||||
{
|
||||
$(".tooltip").tooltip("hide");
|
||||
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr('data-product-id'));
|
||||
$("#mealplan-productcard-modal").modal("show");
|
||||
});
|
||||
|
||||
$(document).on("click", ".mealplan-entry-done-button", function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
@@ -175,9 +175,3 @@ $("#merge-products-save-button").on("click", function(e)
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on("click", ".product-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
$("#productcard-modal").modal("show");
|
||||
});
|
||||
|
@@ -58,8 +58,6 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
|
||||
if (productId)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh(productId);
|
||||
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function(productDetails)
|
||||
{
|
||||
|
@@ -145,15 +145,6 @@ $(document).on('click', '.shoppinglist-delete-button', function(e)
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on("click", ".product-name-cell", function(e)
|
||||
{
|
||||
if ($(e.currentTarget).attr("data-product-id") != "")
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
$("#shoppinglist-productcard-modal").modal("show");
|
||||
}
|
||||
});
|
||||
|
||||
$(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() },
|
||||
|
@@ -151,12 +151,6 @@ $(document).on('click', '.product-open-button', function(e)
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on("click", ".stock-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-stock-id"));
|
||||
$("#stockentry-productcard-modal").modal("show");
|
||||
});
|
||||
|
||||
$(document).on('click', '.stockentry-grocycode-label-print', function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
@@ -337,9 +331,3 @@ function UndoStockBookingEntry(bookingId, stockRowId)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
$(document).on("click", ".product-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
$("#productcard-modal").modal("show");
|
||||
});
|
||||
|
@@ -144,9 +144,3 @@ $(document).on('click', '.product-grocycode-label-print', function(e)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on("click", ".product-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
$("#stockjournal-productcard-modal").modal("show");
|
||||
});
|
||||
|
@@ -229,12 +229,6 @@ $(document).on('click', '.product-open-button', function(e)
|
||||
);
|
||||
});
|
||||
|
||||
$(document).on("click", ".product-name-cell", function(e)
|
||||
{
|
||||
Grocy.Components.ProductCard.Refresh($(e.currentTarget).attr("data-product-id"));
|
||||
$("#stockoverview-productcard-modal").modal("show");
|
||||
});
|
||||
|
||||
function RefreshStatistics()
|
||||
{
|
||||
Grocy.Api.Get('stock',
|
||||
|
Reference in New Issue
Block a user