{{extend 'layout.html'}}
<script>
// Display the status history in a popup window
function showPopup(msg) {
  var myWindow = window.open("", "MsgWindow", "width=500,height=200,top=100,left=250");
  var fields = msg.split(",");
  var lineout = "<h2>Status History for "+fields[0]+" Log #"+fields[1]+"</h2>"
  lineout += "<table border='1' cellpadding='5'><tr><th>Event</th><th>User</th><th>Req Date</th><th>Status Date</th></tr>"
  // Is there a 1097 status?
  if (fields[3].length > 0)
  {
      lineout += "<tr>";
      lineout += "<td>" + fields[2] + "</td>"; // event type
      lineout += "<td>" + fields[3] + "</td>"; // user
      lineout += "<td>" + fields[4] + " " + fields[5] +"</td>"; // req date-time
      lineout += "<td>" + fields[6] + " " + fields[7] +"</td>"; // status date-time
      lineout += "</tr>"
  }
  // Is there a 1098 status?
  if (fields[9].length > 0)
  {
      lineout += "<tr>";
      lineout += "<td>" + fields[8] + "</td>"; // event type
      lineout += "<td>" + fields[9] + "</td>"; // user
      lineout += "<td>" + fields[4] + " " + fields[5] +"</td>"; // req date-time
      lineout += "<td>" + fields[10] + " " + fields[11] +"</td>"; // status date-time
      lineout += "</tr>"
  }
  // Is there a 1022 status?
  if (fields[13].length > 0)
  {
      lineout += "<tr>";
      lineout += "<td>" + fields[12] + "</td>"; // event type
      lineout += "<td>" + fields[13] + "</td>"; // user
      lineout += "<td>" + fields[4] + " " + fields[5] +"</td>"; // req date-time
      lineout += "<td>" + fields[14] + " " + fields[15] +"</td>"; // status date-time
      lineout += "</tr></table>"
  }
  myWindow.document.body.innerHTML = ''; // clear any previous output
  myWindow.document.write(lineout ); //fill the window
}
</script>
<h2>
    Search Results
</h2>
<hr>
<!-- NB:  Python code within comment is STILL executed -->
Query: {{=msg}}
<br>
Number of records found: {{=count}}
<br>
{{if (count > 0):}}
<!-- 
<form action="statuslist.html" enctype="multipart/form-data" method="post">
    <input type="submit" value="show status form" />
    <button class="w2p-form-button" onclick="window.location=&#x27;/HLD/default/showhistory&#x27;;return false">show history</button><br>
    <table border="1" cellpadding="5">
        <tr>
        <th></th>
        <th>DTM<br>Area</th>
        <th>Closure ID / <br>Log No.</th>
        <th>Route &amp; Dir /<br>Type of Closure</th>
        <th>Start Date<br>End Date<br>Est. Delay</th>
        <th>Facility</th>
        <th>Limits</th>
        <th>Work<br>Description</th>
        <th>TMP</th>
        <th>Requestor/<br>Radio Call No.</th>
        </tr>
{{for hwy in highways:}}
        <tr>
        <td><INPUT type="checkbox" name="ckb1" value="{{=hwy.closureid}}"/></td>
        <td align="center">{{=hwy.closureid[0]}}</td>
        <td align="center">{{=hwy.closureid}}<BR><HR>{{=hwy.lognum}}</td>
        <td align="center">{{=hwy.route}}&nbsp;{{=hwy.direction}}<BR><HR>{{=hwy.closuretype}}</td>
        <td align="center">{{=hwy.startdate}}<BR><HR>{{=hwy.enddate}}<BR><HR>{{=hwy.estdelay}}</td>
        {{=TD(hwy.facility)}}
        <td align="center">{{=hwy.startlocation}}<BR><HR>{{=hwy.endlocation}}</td>
        {{=TD(hwy.worktype)}}
            <td align="center">{{=hwy.tmpcozeep}}<BR>{{=hwy.tmpdetour}}</td>
        {{=TD(hwy.supervisor)}}
{{pass}}
        </tr>
    </table>
    <div style="display:none;">
        <input name="_formkey" type="hidden" value="8138fabc-b5fc-4787-9f49-80e9ac931cf2" />
        <input name="_formname" type="hidden" value="default" />
    </div>
</form>
-->
{{pass}}
<HR>
<table border="1" cellpadding="5">
{{=table}}
{{for item in multiform:}}
{{=item}}
{{pass}}
</table>
<HR>
