Marthee commited on
Commit
c074444
·
verified ·
1 Parent(s): 1f5bfdb

Update templates/legendDirectory.html

Browse files
Files changed (1) hide show
  1. templates/legendDirectory.html +579 -77
templates/legendDirectory.html CHANGED
@@ -1,97 +1,599 @@
1
  <!DOCTYPE html>
2
  <html lang="en" dir="ltr">
3
  <head>
 
 
 
 
 
 
4
  <link rel="stylesheet" href="https://use.typekit.net/zos0ars.css">
5
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
6
- <link rel="stylesheet" href="static/style.css">
7
-
 
 
 
 
 
8
  <meta charset="utf-8">
9
- <title>ADR Console - V2</title>
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  </head>
12
- <body>
13
-
14
- <div class="tab-nav-container">
15
-
16
- <label class="tab active pagetitle">ADR Console</label> <i class="fa fa-home" style="filter: invert();"></i>
17
-
18
- <div class="tab legends">
19
- <label> Legends' History </label>
20
- <i class="fa fa-caret-down"></i>
21
- <div class="dropbtnLinks-content">
22
- <p> hii </p>
23
  </div>
24
- </button>
25
- </div>
26
- <div class="tab userguide">
27
- <button class="dropbtn"> <i class="fa fa-info" aria-hidden="true"></i> <!--User Guide-->
28
- <i class="fa fa-caret-down"></i>
29
- </button>
 
 
 
 
 
 
 
 
 
 
30
 
31
- <div class="dropdown-content">
32
- <div id="userguidetext">
33
- <div id="textfirstpage">
34
- <label style="font-style: oblique;"> <br>
35
- Please read the following before you use this tool. </label>
36
- <br><br>
37
- <label style="font-style: oblique;" >Note : The algorithm is based on detecting shapes and colors from the plan. Some shapes such as tables and textboxes containing information about the plan may be seen as shapes as well, therefore inserted into the algorithm as well.
38
- To avoid this, please clean up the plan before you choose to measure it
39
- by erasing them or by drawing a white rectangle above them using any external tool. </label>
40
- <br>
41
 
42
- <br>
43
- The tool is divided into two main parts:
44
- <br>
45
- <li id="userguideheadings"> First Part </li>
46
- <br> You will find three dropdowns. Choose the name of the project you want to measure, along with the project part, and the project section.
47
- <br > <br>
48
- <label style="font-style: italic;"> Please double check the project section chosen as this chooses the code that will be applied to the plan. </label>
49
- <br>
50
- <br>
51
- Mark the project you wish to meaure from the section labeled 'To measure'. You could also choose any relevant documents you wish to see (optional).
52
- <br> <label style="font-style: italic;">Pixel to Metric conversion important notes : </label>When you choose to measure a specific plan, you will be provided with a pdf that has
53
- a white rectangle drawn in it. Please open this pdf in Bluebeam and measure its area and perimeter and insert them in the textboxes that will be shown below.
54
- When measuring this rectangle, you could consider it as the scale check done on Bluebeam.
55
- <br> <br> <label style="font-style: italic;">Notes when measuring secion 1.0: </label>
56
- <label id=info >Choose whether this project contains levels or not. If you wish to measure all of the plan, let the number of plans equal to one. If you wish to measure certain regions of the plan or have the plan divided into levels,
57
- please type in a number greater than 1 (number of levels). </label>
58
- <br> If you choose Measure specific regions, please draw shapes around the desired regions on Bluebeam or any external tool before choosing to measure this plan.
59
- <br> You should also insert the colors of the levels in rgb format (Red-Green-Blue).
60
-
61
- <br>
62
 
63
- <i id="secondpage" class="fa fa-arrow-right" aria-hidden="true"></i>
64
- <br>
65
- </div>
66
- <div id="textsecondpage" hidden=until-found>
67
- <br>
68
- <li id="userguideheadings" > Second part </li>
69
- <br>
70
- First, please open the google sheets link labeled 'Legend' and fill in the names of each shape.
71
- <br>Ex. The first row shows the measurement of GB-1 , in the first column type in GB-1.
72
- <br> After you are done with filling in the legend, go back to the ADR Console.
73
- You will find three dropdowns and three textboxes.
74
 
75
- <li style="list-style-type:square;"> The first dropdown will allow you to choose whether the shape is a ground beam or a pile cap. </li>
76
- <li style="list-style-type:square;"> The second dropdown is the choice of (Area-perimeter-Length-Count).</li>
77
- <li style="list-style-type:square;"> The third dropdown gives you the first part of the MC-T Name.</li>
78
- <br> Then fill in the rows below the dropdowns with the corresponding detail and depth.
79
- The plus button allows you to add more rows within this block.
80
- <br>
81
- There is another button above the dropdowns (to the right) that allows you to add another block and repeat the process for another item (Ground Beam or Pile Cap) or (Area-perimeter-Length-Count).
82
- <br><br>
83
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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
  <link rel="stylesheet" href="https://use.typekit.net/zos0ars.css">
11
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
12
+ <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
13
+ <link rel="stylesheet" href="static/MenuStyle.css">
14
+ <link rel="stylesheet" href="static/LegendPageStyle.css">
15
+ <link rel="stylesheet" href="static/wordSearchCss.css">
16
+ <link rel="stylesheet" href="static/popups.css">
17
+ <link rel="stylesheet" href="static/IMG-Larger.css">
18
+ <link rel="stylesheet" href="static/searchButton.css">
19
  <meta charset="utf-8">
20
+ <title>ADR Console</title>
21
+ <link rel = "icon" type = "image/png" sizes = "180x154" href = "static/images/TSAlogoCropped180x154.png">
22
+ <link rel = "icon" type = "image/png" sizes = "32x27" href = "static/images/TSAlogoCropped32x27.png">
23
+ <link rel = "icon" type = "image/png" sizes = "16x14" href = "static/images/TSAlogoCropped16x14.png">
24
+ <link rel = "mask-icon" href = "static/images/TSAlogoCropped180x154.png">
25
+ <link rel = "shortcut icon" href = "static/images/TSAlogoCropped180x154.png">
26
+
27
+ <script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-core.min.js"></script>
28
+ <script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-sunburst.min.js"></script>
29
+ <script src="https://cdn.anychart.com/releases/8.9.0/js/anychart-data-adapter.min.js"></script>
30
+
31
+
32
 
33
  </head>
34
+ <body >
35
+ <div id="all">
36
+ {% include 'loading.html' %}
37
+ </div>
38
+ <!--Main tab links-->
39
+ <div class="tab">
40
+ <div class="container" id="toggle">
41
+ <div class="bar1"></div>
42
+ <div class="bar2"></div>
43
+ <div class="bar3"></div>
 
44
  </div>
45
+
46
+ <!-- Home (ADR Console) button comes first -->
47
+ <a class="tablinks" id="pagetitle" href="{{ url_for('measurementConsoleFn') }}">
48
+ ADR Console <i class="fa fa-home"></i>
49
+ </a>
50
+
51
+ <!-- Legends History button comes second -->
52
+ <button class="tablinks" id="LegendHist" onclick="openTab(event, 'legends')">
53
+ Legends History <i class="fa fa-caret-down"></i>
54
+ </button>
55
+
56
+ <!-- Info button (as before) -->
57
+
58
+ <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+P6upqZGVlBS1wIJo2bRpqamoMHg7gFtwGIEqX4HEATkmcP378iGPHjmHMmDG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X5vzrz3XwA6bon+B8RXxEBPsptqAAAAABJRU5ErkJggg=="></button>
59
+
60
+ </div>
61
 
 
 
 
 
 
 
 
 
 
 
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
+ <div id="mySidebar" class="slide-out">
66
+ <div id="menuOptions">
67
+ <li onclick="openTab(event, 'home')" >Measure Plans </li>
68
+ <li><a href="{{ url_for('searchDocument') }}">Search in Documents</a></li>
69
+ </div>
70
+ </div>
71
+
72
+ <div id="home" class="tabcontent" >
73
+ <div id="loading" hidden> </div>
74
+
75
+ <div id="canvaswindow" hidden="until-found">
76
+ <canvas id="myCanvas"></canvas>
77
  <br>
78
+ <input type="button" value="Draw New Shape" id="NewShapeButtonId" />
79
+ <input type="button" value="Undo" id="undoButtonId" />
80
+ <div id="colorpickers">
81
+ <input type="color" id="color" value="#2FFFFF" >
82
+ </div>
83
+ <input type="button" value="Save" id="savecanvas" />
84
+ </div>
85
+
86
+ </div>
87
+
88
+
89
+ <div id="legends" class="tabcontent">
90
+ <ul class="graynavbarLegend" >
91
+ <label class="label1">Project Name / Project Part / NRM Section /</label> <label class="label2">Legend</label>
92
+ <div class="legendtime">
93
+ <div style="display: inline-flex;">
94
+ <label class="CreatedTime"> Created Time </label>
95
+ <button id="sortBtnCreateDesc" class="sortbutton" onclick="sortlegends(this.id)"><i id="CreatesortDesc" class="fa fa-sort-amount-desc" aria-hidden="true" ></i> </button>
96
+ <button id="sortBtnCreateAsc" class="sortbutton" onclick="sortlegends(this.id)"><i id="CreatesortAsc" class="fa fa-sort-amount-asc" aria-hidden="true" ></i></button>
97
+ </div>
98
+ <div style="display: inline-flex;">
99
+ <label class="EditTime"> Last Edited Time </label>
100
+ <button id="sortBtnEditDesc" class="sortbutton" onclick="sortlegends(this.id)"><i id="EditsortDesc" class="fa fa-sort-amount-desc" aria-hidden="true" ></i></button>
101
+ <button id="sortBtnEditAsc"class="sortbutton" onclick="sortlegends(this.id)"><i id="EditsortAsc" class="fa fa-sort-amount-asc" aria-hidden="true" ></i> </button>
102
+ </div>
103
 
104
  </div>
105
+ </ul>
106
+
 
107
  </div>
108
+ <div class="dropdown-content">
109
+ <div id="userguidetext">
110
+ <div id="textfirstpage">
111
+ <label style="font-style: oblique;"> <br> Before using this tool, kindly read the following. </label>
112
+ <br><br>
113
+ <label style="font-style: oblique;" > Note : This algorithm is based on searching in pdfs only. </label>
114
+ <br><br>
115
+ The tool has two main tabs. File search - Folder Search.
116
+ <br><br>
117
+ <li id="userguideheadings"> File Search </li>
118
+ <br>The first dropdown available allows you to select the name of the project you wish to search in.
119
+ <br >
120
+ Write down the word you want to search for in the field labeled 'Keyword'.
121
+ You could choose one or more projects to search in from the "Documents to Measure" section. Additionally, you have the ability to view any relevant documents you might need in Dropbox.(optional)
122
+ <br> <br>
123
+ <li id="userguideheadings" > Folder Search </li>
124
+ <br>
125
+ Allows you to search in all pdfs found in a specific folder.
126
+ <br><br>
127
+ <label id="underlinedLables"> - Outputs: </label> <br>
128
+ Table: Contains a summary of the keyword used to search with, the name(s) of the document(s) search in, the number of occurences.
129
+ <br>
130
+ Image View of the pages in which the keyword was found.
131
+ <br> <br> <br>
132
+ </div>
133
+ </div>
134
+ </div>
135
+ <!-- POP-UP code -- to handle errors -->
136
+ <!-- Link to trigger modal -->
137
+
138
+ <!-- Modal popup box -->
139
+ <div id="mpopupBox" class="mpopup">
140
+ <!-- Modal content -->
141
+ <div class="modal-content">
142
+ <div class="modal-header">
143
+ <span class="close">×</span>
144
+ <h2>Error</h2>
145
+ </div>
146
+ <div class="modal-body">
147
+ <p id="modal-bodyText">
148
+ </p>
149
+ </div>
150
+
151
+ </div>
152
+ </div>
153
 
 
154
  </body>
155
+ </html>
156
+
157
+ <script >
158
+ ///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
159
+
160
+ PrjNamesArray=[];
161
+ PrjPartsArray=[];
162
+ PrjSectionsArray=[];
163
+ var partsArrwithID=[];
164
+ var firstDpwnValue;
165
+ var prjids=[]
166
+
167
+ displayprjnames()
168
+ function displayprjnames(){
169
+ $.get('/getprojectnames/')
170
+ .success(function(data) {
171
+ document.getElementById("all").style.display = "none";
172
+
173
+ for (let i=0;i<data[0].length;i++)
174
+ {
175
+ PrjNamesArray.push(data[0][i]);
176
+ }
177
+
178
+ })
179
+ .error(function(jqXHR, textStatus, errorThrown) {
180
+ 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. ';
181
+ ShowPopUp();
182
+
183
+ });
184
+ }
185
+ /*Menu bar icon mySidebar and Toggle*/
186
+ var $mySidebar = document.getElementById('mySidebar');
187
+ var $toggle = document.getElementById('toggle');
188
+ $toggle.addEventListener('click', function() {
189
+
190
+ var isOpen = $mySidebar.classList.contains('slide-in');
191
+ w3_open();
192
+ $mySidebar.setAttribute('class', isOpen ? 'slide-out' : 'slide-in');
193
+ $toggle.classList.toggle("change");
194
+
195
+
196
+ if ($mySidebar.classList.contains('slide-out')){
197
+ w3_close()
198
+ }
199
+
200
+ });
201
+
202
+
203
+ //___________________________________________________________________________________________________________
204
+ //___________________________________________________________________________________________________________
205
+
206
+ //___________________________________________________________________________________________________________
207
+ //___________________________________________________________________________________________________________
208
+ /*Tab View of User Guide*/
209
+
210
+ function w3_open() {
211
+ document.getElementById("home").style.marginLeft = "25%";
212
+ document.getElementById("legends").style.marginLeft = "25%";
213
 
214
+ document.getElementById("home").style.transition= '0.8s';
215
+ document.getElementById("legends").style.transition= '0.8s';
216
+
217
+ document.getElementById("mySidebar").style.width = "25%";
218
+ document.getElementById("mySidebar").style.display = "block";
219
+ }
220
+
221
+ function w3_close() {
222
+ document.getElementById("home").style.marginLeft = "0%";
223
+ document.getElementById("legends").style.marginLeft = "0%";
224
+ document.getElementById("home").style.transition= '1.5s'
225
+ document.getElementById("legends").style.transition= '1.5s'
226
+ document.getElementById("mySidebar").style.display = "none";
227
+ }
228
+ //___________________________________________________________________________________________________________
229
+ //___________________________________________________________________________________________________________
230
+
231
+ //___________________________________________________________________________________________________________
232
+ //___________________________________________________________________________________________________________
233
+ /*Toggle Tab View of Home and Legend along with the Menu bar icon*/
234
+ function openTab(evt, tabname) {
235
+ console.log(tabname)
236
+ // Declare all variables
237
+ var i, tabcontent, tablinks;
238
+
239
+ // Get all elements with class="tabcontent" and hide them
240
+ tabcontent = document.getElementsByClassName("tabcontent");
241
+ for (i = 0; i < tabcontent.length; i++) {
242
+ tabcontent[i].style.display = "none";
243
+ }
244
+
245
+ // Get all elements with class="tablinks" and remove the class "active"
246
+ tablinks = document.getElementsByClassName("tablinks");
247
+ for (i = 0; i < tablinks.length; i++) {
248
+ tablinks[i].className = tablinks[i].className.replace(" active", "");
249
+ }
250
+
251
+ // Show the current tab, and add an "active" class to the button that opened the tab
252
+ document.getElementById(tabname).style.display = "block";
253
+ evt.currentTarget.className += " active";
254
+ var isOpen = $mySidebar.classList.contains('slide-in');
255
+ if ($mySidebar.classList.contains('slide-in'))
256
+ {
257
+ $mySidebar.setAttribute('class', isOpen ? 'slide-out' : 'slide-in');
258
+
259
+ document.getElementById("pagetitle").style.backgroundColor='rgb(0, 60, 255)';
260
+
261
+ $toggle.classList.toggle("change");
262
+
263
+ }
264
+
265
+ }
266
+ // Start with the first page (Home)
267
+ document.getElementById("LegendHist").click();
268
+ // document.getElementById("FileTabID").click();
269
+
270
+
271
+ //___________________________________________________________________________________________________________
272
+ //___________________________________________________________________________________________________________
273
+ // _________________________________________________________________________________
274
+ //___________________________________________________________________________________________________________
275
+ /*User Guide button toggle*/
276
+ function userguideclick(){
277
+ console.log('cghj')
278
+ var acc = document.getElementsByClassName("dropdown-content")[0];
279
+ var i;
280
+ acc.classList.toggle("active");
281
+
282
+ /* Toggle between hiding and showing the active panel */
283
+ if (acc.style.display === "block") {
284
+ acc.style.display = "none";
285
+
286
+ } else {
287
+ acc.style.display = "block";
288
+ acc.style.backgroundColor=(0, 153, 255);
289
+ }
290
+ }
291
+ //to be retrieved from python code
292
+
293
+
294
+ //___________________________________________________________________________________________________________
295
+ //___________________________________________________________________________________________________________
296
+ //___________________________________________________________________________________________________________
297
+ //___________________________________________________________________________________________________________
298
+ /////////////////////////////////////*LEGEND DIRECTORY*//////////////////////////////////
299
+
300
+ /////////////////////////////////////////////////////////////////////////////////////////
301
+ /////////////////////////////////////////////////////////////////////////////////////////
302
+ /*Get tables of Prj Names, parts , sections from API code */
303
+ table1={}
304
+ table2={}
305
+ table3={}
306
+ $.get('/getAPITables/')
307
+ .success(function(data){
308
+
309
+ table1=data[0]; //prj names table
310
+ table2=data[1]; //prj parts table
311
+ table3=data[2]; //prj sections table
312
+ })
313
+ .error(function(jqXHR, textStatus, errorThrown) {
314
+ PopupElement.textContent='Error occured. Refresh and try again. If the error continues, please contact the ADR team to fix it. ';
315
+ ShowPopUp();
316
+ });
317
+ var pathsarr={};
318
+ var legendscontent= document.getElementById('legends');
319
+ var createdTimeDiv= document.getElementById('createdTimeDiv');
320
+ //___________________________________________________________________________________________________________
321
+ //___________________________________________________________________________________________________________
322
+ /*Create divs for each prj and div for each part*/
323
+ getlegendstoDirectory()
324
+ function getlegendstoDirectory(){
325
+ console.log('here')
326
+ $.get( '/getdrivelinks/'+'0').then (function(data){
327
+
328
+ pathsarr=data
329
+ if (!legendscontent.children[1]){
330
+ var allprjdiv= document.createElement("div");
331
+ allprjdiv.id='allprjdiv';
332
+ }
333
+ else{
334
+ legendscontent.children[1].innerHTML='';
335
+ var allprjdiv=legendscontent.children[1];
336
+ allprjdiv.id='allprjdiv';
337
+ }
338
+
339
+ for (let proj=0; proj<PrjNamesArray.length ; proj++)
340
+ {
341
+ var labelprojdiv= document.createElement("div");
342
+ var newlabelproj = document.createElement("label")
343
+ var i = document.createElement("i");
344
+ var brk= document.createElement("br");
345
+ i.className="fa fa-folder"
346
+ newlabelproj.textContent=PrjNamesArray[proj];
347
+ newlabelproj.id='prjname';
348
+ newlabelproj.className='prjnameclass';
349
+
350
+ labelprojdiv.append(i)
351
+ labelprojdiv.append(newlabelproj)
352
+ labelprojdiv.append(brk)
353
+ allprjdiv.append(labelprojdiv)
354
+
355
+ }
356
+ legendscontent.append(allprjdiv)
357
+
358
+ legendscontent.querySelectorAll('label').forEach(function(elem){
359
+ elem.addEventListener('click',function(){
360
+
361
+ if (!elem.parentElement.children[3]){
362
+
363
+ var prjnameId;
364
+ var prjpartsforLgnd=[];
365
+ var prjpartId;
366
+ var prjSectionsforLgnd=[];
367
+ /*get prj clicked on */
368
+ for (item in table1.ProjectName)
369
+ {
370
+ if (table1.ProjectName[item] == elem.textContent.toString())
371
+ {
372
+ prjnameId = table1.ProjectId[item];
373
+ break;
374
+ }
375
+ }
376
+ /*get prj parts of this prj and its id*/
377
+ for (item in table2.ProjectId)
378
+ {
379
+ if (table2.ProjectId[item] == prjnameId.toString())
380
+ {
381
+ prjpartsforLgnd.push(table2.ProjectPart[item]);
382
+ prjpartId=table2.ProjectPartId[item] ;
383
+ }
384
+ }
385
+ var allpartsdiv= document.createElement("div");
386
+ for (let prjpart=0;prjpart<prjpartsforLgnd.length;prjpart++)
387
+ {
388
+ var labelpartdiv= document.createElement("div");
389
+ labelpartdiv.style.marginLeft='20px';
390
+
391
+ var newlabelpart = document.createElement("label")
392
+ var i = document.createElement("i");
393
+ var brk= document.createElement("br");
394
+ i.className="fa fa-folder"
395
+
396
+ newlabelpart.textContent=prjpartsforLgnd[prjpart];
397
+ newlabelpart.id='prjpart';
398
+ newlabelpart.className='prjpartclass';
399
+
400
+ labelpartdiv.append(i)
401
+ labelpartdiv.append(newlabelpart)
402
+ labelpartdiv.append(brk)
403
+
404
+ allpartsdiv.append(labelpartdiv)
405
+ }
406
+ elem.parentElement.append(allpartsdiv)
407
+ elem.parentElement.querySelector('i').className='fa fa-folder-open';
408
+ /*Sections divs*/
409
+ for (let c=0;c<elem.parentElement.children[3].children.length;c++) //Div of Part
410
+ {prjSectionsforLgnd=[]
411
+
412
+ elem.parentElement.children[3].children[0].children.innerHTML=''
413
+
414
+ elem.parentElement.children[3].children[c].children[1].addEventListener('click',function(){
415
+ var partlabelText= elem.parentElement.children[3].children[c].children[1].textContent;
416
+
417
+ for (item in table3.ProjectId)
418
+ {
419
+ if (table3.ProjectId[item] ==prjnameId && table3.ProjectPartId[item]==prjpartId )
420
+ {
421
+ prjSectionsforLgnd.push(table3.ProjectSection[item]);
422
+ }
423
+ }
424
+
425
+ if (! elem.parentElement.children[3].children[c].children[3]) {
426
+ console.log(elem.parentElement.children[3].children[c])
427
+ var labelsecdiv= document.createElement("div");
428
+ labelsecdiv.style.marginLeft='25px';
429
+
430
+ for (let cc=0;cc<prjSectionsforLgnd.length;cc++){
431
+
432
+ var seperateSecdiv = document.createElement("div")
433
+ var newlabelsec = document.createElement("label")
434
+ var i = document.createElement("i");
435
+ var brk= document.createElement("br");
436
+ i.className="fa fa-folder"
437
+ console.log('addingsection')
438
+
439
+ newlabelsec.textContent=prjSectionsforLgnd[cc];
440
+ newlabelsec.id='prjsec';
441
+ newlabelsec.className='prjsecclass';
442
+ if (!(newlabelsec.textContent.toString().startsWith('1.0') || newlabelsec.textContent.startsWith('3.2') || newlabelsec.textContent.startsWith('2.2') || newlabelsec.textContent.startsWith('2.1')))
443
+ {
444
+ newlabelsec.style.color='lightgray';
445
+ i.style.color='lightgray'
446
+ newlabelsec.style.cursor='default';
447
+ }
448
+ seperateSecdiv.append(i)
449
+ seperateSecdiv.append(newlabelsec)
450
+ seperateSecdiv.append(brk)
451
+ labelsecdiv.append(seperateSecdiv)
452
+
453
+ elem.parentElement.children[3].children[c].append(labelsecdiv)
454
+ // console.log(labelsecdiv)
455
+ }
456
+ elem.parentElement.children[3].children[c].children[0].className='fa fa-folder-open';
457
+
458
+
459
+ /*Get path to legends - project name , part , section*/
460
+
461
+ for (let k=0;k<elem.parentElement.children[3].children[c].children[3].children.length;k++)
462
+ {
463
+ elem.parentElement.children[3].children[c].children[3].children[k].children[1].addEventListener('click',function(){
464
+ legendpathh='/'+elem.textContent +'/' + partlabelText + '/' + elem.parentElement.children[3].children[c].children[3].children[k].children[1].textContent+'/'
465
+
466
+ if (!elem.parentElement.children[3].children[c].children[3].children[k].children[3])
467
+ {
468
+
469
+ for (let o=0; o<pathsarr.length;o++){
470
+ console.log(pathsarr[o])
471
+ if (JSON.stringify(pathsarr[o][1]) === JSON.stringify(legendpathh) ){
472
+ var legendsdiv= document.createElement("div");
473
+ legendsdiv.style.marginLeft='20px';
474
+
475
+ var seperateSecdiv = document.createElement("div")
476
+ var legendlabel = document.createElement("label")
477
+ var brk= document.createElement("br");
478
+ legendlabel.textContent=pathsarr[o][0]
479
+ legendlabel.id='legend';
480
+
481
+ legendlabel.className='legendclass';
482
+ var legendlabeldiv= document.createElement("div");
483
+ legendlabeldiv.id='legendtimediv'
484
+
485
+ var createdTimelbl = document.createElement("label")
486
+ var brk= document.createElement("br");
487
+ createdTimelbl.textContent=new Date(pathsarr[o][2].createdTime ).toUTCString()
488
+ createdTimelbl.id='legendtime';
489
+ createdTimelbl.className='legendclass';
490
+
491
+ var modifiedTimelbl = document.createElement("label")
492
+ var brk= document.createElement("br");
493
+ modifiedTimelbl.textContent=new Date(pathsarr[o][2].modifiedTime ).toUTCString()
494
+ modifiedTimelbl.id='legendmodtime';
495
+ modifiedTimelbl.className='legendclass';
496
+
497
+ console.log(pathsarr[o][2].createdTime,pathsarr[o][2].modifiedTime )
498
+ seperateSecdiv.append(legendlabel)
499
+ legendlabeldiv.append(createdTimelbl)
500
+ legendlabeldiv.append(modifiedTimelbl)
501
+
502
+ seperateSecdiv.style.display='flex';
503
+ seperateSecdiv.id='legendlbldivwhole'
504
+ seperateSecdiv.append(legendlabeldiv);
505
+ seperateSecdiv.append(brk);
506
+ legendsdiv.append(seperateSecdiv);
507
+ console.log(legendsdiv);
508
+
509
+ elem.parentElement.children[3].children[c].children[3].children[k].append(legendsdiv)
510
+
511
+
512
+ /*open legend link*/
513
+ seperateSecdiv.addEventListener('click',function(){
514
+ window.open('https://docs.google.com/spreadsheets/d/'+pathsarr[o][3])
515
+ })
516
+ if (elem.parentElement.children[3].children[c].children[3].children[k].children[0].className=='fa fa-folder')
517
+ elem.parentElement.children[3].children[c].children[3].children[k].children[0].className='fa fa-folder-open';
518
+ }
519
+ }
520
+ }
521
+ else{
522
+ for (let y =elem.parentElement.children[3].children[c].children[3].children[k].children.length; y>=0;y--)
523
+ {
524
+ if (elem.parentElement.children[3].children[c].children[3].children[k].children[y] instanceof HTMLDivElement)
525
+ elem.parentElement.children[3].children[c].children[3].children[k].removeChild(elem.parentElement.children[3].children[c].children[3].children[k].children[y]);
526
+ }
527
+ elem.parentElement.children[3].children[c].children[3].children[k].children[0].className='fa fa-folder';
528
+ }
529
+ })
530
+ }
531
+ }
532
+ else{
533
+ elem.parentElement.children[3].children[c].removeChild(elem.parentElement.children[3].children[c].children[3]);
534
+ elem.parentElement.children[3].children[c].children[0].className='fa fa-folder';
535
+
536
+ }
537
+
538
+ })
539
+ }
540
+ }
541
+ /*remove all parts along with sectionns of element (prj name)s*/
542
+ else{
543
+ elem.parentElement.removeChild(elem.parentElement.children[3]);
544
+ elem.parentElement.children[0].className='fa fa-folder';
545
+ }
546
+ })
547
+ })
548
+ })
549
+ }
550
+ function sortlegends(clicked_id){
551
+ var allarr=[]
552
+ for ( let u=0 ; u<document.getElementById('allprjdiv').children.length ; u++)
553
+ {
554
+ //Project names folder
555
+ if (document.getElementById('allprjdiv').children[u].children[3])
556
+ {
557
+ for (let uu=0 ; uu<document.getElementById('allprjdiv').children[u].children[3].children.length;uu++)
558
+ {//Project part folder
559
+ if(document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3])
560
+ {
561
+ var arr=[]
562
+ for (let uuu=0;uuu<document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children.length;uuu++)
563
+ {//NRM section folder - direct parent
564
+ for (let h=0;h<document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children.length;h++)
565
+ {
566
+ if (document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h] instanceof HTMLDivElement)
567
+ {
568
+ if (clicked_id == 'sortBtnCreateDesc' || clicked_id == 'sortBtnCreateAsc' )
569
+ arr.push([document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h], new Date(document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h].children[0].children[1].children[0].textContent)])
570
+ if (clicked_id == 'sortBtnEditDesc' || clicked_id == 'sortBtnEditAsc' )
571
+ arr.push([document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h], new Date(document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h].children[0].children[1].children[1].textContent)])
572
+ // legends in this parent only
573
+
574
+ if (h==document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children.length-1)
575
+ {
576
+ if (clicked_id == 'sortBtnCreateDesc' || clicked_id == 'sortBtnEditDesc' )
577
+ x=arr.sort((a, b) => b[1]- a[1])
578
+ if (clicked_id=='sortBtnCreateAsc' || clicked_id == 'sortBtnEditAsc' )
579
+ x=arr.sort((a, b) => a[1]- b[1])
580
+
581
+ if (document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].children[h] instanceof HTMLDivElement)
582
+ {
583
+ console.log(document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu] )
584
+ for (let k =0; k <x.length; k++)
585
+ document.getElementById('allprjdiv').children[u].children[3].children[uu].children[3].children[uuu].appendChild(x[k][0])
586
+ }
587
+ }
588
+ }
589
+ }
590
+ }
591
+ allarr.push(arr);
592
+ }
593
+ }
594
+ }
595
+ }
596
+ }
597
+
598
+ </script>
599
+