<!--                                                                  -->
<!--  Copyright (C) 2011 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="" encoding="utf-8" />

    <xsl:template name="showCriteriaSales">
        <fieldset class="Form-fieldset Catalog-conditions-wrapper">
            <h3>Select Catalog Include</h3>
            <div class="Form-item Form-item-standart">
                <label class="Form-label">
                    <div class="Form-input-wrapper">
                        <xsl:variable name="filterOptions">
                            <map>
                                <mapEntry>
                                    <name>All Catalog</name>
                                    <value>0</value>
                                </mapEntry>
                                <mapEntry>
                                    <name>Catalog Where</name>
                                    <value>1</value>
                                </mapEntry>
                            </map>
                        </xsl:variable>
                        <xsl:call-template name="uiDropdown">
                            <xsl:with-param name="items" select="$filterOptions"/>
                            <xsl:with-param name="id" select="'Parameters_CatalogFilter'" />
                            <xsl:with-param name="name" select="'Parameters_CatalogFilter'" />
                            <xsl:with-param name="className" select="'filter'"/>
                        </xsl:call-template>
                    </div>
                </label>
            </div>
            <div class="Form-item Add-new-condition">
                <xsl:call-template name="uiButton">
                    <xsl:with-param name="id" select="'addTextLink'" />
                    <xsl:with-param name="classNAme" select="'duplicator'" />
                    <xsl:with-param name="iconLeftType" select="'add'" />
                    <xsl:with-param name="content" select="'Add Field'" />
                    <xsl:with-param name="type" select="'text-inline'" />
                    <xsl:with-param name="size" select="'large'" />
                </xsl:call-template>
            </div>
        </fieldset>

        <fieldset class="Form-fieldset Form-fieldset-line-top Source-conditions-wrapper">
            <h3>Select Sales Source Include</h3>
            <div class="Form-item Form-item-standart">
                <label class="Form-label">
                    <div class="Form-input-wrapper">
                        <xsl:variable name="salesFilterOptions">
                            <map>
                                <mapEntry>
                                    <name>All Sales</name>
                                    <value>0</value>
                                </mapEntry>
                                <mapEntry>
                                    <name>Sales Where</name>
                                    <value>1</value>
                                </mapEntry>
                            </map>
                        </xsl:variable>
                        <xsl:call-template name="uiDropdown">
                            <xsl:with-param name="items" select="$salesFilterOptions"/>
                            <xsl:with-param name="id" select="'Parameters_SourceFilter'" />
                            <xsl:with-param name="name" select="'Parameters_SourceFilter'" />
                            <xsl:with-param name="className" select="'filter'"/>
                        </xsl:call-template>
                    </div>
                </label>
            </div>
            <div class="Form-item Add-new-condition">
                <xsl:call-template name="uiButton">
                    <xsl:with-param name="id" select="'addImageLink'" />
                    <xsl:with-param name="classNAme" select="'duplicator'" />
                    <xsl:with-param name="iconLeftType" select="'add'" />
                    <xsl:with-param name="content" select="'Add Field'" />
                    <xsl:with-param name="type" select="'text-inline'" />
                    <xsl:with-param name="size" select="'large'" />
                </xsl:call-template>
            </div>
        </fieldset>

        <script>
            window.addEventListener('load', function () {
                ReportPage.salesInit();
            });
        </script>
    </xsl:template>

    <xsl:template name="criteriaSalesTemplates">
        <div id="Sales-templates" class="hidden">
            <div id="salesCatalogLine">
                <div class="Form-item Condition">
                    <div class="Form-group-horizontal Form-group-horizontal-up">
                        <div class="Form-item Form-item-standart Sales-field-name">
                            <label class="Form-label">
                                <div class="Form-input-wrapper">
                                    <xsl:variable name="fieldNameOptions">
                                        <map>
                                            <mapEntry>
                                                <name>Album Title</name>
                                                <value>album_title</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>Album Artist</name>
                                                <value>album_artist</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>Client Album ID</name>
                                                <value>client_album_id</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>Album Custom 1</name>
                                                <value>album_custom_1</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>Album Custom 2</name>
                                                <value>album_custom_2</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>Album Custom 3</name>
                                                <value>album_custom_3</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>Catalog #</name>
                                                <value>catalog_#</value>
                                            </mapEntry>
                                            <xsl:if test="Params/Type='Digital' or Params/Type='Digital And Physical'">
                                                <mapEntry>
                                                    <name>ISRC</name>
                                                    <value>isrc</value>
                                                </mapEntry>
                                            </xsl:if>
                                            <mapEntry>
                                                <name>Label Name</name>
                                                <value>label_name</value>
                                            </mapEntry>
                                            <xsl:if test="Params/Type='Digital' or Params/Type='Digital And Physical'">
                                                <mapEntry>
                                                    <name>Media Type</name>
                                                    <value>media_type</value>
                                                </mapEntry>
                                            </xsl:if>
                                            <mapEntry>
                                                <name>Product Type</name>
                                                <value>product_type</value>
                                            </mapEntry>
                                            <xsl:if test="Params/Type='Digital' or Params/Type='Digital And Physical'">
                                                <mapEntry>
                                                    <name>Product Format</name>
                                                    <value>product_format</value>
                                                </mapEntry>
                                            </xsl:if>
                                            <mapEntry>
                                                <name>Release Date</name>
                                                <value>release_date</value>
                                            </mapEntry>
                                            <xsl:if test="Params/Type='Digital' or Params/Type='Digital And Physical'">
                                                <mapEntry>
                                                    <name>Track Title</name>
                                                    <value>track_title</value>
                                                </mapEntry>
                                                <mapEntry>
                                                    <name>Track Artist</name>
                                                    <value>track_artist</value>
                                                </mapEntry>
                                                <mapEntry>
                                                    <name>Client Track ID</name>
                                                    <value>client_track_id</value>
                                                </mapEntry>
                                                <mapEntry>
                                                    <name>Track Custom 1</name>
                                                    <value>track_custom_1</value>
                                                </mapEntry>
                                                <mapEntry>
                                                    <name>Track Custom 2</name>
                                                    <value>track_custom_2</value>
                                                </mapEntry>
                                                <mapEntry>
                                                    <name>Track Custom 3</name>
                                                    <value>track_custom_3</value>
                                                </mapEntry>
                                            </xsl:if>
                                            <mapEntry>
                                                <name>UPC</name>
                                                <value>upc</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>UPC (Alt)</name>
                                                <value>upc_alt</value>
                                            </mapEntry>
                                        </map>
                                    </xsl:variable>
                                    <xsl:call-template name="uiDropdown">
                                        <xsl:with-param name="items" select="$fieldNameOptions"/>
                                        <xsl:with-param name="name" select="'Parameters_CatalogFieldList_CatalogField_{0}_Name'" />
                                        <xsl:with-param name="className" select="'fieldName'"/>
                                        <xsl:with-param name="disabled" select="'true'" />
                                    </xsl:call-template>
                                </div>
                            </label>
                        </div>
                        <div class="Form-item Sales-field-operator">
                            <label class="Form-label">
                                <div class="Form-input-wrapper">
                                    <xsl:call-template name="uiDropdown">
                                        <xsl:with-param name="name" select="'Parameters_CatalogFieldList_CatalogField_{0}_Op'" />
                                        <xsl:with-param name="disabled" select="'true'" />
                                    </xsl:call-template>
                                </div>
                            </label>
                        </div>
                        <div class="Form-item Form-item-standart Sales-field-value">
                            <label class="Form-label">
                                <div class="Form-input-wrapper">
                                    <input name="Parameters_CatalogFieldList_CatalogField_{{0}}_Value" class="fieldValue Input Form-input" disabled="disabled" />
                                </div>
                            </label>
                        </div>
                        <div class="Form-item Form-item-icon Sales-delete-condition">
                            <a class="js-tooltip delete" href="javascript:void(0)" title="Remove">
                                <xsl:call-template name="icon">
                                    <xsl:with-param name="type" select="'delete'" />
                                    <xsl:with-param name="role" select="'action'" />
                                </xsl:call-template>
                            </a>
                        </div>
                    </div>
                </div>
            </div>
            <div id="salesSourceLine">
                <div class="Form-item Condition">
                    <div class="Form-group-horizontal Form-group-horizontal-up">
                        <div class="Form-item Form-item-standart Sales-field-name">
                            <label class="Form-label">
                                <div class="Form-input-wrapper">
                                    <xsl:variable name="salesFieldNameOptions">
                                        <map>
                                            <mapEntry>
                                                <name>Currency Code</name>
                                                <value>currency_code</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>Distributor</name>
                                                <value>distributor</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>Service Name</name>
                                                <value>service_name</value>
                                            </mapEntry>
                                            <mapEntry>
                                                <name>Territory</name>
                                                <value>territory</value>
                                            </mapEntry>
                                        </map>
                                    </xsl:variable>
                                    <xsl:call-template name="uiDropdown">
                                        <xsl:with-param name="items" select="$salesFieldNameOptions"/>
                                        <xsl:with-param name="name" select="'Parameters_SourceFieldList_SourceField_{0}_Name'" />
                                        <xsl:with-param name="className" select="'fieldName'"/>
                                        <xsl:with-param name="disabled" select="'true'" />
                                    </xsl:call-template>
                                </div>
                            </label>
                        </div>
                        <div class="Form-item Sales-field-operator">
                            <label class="Form-label">
                                <div class="Form-input-wrapper">
                                    <xsl:call-template name="uiDropdown">
                                        <xsl:with-param name="name" select="'Parameters_SourceFieldList_SourceField_{0}_Op'" />
                                        <xsl:with-param name="disabled" select="'true'" />
                                    </xsl:call-template>
                                </div>
                            </label>
                        </div>
                        <div class="Form-item Form-item-standart Sales-field-value">
                            <label class="Form-label">
                                <div class="Form-input-wrapper">
                                    <input name="Parameters_SourceFieldList_SourceField_{{0}}_Value" class="fieldValue Input Form-input" disabled="disabled" />
                                </div>
                            </label>
                        </div>
                        <div class="Form-item Form-item-icon Sales-delete-condition">
                            <a class="js-tooltip delete" href="javascript:void(0)" title="Remove">
                                <xsl:call-template name="icon">
                                    <xsl:with-param name="type" select="'delete'" />
                                    <xsl:with-param name="role" select="'action'" />
                                </xsl:call-template>
                            </a>
                        </div>
                    </div>
                </div>
            </div>

            <select id="standartOperator">
                <option value="equal">Is</option>
                <option value="not_equal">Is Not</option>
            </select>
            <select id="releaseDateOperator">
                <option value="equal">Is</option>
                <option value="before">On or Before</option>
                <option value="after">On or After</option>
            </select>

            <div id="templateTextBox">
                <input class="fieldValue Input Form-input" />
            </div>
            <div id="templateMediaSelect">
                <select class="fieldValue">
                    <option value="Audio">Audio</option>
                    <option value="Video">Video</option>
                </select>
            </div>
            <div id="templateProductTypeSelect">
                <select class="fieldValue">
                    <xsl:if test="Params/Type = 'Digital' or Params/Type = 'Digital And Physical'">
                        <option value="DA">Digital Album</option>
                        <option value="DT">Digital Track</option>
                    </xsl:if>
                    <xsl:if test="Params/Type = 'Physical' or Params/Type = 'Digital And Physical'">
                        <option value="LP">LP</option>
                        <option value="CD">CD</option>
                        <option value="VHS">VHS</option>
                        <option value="CASS">Cassette</option>
                        <option value="EP">EP</option>
                        <option value="DVD">DVD</option>
                        <option value="CD2">Double CD</option>
                        <option value="CD5">CD single</option>
                        <option value="DVDCD">DVD/CD set</option>
                        <option value="CAS5">Cassette single</option>
                        <option value="LP5">LP5</option>
                        <option value="BD">Blu-ray Disc</option>
                    </xsl:if>
                </select>
            </div>
            <div id="templateProductFormatSelect">
                <select class="fieldValue">
                    <option value="Download">Download</option>
                    <option value="Premium download">Premium download</option>
                    <option value="Download upgrade">Download upgrade</option>
                    <option value="Stream">Stream</option>
                    <option value="Tethered">Tethered download</option>
                    <option value="Ringtone">Ringtone</option>
                    <option value="Jukebox">Jukebox</option>
                    <option value="Dual download">Dual download</option>
                    <option value="Background music">Background music</option>
                    <option value="Variable price download">Variable price download</option>
                    <option value="Ringback">Ringback</option>
                    <option value="PI (All)">PI (All)</option>
                    <xsl:if test="/Root/Client/OrchardClient = 1">
                        <option value="Orchard Synchronization Revenue">Orchard Synchronization Revenue</option>
                    </xsl:if>
                </select>
            </div>

            <div id="templateCurrencyCodeSelect">
                <select class="fieldValue">
                    <xsl:for-each select="Form/Parameters/CurrencyFormatList/CurrencyFormat">
                        <xsl:sort select="CurrencyCode"/>
                        <option value="{CurrencyCode}">
                            <xsl:value-of select="CurrencyCode"/> -
                            <xsl:value-of select="Description"/>
                        </option>
                    </xsl:for-each>
                </select>
            </div>
            <div id="templateAutoComplete">
                <div class="Auto-complete-wrapper">
                    <input id="{{0}}" name="{{0}}" class="fieldValue Input Form-input" type="text" />
                    <input id="id{{0}}" type="hidden" />
                    <div id="div{{0}}" />
                </div>
            </div>

            <div id="templateCountryCodeSelect">
                <select  class="fieldValue">
                    <xsl:for-each select="Form/Parameters/CountryList/Country">
                        <xsl:sort select="CountryCode"/>
                        <option value="{CountryCode}">
                            <xsl:value-of select="CountryCode"/> -
                            <xsl:value-of select="Name"/>
                        </option>
                    </xsl:for-each>
                </select>
            </div>
        </div>
    </xsl:template>
</xsl:stylesheet>
