return (self.booking_line.booking.is_questionable if self.booking_line
else False)
- @property
- def is_empty(self) -> bool:
- """Return if both .code and .comment are empty."""
- return not bool(self.code or self.comment)
-
@property
def raw_nbsp(self) -> str:
"""Return .raw but ensure whitespace as , and at least one."""
if action == 'move':
id_ = self.server.move_booking(id_, dir_ == 'up')
return Path(self.path).joinpath(f'#{id_}')
- elif action == 'copy':
- id_ = self.server.copy_booking(id_, dir_ == 'to_end')
- return Path(EDIT_STRUCT).joinpath(f'{id_}')
+ id_ = self.server.copy_booking(id_, dir_ == 'to_end')
+ return Path(EDIT_STRUCT).joinpath(f'{id_}')
def do_GET(self) -> None:
""""Route GET requests to respective handlers."""
def get_ledger(self, ctx: dict[str, Any], raw: bool) -> None:
"""Display ledger of all Bookings."""
- ctx['dat_lines'] = [dl for dl in self.server.dat_lines
- if raw or not dl.is_empty]
+ ctx['dat_lines'] = self.server.dat_lines
self._send_rendered(LEDGER_RAW if raw else LEDGER_STRUCT, ctx)
<form action="/ledger_{% if raw %}raw{% else %}structured{% endif %}" method="POST">
<table class="ledger">
{% for dat_line in dat_lines %}
- {% if (not raw) and dat_line.is_intro and loop.index > 1 %}
- <tr class="alternating"><td><td colspan=4> </td></tr>
- {% endif %}
<tr class="alternating{% if dat_line.is_questionable %} warning{% endif %}">
{% if dat_line.is_intro %}
<td id="{{dat_line.booking_id}}"><a href="#{{dat_line.booking_id}}">[#]</a><input type="submit" name="ledger_move_{{dat_line.booking_id}}_up" value="^"{% if not dat_line.booking.can_move(1) %} disabled{% endif %}/></td>
{% if dat_line.is_intro %}
<td class="date {% if dat_line.error %} invalid{% endif %}" colspan=2><a href="/bookings/{{dat_line.booking_id}}">{{dat_line.booking.date}}</a></td>
<td{% if dat_line.error %} class="invalid"{% endif %}>{{dat_line.booking.target}}</td>
- {% elif not dat_line.error %}
+ <td>{{dat_line.comment}}</td>
+ {% elif dat_line.error %}
+ <td class="invalid" colspan=3>{{dat_line.code}}</td>
+ <td>{{dat_line.comment}}</td>
+ {% elif dat_line.booking_line %}
<td class="amt">{{dat_line.booking_line.amount_short}}</td>
<td class="curr">{{dat_line.booking_line.currency|truncate(4,true,"…")}}</td>
<td>{{dat_line.booking_line.account}}</td>
+ <td>{{dat_line.comment}}</td>
{% else %}
- <td class="invalid" colspan=3>{{dat_line.code}}</td>
+ <td colspan=2></td><td colspan=2>{{dat_line.comment}} </td>
{% endif %}
- <td>{{dat_line.comment}}</td>
{% endif %}
</tr>
{% if dat_line.error and not raw %}