From 979fe0597063fe868191678ac2dd4c1da2b4ab2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Wed, 12 Dec 2018 08:08:05 +0100 Subject: [PATCH] Doplneno presouvani polozek --- src/app.js | 5 ++++- src/views/partials/backend/budgetDetail.ejs | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/app.js b/src/app.js index 89dcfa6..aa2f207 100644 --- a/src/app.js +++ b/src/app.js @@ -277,7 +277,9 @@ app.post ('/budget/add_item_in_group', function (req, res) { var price = req.body.price[i]; var bought = typeof req.body["bought_" + i] == 'undefined' ? false : true; - templateData.budget[group].items.push ({ + var g = typeof req.body.move_group[i] == 'undefined' ? group : req.body.move_group[i]; + + templateData.budget[g].items.push ({ name: itemName, price: price, bought: bought @@ -299,6 +301,7 @@ app.get ('/budget/detail/:id', function (req, res) { var detail = templateData.budget[req.params.id]; detail.id = req.params.id; + detail.budgetGroups = templateData.budget; app.set ('layout', false); diff --git a/src/views/partials/backend/budgetDetail.ejs b/src/views/partials/backend/budgetDetail.ejs index 04f5cfd..b8e81d9 100644 --- a/src/views/partials/backend/budgetDetail.ejs +++ b/src/views/partials/backend/budgetDetail.ejs @@ -5,6 +5,9 @@ Koupeno Jméno Cena + <% if (budgetGroups.length > 1) { %> + Přesunout + <% } %> @@ -32,6 +35,20 @@ + <% if (budgetGroups.length > 1) { %> + + + + + <% } %> +