<!--                                                                  -->
<!--  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="payorSearchLayout">
        <xsl:call-template name="searchResults" />
        <xsl:call-template name="buttons" />
    </xsl:template>

    <xsl:template name="searchResults">
        <xsl:choose>
            <xsl:when test="not(Params/Query) and count(Payor) = 0">
                <p>No payors have been created.</p>
            </xsl:when>
            <xsl:otherwise>
                <xsl:if test="Params/Query">
                    <h2>Search Results</h2>
                </xsl:if>
                <xsl:call-template name="searchNav" />
                <xsl:call-template name="searchText" />
                <xsl:call-template name="successMessageGeneral">
                    <xsl:with-param name="successMessage">
                        <xsl:choose>
                            <xsl:when test="Messages/Message/Code = 'delete_success'">Payor successfully deleted!</xsl:when>
                            <xsl:otherwise>Payor successfully set as default!</xsl:otherwise>
                        </xsl:choose>
                    </xsl:with-param>
                </xsl:call-template>
                <xsl:if test="count(Payor) != 0">
                    <table class="Table Table-with-highlight">
                        <thead>
                            <tr class="Table-row Table-row-header">
                                <th class="Table-col">Name</th>
                                <th class="Table-col">Client Payor #</th>
                                <th class="Table-col">Status</th>
                                <th class="Table-col">Default</th>
                                <th class="Table-col">Display Logo</th>
                                <th class="Table-col">Actions</th>
                                <th class="Table-col Table-col-icon">Edit</th>
                            </tr>
                        </thead>
                        <tbody>
                            <xsl:for-each select="Payor">
                                <tr class="Table-row Table-row-data">
                                    <td class="Table-col">
                                        <a href="payor?PayorID={PayorID}&amp;c=show"><xsl:value-of select="Name" /></a>
                                    </td>
                                    <td class="Table-col">
                                        <xsl:value-of select="ClientPayorID" />
                                    </td>
                                    <td class="Table-col">
                                        <xsl:choose>
                                            <xsl:when test="Inactive = 1">Inactive</xsl:when>
                                            <xsl:otherwise>Active</xsl:otherwise>
                                        </xsl:choose>
                                    </td>
                                    <td class="Table-col">
                                        <xsl:if test="IsDefault = 1">
                                            <xsl:call-template name="icon">
                                                <xsl:with-param name="type" select="'complete'" />
                                                <xsl:with-param name="size" select="'medium'" />
                                                <xsl:with-param name="className" select="'List-default'" />
                                            </xsl:call-template>
                                        </xsl:if>
                                    </td>
                                    <td class="Table-col">
                                        <xsl:choose>
                                            <xsl:when test="ShowLogo = 1 and normalize-space(LogoSourceWeb)">
                                                <a href="javascript:showPayorLogo('{LogoSourceWeb}?v={/Root/Session}')">Yes</a>
                                            </xsl:when>
                                            <xsl:when test="ShowLogo = 1">
                                                Yes
                                            </xsl:when>                                            
                                            <xsl:otherwise>No</xsl:otherwise>
                                        </xsl:choose>
                                    </td>                                       
                                    <td class="Table-col">
                                        <xsl:if test="IsDefault = 0"><a href="?c=set_default&amp;PayorID={PayorID}">Set as Default</a></xsl:if>
                                    </td>                                 
                                    <td class="Table-col Table-col-icon">
                                        <a href="payor?c=edit&amp;PayorID={PayorID}">
                                            <xsl:call-template name="icon">
                                                <xsl:with-param name="type" select="'edit'" />
                                                <xsl:with-param name="role" select="'action'" />
                                            </xsl:call-template>
                                        </a>
                                    </td>
                                </tr>
                            </xsl:for-each>
                        </tbody>
                    </table>
                </xsl:if>
                <xsl:call-template name="searchNav" />
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

</xsl:stylesheet>
