<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" >
    <style type="text/css" media="screen">
    	@import url(/production/css/rps_main.css?v=8);
    </style>
    <script type="text/javascript" src="/production/javascript/jquery/jquery-3.6.0.min.js"></script>
    <script type="text/javascript" src="/production/javascript/jquery/jquery-ui.min.1.13.0.js"></script>

    <script type="text/javascript" src="/production/javascript/rps_main.js?v=2"></script>

    <script type="text/javascript" src="/production/javascript/autocomplete/rsAutoCompleteNew.js"></script>
    <script type="text/javascript" src="/production/javascript/rsHTMLObject.js?v=6"></script>
    <script type="text/javascript" src="/production/javascript/rsPeriodicUpdateObject.js?v=6"></script>
    <script type="text/javascript" src="/production/javascript/rsUpdateWhenStateChanges.js?v=6"></script>

    <xsl:call-template name="bodyTitle" >
        <xsl:with-param name="title">DTMV Catalog Import Files Waiting For Import</xsl:with-param>
    </xsl:call-template>
    <xsl:call-template name="waitingFiles" />
    <xsl:call-template name="queueControl" />
    <p /><p />
</xsl:template>


<xsl:template name="waitingFiles" >
    <fieldset>
        <legend>Waiting Files For <xsl:value-of select="SelectedClient/ClientName" /></legend>
            <table class="textChart">
                <xsl:choose>
                    <xsl:when test="FileCount > 0">
                        <xsl:for-each select="WaitingFileList/File">
                            <xsl:call-template name="fileRow" />
                        </xsl:for-each>
                    </xsl:when>
                    <xsl:otherwise><td><tr>There are no waiting files</tr></td></xsl:otherwise>
                </xsl:choose>
            </table>
    </fieldset>
</xsl:template>


<xsl:template name="fileRow" >
    <tr class="row{position() mod 2}">
        <td><xsl:value-of select="." /></td>
    </tr>
</xsl:template>


<xsl:template name="queueControl" >
    <xsl:variable name="linkClientID" select="SelectedClient/ClientID" />
    <p />
    <b>Last Import Status :  </b><xsl:value-of select="ImportStatus/StatusText" /><p />
        <xsl:if test="FileCount > 0">
            <xsl:choose>
                <xsl:when test="ImportStatus/StatusType = 'done'" >
                    <a href="/support/dtmv?c=queue&amp;client={$linkClientID}">Queue An Import</a>
                </xsl:when>
                <xsl:when test="ImportStatus/StatusType = 'error'" >
                    <a href="/support/dtmv?c=queue&amp;force=1&amp;client={$linkClientID}">Retry Last Import</a>
                </xsl:when>
                <xsl:otherwise>
                    An Import is currently running
                </xsl:otherwise>
            </xsl:choose>
        </xsl:if>
</xsl:template>


</xsl:stylesheet>
