<?xml version="1.0" encoding="UTF-8"?>
<t:switch prioritized="true">
<html>
{
  base := base-uri() (: for searchDetails :)
}

<td t:condition="contains(., 'Ausweis gültig bis')">{$account-expiration := extract(., "[0-9./-]+")}</td>?

<t:switch prioritized="true">
<form>{$mode := @name/string()}

<TABLE>
<TR>
  <t:siblings-header>
    <TH>Fällig</TH>?
    <TH>V</TH>?
    <TH>M</TH>?
    <TH>Signatur</TH>
    <TH>Status</TH>?
    <TH>Bestell-Nr</TH>?
    <TH>Ausgabeort</TH>?
    <th/>*
  </t:siblings-header>
</TR>



<TR>
 {let $checkbox := .//input[@type="checkbox"]
  return book:= {
                 "statusId": if (exists($checkbox)) then "curious" else "critical",
                 "_internalId": $checkbox/@name/string()
                },
  if ($mode != "verl") then (
    $book.statusId := if ($mode eq "bestl") then "ordered" else "requested",
    $book.cancelable := $book._internalId != "",
    $book._func := $mode
  ) else ()
 }
 <t:siblings>
   <TD>{$book.duedate := parse-date(.)}</TD>
   <TD>{$book.renewCount}</TD>
   <TD></TD> 
   <TD>{book.id := translate(extract(., "^[^/]+"),' ',''), 
        book.shortId := extract($book.id, '[^-]*'),
        book.title := substring-after(., ":"),
        book.author := extract(., "/([^:]+)", 1)
   }</TD>
   <TD>{$book.status := inner-text()}</TD> 
   <TD>{$book.barcode}</TD>
   <TD>{$book.libraryBranch}</TD>
   <td/>
 </t:siblings>
   
<!-- <TD></TD>
 <TD><template:read var="status" source="../td[last()]/deep-text()"/></TD>
 <template:if test="$book._internalId!=''">
   <template:read var="book.status:curious" source="concat($V, '-mal verlängert, ', $status)"/>
 </template:if>
 <template:if test="empty($book._internalId)">
   <template:read var="book.status:problematic" source="concat($status, ', ', $V, '-mal verlängert')"/>
 </template:if>-->
</tr>+

</table>
</form>


<b><t:match-text regex="keine Medien"/></b>
<td><t:match-text regex="keine Medien entliehen"/></td>

</t:switch>

</html>

<html>
<title>Status</title>
<font color="red"><b>{vl:raise(.)}</b></font>
</html>

<FONT COLOR="red"><b>Ausweisnummer oder Passwort sind falsch.<t:s>vl:raise-login(.)</t:s></b></font>

</t:switch>
