<?xml version="1.0"?>
<!-- edited with XML Spy v2.5 NT  - http://www.xmlspy.com -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xslc="http://xslcomponents.org/TR/WD-xslc">
	<xsl:import href="../../xslc.xsl"/>
	<xsl:import href="../../Common.xsl"/>
	<xsl:import href="../../yui-VO20130327.xsl"/>
	<xsl:template match="/">
		<xsl:apply-templates select="document"/>
	</xsl:template>
	<xsl:template match="document">
		<xsl:param name="UserR" select="/document/tResaS/tResa/idUser"/>
		<xsl:param name="UserID" select="/document/XMLC_Params/XMLC_UserID"/>
		<xsl:param name="RecordCount" select="/document/tResaS/@RowCount"/>
		<xsl:call-template name="xslc:Page">
			<xsl:with-param name="BodyAttributes">
				<Attributes onload="ResaInit(); "/>
			</xsl:with-param>
			<xsl:with-param name="Head">
				<xsl:call-template name="AutoComplete.Head"/>
				<style type="text/css">a.aopt { text-decoration:none;}
a.aoptselected { text-decoration: none; background-color: #cbdaf5}

fieldset
{
  border:1px solid #B1DBF3; 
    -moz-border-radius:4px;
    border-radius:4px;
}

.separa
    {
    border-top: 1px solid blue;
    padding-top: 5px;
    margin-top: 2px;
    }
</style>
				<script language="javascript">
					<![CDATA[   function oForm(oWidth, oHeight) {
      if (vidPaneID.style.display=='block') {
         vidPaneID.style.display='none';
//         vidPaneID.innerHTML=''; 
      } else {
         vidPaneID.style.display='block';
//         vidPaneID.style.width=oWidth;
//         vidPaneID.style.height=oHeight;
      }
   }]]>
					<![CDATA[   function ShowHideForm(vid) {
      if (vid.style.display=='block') {
         vid.style.display='none';
      } else {
         vid.style.display='block';
      }
   }
   function wReload(hRef) {
      parent.document.location = hRef;
   }]]>
				</script>
				<script language="javascript">
					<![CDATA[function clickSel(item) {
  var apos = getObject('idValue').value;
  var aopt = getObject('idSel').value;
  var abbr = tOpts[parseInt(item)+1];

  var sval=getObject('nv'+aopt+apos).innerHTML;
  var memval = sval.toUpperCase();
  if (memval.indexOf(';'+abbr+';') ==-1) {
    sval=sval+';'+abbr+';'
    sval=sval.replace(';;', ';')}
  if (memval.indexOf(';'+abbr+';') !=-1) {
    sval=memval.replace(';'+abbr+';', ';')}
  if (sval==';') {
    sval='' }
  getObject('nv'+aopt+apos).innerHTML=sval;
  optSelect(apos);
  setCommand();
 }
]]>
				</script>
				<script language="javascript">
					<![CDATA[function selSelect(item)
 {
  if (item=='Rec') {
    zSel.style.display='none';
    zRec.style.display='block';
    SelSel.className='opt';
    SelRec.className='optRowSelected';
  }
  if (item=='Sel') {
    zRec.style.display='none';
    zSel.style.display='block';
    SelRec.className='opt';
    SelSel.className='optRowSelected';
  }

 }
]]>
				</script>
			</xsl:with-param>
			<xsl:with-param name="Body">
				<xsl:call-template name="xslc:ApplicationMessages"/>
				<xsl:apply-templates select="tResaS/tResa"/>
				<xsl:if test="$RecordCount=0">
					<xsl:call-template name="xslc:FormResa"/>
				</xsl:if>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="tResaS/tResa">
		<xsl:param name="UserR" select="/document/tResaS/tResa/idUser"/>
		<xsl:param name="UserID" select="/document/XMLC_Params/XMLC_UserID"/>
		<xsl:param name="RecordCount" select="/document/tResaS/@RowCount"/>
		<xsl:if test="$RecordCount!=0 and $UserID!=$UserR">
			<table border="0" cellpadding="2" cellspacing="0" width="400px">
				<span class="clFieldCaption">
					<br/>une réservation a été effectuée pour ce Véhicule...<br/>à partir de <xsl:value-of select="DateResa"/>, jusqu'au <xsl:value-of select="DateMax"/> inclus.</span>
				<tr>
					<td align="right">
						<br/>
						<span class="clFieldCaption">pour :</span>
					</td>
					<td style="padding-left: 10px; font-weight: bold" width="200px">
						<br/>
						<xsl:if test="$UserID=$UserR">
							<xsl:value-of select="UserName"/>
						</xsl:if>
						<xsl:if test="$UserID!=$UserR">
							<table>
								<tr>
									<td>
										<a href="mailto:{UserName}" style="color:blue">
											<xsl:value-of select="UserName"/>
										</a>
									</td>
									<td>
										<xsl:call-template name="xslc:ToolbarButton">
											<xsl:with-param name="Caption">
												<img alt="contacter par mail" border="0" src="{$XMLC_PictosPath}button_email.gif"/>
											</xsl:with-param>
											<xsl:with-param name="HRef">mailto:<xsl:value-of select="UserName"/>
											</xsl:with-param>
										</xsl:call-template>
									</td>
								</tr>
							</table>
						</xsl:if>
					</td>
				</tr>
				<tr>
					<td align="right">
						<span class="clFieldCaption">véhicule sélectionné :</span>
					</td>
					<td style="padding-left: 10px; font-weight: bold" width="200px">
						<xsl:value-of select="/document/Params/sInfoVN"/>
					</td>
				</tr>
				<tr>
					<td align="right">
						<span class="clFieldCaption">nom du Client:</span>
					</td>
					<td style="padding-left: 10px">
						<xsl:value-of select="TextResa"/>
					</td>
				</tr>
				<tr>
					<td align="right" valign="top">
						<span class="clFieldCaption">commentaire :</span>
					</td>
					<td style="padding-left: 10px" height="100px">
						<xsl:value-of select="Commentaire"/>
					</td>
				</tr>
				<tr>
					<td> </td>
					<td align="right">
						<xsl:call-template name="xslc:Button">
							<xsl:with-param name="idName">BtnQuitter</xsl:with-param>
							<xsl:with-param name="Caption">Quitter</xsl:with-param>
							<xsl:with-param name="OnClick">parent.ShowHideForm(parent.document.getElementById('vdivFormResa')); return false;</xsl:with-param>
							<xsl:with-param name="Width">100px</xsl:with-param>
						</xsl:call-template>
					</td>
				</tr>
			</table>
		</xsl:if>
		<xsl:if test="$RecordCount=0 or $UserID=$UserR">
			<xsl:call-template name="xslc:FormResa"/>
		</xsl:if>
	</xsl:template>
	<xsl:template name="xslc:FormResa">
		<xsl:param name="UserR" select="/document/tResaS/tResa/idUser"/>
		<xsl:param name="UserID" select="/document/XMLC_Params/XMLC_UserID"/>
		<xsl:param name="RecordCount" select="/document/tResaS/@RowCount"/>
		<xsl:param name="ResaAction">
			<xsl:if test="$RecordCount=0 ">InsertReservation</xsl:if>
			<xsl:if test="$RecordCount!=0 ">UpdateReservation</xsl:if>
		</xsl:param>
		<script language="javascript">
			<![CDATA[function donner_focus(chp)
{

  var focusControl = getObjectById(chp);
	try {
focusControl.focus();
      }
      catch (err) {
      }
}

function ResaInit()
{]]>
			<![CDATA[// récupération du nombre de réservation 
var iiCount= ']]>
			<xsl:value-of select="/document/tResaS/@RowCount"/>
			<![CDATA[';
  if (iiCount==0) {
    selSelect('Rec');
  }
  if (iiCount!=0) {
    selSelect('Sel');
  }

}]]>
		</script>
		<xsl:if test="/document/Params/ResaMessage!='' and $RecordCount=0">
			<span class="clFieldCaption">
				<br/>votre réservation a été annulée pour ce Véhicule<br/>
				<br/>
			</span>
			<table border="0" cellpadding="2" cellspacing="0" width="400px">
				<tr>
					<td/>
					<td style="padding-left: 10px; font-weight: bold" width="200px">
						<br/>
						<xsl:call-template name="xslc:Button">
							<xsl:with-param name="idName">BtnQuitter</xsl:with-param>
							<xsl:with-param name="Caption">Quitter</xsl:with-param>
							<xsl:with-param name="OnClick">parent.ShowHideForm(parent.document.getElementById('vdivFormResa')); return false;</xsl:with-param>
							<xsl:with-param name="Width">200px</xsl:with-param>
						</xsl:call-template>
					</td>
				</tr>
			</table>
		</xsl:if>
		<xsl:if test="/document/Params/ResaMessage=''">
			<form name="DeleteForm" method="POST" action="{/document/Aliases/bdVODLL}DeleteReservation">
				<input type="hidden" name="idResa" value="{idResa}"/>
				<input type="hidden" name="idVehicle" value="{/document/Params/idVehicle}"/>
				<input type="hidden" name="idUser" value="{/document/XMLC_Params/XMLC_UserID}"/>
			</form>
			<form name="ResaForm" method="POST" action="{/document/Aliases/bdVODLL}{$ResaAction}">
				<input type="hidden" name="idResa" value="{idResa}"/>
				<input type="hidden" name="idVehicle" value="{/document/Params/idVehicle}"/>
				<input type="hidden" name="sInfoVN" value="{/document/Params/sInfoVN}"/>
				<input type="hidden" name="idUser" value="{/document/XMLC_Params/XMLC_UserID}"/>
				<input type="hidden" name="UserName" value="{/document/XMLC_Params/XMLC_UserName}"/>
				<xsl:if test="$RecordCount=0">
					<span class="clFieldCaption">
						<br/>Complétez les informations suivantes, afin de réaliser une réservation qui restera effective pour une durée de 2 jours...</span>
				</xsl:if>
				<xsl:if test="$UserID=$UserR">
					<span class="clFieldCaption">
						<br/>Votre réservation est effective pour une durée de 2 jours...<br/>à partir de <xsl:value-of select="DateResa"/>, jusqu'au <xsl:value-of select="DateMax"/> inclus.<br/>Vous pouvez éventuellement la modifier ou l'annuler...<br/>
					</span>
				</xsl:if>
				<table border="0" cellpadding="2" cellspacing="0" width="600px">
					<tr>
						<td align="right">
							<br/>
							<span class="clFieldCaption">votre identifiant de connexion :</span>
						</td>
						<td style="padding-left: 10px; font-weight: bold">
							<br/>
							<xsl:value-of select="/document/XMLC_Params/XMLC_UserName"/>
						</td>
						<td width="150px"/>
					</tr>
					<tr>
						<td align="right">
							<span class="clFieldCaption">véhicule sélectionné :</span>
						</td>
						<td colspan="2" style="padding-left: 10px; font-weight: bold">
							<xsl:value-of select="/document/Params/sInfoVN"/>
						</td>
					</tr>
					<tr>
						<td colspan="3">
							<fieldset>
								<legend style="font-weight:bold">Coordonnées du client</legend>
								<table>
									<tr>
										<td id="SelRec" width="150px" onclick="selSelect('Rec');" onmouseover="seloldClass=this.className; this.className='optRowSelected';" onmouseout="this.className=seloldClass;">
											<div id="hREC">
												<img border="0" src="{$XMLC_PictosPath}button_service.gif"/>Recherche</div>
										</td>
										<td id="SelSel" width="150px" onclick="selSelect('Sel');" onmouseover="seloldClass=this.className; this.className='optRowSelected';" onmouseout="this.className=seloldClass;">
											<div id="hSEL">
												<img border="0" src="{$XMLC_PictosPath}button_service.gif"/>Sélection</div>
										</td>
									</tr>
								</table>
								<div class="separa"/>
								<div id="zSel" style="display: none; ">zone sélection :<table width="100%">
										<tr>
											<td align="right">
												<span class="clFieldCaption">nom du Client:</span>
											</td>
											<td style="padding-left: 10px">
												<input type="text" class="clFlatTextInput" name="TextResa" size="30" value="{TextResa}"/>
											</td>
											<td/>
										</tr>
										<tr>
											<td align="right" valign="top">
												<span class="clFieldCaption">commentaire (éventuel):</span>
											</td>
											<td style="padding-left: 10px">
												<textarea rows="3" class="clFlatTextInput" name="Commentaire">
													<xsl:value-of select="Commentaire"/>
												</textarea>
											</td>
											<td/>
										</tr>
										<tr>
											<td> </td>
											<td align="right" style="padding-left: 10px">
												<script language="javascript">
													<![CDATA[// 
// Valider les paramètres d'appel et lancement Submit
// 
function goSubmit() {
 if (getObjectById('TextResa').value=='') {
      SetFocus('TextResa');
      return false
   } ;

document.ResaForm.submit(); 
return false;
}

//donner_focus('TextResa');
donner_focus('InputSearchVO');]]>
												</script>
												<xsl:if test="$RecordCount!=0 ">
													<xsl:call-template name="xslc:Button">
														<xsl:with-param name="idName">BtnSave</xsl:with-param>
														<xsl:with-param name="Caption">Enregistrer</xsl:with-param>
														<xsl:with-param name="OnClick">goSubmit(); return false;</xsl:with-param>
														<xsl:with-param name="Width">200px</xsl:with-param>
													</xsl:call-template>
													<xsl:call-template name="xslc:Button">
														<xsl:with-param name="idName">BtnAnnuler</xsl:with-param>
														<xsl:with-param name="Caption">Annuler cette réservation</xsl:with-param>
														<xsl:with-param name="OnClick">document.DeleteForm.submit(); return false;</xsl:with-param>
														<xsl:with-param name="Width">200px</xsl:with-param>
													</xsl:call-template>
												</xsl:if>
												<xsl:if test="$RecordCount=0 ">
													<xsl:call-template name="xslc:Button">
														<xsl:with-param name="idName">BtnSave</xsl:with-param>
														<xsl:with-param name="Caption">Réserver ce Véhicule</xsl:with-param>
														<xsl:with-param name="OnClick">goSubmit(); return false;</xsl:with-param>
														<xsl:with-param name="Width">200px</xsl:with-param>
													</xsl:call-template>
												</xsl:if>
												<xsl:call-template name="xslc:Button">
													<xsl:with-param name="idName">BtnQuitter</xsl:with-param>
													<xsl:with-param name="Caption">Quitter</xsl:with-param>
													<xsl:with-param name="OnClick">parent.ShowHideForm(parent.document.getElementById('vdivFormResa')); return false;</xsl:with-param>
													<xsl:with-param name="Width">200px</xsl:with-param>
												</xsl:call-template>
											</td>
											<td/>
										</tr>
									</table>
								</div>
							</fieldset>
						</td>
					</tr>
				</table>
			</form>
			<div id="zRec" style="display: none; ">zone recherche :<form action="{/document/Aliases/bdVODLL}SearchVO" name="MainForm" method="post">
					<input type="hidden" name="SVOTypeSearch" value="{/document/OutParams/TypeSearch}"/>
					<input type="hidden" name="SVOTypeVO" value="{/document/OutParams/TypeVO}"/>
					<input type="hidden" name="SVOSITE" value="{/document/OutParams/SITE}"/>
					<input type="hidden" name="NextAction" value="FormtReservation"/>
					<input type="hidden" name="idVehicle" value="{/document/Params/idVehicle}"/>
					<input type="hidden" name="sInfoVN" value="{/document/Params/sInfoVN}"/>
				</form>
				<table cellpadding="0" cellspacing="0" height="100%" width="100%">
					<tr height="8px">
						<td/>
						<td/>
					</tr>
					<tr>
						<td width="140px" align="right">Type Recherche: </td>
						<td>
							<select id="CBsearch" onchange="javascript: document.MainForm.SVOTypeSearch.value=getObjectById('CBsearch').value; document.MainForm.submit(); return false;" style="width:152px">
								<option value="4">
									<xsl:if test="/document/OutParams/TypeSearch=4">
										<xsl:attribute name="selected"/>
									</xsl:if>BProFid - N° Immat</option>
								<option value="5">
									<xsl:if test="/document/OutParams/TypeSearch=5">
										<xsl:attribute name="selected"/>
									</xsl:if>BProFid - Nom Client</option>
								<option value="6">
									<xsl:if test="/document/OutParams/TypeSearch=6">
										<xsl:attribute name="selected"/>
									</xsl:if>BProFid - Mobile</option>
								<option value="7">
									<xsl:if test="/document/OutParams/TypeSearch=7">
										<xsl:attribute name="selected"/>
									</xsl:if>BProFid - Téléphone</option>
								<option value="8" style="color:orange">
									<xsl:if test="/document/OutParams/TypeSearch=8">
										<xsl:attribute name="selected"/>
									</xsl:if>BProFid - Mail</option>
							</select>
						</td>
					</tr>
					<xsl:call-template name="AutoComplete">
						<xsl:with-param name="Name">InputSearchVO</xsl:with-param>
						<xsl:with-param name="InputAttributes">
							<Attributes size="23"/>
						</xsl:with-param>
						<xsl:with-param name="UseShadow">true</xsl:with-param>
						<xsl:with-param name="DatasXMLServiceName">DataSearchVO</xsl:with-param>
						<xsl:with-param name="ResultRecordName">VO</xsl:with-param>
						<xsl:with-param name="ResultFields">
							<Field>
								<Name>VO_Result</Name>
							</Field>
							<Field>
								<Name>VO_ID</Name>
							</Field>
							<Field>
								<Name>idOwner</Name>
							</Field>
							<Field>
								<Name>VO_ORDRE</Name>
							</Field>
							<Field>
								<Name>VO_NO</Name>
							</Field>
							<Field>
								<Name>VO_IMMAT</Name>
							</Field>
							<Field>
								<Name>VO_DESC</Name>
							</Field>
							<Field>
								<Name>VO_BUYER</Name>
							</Field>
							<Field>
								<Name>VO_Icon</Name>
							</Field>
						</xsl:with-param>
						<xsl:with-param name="TemplateResult">&lt;table style="table-layout: fixed;"&gt;&lt;tr&gt;&lt;td style="vertical-align: middle; display: inline-block; width:100px;"&gt;&lt;div style="width:100px; word-wrap: break-word"&gt;&lt;img border="0" src="<xsl:value-of select="$XMLC_PictosPath"/>
							<FieldName>VO_Icon</FieldName>.gif"/&gt;<xsl:choose>
								<xsl:when test="(/document/OutParams/TypeSearch='3')">
									<span style="color:blue">
										<FieldName>VO_NO</FieldName>
									</span>
								</xsl:when>
								<xsl:otherwise>
									<span style="color:purple">
										<FieldName>VO_NO</FieldName>
									</span>
								</xsl:otherwise>
							</xsl:choose>&lt;/div&gt;&lt;/td&gt;&lt;td style="width:80px;"&gt;&lt;div style="width:80px;word-wrap: break-word"&gt;<span style="color:purple">
								<FieldName>VO_ORDRE</FieldName>
							</span>&lt;/div&gt;&lt;/td&gt;&lt;td style="width:80px;"&gt;&lt;div style="width:80px;word-wrap: break-word"&gt;<xsl:choose>
								<xsl:when test="(/document/OutParams/TypeSearch='1') or (/document/OutParams/TypeSearch='')">
									<span style="color:blue">
										<FieldName>VO_IMMAT</FieldName>
									</span>
								</xsl:when>
								<xsl:otherwise>
									<span style="color:purple">
										<FieldName>VO_IMMAT</FieldName>
									</span>
								</xsl:otherwise>
							</xsl:choose>&lt;/div&gt;&lt;/td&gt;&lt;td style="width:125px;"&gt;&lt;div style="width:125px;word-wrap: break-word"&gt;<span style="color:purple">
								<FieldName>VO_DESC</FieldName>
							</span>&lt;/div&gt;&lt;/td&gt;&lt;td style="width:125px;"&gt;&lt;div style="width:125px;word-wrap: break-word"&gt;<xsl:choose>
								<xsl:when test="/document/OutParams/TypeSearch='2'">
									<span style="color:blue">
										<FieldName>VO_BUYER</FieldName>
									</span>
								</xsl:when>
								<xsl:otherwise>
									<span style="color:purple">
										<FieldName>VO_BUYER</FieldName>
									</span>
								</xsl:otherwise>
							</xsl:choose>&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</xsl:with-param>
						<xsl:with-param name="VActionOnSelect">// attention : ne s'ajoute pas au script 
// à faire dans ..\..\yui-VO20100302.xsl
if (datas[2]!=0) {

if (getObjectById('CBsearch').value &gt;3) 
parent.PopFormAxVO('FormVO', '0&amp;idClient='+datas[1]);

if (getObjectById('CBsearch').value &lt;4) 
parent.PopFormAxVO('FormVO', datas[1]);

  parent.ShowHide('YuiSearch'); return false;
 }</xsl:with-param>
					</xsl:call-template>
				</table>
			</div>
		</xsl:if>
	</xsl:template>
</xsl:stylesheet>
