<!--                                                                  -->
<!--  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">
    <div class="section" id="payorList">
			<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="textChart hiOn" id="resultsHeader">
	      	    <tr>
  	      	    <th class="rowLeft">Name</th>
    	      	  <th>Client Payor #</th>
								<th>Status</th>
								<th class="defaultCol">Default</th>
      	      	<th class="actionsCol">Actions</th>
		          </tr>
  		        <xsl:for-each select="Payor">
    		        <tr class="row{position() mod 2}">
      		        <td class="rowLeft">
        		        <a href="payor?PayorID={PayorID}&amp;c=show"><xsl:value-of select="Name" /></a>
          		    </td>
            		  <td>
              		  <xsl:value-of select="ClientPayorID" />
	              	</td>
									<td>
										<xsl:choose>
											<xsl:when test="Inactive = 1">Inactive</xsl:when>
											<xsl:otherwise>Active</xsl:otherwise>
										</xsl:choose>
									</td>
                  <td class="icon">
                     <xsl:if test="IsDefault = 1"><img src="/production/images/icons/office/Checkmark-(16x16).png" height="16" width="16" /></xsl:if>
                   </td>
	  	            <td>
  	  	            <a href="payor?c=edit&amp;PayorID={PayorID}">Edit</a>
  	  	            <xsl:if test="IsDefault = 0">, <a href="?c=set_default&amp;PayorID={PayorID}">Set as Default</a></xsl:if>
        	  	    </td>
          	  	</tr>
		          </xsl:for-each>
  		      </table>
    		  </xsl:if>
	    	  <xsl:call-template name="searchNav" />
	  	    <br class="superBreak" />
				</xsl:otherwise>
			</xsl:choose>
    </div>
  </xsl:template>

</xsl:stylesheet>

