Added categories and Filter widget

This commit is contained in:
Florian "flowdy" Heß
2017-01-29 15:57:34 +01:00
parent 6f19437901
commit d7db9a2eb1
23 changed files with 167 additions and 40 deletions

View File

@@ -14,3 +14,5 @@
</td><td class="number"><%== money $hr->debit %></td><td class="number"><%== money $hr->credit %></td><td><%= $hr->note %></td></tr>
% }
</table>
%= include 'filter-widget'

View File

@@ -7,7 +7,7 @@
% my $inter_header = begin
% my $group = shift;
<tr><th colspan="11"><%= $group || 'Club management accounts' %></th>
<th colspan="2"><a href="/debit?group=<%= $group %>"><img class="icon" src="/add-debit.svg" alt="Charge">all</a></th></tr>
<th colspan="2"><a href="/debit?group=<%= $group %>"><img class="icon" src="/add-debit.svg" alt="Charge"> all at once</a></th></tr>
% end
% while ( my $account = $accounts->next ) {
% my $bal = $account->balance;

View File

@@ -1,12 +1,12 @@
% title 'Make transfers for ' . $account;
<p>Check at least one item of each table that belong together.</p>
<p>Check at least one item of both tables. Make sure they correspond in regard to their purposes. <em><strong>Caution:</strong> When you do not check any items in either table, this effectively is to check all in it!</em></p>
<form method="post">
<h2>Available credits</h2>
<p>Check credits you want to <strong>spend for the arrear(s) below</strong> with.</p>
<p>Check credits you want to <strong>spend for the arrear(s) below</strong>:</p>
<table>
<tr><th>?</th><th>date</th><th>purpose</th><th>to spend</th></tr>

View File

@@ -10,3 +10,5 @@
% }
<tr><td colspan="3" style="text-align:right;">Current balance:</td><td class="number"><%== $total_debit ? money $total_debit : '' %></td><td class="number"><%== $total_credit ? money $total_credit : '' %></td>
</table>
%= include 'filter-widget'

View File

@@ -8,3 +8,5 @@
<tr><td class="number"><a href="/credit/<%= $credit->credId %>"><%= $credit->credId %></a></td><td><%= $credit->date %></td><td><%== nl2br $credit->purpose %></td><td class="number"><%== money $credit->value %></td><td class="number <%= $credit->spent < $credit->value ? "mark" : "" %>"><%== money $credit->spent %></td></tr>
% }
</table>
%= include 'filter-widget'

View File

@@ -11,6 +11,17 @@
% $r{purpose} = begin
<input id="purpose" name="purpose" style="width:100%" value="<%= $credit->purpose %>">
% end
% $r{category} = begin
% my $category = $credit->category // '';
<select id="category" name="category">
<option value="">-- Please select --</option>
% while ( my $c = $categories->next ) {
<option value="<%= $c->ID %>" <%== $category == $c->ID ? 'selected="selected"' :'' %>>
<%= $c->label %>
</option>
% }
</select>
% end
% $r{value} = begin
<input id="value" name="value" value="<%= $credit->value %>"> Cent (declare target credit with "0")
% end

View File

@@ -9,3 +9,5 @@
<tr><td><a href="/debit/<%= $debit->billId %>"><%= $debit->billId %></a></td><td><%= $debit->date %></td><td><%== nl2br $debit->purpose %></td><td class="number"><%== money $debit->value %></td><td class="number <%= $debit->paid < $debit->value ? "mark" : "" %>"><%== money $debit->paid %><td><a href="/credit/<%= $tgt->credId %>"><%= $tgt->account->ID %></a></tr>
% }
</table>
%= include 'filter-widget'

View File

@@ -14,6 +14,17 @@
% $r{purpose} = begin
<input id="purpose" name="purpose" style="width:100%" value="<%= $debit->purpose %>">
% end
% $r{category} = begin
% my $category = $debit->category // '';
<select id="category" name="category">
<option value="">-- Please select --</option>
% while ( my $c = $categories->next ) {
<option value="<%= $c->ID %>" <%== $category == $c->ID ? 'selected="selected"' :'' %>>
<%= $c->label %>
</option>
% }
</select>
% end
% $r{value} = begin
<input id="value" name="value" value="<%= $debit->value %>"> Cent
% end
@@ -42,10 +53,12 @@ oops
</optgroup>
</select>
% end
% if ( !stash 'account' ) {
% $r{debtor} = begin
% my $g = param 'group';
<input id="debtor" name="debtor" value="<%= $g ? "\@$g" : $debit->debtor %>">
% end
% }
<dl class="upsert">
% for my $f ( $debit->result_source->columns ) {

View File

@@ -39,7 +39,7 @@
% }
% if ( defined $sql ) {
<div class="targettable" id="sql">
<p>In case you are interested, this is what is executed in the database in order to process your request and to render this page. All essential logic and consistency checking is done on database level via triggers and views, so you could execute these SQL statements e.g. in the console and would get the same results. Note that, if any POST requests redirected here, SQL commands of those come first:</p>
<p>Please note that, to run the SQL commands directly in another tool, you might need to resolve the prepared statements manually. Just replace all question marks by the values listed after the colon in each line.</p>
<textarea rows="5" style="width:100%;border:1px inset lightgrey;" readonly="readonly">
%== $$sql
</textarea></div>