| 1 | <script type="text/javascript">
|
|---|
| 2 |
|
|---|
| 3 | $(document).ready(function(){
|
|---|
| 4 | var name;
|
|---|
| 5 | var value;
|
|---|
| 6 | var timeValue;
|
|---|
| 7 | var meas;
|
|---|
| 8 | var meas2;
|
|---|
| 9 | var x=0;
|
|---|
| 10 | var measurement=0;
|
|---|
| 11 | var getTableId;
|
|---|
| 12 | var is=0;
|
|---|
| 13 | window.cnt=0;
|
|---|
| 14 | var x = 0;
|
|---|
| 15 | <?php
|
|---|
| 16 | include '../include/factdb.php';
|
|---|
| 17 | if(isset($_GET['days']))
|
|---|
| 18 | {
|
|---|
| 19 | $day = $_GET['days'];
|
|---|
| 20 | }
|
|---|
| 21 | else
|
|---|
| 22 | {
|
|---|
| 23 | $day =date("Y-m-d");
|
|---|
| 24 | }
|
|---|
| 25 | $days = Date('Y-m-d',strtotime($day));
|
|---|
| 26 | $fetch = mysql_query("SELECT * FROM schedule ORDER BY fScheduleID ASC") or die(mysql_error());
|
|---|
| 27 | while($rows = mysql_fetch_array($fetch))
|
|---|
| 28 | {
|
|---|
| 29 | $timestamp=strtotime($rows['fStart']);
|
|---|
| 30 | $timestamp2 = date('Y-m-d',$timestamp);
|
|---|
| 31 | $date_time = date('H:i',$timestamp);
|
|---|
| 32 |
|
|---|
| 33 | if($days == $timestamp2)
|
|---|
| 34 | {
|
|---|
| 35 | ?>
|
|---|
| 36 | cnt++;
|
|---|
| 37 |
|
|---|
| 38 | $('#save').attr('value','UPDATE');
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | var div= document.createElement("div");
|
|---|
| 42 | div.setAttribute('id','TableHolder');
|
|---|
| 43 | var table = document.createElement("table");
|
|---|
| 44 | table.setAttribute('id',"table"+cnt);
|
|---|
| 45 | table.setAttribute('width','100%');
|
|---|
| 46 | var tr = document.createElement('tr');
|
|---|
| 47 | var td3=document.createElement('td');
|
|---|
| 48 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 49 | td3.setAttribute('class','first');
|
|---|
| 50 | td3.appendChild(
|
|---|
| 51 | input = document.createElement("input"),
|
|---|
| 52 | input.setAttribute("type","time"),
|
|---|
| 53 | input.setAttribute("id","Time"),
|
|---|
| 54 | input.setAttribute("max","24"),
|
|---|
| 55 | input.setAttribute("min","1"),
|
|---|
| 56 | input.setAttribute("required",true),
|
|---|
| 57 | input.setAttribute("value",'<?php echo $date_time; ?>')
|
|---|
| 58 |
|
|---|
| 59 | );
|
|---|
| 60 | td3.appendChild(
|
|---|
| 61 | button=document.createElement('input'),
|
|---|
| 62 | button.setAttribute('type','button'),
|
|---|
| 63 | button.setAttribute('value','[+]'),
|
|---|
| 64 | button.setAttribute('id','btnAddTime'),
|
|---|
| 65 | button.setAttribute('name','table'+cnt),
|
|---|
| 66 | button.onclick=function(){
|
|---|
| 67 |
|
|---|
| 68 | var aa;
|
|---|
| 69 | $('div#TableHolder #table'+cnt+' #Time').each(function(){
|
|---|
| 70 | aa = $(this).val();
|
|---|
| 71 | });
|
|---|
| 72 |
|
|---|
| 73 | if(aa != ""){ var splitting =aa.split(':'); var add = 01;
|
|---|
| 74 |
|
|---|
| 75 | timeValue = aa;
|
|---|
| 76 |
|
|---|
| 77 | function pad(number, length) {
|
|---|
| 78 |
|
|---|
| 79 | var str = '' + number;
|
|---|
| 80 | while (str.length < length) {
|
|---|
| 81 | str = '0' + str;
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | return str;
|
|---|
| 85 |
|
|---|
| 86 | };
|
|---|
| 87 |
|
|---|
| 88 | var s = 0; var get;
|
|---|
| 89 | var nn = '#'+$(this).attr('name');
|
|---|
| 90 | $("table").each(function() { if($(this).attr("name")==nn){ get = "#"+$(this).attr("id"); s =1; }else{ if(s==0){ get = nn; }
|
|---|
| 91 | }
|
|---|
| 92 | });
|
|---|
| 93 | getTableId =get;
|
|---|
| 94 | name="name"; value = nn;
|
|---|
| 95 | measurement = 0;
|
|---|
| 96 | meas = "class"; meas2 = "time"; //getTableId = $(this).attr('name');
|
|---|
| 97 | split2(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 | }
|
|---|
| 102 | );
|
|---|
| 103 | var td=document.createElement('td');
|
|---|
| 104 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 105 | td.appendChild(
|
|---|
| 106 | sourcecbo= document.createElement('select'),
|
|---|
| 107 | sourcecbo.setAttribute('id','source'),
|
|---|
| 108 | <?php
|
|---|
| 109 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 110 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 111 | {
|
|---|
| 112 | ?>
|
|---|
| 113 | sourcecbo.appendChild(
|
|---|
| 114 | option=document.createElement('option'),
|
|---|
| 115 |
|
|---|
| 116 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 117 | <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo"option.setAttribute('selected',true),"; } ?>
|
|---|
| 118 |
|
|---|
| 119 |
|
|---|
| 120 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 | ),
|
|---|
| 124 | <?php
|
|---|
| 125 | }
|
|---|
| 126 | ?>
|
|---|
| 127 | sourcecbo.setAttribute('id','source')
|
|---|
| 128 |
|
|---|
| 129 | );
|
|---|
| 130 | var td1=document.createElement('td');
|
|---|
| 131 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 132 | td1.appendChild(
|
|---|
| 133 | measurementcbo= document.createElement('select'),
|
|---|
| 134 | measurementcbo.setAttribute('id','measurement'),
|
|---|
| 135 | <?php
|
|---|
| 136 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 137 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 138 | {
|
|---|
| 139 | ?>
|
|---|
| 140 | measurementcbo.appendChild(
|
|---|
| 141 | option=document.createElement('option'),
|
|---|
| 142 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 143 |
|
|---|
| 144 | <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} ?>
|
|---|
| 145 |
|
|---|
| 146 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 147 | ),
|
|---|
| 148 | <?php
|
|---|
| 149 | }
|
|---|
| 150 | ?>
|
|---|
| 151 | measurementcbo.setAttribute('id','measurement')
|
|---|
| 152 | );
|
|---|
| 153 | td1.appendChild(
|
|---|
| 154 | button=document.createElement('input'),
|
|---|
| 155 | button.setAttribute('type','button'),
|
|---|
| 156 | button.setAttribute('value','[+]'),
|
|---|
| 157 | button.setAttribute('id','btnAddTime'),
|
|---|
| 158 | button.setAttribute('name','#table'+cnt),
|
|---|
| 159 | button.onclick=function(){
|
|---|
| 160 | var aa;
|
|---|
| 161 | $('div#TableHolder #table'+cnt+' #Time').each(function(){
|
|---|
| 162 | aa = $(this).val();
|
|---|
| 163 | });
|
|---|
| 164 |
|
|---|
| 165 | if(aa != ""){ timeValue = aa; name="name"; value=$(this).attr('name'); measurement=1; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 166 |
|
|---|
| 167 | }
|
|---|
| 168 | );
|
|---|
| 169 | var td2=document.createElement('td');
|
|---|
| 170 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 171 | td2.appendChild(
|
|---|
| 172 | input = document.createElement('input'),
|
|---|
| 173 | input.setAttribute('type','text'),
|
|---|
| 174 | input.setAttribute('id','txtData'),
|
|---|
| 175 | input.setAttribute('value','<?php echo $rows['fData']; ?>')
|
|---|
| 176 |
|
|---|
| 177 |
|
|---|
| 178 | );
|
|---|
| 179 | var td4=document.createElement('td');
|
|---|
| 180 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 181 | td4.appendChild(
|
|---|
| 182 | button=document.createElement('input'),
|
|---|
| 183 | button.setAttribute('type','button'),
|
|---|
| 184 | button.setAttribute('value','Delete'),
|
|---|
| 185 | button.setAttribute('id','btnDelete'),
|
|---|
| 186 | button.onclick=function(){
|
|---|
| 187 | $('#table'+cnt).remove();
|
|---|
| 188 | }
|
|---|
| 189 | );
|
|---|
| 190 |
|
|---|
| 191 | tr.appendChild(td3);
|
|---|
| 192 | tr.appendChild(td1);
|
|---|
| 193 | tr.appendChild(td);
|
|---|
| 194 |
|
|---|
| 195 | tr.appendChild(td2);
|
|---|
| 196 | tr.appendChild(td4);
|
|---|
| 197 | table.appendChild(tr);
|
|---|
| 198 | div.appendChild(table);
|
|---|
| 199 | $('#TableH1').append(div);
|
|---|
| 200 |
|
|---|
| 201 | <?php
|
|---|
| 202 | }
|
|---|
| 203 | }
|
|---|
| 204 | ?>
|
|---|
| 205 |
|
|---|
| 206 | if(cnt==0)
|
|---|
| 207 | {
|
|---|
| 208 | $('#save').attr('value','SAVE');
|
|---|
| 209 | var div= document.createElement("div");
|
|---|
| 210 | div.setAttribute('id','TableHolder');
|
|---|
| 211 | var table = document.createElement("table");
|
|---|
| 212 | table.setAttribute('id',"table2");
|
|---|
| 213 | table.setAttribute('width','100%');
|
|---|
| 214 | table.setAttribute('name','#table2');
|
|---|
| 215 | var tr = document.createElement('tr');
|
|---|
| 216 | tr.setAttribute('id','');
|
|---|
| 217 | tr.setAttribute('class','');
|
|---|
| 218 | var td3=document.createElement('td');
|
|---|
| 219 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 220 | td3.setAttribute('class','first');
|
|---|
| 221 | td3.appendChild(
|
|---|
| 222 | input = document.createElement("input"),
|
|---|
| 223 | input.setAttribute("type","time"),
|
|---|
| 224 | input.setAttribute("id","Time"),
|
|---|
| 225 | input.setAttribute("max","24"),
|
|---|
| 226 | input.setAttribute("min","1"),
|
|---|
| 227 | input.setAttribute("required",true),
|
|---|
| 228 | input.onkeyup = function(){
|
|---|
| 229 |
|
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 232 |
|
|---|
| 233 | if($('div#TableHolder #table2 #Time').val() <= 0 || $('div#TableHolder #table1 #Time').val() <=0){
|
|---|
| 234 |
|
|---|
| 235 |
|
|---|
| 236 | }else{
|
|---|
| 237 | if($('div#TableHolder #table1 #Time').val() <= $('div#TableHolder #table2 #Time').val()){
|
|---|
| 238 | alert('2nd row must be greater than 1st');
|
|---|
| 239 | }
|
|---|
| 240 | }
|
|---|
| 241 |
|
|---|
| 242 |
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
|
|---|
| 247 | }
|
|---|
| 248 |
|
|---|
| 249 |
|
|---|
| 250 | );
|
|---|
| 251 | td3.appendChild(
|
|---|
| 252 | button=document.createElement('input'),
|
|---|
| 253 | button.setAttribute('type','button'),
|
|---|
| 254 | button.setAttribute('value','[+]'),
|
|---|
| 255 | button.setAttribute('id','btnAddTime'),
|
|---|
| 256 | button.setAttribute('name','#table2'),
|
|---|
| 257 | button.onclick=function(){
|
|---|
| 258 | var aa;
|
|---|
| 259 | $('div#TableHolder #table2 #Time').each(function(){
|
|---|
| 260 | aa = $(this).val();
|
|---|
| 261 | });
|
|---|
| 262 |
|
|---|
| 263 | if(aa != ""){ var splitting =aa.split(':'); var add = 01;
|
|---|
| 264 |
|
|---|
| 265 | timeValue = aa;
|
|---|
| 266 |
|
|---|
| 267 | function pad(number, length) {
|
|---|
| 268 |
|
|---|
| 269 | var str = '' + number;
|
|---|
| 270 | while (str.length < length) {
|
|---|
| 271 | str = '0' + str;
|
|---|
| 272 | }
|
|---|
| 273 |
|
|---|
| 274 | return str;
|
|---|
| 275 |
|
|---|
| 276 | };
|
|---|
| 277 |
|
|---|
| 278 | var s = 0; var get;
|
|---|
| 279 |
|
|---|
| 280 | $("table").each(function() { if($(this).attr("name")=='#table2'){ get = "#"+$(this).attr("id"); s =1; }else{ if(s==0){ get = '#table2'; }
|
|---|
| 281 | }
|
|---|
| 282 | });
|
|---|
| 283 | getTableId =get;
|
|---|
| 284 | name="name"; value = '#table2';
|
|---|
| 285 | measurement = 0;
|
|---|
| 286 | meas = "class"; meas2 = "time"; //getTableId = $(this).attr('name');
|
|---|
| 287 | split2(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 288 |
|
|---|
| 289 |
|
|---|
| 290 | }
|
|---|
| 291 | );
|
|---|
| 292 | var td=document.createElement('td');
|
|---|
| 293 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 294 | td.appendChild(
|
|---|
| 295 | sourcecbo= document.createElement('select'),
|
|---|
| 296 | sourcecbo.setAttribute('id','source'),
|
|---|
| 297 | <?php
|
|---|
| 298 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 299 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 300 | {
|
|---|
| 301 | ?>
|
|---|
| 302 | sourcecbo.appendChild(
|
|---|
| 303 | option=document.createElement('option'),
|
|---|
| 304 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 305 | option.setAttribute('selected',true),
|
|---|
| 306 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 307 |
|
|---|
| 308 | ),
|
|---|
| 309 | <?php
|
|---|
| 310 | }
|
|---|
| 311 | ?>
|
|---|
| 312 | sourcecbo.setAttribute('id','source')
|
|---|
| 313 |
|
|---|
| 314 | );
|
|---|
| 315 | var td1=document.createElement('td');
|
|---|
| 316 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 317 | td1.appendChild(
|
|---|
| 318 | measurementcbo= document.createElement('select'),
|
|---|
| 319 | measurementcbo.setAttribute('id','measurement'),
|
|---|
| 320 | <?php
|
|---|
| 321 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 322 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 323 | {
|
|---|
| 324 | ?>
|
|---|
| 325 | measurementcbo.appendChild(
|
|---|
| 326 | option=document.createElement('option'),
|
|---|
| 327 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 328 | option.setAttribute('selected',true),
|
|---|
| 329 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 330 | ),
|
|---|
| 331 | <?php
|
|---|
| 332 | }
|
|---|
| 333 | ?>
|
|---|
| 334 | measurementcbo.setAttribute('id','measurement')
|
|---|
| 335 | );
|
|---|
| 336 | td1.appendChild(
|
|---|
| 337 | button=document.createElement('input'),
|
|---|
| 338 | button.setAttribute('type','button'),
|
|---|
| 339 | button.setAttribute('value','[+]'),
|
|---|
| 340 | button.setAttribute('id','btnAddTime'),
|
|---|
| 341 | button.setAttribute('name','#table2'),
|
|---|
| 342 | button.onclick=function(){
|
|---|
| 343 | var aa;
|
|---|
| 344 | $('div#TableHolder #table2 #Time').each(function(){
|
|---|
| 345 | aa = $(this).val();
|
|---|
| 346 | });
|
|---|
| 347 | if(aa != ""){ timeValue =aa; name="name"; value=$(this).attr('name'); measurement = 1; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 | }
|
|---|
| 351 | );
|
|---|
| 352 | var td2=document.createElement('td');
|
|---|
| 353 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 354 | td2.appendChild(
|
|---|
| 355 | input = document.createElement('input'),
|
|---|
| 356 | input.setAttribute('type','text'),
|
|---|
| 357 | input.setAttribute('id','txtData')
|
|---|
| 358 |
|
|---|
| 359 | );
|
|---|
| 360 | var td4=document.createElement('td');
|
|---|
| 361 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 362 |
|
|---|
| 363 | td4.appendChild(
|
|---|
| 364 | button=document.createElement('input'),
|
|---|
| 365 | button.setAttribute('type','button'),
|
|---|
| 366 | button.setAttribute('value','Delete'),
|
|---|
| 367 | button.setAttribute('id','btnDelete'),
|
|---|
| 368 | button.onclick=function(){
|
|---|
| 369 | $('#table2').remove();
|
|---|
| 370 |
|
|---|
| 371 | }
|
|---|
| 372 | );
|
|---|
| 373 |
|
|---|
| 374 | tr.appendChild(td3);
|
|---|
| 375 | tr.appendChild(td1);
|
|---|
| 376 | tr.appendChild(td);
|
|---|
| 377 |
|
|---|
| 378 | tr.appendChild(td2);
|
|---|
| 379 | tr.appendChild(td4);
|
|---|
| 380 | table.appendChild(tr);
|
|---|
| 381 | div.appendChild(table);
|
|---|
| 382 | $('#TableH1').append(div);
|
|---|
| 383 |
|
|---|
| 384 | var div= document.createElement("div");
|
|---|
| 385 | div.setAttribute('id','TableHolder');
|
|---|
| 386 | var table = document.createElement("table");
|
|---|
| 387 | table.setAttribute('id',"table1");
|
|---|
| 388 | table.setAttribute('width','100%');
|
|---|
| 389 | var tr = document.createElement('tr');
|
|---|
| 390 | tr.setAttribute('id','');
|
|---|
| 391 | tr.setAttribute('class','');
|
|---|
| 392 | var td3=document.createElement('td');
|
|---|
| 393 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 394 | td3.setAttribute('class','first');
|
|---|
| 395 | td3.appendChild(
|
|---|
| 396 | input = document.createElement("input"),
|
|---|
| 397 | input.setAttribute("type","time"),
|
|---|
| 398 | input.setAttribute("id","Time"),
|
|---|
| 399 | input.setAttribute("max","24"),
|
|---|
| 400 | input.setAttribute("min","1"),
|
|---|
| 401 | input.setAttribute("required",true),
|
|---|
| 402 | input.onkeyup = function(){
|
|---|
| 403 |
|
|---|
| 404 |
|
|---|
| 405 |
|
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 | if($('div#TableHolder #table2 #Time').val() <= 0 || $('div#TableHolder #table1 #Time').val() <=0){
|
|---|
| 409 |
|
|---|
| 410 |
|
|---|
| 411 | }else{
|
|---|
| 412 | if($('div#TableHolder #table1 #Time').val() <= $('div#TableHolder #table2 #Time').val()){
|
|---|
| 413 | alert(' row must be greater than previous');
|
|---|
| 414 | return false;
|
|---|
| 415 | }
|
|---|
| 416 | }
|
|---|
| 417 |
|
|---|
| 418 |
|
|---|
| 419 |
|
|---|
| 420 |
|
|---|
| 421 |
|
|---|
| 422 |
|
|---|
| 423 | }
|
|---|
| 424 | );
|
|---|
| 425 | td3.appendChild(
|
|---|
| 426 | button=document.createElement('input'),
|
|---|
| 427 | button.setAttribute('type','button'),
|
|---|
| 428 | button.setAttribute('value','[+]'),
|
|---|
| 429 | button.setAttribute('id','btnAddTime'),
|
|---|
| 430 | button.setAttribute('name','#table1'),
|
|---|
| 431 | button.onclick=function(){
|
|---|
| 432 | var aa;
|
|---|
| 433 | $('div#TableHolder #table1 #Time').each(function(){
|
|---|
| 434 | aa = $(this).val();
|
|---|
| 435 | });
|
|---|
| 436 | if(aa !='') { var splitting =aa.split(':'); var add = 01;
|
|---|
| 437 |
|
|---|
| 438 | timeValue = aa;
|
|---|
| 439 |
|
|---|
| 440 | function pad(number, length) {
|
|---|
| 441 |
|
|---|
| 442 | var str = '' + number;
|
|---|
| 443 | while (str.length < length) {
|
|---|
| 444 | str = '0' + str;
|
|---|
| 445 | }
|
|---|
| 446 |
|
|---|
| 447 | return str;
|
|---|
| 448 |
|
|---|
| 449 | };
|
|---|
| 450 |
|
|---|
| 451 |
|
|---|
| 452 | var s = 0; var get;
|
|---|
| 453 |
|
|---|
| 454 | $("table").each(function() {
|
|---|
| 455 | if($(this).attr("name")=='#table1'){
|
|---|
| 456 | get = "#"+$(this).attr("id");
|
|---|
| 457 |
|
|---|
| 458 | s =1;
|
|---|
| 459 | }else{
|
|---|
| 460 | if(s==0){
|
|---|
| 461 | get = '#table1';
|
|---|
| 462 | }
|
|---|
| 463 | }
|
|---|
| 464 | });
|
|---|
| 465 | getTableId =get;
|
|---|
| 466 | name="name"; value = '#table1';
|
|---|
| 467 | measurement = 0;
|
|---|
| 468 | meas = "class"; meas2 = "time"; //getTableId = $(this).attr('name');
|
|---|
| 469 | split2(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 470 |
|
|---|
| 471 |
|
|---|
| 472 | }
|
|---|
| 473 | );
|
|---|
| 474 | var td=document.createElement('td');
|
|---|
| 475 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 476 | td.appendChild(
|
|---|
| 477 | sourcecbo= document.createElement('select'),
|
|---|
| 478 | sourcecbo.setAttribute('id','source'),
|
|---|
| 479 | <?php
|
|---|
| 480 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 481 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 482 | {
|
|---|
| 483 | ?>
|
|---|
| 484 | sourcecbo.appendChild(
|
|---|
| 485 | option=document.createElement('option'),
|
|---|
| 486 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 487 | option.setAttribute('selected',true),
|
|---|
| 488 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 489 |
|
|---|
| 490 | ),
|
|---|
| 491 | <?php
|
|---|
| 492 | }
|
|---|
| 493 | ?>
|
|---|
| 494 | sourcecbo.setAttribute('id','source')
|
|---|
| 495 |
|
|---|
| 496 | );
|
|---|
| 497 | var td1=document.createElement('td');
|
|---|
| 498 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 499 | td1.appendChild(
|
|---|
| 500 | measurementcbo= document.createElement('select'),
|
|---|
| 501 | measurementcbo.setAttribute('id','measurement'),
|
|---|
| 502 | <?php
|
|---|
| 503 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 504 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 505 | {
|
|---|
| 506 | ?>
|
|---|
| 507 | measurementcbo.appendChild(
|
|---|
| 508 | option=document.createElement('option'),
|
|---|
| 509 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 510 | option.setAttribute('selected',true),
|
|---|
| 511 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 512 | ),
|
|---|
| 513 | <?php
|
|---|
| 514 | }
|
|---|
| 515 | ?>
|
|---|
| 516 | measurementcbo.setAttribute('id','measurement')
|
|---|
| 517 | );
|
|---|
| 518 | td1.appendChild(
|
|---|
| 519 | button=document.createElement('input'),
|
|---|
| 520 | button.setAttribute('type','button'),
|
|---|
| 521 | button.setAttribute('value','[+]'),
|
|---|
| 522 | button.setAttribute('id','btnAddTime'),
|
|---|
| 523 | button.setAttribute('name','#table1'),
|
|---|
| 524 | button.onclick=function(){
|
|---|
| 525 | var aa;
|
|---|
| 526 | $('div#TableHolder #table1 #Time').each(function(){
|
|---|
| 527 | aa = $(this).val();
|
|---|
| 528 | });
|
|---|
| 529 |
|
|---|
| 530 | if(aa != ""){ timeValue = aa; name="name"; value="#table1"; measurement=1; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 | }
|
|---|
| 534 | );
|
|---|
| 535 | var td2=document.createElement('td');
|
|---|
| 536 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 537 | td2.appendChild(
|
|---|
| 538 | input = document.createElement('input'),
|
|---|
| 539 | input.setAttribute('type','text'),
|
|---|
| 540 | input.setAttribute('id','txtData')
|
|---|
| 541 |
|
|---|
| 542 | );
|
|---|
| 543 | var td4=document.createElement('td');
|
|---|
| 544 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 545 |
|
|---|
| 546 | td4.appendChild(
|
|---|
| 547 | button=document.createElement('input'),
|
|---|
| 548 | button.setAttribute('type','button'),
|
|---|
| 549 | button.setAttribute('value','Delete'),
|
|---|
| 550 | button.setAttribute('id','btnDelete'),
|
|---|
| 551 | button.onclick=function(){
|
|---|
| 552 | $('#table1').remove();
|
|---|
| 553 |
|
|---|
| 554 | }
|
|---|
| 555 | );
|
|---|
| 556 |
|
|---|
| 557 | tr.appendChild(td3);
|
|---|
| 558 | tr.appendChild(td1);
|
|---|
| 559 | tr.appendChild(td);
|
|---|
| 560 |
|
|---|
| 561 | tr.appendChild(td2);
|
|---|
| 562 | tr.appendChild(td4);
|
|---|
| 563 | table.appendChild(tr);
|
|---|
| 564 | div.appendChild(table);
|
|---|
| 565 | $('#TableH1').append(div);
|
|---|
| 566 |
|
|---|
| 567 |
|
|---|
| 568 | }
|
|---|
| 569 | var meas;
|
|---|
| 570 | var timeValue;
|
|---|
| 571 | var pad;
|
|---|
| 572 | if(cnt==0){ cnt=2; }
|
|---|
| 573 | function split2()
|
|---|
| 574 | {
|
|---|
| 575 |
|
|---|
| 576 | cnt++;
|
|---|
| 577 | var div= document.createElement("div");
|
|---|
| 578 | div.setAttribute('id','TableHolder');
|
|---|
| 579 | var table = document.createElement("table");
|
|---|
| 580 | table.setAttribute('id',"table"+cnt);
|
|---|
| 581 | table.setAttribute('width','100%');
|
|---|
| 582 | if(measurement==1){ table.setAttribute(name,value); }
|
|---|
| 583 | var tr = document.createElement('tr');
|
|---|
| 584 | tr.setAttribute('id','');
|
|---|
| 585 | tr.setAttribute('class','');
|
|---|
| 586 |
|
|---|
| 587 | var td3=document.createElement('td');
|
|---|
| 588 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 589 | td3.setAttribute('class','first');
|
|---|
| 590 |
|
|---|
| 591 | td3.appendChild(
|
|---|
| 592 | input = document.createElement("input"),
|
|---|
| 593 | input.setAttribute("type","time"),
|
|---|
| 594 | input.setAttribute("id","Time"),
|
|---|
| 595 | input.setAttribute("max","24"),
|
|---|
| 596 | input.setAttribute("min",'1'),
|
|---|
| 597 | input.setAttribute("required",true),
|
|---|
| 598 | input.setAttribute(meas,meas2),
|
|---|
| 599 | input.setAttribute("value",timeValue)
|
|---|
| 600 |
|
|---|
| 601 |
|
|---|
| 602 | );
|
|---|
| 603 | td3.appendChild(
|
|---|
| 604 | button=document.createElement('input'),
|
|---|
| 605 | button.setAttribute('type','button'),
|
|---|
| 606 | button.setAttribute('value','[+]'),
|
|---|
| 607 | button.setAttribute('id','btnAddTime'),
|
|---|
| 608 | button.setAttribute(meas,meas2),
|
|---|
| 609 | button.setAttribute('name','table'+cnt),
|
|---|
| 610 |
|
|---|
| 611 | button.onclick=function(){
|
|---|
| 612 | var aa;
|
|---|
| 613 | $('div#TableHolder #table'+cnt+' #Time').each(function(){
|
|---|
| 614 | aa = $(this).val();
|
|---|
| 615 | });
|
|---|
| 616 |
|
|---|
| 617 | if(value == 'undefined'){ bb = $(this).closest('table').attr('name'); }else{
|
|---|
| 618 | bb = value; }
|
|---|
| 619 | if(aa != ""){var splitting = aa.split(':'); var add = 01;
|
|---|
| 620 |
|
|---|
| 621 |
|
|---|
| 622 | timeValue = aa;
|
|---|
| 623 |
|
|---|
| 624 | function pad(number, length) {
|
|---|
| 625 |
|
|---|
| 626 | var str = '' + number;
|
|---|
| 627 | while (str.length < length) {
|
|---|
| 628 | str = '0' + str;
|
|---|
| 629 | }
|
|---|
| 630 |
|
|---|
| 631 | return str;
|
|---|
| 632 |
|
|---|
| 633 | }
|
|---|
| 634 |
|
|---|
| 635 | var s = 0; var get;
|
|---|
| 636 | var nn;
|
|---|
| 637 | nn = '#'+$(this).attr("name");
|
|---|
| 638 | $("table").each(function() {
|
|---|
| 639 | if($(this).attr("name")==nn){
|
|---|
| 640 |
|
|---|
| 641 | get = "#"+$(this).attr("id");
|
|---|
| 642 | //get = $(this).attr("name");
|
|---|
| 643 | s =1;
|
|---|
| 644 | }else{
|
|---|
| 645 | if(s==0){
|
|---|
| 646 | get = nn;
|
|---|
| 647 | }
|
|---|
| 648 | }
|
|---|
| 649 | });
|
|---|
| 650 |
|
|---|
| 651 | name="name"; value = bb;
|
|---|
| 652 | meas = "class"; meas2 = "time"; getTableId = get; measurement =0; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 653 |
|
|---|
| 654 |
|
|---|
| 655 | }
|
|---|
| 656 | );
|
|---|
| 657 |
|
|---|
| 658 | var td=document.createElement('td');
|
|---|
| 659 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 660 | td.appendChild(
|
|---|
| 661 | sourcecbo= document.createElement('select'),
|
|---|
| 662 | sourcecbo.setAttribute('id','source'),
|
|---|
| 663 | <?php
|
|---|
| 664 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 665 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 666 | {
|
|---|
| 667 | ?>
|
|---|
| 668 | sourcecbo.appendChild(
|
|---|
| 669 | option=document.createElement('option'),
|
|---|
| 670 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 671 | option.setAttribute('selected',true),
|
|---|
| 672 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 673 |
|
|---|
| 674 | ),
|
|---|
| 675 | <?php
|
|---|
| 676 | }
|
|---|
| 677 | ?>
|
|---|
| 678 | sourcecbo.setAttribute('id','source')
|
|---|
| 679 |
|
|---|
| 680 | );
|
|---|
| 681 | var td1=document.createElement('td');
|
|---|
| 682 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 683 | td1.appendChild(
|
|---|
| 684 | measurementcbo= document.createElement('select'),
|
|---|
| 685 | measurementcbo.setAttribute('id','measurement'),
|
|---|
| 686 | <?php
|
|---|
| 687 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 688 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 689 | {
|
|---|
| 690 | ?>
|
|---|
| 691 | measurementcbo.appendChild(
|
|---|
| 692 | option=document.createElement('option'),
|
|---|
| 693 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 694 | option.setAttribute('selected',true),
|
|---|
| 695 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 696 | ),
|
|---|
| 697 | <?php
|
|---|
| 698 | }
|
|---|
| 699 | ?>
|
|---|
| 700 | measurementcbo.setAttribute('id','measurement')
|
|---|
| 701 | );
|
|---|
| 702 | td1.appendChild(
|
|---|
| 703 | button=document.createElement('input'),
|
|---|
| 704 | button.setAttribute('type','button'),
|
|---|
| 705 | button.setAttribute('value','[+]'),
|
|---|
| 706 | button.setAttribute('id','btnAddTime'),
|
|---|
| 707 | button.setAttribute('name','#table'+cnt),
|
|---|
| 708 | button.onclick=function(){
|
|---|
| 709 | var aa,cc=0;
|
|---|
| 710 | var bb,dd;
|
|---|
| 711 | $('div#TableHolder #table'+cnt+' #Time').each(function(){
|
|---|
| 712 | aa = $(this).val();
|
|---|
| 713 |
|
|---|
| 714 |
|
|---|
| 715 |
|
|---|
| 716 | });
|
|---|
| 717 | dd= $(this).attr('name');
|
|---|
| 718 |
|
|---|
| 719 | if($('div#TableHolder '+dd+' #Time').is(':visible')){
|
|---|
| 720 | cc=0;
|
|---|
| 721 |
|
|---|
| 722 | }else{
|
|---|
| 723 | cc=1;
|
|---|
| 724 | }
|
|---|
| 725 |
|
|---|
| 726 | x = 1;
|
|---|
| 727 | if(meas2 == 'time' && measurement == 0 && cc != 1){ bb = '#'+$(this).closest('table').attr('id'); }else{
|
|---|
| 728 | bb = value; if($(this).closest('table').attr('name')!=value && cc!=0 ){ bb = '#'+$(this).closest('table').attr('id'); } }
|
|---|
| 729 |
|
|---|
| 730 | if(aa != "")
|
|---|
| 731 | {
|
|---|
| 732 | name = "name";
|
|---|
| 733 | value = bb;
|
|---|
| 734 |
|
|---|
| 735 | timeValue = aa;
|
|---|
| 736 | meas = "hidden";
|
|---|
| 737 | meas2 = true;
|
|---|
| 738 | getTableId = $(this).attr('name');
|
|---|
| 739 | measurement = 1;
|
|---|
| 740 | split1();
|
|---|
| 741 | }
|
|---|
| 742 | else
|
|---|
| 743 | {
|
|---|
| 744 | alert("please enter value for time to add measurement");
|
|---|
| 745 | }
|
|---|
| 746 |
|
|---|
| 747 |
|
|---|
| 748 | }
|
|---|
| 749 | );
|
|---|
| 750 |
|
|---|
| 751 | var td2=document.createElement('td');
|
|---|
| 752 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 753 | td2.appendChild(
|
|---|
| 754 | input = document.createElement('input'),
|
|---|
| 755 | input.setAttribute('type','text'),
|
|---|
| 756 | input.setAttribute('id','txtData')
|
|---|
| 757 |
|
|---|
| 758 | );
|
|---|
| 759 | var td4=document.createElement('td');
|
|---|
| 760 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 761 |
|
|---|
| 762 | td4.appendChild(
|
|---|
| 763 | button=document.createElement('input'),
|
|---|
| 764 | button.setAttribute('type','button'),
|
|---|
| 765 | button.setAttribute('value','Delete'),
|
|---|
| 766 | button.setAttribute('id','btnDelete'),
|
|---|
| 767 | button.onclick=function(){
|
|---|
| 768 | $('#table'+cnt).remove();
|
|---|
| 769 | cnt--;
|
|---|
| 770 | }
|
|---|
| 771 | );
|
|---|
| 772 |
|
|---|
| 773 | tr.appendChild(td3);
|
|---|
| 774 | tr.appendChild(td1);
|
|---|
| 775 | tr.appendChild(td);
|
|---|
| 776 |
|
|---|
| 777 | tr.appendChild(td2);
|
|---|
| 778 | tr.appendChild(td4);
|
|---|
| 779 | table.appendChild(tr);
|
|---|
| 780 | div.appendChild(table);
|
|---|
| 781 | $(div).insertAfter($(getTableId));
|
|---|
| 782 |
|
|---|
| 783 |
|
|---|
| 784 |
|
|---|
| 785 | }
|
|---|
| 786 | function split1()
|
|---|
| 787 | {
|
|---|
| 788 |
|
|---|
| 789 | cnt++;
|
|---|
| 790 | var div= document.createElement("div");
|
|---|
| 791 | div.setAttribute('id','TableHolder');
|
|---|
| 792 | var table = document.createElement("table");
|
|---|
| 793 | table.setAttribute('id',"table"+cnt);
|
|---|
| 794 | table.setAttribute('width','100%');
|
|---|
| 795 | if(measurement==1){ table.setAttribute(name,value); }
|
|---|
| 796 | var tr = document.createElement('tr');
|
|---|
| 797 | tr.setAttribute('id','');
|
|---|
| 798 | tr.setAttribute('class','');
|
|---|
| 799 |
|
|---|
| 800 | var td3=document.createElement('td');
|
|---|
| 801 | td3.setAttribute('style','border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;');
|
|---|
| 802 | td3.setAttribute('class','first');
|
|---|
| 803 | td3.appendChild(
|
|---|
| 804 | input = document.createElement("input"),
|
|---|
| 805 | input.setAttribute("type","time"),
|
|---|
| 806 | input.setAttribute("id","Time"),
|
|---|
| 807 | input.setAttribute("max","24"),
|
|---|
| 808 | input.setAttribute("min",'1'),
|
|---|
| 809 | input.setAttribute("required",true),
|
|---|
| 810 | input.setAttribute(meas,meas2),
|
|---|
| 811 | input.setAttribute("value",timeValue)
|
|---|
| 812 |
|
|---|
| 813 | );
|
|---|
| 814 | td3.appendChild(
|
|---|
| 815 | button=document.createElement('input'),
|
|---|
| 816 | button.setAttribute('type','button'),
|
|---|
| 817 | button.setAttribute('value','[+]'),
|
|---|
| 818 | button.setAttribute('id','btnAddTime'),
|
|---|
| 819 | button.setAttribute(meas,meas2),
|
|---|
| 820 | button.setAttribute('name','table'+cnt),
|
|---|
| 821 |
|
|---|
| 822 | button.onclick=function(){
|
|---|
| 823 | var aa;
|
|---|
| 824 | $('div#TableHolder #table'+cnt+' #Time').each(function(){
|
|---|
| 825 | aa = $(this).val();
|
|---|
| 826 | });
|
|---|
| 827 | if(value == 'undefined'){ bb = $(this).closest('table').attr('name'); }else{
|
|---|
| 828 | bb = value; }
|
|---|
| 829 | if(aa != ""){ var splitting = aa.split(':'); var add = 01;
|
|---|
| 830 |
|
|---|
| 831 | timeValue = aa;
|
|---|
| 832 |
|
|---|
| 833 | function pad(number, length) {
|
|---|
| 834 |
|
|---|
| 835 | var str = '' + number;
|
|---|
| 836 | while (str.length < length) {
|
|---|
| 837 | str = '0' + str;
|
|---|
| 838 | }
|
|---|
| 839 |
|
|---|
| 840 | return str;
|
|---|
| 841 |
|
|---|
| 842 | }
|
|---|
| 843 | var s = 0; var get;
|
|---|
| 844 | var nn;
|
|---|
| 845 | nn = '#'+$(this).attr("name");
|
|---|
| 846 | $("table").each(function() {
|
|---|
| 847 | if($(this).attr("name")==nn){
|
|---|
| 848 |
|
|---|
| 849 | get = "#"+$(this).attr("id");
|
|---|
| 850 | //get = $(this).attr("name");
|
|---|
| 851 | s =1;
|
|---|
| 852 | }else{
|
|---|
| 853 | if(s==0){
|
|---|
| 854 | get = nn;
|
|---|
| 855 | }
|
|---|
| 856 | }
|
|---|
| 857 | });
|
|---|
| 858 |
|
|---|
| 859 | name="name"; value=bb; measurement=0; meas = "class"; meas2 = "time"; getTableId = get; split1(); }else{ alert("please enter value for time to add measurement"); }
|
|---|
| 860 |
|
|---|
| 861 |
|
|---|
| 862 | }
|
|---|
| 863 | );
|
|---|
| 864 |
|
|---|
| 865 | var td=document.createElement('td');
|
|---|
| 866 | td.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 867 | td.appendChild(
|
|---|
| 868 | sourcecbo= document.createElement('select'),
|
|---|
| 869 | sourcecbo.setAttribute('id','source'),
|
|---|
| 870 | <?php
|
|---|
| 871 | $source=mysql_query("SELECT*FROM source");
|
|---|
| 872 | while($rowsource=mysql_fetch_array($source))
|
|---|
| 873 | {
|
|---|
| 874 | ?>
|
|---|
| 875 | sourcecbo.appendChild(
|
|---|
| 876 | option=document.createElement('option'),
|
|---|
| 877 | option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
|
|---|
| 878 | option.setAttribute('selected',true),
|
|---|
| 879 | option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
|
|---|
| 880 |
|
|---|
| 881 | ),
|
|---|
| 882 | <?php
|
|---|
| 883 | }
|
|---|
| 884 | ?>
|
|---|
| 885 | sourcecbo.setAttribute('id','source')
|
|---|
| 886 |
|
|---|
| 887 | );
|
|---|
| 888 | var td1=document.createElement('td');
|
|---|
| 889 | td1.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px;text-align:center;");
|
|---|
| 890 |
|
|---|
| 891 | td1.appendChild(
|
|---|
| 892 | measurementcbo= document.createElement('select'),
|
|---|
| 893 | measurementcbo.setAttribute('id','measurement'),
|
|---|
| 894 | <?php
|
|---|
| 895 | $measure=mysql_query("SELECT*FROM measurement");
|
|---|
| 896 | while($rowmeasure=mysql_fetch_array($measure))
|
|---|
| 897 | {
|
|---|
| 898 | ?>
|
|---|
| 899 | measurementcbo.appendChild(
|
|---|
| 900 | option=document.createElement('option'),
|
|---|
| 901 | option.setAttribute('value','<?php echo $rowmeasure['fMeasurementKey']; ?>'),
|
|---|
| 902 | option.setAttribute('selected',true),
|
|---|
| 903 | option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
|
|---|
| 904 | ),
|
|---|
| 905 | <?php
|
|---|
| 906 | }
|
|---|
| 907 | ?>
|
|---|
| 908 | measurementcbo.setAttribute('id','measurement')
|
|---|
| 909 | );
|
|---|
| 910 | td1.appendChild(
|
|---|
| 911 | button=document.createElement('input'),
|
|---|
| 912 | button.setAttribute('type','button'),
|
|---|
| 913 | button.setAttribute('value','[+]'),
|
|---|
| 914 | button.setAttribute('id','btnAddTimes'),
|
|---|
| 915 | button.setAttribute('name','#table'+cnt),
|
|---|
| 916 | button.onclick=function(){
|
|---|
| 917 |
|
|---|
| 918 | var aa,cc=0;
|
|---|
| 919 | var bb,dd;
|
|---|
| 920 | $('div#TableHolder #table'+cnt+' #Time').each(function(){
|
|---|
| 921 | aa = $(this).val();
|
|---|
| 922 |
|
|---|
| 923 | });
|
|---|
| 924 | dd= $(this).attr('name');
|
|---|
| 925 | if($('div#TableHolder '+dd+' #Time').is(':visible')){
|
|---|
| 926 | cc=0;
|
|---|
| 927 |
|
|---|
| 928 | }else{
|
|---|
| 929 | cc=1;
|
|---|
| 930 | }
|
|---|
| 931 | x=1;
|
|---|
| 932 | if(meas2 == 'time' && measurement == 0 && cc != 1){ bb = '#'+$(this).closest('table').attr('id'); }else{
|
|---|
| 933 | bb = value; if($(this).closest('table').attr('name')!=value && cc!=0 ){ bb = '#'+$(this).closest('table').attr('id'); } }
|
|---|
| 934 |
|
|---|
| 935 | if(aa != "")
|
|---|
| 936 | {
|
|---|
| 937 | name = "name";
|
|---|
| 938 | value = bb;
|
|---|
| 939 | //alert(value);
|
|---|
| 940 | timeValue = aa;
|
|---|
| 941 | meas = "hidden";
|
|---|
| 942 | meas2 = true;
|
|---|
| 943 | getTableId = $(this).attr('name');
|
|---|
| 944 | measurement =1;
|
|---|
| 945 | split1();
|
|---|
| 946 | }
|
|---|
| 947 | else
|
|---|
| 948 | {
|
|---|
| 949 | alert("please enter value for time to add measurement");
|
|---|
| 950 | }
|
|---|
| 951 | }
|
|---|
| 952 | );
|
|---|
| 953 |
|
|---|
| 954 | var td2=document.createElement('td');
|
|---|
| 955 | td2.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 956 | td2.appendChild(
|
|---|
| 957 | input = document.createElement('input'),
|
|---|
| 958 | input.setAttribute('type','text'),
|
|---|
| 959 | input.setAttribute('id','txtData')
|
|---|
| 960 |
|
|---|
| 961 | );
|
|---|
| 962 | var td4=document.createElement('td');
|
|---|
| 963 | td4.setAttribute("style","border:1px solid white; color:#37DFB1; font-size:14px; text-align:center;");
|
|---|
| 964 |
|
|---|
| 965 | td4.appendChild(
|
|---|
| 966 | button=document.createElement('input'),
|
|---|
| 967 | button.setAttribute('type','button'),
|
|---|
| 968 | button.setAttribute('value','Delete'),
|
|---|
| 969 | button.setAttribute('id','btnDelete'),
|
|---|
| 970 | button.onclick=function(){
|
|---|
| 971 | $('#table'+cnt).remove();
|
|---|
| 972 | cnt--;
|
|---|
| 973 | });
|
|---|
| 974 |
|
|---|
| 975 | tr.appendChild(td3);
|
|---|
| 976 | tr.appendChild(td1);
|
|---|
| 977 | tr.appendChild(td);
|
|---|
| 978 |
|
|---|
| 979 | tr.appendChild(td2);
|
|---|
| 980 | tr.appendChild(td4);
|
|---|
| 981 | table.appendChild(tr);
|
|---|
| 982 | div.appendChild(table);
|
|---|
| 983 | $(div).insertAfter($(getTableId));
|
|---|
| 984 | }
|
|---|
| 985 |
|
|---|
| 986 | //$('div#TableHolder #table'+cnt+' #Time')
|
|---|
| 987 |
|
|---|
| 988 |
|
|---|
| 989 | // $('div#TableHolder table #Time').keyup(function(){
|
|---|
| 990 |
|
|---|
| 991 | // if($('div#TableHolder #table2 #Time').val() <= 0 || $('div#TableHolder #table1 #Time').val() <=0){
|
|---|
| 992 |
|
|---|
| 993 |
|
|---|
| 994 | // }else{
|
|---|
| 995 | // if($('div#TableHolder #table1 #Time').val() <= $('div#TableHolder #table2 #Time').val()){
|
|---|
| 996 | // alert(cnt);
|
|---|
| 997 | // }
|
|---|
| 998 | // }
|
|---|
| 999 | // });
|
|---|
| 1000 |
|
|---|
| 1001 |
|
|---|
| 1002 |
|
|---|
| 1003 |
|
|---|
| 1004 |
|
|---|
| 1005 | });
|
|---|
| 1006 | </script> |
|---|