﻿<span data-bind="visible: inprogressinstancesordered().length == 0">You do not have any requests in progress at the moment.</span>
<table data-bind="visible: inprogressinstancesordered().length > 0" style="width: 100%;">
    <tr>
        <th>Reference</th>
        <th>Assigned To</th>
        <th>Title</th>
        <th>Created By</th>
    </tr>
  <tbody data-bind="visible: inprogressinstancesordered().length != 0, template: {name: 'instanceTemplate', foreach:@ViewData["ListName"]}">
  </tbody>
</table>

<script type="text/x-jquery-tmpl" id="instanceTemplate">
    <tr class="alt-row-indicator-${GetRowClass()}">
        <td>${ReferenceNumber}</td>
        <td><span data-bind="html: viewModel.getAssignedTo(AssignedTo())"/></td>
        <td>
            {{if GetTaskDescription(WorkflowInstanceStateID())}}
                ${WorkflowFriendlyName} request ${ReferenceNumber} created by ${CreatedByName} is currently in error and must be attended to by the ${WorkflowFriendlyName} Workflow Administrator.
            {{else}}
                ${WorkflowFriendlyName} request ${ReferenceNumber} created by ${CreatedByName}
            {{/if}}
        </td>
        <td>${CreatedByName}</td>
    </tr>
</script>

<script type="text/javascript">
    var _counter = 0;
    function GetRowClass() {
        return ((_counter++) % 2) ? "even" : "odd";
    }

    function GetTaskDescription(id) {
        return (id == 4);
    }
</script>
