Drobne upravy + pretextovani budgetu

This commit is contained in:
Michal Kváček
2018-12-11 13:13:09 +01:00
parent 7363b6f7a9
commit effafd9daa
4 changed files with 30 additions and 24 deletions
+11 -16
View File
@@ -85,28 +85,23 @@ var templateData = {
albumsCount: 0,
budget: [
{
name: "Rozlucka se svobodou",
limit: 20000,
name: "Svatební cesta",
limit: 30000,
items: [
{
name: "Polozka 1",
bought: false,
price: 1200
},
{
name: "Polozka 2",
bought: false,
price: 1200
},
{
name: "Polozka 3",
name: "Letenky",
bought: true,
price: 1200
price: 2 * 6000
},
{
name: "Polozka 4",
name: "Ubytování v hotelu",
bought: false,
price: 1200
price: 7 * 1100
},
{
name: "Ostatní výdaje",
bought: false,
price: 10000
},
]
}
+7 -3
View File
@@ -20,11 +20,15 @@ $ (document).on ('click', '.delete-button a', function () {
$ (document).on ('click', '.js-delete-button', function () {
var target = $ (this).data ('target');
var isExisting = $ (this).closest (target).hasClass('existing');
$ (this).closest (target).remove ();
var url = $ (this).data ('href');
if (typeof url != 'undefined') {
$.get (url);
if (isExisting) {
var url = $ (this).data ('href');
if (typeof url != 'undefined') {
$.get (url);
}
}
});
+11 -4
View File
@@ -1,12 +1,19 @@
<div class="heading-budget my-3 col-md-12">
<h1>Správa rozpočtu</h1>
<% if (budget.length > 0) { %>
<a href="#addItem" class="btn btn-info btn-lg" data-toggle="modal" data-target="#addItem">
Přidat položky
</a>
<a href="#addGroup" class="btn btn-info btn-lg" data-toggle="modal" data-target="#addGroup">
Upravit skupiny
Přidat výdaje
</a>
<a href="#addGroup" class="btn btn-info btn-lg" data-toggle="modal" data-target="#addGroup">
Upravit skupiny výdajů
</a>
<% } else { %>
<a href="#addGroup" class="btn btn-info btn-lg" data-toggle="modal" data-target="#addGroup">
Přidat skupinu výdajů
</a>
<% } %>
</div>
<%- include('../partials/notification.ejs', {parameter: "newGroup", notifiactionText: "Skupina úspěšně vytvořena."}) %>
@@ -25,7 +25,7 @@
<% for (var i in budget) { %>
<tr class="add-group-template draggable template-container__item existing">
<td>
<input type="text" class="form-control" name="group[<% i %>]" value="<%= budget[i].name %>">
<input type="text" class="form-control" required name="group[<% i %>]" value="<%= budget[i].name %>">
</td>
<td style="width: 25%">