<!--                                                                  -->
<!--  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="payeeMainLayout">
        <div id="artistPayeeMain">
            <div class="twoSections">
                <xsl:call-template name="addSection" />
                <xsl:call-template name="viewSection" />
            </div>
            <xsl:call-template name="searchSection" />
            <xsl:call-template name="recentList" />
        </div>
    </xsl:template>

    <xsl:template name="addSection">
        <div class="sectionLeft landingAdd">
            <div class="landingWrapper">
                <h2>Add Publisher/Payee</h2>
                <table>
                    <tr>
                        <td>
                            <a href="/rps/publisher?c=edit" title="Add New Publisher"><img src="/production/images/icons/office/Add-(16x16).gif" /></a> <a href="/rps/publisher?c=edit">Add New Publisher</a>
                            <br /><br />
                            <a href="/rps/artist_payee?c=edit" title="Add New Artist/Producer Payee"><img src="/production/images/icons/office/Add-(16x16).gif" /></a> <a href="/rps/artist_payee?c=edit">Add New Artist/Producer Payee</a>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </xsl:template>

    <xsl:template name="viewSection">
        <div class="sectionRight landingView">
            <div class="landingWrapper">
                <h2>View Publisher/Payee</h2>
                <ul>
                    <li>For Music Works:
                        <ul>
                            <li><a href="/rps/publisher?c=list">All Publishers</a></li>
                            <li><a href="/rps/publisher?c=list&amp;filter=direct">Direct Publishers</a></li>
                            <li><a href="/rps/publisher?c=list&amp;filter=hasAdmin">Publishers with Admin Only</a></li>
                            <li><a href="/rps/publisher?c=list&amp;filter=hasAgent">Publishers with Agent</a></li>
                            <li><a href="/rps/publisher?c=list&amp;filter=admin">Administrators</a></li>
                            <li><a href="/rps/publisher?c=list&amp;filter=agent">Agents</a></li>
                        </ul>
                    </li>
                    <li>For Sound Recordings:
                        <ul>
                            <li><a href="/rps/artist_payee?c=list">Artist/Producer Payees</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </xsl:template>

    <xsl:template name="searchSection">
        <div class="section landingSearch">
            <table>
                <tr>
                    <td>
                        <form action="/rps/publisher" method="get" name="payeeLandingSearch" id="payeeLandingSearch">
                            <input type="hidden" name="c" value="search" />
                            <label for="payeeSearch">Search: </label>
                            <select name="searchType" onChange="updateSearchAction('payeeLandingSearch',this.value)">
                                <option value="publisher">Publishers</option>
                                <option value="artist_payee">Artist/Producer</option>
                            </select>
                            <input type="text" name="Query" id="payeeSearch" class="searchField" />
                            <input type="submit" name="go" value="Go" />
                            <br />
                            <span class="subtle">Search by publisher or artist/producer payee name.</span>
                        </form>
                    </td>
                </tr>
            </table>
        </div>
    </xsl:template>

    <xsl:template name="recentList">
        <div class="section">
            <h2>Most Recently Accessed Payees</h2>
            <xsl:if test="RecentlyViewed/Item">
                <table class="textChart hiOn">
                    <tr>
                        <th class="rowLeft">Name</th>
                        <th>Type</th>
                        <th>Client Account #</th>
                        <th class="editCol">Edit</th>
                    </tr>
                    <xsl:for-each select="RecentlyViewed/Item">
                        <tr class="row{position() mod 2}">
                            <td class="rowLeft">
                                <xsl:if test="ArtistPayee">
                                    <a href="/rps/artist_payee?c=show&amp;ArtistPayeeID={ArtistPayee/ArtistPayeeID}"><xsl:value-of select="ArtistPayee/Name" /></a>
                                </xsl:if>
                                <xsl:if test="Publisher">
                                    <a href="/rps/publisher?c=show&amp;PublisherID={Publisher/PublisherID}"><xsl:value-of select="Publisher/PublisherName" /></a>
                                </xsl:if>
                            </td>
                            <td>
                                <xsl:choose>
                                    <xsl:when test="Publisher">
                                        <xsl:choose>
                                            <xsl:when test="Publisher/IsAgency = 1">Agency</xsl:when>
                                            <xsl:when test="Publisher/IsAdmin = 1">Administrator</xsl:when>
                                            <xsl:otherwise>Publisher</xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:when>
                                    <xsl:otherwise>Artist/Producer</xsl:otherwise>
                                </xsl:choose>
                            </td>
                            <td><xsl:value-of select="ArtistPayee/ClientAccountID" /><xsl:value-of select="Publisher/ClientAccountID" /></td>
                            <td class="icon">
                                <a title="Edit">
                                    <xsl:attribute name="href">
                                        <xsl:if test="ArtistPayee">/rps/artist_payee?c=edit&amp;ArtistPayeeID=<xsl:value-of select="ArtistPayee/ArtistPayeeID" /></xsl:if>
                                        <xsl:if test="Publisher">/rps/publisher?c=edit&amp;PublisherID=<xsl:value-of select="Publisher/PublisherID" /></xsl:if>
                                    </xsl:attribute>
                                    <img src="/production/images/icons/office/Edit-(16x16).gif" />
                                </a>
                            </td>
                        </tr>
                    </xsl:for-each>
                </table>
            </xsl:if>
            <xsl:if test="not(RecentlyViewed/Item)">
                <p>No payees exist in your viewing history.</p>
            </xsl:if>
        </div>
    </xsl:template>

</xsl:stylesheet>
