Bonjour a tous,
Voici ce que j'ai fais pour l'instant
[ Lien ] et en gros je crée un post-it contenant l'heure suivant ce que l'utilisateur à selectionner.
Le probleme est le suivant: j'aimerais pouvoir saisir le post it, c'est a dire faire un drag and drop sur mes post it et pouvoir les deplacer dans les cases de mon tableau ou bien dans une poubelle. Je cherche sur internet depuis trop longtemp et la je pete un plomb. J'ai presque essayé pas mal de truc: wz_dragdrop.js,.... mais je n'y arrive pas !
Voici le code de ma page utilisant le wz_dragdrop.js:
Je vous enleve le bout de code qui ne concerne pas l'exemple, voici donc le site ci dessus simplifié pour la situation :
<html>
<head>
<title>Planning</title>
<script language="JavaScript" type="text/JavaScript">
function suivant_jour() {
ho1=document.h1.h1_debut.options[document.h1.h1_debut.selectedIndex].text;
ho2=document.h1.h1_fin.options[document.h1.h1_fin.selectedIndex].text;
ho3=document.h2.h2_debut.options[document.h2.h2_debut.selectedIndex].text;
ho4=document.h2.h2_fin.options[document.h2.h2_fin.selectedIndex].text;
heure=ho1+"h"+ho2+"\r\n"+ho3+"h"+ho4;
if (verif_jour())
{afficher("fond_tab1");
var no=1;
while (document.getElementById("post_jour_"+no) && no<=16)
{
if (document.getElementById("post_jour_"+no).style.visibility!="visible")
{
for (i=no-1; i>0; i--)
{ if (document.getElementById("post_jour_"+i).value==heure)
{alert("La tranche horaire existe déjà"); return;}
}
afficher("post_jour_"+no);
document.getElementById("post_jour_"+no).value = heure;
document.getElementById("post_jour_"+no).innerHTML = heure;
return;
}
no++;
}
alert("Le nombre maximum de Post-it a été atteint !");
}
}
function suivant_nuit() {
ho1=document.h3.h3_debut.options[document.h3.h3_debut.selectedIndex].text;
ho2=document.h3.h3_fin.options[document.h3.h3_fin.selectedIndex].text;
ho3=document.h4.h4_debut.options[document.h4.h4_debut.selectedIndex].text;
ho4=document.h4.h4_fin.options[document.h4.h4_fin.selectedIndex].text;
heure=ho1+"h"+ho2+"\r\n"+ho3+"h"+ho4;
if (verif_nuit())
{afficher("fond_tab2");
var no=1;
while (document.getElementById("post_nuit_"+no) && no<=10)
{
if (document.getElementById("post_nuit_"+no).style.visibility!="visible" )
{
for (i=no-1; i>0; i--)
{ if (document.getElementById("post_nuit_"+i).value==heure)
{alert("La tranche horaire existe déjà"); return;}
}
afficher("post_nuit_"+no);
document.getElementById("post_nuit_"+no).value = heure;
document.getElementById("post_nuit_"+no).innerHTML = heure;
return;
}
no++;
}
alert("Le nombre maximum de Post-it a été atteint !");
}
}
function suivant_off() {
journee=document.h5.h5_journée.options[document.h5.h5_journée.selectedIndex].text;
if (verif_off())
{afficher("fond_tab3");
var no=1;
while (document.getElementById("post_off_"+no) && no<=7)
{
if (document.getElementById("post_off_"+no).style.visibility!="visible" )
{
for (i=no-1; i>0; i--)
{ if (document.getElementById("post_off_"+i).value==journee)
{alert("La journée off existe déjà"); return;}
}
afficher("post_off_"+no);
document.getElementById("post_off_"+no).value = journee;
document.getElementById("post_off_"+no).innerHTML = journee;
return;
}
no++;
}
alert("Le nombre maximum de Post-it a été atteint !");
}
}
function ajouter_employé() {
var newRow = document.getElementById('table').insertRow(-1);
var newCell = newRow.insertCell(0);
newCell.innerHTML = '<align="center"><input type="text" size="10">';
newCell = newRow.insertCell(1);
newCell.innerHTML = '<select name="poste"><option>Choisir<option>Cuisine<option>Salle<option>Bar<option>Réception<option>Autre';
newCell = newRow.insertCell(2);
newCell.innerHTML = '';
newCell = newRow.insertCell(3);
newCell.innerHTML = '';
newCell = newRow.insertCell(4);
newCell.innerHTML = '';
newCell = newRow.insertCell(5);
newCell.innerHTML = '';
newCell = newRow.insertCell(6);
newCell.innerHTML = '';
newCell = newRow.insertCell(7);
newCell.innerHTML = '';
newCell = newRow.insertCell(8);
newCell.innerHTML = '';
newCell = newRow.insertCell(9);
newCell.innerHTML = '';
newCell = newRow.insertCell(10);
newCell.innerHTML = '';
newCell = newRow.insertCell(11);
newCell.innerHTML = '';
newCell = newRow.insertCell(12);
newCell.innerHTML = '';
newCell = newRow.insertCell(13);
newCell.innerHTML = '';
newCell = newRow.insertCell(14);
newCell.innerHTML = '';
newCell = newRow.insertCell(15);
newCell.innerHTML = '';
newCell = newRow.insertCell(16);
newCell.innerHTML = '';
newCell = newRow.insertCell(17);
newCell.innerHTML = '';
newCell = newRow.insertCell(18);
newCell.innerHTML = '';
newCell = newRow.insertCell(19);
newCell.innerHTML = '';
newCell = newRow.insertCell(20);
newCell.innerHTML = '';
newCell = newRow.insertCell(21);
newCell.innerHTML = '';
newCell = newRow.insertCell(21);
newCell.innerHTML = '';
}
</script>
</head>
<body>
<script type="text/javascript" src="source/wz_dragdrop.js"></script>
<div id="fond" style="position:absolute; left:10px; top:10px; width:800px; height:560px; z-index:200">
<font size="4" face="Verdana" color="#000000">
<p>Planning Avec Horaire nuit / 37 heures</p></font>
<p>1 - Pour ajouter une tranche horaire, veuillez choisir le type :</p>
<p><form name="type_horaire">
<INPUT type="button" name="type_horaire" OnClick="horaire_jour();" value="Horaire de jour"> <INPUT type="button" name="type_horaire" OnClick="horaire_nuit();" value="Horaire de nuit"> <INPUT type="button" name="type_horaire" OnClick="journée_off();" value="Journée Off">
</form></p>
<div id="Layer1" style="position:absolute; left:10px; top:130px; width:390px; height:150px; z-index:3; overflow: hidden; visibility: hidden;">
<form name="h1">
Horaire de jour :
<p>2 - Début tranche horaire :
<SELECT NAME="h1_debut"><option value="">hh</option><option value="07">07</option><option value="08">08</option><option value="09">09</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option>
</SELECT>h
<SELECT NAME="h1_fin"><option value="">min</option><option value="0">00</option><option value="15">15</option><option value="30">30</option><option value="45">45</option>
</SELECT></p>
</form>
<form id="h2" name="h2">
<DIV><p>3 - Fin tranche horaire :
<SELECT id="h2_debut" onchange=changeliste_jour() name="h2_debut"><option value="" selected>hh</option><option value="07">07</option><option value="08">08</option><option value="09">09</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option>
</SELECT>h
<A id="h2_fin_div"><SELECT id="h2_fin" name="h2_fin"><option value="" selected>min</option>
</SELECT></A></p>
<p><input type="button" name="Suivant" OnClick="suivant_jour();" value="Suivant" width="57" height="16"></p>
</DIV>
</form>
</div>
<div id="Layer2" style="position:absolute; left:10px; top:130px; width:390px; height:150px; z-index:2; overflow: hidden; visibility: hidden;">
<form name="h3">
Horaire de nuit :
<p>2 - Début tranche horaire :
<SELECT NAME="h3_debut"><option value="">hh</option><option value="0">22</option><option value="1">23</option><option value="2">00</option><option value="3">01</option><option value="4">02</option><option value="5">03</option><option value="6">04</option><option value="7">05</option><option value="8">06</option><option value="9">07</option>
</SELECT>h
<SELECT NAME="h3_fin"><option value="">min</option><option value="0">00</option><option value="15">15</option><option value="30">30</option><option value="45">45</option>
</SELECT></p>
</form>
<form id="h4" name="h4">
<DIV><p>3 - Fin tranche horaire :
<SELECT id="h4_debut" onchange=changeliste_nuit() name="h4_debut">
<option value="" selected>hh</option><option value="0">22</option><option value="1">23</option><option value="2">00</option><option value="3">01</option><option value="4">02</option><option value="5">03</option><option value="6">04</option><option value="7">05</option><option value="8">06</option><option value="9">07</option>
</SELECT>h
<A id="h4_fin_div"><SELECT id="h4_fin" name="h4_fin">
<option value="" selected>min</option></SELECT></A></p>
<p><input type="button" name="Suivant" OnClick="suivant_nuit();" value="Suivant" width="57" height="16"></p>
</DIV>
</form>
</div>
<div id="Layer3" style="position:absolute; left:10px; top:130px; width:390px; height:150px; z-index:1; overflow: hidden; visibility: hidden;">
<form name="h5">
Journée Off :
<p>2 - Choix de la journée Off :
<SELECT NAME="h5_journée"><option value="">Choisir</option><option value="lundi">Lundi</option><option value="mardi">Mardi</option><option value="mercredi">Mercredi</option><option value="jeudi">Jeudi</option><option value="vendredi">Vendredi</option><option value="samedi">Samedi</option><option value="dimanche">Dimanche</option>
</SELECT></p>
</form>
<p><input type="button" name="Suivant" OnClick="suivant_off();" value="Suivant" width="57" height="16"></p>
</form>
</div>
<div id="fond_tab1" style="position:absolute; left:10px; top:300px; width:725px; height:40px; z-index:5; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; visibility: hidden;">
<div id="post_jour_1" style="position:absolute; left:5px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_2" style="position:absolute; left:50px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_3" style="position:absolute; left:95px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_4" style="position:absolute; left:140px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_5" style="position:absolute; left:185px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_6" style="position:absolute; left:230px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_7" style="position:absolute; left:275px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_8" style="position:absolute; left:320px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_9" style="position:absolute; left:365px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_10" style="position:absolute; left:410px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_11" style="position:absolute; left:455px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_12" style="position:absolute; left:500px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_13" style="position:absolute; left:545px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_14" style="position:absolute; left:590px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_15" style="position:absolute; left:635px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_jour_16" style="position:absolute; left:680px; top:5px; width:40px; height:30px; z-index:5; background-color: #CCFF99; layer-background-color: #CCFF99; border: 1px none #000000; visibility: hidden;"></div>
</div>
<div id="fond_tab2" style="position:absolute; left:10px; top:350px; width:455px; height:40px; z-index:6; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; visibility: hidden;">
<div id="post_nuit_1" style="position:absolute; left:5px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_nuit_2" style="position:absolute; left:50px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_nuit_3" style="position:absolute; left:95px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_nuit_4" style="position:absolute; left:140px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_nuit_5" style="position:absolute; left:185px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_nuit_6" style="position:absolute; left:230px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_nuit_7" style="position:absolute; left:275px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_nuit_8" style="position:absolute; left:320px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_nuit_9" style="position:absolute; left:365px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_nuit_10" style="position:absolute; left:410px; top:5px; width:40px; height:30px; z-index:6; background-color: #FFCC66; layer-background-color: #FFCC66; border: 1px none #000000; visibility: hidden;"></div>
</div>
<div id="fond_tab3" style="position:absolute; left:10px; top:400px; width:530px; height:40px; z-index:7; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; visibility: hidden;">
<div id="post_off_1" style="position:absolute; left:5px; top:5px; width:70px; height:30px; z-index:7; background-color: #6699FF; layer-background-color: #6699FF; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_off_2" style="position:absolute; left:80px; top:5px; width:70px; height:30px; z-index:7; background-color: #6699FF; layer-background-color: #6699FF; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_off_3" style="position:absolute; left:155px; top:5px; width:70px; height:30px; z-index:7; background-color: #6699FF; layer-background-color: #6699FF; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_off_4" style="position:absolute; left:230px; top:5px; width:70px; height:30px; z-index:7; background-color: #6699FF; layer-background-color: #6699FF; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_off_5" style="position:absolute; left:305px; top:5px; width:70px; height:30px; z-index:7; background-color: #6699FF; layer-background-color: #6699FF; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_off_6" style="position:absolute; left:380px; top:5px; width:70px; height:30px; z-index:7; background-color: #6699FF; layer-background-color: #6699FF; border: 1px none #000000; visibility: hidden;"></div>
<div id="post_off_7" style="position:absolute; left:455px; top:5px; width:70px; height:30px; z-index:7; background-color: #6699FF; layer-background-color: #6699FF; border: 1px none #000000; visibility: hidden;"></div>
</div>
<div id="tableau_employé" style="position:absolute; left:10px; top:450px; width:790px; height:100px; z-index:8; visibility: visible;">
<p align="right"><IMG SRC="source/trash.jpg" name="trash" TITLE="Corbeille" ondragdrop ="ok();"></p>
<p align="right"><input type="button" name="button" onClick="ajouter_employé()" value="Ajouter un employé"></p>
<p><table width="100%" id="table" border="1">
<tr>
<td width="8%"><div align="center" class="Style1">Employé</div></td>
<td width="8%"><div align="center" class="Style1">Poste</div></td>
<td width="12%" colspan="3"><div align="center" class="Style2"><em>Lundi</em></div></td>
<td width="12%" colspan="3"><div align="center" class="Style2"><em>Mardi</em></div></td>
<td width="12%" colspan="3"><div align="center" class="Style2"><em>Mercredi</em></div></td>
<td width="12%" colspan="3"><div align="center" class="Style2"><em>Jeudi</em></div></td>
<td width="12%" colspan="3"><div align="center" class="Style2"><em>Vendredi</em></div></td>
<td width="12%" colspan="3"><div align="center" class="Style2"><em>Samedi</em></div></td>
<td width="12%" colspan="3"><div align="center" class="Style2"><em>Dimanche</em></div></td>
</tr>
<tr>
<td width="8%"><input name="nom_employe" type="text" size="10"></td>
<td width="8%">
<select>
<option>Choisir</option>
<option>Cuisine</option>
<option>Réception</option>
<option>Salle</option>
<option>Bar</option>
<option>Autre</option>
</select>
</td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
<td width="3%"></td>
</tr>
</table></p>
</div>
</font>
<script type="text/javascript">
SET_DHTML(CURSOR_MOVE, "post_jour_1", "post_jour_2", "post_jour_3", "post_jour_4", "post_jour_5", "post_jour_6", "post_jour_7", "post_jour_8", "post_jour_9", "post_jour_10", "post_jour_11", "post_jour_12", "post_jour_13", "post_jour_14", "post_jour_15", "post_jour_16", "post_nuit_1", "post_nuit_2", "post_nuit_3", "post_nuit_4", "post_nuit_5", "post_nuit_6", "post_nuit_7", "post_nuit_8", "post_nuit_9", "post_nuit_10", "post_off_1", "post_off_2", "post_off_3", "post_off_4", "post_off_5", "post_off_6", "post_off_7");
</script>
</div>
</body>
</html>
_________________________________________________________________________________________
Voila je ne sais pas si ça va vous aider mais je desespere ! En gros mon post-it est un div caché par defaut que je rend visible en cliquant sur un bouton et ke je rempli avec un innerHTML.
Maintenant j'aimerais faire un glisser deposer pour les mettre dans mon tableau (sachant que je dois faire des controle derriere ! coherence des horaires,...)
Je remerci d'avance tous ceux qui sacrifiront de leur temps pour ce sujet !
Help me please !!!