﻿<?xml version="1.0" encoding="UTF-8" ?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">



<xsl:import href="DDC_Trad.xsl"/>


<xsl:output method="html"
	indent="yes"
	omit-xml-declaration="yes"
	encoding="UTF-8"
	media-type="print"
	doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>

      
<xsl:template match="/">
<xsl:variable name="langueVar" select="//Header/Langue"/>
<html>

<head>
<title>
	<xsl:call-template name="afficheTrad">
			<xsl:with-param name="DA_idTrad">id0323</xsl:with-param>
			<xsl:with-param name="DA_langue" select="$langueVar"/>
	</xsl:call-template>
</title>
<LINK rel="stylesheet" type="text/css" href="../config/demande_histo.css" />
<LINK rel="stylesheet" type="text/css" href="../config/font-police.css" />
</head>

<xsl:variable name="Police">Police_<xsl:value-of select="$langueVar"/></xsl:variable>
<body id="{$Police}" >


<xsl:apply-templates select="EmailDiagDocument">
	<xsl:with-param name="langueVar" select="$langueVar"/>
</xsl:apply-templates>

<!--
<H1>DEBUG &lt;Ensemble des donnees presentes dans le fichier xml stylise&gt; </H1>
<xsl:value-of select="."/>
<H1>END DEBUG</H1>
-->

</body>

</html>
</xsl:template>


<xsl:template match="EmailDiagDocument">
	<!-- premiere partie - titre et info date/filtre.. -->
<xsl:param name="langueVar"/>

<div class="historiquePages">

<table id="titre">
	<!-- titre du document dossier historique-->
	<tr>
		<td id="imgLion">
			<img src="../pictures/image_gauche.jpg"/>
		</td>
		<td id="titre">
			<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0323</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$langueVar"/>
			</xsl:call-template>
		</td>
		<td id="imgDroite">
			<img src="../pictures/image_droite.jpg"/>
		</td>
	</tr>
</table>
	<!-- Information date, filtre, .. -->
<div>
	<xsl:call-template name="infosGen">
		<xsl:with-param name="infoPDVLangue" select="$langueVar"/>
	</xsl:call-template> 
</div>

	<!-- tableau recapitulatif des dossiers -->

<table id="tableHistorique">
	<tr>
 	  <td> 
		<!-- Statut -->
	   	<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0299</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$langueVar"/>
		</xsl:call-template>
 	  </td>
  	  <td>
		<!-- Date -->
	   	<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0300</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$langueVar"/>
		</xsl:call-template>
 	  </td>
 	  <td>
		<!-- Type -->
	   	<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0301</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$langueVar"/>
		</xsl:call-template>
 	  </td>
 	  <td>
		<!-- Type de Vehicule -->
	   	<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0137</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$langueVar"/>
		</xsl:call-template>
 	  </td>
	  <td>
		<!-- VIN -->
	   	<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0138</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$langueVar"/>
		</xsl:call-template>
	  </td>
 	  <td>
		<!-- Numero de dossier -->
	   	<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0163</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$langueVar"/>
		</xsl:call-template>
 	  </td>
	  <td>
		<!-- Nombre de complement -->
	   	<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0310</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$langueVar"/>
		</xsl:call-template>
 	  </td>
	</tr>
<xsl:apply-templates select="Body/Dossier">
	<xsl:with-param name="infoPDVLangue" select="$langueVar"/>
</xsl:apply-templates>
</table>
<!--
<H1>
nb dossier = <xsl:value-of select="$nbDossier"/>
<br/>
nb page = <xsl:value-of select="$nbPage"/>
</H1>
-->
</div>
</xsl:template>


<!-- cree la premiere partie de la page
	reference vers les informations generales filtres, dates
-->
<xsl:template name="infosGen">
	 <!-- titre du document Rapport de l'historique -->
<xsl:param name="infoPDVLangue"/>

<table id="tableFiltre">
<tr>
	<!-- Date -->
	<td>
		<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0300</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$infoPDVLangue"/>
		</xsl:call-template>
	</td>
	<!-- Valeur de la Date generation du rapport -->
	<td id="texteUtilisateur">
		<xsl:variable name="dateGeneration" select="Header/DateGeneration"/>
		<xsl:call-template name="afficheValeur">
			<xsl:with-param name="val" select="$dateGeneration"/>
		</xsl:call-template>
	</td>
	
	<!-- Point de service -->
	<td>
		<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0321</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$infoPDVLangue"/>
		</xsl:call-template>
	</td>
	<!-- valeur du point de service -->
	<td id="texteUtilisateur">
		<xsl:variable name="pointDeService" select="Header/PointDeService"/>
		<xsl:call-template name="afficheValeur">
			<xsl:with-param name="val" select="$pointDeService"/>
		</xsl:call-template>
	</td>
</tr>

<tr>
	<!-- Filtrer par -->
	<td>
		<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0305</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$infoPDVLangue"/>
		</xsl:call-template>
	</td>
	<!-- Nom du filtre des dossiers -->
	<td id="texteUtilisateur">
		<xsl:variable name="filtreName" select="Header/FilterName"/>
		<xsl:call-template name="afficheValeur">
			<xsl:with-param name="val" select="$filtreName"/>
		</xsl:call-template>
	</td>
	
	<!-- Valeur du filtre -->
	<td>
		<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0306</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$infoPDVLangue"/>
		</xsl:call-template>
	</td>
	<!-- valeur du filtre utilise pour les dossiers -->
	<td id="texteUtilisateur">
		<xsl:variable name="filtreValue" select="Header/FilterValue"/>
		<xsl:call-template name="afficheValeur">
			<xsl:with-param name="val" select="$filtreValue"/>
		</xsl:call-template>
	</td>
</tr>
</table>

</xsl:template>


<!-- cree la partie specifique historique
	recapitulatif des dossiers DA/CI
-->
<xsl:template match="Dossier">
<xsl:param name="infoPDVLangue"/>
<tr>
   <td id="tdHistorique">
	<!-- statut : gestion de l'image associee -->
	<xsl:variable name="varStatut" select="Statut"/>
	<xsl:variable name="imgSrcStatut">
		<xsl:choose>
			<xsl:when test=" $varStatut = 'TRANSMITTED' ">../pictures/Statut_ok_histo.bmp</xsl:when>
			<xsl:otherwise>../pictures/Statut_nok_histo.bmp</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	<img src="{$imgSrcStatut}"/>
   </td>
   <td id="tdHistorique">
	 <xsl:value-of select="ValidateDateTime"/>
   </td>
   <td id="tdHistorique">
	 <xsl:variable name="natureDossier" select="Nature"/>
	 <xsl:if test="$natureDossier = 'VEHICULE_NATURE'">
		<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0206</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$infoPDVLangue"/>
		</xsl:call-template>
	 </xsl:if>
	 <xsl:if test="$natureDossier = 'OUTIL_DIAG_NATURE'">
		<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0207</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$infoPDVLangue"/>
		</xsl:call-template>
	 </xsl:if>
	 <xsl:if test="$natureDossier = 'DOCUMENTATION_NATURE'">
		<xsl:call-template name="afficheTrad">
				<xsl:with-param name="DA_idTrad">id0307</xsl:with-param>
				<xsl:with-param name="DA_langue" select="$infoPDVLangue"/>
		</xsl:call-template>
	 </xsl:if>
   </td>
   <td id="tdHistorique"> 
	<xsl:value-of select="Vehicule/Type"/>
   </td>
   <td id="tdHistorique"> 
	<xsl:value-of select="Vehicule/VIN"/>
   </td>
   <td id="tdHistorique"> 
	<xsl:value-of select="TicketNumber"/>
   </td>
   <td id="tdHistorique"> 
	<xsl:value-of select="NbCI"/>
   </td>
</tr>
</xsl:template>

<xsl:template name="afficheValeur">
<xsl:param name="val">''</xsl:param>
	<xsl:choose>
		<xsl:when test="$val != ''">
			<xsl:value-of select="$val"/>
		</xsl:when>
		<xsl:otherwise>
			&#160;
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

</xsl:stylesheet>
