<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:include href="/app/tools/support/templates/layout.xsl" />

  <xsl:template name="mainBody" >
    <xsl:call-template name="bodyTitle" >
      <xsl:with-param name="title">Orchard Sales Integration Reports</xsl:with-param>
    </xsl:call-template>

    <xsl:call-template name="displayCriteria" />

    <!-- xsl:if test="IsSubmit &gt; 0">
      <xsl:call-template name="displayResults" />
    </xsl:if-->
  </xsl:template>


  <xsl:template name="displayCriteria" >

    <xsl:if test="/Root/Error">
        <span class="error">
            <p class="warningGeneral messageBox"><xsl:value-of select="/Root/Error"/></p>
        </span>
    </xsl:if>
    <xsl:if test="Params/msg = 'delete_success'">
      <div id="body_message" style="margin-bottom: 10px; font-weight: bold; color: green">
        File '<xsl:value-of select="/Root/Params/file"/>' has been deleted.
      </div>
    </xsl:if>

    <fieldset>
    Available Report(s):
    <xsl:choose>
      <xsl:when test="count(Collection/Report) &gt; 0">
        <table style="display: block">
          <xsl:for-each select="/Root/Collection/Report">
            <tr>
              <td style="text-align:right">
                <xsl:value-of select="./name" />
              </td>
              <td>
                <a href="/support/reports?c=orchard_sales&amp;a=get&amp;file={./clean}">Download</a>
              </td>
              <td>
                <a href="/support/reports?c=orchard_sales&amp;a=del&amp;file={./clean}">Delete</a>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p>No reports found.</p>
      </xsl:otherwise>
    </xsl:choose>

    <form action="/support/reports" method="get">
      <input type="hidden" name="c" value="{/Root/Cmd}" />
      <input type="hidden" name="a" value="create" />
      <!--table>
        <tr>
          <xsl:call-template name="textField" >
            <xsl:with-param name="label">Search</xsl:with-param>
            <xsl:with-param name="name">query</xsl:with-param>
            <xsl:with-param name="value" select = "Params/query" />
          </xsl:call-template>

          <xsl:call-template name="listField" >
            <xsl:with-param name="label">Page Size</xsl:with-param>
            <xsl:with-param name="name">limit</xsl:with-param>
            <xsl:with-param name="value" select = "Params/limit" />
            <xsl:with-param name="options" >
              <option name="25">25</option>
              <option name="50">50</option>
              <option name="100">100</option>
              <option name="250">250</option>
            </xsl:with-param>
          </xsl:call-template>

          <td>
            <xsl:call-template name="submitButton" >
              <xsl:with-param name="name">submit</xsl:with-param>
              <xsl:with-param name="label">Search</xsl:with-param>
            </xsl:call-template>
          </td>
        </tr>
      </table-->

            <xsl:call-template name="submitButton" >
              <xsl:with-param name="name">XXX Generate New Report</xsl:with-param>
              <xsl:with-param name="label">Generate New Report</xsl:with-param>
            </xsl:call-template>

    </form>
    </fieldset>
  </xsl:template>

  <xsl:template name="displayResults" >

    <fieldset>

      <xsl:call-template name="collectionList" >
        <xsl:with-param name="columns" >
          <Column align="left" field="client">Client</Column>
          <Column align="left" field="client_id">Client ID</Column>
          <Column align="left" field="album_id">Album ID</Column>
          <Column align="left" field="title">Title</Column>
        </xsl:with-param>
        <xsl:with-param name="keyField">album_id</xsl:with-param>
      </xsl:call-template>

    </fieldset>
  </xsl:template>
</xsl:stylesheet>
