@osfarm/itineraire-technique 1.1.9 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- .main-header{background-color:green;color:#fff;height:3rem;display:flex;align-items:center}.editor-view{overflow-y:auto;height:calc(100vh - 4rem)}.rotation_item .step-edit{color:#878787;cursor:pointer;display:none;margin-left:10px;font-size:70%;vertical-align:super}.rotation_item:hover .step-edit{display:inline !important}.welcome-view{background-color:#a9e9a9;color:green;padding:1rem;margin-top:1rem;border-radius:1rem}.card-white{background-color:#fff;padding:1rem;border-radius:1rem}.card-holder{background-color:#f5f5f5;padding:1rem;border-radius:1rem;margin:auto}.editable-row{background-color:#f7f7f7;min-height:3rem;display:flex;align-items:center;border-radius:.5rem}.editable-row .edit-buttons{visibility:hidden}.editable-row:hover>.edit-buttons{visibility:visible}.intervention-row{background:#e0e0e0}.primary-button{color:#fff;background-color:green;border:green}.primary-button:hover{background-color:#026602}.close-step-times{background:none;border:none;color:#878787;font-size:120%}.close-step-times:hover{color:#494949}#cropsContainer .drag-handle{color:#ccc;font-weight:normal;font-size:86%;margin-right:10px;vertical-align:middle;cursor:grab}.form-control.text-right{text-align:right}/*# sourceMappingURL=styles-editor.css.map */
1
+ .main-header{background-color:#6fa76f;color:#fff;height:3rem;display:flex;align-items:center}.main-header .btn.show,.main-header .btn:first-child:active,.main-header :not(.btn-check)+.btn:active{background-color:#026602}.editor-view{overflow-y:auto;height:calc(100vh - 4rem)}.rotation_item .step-edit{color:#878787;cursor:pointer;display:none;margin-left:10px;font-size:70%;vertical-align:super}.rotation_item:hover .step-edit{display:inline !important}.welcome-view{background-color:#6fa76f;color:#fff;padding:1rem;margin-top:1rem;border-radius:1rem}.welcome-view #cropsContainer{color:green}.card-white{background-color:#fff;padding:1rem;border-radius:1rem}.card-holder{background-color:#f5f5f5;padding:1rem;border-radius:1rem;margin:auto}.editable-row{background-color:#f7f7f7;min-height:3rem;display:flex;align-items:center;border-radius:.5rem}.editable-row .edit-buttons{visibility:hidden}.editable-row:hover>.edit-buttons{visibility:visible}.intervention-row{background:#e0e0e0}.primary-button{color:#fff;background-color:green;border:green}.primary-button:hover{background-color:#026602}.close-step-times{background:none;border:none;color:#878787;font-size:120%}.close-step-times:hover{color:#494949}#cropsContainer .drag-handle{color:#ccc;font-weight:normal;font-size:86%;margin-right:10px;vertical-align:middle;cursor:grab}.form-control.text-right{text-align:right}.modal .form-label{font-weight:600}/*# sourceMappingURL=styles-editor.css.map */
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../scss/styles-editor.scss"],"names":[],"mappings":"AAKA,aACI,uBACA,WACA,OALY,KAOZ,aACA,mBAGJ,aACI,gBAGA,0BAKA,0BACI,cACA,eACA,aACA,iBACA,cACA,qBAGJ,gCACI,0BAIR,cACI,yBACA,YACA,aACA,gBACA,mBAGJ,YACI,sBACA,aACA,mBAGJ,aACI,yBACA,aACA,mBACA,YAGJ,cACI,yBACA,gBAEA,aACA,mBAEA,oBAEA,4BACI,kBAGJ,kCACI,mBAIR,kBACI,mBAGJ,gBACI,MA/EgB,KAgFhB,iBAlFW,MAmFX,OAnFW,MAqFX,sBACI,iBArFa,QA0FrB,kBACI,gBACA,YACA,cACA,eAEA,wBACI,cAIR,6BACI,WACA,mBACA,cACA,kBACA,sBACA,YAIA,yBACI","file":"styles-editor.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../scss/styles-editor.scss"],"names":[],"mappings":"AAKA,aACI,yBACA,WACA,OALY,KAOZ,aACA,mBAEA,sGACI,yBAIR,aACI,gBAGA,0BAKA,0BACI,cACA,eACA,aACA,iBACA,cACA,qBAGJ,gCACI,0BAIR,cACI,yBACA,WACA,aACA,gBACA,mBAEA,8BACI,YAIR,YACI,sBACA,aACA,mBAGJ,aACI,yBACA,aACA,mBACA,YAGJ,cACI,yBACA,gBAEA,aACA,mBAEA,oBAEA,4BACI,kBAGJ,kCACI,mBAIR,kBACI,mBAGJ,gBACI,MAvFgB,KAwFhB,iBA1FW,MA2FX,OA3FW,MA6FX,sBACI,iBA7Fa,QAiGrB,kBACI,gBACA,YACA,cACA,eAEA,wBACI,cAIR,6BACI,WACA,mBACA,cACA,kBACA,sBACA,YAIA,yBACI,iBAKJ,mBACI","file":"styles-editor.css"}
@@ -1 +1 @@
1
- div.mainITKContainer{container-type:inline-size;container-name:myparent;line-height:1rem}div.mainITKContainer .left-transcript{display:none;width:50%;font-family:Segoe UI}div.mainITKContainer .chart-div{width:100%}div.mainITKContainer .bottom-transcript{display:none}div.mainITKContainer.withTranscript .bottom-transcript{display:block;font-family:Segoe UI}@container myparent (min-width: 800px){div.mainITKContainer.withTranscript .left-transcript{display:block}div.mainITKContainer.withTranscript .chart-div{width:50%}div.mainITKContainer.withTranscript .bottom-transcript{display:none}}@container myparent (min-width: 1200px){div.mainITKContainer.withTranscript .left-transcript{display:block;width:40%}div.mainITKContainer.withTranscript .chart-div{width:60%}div.mainITKContainer.withTranscript .bottom-transcript{display:none}}div.mainITKContainer div.rotation_item{background-color:#f8fafc;border-left:#fff 14px solid;border-radius:7px;padding:8px 3px 5px 9px;margin:12px 0;overflow-x:hidden}div.mainITKContainer div.rotation_item.highlighted{box-shadow:0px 4px 4px 0px var(--UI-Shadow, rgba(17, 36, 69, 0.16)),0px 1px 16px 0px var(--UI-Shadow, rgba(17, 36, 69, 0.16));background-color:#f0f3f5}div.mainITKContainer div.rotation_item div.step-header h4{margin-bottom:0;margin-top:0}div.mainITKContainer div.rotation_item div.step-header div.step_dates{font-size:11px;background-color:#cdcccc;color:#fff;margin:5px;padding:2px 5px;border-radius:5px;height:20px;float:right}div.mainITKContainer div.rotation_item div.step-header div.collapse-button{border-radius:50%;width:30px;height:30px;text-align:center;padding:5px 0px;margin:0 5px 3px 0;cursor:pointer;background:#dfe6f7;color:#7a8bad;float:right;transition:transform .3s ease-in-out}div.mainITKContainer div.rotation_item .step_description{clear:both}div.mainITKContainer div.rotation_item.show-all div.collapse-button{transform:rotate(180deg)}div.mainITKContainer div.rotation_item.show-all div.details{max-height:10000px}div.mainITKContainer div.rotation_item div.details{max-height:0px;overflow:hidden;transition:max-height .3s ease-in-out}div.mainITKContainer div.rotation_item div.details div.intervention{background-color:#fff;border-radius:5px;margin-bottom:11px;padding:13px;cursor:pointer}div.mainITKContainer div.rotation_item div.details div.intervention span.intervention_title{font-weight:bold}div.mainITKContainer div.rotation_item div.details div.intervention span.intervention_date{color:#707070;background-color:#f0f3f5;float:right}div.mainITKContainer div.rotation_item div.details div.intervention div.intervention_description{margin-top:5px}div.mainITKContainer div.rotation_item .step-edit{display:none}div.mainITKContainer .charts{width:100%;height:500px;display:inline-block}div.mainITKContainer .transcript{font-size:80%;width:100%;max-height:450px;overflow-y:scroll;scroll-behavior:smooth;padding:3px}.rotation-tooltip{max-width:400px}/*# sourceMappingURL=styles-rendering.css.map */
1
+ div.mainITKContainer{container-type:inline-size;container-name:myparent;line-height:1rem}div.mainITKContainer .left-transcript{display:none;width:50%;font-family:Segoe UI}div.mainITKContainer .chart-div{width:100%}div.mainITKContainer .bottom-transcript{display:none}div.mainITKContainer.withTranscript .bottom-transcript{display:block;font-family:Segoe UI}@container myparent (min-width: 800px){div.mainITKContainer.withTranscript .left-transcript{display:block}div.mainITKContainer.withTranscript .chart-div{width:50%}div.mainITKContainer.withTranscript .bottom-transcript{display:none}}@container myparent (min-width: 1000px){div.mainITKContainer.withTranscript .left-transcript{display:block;width:40%}div.mainITKContainer.withTranscript .chart-div{width:60%}div.mainITKContainer.withTranscript .bottom-transcript{display:none}}div.mainITKContainer div.rotation_item{background-color:#f8fafc;border-left:#fff 14px solid;border-radius:7px;padding:8px 3px 5px 9px;margin:12px 0;overflow-x:hidden}div.mainITKContainer div.rotation_item.highlighted{box-shadow:0px 4px 4px 0px var(--UI-Shadow, rgba(17, 36, 69, 0.16)),0px 1px 16px 0px var(--UI-Shadow, rgba(17, 36, 69, 0.16));background-color:#f0f3f5}div.mainITKContainer div.rotation_item div.step-header h4{font-size:20px;margin-bottom:0;margin-top:0}div.mainITKContainer div.rotation_item div.step-header div.step_dates{font-size:11px;background-color:#cdcccc;color:#000;margin:5px;padding:2px 5px;border-radius:5px;height:20px;float:right}div.mainITKContainer div.rotation_item div.step-header div.collapse-button{border-radius:50%;width:30px;height:30px;text-align:center;padding:5px 0px;margin:0 5px 3px 0;cursor:pointer;background:#dfe6f7;color:#7a8bad;float:right;transition:transform .3s ease-in-out}div.mainITKContainer div.rotation_item .step_description{clear:both}div.mainITKContainer div.rotation_item.show-all div.collapse-button{transform:rotate(180deg)}div.mainITKContainer div.rotation_item.show-all div.details{max-height:10000px}div.mainITKContainer div.rotation_item div.details{max-height:0px;overflow:hidden;transition:max-height .3s ease-in-out}div.mainITKContainer div.rotation_item div.details div.intervention{background-color:#fff;border-radius:5px;margin-bottom:11px;padding:13px;cursor:pointer}div.mainITKContainer div.rotation_item div.details div.intervention span.intervention_title{font-weight:bold}div.mainITKContainer div.rotation_item div.details div.intervention span.intervention_date{color:#707070;background-color:#f0f3f5;float:right}div.mainITKContainer div.rotation_item div.details div.intervention div.intervention_description{margin-top:5px}div.mainITKContainer div.rotation_item .step-edit{display:none}div.mainITKContainer .charts{width:100%;height:500px;display:inline-block}div.mainITKContainer .transcript{font-size:80%;width:100%;max-height:450px;overflow-y:scroll;scroll-behavior:smooth;padding:3px}.rotation-tooltip{max-width:400px;text-align:left}.rotation-tooltip div.step_dates{font-size:9px;background-color:#cdcccc;color:#000;margin:5px;padding:0px 5px;border-radius:5px;float:right}/*# sourceMappingURL=styles-rendering.css.map */
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../scss/styles-rendering.scss"],"names":[],"mappings":"AAAA,qBACI,2BACA,wBACA,iBAEA,sCACI,aACA,UACA,qBAGJ,gCACI,WAGJ,wCACI,aAIA,uDACI,cACA,qBAIR,uCAEQ,qDACI,cAGJ,+CACI,UAGJ,uDACI,cAKZ,wCAEQ,qDACI,cACA,UAGJ,+CACI,UAGJ,uDACI,cAKZ,uCACI,yBACA,4BACA,kBACA,wBACA,cACA,kBAEA,mDACI,8HAEA,yBAIA,0DACI,gBACA,aAGJ,sEACI,eACA,yBACA,WACA,WACA,gBACA,kBACA,YACA,YAGJ,2EACI,kBACA,WACA,YACA,kBACA,gBACA,mBACA,eACA,mBACA,cACA,YACA,qCAIR,yDACI,WAIA,oEACI,yBAGJ,4DACI,mBAKR,mDACI,eACA,gBACA,sCAEA,oEACI,sBACA,kBACA,mBACA,aACA,eAEA,4FACI,iBAGJ,2FACI,cACA,yBACA,YAGJ,iGACI,eAKZ,kDACI,aAIR,6BACI,WACA,aACA,qBAGJ,iCACI,cACA,WACA,iBACA,kBACA,uBACA,YAIR,kBACI","file":"styles-rendering.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../scss/styles-rendering.scss"],"names":[],"mappings":"AAAA,qBACI,2BACA,wBACA,iBAEA,sCACI,aACA,UACA,qBAGJ,gCACI,WAGJ,wCACI,aAIA,uDACI,cACA,qBAIR,uCAEQ,qDACI,cAGJ,+CACI,UAGJ,uDACI,cAKZ,wCAEQ,qDACI,cACA,UAGJ,+CACI,UAGJ,uDACI,cAKZ,uCACI,yBACA,4BACA,kBACA,wBACA,cACA,kBAEA,mDACI,8HAEA,yBAIA,0DACI,eACA,gBACA,aAGJ,sEACI,eACA,yBACA,WACA,WACA,gBACA,kBACA,YACA,YAGJ,2EACI,kBACA,WACA,YACA,kBACA,gBACA,mBACA,eACA,mBACA,cACA,YACA,qCAIR,yDACI,WAIA,oEACI,yBAGJ,4DACI,mBAKR,mDACI,eACA,gBACA,sCAEA,oEACI,sBACA,kBACA,mBACA,aACA,eAEA,4FACI,iBAGJ,2FACI,cACA,yBACA,YAGJ,iGACI,eAKZ,kDACI,aAIR,6BACI,WACA,aACA,qBAGJ,iCACI,cACA,WACA,iBACA,kBACA,uBACA,YAIR,kBACI,gBACA,gBAEA,iCACI,cACA,yBACA,WACA,WACA,gBACA,kBACA","file":"styles-rendering.css"}
package/editor.html CHANGED
@@ -1,5 +1,5 @@
1
1
  <!doctype html>
2
- <html lang="en">
2
+ <html lang="fr">
3
3
 
4
4
  <head>
5
5
  <meta charset="utf-8">
@@ -35,23 +35,46 @@
35
35
  <div class="container-fluid">
36
36
  <div class="row">
37
37
  <div class="col-auto text-left main-header file-icons mb-2">
38
- <button type="button" onclick="importFromJsonFile()" class="btn btn-outline-primary primary-button"
39
- id="importFromJsonButton"><i class="fa fa-upload" aria-hidden="true"></i> Charger (JSON)</button>
40
- <button type="button" onclick="importFromTestJson()" class="btn btn-outline-primary primary-button"
41
- id="importFromExampleJsonButton"><i class="fa fa-upload" aria-hidden="true"></i> Charger un
42
- exemple</button>
43
- <button type="button" onclick="exportToJsonFile(crops)"
44
- class="btn btn-outline-primary primary-button" id="exportToJsonButton"><i
45
- class="fa fa-download" aria-hidden="true"></i> Exporter</button>
46
- <button type="button" onclick="wipe(crops)" class="btn btn-outline-primary primary-button"
47
- id="exportToJsonButton"><i class="fa fa-trash" aria-hidden="true"></i> Tout effacer</button>
38
+ <div id="WikiButtons" class="d-none">
39
+ <div class="btn-group me-2" role="group">
40
+ <button type="button" class="btn btn-outline-primary primary-button" onclick="loadFromWiki()"><i class="fa fa-upload" aria-hidden="true"></i> Charger une rotation</a></button>
41
+ <button type="button" class="btn btn-outline-primary primary-button dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
42
+ <span class="visually-hidden">Autres options de chargement</span>
43
+ </button>
44
+ <ul class="dropdown-menu">
45
+ <li><a class="dropdown-item" href="#" onclick="importFromTestJson()"><i class="fa fa-lightbulb-o" aria-hidden="true"></i> Charger un exemple</a></li>
46
+ <li><a class="dropdown-item" href="#" onclick="importFromJsonFile()"><i class="fa fa-upload" aria-hidden="true"></i> Importer (JSON)</a></li>
47
+ </ul>
48
+ </div><div class="btn-group me-2" role="group">
49
+ <button type="button" onclick="saveToWiki()" class="btn btn-outline-primary primary-button"><i class="fa fa-download" aria-hidden="true"></i> Enregistrer dans le wiki</button>
50
+ <button type="button" class="btn btn-outline-primary primary-button dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
51
+ <span class="visually-hidden">Autres options de chargement</span>
52
+ </button>
53
+ <ul class="dropdown-menu">
54
+ <li><a class="dropdown-item" href="#" onclick="exportToJsonFile()"><i class="fa fa-download" aria-hidden="true"></i> Exporter</a></li>
55
+ </ul>
56
+ </div>
57
+ </div>
58
+ <div id="NonWikiButtons" class="">
59
+ <div class="btn-group me-2" role="group">
60
+ <button type="button" class="btn btn-outline-primary primary-button" onclick="importFromJsonFile()"><i class="fa fa-upload" aria-hidden="true"></i> Charger une rotation</a></button>
61
+ <button type="button" class="btn btn-outline-primary primary-button dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
62
+ <span class="visually-hidden">Autres options de chargement</span>
63
+ </button>
64
+ <ul class="dropdown-menu">
65
+ <li><a class="dropdown-item" href="#" onclick="importFromTestJson()"><i class="fa fa-lightbulb-o" aria-hidden="true"></i> Charger un exemple</a></li>
66
+ </ul>
67
+ </div><button type="button" onclick="exportToJsonFile()" class="btn btn-outline-primary primary-button me-2"><i class="fa fa-download" aria-hidden="true"></i> Exporter (JSON)</button>
68
+ </div>
69
+
70
+ <button type="button" onclick="wipe(crops)" class="btn btn-outline-primary primary-button"><i class="fa fa-trash" aria-hidden="true"></i> Tout effacer</button>
48
71
  </div>
49
72
  <div class="col text-center main-header mb-2">
50
73
  <h1 id="title" contenteditable="true" style="width: 100%">Itinéraire technique</h1>
51
74
  </div>
52
75
  <div class="col-auto text-right main-header file-icons mb-2">
53
76
  <button type="button" class="btn btn-outline-primary primary-button"
54
- id="exportToJsonButton" data-bs-toggle="modal" data-bs-target="#modalParams"><i class="fa fa-cog" aria-hidden="true"></i> Réglages</button>
77
+ data-bs-toggle="modal" data-bs-target="#modalParams"><i class="fa fa-cog" aria-hidden="true"></i> Réglages</button>
55
78
  </div>
56
79
  </div>
57
80
  <div class="row">
@@ -225,6 +248,29 @@
225
248
  </div>
226
249
  </div>
227
250
 
251
+ <!-- Wiki Files Modal -->
252
+ <div class="modal fade" id="wikiFilesModal" tabindex="-1" aria-labelledby="wikiFilesModalLabel" aria-hidden="true">
253
+ <div class="modal-dialog modal-lg">
254
+ <div class="modal-content">
255
+ <div class="modal-header">
256
+ <h5 class="modal-title" id="wikiFilesModalLabel">Charger depuis le wiki</h5>
257
+ <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
258
+ </div>
259
+ <div class="modal-body">
260
+ <div id="wikiFilesStatus" class="mb-3">
261
+ <i class="fa fa-spinner fa-spin"></i> Chargement de vos fichiers...
262
+ </div>
263
+ <div id="wikiFilesList" class="list-group">
264
+ <!-- Files will be populated here -->
265
+ </div>
266
+ </div>
267
+ <div class="modal-footer">
268
+ <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
269
+ </div>
270
+ </div>
271
+ </div>
272
+ </div>
273
+
228
274
  <!-- Modal -->
229
275
  <div class="modal fade" id="modalParams" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
230
276
  <div class="modal-dialog">
@@ -235,33 +281,88 @@
235
281
  </div>
236
282
  <div class="modal-body">
237
283
  <form>
238
- <div class="mb-3">
239
- <label for="regionInput" class="form-label">Région</label>
240
- <input type="text" class="form-control" id="regionInput" value="France">
241
- </div>
242
- <div class="mb-3">
243
- <label for="viewSelect" class="form-label">Affichage par défaut</label>
244
- <select class="form-select" id="viewSelect">
245
- <option value="horizontal">En frise</option>
246
- <option value="vertical">En donut</option>
247
- </select>
248
- </div>
249
- <div class="mb-3 form-check">
250
- <input type="checkbox" class="form-check-input" id="showTranscriptCheckbox" checked>
251
- <label class="form-check-label" for="showTranscriptCheckbox">Afficher la transcription textuelle</label>
252
- </div>
253
- <div class="mb-3">
254
- <label for="topInterventionsTitle" class="form-label">Titre des interventions du haut</label>
255
- <input type="text" class="form-control" id="topInterventionsTitle" value="Contrôle adventices">
256
- </div>
257
- <div class="mb-3">
258
- <label for="bottomInterventionsTitle" class="form-label">Titre des interventions du bas</label>
259
- <input type="text" class="form-control" id="bottomInterventionsTitle" value="Autres interventions">
260
- </div>
261
- <div class="mb-3">
262
- <label for="stepsTitle" class="form-label">Titre des étapes de la rotation</label>
263
- <input type="text" class="form-control" id="stepsTitle" value="Étapes de la rotation dans la parcelle">
284
+ <!-- Tabs navigation -->
285
+ <ul class="nav nav-tabs" id="paramsTabs" role="tablist">
286
+ <li class="nav-item" role="presentation">
287
+ <button class="nav-link active" id="general-tab" data-bs-toggle="tab" data-bs-target="#generalTab" type="button" role="tab" aria-controls="generalTab" aria-selected="true">Réglages généraux</button>
288
+ </li>
289
+ <li class="nav-item" role="presentation">
290
+ <button class="nav-link" id="context-tab" data-bs-toggle="tab" data-bs-target="#contextTab" type="button" role="tab" aria-controls="contextTab" aria-selected="false">Contexte de la parcelle</button>
291
+ </li>
292
+ </ul>
293
+
294
+ <!-- Tabs content -->
295
+ <div class="tab-content pt-3" id="paramsTabsContent">
296
+ <!-- General settings -->
297
+ <div class="tab-pane fade show active" id="generalTab" role="tabpanel" aria-labelledby="general-tab">
298
+ <div class="mb-3">
299
+ <label for="viewSelect" class="form-label">Affichage par défaut</label>
300
+ <select class="form-select" id="viewSelect">
301
+ <option value="horizontal">En frise</option>
302
+ <option value="vertical">En donut</option>
303
+ </select>
304
+ </div>
305
+ <div class="mb-3 form-check">
306
+ <input type="checkbox" class="form-check-input" id="showTranscriptCheckbox" checked>
307
+ <label class="form-check-label" for="showTranscriptCheckbox">Afficher la transcription textuelle</label>
308
+ </div>
309
+ <div class="mb-3">
310
+ <label for="topInterventionsTitle" class="form-label">Titre des interventions du haut</label>
311
+ <input type="text" class="form-control" id="topInterventionsTitle" value="Contrôle adventices">
312
+ </div>
313
+ <div class="mb-3">
314
+ <label for="bottomInterventionsTitle" class="form-label">Titre des interventions du bas</label>
315
+ <input type="text" class="form-control" id="bottomInterventionsTitle" value="Autres interventions">
316
+ </div>
317
+ <div class="mb-3">
318
+ <label for="stepsTitle" class="form-label">Titre des étapes de la rotation</label>
319
+ <input type="text" class="form-control" id="stepsTitle" value="Étapes de la rotation dans la parcelle">
320
+ </div>
321
+ </div>
322
+
323
+ <!-- Plot context -->
324
+ <div class="tab-pane fade" id="contextTab" role="tabpanel" aria-labelledby="context-tab">
325
+ <div class="mb-3">
326
+ <label for="regionInput" class="form-label">Région</label>
327
+ <input type="text" class="form-control" id="regionInput" value="France">
328
+ </div>
329
+ <div class="mb-3">
330
+ <label for="addressInput" class="form-label">Adresse</label>
331
+ <div class="input-group">
332
+ <input type="text" class="form-control" id="addressInput" placeholder="Adresse de la parcelle">
333
+ <button class="btn btn-outline-primary" type="button" id="searchLocationBtn">
334
+ <i class="fa fa-search"></i> Rechercher
335
+ </button>
336
+ </div>
337
+ <div id="locationSearchStatus" class="form-text"></div>
338
+ </div>
339
+ <div class="row">
340
+ <div class="col-md-6 mb-3">
341
+ <label for="latitudeInput" class="form-label">Latitude</label>
342
+ <input type="text" class="form-control" id="latitudeInput" placeholder="Ex: 48.8566">
343
+ </div>
344
+ <div class="col-md-6 mb-3">
345
+ <label for="longitudeInput" class="form-label">Longitude</label>
346
+ <input type="text" class="form-control" id="longitudeInput" placeholder="Ex: 2.3522">
347
+ </div>
348
+ </div>
349
+ <div id="googleMapsLink" class="mb-3" style="display: none;">
350
+ <a href="#" target="_blank" class="small text-primary">
351
+ <i class="fa fa-map-marker"></i> Voir sur Google Maps
352
+ </a>
353
+ </div>
354
+ <div class="mb-3 form-check">
355
+ <input type="checkbox" class="form-check-input" id="ombroCheck">
356
+ <label class="form-check-label" for="ombroCheck">Intégrer un diagramme ombrothermique</label>
357
+ </div>
358
+ <div class="mb-3">
359
+ <label for="ombroData" class="form-label">De janvier à décembre, séparé par des espaces<br>(ligne 1: températures en °C, ligne 2: précipitations en mm)</label>
360
+ <textarea class="form-control" id="ombroData" rows="2" placeholder="7.5 7.3 8.9 10.8 13.4 16.4 17.8 18.0 16.7 14.5 11.0 8.3&#10;82 60 54 50 52 32 38 33 56 77 78 85"></textarea>
361
+ <div class="form-text">Entrez deux lignes séparées par un retour à la ligne</div>
362
+ </div>
363
+ </div>
264
364
  </div>
365
+
265
366
  </form>
266
367
  </div>
267
368
  <div class="modal-footer">
@@ -293,6 +394,7 @@
293
394
  };
294
395
 
295
396
  let selectedStep; // an instance of Crop
397
+ let we; // WikiEditor instance
296
398
 
297
399
  initializeOptions();
298
400
 
@@ -379,6 +481,111 @@
379
481
  $("#bottomInterventionsTitle").val(crops.options.title_bottom_interventions);
380
482
  $("#stepsTitle").val(crops.options.title_steps);
381
483
  $("#regionInput").val(crops.options.region ?? "France");
484
+ $("#addressInput").val(crops.options.address ?? "");
485
+ $("#latitudeInput").val(crops.options.latitude ?? "");
486
+ $("#longitudeInput").val(crops.options.longitude ?? "");
487
+
488
+ // Load ombrothermic data from climate_data if present
489
+ let hasClimateData = crops.options.climate_data &&
490
+ crops.options.climate_data.temperatures &&
491
+ crops.options.climate_data.precipitations;
492
+
493
+ // Check the checkbox if show_climate_diagram is explicitly true OR if climate_data exists
494
+ let showDiagram = crops.options.show_climate_diagram === true;
495
+ $("#ombroCheck").prop("checked", showDiagram);
496
+
497
+ if (hasClimateData) {
498
+ let tempLine = crops.options.climate_data.temperatures.join(' ');
499
+ let precipLine = crops.options.climate_data.precipitations.join(' ');
500
+ $("#ombroData").val(tempLine + '\n' + precipLine);
501
+ } else {
502
+ $("#ombroData").val("");
503
+ }
504
+
505
+ // Enable/disable textarea based on checkbox state
506
+ $("#ombroData").prop("disabled", !showDiagram);
507
+ });
508
+
509
+ // Add event listener to toggle textarea when checkbox changes
510
+ $("#ombroCheck").on("change", function() {
511
+ $("#ombroData").prop("disabled", !this.checked);
512
+ });
513
+
514
+ // Update Google Maps link when coordinates change
515
+ function updateGoogleMapsLink() {
516
+ const lat = $("#latitudeInput").val().trim();
517
+ const lon = $("#longitudeInput").val().trim();
518
+
519
+ if (lat && lon && !isNaN(parseFloat(lat)) && !isNaN(parseFloat(lon))) {
520
+ const mapsUrl = `https://www.google.com/maps?q=${lat},${lon}`;
521
+ $("#googleMapsLink a").attr("href", mapsUrl);
522
+ $("#googleMapsLink").show();
523
+ } else {
524
+ $("#googleMapsLink").hide();
525
+ }
526
+ }
527
+
528
+ // Attach listeners to lat/long inputs
529
+ $("#latitudeInput, #longitudeInput").on("input change", updateGoogleMapsLink);
530
+
531
+ // Update link when modal opens
532
+ $('#modalParams').on('shown.bs.modal', function() {
533
+ updateGoogleMapsLink();
534
+ });
535
+
536
+ // Location search button handler
537
+ $("#searchLocationBtn").on("click", function() {
538
+ const address = $("#addressInput").val().trim();
539
+
540
+ if (!address) {
541
+ $("#locationSearchStatus").html('<span class="text-warning">Veuillez entrer une adresse</span>');
542
+ return;
543
+ }
544
+
545
+ // Show loading state
546
+ $("#searchLocationBtn").prop("disabled", true);
547
+ $("#locationSearchStatus").html('<i class="fa fa-spinner fa-spin"></i> Recherche en cours...');
548
+
549
+ $.ajax({
550
+ url: "https://itk-info.tripleperformance.fr/api/location",
551
+ method: "POST",
552
+ contentType: "application/json",
553
+ data: JSON.stringify({ address: address }),
554
+ success: function(data) {
555
+ console.log("Location data received:", data);
556
+
557
+ // Populate latitude and longitude
558
+ if (data.latitude && data.longitude) {
559
+ $("#latitudeInput").val(data.latitude);
560
+ $("#longitudeInput").val(data.longitude);
561
+ updateGoogleMapsLink();
562
+ }
563
+
564
+ // Populate climate data if available
565
+ if (data.monthly_temperatures && data.monthly_rainfall) {
566
+ let tempLine = data.monthly_temperatures.join(' ');
567
+ let precipLine = data.monthly_rainfall.join(' ');
568
+ $("#ombroData").val(tempLine + '\n' + precipLine);
569
+ $("#ombroCheck").prop("checked", true);
570
+ $("#ombroData").prop("disabled", false);
571
+ }
572
+
573
+ // Show success message
574
+ let message = '<span class="text-success">✓ Coordonnées trouvées';
575
+ if (data.source_explanation) {
576
+ message += ' — ' + data.source_explanation;
577
+ }
578
+ message += '</span>';
579
+ $("#locationSearchStatus").html(message);
580
+ },
581
+ error: function(err) {
582
+ console.error("Location search error:", err);
583
+ $("#locationSearchStatus").html('<span class="text-danger">Erreur lors de la recherche</span>');
584
+ },
585
+ complete: function() {
586
+ $("#searchLocationBtn").prop("disabled", false);
587
+ }
588
+ });
382
589
  });
383
590
 
384
591
  $("#paramsModalSaveButton").click(function () {
@@ -388,6 +595,37 @@
388
595
  crops.options.title_bottom_interventions = $("#bottomInterventionsTitle").val();
389
596
  crops.options.title_steps = $("#stepsTitle").val();
390
597
  crops.options.region = $("#regionInput").val();
598
+ crops.options.address = $("#addressInput").val().trim();
599
+ crops.options.latitude = $("#latitudeInput").val().trim();
600
+ crops.options.longitude = $("#longitudeInput").val().trim();
601
+
602
+ // Convert ombrothermic data to climate_data object
603
+ let ombroEnabled = $("#ombroCheck").prop("checked");
604
+
605
+ if (ombroEnabled) {
606
+ crops.options.show_climate_diagram = true;
607
+
608
+ let ombroText = $("#ombroData").val().trim();
609
+ let lines = ombroText.split('\n');
610
+
611
+ if (lines.length >= 2) {
612
+ let temperatures = lines[0].trim().split(/\s+/).map(v => parseFloat(v)).filter(v => !isNaN(v));
613
+ let precipitations = lines[1].trim().split(/\s+/).map(v => parseFloat(v)).filter(v => !isNaN(v));
614
+
615
+ if (temperatures.length > 0 && precipitations.length > 0) {
616
+ crops.options.climate_data = {
617
+ temperatures: temperatures,
618
+ precipitations: precipitations
619
+ };
620
+ } else {
621
+ delete crops.options.climate_data;
622
+ }
623
+ } else {
624
+ delete crops.options.climate_data;
625
+ }
626
+ } else {
627
+ crops.options.show_climate_diagram = false;
628
+ }
391
629
 
392
630
  // Close the modal:
393
631
  let modal = bootstrap.Modal.getInstance(document.getElementById('modalParams'));
@@ -395,8 +633,41 @@
395
633
 
396
634
  refreshAllTables();
397
635
  });
636
+ }
637
+
638
+ // On page load, create WikiEditor instance
639
+ $(document).ready(function() {
640
+
641
+ // If we are in a wiki (the domain contains "tripleperformance.ag or tripleperformance.fr" then show the Wiki buttons
642
+ if (window.location.hostname.includes("tripleperformance.ag") || window.location.hostname.includes("tripleperformance.fr")) {
643
+ document.getElementById("WikiButtons").classList.remove("d-none");
644
+ document.getElementById("NonWikiButtons").classList.add("d-none");
645
+
646
+ we = new WikiEditor();
647
+ we.loadPageFromURL();
648
+ } else {
649
+ document.getElementById("WikiButtons").classList.add("d-none");
650
+ document.getElementById("NonWikiButtons").classList.remove("d-none");
651
+ }
652
+ });
398
653
 
399
- let we = new WikiEditor();
654
+ // Global wrapper function for loadFromWiki
655
+ function loadFromWiki() {
656
+ if (typeof we !== 'undefined') {
657
+ showConfirmationModal(() => {
658
+ we.loadFromWiki();
659
+ });
660
+ } else {
661
+ console.error('WikiEditor instance not available');
662
+ }
663
+ }
664
+
665
+ function saveToWiki() {
666
+ if (typeof we !== 'undefined') {
667
+ we.saveToWiki();
668
+ } else {
669
+ console.error('WikiEditor instance not available');
670
+ }
400
671
  }
401
672
 
402
673
  class StepModel {