<?xml version="1.0" encoding="UTF-8"?>
<html>
<t:s>$bookTableBroken:=false(), $wrong-update-page := get("wrong-update-page", false())</t:s>
<t:switch-prioritized>
<body>
 <a t:condition="contains(@href, 'MEMSTAT')">{$new-update-page := @href}</a>?

 <fieldset><div class='MemStatMembCapt'>
    <template:read var="delete-current-books()"/>
    {hasShelfMark := false()}
 </div></fieldset>

 <form name="MEMISSIT" template:optional="true">
   {bookTableBroken:=true()}
   <fieldset id="issued_items">
     
     <table>
       {$noExtendingPossible:=true()}
       <thead><tr><th  class="barcode"  ></th>
                  <th   ></th> <!-- class: titleVolRef -->
                  <th  class="author"   ></th>
                  <th  class="callNumber"  >{$hasShelfMark := true()}</th>?
                  <th  class="dueDate"   ></th>
                  <th  class="numRenewals"  ></th>
                  <th  class="renew"   template:optional="true">
                    {noExtendingPossible:=false()}
                  </th></tr></thead>
                  
       <template:loop> 
       <tr>
          {book := {"statusId": "critical"}, bookTableBroken := false()}
          <th class="barcode" headers="th1_1">{$book.id}</th>
          <td headers="th1_2">
            {let $separators := (.//span[contains(@class, "ItemNotesLeader")], .//br)[1]
            return (
             book.title := if ($separators) then join($separators/preceding-sibling::node()) else .,
             book.status := if ($separators) then join($separators/following-sibling::node()) 
                            else if ($noExtendingPossible) then 'Prinzipiell keine Verlängerung möglich'
                            else ""
            )}
          </td>
          <td headers="th1_3">{$book.author}</td>
          <td t:test="$hasShelfMark">{$book.category}</td>
          <td>{$book.duedate := parse-date(.)}</td>
          <td>{$book.renewCount}</td>
          <td template:optional="true">{let $name := input/@name where $name return ($book.extendid:=$name, 
                                                                                     $book.statusId := "curious")}</td>
       </tr>
       </template:loop>
     </table>

     <input type="hidden" name="mid">{$mid := @value}</input>
  </fieldset>
 </form>
 
 
   <fieldset id="reserved_items_flds" template:optional="true">
     {cancelForm := form(ancestor::form[1], {"": {"kind": "submit"}}), hasShelfMark:=false(), hasDelete := false()}
     <table>
       
       <thead><tr> 
          <th class="barcode"></th>
          <th></th>
          <th class="author"></th>
          <th class="callNumber">{$hasShelfMark := true()}</th>?
          <th class="reserveDate"></th>
          <th class="delete">{$hasDelete := true()}</th>?
      </tr></thead>
                  
       <template:loop>
       <tr>
          {book := {"statusId": "ordered", "cancelable": false()}}
          <td headers='th7_2'>{$book.id}</td>
          <td>{$book.title}</td>
          <td>{$book.author}</td>
          <td t:test="$hasShelfMark">{$book.category}</td>
          <td>{$book.issueDate := parse-date(.)}</td>
          <td t:test="$hasDelete"><input type="checkbox">{
            book.cancelId := uri-combine(., ()),
            book.cancelable := true()
          }</input></td>
       </tr>

       </template:loop>
     </table>

     <input type="hidden" name="mid">{$mid:=@value}</input>?
  </fieldset>
</body>


<form>
  <template:meta default-text-matching="regex"/>
  Systemmeldung|System Nachricht|Exception Message
  <p>Ihre Anforderung konnte|Your process</p>
  <blockquote>
    <ul>{
     string() ! (if (matches(., "Ungültige Benutzernummer|Invalid user number")) then vl:raise-login(.)
     else vl:raise(.))
    }</ul>
  </blockquote>
</form>

<head><title>Log out redirect</title>{$session-lost := true}</head>

<a t:condition="not($wrong-update-page) and contains(@href, 'MEMSTAT')">{$update-page := @href, $wrong-update-page := true()}</a>

</t:switch-prioritized>

<template:if test="$bookTableBroken">
  <BOOKTABLEBROKEN>
  Probably site layout changed!
  </BOOKTABLEBROKEN>
</template:if>
</html>
