Marthee commited on
Commit
e3e0aa7
·
verified ·
1 Parent(s): 961ad20

Upload tableDetection.html

Browse files
Files changed (1) hide show
  1. templates/tableDetection.html +1556 -0
templates/tableDetection.html ADDED
@@ -0,0 +1,1556 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en" dir="ltr">
3
+ <head>
4
+
5
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
6
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet"/>
7
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script>
8
+ <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
9
+
10
+
11
+
12
+ <link rel="stylesheet" href="https://use.typekit.net/zos0ars.css">
13
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
14
+ <link rel="stylesheet" href="static/style.css">
15
+ <link rel="stylesheet" href="static/MenuStyle.css">
16
+ <link rel="stylesheet" href="static/LegendPageStyle.css">
17
+ <link rel="stylesheet" href="static/popups.css">
18
+ <link rel="stylesheet" href="static/IMG-Larger.css">
19
+ <link rel="stylesheet" href="static/searchButton.css">
20
+ <meta charset="utf-8">
21
+ <title>ADR Console</title>
22
+ <link rel = "icon" type = "image/png" sizes = "180x154" href = "static/images/TSAlogoCropped180x154.png">
23
+ <link rel = "icon" type = "image/png" sizes = "32x27" href = "static/images/TSAlogoCropped32x27.png">
24
+ <link rel = "icon" type = "image/png" sizes = "16x14" href = "static/images/TSAlogoCropped16x14.png">
25
+ <link rel = "mask-icon" href = "static/images/TSAlogoCropped180x154.png">
26
+ <link rel = "shortcut icon" href = "static/images/TSAlogoCropped180x154.png">
27
+
28
+ <script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-core.min.js"></script>
29
+ <script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-sunburst.min.js"></script>
30
+ <script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-data-adapter.min.js"></script>
31
+
32
+
33
+
34
+ </head>
35
+ <body >
36
+ <div id="all">
37
+ {% include 'loading.html' %}
38
+ </div>
39
+ <!--Main tab links-->
40
+ <div class="tab" >
41
+ <div class="container" id="toggle">
42
+ <div class="bar1"></div>
43
+ <div class="bar2"></div>
44
+ <div class="bar3"></div>
45
+ </div>
46
+
47
+ <button class="tablinks" id="pagetitle" onclick="openTab(event, 'home')">ADR Console <i class="fa fa-home" > </i></button>
48
+ <!-- <button class="tablinks" id="LegendHist" onclick="openTab(event, 'legends')">Legends History <i class="fa fa-caret-down"></i></button> -->
49
+ <a class="tablinks" id="LegendHist" href="{{ url_for('legendDirectory') }}">Legends History <i class="fa fa-caret-down"></i></a>
50
+ <button class="dropbtn" onclick="userguideclick()"><img id="infoImg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAAHz0lEQVR4nNVbW0xVVxC9SAEfNPGRCJICGoWKRkUUNfEVFUnsn0ZjfARfAWmq8UNLfSUmxkLxCzDS6kcrDx8/xkeiaFujJia1ifFDRPyw0Fi0xjeliKi4mnU49+bcfeZwufeefaErmYQczt2zZ/bsPbNn5ng8mgFgAoDNAA4B+BnAnwBaYUer+b/L5rv8TYbn/wYA0QCWAKgG8DfCx2NzLI4Z7emvAJAEoNScsC5w7O8AjPL0FwBIAfA9gLeIHDoAHAaQ3JeCxwLYDaA90GyfPn2KM2fOoKSkBOvXr0dOTg6mT5+OjIwMg/g3n23YsMF45+zZs3j27FlvFPEvgG8AxERa+GwAjT3NrL6+HkVFRZg8eTKioqLAnwVD/M2UKVOwc+dO3L17N5AiGgBkRUr4AgCd0izev3+P6upqZGVlBS1wIJo2bRpqamoMHg7gFtwGIEqX4HEATkmcP378iGPHjmHMmDGuC67S2LFjDUWQpwOOc3u6Lf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sptqAAAAABJRU5ErkJggg=="></button>
51
+ </div>
52
+
53
+
54
+ <div id="mySidebar" class="slide-out">
55
+ <div id="menuOptions">
56
+ <li><a href="{{ url_for('measurementConsoleFn') }}">Measure Plans </a></li>
57
+ <li><a href="{{ url_for('searchDocument') }}">Search in Documents</a></li>
58
+ <li onclick=redirectOmarSearch()>Table Detection</li>
59
+
60
+ </div>
61
+ </div>
62
+
63
+ <div id="home" class="tabcontent" >
64
+
65
+ <div id="loading" hidden> </div>
66
+ <form method="post" id="myForm" enctype="multipart/form-data">
67
+
68
+
69
+ <div id ="">
70
+ <select name="selectproj" class="selectionsProj" id="selectionsProjid" required > </select>
71
+ </div>
72
+
73
+ <div id ="projectpart">
74
+ <select name="selectprojp" class="selectionsProjp" id="selectionsProjpid" required> </select>
75
+ </div>
76
+
77
+ <div id ="projectsection">
78
+ <select name="selectprojs" class="selectionsProjs" onchange=getproj() required> </select>
79
+ </div>
80
+
81
+
82
+ <div id ="tomeasurediv">
83
+ <div>
84
+ <label id="measureLabel">Document To Measure</label>
85
+ <input type="search" onkeyup=filterFunction(this.id) id="tomeasureSearchInput">
86
+ <!-- <button id="refreshDropboxButtonID"></button> -->
87
+ <i hidden class="fa fa-dropbox fa-lg" id="refreshDropboxButtonID">
88
+ <span class="dropboxtip">The console updates projects retrieved from Dropbox automatically at 9:00 am and 9:00 p.m. If you need to access any projects in between, just click on this button. Please note that it will refresh the files related to the project you chose only.</span> </i>
89
+
90
+ </div>
91
+ <div id="measureCheckbox">
92
+ <!-- <select style="margin-left: -1%;" hidden name="measureselectname" id="measureselectid" multiple size="5"></select> -->
93
+ <div id="measureContainer" hidden required></div>
94
+ </div>
95
+ </div>
96
+
97
+ <button id="Newtablebutton">Table Detect</button>
98
+
99
+ </form>
100
+
101
+ <!-- <button id="downloadbutton" hidden>Download Tables</button> -->
102
+
103
+ <input type="button" value="Download Tables" id="downloadbutton" style="display: none;" />
104
+
105
+
106
+
107
+
108
+ <div id="progressBar" hidden>
109
+ <div id="progress">0%</div>
110
+ </div>
111
+
112
+ <!-- Modal popup box -->
113
+ <div id="mpopupBox" class="mpopup" name="tobeclosed">
114
+ <!-- Modal content -->
115
+ <div class="modal-content">
116
+ <div class="modal-header">
117
+ <button type="button" class="closeModal" data-dismiss="modal">&times;</button>
118
+ <h2 id="TopTextModal">Error</h2>
119
+ </div>
120
+ <div class="modal-body">
121
+ <p id="modal-bodyText">
122
+ </p>
123
+ <br>
124
+ </div>
125
+
126
+ </div>
127
+ </div>
128
+
129
+ <!-- Modal popup box -->
130
+ <div id="mpopupBox" class="mpopup" name="tobeclosed">
131
+ <!-- Modal content -->
132
+ <div class="modal-content">
133
+ <div class="modal-header">
134
+ <button type="button" class="closeModal" data-dismiss="modal">&times;</button>
135
+ <h2 id="TopTextModal">Error</h2>
136
+ </div>
137
+ <div class="modal-body">
138
+ <p id="modal-bodyText">
139
+ </p>
140
+ <br>
141
+ </div>
142
+
143
+ </div>
144
+ </div>
145
+
146
+ <!-- <div id="loading" hidden> </div> -->
147
+ </div>
148
+ <div id="legends" class="tabcontent">
149
+ <ul class="graynavbarLegend" >
150
+ <label class="label1">Project Name / Project Part / NRM Section /</label> <label class="label2">Legend</label>
151
+ <div class="legendtime">
152
+ <div style="display: inline-flex;">
153
+ <label class="CreatedTime"> Created Time </label>
154
+ <button id="sortBtnCreateDesc" class="sortbutton" onclick="sortlegends(this.id)"><i id="CreatesortDesc" class="fa fa-sort-amount-desc" aria-hidden="true" ></i> </button>
155
+ <button id="sortBtnCreateAsc" class="sortbutton" onclick="sortlegends(this.id)"><i id="CreatesortAsc" class="fa fa-sort-amount-asc" aria-hidden="true" ></i></button>
156
+ </div>
157
+ <div style="display: inline-flex;">
158
+ <label class="EditTime"> Last Edited Time </label>
159
+ <button id="sortBtnEditDesc" class="sortbutton" onclick="sortlegends(this.id)"><i id="EditsortDesc" class="fa fa-sort-amount-desc" aria-hidden="true" ></i></button>
160
+ <button id="sortBtnEditAsc"class="sortbutton" onclick="sortlegends(this.id)"><i id="EditsortAsc" class="fa fa-sort-amount-asc" aria-hidden="true" ></i> </button>
161
+ </div>
162
+ </div>
163
+ </ul>
164
+
165
+ </div>
166
+ <div class="dropdown-content" id="dropdown-contentUserguideId" name="tobeclosed">
167
+ <div id="userguidetext" >
168
+ <div id="UserguideRibbon">
169
+ <label id="UserGuideHeader"> User Guide Text: Before using this tool, kindly read the following carefully. </label>
170
+ <button id="homeguidebutton" style="background-color: transparent; border: none;" onclick="ShowSectionUserguide(this)">
171
+ <i class="fa fa-home fa-lg" id="userguideHome"></i>
172
+ </button>
173
+
174
+ <div class="Userguidecontainer" id="UserGuidetoggle" onclick="userguidetoggleFunction()">
175
+ <div class="UserGuidebar1"></div>
176
+ <div class="UserGuidebar2"></div>
177
+ <div class="UserGuidebar3"></div>
178
+ </div>
179
+
180
+
181
+ <button type="button" class="closeModal" id="userguideClose" data-dismiss="modal">&times;</button>
182
+ <button style="background-color: transparent; border: none;" id="userguideTableMaya" onclick="userguideMayaTableClick()">
183
+ <i class="fa fa-th fa-lg" aria-hidden="true"></i>
184
+ </button>
185
+ <div id="UserGuideSideBar">
186
+ <div id="UserGuidemenuOptions">
187
+ <li onclick="ShowSectionUserguide(this)">1.0 Substructure</li>
188
+ <li onclick="ShowSectionUserguide(this)">2.1 Frames</li>
189
+ <li onclick="ShowSectionUserguide(this)">2.2 Upper Floor</li>
190
+ <li onclick="ShowSectionUserguide(this)">2.3 Roof</li>
191
+ <li onclick="ShowSectionUserguide(this)">2.4 Stairs</li>
192
+ <li onclick="ShowSectionUserguide(this)">2.5 External Walls</li>
193
+ <li onclick="ShowSectionUserguide(this)">2.6 External Openings</li>
194
+ <li onclick="ShowSectionUserguide(this)">2.7 Internal Walls</li>
195
+ <li onclick="ShowSectionUserguide(this)">2.8 Internal Openings</li>
196
+ <li onclick="ShowSectionUserguide(this)">3.1 Wall Finishes</li>
197
+ <li onclick="ShowSectionUserguide(this)">3.2 Floor Finishes</li>
198
+ <li onclick="ShowSectionUserguide(this)">3.3 Ceiling Finishes</li>
199
+ <li onclick="ShowSectionUserguide(this)">4.0 Fittings, Furnishings and Equipments</li>
200
+ <li onclick="ShowSectionUserguide(this)">5.0 Services</li>
201
+ <li onclick="ShowSectionUserguide(this)">5.1 Sanitary</li>
202
+ <li onclick="ShowSectionUserguide(this)">7.0 Works to existing buildings</li>
203
+ <li onclick="ShowSectionUserguide(this)">8.1 Site Preparation Works</li>
204
+ <li onclick="ShowSectionUserguide(this)">8.2 Roads, Paths, Pavings</li>
205
+ <li onclick="ShowSectionUserguide(this)">8.3 Soft Landscaping</li>
206
+ <li onclick="ShowSectionUserguide(this)">8.4 Fencing, Railing, Walls</li>
207
+ <li onclick="ShowSectionUserguide(this)">8.5 External Fixtures</li>
208
+ <li onclick="ShowSectionUserguide(this)">8.6 External Drainage</li>
209
+ <li onclick="ShowSectionUserguide(this)">8.7 External Services</li>
210
+ <li onclick="ShowSectionUserguide(this)">8.8 Minor Buildings</li>
211
+
212
+ </div>
213
+ </div>
214
+ </div>
215
+
216
+
217
+ <div id="textfirstpage">
218
+ <label style="font-weight: bold;">
219
+ After reading this user guide, if you still encounter any issues or have suggestions for improving the system, please don't hesitate to contact the ADR team.
220
+ </label>
221
+ <br>
222
+ <label style="font-style: italic;">
223
+ This page provides general guidance on using the console. For details on a specific section, refer to the menu and select the desired section by clicking the '<i class="fa fa-bars" aria-hidden="true"></i>' icon.
224
+ <br>
225
+ In the top right corner, you will find this icon '<i class="fa fa-th fa-lg" aria-hidden="true"></i>', which, when clicked, takes you to a Google Spreadsheet containing a summarized table of the main AI features implemented and
226
+ planned for the ADR console, along with the sections where they are applied.
227
+ </label>
228
+
229
+
230
+ <br>
231
+ The tool is divided into two main parts:
232
+ <br><br>
233
+ <i class="fa fa-circle" aria-hidden="true"> </i> <label id="userguideheadings"> First Part </label>
234
+ <br>
235
+ <div style="margin-left: 40px;">
236
+ The system automatically refreshes all data retrieved every 5 minutes from the MC including project names, parts, sections, and MC-T names every. However, if you notice missing information, click this button
237
+ <span style="background-color: blue; color: white; padding: 2px 8px; border-radius: 4px; font-style: italic; margin-top: 5px;">Refresh data received from MC</span> to retrieve the latest MC updates.
238
+
239
+ <br>
240
+ <label id="underlinedLables">Inputs: </label>
241
+ <br>
242
+
243
+ <li>
244
+ Use the three dropdown menus to select the project name, part, and section to measure.
245
+ <br>
246
+ <img src="static/images/Dropdowns_3.png" alt="Dropdown menus example" style="margin-top: 10px; width:240px;">
247
+ <label style="font-style: italic; margin-left: -10px; margin-top: 50px;color: #2e83c7;"> Ensure the correct 'Project Section' is selected, as it affects the applied code. </label>
248
+ <br>
249
+ </li>
250
+ <li>
251
+ <label style="font-size: 15px;"> Document To Measure: </label>
252
+ <br>
253
+ Clicking a document's name opens a PDF preview in a separate tab attached to the black ribbon inside the console. Checking the box next to the document selects it as the document to measure.
254
+
255
+ <br>
256
+ <li>
257
+ When retrieving documents for measurement, if multiple files share the same name on Dropbox, a popup may appear. In such cases, please rename the files in Dropbox, then return to the console and click the following icon:
258
+ <i hidden class="fa fa-dropbox" style="color:white; background-color: #2e83c7; border-radius: 4px;"></i> to retrieve the updated documents. You can then select the desired document for measurement. Please note that this process will refresh all documents in the selected project folder.
259
+ </li>
260
+ <br>
261
+ </li>
262
+ After selecting the project, part, section, and file:
263
+ <br>
264
+ 1)Click the Table Detect button. The system will process the PDF and automatically download the resulting Excel file.
265
+ <br>
266
+ 2)If the automatic download does not occur, click Download Table to retrieve the Excel output manually.
267
+ <br>
268
+ 3)The excel sheet contains a column named "page number" which helps in tracing if there any missing cells.
269
+ <br>
270
+ 4)The project works on the approach with a 80% chance success and a 20% chance fail, depending on the quality of the pdf and whether the table conatins any overlaid shape on it.
271
+ <br>
272
+ 5)This Project is made for 4.0 Plans.
273
+
274
+ </div>
275
+
276
+
277
+
278
+ </div>
279
+ </div>
280
+
281
+
282
+ </body>
283
+ </html>
284
+
285
+ <script>
286
+ function userguidetoggleFunction() {
287
+ var dropdownContentUserguideId = document.getElementById("dropdown-contentUserguideId");
288
+ var UserGuideSideBar = document.getElementById('UserGuideSideBar');
289
+ var UserGuidetoggle = document.getElementById('UserGuidetoggle');
290
+
291
+ var isOpen = UserGuideSideBar.style.display === "block";
292
+
293
+ // **Close the dropdown when opening User Guide**
294
+ dropdownContentUserguideId.classList.remove("active");
295
+
296
+ // **Toggle the sidebar visibility properly**
297
+ if (isOpen) {
298
+ UserGuideSideBar.style.display = "none";
299
+ UserGuideSideBar.classList.remove('UserGuideslide-in');
300
+ UserGuideSideBar.classList.add('UserGuideslide-out');
301
+ UserGuidetoggle.classList.remove("change");
302
+ } else {
303
+ UserGuideSideBar.style.display = "block";
304
+ UserGuideSideBar.style.width = "25%";
305
+ UserGuideSideBar.classList.add('UserGuideslide-in');
306
+ UserGuideSideBar.classList.remove('UserGuideslide-out');
307
+ UserGuidetoggle.classList.add("change");
308
+ }
309
+ }
310
+
311
+ function ShowSectionUserguide(element) {
312
+ var textFirstPage = document.getElementById('textfirstpage');
313
+ var UserGuideSideBar = document.getElementById('UserGuideSideBar');
314
+ var UserGuidetoggle = document.getElementById('UserGuidetoggle');
315
+ var isOpen = UserGuideSideBar.style.display === "block";
316
+
317
+
318
+
319
+ // **If clicking home and already on home, only toggle icon**
320
+ if (element.id === 'homeguidebutton' || element.parentElement?.id === 'homeguidebutton') {
321
+ if (textFirstPage.style.display === 'block') {
322
+ return; // Exit function to prevent further toggling
323
+ }
324
+ hideAllSections();
325
+ textFirstPage.style.display = 'block';
326
+ return;
327
+ }
328
+
329
+ // **If clicking a section, hide sidebar and update content**
330
+ if (element.tagName === 'LI') {
331
+ hideAllSections();
332
+ // **Toggle the sidebar visibility properly**
333
+ if (isOpen) {
334
+ UserGuideSideBar.style.display = "none";
335
+ UserGuideSideBar.classList.remove('UserGuideslide-in');
336
+ UserGuideSideBar.classList.add('UserGuideslide-out');
337
+ UserGuidetoggle.classList.remove("change");
338
+ } else {
339
+ UserGuideSideBar.style.display = "block";
340
+ UserGuideSideBar.style.width = "25%";
341
+ UserGuideSideBar.classList.add('UserGuideslide-in');
342
+ UserGuideSideBar.classList.remove('UserGuideslide-out');
343
+ UserGuidetoggle.classList.add("change");
344
+ }
345
+ if (element.textContent.startsWith('4.0')) {
346
+ document.getElementById('4_0UserGuide').style.display = 'block';
347
+ document.getElementById('4_0UserGuide').removeAttribute('hidden');
348
+
349
+ }
350
+ }
351
+ }
352
+
353
+ // Function to hide all sections before showing the selected one
354
+ function hideAllSections() {
355
+ document.getElementById('textfirstpage').style.display = 'none';
356
+ document.getElementById('4_0UserGuide').style.display = 'none';
357
+
358
+ }
359
+
360
+ function userguideclick(){
361
+ document.getElementById('textfirstpage').style.display='block'
362
+ var acc = document.getElementsByClassName("dropdown-content")[0];
363
+ var userguideClose=document.getElementById("userguideClose")
364
+ var i;
365
+ acc.classList.toggle("active");
366
+
367
+ /* Toggle between hiding and showing the active panel */
368
+ if (acc.style.display === "block") {
369
+ acc.style.display = "none";
370
+
371
+ } else {
372
+ acc.style.display = "block";
373
+ acc.style.backgroundColor=(0, 153, 255);
374
+ }
375
+
376
+ close.onclick = function() {
377
+ acc.style.display = "none";
378
+ };
379
+
380
+ }
381
+ function userguideMayaTableClick(){
382
+ var userguideTableMaya=document.getElementById('userguideTableMaya')
383
+ window.open('https://docs.google.com/spreadsheets/d/10TjB8EbSiDHybo9YsDDzekxi8iQECpprXdqptHCZzec/edit?gid=875423041#gid=875423041');
384
+
385
+ }
386
+
387
+ // Start with the first tab open
388
+ document.getElementById("pagetitle").click();
389
+
390
+ var closeButtons = document.querySelectorAll(".closeModal");
391
+ var allCloseDivs = document.getElementsByName("tobeclosed");
392
+
393
+ closeButtons.forEach(function(button) {
394
+ button.addEventListener("click", function() {
395
+ allCloseDivs.forEach(function(div) {
396
+ div.style.display = "none";
397
+ });
398
+ });
399
+ });
400
+
401
+ document.getElementById("myForm").addEventListener("submit", function (e) {
402
+ e.preventDefault(); // Prevent form submission
403
+ let isChecked = document.querySelector('input[name="measureCheckbox"]:checked') !== null;
404
+ // let sectionNumber = projsec.value; // Ensure projsec is defined
405
+ // let isRelvClicked = document.querySelector(".relv-item[style*='background-color']") !== null;
406
+
407
+ let TopTextModal = document.getElementById("TopTextModal");
408
+ TopTextModal.textContent = "Warning: Missing Inputs";
409
+ if (!isChecked){
410
+ PopupElement.textContent = "Please select at least one project from 'Documents to Measure' before proceeding!";
411
+ ShowPopUp();
412
+ return;
413
+ }
414
+
415
+
416
+
417
+ // If validation passes, proceed with form submission
418
+ getData(e.target);
419
+ });
420
+
421
+
422
+ function getData(form) {
423
+
424
+ document.getElementById("loading").hidden = false;
425
+
426
+ document.getElementById('Newtablebutton').setAttribute('disabled',true);
427
+ document.getElementById('Newtablebutton').style.cursor='not-allowed';
428
+ document.getElementById('Newtablebutton').style.boxShadow = 'none';
429
+ document.getElementById('Newtablebutton').style.color = 'white';
430
+ document.getElementById('Newtablebutton').style.backgroundColor="rgb(154,152,152)";
431
+
432
+
433
+ var formData = new FormData(form);
434
+
435
+
436
+
437
+
438
+ // clearInterval(interval)
439
+ val=0;
440
+ answers=[];
441
+ tomeasureproj='';
442
+ pdfpath=[];
443
+ formvalues=Object.fromEntries(formData);
444
+
445
+ tomeasureproj=formvalues['measureCheckbox']; //proj name
446
+
447
+ answers.push(selectedValues);
448
+ formData.append('answers',JSON.stringify(answers))
449
+
450
+ // Place this once in your JS before any $.ajax calls
451
+ $.ajaxTransport("+binary", function(options, originalOptions, jqXHR) {
452
+ if (window.FormData && (
453
+ (options.dataType && options.dataType === "binary") ||
454
+ (options.data && ((window.ArrayBuffer && options.data instanceof ArrayBuffer) ||
455
+ (window.Blob && options.data instanceof Blob)))
456
+ )) {
457
+ return {
458
+ send: function(headers, callback) {
459
+ const xhr = new XMLHttpRequest();
460
+ xhr.open(options.type, options.url, options.async ?? true,
461
+ options.username, options.password);
462
+ // Apply custom fields like responseType
463
+ xhr.responseType = options.responseType || "blob";
464
+ if (options.xhrFields) {
465
+ for (const field in options.xhrFields) {
466
+ xhr[field] = options.xhrFields[field];
467
+ }
468
+ }
469
+ xhr.onload = function() {
470
+ // Package the response as the declared dataType
471
+ const data = {};
472
+ data[options.dataType] = xhr.response;
473
+ callback(xhr.status, xhr.statusText, data, xhr.getAllResponseHeaders());
474
+ };
475
+ xhr.send(options.data || null);
476
+ },
477
+ abort: function() {
478
+ jqXHR.abort();
479
+ }
480
+ };
481
+ }
482
+ });
483
+
484
+ $.ajax({
485
+ // type: "POST",
486
+ // url: "/savedetectedtables/",
487
+ // // contentType: "application/json", // set content type header to use Flask response.get_json()
488
+ // data: formData,// convert data/object to JSON to send
489
+ // processData: false, // Prevent jQuery from automatically processing the data
490
+ // contentType: false,
491
+ // xhr: function() {
492
+ // const x = $.ajaxSettings.xhr();
493
+ // x.responseType = "blob"; // set blob mode
494
+ // return x;
495
+ // },
496
+ url: "/savedetectedtables/",
497
+ method: "POST",
498
+ data: formData,
499
+ processData: false,
500
+ contentType: false,
501
+ dataType: 'binary', // match your transport
502
+ responseType: 'blob', // tell the transport to use blob
503
+
504
+ success: function(blob) {
505
+ console.log(blob);
506
+ // downloadPdf(data,'detected_tables.xlsx')
507
+ console.log('typeof(blob) = ',typeof(blob))
508
+
509
+ if (!blob || blob.size === 0) {
510
+ // empty response → show your “no tables” popup
511
+ PopupElement.textContent = "No tables detected in the document.";
512
+ ShowPopUp();
513
+ return;
514
+ }
515
+ else{
516
+ console.log("gowa el else")
517
+ downloadPdf(blob,'detected_tables.xlsx')
518
+
519
+ }
520
+
521
+
522
+
523
+
524
+
525
+ },
526
+ error: function(err) {
527
+ var TopTextModal = document.getElementById("TopTextModal");
528
+ TopTextModal.textContent='Error'
529
+ PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
530
+ ShowPopUp();
531
+
532
+ }
533
+ })
534
+ .done(function(data){
535
+ console.log(data)
536
+ document.getElementById("loading").hidden = true;
537
+ document.getElementById('Newtablebutton').removeAttribute('disabled');
538
+ document.getElementById('Newtablebutton').style.cursor='pointer';
539
+ document.getElementById('Newtablebutton').style.color = 'white';
540
+ document.getElementById('Newtablebutton').style.backgroundColor="#16c72e";
541
+ document.getElementById('Newtablebutton').style.padding='10px 102px';
542
+ document.getElementById('Newtablebutton').addEventListener('mouseover',function(){
543
+ document.getElementById('Newtablebutton').style.color='black';
544
+ document.getElementById('Newtablebutton').style.boxShadow=' 0 0 8px 2px #16c72e';
545
+ })
546
+ document.getElementById('Newtablebutton').addEventListener('mouseout',function(){
547
+ document.getElementById('Newtablebutton').style.color='white';
548
+ document.getElementById('Newtablebutton').style.boxShadow='none';
549
+ });
550
+
551
+ // downloadPdf(data,'detected_tables.xlsx')
552
+ // downloadPdf(blob,'detected_tables.xlsx')
553
+ // document.getElementById('downloadbutton').hidden = false;
554
+ document.getElementById('downloadbutton').style.display = 'inline-block';
555
+ // document.getElementById('downloadbutton').onclick=downloadPdf(data,'detected_tables.xlsx')
556
+ const btn = document.getElementById('downloadbutton');
557
+ btn.addEventListener('click', () => {
558
+ downloadPdf(data, 'detected_tables.xlsx');
559
+ });
560
+
561
+
562
+ })
563
+
564
+
565
+ };
566
+
567
+
568
+
569
+
570
+ document.getElementById('Newtablebutton').onclick= function()
571
+ {
572
+ if (!measSelect.value) {
573
+ measSelect.style.boxShadow = '0 0 8px 2px rgb(255, 0, 0)';
574
+ measSelect.setAttribute("required", "")
575
+ }
576
+ }
577
+ document.getElementById('Newtablebutton').addEventListener('click',function(){
578
+ if (!document.getElementsByClassName('selectionsProj')[0].value)
579
+ document.getElementsByClassName('selectionsProj')[0].style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
580
+ if (!document.getElementsByClassName('selectionsProjp')[0].value)
581
+ document.getElementsByClassName('selectionsProjp')[0].style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
582
+ if (!document.getElementsByClassName('selectionsProjs')[0].value)
583
+ document.getElementsByClassName('selectionsProjs')[0].style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
584
+ //___________________________________________________________________________________________________________
585
+ //___________________________________________________________________________________________________________
586
+ if (document.getElementById('imgContainer')) {
587
+ document.getElementById('imgContainer').innerHTML = '';
588
+ }
589
+ });
590
+ var mpopup = document.getElementById('mpopupBox');
591
+ // Select close action element
592
+ // var close = document.getElementsByClassName("closeModal")[0];
593
+ function ShowPopUp(){
594
+ // Open modal
595
+ mpopup.style.display = "block";
596
+ }
597
+ // Close modal once close element is clicked
598
+ // close.onclick = function() {
599
+ // mpopup.style.display = "none";
600
+ // };
601
+ // Close modal when user clicks outside of the modal box
602
+ window.onclick = function(event) {
603
+ if (event.target == mpopup) {
604
+ mpopup.style.display = "none";
605
+ }
606
+ };
607
+ // closeDialog.onclick = function() {
608
+ // dialog_container.style.display = "none";
609
+ // };
610
+
611
+ var dialog_container = document.getElementById('dialog-container');
612
+ // Select close action element
613
+ // var closeDialog = document.getElementsByClassName("closeModal")[0];
614
+ function ShowPopUpWarning(){
615
+ // Open modal
616
+ dialog_container.style.display = "block";
617
+ }
618
+ // Close modal once close element is clicked
619
+ // closeDialog.onclick = function() {
620
+ // console.log()
621
+ // dialog_container.style.display = "none";
622
+ // };
623
+ // Close modal when user clicks outside of the modal box
624
+ window.onclick = function(event) {
625
+ if (event.target == dialog_container) {
626
+ dialog_container.style.display = "none";
627
+ }
628
+ };
629
+
630
+ PopupElement=document.getElementById('modal-bodyText');
631
+
632
+ var ActiveSections=['4.0']
633
+
634
+ var menuItems = document.querySelectorAll("#UserGuidemenuOptions li");
635
+
636
+ menuItems.forEach(function (item) {
637
+ // Extract the section number (first part of the text)
638
+ var sectionNumber = item.textContent.trim().split(" ")[0];
639
+
640
+ // If the section is not in ActiveSections, disable it
641
+ if (!ActiveSections.includes(sectionNumber)) {
642
+ item.id = "disabledSection"; // Assign ID
643
+ item.style.color = "#bdbcbc"; // Greyed-out text
644
+ item.style.cursor = "not-allowed"; // Change cursor
645
+ item.onclick = null; // Disable clicking
646
+ }
647
+ });
648
+
649
+
650
+ function updateProgressBar(value) {
651
+ const progressBar = document.getElementById('progress');
652
+ progressBar.style.width = value + '%';
653
+ progressBar.innerText = Math.round(value) + '%';
654
+ }
655
+
656
+ function redirectOmarSearch(){
657
+ $toggle.classList.toggle("change");
658
+ var isOpen = $mySidebar.classList.contains('slide-out');
659
+ $mySidebar.setAttribute('class', isOpen ? 'slide-in' : 'slide-out');
660
+ w3_close()
661
+
662
+ }
663
+
664
+ sectionSelect=document.getElementById('section-select');
665
+ $(sectionSelect).select2({
666
+ closeOnSelect: true,
667
+ width:'20ch'
668
+
669
+ });
670
+ // add project names to first dropdown from google sheet
671
+ firstdropdown=document.getElementsByClassName('selectionsProj')[0];
672
+ seconddropdown=document.getElementsByClassName('selectionsProjp')[0];
673
+ thirddropdown=document.getElementsByClassName('selectionsProjs')[0];
674
+
675
+
676
+ $(firstdropdown).select2({
677
+ placeholder:'Projects',
678
+ closeOnSelect: true,
679
+ width:'51ch'
680
+
681
+ });
682
+
683
+ $(seconddropdown).select2({
684
+ placeholder:'Project Parts',
685
+ closeOnSelect: true,
686
+ width:'51ch'
687
+ });
688
+ $(thirddropdown).select2({
689
+ placeholder:'Sections',
690
+ closeOnSelect: true,
691
+ width:'51ch'
692
+ });
693
+ var measSelect = document.getElementById("measureselectid");
694
+
695
+ // var relvSelect = document.getElementById("relvselectid");
696
+ document.getElementById("all").style.display = "block";
697
+
698
+ PrjNamesArray=[];
699
+ PrjPartsArray=[];
700
+ PrjSectionsArray=[];
701
+ var partsArrwithID=[];
702
+ var firstDpwnValue;
703
+ var prjids=[]
704
+
705
+ displayprjnames()
706
+ function displayprjnames(){
707
+
708
+ var eventSource = new EventSource('/getprojectnames/');
709
+ document.getElementById('progressBar').removeAttribute('hidden')
710
+ document.getElementById('progressBar').style.display='block';
711
+ eventSource.onmessage = function (event) {
712
+ var progress = parseInt(event.data); // Progress value from Flask
713
+ if (progress <= 100) {
714
+ console.log(progress); // Log progress for debugging
715
+ document.getElementById('progress').style.width = progress + '%';
716
+ document.getElementById('progress').textContent = progress + '%';
717
+ } else {
718
+ // Final data handling when progress reaches 100%
719
+ console.log('Process completed!');
720
+
721
+ // Parse and handle the final response data (documentsToMeasure, RelevantDocuments, extracted_path)
722
+ var data = JSON.parse(event.data); // Assuming the result is a JSON array
723
+ console.log('Final result:', data);
724
+ // You can use this data to update your page or handle it accordingly
725
+
726
+ eventSource.close(); // Close the connection when finished
727
+ document.getElementById('progressBar').setAttribute('hidden',true)
728
+ document.getElementById('progressBar').style.display='none';
729
+ document.getElementById('progress').style.width = '0%'; // Reset progress for the next process
730
+ document.getElementById('progress').textContent = '0%';
731
+
732
+ document.getElementById("all").style.display = "none";
733
+ prjids=data[1];
734
+ var op0 = document.createElement("OPTION") ;
735
+ op0.text= 'Projects'
736
+ op0.value= "";
737
+ op0.hidden=true;
738
+ firstdropdown.add(op0);
739
+ for (let i=0;i<data[0].length;i++)
740
+ {
741
+ opt=document.createElement("option");
742
+ opt.textContent=data[0][i];
743
+ opt.text=data[0][i];
744
+ firstdropdown.append(opt);
745
+ PrjNamesArray.push(data[0][i]);
746
+ }
747
+
748
+ }
749
+ }
750
+
751
+
752
+ eventSource.onerror = function (error) {
753
+ console.error('Error occurred:', error);
754
+ eventSource.close(); // Close on error
755
+ PopupElement.textContent='Error occured while retrieving the Project Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
756
+ ShowPopUp();
757
+ };
758
+ }
759
+ /*Get chosen value and send to flask to get project parts*/
760
+
761
+ $(firstdropdown).on("change", function (e) {
762
+ console.log('clickeds')
763
+ firstDpwnValue=firstdropdown.value;
764
+ seconddropdown.innerHTML='';
765
+ var op0 = document.createElement("OPTION") ;
766
+ op0.text= 'Project Part'
767
+ op0.value= "";
768
+ op0.hidden=true;
769
+ seconddropdown.add(op0);
770
+ var ii, L = seconddropdown.options.length - 1;
771
+ for(ii = L; ii >= 0; ii--) {
772
+ if (seconddropdown.options[ii].value)
773
+ seconddropdown.remove(ii);
774
+ }
775
+
776
+ displayprojparts(prjids[(firstdropdown.selectedIndex)-1]);
777
+ })
778
+ var partsArrIDsonly=[]
779
+ function displayprojparts(val){
780
+ document.getElementById("all").style.display = "block";
781
+ console.log(val)
782
+ $.get('/getprojectparts/'+JSON.stringify(val))
783
+ .success(function(data){
784
+ document.getElementById("all").style.display = "none";
785
+ partsArrwithID= data[0];
786
+ partsArrIDsonly= data[1];
787
+
788
+ for (let i=0;i<data[0].length;i++)
789
+ {
790
+ opt=document.createElement("option");
791
+ opt.value=data[0][i];
792
+ opt.text=data[0][i];
793
+ seconddropdown.append(opt);
794
+ PrjPartsArray.push(data[0][i]);
795
+
796
+ }
797
+
798
+ })
799
+ .error(function(jqXHR, textStatus, errorThrown) {
800
+ PopupElement.textContent='Error occured while retrieving the Project Parts. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
801
+ ShowPopUp();
802
+ });
803
+ }
804
+ $(seconddropdown).on("change", function (e) {
805
+ thirddropdown.innerHTML='';
806
+ var op0 = document.createElement("OPTION") ;
807
+ op0.text= 'Section'
808
+ op0.value= "";
809
+ op0.hidden=true;
810
+ thirddropdown.add(op0);
811
+ displayprojsections(prjids[(firstdropdown.selectedIndex)-1],partsArrIDsonly[(seconddropdown.selectedIndex)-1]);
812
+ })
813
+ function isValueNotInDropdown(dropdown, value) {
814
+ // const dropdown = document.getElementById(dropdownId);
815
+ const values = Array.from(dropdown.options).map(option => option.value);
816
+ return !values.includes(value); // Check if the value is not in dropdown values
817
+ }
818
+ function displayprojsections(projectid,Partid){
819
+ console.log(seconddropdown.selectedIndex)
820
+ document.getElementById("all").style.display = "block";
821
+ if (measSelect && measSelect.hasChildNodes()) {
822
+ while (measSelect.firstChild) {
823
+ measSelect.removeChild(measSelect.firstChild);
824
+ }
825
+ }
826
+
827
+ // if (relvSelect && relvSelect.hasChildNodes()) {
828
+ // while (relvSelect.firstChild) {
829
+ // relvSelect.removeChild(relvSelect.firstChild);
830
+ // }
831
+ // }
832
+ $.get('/getprojectsections/' + JSON.stringify([projectid, Partid]))
833
+ .done(function(data) {
834
+ document.getElementById("all").style.display = "none";
835
+
836
+ for (let i = 0; i < data.length; i++) {
837
+ let valueDoesNotExist = isValueNotInDropdown(thirddropdown, data[i]);
838
+
839
+ if (valueDoesNotExist) {
840
+ let opt = document.createElement("option");
841
+ opt.value = data[i];
842
+ opt.text = data[i];
843
+
844
+ let isActive = false;
845
+ for (let d = 0; d < ActiveSections.length; d++) {
846
+ if (data[i].startsWith(ActiveSections[d])) {
847
+ isActive = true;
848
+ break; // Exit loop early if active
849
+ }
850
+ }
851
+
852
+ if (!isActive) {
853
+ opt.style.color = '#bdbcbc';
854
+ opt.style.cursor = 'not-allowed';
855
+ opt.setAttribute('disabled', true);
856
+ }
857
+
858
+ thirddropdown.append(opt);
859
+ PrjSectionsArray.push(data[i]);
860
+ }
861
+ }
862
+ })
863
+ .fail(function(jqXHR, textStatus, errorThrown) {
864
+ PopupElement.textContent='Error occured while retrieving the Project Sections. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
865
+ ShowPopUp();
866
+ });
867
+
868
+ }
869
+
870
+ function filterFunction(id) {
871
+ var input, filter, ul, li, a, i;
872
+ input = document.getElementById(id);
873
+ filter = input.value.toUpperCase();
874
+ if (id.toString().startsWith('tomeasure'))
875
+ a = document.querySelectorAll("#measureContainer .measure-item");
876
+
877
+ // a = document.getElementById("measureselectid").children;
878
+ // else
879
+ // // a = document.getElementById("relvselectid").children;
880
+ // a = document.querySelectorAll("#relvselectid .relv-item");
881
+ // a = div.getElementsByTagName("option");
882
+ for (i = 0; i < a.length; i++) {
883
+ txtValue = a[i].textContent || a[i].innerText;
884
+ if (txtValue.toUpperCase().indexOf(filter) > -1) {
885
+ a[i].style.display = "";
886
+ } else {
887
+ a[i].style.display = "none";
888
+ }
889
+ }
890
+ }
891
+
892
+ function getproj(){
893
+
894
+
895
+ var proj = document.getElementsByClassName("selectionsProj")[0];
896
+ var projectVal=proj.value.toString() //selected project
897
+
898
+ var inputs = document.getElementsByTagName("select")[1]; //second dropdown(project part)
899
+ var p=document.getElementById("selectionsProjpid") //project part
900
+
901
+ var sections = document.getElementsByClassName("selectionsProjs")[0];
902
+
903
+ var eventSource = new EventSource('/getmethod/' + JSON.stringify(projectVal));
904
+ document.getElementById('progressBar').removeAttribute('hidden')
905
+ document.getElementById('progressBar').style.display='block';
906
+ eventSource.onmessage = function (event) {
907
+ var progress = parseInt(event.data); // Progress value from Flask
908
+ if (progress <= 100) {
909
+ console.log(progress); // Log progress for debugging
910
+ document.getElementById('progress').style.width = progress + '%';
911
+ document.getElementById('progress').textContent = progress + '%';
912
+ } else {
913
+ // Final data handling when progress reaches 100%
914
+ console.log('Process completed!');
915
+
916
+ // Parse and handle the final response data (documentsToMeasure, RelevantDocuments, extracted_path)
917
+ var data = JSON.parse(event.data); // Assuming the result is a JSON array
918
+ console.log('Final result:', data);
919
+ // You can use this data to update your page or handle it accordingly
920
+
921
+ eventSource.close(); // Close the connection when finished
922
+ document.getElementById('progressBar').setAttribute('hidden',true)
923
+ document.getElementById('progressBar').style.display='none';
924
+ document.getElementById('progress').style.width = '0%'; // Reset progress for the next process
925
+ document.getElementById('progress').textContent = '0%';
926
+
927
+
928
+ document.getElementById('refreshDropboxButtonID').style.display = "block";
929
+ document.getElementById("all").style.display = "none";
930
+ // if (sections.value.startsWith('3.2') || sections.value.startsWith('3.3') || sections.value.startsWith('2.7') ){
931
+ // document.getElementById('dxfdiv').removeAttribute('hidden');
932
+ // document.getElementById('pdftodxfFile').setAttribute('required',true)
933
+ // }
934
+
935
+ // else{
936
+ // document.getElementById('dxfdiv').setAttribute('hidden',true)
937
+ // }
938
+
939
+ extracted_path=data[2]
940
+ var docsToMeasure=data[0]; //
941
+ // var relvDocs=data[1]
942
+ var projname = document.getElementsByClassName("selectionsProj")[0];
943
+ var projpart = document.getElementsByClassName("selectionsProjp")[0];
944
+ var projsec = document.getElementsByClassName("selectionsProjs")[0];
945
+
946
+ var meas = document.getElementById("measureCheckbox") ;
947
+ // var relv = document.getElementById("relvdiv") ;
948
+ const measids=[];
949
+ // const relvids=[];
950
+ const measoptns=[];
951
+
952
+ // var measSelect = document.getElementById("measureselectid");
953
+ var measSelect = document.getElementById("measureContainer");
954
+
955
+ // var relvSelect = document.getElementById("relvselectid");
956
+ // var levelcheckbox= document.getElementById("levelcheckbox");
957
+
958
+
959
+ measSelect.removeAttribute("hidden");
960
+ // relvSelect.removeAttribute("hidden");
961
+ if (measSelect && measSelect.hasChildNodes()) {
962
+ while (measSelect.firstChild) {
963
+ measSelect.removeChild(measSelect.firstChild);
964
+ }
965
+ }
966
+
967
+ var optn2 = document.createElement("div"); // Use a <div> instead of <option>
968
+ optn2.textContent = 'Select project to measure'; // Set text content
969
+ optn2.hidden = true; // Keep it hidden
970
+ optn2.id = 'hidden';
971
+
972
+ measSelect.appendChild(optn2); // Append to div instead of .add()
973
+ document.getElementById("hidden").required = true;
974
+
975
+
976
+ // if (relvSelect && relvSelect.hasChildNodes()) {
977
+ // while (relvSelect.firstChild) {
978
+ // relvSelect.removeChild(relvSelect.firstChild);
979
+ // }
980
+ // }
981
+ const nameSet = new Set(); // To track unique names
982
+ // const nameSetRelv = new Set(); // To track unique names
983
+
984
+ // Action foconst nameSet = new Set(); // To track unique names
985
+
986
+ // Action for when the checkbox is clicked
987
+ function handleLabelClick(event) {
988
+ let selectedLabel = event.target.textContent;
989
+ console.log("Label clicked: ", selectedLabel);
990
+
991
+ // Reset background only for items whose checkbox is **not** checked
992
+ document.querySelectorAll(".measure-item").forEach(item => {
993
+ const checkbox = item.querySelector('input[type="checkbox"]');
994
+ if (!checkbox.checked) {
995
+ item.style.backgroundColor = '';
996
+ }
997
+ });
998
+
999
+ // Optionally highlight the clicked div (even though its checkbox isn’t selected)
1000
+ const clickedDiv = event.target.closest(".measure-item");
1001
+ clickedDiv.style.backgroundColor = '#919592';
1002
+
1003
+ // Show loading spinner
1004
+ document.getElementById("all").style.display = "block";
1005
+
1006
+ fetch('/getdropboxurl/' + JSON.stringify(selectedLabel), {
1007
+ method: 'POST',
1008
+ headers: { 'Content-Type': 'application/json' },
1009
+ body: JSON.stringify({ filename: "your_pdf_filename_here.pdf" }) // ← Replace with real value if dynamic
1010
+ })
1011
+ .then(response => response.blob())
1012
+ .then(blob => {
1013
+ document.getElementById("all").style.display = "none";
1014
+ const url = URL.createObjectURL(blob);
1015
+ addIframeTab(selectedLabel, url);
1016
+ })
1017
+ .catch(function (jqXHR, textStatus, errorThrown) {
1018
+ PopupElement.textContent = 'Error occurred while retrieving the Dropbox URL. Refresh and try again. If the error continues, please contact the ADR team to fix it.';
1019
+ ShowPopUp();
1020
+ });
1021
+ }
1022
+ selectedValues=[]
1023
+ function handleCheckboxChange(event) {
1024
+ // Uncheck all checkboxes before checking the current one
1025
+ // document.querySelectorAll('input[name="measureCheckbox"]').forEach(checkbox => {
1026
+ // checkbox.checked = false;
1027
+ // });
1028
+
1029
+ // Check the current checkbox
1030
+ // event.target.checked = true;
1031
+
1032
+ // // Action when checkbox is clicked (e.g., log the selected project)
1033
+ // let selectedValue = event.target.value;
1034
+ // measSelect.value=selectedValue;
1035
+ // console.log("Selected project:", selectedValue);
1036
+
1037
+ const selectedCheckboxes = Array.from(document.querySelectorAll('input[name="measureCheckbox"]:checked'));
1038
+ selectedValues = selectedCheckboxes.map(cb => cb.value);
1039
+ measSelect.value = selectedValues.join(', ');
1040
+
1041
+
1042
+ console.log("Selected projects:", selectedValues);
1043
+
1044
+ pdfname = selectedValues.length === 1 ? selectedValues[0] : selectedValues.join(', ');
1045
+
1046
+
1047
+ // Highlight the selected item
1048
+ document.querySelectorAll(".measure-item").forEach(item => {
1049
+ const checkbox = item.querySelector('input[name="measureCheckbox"]');
1050
+ item.style.backgroundColor = checkbox.checked ? '#d3f8d3' : '';
1051
+ });
1052
+ console.log("Selected projects:", selectedValues);
1053
+
1054
+ // Highlight the selected item
1055
+ // document.querySelectorAll(".measure-item").forEach(item => {
1056
+ // item.style.backgroundColor = ''; // Reset background color for all items
1057
+ // });
1058
+ // event.target.closest(".measure-item").style.backgroundColor = '#d3f8d3'; // Highlight the selected item
1059
+
1060
+
1061
+
1062
+ // Show alert immediately to prompt the user
1063
+ // if (projsec.value.startsWith('3.2') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.7')) {
1064
+ // // downloadPdf(selectedValue);
1065
+ // downloadPdf(selectedValue,'DXF_File_:'+selectedValue)
1066
+ // // window.alert("Measure the purple shape drawn on the PDF using Foxit Reader, Bluebeam, or any other external tool, then enter its area and perimeter in your desired scale.");
1067
+ // }
1068
+ // else{
1069
+ // window.alert("Measure the purple shape drawn on the PDF using Foxit Reader, Bluebeam, or any other external tool, then enter its area and perimeter in your desired scale.");
1070
+ // }
1071
+ canvasimg='';
1072
+ ry=[[]];
1073
+ // levelcheckbox.checked=false;
1074
+ // pdfname=selectedValue;
1075
+ pdfname=selectedValues;
1076
+ measSelect.style.boxShadow='none';
1077
+
1078
+ console.log(projsec.value)
1079
+ // if (!(projsec.value.startsWith('2.6') || projsec.value.startsWith('2.8'))) {
1080
+ // document.getElementById("all").style.display = "block";
1081
+
1082
+ // pixelArr=[projname.value, projpart.value,projsec.value, pdfname]
1083
+ // var eventSource = new EventSource('/pixelimg/' + JSON.stringify(pixelArr));
1084
+ // document.getElementById('progressBar').removeAttribute('hidden')
1085
+ // document.getElementById('progressBar').style.display='block';
1086
+ // eventSource.onmessage = function (event) {
1087
+ // var progress = parseInt(event.data); // Progress value from Flask
1088
+ // if (progress <= 100) {
1089
+ // console.log(progress); // Log progress for debugging
1090
+ // document.getElementById('progress').style.width = progress + '%';
1091
+ // document.getElementById('progress').textContent = progress + '%';
1092
+ // } else {
1093
+ // var data = JSON.parse(event.data); // Assuming the result is a JSON array
1094
+ // eventSource.close(); // Close the connection when finished
1095
+
1096
+ // document.getElementById('progressBar').setAttribute('hidden',true)
1097
+ // document.getElementById('progressBar').style.display='none';
1098
+ // document.getElementById('progress').style.width = '0%'; // Reset progress for the next process
1099
+ // document.getElementById('progress').textContent = '0%';
1100
+ // document.getElementById("all").style.display = "none";
1101
+ // // Display link or any additional data if needed
1102
+ // window.open(data[2]);
1103
+ // downloadPdf(pdfname,'Pixel_Conversion_File_:'+pdfname)
1104
+ // document.getElementById("all").style.display = "none";
1105
+
1106
+ // document.getElementById('Newtablebutton').onclick= function()
1107
+ // {
1108
+ // if (!areaRatio.value){
1109
+ // if (!(projsec.value.startsWith('3.2')) & !(projsec.value.startsWith('2.8')) & !(projsec.value.startsWith('2.6')) & !(projsec.value.startsWith('3.3')) & !(projsec.value.startsWith('2.7')) )
1110
+ // areaRatio.style.boxShadow='0 0 8px 2px rgb(255, 0, 0)';
1111
+ // }
1112
+ // if (!prmRatio.value) {
1113
+ // if (!(projsec.value.startsWith('2.6') || projsec.value.startsWith('2.8'))) {
1114
+ // prmRatio.style.boxShadow = '0 0 8px 2px rgb(255, 0, 0)';
1115
+ // }
1116
+ // }
1117
+
1118
+ // }
1119
+ // document.getElementById('radiosColors').removeAttribute('hidden');
1120
+ // var scalelbl= document.createElement("label");
1121
+ // scalelbl.innerText='Scale Document';
1122
+ // scalelbl.id='measureLabel';
1123
+ // var br1= document.createElement("br");
1124
+ // var areadiv=document.createElement("div");
1125
+ // areadiv.id='areadiv'
1126
+ // var areaRatiolbl= document.createElement("label");
1127
+ // areaRatiolbl.innerText='Area:'
1128
+ // areaRatiolbl.id='radiolbl';
1129
+
1130
+ // var areaRatio= document.createElement("input");
1131
+ // areaRatio.type='number';
1132
+ // areaRatio.id='arealvlinput';
1133
+ // areaRatio.className='lvlinput';
1134
+ // areaRatio.name='areaRatio';
1135
+ // areaRatio.style.marginLeft='78px';
1136
+ // areaRatio.style.textAlign='right';
1137
+ // areaRatio.step=".0000001";
1138
+ // areaRatio.min = "0"; // Allow only positive numbers (>= 0)
1139
+ // if( projsec.value.startsWith('3.2') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.1') || projsec.value.startsWith('2.7')){
1140
+ // areaRatio.setAttribute('disabled',true)
1141
+ // areaRatio.style.cursor='not-allowed';
1142
+ // areaRatio.style.backgroundColor='rgba(101, 101, 101, 0.27)'
1143
+ // document.getElementById('selectunitA').setAttribute('disabled',true)
1144
+ // document.getElementById('selectunitA').style.cursor='not-allowed';
1145
+ // document.getElementById('selectunitA').style.backgroundColor='rgba(101, 101, 101, 0.27)'
1146
+ // }
1147
+
1148
+ // else{ // section 1.0
1149
+ // areaRatio.removeAttribute('disabled')
1150
+ // areaRatio.style.cursor='pointer';
1151
+ // document.getElementById('selectunitA').removeAttribute('disabled')
1152
+ // document.getElementById('selectunitA').style.cursor='pointer';
1153
+ // }
1154
+ // areaRatio.addEventListener('change',function(){
1155
+ // areaRatio.value=(Number(areaRatio.value)).toFixed(7)
1156
+ // areaRatio.style.boxShadow='none';
1157
+ // })
1158
+ // areaRatio.required=true;
1159
+ // selectunitA=document.getElementById('selectunitA')
1160
+ // selectunitA.removeAttribute('hidden')
1161
+
1162
+ // areadiv.append(areaRatiolbl,areaRatio,selectunitA)
1163
+ // var br2= document.createElement("br");
1164
+ // var br3= document.createElement("br");
1165
+ // var prmdiv=document.createElement("div");
1166
+ // prmdiv.id='prmdiv'
1167
+ // var prmRatiolbl= document.createElement("label");
1168
+ // prmRatiolbl.innerText='Perimeter:'
1169
+ // prmRatiolbl.id='radiolbl';
1170
+
1171
+ // var prmRatio= document.createElement("input");
1172
+ // prmRatio.type='number';
1173
+ // prmRatio.id='perimlvlinput';
1174
+ // prmRatio.className='lvlinput';
1175
+ // prmRatio.name='prmRatio';
1176
+ // prmRatio.style.textAlign='right';
1177
+ // prmRatio.style.marginLeft='49px';
1178
+ // prmRatio.step=".0000001";
1179
+ // prmRatio.min = "0"; // Allow only positive numbers (>= 0)
1180
+ // prmRatio.addEventListener('change',function(){
1181
+ // prmRatio.value=(Number(prmRatio.value)).toFixed(7)
1182
+ // prmRatio.style.boxShadow='none';
1183
+ // })
1184
+ // prmRatio.required=true;
1185
+ // selectunitP=document.getElementById('selectunitP')
1186
+ // selectunitP.removeAttribute('hidden')
1187
+
1188
+ // prmdiv.append(prmRatiolbl, prmRatio,selectunitP)
1189
+ // var ratiosdiv= document.getElementById("ratios");
1190
+ // ratiosdiv.innerHTML='';
1191
+ // ratiosdiv.append(scalelbl);
1192
+ // ratiosdiv.append(br1);
1193
+ // ratiosdiv.append(areadiv)
1194
+ // ratiosdiv.append(prmdiv)
1195
+ // areainpixels=data[0];
1196
+ // prminpixels=data[1];
1197
+
1198
+
1199
+ // if( projsec.value.startsWith('2.8') || projsec.value.startsWith('2.6')) {
1200
+ // areaRatio.setAttribute('disabled',true)
1201
+ // areaRatio.style.cursor='not-allowed';
1202
+ // areaRatio.style.backgroundColor='rgba(101, 101, 101, 0.27)'
1203
+ // document.getElementById('selectunitA').setAttribute('disabled',true)
1204
+ // document.getElementById('selectunitA').style.cursor='not-allowed';
1205
+ // document.getElementById('selectunitA').style.backgroundColor='rgba(101, 101, 101, 0.27)'
1206
+
1207
+ // prmRatio.setAttribute('disabled',true)
1208
+ // prmRatio.style.cursor='not-allowed';
1209
+ // prmRatio.style.backgroundColor='rgba(101, 101, 101, 0.27)'
1210
+ // document.getElementById('selectunitP').setAttribute('disabled',true)
1211
+ // document.getElementById('selectunitP').style.cursor='not-allowed';
1212
+ // document.getElementById('selectunitP').style.backgroundColor='rgba(101, 101, 101, 0.27)'
1213
+ // }
1214
+ // };
1215
+ // }
1216
+
1217
+
1218
+ // eventSource.onerror = function (error) {
1219
+ // console.error('Error occurred:', error);
1220
+ // eventSource.close(); // Close on error
1221
+ // PopupElement.textContent='Error occured while uploading the pdf to the Dropbox. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
1222
+ // ShowPopUp();
1223
+ // };
1224
+
1225
+ // selectunitA.addEventListener('change',function(){
1226
+ // value=document.getElementById('selectunitA').value
1227
+ // if (value=='mm2')
1228
+ // ratioAunit=1000000;
1229
+ // else
1230
+ // ratioAunit=1;
1231
+ // })
1232
+ // selectunitP.addEventListener('change',function(){
1233
+ // value=document.getElementById('selectunitP').value
1234
+ // if (value=='mm'){
1235
+ // ratioPunit=1000;
1236
+ // }
1237
+ // else
1238
+ // ratioPunit=1;
1239
+
1240
+ // })
1241
+ // // }
1242
+ // // for 2.8 multiple pdfs
1243
+ // // else{
1244
+ // // pdfnames=getSelectValues(elem)
1245
+ // // }
1246
+ // }
1247
+ // else{
1248
+ // document.getElementById('radiosColors').removeAttribute('hidden')
1249
+ // }
1250
+ }
1251
+ // Action for when the label is clicked (no checkbox change)
1252
+ // function handleLabelClick(event) {
1253
+ // let selectedLabel = event.target.textContent;
1254
+ // console.log("Label clicked: ", selectedLabel);
1255
+
1256
+ // // Reset background only for items whose checkbox is **not** checked
1257
+ // document.querySelectorAll(".measure-item").forEach(item => {
1258
+ // const checkbox = item.querySelector('input[type="checkbox"]');
1259
+ // if (!checkbox.checked) {
1260
+ // item.style.backgroundColor = '';
1261
+ // }
1262
+ // });
1263
+
1264
+ // // Optionally highlight the clicked div (even though its checkbox isn’t selected)
1265
+ // const clickedDiv = event.target.closest(".measure-item");
1266
+ // clickedDiv.style.backgroundColor = '#919592';
1267
+
1268
+ // // Show loading spinner
1269
+ // document.getElementById("all").style.display = "block";
1270
+
1271
+ // fetch('/getdropboxurl/' + JSON.stringify(selectedLabel), {
1272
+ // method: 'POST',
1273
+ // headers: { 'Content-Type': 'application/json' },
1274
+ // body: JSON.stringify({ filename: "your_pdf_filename_here.pdf" }) // ← Replace with real value if dynamic
1275
+ // })
1276
+ // .then(response => response.blob())
1277
+ // .then(blob => {
1278
+ // document.getElementById("all").style.display = "none";
1279
+ // const url = URL.createObjectURL(blob);
1280
+ // // addIframeTab(selectedLabel, url);
1281
+ // })
1282
+ // .catch(function (jqXHR, textStatus, errorThrown) {
1283
+ // PopupElement.textContent = 'Error occurred while retrieving the Dropbox URL. Refresh and try again. If the error continues, please contact the ADR team to fix it.';
1284
+ // ShowPopUp();
1285
+ // });
1286
+ // }
1287
+
1288
+
1289
+ for (let i = 0; i < docsToMeasure.length; i++) {
1290
+ let name = docsToMeasure[i][0];
1291
+
1292
+ // Create div for the measure item
1293
+ let div = document.createElement("div");
1294
+ div.className = "measure-item";
1295
+
1296
+ // Create the checkbox
1297
+ let checkbox = document.createElement("input");
1298
+ checkbox.type = "checkbox";
1299
+ checkbox.name = "measureCheckbox";
1300
+ checkbox.value = name;
1301
+
1302
+ // Only clicking checkbox checks it and triggers handler
1303
+ checkbox.onclick = function (e) {
1304
+ e.stopPropagation(); // prevent bubbling to div
1305
+ handleCheckboxChange(e);
1306
+ };
1307
+
1308
+ // Create the label
1309
+ let label = document.createElement("label");
1310
+ label.textContent = name;
1311
+
1312
+ // Label click does not check the checkbox
1313
+ label.onclick = function (e) {
1314
+ e.stopPropagation(); // just to be safe
1315
+ handleLabelClick(e, name);
1316
+ };
1317
+
1318
+ // Div click also doesn't check the checkbox
1319
+ div.onclick = function (e) {
1320
+ handleLabelClick(e, name);
1321
+ };
1322
+
1323
+ // Assemble
1324
+ div.appendChild(checkbox);
1325
+ div.appendChild(label);
1326
+ measSelect.appendChild(div);
1327
+
1328
+ // Handle duplicates
1329
+ if (nameSet.has(name)) {
1330
+ label.style.color = "red";
1331
+ document.getElementById("TopTextModal").textContent = 'Error: Duplicates Error';
1332
+ PopupElement.textContent = 'Duplicate project names were detected while retrieving the project PDFs. Please visit Dropbox and rename the relevant files that you will be working on to ensure each project has a unique name. Once the renaming is complete, return to the console and click on the Dropbox icon to retrieve the updated project names.';
1333
+ ShowPopUp();
1334
+ } else {
1335
+ nameSet.add(name);
1336
+ }
1337
+ }
1338
+
1339
+
1340
+ // for (let i = 0; i < relvDocs.length; i++) {
1341
+ // let name = relvDocs[i][0];
1342
+
1343
+ // // Create div for the measure item
1344
+ // let divRelv = document.createElement("div");
1345
+ // divRelv.className = "relv-item";
1346
+
1347
+ // // Create the checkbox
1348
+ // let checkboxRelv = document.createElement("input");
1349
+ // checkboxRelv.type = "checkbox";
1350
+ // checkboxRelv.name = "measureCheckboxRelv";
1351
+ // checkboxRelv.value = name;
1352
+
1353
+ // // Create the label
1354
+ // let label = document.createElement("label");
1355
+ // label.textContent = name;
1356
+
1357
+ // // Shared click handler
1358
+ // function checkboxRelvClick(event) {
1359
+ // event.stopPropagation(); // Prevent event bubbling issues
1360
+
1361
+ // // Get the parent div from the event target
1362
+ // const container = event.currentTarget;
1363
+
1364
+ // // Get the checkbox inside this container
1365
+ // const checkbox = container.querySelector('input[type="checkbox"]');
1366
+
1367
+ // // Uncheck all checkboxes
1368
+ // document.querySelectorAll('input[name="measureCheckboxRelv"]').forEach(cb => cb.checked = false);
1369
+
1370
+ // // Check the clicked one
1371
+ // checkbox.checked = true;
1372
+
1373
+ // const relevantDocumentName = checkbox.value;
1374
+ // console.log("Item clicked: ", relevantDocumentName);
1375
+
1376
+ // if (projsec.value.startsWith('2.8') || projsec.value.startsWith('2.6')) {
1377
+ // doorSchedulePDF = relevantDocumentName;
1378
+ // console.log(doorSchedulePDF);
1379
+ // }
1380
+
1381
+ // // Highlight selection
1382
+ // document.querySelectorAll(".relv-item").forEach(item => {
1383
+ // item.style.backgroundColor = '';
1384
+ // });
1385
+ // container.style.backgroundColor = '#d3f8d3';
1386
+ // document.getElementById('relvselectid').style.boxShadow = '';
1387
+ // relvSelect.value = relevantDocumentName;
1388
+ // }
1389
+
1390
+ // // Assign the click event to the container div
1391
+ // divRelv.onclick = checkboxRelvClick;
1392
+
1393
+ // // Also attach to checkbox specifically to prevent bubbling issue
1394
+ // checkboxRelv.onclick = (e) => {
1395
+ // e.stopPropagation();
1396
+ // divRelv.click(); // Trigger div's click logic
1397
+ // };
1398
+
1399
+ // divRelv.appendChild(checkboxRelv);
1400
+ // divRelv.appendChild(label);
1401
+
1402
+ // relvSelect.appendChild(divRelv);
1403
+
1404
+ // if (nameSetRelv.has(name)) {
1405
+ // label.style.color = "red";
1406
+ // } else {
1407
+ // nameSetRelv.add(name);
1408
+ // }
1409
+ // }
1410
+
1411
+
1412
+ // relvids.push(relvSelect);
1413
+ measids.push(measSelect);
1414
+
1415
+ // document.addEventListener("click", function(event) {
1416
+ // const iframe = document.getElementById("pdfFrame");
1417
+ // if (!iframe.contains(event.target)) {
1418
+ // const iframe = document.getElementById("pdfFrame");
1419
+ // iframe.style.display = "none";
1420
+ // }
1421
+ // });
1422
+ document.getElementById('Newtablebutton').onclick= function()
1423
+ {
1424
+ if (!measSelect.value) {
1425
+ measSelect.style.boxShadow = '0 0 8px 2px rgb(255, 0, 0)';
1426
+ measSelect.setAttribute("required", "")
1427
+ }
1428
+
1429
+ // if (!relvSelect.value) {
1430
+ // if (sectionNumber.startsWith('2.8') || sectionNumber.startsWith('2.6')) {
1431
+ // relvSelect.style.boxShadow = '0 0 8px 2px rgb(255, 0, 0)';
1432
+ // relvSelect.setAttribute("required", "")
1433
+ // }
1434
+ // }
1435
+
1436
+
1437
+ }
1438
+
1439
+ }
1440
+
1441
+
1442
+ if (document.getElementById('arealvlinput')){
1443
+ if( projsec.value.startsWith('3.2') || projsec.value.startsWith('2.8') || projsec.value.startsWith('2.6') || projsec.value.startsWith('3.3') || projsec.value.startsWith('2.1') || projsec.value.startsWith('2.7')){
1444
+ document.getElementById('arealvlinput').setAttribute('disabled',true)
1445
+ document.getElementById('selectunitA').setAttribute('disabled',true)
1446
+ }
1447
+ else{ // section 1.0
1448
+ document.getElementById('arealvlinput').removeAttribute('disabled')
1449
+ document.getElementById('selectunitA').removeAttribute('disabled')
1450
+ }
1451
+ }
1452
+
1453
+
1454
+
1455
+ // if (!(thirddropdown.value.startsWith('2.8')||thirddropdown.value.startsWith('2.6')) ) {
1456
+ // document.getElementById("relvselectid").classList.add("disabled");
1457
+ // document.getElementById("relvoverlay").style.display = "block";
1458
+ // } else {
1459
+ // document.getElementById("relvselectid").classList.remove("disabled");
1460
+ // document.getElementById("relvoverlay").style.display = "none";
1461
+ // }
1462
+
1463
+ };
1464
+
1465
+ eventSource.onerror = function (error) {
1466
+ console.error('Error occurred:', error);
1467
+ eventSource.close(); // Close on error
1468
+ PopupElement.textContent='Error occured while retrieving the Project Names. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
1469
+ ShowPopUp();
1470
+ };
1471
+
1472
+ }
1473
+ //___________________________________________________________________________________________________________
1474
+ //___________________________________________________________________________________________________________
1475
+ function downloadPdf(blob,downloadPDFName) {
1476
+
1477
+ // const url = URL.createObjectURL(blob);
1478
+ // var link = document.createElement('a');
1479
+ // link.href = url;
1480
+ // link.download = downloadPDFName;
1481
+ // link.dispatchEvent(new MouseEvent('click'));
1482
+
1483
+
1484
+ const url = URL.createObjectURL(blob);
1485
+ const a = document.createElement('a');
1486
+ a.style.display = 'none';
1487
+ a.href = url;
1488
+ a.download = downloadPDFName;
1489
+ document.body.appendChild(a);
1490
+ a.click();
1491
+ document.body.removeChild(a);
1492
+ URL.revokeObjectURL(url);
1493
+
1494
+ }
1495
+ /*Menu bar icon mySidebar and Toggle*/
1496
+ var $mySidebar = document.getElementById('mySidebar');
1497
+ var $toggle = document.getElementById('toggle');
1498
+ $toggle.addEventListener('click', function() {
1499
+
1500
+ var isOpen = $mySidebar.classList.contains('slide-in');
1501
+ w3_open();
1502
+ $mySidebar.setAttribute('class', isOpen ? 'slide-out' : 'slide-in');
1503
+ $toggle.classList.toggle("change");
1504
+
1505
+
1506
+ if ($mySidebar.classList.contains('slide-out')){
1507
+ w3_close()
1508
+ }
1509
+ });
1510
+
1511
+ function w3_open() {
1512
+ document.getElementById("home").style.marginLeft = "25%";
1513
+ document.getElementById("legends").style.marginLeft = "25%";
1514
+
1515
+ document.getElementById("home").style.transition= '0.8s';
1516
+ document.getElementById("legends").style.transition= '0.8s';
1517
+
1518
+ document.getElementById("mySidebar").style.width = "25%";
1519
+ document.getElementById("mySidebar").style.display = "block";
1520
+ }
1521
+
1522
+ function w3_close() {
1523
+ document.getElementById("home").style.marginLeft = "0%";
1524
+ document.getElementById("legends").style.marginLeft = "0%";
1525
+ document.getElementById("home").style.transition= '1.5s'
1526
+ document.getElementById("legends").style.transition= '1.5s'
1527
+ document.getElementById("mySidebar").style.display = "none";
1528
+ }
1529
+ function openTab(evt, tabname) {
1530
+ var i, tabcontent, tablinks;
1531
+
1532
+
1533
+
1534
+ // Hide all tab contents
1535
+ tabcontent = document.getElementsByClassName("tabcontent");
1536
+ for (i = 0; i < tabcontent.length; i++) {
1537
+ tabcontent[i].style.display = "none";
1538
+ }
1539
+
1540
+ // Remove "active" class from all tab buttons
1541
+ tablinks = document.getElementsByClassName("tablinks");
1542
+ for (i = 0; i < tablinks.length; i++) {
1543
+ tablinks[i].className = tablinks[i].className.replace(" active", "");
1544
+ }
1545
+
1546
+ // Show selected tab content and mark button as active
1547
+ var tab = document.getElementById(tabname);
1548
+ if (tab) {
1549
+ tab.style.display = "block";
1550
+ tab.className += " active";
1551
+ // evt.currentTarget.className += " active";
1552
+ } else {
1553
+ console.error('Tab content with ID ' + tabname + ' not found.');
1554
+ }
1555
+ }
1556
+ </script>