1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
<script type="text/javascript">
function FileStateChanged(uploader, file, httpStatus, isLast) {
var t = Flajaxian.$("MyDiv");
switch (file.state) {
case 5:
t.innerHTML += "name:" + file.name + " state:Erreur </br>";
break;
}
Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast);
if (file.state > Flajaxian.File_Uploading && isLast) {
/*Afficher le fichier TLD*/
document.getElementById('LogoName').value = file.name;
}
}
$(function () {
$.ajax({
type: "POST",
url: "Edit_couleur.aspx/GetGrossistes",
data: '{"PageEnCours":"' + document.location.href.toString() + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
$('#lstGrossistes').append($('<option>', { value: "-1", text: "Sélectionnez un grossiste" }));
if (msg.d != null) {
$.each(msg.d, function (i, item) {
$('#lstGrossistes').append($('<option>', { value: item.IdGros, text: item.Libelle }));
});
}
},
error: function () {
alert('oups');
}
});
$('#lstGrossistes').change(function () {
var Gros = $(this).val();
if (Gros == "-1") {
$('#divcouleur').html("");
}
else {
$.ajax({
type: "POST",
url: "Edit_couleur.aspx/GetCouleur",
data: '{"IdGros":' + Gros + ',"PageEnCours":"' + document.location.href.toString() + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
BuildTable(msg);
}
});
$('.error').hide();
}
});
});
function BuildTable(msg) {
var table = '<table><thead><tr class="Entete"><th>Libellé</th><th>Code</th><th colspan="2"></th></thead><tbody>';
for (var post in msg.d) {
var row = '<tr id=' + msg[post].IdCouleur + '>';
row += '<td>' + msg[post].Libelle + '</td>';
row += '<td>' + msg[post].IdCouleurGros + '</td>';
row += '<td>' + '</td>';
row += '<td><img src="/Images/suppr.png" alt="Supprimer" id="Delete"></td>';
row += '</tr>';
table += row;
}
//Pied pour ajout
table += '<tr class="Entete2"><td><input type="text" id="txtCouleur" /><br /><label class="error" for="txtCouleur" id="Lib_error">Champs Libellé obligatoire.</label></td>'
table += '<td><input type="text" id="txtCode" /><br /></td>'
table += '<td><br /><input type="hidden" id="LogoName" /><div id="MyDiv"></div>'
table += '<br /><label class="error" id="Img_error">Champs Image obligatoire.</label></td>'
table += '<td><img src="/Images/add.png" alt="Ajouter" id="Add" /></td></tr>'
table += '</tbody></table>';
$('#divcouleur').html(table);
}; |
Partager