From 586b58498d1c4d2998dddea34492c110f99455ae Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 20 Jan 2025 11:54:09 +0100
Subject: [PATCH] For Booking view, use '/{Booking.id_}' rather than
 '?idx={Booking.id_}'.

---
 ledger.py            | 2 +-
 templates/index.tmpl | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ledger.py b/ledger.py
index 746d8a3..eee9c5d 100755
--- a/ledger.py
+++ b/ledger.py
@@ -76,7 +76,7 @@ class Handler(PlomHttpHandler):
     def do_GET(self) -> None:
         # pylint: disable=invalid-name,missing-function-docstring
         if self.pagename == 'booking':
-            b = self.server.bookings[int(self.params.first('idx'))]
+            b = self.server.bookings[int(self.path_toks[2])]
             dat_lines = self.server.dat_lines[b.idx_start:b.idx_end]
             self.send_rendered(Path('index.tmpl'), {'dat_lines': dat_lines})
         elif self.pagename == 'raw':
diff --git a/templates/index.tmpl b/templates/index.tmpl
index ca1e096..bf83499 100644
--- a/templates/index.tmpl
+++ b/templates/index.tmpl
@@ -22,7 +22,7 @@ td.curr { text-align: center; }
   {% if l.type == "value" %}
     <td class="amt">{{l.amt}}</td><td class="curr">{{l.curr|truncate(4,true,"…")}}</td><td>{{l.acc}}</td>
   {% elif l.type == "intro" %}
-    <td class="code" colspan=3><a href="booking?idx={{l.booking.id_}}">{{l.code}}</a></td>
+    <td class="code" colspan=3><a href="/booking/{{l.booking.id_}}">{{l.code}}</a></td>
   {% else %}
     <td colspan=3>{{l.code}}</td>
   {% endif %}
-- 
2.30.2