From bddf094ecbb9198ce97c679ceb7d8fbdc230dde8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Wed, 29 Nov 2023 22:46:58 +0100 Subject: [PATCH] document list display --- doclist.css | 52 +++++++++++++++++++++++++++++++++++++++++++ doclist.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 doclist.css create mode 100644 doclist.sh diff --git a/doclist.css b/doclist.css new file mode 100644 index 0000000..6a5d50c --- /dev/null +++ b/doclist.css @@ -0,0 +1,52 @@ +body { + text-align: center; +} + +section#open, section#sent, section#resent, +section#paid, section#cancelled { + display: block; + border-top: 1pt solid #AAF; + padding-left: 1em; + padding-right: 1em; + vertical-align: top; + text-align: left; + width: 100%; + max-width: 720pt; + margin: auto; + margin-top: 2em; +} + +section h2 { + text-align: center; +} + +section form.invoice { + display: inline-block; + width: 216pt; + background-color: #FFF; + padding: 0 .5em .375em .5em; + box-shadow: .25em .25em .5em #888; +} +section form.invoice span { + display: block; +} + +section form.invoice.new { + padding-top: .5em; +} +section form.invoice.new label[for=new_type] { + display: none; +} + +@media(min-width: 720pt) { + section#open, section#sent, section#resent { + display: inline-block; + width: 240pt; + max-width: 33%; + border-top: none; + border-left: 1pt solid #AAF; + } + section#resent { + border-right: 1pt solid #AAF; + } +} diff --git a/doclist.sh b/doclist.sh new file mode 100644 index 0000000..d31619d --- /dev/null +++ b/doclist.sh @@ -0,0 +1,64 @@ +#!/bin/sh + +printf '%s\r\n' "Content-Type: text/html; charset=utf-8" "" + +list_status() { + local status=$1 + + grep -lxF "status ${status}" "$_DATA"/*.kvd \ + | while read file; do + id="${file##*/}" id="${id%.kvd}" + DB3 open "$file" || continue + cat <<-EOF + [form .invoice method=POST + [h3 [a href="/doc/${id}" . $(DB3 get number || printf ????)]] + [span .date . $(DB3 get date || printf ????-??-??)] + [span .rcpt . $(DB3 get rcpt || printf ?)] + [span .total . $(DB3 get total || printf '?') €] + [select name=status + [option value=open $([ "$status" = open ] && printf selected=selected) . $(_ Open)] + [option value=sent $([ "$status" = sent ] && printf selected=selected) . $(_ Sent)] + [option value=resent $([ "$status" = resent ] && printf selected=selected) . $(_ Reminded)] + [option value=paid $([ "$status" = paid ] && printf selected=selected) . $(_ Paid)] + [option value=cancelled $([ "$status" = cancelled ] && printf selected=selected) . $(_ Cancelled)] + ] + [input type=hidden name=id value="$id"] + [input type=hidden name=tid value="$(transid "$file")"] + [input type=hidden name=session_key value="$SESSION_KEY"] + [button type=submit name=action value=update_invoice . $(_ Update)] + ] + EOF + done +} + +"$_EXEC/cgilite/html-sh.sed" <