Various fixes and completing the HTTP interface

This commit is contained in:
Florian "flowdy" Heß
2017-01-15 22:03:06 +01:00
parent f4bcbcad6f
commit 53ef8ff175
14 changed files with 84 additions and 45 deletions

View File

@@ -7,10 +7,10 @@
% while ( my $hr = $history->next ) {
<tr><td><%= $hr->date %></td><td>
% my $this = $hr->this_credit;
<strong>On <a href="/credit/<%= $hr->credId %>"><%= <%= $this->credId %></a>:</strong> <%= $this->purpose %><br>
<strong>On <a href="/credit/<%= $hr->credId %>"><%= <%= $this->credId %></a>:</strong> <%== nl2br $this->purpose %><br>
% my $that = $hr->that_credit;
<strong>With <%= $that->account->ID %>/<a href="/credit/<%= $that->credId %>"><%= <%= $that->credId %></a>:</strong> <%= $that->purpose %><br>
<strong>Pay <%= $hr->billId %>:</strong> <%= $hr->purpose %>
</td><td class="number"><%= $hr->debit %></td><td class="number"><%= $hr->credit %></td><td><%= $hr->note %></td></tr>
<strong>With <%= $that->account->ID %>/<a href="/credit/<%= $that->credId %>"><%= <%= $that->credId %></a>:</strong> <%== nl2br $that->purpose %><br>
<strong>Pay <%= $hr->billId %>:</strong> <%== nl2br $hr->purpose %>
</td><td class="number"><%== money $hr->debit %></td><td class="number"><%== money $hr->credit %></td><td><%= $hr->note %></td></tr>
% }
</table>

View File

@@ -16,22 +16,23 @@
% }
% my $u = $account->ID;
<tr><th><%= $u %></th>
<td class="even_until"><%= $bal->even_until // "never" %></td><td class="number"><%= $bal->arrears %></td><td><a href="<%= $u %>/debits">list</td><td><a href="<%= $u %>/out">add</a></td>
<td class="even_until"><%= $bal->even_until // "never" %></td><td class="number"><%== money $bal->arrears %></td><td><a href="<%= $u %>/debits">list</td><td><a href="<%= $u %>/out">add</a></td>
<td class="centered">
% my $which = ($bal->arrears && 1) + ($bal->available && 1);
% if ( $which == 2 ) {
<a class="transfer-btn" href="<%= $u %>/transfer">C&hArr;D!</a>
% }
% elsif ( $which ) {
<span style="background-color:rgba(224,224,0,0.4);">N/A</span>
<span style="background-color:rgba(224,224,0,0.4);">&nbsp;N/A&nbsp;</span>
% }
% else {
<span style="background-color:rgba(0,224,0,0.4);">N/A</span>
<span style="background-color:rgba(0,224,0,0.4);">&nbsp;N/A&nbsp;</span>
% }
</td><td class="number"><%= $bal->available %></td><td><a href="<%= $u %>/credits">list</a></td><td><a href="<%= $u %>/in">add</a></td><td class="number"><%= $bal->earned %></td><td class="number"><%= $bal->promised %></td><td><a href="<%= $u %>/history">History</a></td><td><a href="<%= $u %>/report">Report</a></td></tr>
</td><td class="number"><%== money $bal->available %></td><td><a href="<%= $u %>/credits">list</a></td><td><a href="<%= $u %>/in">add</a></td><td class="number"><%== money $bal->earned %></td><td class="number"><%== money $bal->promised %></td><td><a href="<%= $u %>/history">History</a></td><td><a href="<%= $u %>/report">Report</a></td></tr>
% } # while
</table>
<p style="text-align:center;"><a href="/bankStatement">Reconstructed bank statement</a></p>
<div class="help">
<h2>Column explanation</h2>
<dl>

View File

@@ -0,0 +1,8 @@
% title 'Account report';
<table>
<tr><th>Date</th><th>Value</th><th>Purpose</th></tr>
% while ( my $record = $report->next ) {
<tr><td><%= $record->date %></td><td class="number"><%== money $record->value %></td><td><%== nl2br $record->purpose %></td></tr>
% }
</table>

View File

@@ -1,4 +1,4 @@
% title 'Make transfers';
% title 'Make transfers for ' . $account;
<p>Check at least one item of each table that belong together.</p>
@@ -6,34 +6,33 @@
<h2>Available credits</h2>
<p>Check credits you want to <strong>pay above debit(s)</strong> with.</p>
<p>Check credits you want to <strong>spend for the arrear(s) below</strong> with.</p>
<table>
<tr><th>S</th><th>date</th><th>purpose</th><th>to spend</th></tr>
<tr><th>?</th><th>date</th><th>purpose</th><th>to spend</th></tr>
% while ( my $d = $credits->next ) {
<tr><td><input type="checkbox" name="credits" value="<%= $d->credId %>"></td>
<td><%= $d->date %></td>
<td><%= $d->purpose %></td>
<td><%= $d->difference %></td>
<td><%== nl2br $d->purpose %></td>
<td class="number"><%== money $d->difference %></td>
</tr>
% }
</table>
<h2>Current arrears</h2>
<p>Check arrears you want to <strong>use this credit</strong> for.</p>
<p>Check arrears you want to <strong>settle with credit(s) above</strong>.</p>
<table>
<tr><th>S</th><th>date</th><th>purpose</th><th>to pay</th></tr>
<tr><th>?</th><th>date</th><th>purpose</th><th>to pay</th></tr>
% while ( my $d = $arrears->next ) {
<tr><td><input type="checkbox" name="debits" value="<%= $d->billId %>"></td>
<td><%= $d->date %></td>
<td><%= $d->purpose %></td>
<td><%= $d->difference %></td>
<td><%== nl2br $d->purpose %></td>
<td class="number"><%== money $d->difference %></td>
</tr>
% }
</table>
<p><button type="submit">Make transfers</button>
<a href="<%= url_for('home') %>">Return to account list</a></p>
</form>