Try to implement new transaction

This commit is contained in:
2021-12-02 10:43:42 +00:00
parent 4d1b883974
commit adce350e0c
3 changed files with 125 additions and 7 deletions

View File

@@ -25,7 +25,7 @@
</tr>
{{end}}
</table>
{{template "budget-new"}}
{{template "transaction-new"}}
</body>
</html>
{{end}}

44
web/transaction-new.html Normal file
View File

@@ -0,0 +1,44 @@
{{define "transaction-new"}}
<div id="newbudgetmodal" class="modal fade">
<div class="modal-dialog" role="document">
<script>
$(document).ready(function () {
$('#errorcreatingbudget').hide();
$('#newbudgetform').ajaxForm({
error: function() {
$('#errorcreatingbudget').show();
}
});
});
</script>
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">New Transaction</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<form id="newbudgetform" action="/api/v1/transaction/new" method="POST">
<div class="modal-body">
<div class="form-group">
<label for="date">Date</label>
<input type="date" name="date" class="form-control" value="{{.Now}}" />
</div>
<div class="form-group">
<label for="memo">Memo</label>
<input type="text" name="memo" class="form-control" />
</div>
<div class="form-group">
<label for="amount">Amount</label>
<input type="number" name="amount" class="form-control" placeholder="0.00" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<input type="submit" class="btn btn-primary" value="Create" class="form-control" />
</div>
</form>
</div>
</div>
</div>
{{end}}