<?xml version="1.0" encoding="ISO-8859-15"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xslc="http://xslcomponents.org/TR/WD-xslc">
	<xsl:import href="../../xslc-a.xsl"/>
	<xsl:import href="../../Common.xsl"/>
	<xsl:template match="/">
		<xsl:apply-templates select="document"/>
	</xsl:template>
	<xsl:template match="document">
		<xsl:param name="RecordCount" select="@LCS/RowCount"/>
		<xsl:call-template name="xslc:Page">
			<xsl:with-param name="DisplayTabControl">0</xsl:with-param>
			<xsl:with-param name="DisplayTabs">0</xsl:with-param>
			<xsl:with-param name="Head">
				<link rel="shortcut icon" type="image/ico" href="{$XMLC_Portal}faviconP.ico"/>
				<META HTTP-EQUIV="imagetoolbar" CONTENT="no"/>
			</xsl:with-param>
			<xsl:with-param name="Title">Planning des contacts</xsl:with-param>
			<xsl:with-param name="ActivePageName">Planning ProFid</xsl:with-param>
			<xsl:with-param name="Body">
				<form action="{/document/Aliases/bdVODLL}mProFidPlanning" name="MainForm" method="post">
					<input type="hidden" name="idcom" value="{/document/OutParams/idcom}"/>
					<input type="hidden" name="vday" value="{/document/OutParams/vday}"/>
				</form>
				<xsl:call-template name="xslc:ApplicationMessages"/>
				<xsl:apply-templates select="vPlanningS"/>
				<xsl:call-template name="xslc:PoweredBy"/>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<!---->
	<xsl:template match="vPlanningS">
		<xsl:param name="RecordCount" select="@RowCount"/>
		<xsl:variable name="vidcom" select="/document/OutParams/idcom"/>
		<xsl:variable name="mdayprev">accédez au planning du <xsl:value-of select="/document/dPlanningPrev"/>
		</xsl:variable>
		<xsl:variable name="mdaynext">accédez au planning du <xsl:value-of select="/document/dPlanningNext"/>
		</xsl:variable>
		<xsl:variable name="vDLL">
			<xsl:value-of select="/document/XMLC_Params/XMLC_ScriptName"/>/</xsl:variable>
		<xsl:variable name="vAction">
			<xsl:value-of select="/document/Aliases/bdVODLL"/>
			<xsl:value-of select="/document/XMLC_Params/XMLC_Action"/>
		</xsl:variable>
		<xsl:if test="$vDLL!=/document/Aliases/bdVODLL">
			<p align="right">Non OK, utilisez plutôt le lien suivant :<a href="{$vAction}" style="color:red">http://<xsl:value-of select="$vAction"/>
				</a>
			</p>
		</xsl:if>
		<table border="0" class="clFlatTable" width="100%">
			<tr>
				<td/>
				<td align="center" valign="middle" nowrap="">
					<select id="CBCommercial" name="CBCommercial" onchange="javascript: document.MainForm.idcom.value=getObject('CBCommercial').value; document.MainForm.submit(); return false;" style="width:205px" onkeypress="return handleKeyPress(event);">
						<option value="">
							<xsl:if test="/document/OutParams/idcom=''">Choix Vendeur</xsl:if>
						</option>
						<xsl:for-each select="/document/tCommerciauxS/tCommerciaux">
							<option value="{idcom}">
								<xsl:if test="/document/OutParams/idcom=idcom">
									<xsl:attribute name="selected"/>
								</xsl:if>
								<xsl:value-of select="cNom"/>
							</option>
						</xsl:for-each>
					</select>
				</td>
				<td/>
			</tr>
			<tr class="clRowHeader">
				<xsl:if test="/document/XMLC_Profile/XMLC_DisplayHeaderGradient = '1'">
					<xsl:attribute name="style">background-image: url('<xsl:value-of select="$XMLC_SkinPath"/>rowHeader_Gradient.gif');</xsl:attribute>
				</xsl:if>
				<td>
					<a href="{/document/Aliases/bdVODLL}mProFidPlanning?idcom={$vidcom}&amp;vday={/document/dPlanningPrev}">
						<img alt="{$mdayprev}" border="0" src="{$XMLC_PictosPath}Icons/Common/step_left.gif" title="{$mdayprev}"/>
					</a>
				</td>
				<td align="center" valign="middle" nowrap="">
					<xsl:value-of select="/document/dPlanning"/>
				</td>
				<td>
					<a href="{/document/Aliases/bdVODLL}mProFidPlanning?idcom={$vidcom}&amp;vday={/document/dPlanningNext}">
						<img alt="{$mdaynext}" border="0" src="{$XMLC_PictosPath}Icons/Common/step_right.gif" title="{$mdaynext}"/>
					</a>
				</td>
			</tr>
			<xsl:apply-templates select="vPlanning"/>
		</table>
	</xsl:template>
	<xsl:template match="vPlanning">
		<xsl:variable name="vConcession" select="Concession"/>
		<xsl:variable name="vOwner" select="idOwner"/>
		<xsl:variable name="vSite" select="Site"/>
		<xsl:variable name="vTagSite">
			<xsl:choose>
				<xsl:when test="/document/XMLC_Params/US1 = $vSite">1</xsl:when>
				<xsl:otherwise>
					<xsl:choose>
						<xsl:when test="/document/XMLC_Params/US2 = $vSite">1</xsl:when>
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="/document/XMLC_Params/US3 = $vSite">1</xsl:when>
								<xsl:otherwise>0</xsl:otherwise>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="tAuth1">
			<xsl:choose>
				<xsl:when test="/document/XMLC_Params/UserConcession = $vConcession">
					<xsl:choose>
						<xsl:when test="$vTagSite=1">1</xsl:when>
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="/document/XMLC_Params/UserSite = '#'">1</xsl:when>
								<xsl:otherwise>
									<xsl:choose>
										<xsl:when test="/document/XMLC_Params/XMLC_Supervisor = '1'">1</xsl:when>
										<xsl:otherwise>0</xsl:otherwise>
									</xsl:choose>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="tAuth2">
			<xsl:choose>
				<xsl:when test="/document/XMLC_Params/XMLC_UserID = $vOwner">1</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="tAuth">
			<xsl:choose>
				<xsl:when test="/document/XMLC_Params/XMLC_Authenticated != '0' and (/document/XMLC_Params/User_ProFid = '1')">
					<xsl:choose>
						<xsl:when test="$tAuth1='1'">1</xsl:when>
						<xsl:otherwise>
							<xsl:choose>
								<xsl:when test="$tAuth2='1'">1</xsl:when>
								<xsl:otherwise>0</xsl:otherwise>
							</xsl:choose>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="vidComAct" select="idComAct"/>
		<xsl:variable name="vidClient" select="idClient"/>
		<xsl:variable name="vRptName">
			<xsl:choose>
				<xsl:when test="CliCivilite = 5">Fiche Profid Societe</xsl:when>
				<xsl:otherwise>Fiche Profid</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="vCliPrenom" select="CliPrenom"/>
		<xsl:variable name="vCliNom" select="CliNom"/>
		<xsl:variable name="vCliVille" select="CliVille"/>
		<xsl:variable name="vCliTelDom" select="CliTelDom"/>
		<xsl:variable name="vCliMobile" select="CliMobile"/>
		<xsl:variable name="vTVer" select="aTVer"/>
		<xsl:variable name="clValue">
			<xsl:choose>
				<xsl:when test="position() mod 2 = 1">clRowLight</xsl:when>
				<xsl:otherwise>clRowDark</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="stValue">
			<xsl:choose>
				<xsl:when test="(idcom = /document/SelVendeurS/SelVendeur/idcom) "> font-style:italic; color:blue</xsl:when>
				<xsl:otherwise>font-style:italic;</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="sRowSelect">clRowSelectedS</xsl:variable>
		<tr class="{$clValue}" onmouseover="oldClass=this.className; this.className='{$sRowSelect}';" onmouseout="this.className=oldClass;">
			<td style="{$stValue}">
				<xsl:value-of select="nComAct"/>
			</td>
			<td style="{$stValue}">
				<xsl:value-of select="nClient"/>
				<br/>
				<table>
					<tr>
						<td style="padding: 1px 1px 2px 10px; font-family: Comic sans MS; font-size: 8pt; color: #606060">
							<xsl:if test="CliTelDom!=''">
								<xsl:value-of select="CliTelDom"/>
							</xsl:if>
							<xsl:if test="CliTelDom!='' and CliMobile!=''"> - </xsl:if>
							<xsl:if test="CliMobile!=''">
								<xsl:value-of select="CliMobile"/>
							</xsl:if>
							<br/>
							<xsl:value-of select="CliCP"/> - <xsl:value-of select="CliVille"/>
							<xsl:if test="CliPays!=''"> - <xsl:value-of select="CliPays"/>
							</xsl:if>
						</td>
					</tr>
				</table>
			</td>
			<td style="{$stValue}">
				<xsl:value-of select="nComAct"/>
			</td>
		</tr>
	</xsl:template>
</xsl:stylesheet>
