<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template name="forcesplitLayout">
        <xsl:choose>
            <xsl:when test="File/FileStatus = 5">
                <div class="TrackerForceSplit Tracker-edit-page-container">
                    <p><span class="FileName"><xsl:value-of select="File/OrigFileName" /></span> force split successfully!</p>
                    <p><span class="FileName"><xsl:value-of select="File/OrigFileName" /></span> is a stub for reconciliation.</p>
                    <p><span class="FileName"><xsl:value-of select="NewFile/OrigFileName" /></span>  contains the sales records.</p>
                    <p><a class="ReturnToLink" href="/app/tracker">Return to Status Tracker</a></p>
                </div>
            </xsl:when>
            <xsl:otherwise>
                <div class="TrackerForceSplit Tracker-edit-page-container">
                    <xsl:call-template name="messages" />
                    <div class="TrackerForceSplit-common-info">

                        <xsl:variable name="forceLayoutCommonInfo">
                            <map>
                                <mapEntry>
                                    <name>
                                        File Name
                                    </name>
                                    <value>
                                        <xsl:value-of select="File/OrigFileName"/>
                                    </value>
                                </mapEntry>
                                <mapEntry>
                                    <name>
                                        Service
                                    </name>
                                    <value>
                                        <xsl:value-of select="File/ServiceName" />
                                    </value>
                                </mapEntry>
                                <mapEntry>
                                    <name>
                                        Received
                                    </name>
                                    <value>
                                        <xsl:value-of select="File/DateCreatedPretty" />
                                    </value>
                                </mapEntry>
                                <mapEntry>
                                    <name>
                                        Units
                                    </name>
                                    <value>
                                        <xsl:value-of select="File/UnitsPretty" />
                                    </value>
                                </mapEntry>
                                <mapEntry>
                                    <name>
                                        Revenue
                                    </name>
                                    <value>
                                        <xsl:value-of select="File/RevenuePretty" />
                                    </value>
                                </mapEntry>
                                <mapEntry>
                                    <name>
                                        Errors
                                    </name>
                                    <value>
                                        <xsl:value-of select="File/RemainingExceptions" />
                                    </value>
                                </mapEntry>
                            </map>
                        </xsl:variable>

                        <xsl:call-template name="uiValuePair">
                            <xsl:with-param name="items" select="$forceLayoutCommonInfo" />
                        </xsl:call-template>
                    </div>
                    <span id="ERRORstreamRevenue" class="error"></span>
                    <form id="confirmBoxOpener" action="/app/tracker">
                        <fieldset class="Form-fieldset Form-fieldset-buttons">
                            <input type="hidden" name="file" value="{File/FileID}" />
                            <input type="hidden" name="formSubmit" value="1" />
                            <input type="hidden" name="c" value="forcesplit" />
                            <input type="hidden" name="page" value="{Params/page}" />

                            <xsl:call-template name="uiButton">
                                <xsl:with-param name="content" select="'Cancel'" />
                                <xsl:with-param name="type" select="'default'"/>
                                <xsl:with-param name="className" select="'Form-button'"/>
                                <xsl:with-param name="elemType" select="'button'"/>
                                <xsl:with-param name="url">
                                    <xsl:text>/app/tracker</xsl:text>
                                </xsl:with-param>
                            </xsl:call-template>

                            <xsl:call-template name="uiButton">
                                <xsl:with-param name="content">
                                    <xsl:choose>
                                        <xsl:when test="translate(File/RemainingExceptions, translate(File/RemainingExceptions,'0123456789', ''), '') > 0">
                                            Force Split File
                                        </xsl:when>
                                        <xsl:otherwise>
                                            Force Split
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </xsl:with-param>
                                <xsl:with-param name="type" select="'primary'"/>
                                <xsl:with-param name="className" select="'Form-button'"/>
                                <xsl:with-param name="elemType" select="'button'"/>
                                <xsl:with-param name="onClick">
                                    <xsl:if test="translate(File/RemainingExceptions, translate(File/RemainingExceptions,'0123456789', ''), '') > 0">
                                        toggleLayer('confirmBox'); return false;
                                    </xsl:if>
                                </xsl:with-param>
                            </xsl:call-template>

                        </fieldset>
                    </form>
                </div>

                <form id="confirmBox" action="/app/tracker">
                    <div class="Form-confirm-box Tracker-edit-page-container">
                    <input type="hidden" name="file" value="{File/FileID}" />
                    <input type="hidden" name="forceSubmit" value="1" />
                    <input type="hidden" name="c" value="forcesplit" />
                    <input type="hidden" name="page" value="{Params/page}" />
                    <p>Are you sure you want to force split <span class="FileName"><xsl:value-of select="File/OrigFileName" /></span>?</p>
                    <p>Force splitting a file divides it into 2 separate files, one containing all the records and the other being an empty stub for reconciliation purposes.</p>
                    <fieldset class="Form-fieldset Form-fieldset-buttons">

                        <xsl:call-template name="uiButton">
                            <xsl:with-param name="content" select="'Cancel'" />
                            <xsl:with-param name="type" select="'default'"/>
                            <xsl:with-param name="className" select="'Form-button'"/>
                            <xsl:with-param name="elemType" select="'button'"/>
                            <xsl:with-param name="onClick">
                                toggleLayer('confirmBox');
                            </xsl:with-param>
                        </xsl:call-template>

                        <xsl:call-template name="uiButton">
                            <xsl:with-param name="content" select="'Force Split'" />
                            <xsl:with-param name="type" select="'primary'"/>
                            <xsl:with-param name="className" select="'Form-button'"/>
                            <xsl:with-param name="elemType" select="'submit'"/>
                        </xsl:call-template>

                    </fieldset>
                    </div>
                </form>

            </xsl:otherwise>
        </xsl:choose>

    </xsl:template>
</xsl:stylesheet>
