Commit 83520c36 authored by wilhelmhb's avatar wilhelmhb

defaultNotes : debug and display message on button

parent a388b21a
......@@ -12,11 +12,10 @@ function addCustomNote(data) {
},
data: data,
success: function(data) {
console.log(data);
addNoteSuccess();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
//console.log(xhr.responseText);
finCharge();
afficherBd("Une erreur est survenue","Fermer");
......@@ -40,7 +39,7 @@ function addNoteSuccess() {
* @integer idCustomNote: identifier of the note to add
*/
function addCustomNoteToHive(idCustomNote) {
console.log(donneesRuches.hivegroups[idHiveGroup].hives[idHive]);
//console.log(donneesRuches.hivegroups[idHiveGroup].hives[idHive]);
charge();
$.ajax({
type: 'POST',
......@@ -50,11 +49,11 @@ function addCustomNoteToHive(idCustomNote) {
},
data: 'apibundle_pscustomnotecustomer%5BidCustomNote%5D=' + idCustomNote + '&apibundle_pscustomnotecustomer%5BidHive%5D=' + donneesRuches.hivegroups[idHiveGroup].hives[idHive].id_hive,
success: function(data) {
console.log("C'est RAS : " + data);
//console.log("C'est RAS : " + data);
addCustomNoteToHiveSuccess();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
//console.log(xhr.responseText);
finCharge();
afficherBd("Une erreur est survenue","Fermer");
}
......@@ -81,14 +80,14 @@ function getCustomNotes(action,fDefault) {
withCredentials: true
},
success: function(data) {
console.log(data);
//console.log(data);
for(var i in data) {
data[i].level = levels[data[i].level];
}
action(data,fDefault,-1);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
//console.log(xhr.responseText);
finCharge();
afficherBd("Une erreur est survenue","Fermer");
}
......@@ -107,18 +106,18 @@ function getCustomNotesForHive(action, id) {
withCredentials: true
},
success: function(data) {
console.log(data);
//console.log(data);
for(var i in data) {
var dates = formatDate(data[i].date_add);
data[i].date_add = dates.add;
data[i].date_compare = dates.compare;
}
customNotesSetByUser = data;
action();
console.log(id);
action(id);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
//console.log(xhr.responseText);
finCharge();
afficherBd("Une erreur est survenue","Fermer");
}
......@@ -141,12 +140,12 @@ function deleteCustomNoteForHive(idCustomNote,idx) {
withCredentials: true
},
success: function(data) {
console.log("C'est RAS : " + data);
//console.log("C'est RAS : " + data);
supprimerNote(idx);
deleteCustomNoteToHiveSuccess();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
//console.log(xhr.responseText);
finCharge();
afficherBd("Une erreur est survenue","Fermer");
}
......@@ -174,7 +173,7 @@ function deleteCustomNote(idCustomNote) {
$("#"+idCustomNote).remove();
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
//console.log(xhr.responseText);
finCharge();
afficherBd("Une erreur est survenue","Fermer");
}
......
......@@ -12,7 +12,6 @@ function addDefaultNoteToHive(idDefaultNote) {
},
data: 'apibundle_psdefaultnotecustomer%5BidDefaultNote%5D=' + idDefaultNote + '&apibundle_psdefaultnotecustomer%5BidHive%5D=' + donneesRuches.hivegroups[idHiveGroup].hives[idHive].id_hive + '&apibundle_psdefaultnotecustomer%5BidCustomer%5D=' + customer.id,
success: function(data) {
console.log(data);
addDefaultNoteToHiveSuccess();
},
error: function (xhr, ajaxOptions, thrownError) {
......@@ -28,7 +27,7 @@ function addDefaultNoteToHive(idDefaultNote) {
*/
function addDefaultNoteToHiveSuccess() {
finCharge();
goToHistorique(donneesRuches.hivegroups[idHiveGroup-1].hives[idHive-1].id_hive,1);
goToHistorique(donneesRuches.hivegroups[idHiveGroup].hives[idHive].id_hive,1);
}
/**
......@@ -75,7 +74,7 @@ function getDefaultNotesForHive(action, id) {
data[i].date_add = dates.add;
data[i].date_compare = dates.compare;
}
action(data, id);
action(data);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
......
......@@ -62,7 +62,7 @@ function details_histo(nouveau){
$(_('fleche_'+selectHisto)).attr('src','img/histo_fleche_bas.png');
}
var notes;
function afficherNotes(data, indexHive){
function afficherNotes(data){
finCharge();
nNotes=0;
notes=[];
......@@ -73,7 +73,6 @@ function afficherNotes(data, indexHive){
var note = data[i];
for(var j in defaultNotes) {
if(defaultNotes[j].id == note.id_default_note) {
note.data = defaultNotes[j];
}
}
......@@ -117,11 +116,9 @@ function afficherNotes(data, indexHive){
document.getElementById("content-historique").innerHTML = h;
transition(_("phistorique"), "slide");
if(indexHive != null) {
idHive = indexHive;
}
//console.log(idHive);
//console.log(donneesRuches.hivegroups[idHiveGroup].hives[idHive].name);
//if(indexHive != null) {
//idHive = indexHive;
//}
if(idHive!=-1)$("#sous_titre_histo").children("h1").html(donneesRuches.hivegroups[idHiveGroup].hives[idHive].name);
else $("#sous_titre_histo").children("h1").html("Toutes les ruches");
......
......@@ -29,13 +29,13 @@
<div align="center">
{{#default_notes}}
<form class="formulaire" id="{{id}}" type="default">
<input type="submit" class="histo_{{level}}" value="{{name}}" />
<input type="submit" class="histo_{{level}}" value="{{name}} : {{message}}" />
</form>
{{/default_notes}}
<h1>Notes personnalisées</h1>
{{#custom_notes}}
<form class="formulaire" id="{{id}}" type="custom">
<input type="submit" class="histo_{{level}}" value="{{name}}" /><img id="dlcn{{id}}" class="dlcnote" src="img/histo_supprimer2.png" style="width:20px;height:20px;"/>
<input type="submit" class="histo_{{level}}" value="{{name}} : {{message}}" /><img id="dlcn{{id}}" class="dlcnote" src="img/histo_supprimer2.png" style="width:20px;height:20px;"/>
</form>
{{/custom_notes}}
<div class="bouton" id="add_custom_note"><span>Nouvelle note</span></div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment