Commit ffab1118 authored by wilhelmhb's avatar wilhelmhb

type de ruche, d'abeilles, de support, de matériau, et état en tant que liste déroulante

parent 9b53784d
......@@ -39,6 +39,29 @@ var listHivesGlobal;
var rechargerAccueil=false;
var tConnexion;
var levels = ["info", "todo", "warning", "important", "critical"];
var materialType = [{ 'v' : "wood", 'name' : "Bois"},
{ 'v' : "plastic", 'name' : "Plastique"},
{ 'v' : "both", 'name' : "Les deux"},
];
var beesType = [{ 'v' : "buckfast", 'name' : "Buckfast"},
{ 'v' : "hybrid", 'name' : "Hybride"},
{ 'v' : "black", 'name' : "Abeille noire"},
{ 'v' : "other", 'name' : "Autre"},
];
var supportType = [{ 'v' : "steel_frame", 'name' : "Châssis acier"},
{ 'v' : "cinderblock", 'name' : "Parpaing"},
{ 'v' : "beam", 'name' : "Poutre"},
{ 'v' : "other", 'name' : "Autre"},
];
var hiveType = [{ 'v' : "dadant", 'name' : "Dadant"},
{ 'v' : "langstroth", 'name' : "Langstroth"},
{ 'v' : "warre", 'name' : "Warré"},
{ 'v' : "other", 'name' : "Autre"},
];
var state = [{ 'v' : "good", 'name' : "Bon"},
{ 'v' : "average", 'name' : "Moyen"},
{ 'v' : "bad", 'name' : "Mauvais"},
];
var customNotesSetByUser;
var customNotesCreatedByUser;
......
......@@ -59,14 +59,14 @@ function goToListHives(retour) {
}
}
}
//console.log(donneesRuches);
var h = Mustache.render(template, donneesRuches);
document.getElementById("content-accueil").innerHTML = h;
transition(_("paccueil"), (retour==1)?"retour":"");
accueil();
masquerBd();
};
......@@ -159,17 +159,53 @@ function goToHiveGroupParameters() {
* display the parameters for the selected hive
*/
function goToHiveParameters() {
//console.log('goToHiveParameters : begin');
var template = $(templates).filter('#tpl-params-ruche').html();
// create options for hivegroup selection
var hivegroups = [];
console.log(idHiveGroup);
for(var hivegroup in donneesRuches.hivegroups) {
var h = donneesRuches.hivegroups[hivegroup];
h.isHiveGroup = hivegroup == idHiveGroup;
hivegroups.push(h);
}
var donneesHive = { 'hive' : donneesRuches.hivegroups[idHiveGroup].hives[idHive], 'hivegroups' : hivegroups };
//create option for state selection
var stateP = [];
console.log(state);
for(var i = 0 ; i < state.length ; i++) {
var s = state[i];
s.isState = donneesRuches.hivegroups[idHiveGroup].hives[idHive].state == s.v;
stateP.push(s);
}
//create option for beeType selection
var beeTypeP = [];
for(var i = 0 ; i < beesType.length ; i++) {
var s = beesType[i];
s.isType = donneesRuches.hivegroups[idHiveGroup].hives[idHive].bees_type == s.v;
beeTypeP.push(s);
}
//create option for material selection
var materialP = [];
for(var i = 0 ; i < materialType.length ; i++) {
var s = materialType[i];
s.isType = donneesRuches.hivegroups[idHiveGroup].hives[idHive].material == s.v;
materialP.push(s);
}
//create option for hive_type selection
var hiveTypeP = [];
for(var i = 0 ; i < hiveType.length ; i++) {
var s = hiveType[i];
s.isType = donneesRuches.hivegroups[idHiveGroup].hives[idHive].hive_type == s.v;
hiveTypeP.push(s);
}
//create option for support selection
var supportTypeP = [];
for(var i = 0 ; i < supportType.length ; i++) {
var s = supportType[i];
s.isType = donneesRuches.hivegroups[idHiveGroup].hives[idHive].support == s.v;
supportTypeP.push(s);
}
var donneesHive = { 'hive' : donneesRuches.hivegroups[idHiveGroup].hives[idHive], 'hivegroups' : hivegroups, 'state' : stateP, 'materialType' : materialP, 'hiveType' : hiveTypeP, 'beeType' : beeTypeP, 'supportType' : supportTypeP };
console.log(hivegroups);
console.log(donneesHive);
var h = Mustache.render(template, donneesHive);
document.getElementById("corps-params-ruche").innerHTML = h;
......
......@@ -312,23 +312,43 @@
</div>-->
<div>
<label for="apibundle_pshive_hiveType">Type de ruche</label>
<input type="text" value="{{ hive.hive_type }}" id="apibundle_pshive_hiveType" name="apibundle_pshive[hiveType]" maxlength="64" />
<select value="{{ hive.hive_type }}" id="apibundle_pshive_hiveType" name="apibundle_pshive[hiveType]">
{{#hiveType}}
<option value="{{ v }}" {{#isType}}selected{{/isType}}>{{ name }}</option>
{{/hiveType}}
</select>
</div>
<div>
<label for="apibundle_pshive_beesType">Espèce d'abeilles</label>
<input type="text" value="{{ hive.bees_type }}" id="apibundle_pshive_beesType" name="apibundle_pshive[beesType]" maxlength="64" />
<select value="{{ hive.bees_type }}" id="apibundle_pshive_beesType" name="apibundle_pshive[beesType]">
{{#beeType}}
<option value="{{ v }}" {{#isType}}selected{{/isType}}>{{ name }}</option>
{{/beeType}}
</select>
</div>
<div>
<label for="apibundle_pshive_material">Matériau</label>
<input type="text" value="{{ hive.material }}" id="apibundle_pshive_material" name="apibundle_pshive[material]" maxlength="64" />
<label for="apibundle_pshive_material">Type de matériau</label>
<select value="{{ hive.material }}" id="apibundle_pshive_material" name="apibundle_pshive[material]">
{{#materialType}}
<option value="{{ v }}" {{#isType}}selected{{/isType}}>{{ name }}</option>
{{/materialType}}
</select>
</div>
<div>
<label for="apibundle_pshive_support">Support</label>
<input type="text" value="{{ hive.support }}" id="apibundle_pshive_support" name="apibundle_pshive[support]" maxlength="64" />
<label for="apibundle_pshive_support">Type de support</label>
<select value="{{ hive.support }}" id="apibundle_pshive_support" name="apibundle_pshive[support]">
{{#supportType}}
<option value="{{ v }}" {{#isType}}selected{{/isType}}>{{ name }}</option>
{{/supportType}}
</select>
</div>
<div>
<label for="apibundle_pshive_state">État</label>
<input type="text" value="{{ hive.state }}" id="apibundle_pshive_state" name="apibundle_pshive[state]" maxlength="64" />
<select value="{{ hive.state }}" id="apibundle_pshive_state" name="apibundle_pshive[state]">
{{#state}}
<option value="{{ v }}" {{#isState}}selected{{/isState}}>{{ name }}</option>
{{/state}}
</select>
</div>
<div>
<label for="apibundle_pshive_harvest" class="required">Récolte</label>
......
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