<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn">
  <xsl:output method="html" indent="no" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML 4.01//EN" encoding="utf-8" />

  <xsl:include href="/app/tools/rps/templates/ajax_request.xsl" />
  <xsl:include href="service_list.xsl" />

  <xsl:template name="pickLayout">
  	<xsl:choose>
  		<xsl:when test="Form/ProductDigital/ProductID &gt; 0">
     		<xsl:call-template name="productShowDigitalLayout" />
     	</xsl:when>
     	<xsl:otherwise>
     		<xsl:call-template name="productDigitalNone" />
     	</xsl:otherwise>
		</xsl:choose>
  </xsl:template>


  <xsl:template name="productShowDigitalLayout">
		<xsl:call-template name="productDigitalRestrictions" />
		<br />
		<xsl:call-template name="productDigitalServices" />
  </xsl:template>

  <xsl:template name="productDigitalServices">

    <fieldset>
      <legend>Services</legend>
	    <table class="textChart" id="serviceTable">
          <tr>
            <th class="icon approvedCol">Delivery<br />Approved</th>
            <th class="retailerCol">Retailer</th>
            <th class="dateCol">Date</th>
            <th class="byCol">By</th>
            <th class="statusCol">Status</th>
            <th class="priceTierCol">Wholesale<br />Price Tier</th>
          </tr>

		    <xsl:call-template name="productDigitalServiceList" />

                <xsl:if test="//DeliveryDate != ''">
	    			<tr><td colspan="5"><br />*Services may take up to 30 days to process deliveries.</td></tr>
	    		</xsl:if>

	    </table>
		</fieldset>

        <br class="superBreak" /><br />
				<input type="button" value="Edit Settings" onClick="location.href='product?ProductID={Form/ProductDigital/ProductID}&amp;c=edit_service'" />
  </xsl:template>


  <xsl:template name="productDigitalNone">
  	<br />
		No digital products are configured for this album.
  </xsl:template>


  <xsl:template name="productDigitalRestrictions">
    <fieldset>
      <legend>Country Restrictions</legend>
	    <table class="textChart">
				<tr>
					<th></th>
					<xsl:if test="Access/rps/product/edit_digital">
						<th>Actions</th>
					</xsl:if>
				</tr>
				<tr class="row1">
					<td>
						<xsl:choose>
                          <xsl:when test="normalize-space(Form/ProductDigital/TerritoriesList)" >
  						    <xsl:choose>
							  <xsl:when test="Form/ProductDigital/TerritoriesFlag = 'A'">For Sale Only in: </xsl:when>
							  <xsl:when test="Form/ProductDigital/TerritoriesFlag = 'D'">Not Allowed For Sale in: </xsl:when>
							  <xsl:otherwise>N/A</xsl:otherwise>
						    </xsl:choose>
						    <xsl:call-template name="printTerritoryList" />
                          </xsl:when>
                          <xsl:otherwise>
                            For Sale: World Wide
                          </xsl:otherwise>
                        </xsl:choose>
					</td>
					<xsl:if test="Access/rps/product/edit_digital">
                      <td>
							<a href="product?c=edit_digital&amp;ProductID={Form/ProductDigital/ProductID}">Edit</a>
					  </td>
					</xsl:if>
	      </tr>
	    </table>
		</fieldset>
  </xsl:template>

  <xsl:template name="printTerritoryList" >
    <xsl:for-each select="Form/ProductDigital/Territories/Country" >
      <xsl:if test="position() &gt; 1">, </xsl:if>
      <xsl:value-of select="Name" />
    </xsl:for-each>
  </xsl:template>


</xsl:stylesheet>
