<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:template name="contractListLayout">
        <div class="section">
            <xsl:if test="count(PayorList/Payor) &gt; 1">
                <xsl:call-template name="payorSelectForm" />
            </xsl:if>
            <xsl:call-template name="listNav" />
            <xsl:choose>
                <xsl:when test="count(ArtistContract) = 0">
                    <div class="Table-empty-results">
                        <p>No contracts are available under this heading.</p>
                    </div>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:call-template name="contractListAlpha" />
                    <xsl:call-template name="listNav" />
                </xsl:otherwise>
            </xsl:choose>
        </div>
    </xsl:template>

    <xsl:template name="payorSelectForm">
        <div class="listSelect">
            <form action="/rps/contract" method="get">
                <input type="hidden" name="page" value="{Params/page}" />
                <input type="hidden" name="c" value="list" />
                Now Viewing:
                <select name="payor">
                    <option value="">All Payors</option>
                    <xsl:for-each select="PayorList/Payor">
                        <option value="{PayorID}">
                            <xsl:if test="PayorID = /Root/Params/payor">
                                <xsl:attribute name="selected">selected</xsl:attribute>
                            </xsl:if>
                            <xsl:value-of select="Name" />
                        </option>
                    </xsl:for-each>
                </select>
                <input type="submit" name="go" value="Go" />
            </form>
        </div>
    </xsl:template>

    <xsl:template name="contractListAlpha">
        <table class="Table Table-with-highlight">
            <tr class="Table-row Table-row-header">
                <th class="rowLeft">Contract Title</th>
                <th>Artist</th>
                <th>Contract ID</th>
                <th>Payor</th>
                <th>Payee</th>
                <xsl:if test="/Root/Access/rps/contract/edit = 1">
                    <th class="Table-col Table-col-icon">Edit</th>
                </xsl:if>
            </tr>
            <xsl:for-each select="ArtistContract">
                <xsl:call-template name="contractRow" />
            </xsl:for-each>
        </table>
    </xsl:template>

</xsl:stylesheet>
