Advertisement
Aiaa

hover myTable

Apr 25th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.03 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  6. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  7. <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  8. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  9. <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
  10. <script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
  11. <script>
  12. $(function() {
  13. $( "#taskDate" ).datepicker();
  14. });
  15. </script>
  16. <style>
  17. div.ui.page #myTable tr td div.hoverDes{display: none;}
  18. div.ui.page #myTable tr:hover td div.hoverDes{display: inline-block;}
  19. /*
  20. h4:hover {
  21. display: inline;
  22.  
  23. }*/
  24. .ui-datepicker {
  25. background: white;
  26. /*border: 1px solid #555;*/
  27. color: black;
  28. }
  29. /* The Modal (background) */
  30.  
  31. .modal {
  32. display: none;
  33. /* Hidden by default */
  34. position: fixed;
  35. /* Stay in place */
  36. z-index: 1;
  37. /* Sit on top */
  38. padding-top: 100px;
  39. /* Location of the box */
  40. left: 0;
  41. top: 0;
  42. width: 100%;
  43. /* Full width */
  44. height: 100%;
  45. /* Full height */
  46. overflow: auto;
  47. /* Enable scroll if needed */
  48. background-color: rgb(0, 0, 0);
  49. /* Fallback color */
  50. background-color: rgba(0, 0, 0, 0.4);
  51. /* Black w/ opacity */
  52. }
  53. /* Modal Content */
  54.  
  55. .modal-content {
  56. background-color: #fefefe;
  57. margin: auto;
  58. padding: 20px;
  59. border: 1px solid #888;
  60. width: 80%;
  61. }
  62. /* The Close Button */
  63.  
  64. .close {
  65. color: #aaaaaa;
  66. float: right;
  67. font-size: 28px;
  68. font-weight: bold;
  69. }
  70.  
  71. .close:hover,
  72. .close:focus {
  73. color: #000;
  74. text-decoration: none;
  75. cursor: pointer;
  76. }
  77.  
  78. .button {
  79. background-color: grey;
  80. /* Green */
  81. border: none;
  82. color: white;
  83. padding: 4px 6px;
  84. text-align: center;
  85. text-decoration: none;
  86. display: inline-block;
  87. font-size: 16px;
  88. margin: 4px 2px;
  89. -webkit-transition-duration: 0.4s;
  90. /* Safari */
  91. transition-duration: 0.4s;
  92. cursor: pointer;
  93. }
  94.  
  95. .button1 {
  96. background-color: #e7e7e7;
  97. color: black;
  98. }
  99.  
  100. .button1:hover {
  101. background-color: #555555;
  102. }
  103.  
  104. .nav-side-menu {
  105. overflow: auto;
  106. font-family: verdana;
  107. font-size: 12px;
  108. font-weight: 200;
  109. background-color: #2e353d;
  110. position: fixed;
  111. top: 40px;
  112. width: 18%;
  113. height: 100%;
  114. color: #e1ffff;
  115. }
  116.  
  117. .myButton {
  118. background-color: #2e353d;
  119. border: none;
  120. color: white;
  121. padding: 15px 35%;
  122. text-align: center;
  123. text-decoration: none;
  124. display: inline-block;
  125. font-size: 14px;
  126. margin: 15px 4px;
  127. cursor: pointer;
  128. top: 50%;
  129. }
  130.  
  131. .myButton2 {
  132. background-color: lawngreen;
  133. border: none;
  134. color: black;
  135. padding: 15px 35%;
  136. text-align: center;
  137. text-decoration: none;
  138. display: inline-block;
  139. font-size: 14px;
  140. margin: 15px 4px;
  141. cursor: pointer;
  142. top: 50%;
  143. }
  144. .myButton2:hover {
  145. background-color: darkred;
  146. color: white;
  147. }
  148. /*#butAdd {*/
  149. /*width: XXpx;
  150. height: YYpx;*/
  151. /*position: absolute;*/
  152. /*top: Y&#37;;*/
  153. /*left: 20%;*/
  154. /*}*/
  155.  
  156.  
  157. /*#presenter{*/
  158. /*font-family: verdana;*/
  159. /*font-size: 12px;*/
  160. /*font-weight: 200;*/
  161. /*background-color: lightgrey;*/
  162. /*position: fixed;*/
  163. /*top: 40px;*/
  164. /*width: 80%;*/
  165. /*height: 10%;*/
  166. /*color: #e1ffff;*/
  167.  
  168. /*}*/
  169.  
  170.  
  171. </style>
  172. </head>
  173.  
  174.  
  175.  
  176.  
  177. <body>
  178.  
  179.  
  180.  
  181. <div class="nav-side-menu">
  182. <button class="myButton" id="butAll" onclick="drawTable1(allTasks,1); boldedAll();" ></button><br>
  183. <button class="myButton" id="butPro" onclick="drawTable2(inProgressTasks,2); boldedProg();"></button><br>
  184. <button class="myButton" id="butcom" onclick="drawTable3(finishedTasks,3); boldedFin();" ></button><br>
  185. <button class="myButton" id="butArc" onclick="drawTable4(archivedTasks,4); boldedArch();" ></button><br>
  186. <button class="myButton" id="butArc" onclick="drawTable4(archivedTasks,4); boldedArch();" ></button><br>
  187.  
  188. <button class="myButton2" id="butAdd" >Add Task</button><br>
  189.  
  190.  
  191. </div>
  192.  
  193.  
  194. <!-- Trigger/Open The Modal -->
  195. <!-- The Modal -->
  196. <div id="myModal" class="modal">
  197. <!-- Modal content -->
  198. <div class="modal-content">
  199. <span class="close">x</span>
  200. <br> Add Task:<br>
  201. <input type="text" id="addTask" size="50">
  202. <br> Date:<br>
  203. <input type="text" id="taskDate" size="20">
  204. <br>Description<br>
  205. <input type="text" id="description" size="70">
  206. <br><br>
  207. <button type="button" class="button button1" onclick="assignVals(); drawTable1(allTasks,1); ">Add Task!</button>
  208. <button type="button" class="button button3" onclick="cancelBut(); ">Cancel input</button>
  209.  
  210. </div>
  211. </div>
  212. <div id="myModal2" class="modal">
  213. <!-- Modal content -->
  214. <div class="modal-content">
  215. <span class="close">x</span>
  216. <br> Add Task:<br>
  217. <input type="text" id="addTask" size="50">
  218. <br> Date:<br>
  219. <input type="text" id="taskDate" size="20">
  220. <br>Description<br>
  221. <input type="text" id="description" size="70">
  222. <br><br>
  223. <button type="button" class="button button1" onclick="assignVals(); drawTable1(allTasks,1); ">Edit Task</button>
  224. <button type="button" class="button button3" onclick="cancelBut(); ">Cancel input</button>
  225.  
  226. </div>
  227. </div>
  228.  
  229. <br><br><br>
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236. <div id="presenter" align="center" style="width: 100%; height: 50px; background-color: lightgrey; font-size: 30px; font-weight: bold; ">
  237.  
  238. <p id="present"></p>
  239.  
  240.  
  241. </div>
  242.  
  243.  
  244.  
  245.  
  246.  
  247. <div id="page" class="page">
  248.  
  249. <header class="item header margin-top-0 padding-bottom-0" id="header5">
  250.  
  251. <div class="wrapper">
  252.  
  253.  
  254. <nav role="navigation" class="navbar navbar-inverse navbar-embossed navbar-lg navbar-fixed-top">
  255.  
  256. <div class="container">
  257.  
  258. <div class="navbar-header">
  259.  
  260. <a class="navbar-brand brand">TO DO '19</a>
  261. </div>
  262.  
  263.  
  264. </div>
  265. <!-- /.container -->
  266.  
  267. </nav>
  268. <h1 >
  269.  
  270.  
  271. <table align="right" width="80%" >
  272. <td>
  273. <ui>
  274. </ui>
  275. </td>
  276. <td>
  277. <p id="myTable" />
  278. </td>
  279. </table>
  280. <br><br><br>
  281.  
  282.  
  283.  
  284.  
  285. </div>
  286. <!-- /.wrapper -->
  287. </header>
  288. <!-- /.item -->
  289. </div>
  290. <!-- /#page -->
  291.  
  292.  
  293.  
  294.  
  295.  
  296. <script>
  297.  
  298. function cancelBut(){
  299. document.getElementById("addTask").value="";
  300. document.getElementById("taskDate").value="";
  301. document.getElementById("description").value="";
  302. disappear();
  303. }
  304.  
  305.  
  306.  
  307. function boldedAll(){
  308. document.getElementById("present").innerHTML="All Tasks";
  309.  
  310. }
  311. function boldedProg(){
  312. document.getElementById("present").innerHTML="In progress";
  313.  
  314. }
  315. function boldedFin(){
  316. document.getElementById("present").innerHTML="Finished";
  317.  
  318. }
  319. function boldedArch(){
  320. document.getElementById("present").innerHTML="Archived";
  321.  
  322. }
  323. //MODAL START
  324. // Get the modal
  325. var modal = document.getElementById('myModal');
  326.  
  327. // Get the button that opens the modal
  328. var btn = document.getElementById("butAdd");
  329.  
  330. // Get the <span> element that closes the modal
  331. var span = document.getElementsByClassName("close")[0];
  332.  
  333. // When the user clicks the button, open the modal
  334. btn.onclick = function() {
  335. modal.style.display = "block";
  336. }
  337.  
  338. // When the user clicks on <span> (x), close the modal
  339. span.onclick = function() {
  340. modal.style.display = "none";
  341. }
  342.  
  343. // When the user clicks anywhere outside of the modal, close it
  344. window.onclick = function(event) {
  345. if (event.target == modal) {
  346. modal.style.display = "none";
  347. }
  348. }
  349. function disappear() {
  350. modal.style.display = "none";
  351. }
  352.  
  353. // $('.modal').on('hidden.bs.modal', function(){
  354. // $(this).find('form')[0].reset();
  355. // });
  356. //MODAL END
  357.  
  358.  
  359. var allTasks = [];
  360. var inProgressTasks = [];
  361. var archivedTasks = [];
  362. var finishedTasks = [];
  363. var store=[];
  364.  
  365.  
  366. printButtons();
  367.  
  368.  
  369.  
  370. //object of the input
  371. function inputObj(name,date,description){
  372. this.name=name;
  373. this.date=date;
  374. this.description=description;
  375. }
  376. //inserting in the array of all tasks and in progress by default
  377. function assignVals(){
  378.  
  379. var createObj = new inputObj(document.getElementById("addTask").value,document.getElementById("taskDate").value,document.getElementById("description").value)
  380.  
  381. var here=false;
  382.  
  383.  
  384. for(var i=0;i<allTasks.length&&here==false&&allTasks.length>0;i++){
  385. if(allTasks[i].name==createObj.name
  386. && allTasks[i].date==createObj.date
  387. )
  388. {
  389. here=true;
  390. alert("Task already available")
  391. }
  392.  
  393.  
  394. }
  395.  
  396. var hereA=false;
  397. for(var i=0;i<archivedTasks.length&&hereA==false&&archivedTasks.length>0;i++){
  398. if(archivedTasks[i].name==createObj.name
  399. && archivedTasks[i].date==createObj.date
  400. )
  401. {
  402. hereA=true;
  403. alert("Task is already archived")
  404. }
  405.  
  406.  
  407. }
  408.  
  409. if(document.getElementById("addTask").value==""||document.getElementById("taskDate").value==""){
  410. alert("Name or date panel or both are empty");
  411. }else if(here==false&&hereA==false){
  412. allTasks.push(createObj);
  413. inProgressTasks.push(createObj);
  414. disappear();
  415. cancelBut();
  416.  
  417.  
  418. }
  419.  
  420. printButtons();
  421. }
  422.  
  423.  
  424.  
  425.  
  426. //delete fx
  427. function deleteTask (index){
  428.  
  429.  
  430. var workOnArray=[] ;
  431.  
  432. for(var j=0;j<store.length;j++){
  433.  
  434. var obj = new inputObj(store[j].name,store[j].date,store[j].description);
  435. workOnArray.push(obj);
  436. }
  437.  
  438.  
  439.  
  440. if (confirm("Are you Sure that you want to delete?") == true) {
  441.  
  442.  
  443. var here1=false;
  444. var itIsHere;
  445. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  446.  
  447. if(allTasks[i].name==workOnArray[index-1].name
  448. && allTasks[i].date==workOnArray[index-1].date
  449. && allTasks[i].description==workOnArray[index-1].description )
  450. {
  451. here1=true;
  452. itIsHere=i;
  453.  
  454. }
  455.  
  456. }
  457.  
  458.  
  459. if(here1==true){
  460. allTasks.splice(itIsHere,1);
  461. drawTable1(allTasks,1);
  462.  
  463. var flag=false;
  464. for(var i=0;i<inProgressTasks.length && flag==false;i++){
  465. if (inProgressTasks[i].name==workOnArray[index-1].name
  466. && inProgressTasks[i].date==workOnArray[index-1].date
  467. && inProgressTasks[i].description==workOnArray[index-1].description){
  468.  
  469. flag=true;
  470. inProgressTasks.splice(i,1);
  471.  
  472. }
  473.  
  474. }
  475.  
  476.  
  477.  
  478. for(var i=0;i<finishedTasks.length && flag==false;i++){
  479. if (finishedTasks[i].name==workOnArray[index-1].name
  480. && finishedTasks[i].date==workOnArray[index-1].date
  481. && finishedTasks[i].description==workOnArray[index-1].description){
  482. flag=true;
  483. finished.splice(i,1);
  484.  
  485. }
  486.  
  487. }
  488.  
  489.  
  490.  
  491. }else if (archivedTasks.length>=index && archivedTasks[index-1].name==workOnArray[index-1].name
  492. && archivedTasks[index-1].date==workOnArray[index-1].date
  493. && archivedTasks[index-1].description==workOnArray[index-1].description){
  494.  
  495. archivedTasks.splice(index-1,1);
  496. drawTable4(archivedTasks,4);
  497.  
  498.  
  499. }
  500.  
  501.  
  502.  
  503. }
  504. printButtons();
  505.  
  506. }
  507. function markAsDone(index){
  508. editBool = true ;
  509. var index2 = index-1;
  510. if(myKey==1){
  511. searchFini(index);
  512.  
  513. drawTable1(allTasks,1);
  514. }
  515. else{
  516. if(myKey==2){
  517. var createObj = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  518. delete2(index);
  519.  
  520.  
  521. if(true){
  522.  
  523. finishedTasks.push(createObj);
  524. drawTable2(inProgressTasks,2);
  525.  
  526. }
  527.  
  528. printButtons();
  529.  
  530. }
  531. else if(myKey==4){
  532. var createObj = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  533.  
  534. delete4(index);
  535.  
  536.  
  537. if(true){
  538.  
  539. finishedTasks.push(createObj);
  540. drawTable4(archivedTasks);
  541.  
  542. }
  543.  
  544. printButtons();
  545. }
  546.  
  547.  
  548.  
  549. }
  550.  
  551. }
  552.  
  553.  
  554. function archiving(index){
  555. editBool = true ;
  556. var index2 = index-1;
  557. if(myKey==1){
  558. search2(index);
  559. drawTable1(allTasks,1);
  560. }else{
  561. if(myKey==2){
  562. var createObj = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  563. delete2(index);
  564.  
  565. if(true){
  566.  
  567. archivedTasks.push(createObj);
  568.  
  569. }
  570.  
  571. printButtons();
  572. drawTable2(inProgressTasks,2);
  573. }
  574. else if(myKey==3){
  575. var createObj = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  576.  
  577. delete3(index);
  578.  
  579.  
  580. if(true){
  581.  
  582. archivedTasks.push(createObj);
  583.  
  584. }
  585.  
  586. printButtons();
  587. drawTable3(finishedTasks,3);
  588. }
  589.  
  590.  
  591. }
  592. editBool = false;
  593. }
  594. var editBool = false ;
  595.  
  596.  
  597. function deleteTask (index){
  598. if(editBool == true){
  599. var index2 = index - 1 ;
  600. if(myKey==1){
  601. var here1=false;
  602. var itIsHere1;
  603. var current = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  604. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  605.  
  606. if(allTasks[i].name==current.name
  607. && allTasks[i].date==current.date
  608. && allTasks[i].description==current.description )
  609. {
  610.  
  611. here1=true;
  612. itIsHere1=i;
  613.  
  614. }
  615.  
  616. }
  617. if(here1==true){
  618. allTasks.splice(itIsHere1,1);
  619. var here2=false;
  620. var itIsHere2;
  621. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  622.  
  623. if(inProgressTasks[i].name==current.name
  624. && inProgressTasks[i].date==current.date
  625. && inProgressTasks[i].description==current.description )
  626. {
  627.  
  628. here2=true;
  629. itIsHere2=i;
  630.  
  631. }
  632.  
  633. }
  634.  
  635. if(here2==true){
  636. inProgressTasks.splice(itIsHere2,1);
  637. }
  638. var here3=false;
  639. var itIsHere3;
  640. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  641.  
  642. if(finishedTasks[i].name==current.name
  643. && finishedTasks[i].date==current.date
  644. && finishedTasks[i].description==current.description )
  645. {
  646.  
  647. here3=true;
  648. itIsHere3=i;
  649.  
  650. }
  651.  
  652. }
  653. if(here3==true){
  654. finishedTasks.splice(itIsHere3,1);
  655.  
  656. }
  657. var here4=false;
  658. var itIsHere4;
  659. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  660.  
  661. if(archivedTasks[i].name==current.name
  662. && archivedTasks[i].date==current.date
  663. && archivedTasks[i].description==current.description )
  664. {
  665.  
  666. here4=true;
  667. itIsHere4=i;
  668.  
  669. }
  670.  
  671. }
  672. if(here4==true){
  673. archivedTasks.splice(itIsHere4,1);
  674.  
  675. }
  676.  
  677.  
  678.  
  679. }
  680.  
  681.  
  682.  
  683.  
  684. }
  685. else{
  686.  
  687. if (myKey ==2){
  688. var current = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  689. var here2=false;
  690. var itIsHere2;
  691. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  692.  
  693. if(inProgressTasks[i].name==current.name
  694. && inProgressTasks[i].date==current.date
  695. && inProgressTasks[i].description==current.description )
  696. {
  697.  
  698. here2=true;
  699. itIsHere2=i;
  700.  
  701. }
  702.  
  703. }
  704. if(here2==true){
  705. inProgressTasks.splice(itIsHere2,1);
  706. var here1=false;
  707. var itIsHere1;
  708. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  709.  
  710. if(allTasks[i].name==current.name
  711. && allTasks[i].date==current.date
  712. && allTasks[i].description==current.description )
  713. {
  714.  
  715. here1=true;
  716. itIsHere1=i;
  717.  
  718. }
  719.  
  720. }
  721. if(here1==true){
  722. allTasks.splice(itIsHere1,1);
  723. }
  724. }
  725. }
  726. else if (myKey ==3){
  727. var current = new inputObj (finishedTasks[index2].name,finishedTasks[index2].date,finishedTasks[index2].description);
  728. var here3=false;
  729. var itIsHere3;
  730. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  731.  
  732. if(finishedTasks[i].name==current.name
  733. && finishedTasks[i].date==current.date
  734. && finishedTasks[i].description==current.description )
  735. {
  736.  
  737. here3=true;
  738. itIsHere3=i;
  739.  
  740. }
  741.  
  742. }
  743. if(here3==true){
  744. finishedTasks.splice(itIsHere3,1);
  745. var here1=false;
  746. var itIsHere1;
  747. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  748.  
  749. if(allTasks[i].name==current.name
  750. && allTasks[i].date==current.date
  751. && allTasks[i].description==current.description )
  752. {
  753.  
  754. here1=true;
  755. itIsHere1=i;
  756.  
  757. }
  758.  
  759. } if(here1==true){
  760. allTasks.splice(itIsHere1,1);}
  761.  
  762. }
  763. }
  764. else if (myKey ==4){
  765. var current = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  766. var here4=false;
  767. var itIsHere4;
  768. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  769.  
  770. if(archivedTasks[i].name==current.name
  771. && archivedTasks[i].date==current.date
  772. && archivedTasks[i].description==current.description )
  773. {
  774.  
  775. here4=true;
  776. itIsHere4=i;
  777.  
  778. }
  779.  
  780. }
  781. if(here4==true){
  782. archivedTasks.splice(itIsHere4,1);
  783. var here1=false;
  784. var itIsHere1;
  785. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  786.  
  787. if(allTasks[i].name==current.name
  788. && allTasks[i].date==current.date
  789. && allTasks[i].description==current.description )
  790. {
  791.  
  792. here1=true;
  793. itIsHere1=i;
  794.  
  795. }
  796.  
  797. }
  798. if(here1==true){
  799. allTasks.splice(itIsHere1,1);}
  800.  
  801. }
  802. }
  803.  
  804. }
  805.  
  806. }
  807. else{
  808. if (confirm("Are you Sure that you want to delete?") == true) {
  809. var index2 = index - 1 ;
  810. if(myKey==1){
  811. var here1=false;
  812. var itIsHere1;
  813. var current = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  814. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  815.  
  816. if(allTasks[i].name==current.name
  817. && allTasks[i].date==current.date
  818. && allTasks[i].description==current.description )
  819. {
  820.  
  821. here1=true;
  822. itIsHere1=i;
  823.  
  824. }
  825.  
  826. }
  827. if(here1==true){
  828. allTasks.splice(itIsHere1,1);
  829. var here2=false;
  830. var itIsHere2;
  831. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  832.  
  833. if(inProgressTasks[i].name==current.name
  834. && inProgressTasks[i].date==current.date
  835. && inProgressTasks[i].description==current.description )
  836. {
  837.  
  838. here2=true;
  839. itIsHere2=i;
  840.  
  841. }
  842.  
  843. }
  844.  
  845. if(here2==true){
  846. inProgressTasks.splice(itIsHere2,1);
  847. }
  848. var here3=false;
  849. var itIsHere3;
  850. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  851.  
  852. if(finishedTasks[i].name==current.name
  853. && finishedTasks[i].date==current.date
  854. && finishedTasks[i].description==current.description )
  855. {
  856.  
  857. here3=true;
  858. itIsHere3=i;
  859.  
  860. }
  861.  
  862. }
  863. if(here3==true){
  864. finishedTasks.splice(itIsHere3,1);
  865.  
  866. }
  867. var here4=false;
  868. var itIsHere4;
  869. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  870.  
  871. if(archivedTasks[i].name==current.name
  872. && archivedTasks[i].date==current.date
  873. && archivedTasks[i].description==current.description )
  874. {
  875.  
  876. here4=true;
  877. itIsHere4=i;
  878.  
  879. }
  880.  
  881. }
  882. if(here4==true){
  883. archivedTasks.splice(itIsHere4,1);
  884.  
  885. }
  886.  
  887.  
  888.  
  889. }
  890.  
  891.  
  892.  
  893.  
  894. }
  895. else{
  896.  
  897. if (myKey ==2){
  898. var current = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  899. var here2=false;
  900. var itIsHere2;
  901. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  902.  
  903. if(inProgressTasks[i].name==current.name
  904. && inProgressTasks[i].date==current.date
  905. && inProgressTasks[i].description==current.description )
  906. {
  907.  
  908. here2=true;
  909. itIsHere2=i;
  910.  
  911. }
  912.  
  913. }
  914. if(here2==true){
  915. inProgressTasks.splice(itIsHere2,1);
  916. var here1=false;
  917. var itIsHere1;
  918. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  919.  
  920. if(allTasks[i].name==current.name
  921. && allTasks[i].date==current.date
  922. && allTasks[i].description==current.description )
  923. {
  924.  
  925. here1=true;
  926. itIsHere1=i;
  927.  
  928. }
  929.  
  930. }
  931. if(here1==true){
  932. allTasks.splice(itIsHere1,1);
  933. }
  934. }
  935. }
  936. else if (myKey ==3){
  937. var current = new inputObj (finishedTasks[index2].name,finishedTasks[index2].date,finishedTasks[index2].description);
  938. var here3=false;
  939. var itIsHere3;
  940. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  941.  
  942. if(finishedTasks[i].name==current.name
  943. && finishedTasks[i].date==current.date
  944. && finishedTasks[i].description==current.description )
  945. {
  946.  
  947. here3=true;
  948. itIsHere3=i;
  949.  
  950. }
  951.  
  952. }
  953. if(here3==true){
  954. finishedTasks.splice(itIsHere3,1);
  955. var here1=false;
  956. var itIsHere1;
  957. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  958.  
  959. if(allTasks[i].name==current.name
  960. && allTasks[i].date==current.date
  961. && allTasks[i].description==current.description )
  962. {
  963.  
  964. here1=true;
  965. itIsHere1=i;
  966.  
  967. }
  968.  
  969. } if(here1==true){
  970. allTasks.splice(itIsHere1,1);}
  971.  
  972. }
  973. }
  974. else if (myKey ==4){
  975. var current = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  976. var here4=false;
  977. var itIsHere4;
  978. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  979.  
  980. if(archivedTasks[i].name==current.name
  981. && archivedTasks[i].date==current.date
  982. && archivedTasks[i].description==current.description )
  983. {
  984.  
  985. here4=true;
  986. itIsHere4=i;
  987.  
  988. }
  989.  
  990. }
  991. if(here4==true){
  992. archivedTasks.splice(itIsHere4,1);
  993. var here1=false;
  994. var itIsHere1;
  995. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  996.  
  997. if(allTasks[i].name==current.name
  998. && allTasks[i].date==current.date
  999. && allTasks[i].description==current.description )
  1000. {
  1001.  
  1002. here1=true;
  1003. itIsHere1=i;
  1004.  
  1005. }
  1006.  
  1007. }
  1008. if(here1==true){
  1009. allTasks.splice(itIsHere1,1);}
  1010.  
  1011. }
  1012.  
  1013. }
  1014. }
  1015. }
  1016. }
  1017. }
  1018.  
  1019. function deleteAndPrint(index,num) {
  1020. deleteTask(index);
  1021. if(myKey==1){
  1022. drawTable1(allTasks,myKey);
  1023. }
  1024. else if (myKey ==2){
  1025. drawTable2(inProgressTasks,myKey);
  1026. }
  1027. else if(myKey == 3){
  1028. drawTable3(finishedTasks,myKey);
  1029. }
  1030. else{
  1031. drawTable4(archivedTasks,myKey);
  1032. }
  1033. printButtons();
  1034. }
  1035. function searchFini(index) {
  1036.  
  1037. var index2 = index-1;
  1038. var createObj = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  1039.  
  1040.  
  1041. var here2=false;
  1042. var itIsHere2;
  1043. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  1044.  
  1045. if(inProgressTasks[i].name==createObj.name
  1046. && inProgressTasks[i].date==createObj.date
  1047. && inProgressTasks[i].description==createObj.description )
  1048. {
  1049.  
  1050. here2=true;
  1051. itIsHere2=i;
  1052.  
  1053. }
  1054.  
  1055. }
  1056.  
  1057. var here4=false;
  1058.  
  1059. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  1060.  
  1061. if(archivedTasks[i].name==createObj.name
  1062. && archivedTasks[i].date==createObj.date
  1063. && archivedTasks[i].description==createObj.description )
  1064. {
  1065.  
  1066. here4=true;
  1067. itIsHere2=i;
  1068.  
  1069. }
  1070.  
  1071. }
  1072. if(here4 == true){
  1073. delete4(itIsHere2+1);
  1074. }
  1075. else if(here2 == true){
  1076. delete2(itIsHere2+1);
  1077. }
  1078.  
  1079.  
  1080.  
  1081.  
  1082. if(true){
  1083.  
  1084. finishedTasks.push(createObj);
  1085.  
  1086. }
  1087.  
  1088. printButtons();
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096. editBool = false ;
  1097. }
  1098. function delete2(index){
  1099. inProgressTasks.splice(index - 1,1);
  1100. }
  1101. function delete3(index){
  1102. finishedTasks.splice(index - 1,1);
  1103. }
  1104. function delete4(index){
  1105. archivedTasks.splice(index - 1,1);
  1106. }
  1107.  
  1108. function search2(index) {
  1109. var index2 = index-1;
  1110. var createObj = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  1111.  
  1112.  
  1113.  
  1114.  
  1115. var here2=false;
  1116. var itIsHere2;
  1117. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  1118.  
  1119. if(inProgressTasks[i].name==createObj.name
  1120. && inProgressTasks[i].date==createObj.date
  1121. && inProgressTasks[i].description==createObj.description )
  1122. {
  1123.  
  1124. here2=true;
  1125. itIsHere2=i;
  1126.  
  1127. }
  1128.  
  1129. }
  1130.  
  1131. var here3=false;
  1132.  
  1133. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  1134.  
  1135. if(finishedTasks[i].name==createObj.name
  1136. && finishedTasks[i].date==createObj.date
  1137. && finishedTasks[i].description==createObj.description )
  1138. {
  1139.  
  1140. here3=true;
  1141. itIsHere2=i;
  1142.  
  1143. }
  1144.  
  1145. }
  1146. if(here3 == true){
  1147. delete3(itIsHere2+1);
  1148. }
  1149. else if(here2 == true){
  1150. delete2(itIsHere2+1);
  1151. }
  1152.  
  1153.  
  1154.  
  1155.  
  1156. if(true){
  1157.  
  1158. archivedTasks.push(createObj);
  1159.  
  1160. }
  1161.  
  1162. printButtons();
  1163.  
  1164.  
  1165.  
  1166. }
  1167.  
  1168.  
  1169.  
  1170. var sortN1 = false;
  1171. var sortD1 = false;
  1172. var sortN2 = false;
  1173. var sortD2 = false;
  1174. var sortN3 = false;
  1175. var sortD3 = false;
  1176. var sortN4 = false;
  1177. var sortD4 = false;
  1178.  
  1179.  
  1180. function sortDate(num) {
  1181.  
  1182. if(num==1){
  1183. sortD1 = true ;
  1184. sortN1 = false;
  1185. allTasks.sort(function(a, b){
  1186. var nameA=a.date; var nameB=b.date;
  1187. if (nameA < nameB) //sort string ascending
  1188. return -1 ;
  1189. if (nameA > nameB)
  1190. return 1;
  1191. return 0 ;//default return value (no sorting)
  1192. })
  1193. drawTable1(allTasks,num);
  1194.  
  1195.  
  1196. }else if(num==2){
  1197. sortD2 = true ;
  1198. sortN2 = false;
  1199. inProgressTasks.sort(function(a, b){
  1200. var nameA=a.date; var nameB=b.date;
  1201. if (nameA < nameB) //sort string ascending
  1202. return -1 ;
  1203. if (nameA > nameB)
  1204. return 1;
  1205. return 0 ;//default return value (no sorting)
  1206. })
  1207. drawTable2(inProgressTasks,num);
  1208.  
  1209. }else if(num==3){
  1210. sortD3 = true;
  1211. sortN3 = false;
  1212. finishedTasks.sort(function(a, b){
  1213. var nameA=a.date; var nameB=b.date;
  1214. if (nameA < nameB) //sort string ascending
  1215. return -1 ;
  1216. if (nameA > nameB)
  1217. return 1;
  1218. return 0 ;//default return value (no sorting)
  1219. })
  1220. drawTable3(finishedTasks,num);
  1221. }else if(num==4){
  1222. sortD4 = true;
  1223. sortN4 = false;
  1224. archrivedTasks.sort(function(a, b){
  1225. var nameA=a.date; var nameB=b.date;
  1226. if (nameA < nameB) //sort string ascending
  1227. return -1 ;
  1228. if (nameA > nameB)
  1229. return 1;
  1230. return 0 ;//default return value (no sorting)
  1231. })
  1232. drawTable4(archivedTasks,num);
  1233. }
  1234.  
  1235.  
  1236. }
  1237.  
  1238. function sortName(num) {
  1239.  
  1240. if(num==1){
  1241. sortN1 = true ;
  1242. sortD1 = false ;
  1243. allTasks.sort(function(a, b){
  1244. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1245. if (nameA < nameB) //sort string ascending
  1246. return -1 ;
  1247. if (nameA > nameB)
  1248. return 1;
  1249. return 0 ;//default return value (no sorting)
  1250. })
  1251. drawTable1(allTasks,num);
  1252.  
  1253.  
  1254. }else if(num==2){
  1255. sortN2 = true ;
  1256. sortD2 = false ;
  1257. inProgressTasks.sort(function(a, b){
  1258. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1259. if (nameA < nameB) //sort string ascending
  1260. return -1 ;
  1261. if (nameA > nameB)
  1262. return 1;
  1263. return 0 ;//default return value (no sorting)
  1264. })
  1265. drawTable2(inProgressTasks,num);
  1266.  
  1267. }else if(num==3){
  1268. sortN3 = true ;
  1269. sortD3 = false ;
  1270. finishedTasks.sort(function(a, b){
  1271. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1272. if (nameA < nameB) //sort string ascending
  1273. return -1 ;
  1274. if (nameA > nameB)
  1275. return 1;
  1276. return 0 ;//default return value (no sorting)
  1277. })
  1278. drawTable3(finishedTasks,num);
  1279. }else if(num==4){
  1280. sortN4 = true ;
  1281. sortD4 = false ;
  1282. archrivedTasks.sort(function(a, b){
  1283. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1284. if (nameA < nameB) //sort string ascending
  1285. return -1 ;
  1286. if (nameA > nameB)
  1287. return 1;
  1288. return 0 ;//default return value (no sorting)
  1289. })
  1290. drawTable4(archivedTasks,num);
  1291. }
  1292.  
  1293.  
  1294. }
  1295. function drawTable3(workOnArray,num){
  1296. if(sortD3== true){
  1297. sortD3 = true ;
  1298. sortN3 = false;
  1299. finishedTasks.sort(function(a, b){
  1300. var nameA=a.date; var nameB=b.date;
  1301. if (nameA < nameB) //sort string ascending
  1302. return -1 ;
  1303. if (nameA > nameB)
  1304. return 1;
  1305. return 0 ;//default return value (no sorting)
  1306. })
  1307. }
  1308. if(sortN3== true){
  1309. sortN3 = true ;
  1310. sortD3 = false ;
  1311. finishedTasks.sort(function(a, b){
  1312. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1313. if (nameA < nameB) //sort string ascending
  1314. return -1 ;
  1315. if (nameA > nameB)
  1316. return 1;
  1317. return 0 ;//default return value (no sorting)
  1318. })
  1319. }
  1320. for(var j=0;j<workOnArray.length;j++){
  1321.  
  1322. var create = new inputObj(workOnArray[j].name,workOnArray[j].date,workOnArray[j].description);
  1323. store.push(create);
  1324. }
  1325.  
  1326. myKey = num ;
  1327. var text = "<table class=\"table table-hover\" >";
  1328. text += "<th></th>";
  1329. text += "<th>Task Name </th>";
  1330. text += "<th>Date</th>";
  1331. text += "<th>Description</th>";
  1332. text += "<th></th>";
  1333. text += "<th></th>";
  1334. text+="<td></div align=\"right\"><div class=\"dropdown\" align=\"right\"><button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" align=\"right\">Sort<span class=\"caret\" align=\"right\"></span></button><ul class=\"dropdown-menu dropdown-menu-right\" ><li><a onclick=\"sortName(myKey)\">Sort by name</a></li><li><a onclick=\"sortDate(myKey)\">Sort by date</a></li></ul></div></td>";
  1335.  
  1336. for(var i = 0; i< workOnArray.length; i++){
  1337.  
  1338.  
  1339. text += "<tr>";
  1340. text += "<td></td>";
  1341. if(myKey==3){
  1342.  
  1343. text += "<td><strike>"+workOnArray[i].name + "</strike></td>";
  1344.  
  1345.  
  1346.  
  1347. }else{
  1348. text += "<td>"+workOnArray[i].name + "</td>";
  1349.  
  1350. }
  1351. text += "<td>"+workOnArray[i].date + "</td>";
  1352. text += "<td>"+workOnArray[i].description + "</td>";
  1353. text += "<td><h4 style display=\"none\" >"+workOnArray[i].description + "</h4></td>";
  1354. text += "<td><input type=\"checkbox\" id=\"myCheck\ ></td>";
  1355. text += "<td><div class=\"container\"><div class=\"dropdown\"><button class=\"btn btn-default dropdown-toggle\"type=\"button\" data-toggle=\"dropdown\">Options<span class=\"caret\"></span></button><ul class=\"dropdown-menu \"><li><a onclick=\"archiving(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\">Archive</a></li><li><a type=\"button\" data-toggle=\"modal\" data-target=\"#myModal2\" onclick=\"edit(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\" id=\"butEdit\" >Edit</a></li><li><a onclick=\"deleteAndPrint(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex,myKey)\">Delete</a></li></ul></div></div></td>";
  1356.  
  1357.  
  1358. text += "</tr>"; }
  1359.  
  1360. text+= "</table>";
  1361. document.getElementById("myTable").innerHTML = text;
  1362. printButtons();
  1363. }
  1364. function drawTable4(workOnArray,num){
  1365. if(sortD4== true){
  1366. sortD4 = true ;
  1367. sortN4 = false;
  1368. archivedTasks.sort(function(a, b){
  1369. var nameA=a.date; var nameB=b.date;
  1370. if (nameA < nameB) //sort string ascending
  1371. return -1 ;
  1372. if (nameA > nameB)
  1373. return 1;
  1374. return 0 ;//default return value (no sorting)
  1375. })
  1376. }
  1377. if(sortN4== true){
  1378. sortN4 = true ;
  1379. sortD4 = false ;
  1380. archivedTasks.sort(function(a, b){
  1381. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1382. if (nameA < nameB) //sort string ascending
  1383. return -1 ;
  1384. if (nameA > nameB)
  1385. return 1;
  1386. return 0 ;//default return value (no sorting)
  1387. })
  1388. }
  1389.  
  1390. for(var j=0;j<workOnArray.length;j++){
  1391.  
  1392. var create = new inputObj(workOnArray[j].name,workOnArray[j].date,workOnArray[j].description);
  1393. store.push(create);
  1394. }
  1395.  
  1396. myKey = num ;
  1397. var text = "<table class=\"table table-hover\" >";
  1398. text += "<th></th>";
  1399. text += "<th>Task Name </th>";
  1400. text += "<th>Date</th>";
  1401. text += "<th>Description</th>";
  1402. text += "<th></th>";
  1403. text += "<th></th>";
  1404. text+="<td></div align=\"right\"><div class=\"dropdown\" align=\"right\"><button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" align=\"right\">Sort<span class=\"caret\" align=\"right\"></span></button><ul class=\"dropdown-menu dropdown-menu-right\" ><li><a onclick=\"sortName(myKey)\">Sort by name</a></li><li><a onclick=\"sortDate(myKey)\">Sort by date</a></li></ul></div></td>";
  1405.  
  1406. for(var i = 0; i< workOnArray.length; i++){
  1407.  
  1408.  
  1409. text += "<tr>";
  1410. text += "<td></td>";
  1411. if(myKey==3){
  1412.  
  1413. text += "<td><strike>"+workOnArray[i].name + "</strike></td>";
  1414.  
  1415.  
  1416.  
  1417. }else{
  1418. text += "<td>"+workOnArray[i].name + "</td>";
  1419.  
  1420. }
  1421. text += "<td>"+workOnArray[i].date + "</td>";
  1422. text += "<td>"+workOnArray[i].description + "</td>";
  1423. text += "<td><h4 style display=\"none\" >"+workOnArray[i].description + "</h4></td>";
  1424. text += "<td><input type=\"checkbox\" id=\"myCheck\ ></td>";
  1425. text += "<td><div class=\"container\"><div class=\"dropdown\"><button class=\"btn btn-default dropdown-toggle\"type=\"button\" data-toggle=\"dropdown\">Options<span class=\"caret\"></span></button><ul class=\"dropdown-menu \"><li><a type=\"button\" data-toggle=\"modal\" data-target=\"#myModal2\" onclick=\"edit(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\" id=\"butEdit\" >Edit</a></li><li><a onclick=\"deleteAndPrint(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex,myKey)\">Delete</a></li><li><a onclick=\"markAsDone(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\">Mark as done</a></li></ul></div></div></td>";
  1426.  
  1427. text += "</tr>"; }
  1428.  
  1429. text+= "</table>";
  1430. document.getElementById("myTable").innerHTML = text;
  1431. printButtons();
  1432. }
  1433.  
  1434. function drawTable2(workOnArray,num){
  1435. if(sortD2== true){
  1436. sortD2 = true ;
  1437. sortN2 = false;
  1438. inProgressTasks.sort(function(a, b){
  1439. var nameA=a.date; var nameB=b.date;
  1440. if (nameA < nameB) //sort string ascending
  1441. return -1 ;
  1442. if (nameA > nameB)
  1443. return 1;
  1444. return 0 ;//default return value (no sorting)
  1445. })
  1446. }
  1447. if(sortN2== true){
  1448. sortN2 = true ;
  1449. sortD2 = false ;
  1450. inProgressTasks.sort(function(a, b){
  1451. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1452. if (nameA < nameB) //sort string ascending
  1453. return -1 ;
  1454. if (nameA > nameB)
  1455. return 1;
  1456. return 0 ;//default return value (no sorting)
  1457. })
  1458. }
  1459. for(var j=0;j<workOnArray.length;j++){
  1460.  
  1461. var create = new inputObj(workOnArray[j].name,workOnArray[j].date,workOnArray[j].description);
  1462. store.push(create);
  1463. }
  1464.  
  1465. myKey = num ;
  1466. var text = "<table class=\"table table-hover\" >";
  1467. text += "<th></th>";
  1468. text += "<th>Task Name </th>";
  1469. text += "<th>Date</th>";
  1470. text += "<th>Description</th>";
  1471. text += "<th></th>";
  1472. text += "<th></th>";
  1473. text+="<td></div align=\"right\"><div class=\"dropdown\" align=\"right\"><button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" align=\"right\">Sort<span class=\"caret\" align=\"right\"></span></button><ul class=\"dropdown-menu dropdown-menu-right\" ><li><a onclick=\"sortName(myKey)\">Sort by name</a></li><li><a onclick=\"sortDate(myKey)\">Sort by date</a></li></ul></div></td>";
  1474.  
  1475. for(var i = 0; i< workOnArray.length; i++){
  1476.  
  1477.  
  1478. text += "<tr>";
  1479. text += "<td></td>";
  1480. if(myKey==3){
  1481.  
  1482. text += "<td><strike>"+workOnArray[i].name + "</strike></td>";
  1483.  
  1484.  
  1485.  
  1486. }else{
  1487. text += "<td>"+workOnArray[i].name + "</td>";
  1488.  
  1489. }
  1490. text += "<td>"+workOnArray[i].date + "</td>";
  1491. text += "<td>"+workOnArray[i].description + "</td>";
  1492. text += "<td><h4 style display=\"none\" >"+workOnArray[i].description + "</h4></td>";
  1493. text += "<td><input type=\"checkbox\" id=\"myCheck\ ></td>";
  1494. text += "<td><div class=\"container\"><div class=\"dropdown\"><button class=\"btn btn-default dropdown-toggle\"type=\"button\" data-toggle=\"dropdown\">Options<span class=\"caret\"></span></button><ul class=\"dropdown-menu \"><li><a onclick=\"archiving(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\">Archive</a></li><li><a type=\"button\" data-toggle=\"modal\" data-target=\"#myModal2\" onclick=\"edit(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\" id=\"butEdit\" >Edit</a></li><li><a onclick=\"deleteAndPrint(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex,myKey)\">Delete</a></li><li><a onclick=\"markAsDone(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\">Mark as done</a></li></ul></div></div></td>";
  1495.  
  1496. text += "</tr>"; }
  1497.  
  1498. text+= "</table>";
  1499. document.getElementById("myTable").innerHTML = text;
  1500. printButtons();
  1501. }
  1502. function drawTable1(workOnArray,num){
  1503. if(sortD1== true){
  1504. sortD1 = true ;
  1505. sortN1 = false;
  1506. allTasks.sort(function(a, b){
  1507. var nameA=a.date; var nameB=b.date;
  1508. if (nameA < nameB) //sort string ascending
  1509. return -1 ;
  1510. if (nameA > nameB)
  1511. return 1;
  1512. return 0 ;//default return value (no sorting)
  1513. })
  1514. }
  1515. if(sortN1== true){
  1516. sortN1 = true ;
  1517. sortD1 = false ;
  1518. allTasks.sort(function(a, b){
  1519. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1520. if (nameA < nameB) //sort string ascending
  1521. return -1 ;
  1522. if (nameA > nameB)
  1523. return 1;
  1524. return 0 ;//default return value (no sorting)
  1525. })
  1526. }
  1527.  
  1528. for(var j=0;j<workOnArray.length;j++){
  1529.  
  1530. var create = new inputObj(workOnArray[j].name,workOnArray[j].date,workOnArray[j].description);
  1531. store.push(create);
  1532. }
  1533.  
  1534. myKey = num ;
  1535. var text = "<table class=\"table table-hover\" id=\"tablehov\">";
  1536. text += "<th></th>";
  1537. text += "<th>Task Name </th>";
  1538. text += "<th>Date</th>";
  1539. text += "<th>Description</th>";
  1540. text += "<th></th>";
  1541. text += "<th></th>";
  1542. text+="<td></div align=\"right\"><div class=\"dropdown\" align=\"right\"><button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" align=\"right\">Sort<span class=\"caret\" align=\"right\"></span></button><ul class=\"dropdown-menu dropdown-menu-right\" ><li><a onclick=\"sortName(myKey)\">Sort by name</a></li><li><a onclick=\"sortDate(myKey)\">Sort by date</a></li></ul></div></td>";
  1543.  
  1544. for(var i = 0; i< workOnArray.length; i++){
  1545.  
  1546.  
  1547. text += "<tr>";
  1548. text += "<td></td>";
  1549. if(myKey==3){
  1550.  
  1551. text += "<td><strike>"+workOnArray[i].name + "</strike></td>";
  1552.  
  1553.  
  1554.  
  1555. }else{
  1556. text += "<td>"+workOnArray[i].name + "</td>";
  1557.  
  1558. }
  1559. text += "<td>"+workOnArray[i].date + "</td>";
  1560. text += "<td>"+workOnArray[i].description + "</td>";
  1561. text += "<td><div id=\"hoverDes\" >"+workOnArray[i].description + "</div></td>";
  1562. text += "<td><input type=\"checkbox\" id=\"myCheck\ ></td>";
  1563. text += "<td><div class=\"container\"><div class=\"dropdown\"><button class=\"btn btn-default dropdown-toggle\"type=\"button\" data-toggle=\"dropdown\">Options<span class=\"caret\"></span></button><ul class=\"dropdown-menu \"><li><a onclick=\"archiving(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\">Archive</a></li><li><a type=\"button\" data-toggle=\"modal\" data-target=\"#myModal2\" onclick=\"edit(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\" id=\"butEdit\" >Edit</a></li><li><a onclick=\"deleteAndPrint(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex,myKey)\">Delete</a></li><li><a onclick=\"markAsDone(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex)\">Mark as done</a></li></ul></div></div></td>";
  1564.  
  1565. text += "</tr>"; }
  1566.  
  1567. text+= "</table>";
  1568. document.getElementById("myTable").innerHTML = text;
  1569. printButtons();
  1570. }
  1571.  
  1572. function printButtons(){
  1573. document.getElementById("butAll").innerHTML="All Tasks "+allTasks.length;
  1574. document.getElementById("butPro").innerHTML="Progress "+inProgressTasks.length;
  1575. document.getElementById("butcom").innerHTML="Finished "+finishedTasks.length;
  1576. document.getElementById("butArc").innerHTML="Archived "+archivedTasks.length;
  1577. }
  1578.  
  1579. var x=true;
  1580.  
  1581. $(document).ready(function(){
  1582. $("#butEdit").click(function(){
  1583. $("#myModal").show();
  1584.  
  1585.  
  1586. });
  1587. });
  1588.  
  1589.  
  1590. function edit(index){
  1591. var editable = new inputObj();
  1592. var index2 = index - 1;
  1593. var indexIn ;
  1594. if(myKey==1){
  1595. var createObj = new inputObj (allTasks[index2].name,allTasks[index2].allTasks[index2].description);
  1596. allTasks[index2].name = createObj.name ;
  1597. allTasks[index2].date = createObj.date;
  1598. allTasks[index2].description = createObj.description;
  1599. for (var i = 0; i < inProgressTasks.length; i++) {
  1600. if(inProgressTasks[i].name==createObj.name
  1601. && inProgressTasks[i].date==createObj.date
  1602. && inProgressTasks[i].description==createObj.description ){
  1603. indexIn = i ;
  1604. }
  1605. }
  1606. inProgressTasks[indexIn].name = createObj.name;
  1607. inProgressTasks[indexIn].date = createObj.date;
  1608. inProgressTasks[indexIn].description = createObj.description;
  1609. for (var i = 0; i < finishedTasks.length; i++) {
  1610. if(finishedTasks[i].name==createObj.name
  1611. && finishedTasks[i].date==createObj.date
  1612. && finishedTasks[i].description==createObj.description ){
  1613. indexIn = i ;
  1614. }
  1615. }
  1616. finishedTasks[indexIn].name = createObj.name;
  1617. finishedTasks[indexIn].date = createObj.date;
  1618. finishedTasks[indexIn].description = createObj.description;
  1619. for (var i = 0; i < archivedTasks.length; i++) {
  1620. if(archivedTasks[i].name==createObj.name
  1621. && archivedTasks[i].date==createObj.date
  1622. && archivedTasks[i].description==createObj.description ){
  1623. indexIn = i ;
  1624. }
  1625. }
  1626.  
  1627. archivedTasks[indexIn].name = createObj.name;
  1628. archivedTasks[indexIn].date = createObj.date;
  1629. archivedTasks[indexIn].description = createObj.description;
  1630.  
  1631. }else if(myKey==2){
  1632. var createObj = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  1633. inProgressTasks[index2].name = createObj.name;
  1634. inProgressTasks[index2].date = createObj.date;
  1635. inProgressTasks[index2].description = createObj.description;
  1636.  
  1637. for (var i = 0; i < allTasks.length; i++) {
  1638. if(allTasks[i].name==createObj.name
  1639. && allTasks[i].date==createObj.date
  1640. && allTasks[i].description==createObj.description ){
  1641. indexIn = i ;
  1642. }
  1643. }
  1644. allTasks[indexIn].name = createObj.name ;
  1645. allTasks[indexIn].date = createObj.date;
  1646. allTasks[indexIn].description = createObj.description;
  1647.  
  1648. }else if(myKey==3){
  1649. var createObj = new inputObj (finishedTasks[index2].name,finishedTasks[index2].date,finishedTasks[index2].description);
  1650. finishedTasks[index2].name = createObj.name;
  1651. finishedTasks[index2].date = createObj.date;
  1652. finishedTasks[index2].description = createObj.description;
  1653. for (var i = 0; i < allTasks.length; i++) {
  1654. if(allTasks[i].name==createObj.name
  1655. && allTasks[i].date==createObj.date
  1656. && allTasks[i].description==createObj.description ){
  1657. indexIn = i ;
  1658. }
  1659. }
  1660. allTasks[indexIn].name = createObj.name ;
  1661. allTasks[indexIn].date = createObj.date;
  1662. allTasks[indexIn].description = createObj.description;
  1663. }
  1664. if(myKey==4){
  1665. var createObj = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  1666. archivedTasks[index2].name = createObj.name;
  1667. archivedTasks[index2].date = createObj.date;
  1668. archivedTasks[index2].description = createObj.description;
  1669. for (var i = 0; i < allTasks.length; i++) {
  1670. if(allTasks[i].name==createObj.name
  1671. && allTasks[i].date==createObj.date
  1672. && allTasks[i].description==createObj.description ){
  1673. indexIn = i ;
  1674. }
  1675. }
  1676. allTasks[indexIn].name = createObj.name ;
  1677. allTasks[indexIn].date = createObj.date;
  1678. allTasks[indexIn].description = createObj.description;
  1679. }
  1680.  
  1681.  
  1682. }
  1683.  
  1684.  
  1685.  
  1686. function printAtFirst(){
  1687. if(x==true){
  1688. drawTable1(allTasks,1);
  1689. boldedAll();
  1690.  
  1691. }
  1692. x=false;
  1693.  
  1694. }
  1695. printAtFirst();
  1696.  
  1697.  
  1698. </script>
  1699. </body>
  1700.  
  1701. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement