]> git.plutz.net Git - confetti/commitdiff
styling for iban assignment master
authorPaul Hänsch <paul@plutz.net>
Sat, 20 Apr 2024 19:32:56 +0000 (21:32 +0200)
committerPaul Hänsch <paul@plutz.net>
Sat, 20 Apr 2024 19:32:56 +0000 (21:32 +0200)
ledgers/iban_assign.awk
ledgers/index.cgi
style.css

index eac5b445b3be06587879b36c619b9f4335ada116..68a572716be79a172e86975d561426a1b46c3153 100755 (executable)
@@ -73,8 +73,8 @@ ledger && strftime("%Y-%m-%d", $2, "UTC") == $1 {
 END {
   for (iban in sure) {
     line = "sure       " iban;
-    split(iban_uid[iban], uids, / /);
-    for (uid in uids) line = line "    " STRING(uid "/" uid_fn[uid]);
+    split(sure[iban], uids, / /);
+    for (k in uids) line = line "      " STRING(uids[k] "/" uid_fn[uids[k]]);
     print line;
   }
   for (iban in unsure) {
index 87af8b155435e09425c6c25e0004fce8a14593ed..dbf8ee892a2b3c99454ce4a8632bf93feb131a17 100755 (executable)
@@ -39,33 +39,58 @@ credit() {
     printf '[option value="%s"]' "$(HTML "$name")"
   done
   printf ']'
+  l10n_attendant="$(l10n attendant)"
   { pdi_load "${_DATA}"/vcard/*.vcf
     cat "${_DATA}"/ledgers/????-??-??\ -\ ????-??-??\ -\ ????.tbl
   } | "${_EXEC}"/ledgers/iban_assign.awk \
   | while read -r state iban data; do
     printf '[fieldset .iban .%s [legend . %s ]' \
            "$state" "$iban"
-      if [ $state = sure ]; then
+    if   [ $state = sure ]; then
+      for card in $data; do
+        uid="${card%%/*}" name="$(UNSTRING "${card#*/}")"
+        printf '[span .card . %s]' "$(HTML "${name}")"
+      done
       :
     elif [ $state = guess ]; then
       record="$(UNSTRING "${data%%     *}")"
       cards="${data#*  }"
+      date="${record%% *}"
       principal="${record#*    *       *       }" principal="${principal%%     *}"
       subject="${record#*      *       *       *       }" subject="${subject%% *}"
       amount="${record#*       *       *       *       *       }" amount="${amount%%   *}"
-      printf '[p .principal . %s][p .amount %s][p .subject . %s]' \
-             "$(UNSTRING "$principal" |HTML)" "$(credit "$amount")" "$(UNSTRING "$subject" |HTML)"
-      printf '[h4 . %s]' "$(l10n Guesses)"
-      for card in $cards; do
-        uid="${card%%/*}" name="$(UNSTRING "${card#*/}")"
-        printf '[input .card key="cardfn" value="%s" placeholder="%s" list=lattendants]' "$(HTML "${name}")" "$(l10n attendent)"
+      printf '[p .principal . %s][p .date %s][p .amount %s][p .subject . %s]' \
+             "$(UNSTRING "$principal" |HTML)" "$date" "$(credit "$amount")" "$(UNSTRING "$subject" |HTML)"
+      n=0; for card in $cards; do
+        n=$((n+1)); uid="${card%%/*}" name="$(UNSTRING "${card#*/}")"
+        cat <<-EOF
+         [input type=checkbox id="check_${iban}_$n" name="check_${iban}_$n" value=true checked=checked]
+         [input .card name="fn_${iban}_$n" value="$(HTML "$name")" disabled=disabled]
+         [label .del for="check_${iban}_$n" . -]
+       EOF
+      done
+      for m in 1 2 3 4 5 6 7 8; do
+        cat <<-EOF
+         [input type=checkbox id="check_${iban}_$((n+m))" name="check_${iban}_$((n+m))" value=false]
+         [input .card name="fn_${iban}_$((n+m))" value="" placeholder="${l10n_attendant}" list="lattendants"]
+         [label .add for="check_${iban}_$((n+m))" . +]
+       EOF
       done
     elif [ $state = unknown ]; then
+      date="${data%%   *}"
       principal="${data#*      *       *       }" principal="${principal%%     *}"
       subject="${data#*        *       *       *       }" subject="${subject%% *}"
       amount="${data#* *       *       *       *       }" amount="${amount%%   *}"
-      printf '[p .principal . %s][p .amount %s][p .subject . %s]' \
-             "$(UNSTRING "$principal" |HTML)" "$(credit "$amount")" "$(UNSTRING "$subject" |HTML)"
+      printf '[p .principal . %s][p .date %s][p .amount %s][p .subject . %s]' \
+             "$(UNSTRING "$principal" |HTML)" "$date" "$(credit "$amount")" "$(UNSTRING "$subject" |HTML)"
+      printf '[input name="check_" type=hidden][input type=hidden][label .del]'
+      n=0; for m in 1 2 3 4 5 6 7 8; do
+        cat <<-EOF
+         [input type=checkbox id="check_${iban}_$((n+m))" name="check_${iban}_$((n+m))" value=false]
+         [input .card name="fn_${iban}_$((n+m))" value="" placeholder="${l10n_attendant}" list="lattendants"]
+         [label .add for="check_${iban}_$((n+m))" . +]
+       EOF
+      done
     fi
   printf ']'
   done
index 98b839da1ffaa54f2ea1f170dfe7b3a0e246f98e..742163ba21d5ce1857d6af966e7b7a92f11091e0 100644 (file)
--- a/style.css
+++ b/style.css
@@ -368,6 +368,9 @@ body.categories form.namelist ul.namelist > li ul li {
   display: inline-block;
 }
 
+
+/* ======== Ledgers Page ======== */
+
 form.ibanassign,
 form.ledgers {
   padding: .125em 1em 0 1em;
@@ -388,12 +391,47 @@ form.ledgers {
 .ibanassign fieldset.iban p.principal {
   font-size: .875em;
 }
-.ibanassign fieldset.iban p.amount,
-.ibanassign fieldset.iban p.subject {
+.ibanassign fieldset.iban p.date,
+.ibanassign fieldset.iban p.amount {
+  font-size: .875em;
   display: inline-block;
   vertical-align: top;
+  margin-right: .75em;
+  margin-bottom: 0;
 }
 .ibanassign fieldset.iban p.amount {
   font-weight: bold;
-  margin-right: .75em;
+}
+
+.ibanassign fieldset.iban input[name^="check_"],
+.ibanassign fieldset.iban input[name^="check_"] + input,
+.ibanassign fieldset.iban input[name^="check_"] + input + label {
+  display: none;
+}
+.ibanassign fieldset.iban input[name^="check_"]:checked + input,
+.ibanassign fieldset.iban input[name^="check_"]:checked + input + label.del,
+.ibanassign fieldset.iban input[name^="check_"] + input + label.del + input + input + label.add,
+.ibanassign fieldset.iban input[name^="check_"]:checked + input + label + input + input + label.add {
+  display: inline;
+}
+.ibanassign fieldset.iban input[name^="check_"]:checked + input + label.add,
+.ibanassign fieldset.iban input[name^="check_"] + input + label.del + input:checked + input + label.add,
+.ibanassign fieldset.iban input[name^="check_"]:checked + input + label + input:checked + input + label.add {
+  display: none;
+}
+
+.ibanassign fieldset.iban input[name^="check_"] + input + label {
+  vertical-align: bottom;
+  line-height: 2.5em;
+  padding: .375em .625em;
+  border: .5pt solid;
+}
+.ibanassign fieldset.iban input[name^="check_"] + input + label.add {
+  background-color: #DFD;
+  border-radius: 2pt;
+}
+.ibanassign fieldset.iban input[name^="check_"] + input + label.del {
+  margin: 0 .5em 0 -.25em;
+  background-color: #FDD;
+  border-radius: 0 2pt 2pt 0;
 }