mirror of
https://github.com/grocy/grocy.git
synced 2026-04-07 05:16:15 +02:00
viewjs consume: adjust specific_stock_entry
This commit is contained in:
parent
9ba66aeac2
commit
9258f4eecd
|
|
@ -257,25 +257,10 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||||
{
|
{
|
||||||
stockEntries.forEach(stockEntry =>
|
stockEntries.forEach(stockEntry =>
|
||||||
{
|
{
|
||||||
var openTxt = __t("Not opened");
|
$("#specific_stock_entry").append($("<option>", {
|
||||||
if (stockEntry.open == 1)
|
value: stockEntry.stock_id,
|
||||||
{
|
text: __t("Amount remaining: %1$s Location:%2$s", stockEntry.amount, stockEntry.location_id)
|
||||||
openTxt = __t("Opened");
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < stockEntry.amount; i++)
|
|
||||||
{
|
|
||||||
// Do this only for the first 50 entries to prevent a very long loop (is more anytime needed)?
|
|
||||||
if (i > 50)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#specific_stock_entry").append($("<option>", {
|
|
||||||
value: stockEntry.stock_id,
|
|
||||||
text: __t("Expires on %1$s; Bought on %2$s", moment(stockEntry.best_before_date).format("YYYY-MM-DD"), moment(stockEntry.purchased_date).format("YYYY-MM-DD")) + "; " + openTxt
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function(xhr)
|
function(xhr)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user