﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
    <xsl:output method="xml" indent="yes"/>

    <xsl:template name="ThisWorkoutMeasuresValues">
        <xsl:param name="RepsYN" select="'N/A'"></xsl:param>
        <xsl:param name="RepsNum" select="'N/A'"></xsl:param>
        <xsl:param name="WorkoutItemID" select="'N/A'"></xsl:param>
        <xsl:param name="WorkoutExerciseID" select="'N/A'"></xsl:param>
        <xsl:param name="LevelYN" select="'N/A'"></xsl:param>
        <xsl:param name="LevelNum" select="'N/A'"></xsl:param>
        <xsl:param name="TimeYN" select="'N/A'"></xsl:param>
        <xsl:param name="TimeActValue" select="'N/A'"></xsl:param>
        <xsl:param name="DistanceYN" select="'N/A'"></xsl:param>
        <xsl:param name="DistanceActValue" select="'N/A'"></xsl:param>
        <xsl:param name="WeightYN" select="'N/A'"></xsl:param>
        <xsl:param name="WeightActValue" select="'N/A'"></xsl:param>
        <xsl:param name="CaloriesYN" select="'N/A'"></xsl:param>
        <xsl:param name="CaloriesActValue" select="'N/A'"></xsl:param>
        <xsl:param name="TemplateURL" select="'N/A'"></xsl:param>
        <xsl:param name="TimeMeasueValue" select="'N/A'"></xsl:param>
        <xsl:param name="DistanceMeasureValue" select="'N/A'"></xsl:param>
        <xsl:param name="WeightMeasureValue" select="'N/A'"></xsl:param>
        <xsl:param name="PortalItemID" select="'N/A'"></xsl:param>
        <xsl:param name="AccountID" select="'N/A'"></xsl:param>
        <xsl:param name="position" select="'N/A'"></xsl:param>
        <xsl:param name="MeasureLabelFontStyle" select="'N/A'"></xsl:param>
        <xsl:param name="MeasureEntryBoxWidth" select="'N/A'"></xsl:param>
        <xsl:param name="MeasureEntryBoxHeight" select="'N/A'"></xsl:param>
        <xsl:param name="MeasureEntryBoxFontSize" select="'N/A'"></xsl:param>

        <xsl:param name="MeasureValue">
            <xsl:choose>
                <xsl:when test="$RepsYN = 1 and $RepsNum != 0">
                    <xsl:value-of select="$RepsNum"/>
                </xsl:when>
                <xsl:when test="$LevelYN = 1 and $LevelNum != 0">
                    <xsl:value-of select="$LevelNum"/>
                </xsl:when>
                <xsl:when test="$TimeYN = 1 and $TimeActValue != 0">
                    <xsl:value-of select="$TimeActValue"/>
                </xsl:when>
                <xsl:when test="$DistanceYN = 1 and $DistanceActValue != 0">
                    <xsl:value-of select="$DistanceActValue"/>
                </xsl:when>
                <xsl:when test="$WeightYN = 1 and $WeightActValue != 0">
                    <xsl:value-of select="$WeightActValue"/>
                </xsl:when>
                <xsl:when test="$CaloriesYN = 1 and $CaloriesActValue != 0">
                    <xsl:value-of select="$CaloriesActValue"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text></xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:param>

        <xsl:param name="MeasureTextLabel">
            <xsl:choose>
                <xsl:when test="$RepsYN = 1">
                    <xsl:text>Reps</xsl:text>
                </xsl:when>
                <xsl:when test="$LevelYN = 1">
                    <xsl:text>Levels</xsl:text>
                </xsl:when>
                <xsl:when test="$TimeYN = 1">
                    <xsl:text>Seconds</xsl:text>
                </xsl:when>
                <xsl:when test="$DistanceYN = 1">
                    <xsl:value-of select="$DistanceMeasureValue"/>
                </xsl:when>
                <xsl:when test="$WeightYN = 1">
                    <xsl:value-of select="$WeightMeasureValue"/>
                </xsl:when>
                <xsl:when test="$CaloriesYN = 1">
                    <xsl:text>Cals</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text></xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:param>

        <xsl:param name="IDLabel">
            <xsl:choose>
                <xsl:when test="$RepsYN = 1">
                    <xsl:text>Reps</xsl:text>
                </xsl:when>
                <xsl:when test="$LevelYN = 1">
                    <xsl:text>Levels</xsl:text>
                </xsl:when>
                <xsl:when test="$TimeYN = 1">
                    <xsl:text>Time</xsl:text>
                </xsl:when>
                <xsl:when test="$DistanceYN = 1">
                    <xsl:text>Distance</xsl:text>
                </xsl:when>
                <xsl:when test="$WeightYN = 1">
                    <xsl:text>Weight</xsl:text>
                </xsl:when>
                <xsl:when test="$CaloriesYN = 1">
                    <xsl:text>Calories</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text></xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:param>

        <xsl:param name="FieldValue">
            <xsl:choose>
                <xsl:when test="$RepsYN = 1">
                    <xsl:text>RepsNum</xsl:text>
                </xsl:when>
                <xsl:when test="$LevelYN = 1">
                    <xsl:text>LevelNum</xsl:text>
                </xsl:when>
                <xsl:when test="$TimeYN = 1">
                    <xsl:text>TimeAct</xsl:text>
                </xsl:when>
                <xsl:when test="$DistanceYN = 1">
                    <xsl:text>DistanceAct</xsl:text>
                </xsl:when>
                <xsl:when test="$WeightYN = 1">
                    <xsl:text>WeightAct</xsl:text>
                </xsl:when>
                <xsl:when test="$CaloriesYN = 1">
                    <xsl:text>CaloriesAct</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text></xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:param>

        <xsl:param name="ImageDisplay">
            <xsl:choose>
                <xsl:when test="$RepsNum != 0 or $LevelNum != 0 or $TimeActValue != 0 or $DistanceActValue != 0 or $WeightActValue != 0 or $CaloriesActValue != 0">
                    <xsl:text>Display:inline;</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>Display:none;</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:param>

        <xsl:param name="TextBoxDisplay">
            <xsl:choose>
                <xsl:when test="$RepsNum != 0 or $LevelNum != 0 or $TimeActValue != 0 or $DistanceActValue != 0 or $WeightActValue != 0 or $CaloriesActValue != 0">
                    <xsl:text>Display:none;</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>Display:inline;</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:param>

        <table class="textRight" width="75%">
            <tr>
                <td class="textLeft verticallyMiddle" width="15%">                    
                    <input id="txt_{$WorkoutExerciseID}_{$IDLabel}" type="text" style="font-size:{$MeasureEntryBoxFontSize}px;height:{$MeasureEntryBoxHeight}px;width:{$MeasureEntryBoxWidth}px;{$TextBoxDisplay}margin-right:2px;"
                            value="{$MeasureValue}"
                            onfocus="ExerciseDetailsExpandCollapse('{$WorkoutItemID}','{$WorkoutExerciseID}', '{$PortalItemID}', 'expand','{$AccountID}');"
                            onclick="ExerciseDetailsExpandCollapse('{$WorkoutItemID}','{$WorkoutExerciseID}', '{$PortalItemID}', 'expand','{$AccountID}');"
                            onBlur="workoutTracker_UpdateWorkoutItemSetData('{$WorkoutExerciseID}','txt_{$WorkoutExerciseID}_{$IDLabel}','{$FieldValue}','{$WorkoutItemID}_WorkOut_ItemSelectDate');
                                   numberOnlyForNumbers('txt_{$WorkoutExerciseID}_{$IDLabel}');"
                            onkeypress="numberOnlyForNumbers('txt_{$WorkoutExerciseID}_{$IDLabel}');
                           workoutTracker_UpdateWorkoutItemSetDataOnEnter('{$WorkoutExerciseID}','txt_{$WorkoutExerciseID}_{$IDLabel}','{$FieldValue}','{$WorkoutItemID}_WorkOut_ItemSelectDate',event);"></input>
                </td>
                <td class="textLeft verticallyMiddle" width="5%">
                    <span id="Span_{$WorkoutExerciseID}_{$IDLabel}_Label" class="{$MeasureLabelFontStyle}">
                        <xsl:value-of select="$MeasureValue"/>
                    </span>
                </td>
                <td class="textLeft verticallyMiddle" width="20%">
                    <span class="{$MeasureLabelFontStyle} marginRight5">
                        <xsl:value-of select="$MeasureTextLabel"/>
                    </span>
                </td>
                <td class="textLeft verticallyMiddle" width="10%">
                    <img id="img_EditIcon_{$WorkoutExerciseID}_{$IDLabel}" src="{$TemplateURL}Web/Images/Ver_2_0/edit_goal.png" align="absmiddle"
                        style="{$ImageDisplay}cursor:pointer;"
                        class="verticallyMiddle"
                        onClick ='document.getElementById("Span_{$WorkoutExerciseID}_{$IDLabel}_Label").style.display = "none";
                       document.getElementById("img_EditIcon_{$WorkoutExerciseID}_{$IDLabel}").style.display="none";
                       document.getElementById("txt_{$WorkoutExerciseID}_{$IDLabel}").style.display = "inline";
                       document.getElementById("txt_{$WorkoutExerciseID}_{$IDLabel}").focus();'/>
                </td>
            </tr>
        </table>






    </xsl:template>
</xsl:stylesheet>
