Commit c97353e8 authored by wilhelmhb's avatar wilhelmhb

rectificatifs des paramètres

parent d2e80423
......@@ -29,7 +29,7 @@ function getDataHive(id, id2, name, action) {
else {
$.ajax({
type: 'GET',
url: url+'pscustomer/hives/'+id+'/me',
url: url+'pshive/mes/'+id,
dataType: "json",
xhrFields: {
withCredentials: true
......
......@@ -182,8 +182,8 @@ function goToHiveParameters() {
e.preventDefault();
donneesRuches.hivegroups[idHiveGroup].hives[idHive].name = $("#apibundle_pshive_name").val();
donneesRuches.hivegroups[idHiveGroup].hives[idHive].note = $("#apibundle_pshive_note").val();
donneesRuches.hivegroups[idHiveGroup].hives[idHive].latitude = $("#apibundle_pshive_latitude").val();
donneesRuches.hivegroups[idHiveGroup].hives[idHive].longitude = $("#apibundle_pshive_longitude").val();
donneesRuches.hivegroups[idHiveGroup].hives[idHive].latitude = 0;//$("#apibundle_pshive_latitude").val();
donneesRuches.hivegroups[idHiveGroup].hives[idHive].longitude = 0;//$("#apibundle_pshive_longitude").val();
donneesRuches.hivegroups[idHiveGroup].hives[idHive].id_hive_group = $("#apibundle_pshive_hivegroup").val();
donneesRuches.hivegroups[idHiveGroup].hives[idHive].hive_type = $("#apibundle_pshive_hiveType").val();
donneesRuches.hivegroups[idHiveGroup].hives[idHive].bees_type = $("#apibundle_pshive_beesType").val();
......@@ -209,19 +209,53 @@ function submitParamsHive(){
//console.log("début modif");
var donnees = $("#form-params-hive").serialize();
console.log(donnees);
var params = donnees.split("&apibundle_pshive%5Bnumero_serie%5D=");
var num_serie = params[1];
var data = params[0];
console.log(num_serie);
console.log(data);
console.log(donneesRuches.hivegroups[idHiveGroup].hives[idHive]);
charge();
$.ajax({
type: 'PATCH',
url: url+'pshive/'+donneesRuches.hivegroups[idHiveGroup].hives[idHive].id_hive + '/update',
url: url+'pshive/' + donneesRuches.hivegroups[idHiveGroup].hives[idHive].id_hive + '/update',
xhrFields: {
withCredentials: true
},
data: donnees,
data: data,
success: function(data) {
console.log(data);
//customer = data;
updateLocalHive(data);
/* modify the box */
if(donneesRuches.hivegroups[idHiveGroup].hives[idHive].data.idLogger == null) {
//create
console.log("create");
$.ajax({
type: 'POST',
url: url+'psbox/create',
xhrFields: {
withCredentials: true
},
data: 'apibundle_pshive%5BserialNumber%5D=' + num_serie + '&apibundle_psbox%5BidHive%5D=' + donneesRuches.hivegroups[idHiveGroup].hives[idHive].id_hive + '&apibundle_psbox%5BidClient%5D=' + donneesRuches.hivegroups[idHiveGroup].hives[idHive].id_client ,
success: function(data) {
console.log(data);
donneesRuches.hivegroups[idHiveGroup].hives[idHive].data.serialNumber = num_serie;
finCharge();
},
error: function (xhr, ajaxOptions, thrownError) {
finCharge();
afficherBd("Une erreur est survenue","Fermer");
console.log(xhr.responseText);
}
});
}
else {
console.log("update");
//update
changeLogger(donneesRuches.hivegroups[idHiveGroup].hives[idHive].data.idLogger, num_serie, donneesRuches.hivegroups[idHiveGroup].hives[idHive].id_hive);
donneesRuches.hivegroups[idHiveGroup].hives[idHive].data.serialNumber = num_serie;
}
updateLocalHive(data);
console.log(donneesRuches.hivegroups[idHiveGroup].hives[idHive]);
/* go back to details */
finCharge();
......
......@@ -187,9 +187,9 @@
<div class="sizing"></div>
<div id="bloc1">
<h1>Informations</h1>
<p>Orientation : {{data.ORICARD}}</p>
<p>Capteur :</p>
<p>Rucher : {{name_hive_group}}</p>
<p>Capteur :</p>
<p>Orientation : {{data.ORICARD}}</p>
</div>
<div id="bloc2">
<h1>Miel</h1>
......@@ -287,7 +287,7 @@
<label for="apibundle_pshive_note">Note</label>
<textarea id="apibundle_pshive_note" name="apibundle_pshive[note]" maxlength="65535"></textarea>
</div>-->
<div>
<!--<div>
<label for="apibundle_pshive_latitude">Latitude</label>
<input type="text" id="apibundle_pshive_latitude" value="{{ hive.latitude }}" name="apibundle_pshive[latitude]" />
<div class="cl"></div>
......@@ -296,7 +296,7 @@
<div>
<label for="apibundle_pshive_longitude">Longitude</label>
<input type="text" id="apibundle_pshive_longitude" value="{{ hive.longitude }}" name="apibundle_pshive[longitude]" />
</div>
</div>-->
<div>
<label for="apibundle_pshive_hivegroup">Rucher</label>
<select type="text" id="apibundle_pshive_hivegroup" name="apibundle_pshive[idHiveGroup]">
......@@ -338,6 +338,14 @@
<label for="apibundle_pshive_notes">Notes</label>
<textarea id="apibundle_pshive_notes" name="apibundle_pshive[notes]" maxlength="65535"></textarea>
</div>-->
<div>
<label for="apibundle_pshive_date_installation">Date d'installation</label>
<input type="number" id="apibundle_pshive_date_installation" value="{{ hive.date_install }}" name="apibundle_pshive[dateInstall]" min="2016" step=1 />
</div>
<div>
<label for="apibundle_pshive_numero_serie">Numéro de série du boîtier</label>
<input type="text" id="apibundle_pshive_numero_serie" value="{{ hive.data.serialNumber }}" name="apibundle_pshive[numero_serie]" />
</div>
<div class="bouton"><span>VALIDER</span></div>
</form>
</script>
......
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