Advertisement
Aiaa

code

Apr 25th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.53 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(); deSelect();" ></button><br>
  183. <button class="myButton" id="butPro" onclick="drawTable2(inProgressTasks,2); boldedProg(); deSelect();"></button><br>
  184. <button class="myButton" id="butcom" onclick="drawTable3(finishedTasks,3); boldedFin(); deSelect();" ></button><br>
  185. <button class="myButton" id="butArc" onclick="drawTable4(archivedTasks,4); boldedArch(); deSelect(); " ></button><br>
  186. <button class="myButton" id="butArc" onclick="drawTable4(archivedTasks,4); boldedArch(); deSelect();" ></button><br>
  187.  
  188. <button class="myButton2" id="butAdd" ><span class="glyphicon glyphicon-plus"></span>Add Task</button>
  189. <button class="myButton2" onclick = "DeleteMultipleRows()" id="butremoveall" >Remove All Tasks</button>
  190.  
  191.  
  192. </div>
  193.  
  194.  
  195. <!-- Trigger/Open The Modal -->
  196. <!-- The Modal -->
  197. <div id="myModal" class="modal">
  198. <!-- Modal content -->
  199. <div class="modal-content">
  200. <span class="close">x</span>
  201. <br> Add Task:<br>
  202. <input type="text" id="addTask" size="50">
  203. <br> Date:<br>
  204. <input type="text" id="taskDate" size="20">
  205. <br>Description<br>
  206. <input type="text" id="description" size="70">
  207. <br><br>
  208. <button type="button" class="button button1" onclick="assignVals(); drawTable1(allTasks,1); ">Add Task!</button>
  209. <button type="button" class="button button3" onclick="cancelBut(); ">Cancel input</button>
  210.  
  211. </div>
  212. </div>
  213. <div id="myModal2" class="modal">
  214. <!-- Modal content -->
  215. <div class="modal-content">
  216. <span class="close">x</span>
  217. <br> Add Task:<br>
  218. <input type="text" id="addTask" size="50">
  219. <br> Date:<br>
  220. <input type="text" id="taskDate" size="20">
  221. <br>Description<br>
  222. <input type="text" id="description" size="70">
  223. <br><br>
  224. <button type="button" id="editConf" class="button button1" onclick="assignVals(); drawTable1(allTasks,1); ">Edit Task</button>
  225. <button type="button" class="button button3" onclick="cancelBut(); ">Cancel input</button>
  226.  
  227. </div>
  228. </div>
  229.  
  230. <br><br><br>
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237. <div id="presenter" align="center" style="width: 100%; height: 50px; background-color: lightgrey; font-size: 30px; font-weight: bold; ">
  238.  
  239. <p id="present"></p>
  240.  
  241.  
  242. </div>
  243.  
  244.  
  245.  
  246.  
  247.  
  248. <div id="page" class="page">
  249.  
  250. <header class="item header margin-top-0 padding-bottom-0" id="header5">
  251.  
  252. <div class="wrapper">
  253.  
  254.  
  255. <nav role="navigation" class="navbar navbar-inverse navbar-embossed navbar-lg navbar-fixed-top">
  256.  
  257. <div class="container">
  258.  
  259. <div class="navbar-header">
  260.  
  261. <a class="navbar-brand brand">TO DO '19</a>
  262. </div>
  263.  
  264.  
  265. </div>
  266. <!-- /.container -->
  267.  
  268. </nav>
  269. <h1 >
  270.  
  271.  
  272. <table align="right" width="80%" >
  273. <td>
  274. <ui>
  275. </ui>
  276. </td>
  277. <td>
  278. <p id="myTable" />
  279. </td>
  280. </table>
  281. <br><br><br>
  282.  
  283.  
  284.  
  285.  
  286. </div>
  287. <!-- /.wrapper -->
  288. </header>
  289. <!-- /.item -->
  290. </div>
  291. <!-- /#page -->
  292.  
  293.  
  294.  
  295.  
  296.  
  297. <script>
  298.  
  299. function cancelBut(){
  300. document.getElementById("addTask").value="";
  301. document.getElementById("taskDate").value="";
  302. document.getElementById("description").value="";
  303. disappear();
  304. }
  305.  
  306.  
  307.  
  308. function boldedAll(){
  309. document.getElementById("present").innerHTML="All Tasks";
  310.  
  311. }
  312. function boldedProg(){
  313. document.getElementById("present").innerHTML="In progress";
  314.  
  315. }
  316. function boldedFin(){
  317. document.getElementById("present").innerHTML="Finished";
  318.  
  319. }
  320. function boldedArch(){
  321. document.getElementById("present").innerHTML="Archived";
  322.  
  323. }
  324. //MODAL START
  325. // Get the modal
  326. var modal = document.getElementById('myModal');
  327.  
  328. // Get the button that opens the modal
  329. var btn = document.getElementById("butAdd");
  330.  
  331. // Get the <span> element that closes the modal
  332. var span = document.getElementsByClassName("close")[0];
  333.  
  334. // When the user clicks the button, open the modal
  335. btn.onclick = function() {
  336. modal.style.display = "block";
  337. }
  338.  
  339. // When the user clicks on <span> (x), close the modal
  340. span.onclick = function() {
  341. modal.style.display = "none";
  342. }
  343.  
  344. // When the user clicks anywhere outside of the modal, close it
  345. window.onclick = function(event) {
  346. if (event.target == modal) {
  347. modal.style.display = "none";
  348. }
  349. }
  350. function disappear() {
  351. modal.style.display = "none";
  352. }
  353.  
  354. // $('.modal').on('hidden.bs.modal', function(){
  355. // $(this).find('form')[0].reset();
  356. // });
  357. //MODAL END
  358.  
  359.  
  360. var allTasks = [];
  361. var inProgressTasks = [];
  362. var archivedTasks = [];
  363. var finishedTasks = [];
  364. var store=[];
  365.  
  366.  
  367. printButtons();
  368.  
  369.  
  370.  
  371. //object of the input
  372. function inputObj(name,date,description){
  373. this.name=name;
  374. this.date=date;
  375. this.description=description;
  376. }
  377. //inserting in the array of all tasks and in progress by default
  378. function assignVals(){
  379.  
  380. var createObj = new inputObj(document.getElementById("addTask").value,document.getElementById("taskDate").value,document.getElementById("description").value)
  381.  
  382. var here=false;
  383.  
  384.  
  385. for(var i=0;i<allTasks.length&&here==false&&allTasks.length>0;i++){
  386. if(allTasks[i].name==createObj.name
  387. && allTasks[i].date==createObj.date
  388. )
  389. {
  390. here=true;
  391. alert("Task already available")
  392. }
  393.  
  394.  
  395. }
  396.  
  397. var hereA=false;
  398. for(var i=0;i<archivedTasks.length&&hereA==false&&archivedTasks.length>0;i++){
  399. if(archivedTasks[i].name==createObj.name
  400. && archivedTasks[i].date==createObj.date
  401. )
  402. {
  403. hereA=true;
  404. alert("Task is already archived")
  405. }
  406.  
  407.  
  408. }
  409.  
  410. if(document.getElementById("addTask").value==""||document.getElementById("taskDate").value==""){
  411. alert("Name or date panel or both are empty");
  412. }else if(document.getElementById("addTask").value.trim()==""||document.getElementById("taskDate").value.trim()==""){
  413. alert("Name or date panel or both are empty");
  414. }
  415. else if(here==false&&hereA==false){
  416. allTasks.push(createObj);
  417. inProgressTasks.push(createObj);
  418. disappear();
  419. cancelBut();
  420.  
  421.  
  422. }
  423.  
  424. printButtons();
  425. }
  426.  
  427.  
  428.  
  429.  
  430. //delete fx
  431. // function deleteTask (index){
  432.  
  433.  
  434. // var workOnArray=[] ;
  435.  
  436. // for(var j=0;j<store.length;j++){
  437.  
  438. // var obj = new inputObj(store[j].name,store[j].date,store[j].description);
  439. // workOnArray.push(obj);
  440. // }
  441.  
  442.  
  443.  
  444. // if (confirm("Are you Sure that you want to delete?") == true) {
  445.  
  446.  
  447. // var here1=false;
  448. // var itIsHere;
  449. // for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  450.  
  451. // if(allTasks[i].name==workOnArray[index-1].name
  452. // && allTasks[i].date==workOnArray[index-1].date
  453. // && allTasks[i].description==workOnArray[index-1].description )
  454. // {
  455. // here1=true;
  456. // itIsHere=i;
  457.  
  458. // }
  459.  
  460. // }
  461.  
  462.  
  463. // if(here1==true){
  464. // allTasks.splice(itIsHere,1);
  465. // drawTable1(allTasks,1);
  466.  
  467. // var flag=false;
  468. // for(var i=0;i<inProgressTasks.length && flag==false;i++){
  469. // if (inProgressTasks[i].name==workOnArray[index-1].name
  470. // && inProgressTasks[i].date==workOnArray[index-1].date
  471. // && inProgressTasks[i].description==workOnArray[index-1].description){
  472.  
  473. // flag=true;
  474. // inProgressTasks.splice(i,1);
  475.  
  476. // }
  477.  
  478. // }
  479.  
  480.  
  481.  
  482. // for(var i=0;i<finishedTasks.length && flag==false;i++){
  483. // if (finishedTasks[i].name==workOnArray[index-1].name
  484. // && finishedTasks[i].date==workOnArray[index-1].date
  485. // && finishedTasks[i].description==workOnArray[index-1].description){
  486. // flag=true;
  487. // finished.splice(i,1);
  488.  
  489. // }
  490.  
  491. // }
  492.  
  493.  
  494.  
  495. // }else if (archivedTasks.length>=index && archivedTasks[index-1].name==workOnArray[index-1].name
  496. // && archivedTasks[index-1].date==workOnArray[index-1].date
  497. // && archivedTasks[index-1].description==workOnArray[index-1].description){
  498.  
  499. // archivedTasks.splice(index-1,1);
  500. // drawTable4(archivedTasks,4);
  501.  
  502.  
  503. // }
  504.  
  505.  
  506.  
  507. // }
  508. // printButtons();
  509.  
  510. // }
  511. function markAsDone(index){
  512. editBool = true ;
  513. var index2 = index-1;
  514. if(myKey==1){
  515. searchFini(index);
  516.  
  517. drawTable1(allTasks,1);
  518. }
  519. else{
  520. if(myKey==2){
  521. var createObj = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  522. delete2(index);
  523.  
  524.  
  525. if(true){
  526.  
  527. finishedTasks.push(createObj);
  528. drawTable2(inProgressTasks,2);
  529.  
  530. }
  531.  
  532. printButtons();
  533.  
  534. }
  535. else if(myKey==4){
  536. var createObj = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  537.  
  538. delete4(index);
  539.  
  540.  
  541. if(true){
  542.  
  543. finishedTasks.push(createObj);
  544. drawTable4(archivedTasks);
  545.  
  546. }
  547.  
  548. printButtons();
  549. }
  550.  
  551.  
  552.  
  553. }
  554.  
  555. }
  556.  
  557.  
  558. function archiving(index){
  559. editBool = true ;
  560. var index2 = index-1;
  561. if(myKey==1){
  562.  
  563. search2(index);
  564.  
  565. drawTable1(allTasks,1);
  566. }else{
  567. if(myKey==2){
  568. var createObj = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  569. delete2(index);
  570.  
  571. if(true){
  572.  
  573. archivedTasks.push(createObj);
  574.  
  575. }
  576. for (var i = 0; i < allTasks.length; i++) {
  577. if(allTasks[i].name == createObj.name
  578. && allTasks[i].date == createObj.date
  579. && allTasks[i].description == createObj.description){
  580. allTasks.splice(i,1);
  581. }
  582. }
  583.  
  584.  
  585. printButtons();
  586. drawTable2(inProgressTasks,2);
  587. }
  588. else if(myKey==3){
  589. var createObj = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  590.  
  591. delete3(index);
  592.  
  593.  
  594. if(true){
  595.  
  596. archivedTasks.push(createObj);
  597.  
  598. }
  599. for (var i = 0; i < allTasks.length; i++) {
  600. if(allTasks[i].name == createObj.name
  601. && allTasks[i].date == createObj.date
  602. && allTasks[i].description == createObj.description){
  603. allTasks.splice(i,1);
  604. }
  605. }
  606.  
  607. printButtons();
  608. drawTable3(finishedTasks,3);
  609. }
  610.  
  611.  
  612. }
  613. editBool = false;
  614. }
  615. var editBool = false ;
  616.  
  617.  
  618. function deleteTask (index){
  619. if(editBool == true){
  620. var index2 = index - 1 ;
  621. if(myKey==1){
  622. var here1=false;
  623. var itIsHere1;
  624. var current = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  625. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  626.  
  627. if(allTasks[i].name==current.name
  628. && allTasks[i].date==current.date
  629. && allTasks[i].description==current.description )
  630. {
  631.  
  632. here1=true;
  633. itIsHere1=i;
  634.  
  635. }
  636.  
  637. }
  638. if(here1==true){
  639. allTasks.splice(itIsHere1,1);
  640. var here2=false;
  641. var itIsHere2;
  642. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  643.  
  644. if(inProgressTasks[i].name==current.name
  645. && inProgressTasks[i].date==current.date
  646. && inProgressTasks[i].description==current.description )
  647. {
  648.  
  649. here2=true;
  650. itIsHere2=i;
  651.  
  652. }
  653.  
  654. }
  655.  
  656. if(here2==true){
  657. inProgressTasks.splice(itIsHere2,1);
  658. }
  659. var here3=false;
  660. var itIsHere3;
  661. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  662.  
  663. if(finishedTasks[i].name==current.name
  664. && finishedTasks[i].date==current.date
  665. && finishedTasks[i].description==current.description )
  666. {
  667.  
  668. here3=true;
  669. itIsHere3=i;
  670.  
  671. }
  672.  
  673. }
  674. if(here3==true){
  675. finishedTasks.splice(itIsHere3,1);
  676.  
  677. }
  678. var here4=false;
  679. var itIsHere4;
  680. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  681.  
  682. if(archivedTasks[i].name==current.name
  683. && archivedTasks[i].date==current.date
  684. && archivedTasks[i].description==current.description )
  685. {
  686.  
  687. here4=true;
  688. itIsHere4=i;
  689.  
  690. }
  691.  
  692. }
  693. if(here4==true){
  694. archivedTasks.splice(itIsHere4,1);
  695.  
  696. }
  697.  
  698.  
  699.  
  700. }
  701.  
  702.  
  703.  
  704.  
  705. }
  706. else{
  707.  
  708. if (myKey ==2){
  709. var current = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  710. var here2=false;
  711. var itIsHere2;
  712. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  713.  
  714. if(inProgressTasks[i].name==current.name
  715. && inProgressTasks[i].date==current.date
  716. && inProgressTasks[i].description==current.description )
  717. {
  718.  
  719. here2=true;
  720. itIsHere2=i;
  721.  
  722. }
  723.  
  724. }
  725. if(here2==true){
  726. inProgressTasks.splice(itIsHere2,1);
  727. var here1=false;
  728. var itIsHere1;
  729. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  730.  
  731. if(allTasks[i].name==current.name
  732. && allTasks[i].date==current.date
  733. && allTasks[i].description==current.description )
  734. {
  735.  
  736. here1=true;
  737. itIsHere1=i;
  738.  
  739. }
  740.  
  741. }
  742. if(here1==true){
  743. allTasks.splice(itIsHere1,1);
  744. }
  745. }
  746. }
  747. else if (myKey ==3){
  748. var current = new inputObj (finishedTasks[index2].name,finishedTasks[index2].date,finishedTasks[index2].description);
  749. var here3=false;
  750. var itIsHere3;
  751. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  752.  
  753. if(finishedTasks[i].name==current.name
  754. && finishedTasks[i].date==current.date
  755. && finishedTasks[i].description==current.description )
  756. {
  757.  
  758. here3=true;
  759. itIsHere3=i;
  760.  
  761. }
  762.  
  763. }
  764. if(here3==true){
  765. finishedTasks.splice(itIsHere3,1);
  766. var here1=false;
  767. var itIsHere1;
  768. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  769.  
  770. if(allTasks[i].name==current.name
  771. && allTasks[i].date==current.date
  772. && allTasks[i].description==current.description )
  773. {
  774.  
  775. here1=true;
  776. itIsHere1=i;
  777.  
  778. }
  779.  
  780. } if(here1==true){
  781. allTasks.splice(itIsHere1,1);}
  782.  
  783. }
  784. }
  785. else if (myKey ==4){
  786. var current = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  787. var here4=false;
  788. var itIsHere4;
  789. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  790.  
  791. if(archivedTasks[i].name==current.name
  792. && archivedTasks[i].date==current.date
  793. && archivedTasks[i].description==current.description )
  794. {
  795.  
  796. here4=true;
  797. itIsHere4=i;
  798.  
  799. }
  800.  
  801. }
  802. if(here4==true){
  803. archivedTasks.splice(itIsHere4,1);
  804. var here1=false;
  805. var itIsHere1;
  806. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  807.  
  808. if(allTasks[i].name==current.name
  809. && allTasks[i].date==current.date
  810. && allTasks[i].description==current.description )
  811. {
  812.  
  813. here1=true;
  814. itIsHere1=i;
  815.  
  816. }
  817.  
  818. }
  819. if(here1==true){
  820. allTasks.splice(itIsHere1,1);}
  821.  
  822. }
  823. }
  824.  
  825. }
  826.  
  827. }
  828. else{
  829. if (confirm("Are you Sure that you want to delete?") == true) {
  830. var index2 = index - 1 ;
  831. if(myKey==1){
  832. var here1=false;
  833. var itIsHere1;
  834. var current = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  835. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  836.  
  837. if(allTasks[i].name==current.name
  838. && allTasks[i].date==current.date
  839. && allTasks[i].description==current.description )
  840. {
  841.  
  842. here1=true;
  843. itIsHere1=i;
  844.  
  845. }
  846.  
  847. }
  848. if(here1==true){
  849. allTasks.splice(itIsHere1,1);
  850. var here2=false;
  851. var itIsHere2;
  852. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  853.  
  854. if(inProgressTasks[i].name==current.name
  855. && inProgressTasks[i].date==current.date
  856. && inProgressTasks[i].description==current.description )
  857. {
  858.  
  859. here2=true;
  860. itIsHere2=i;
  861.  
  862. }
  863.  
  864. }
  865.  
  866. if(here2==true){
  867. inProgressTasks.splice(itIsHere2,1);
  868. }
  869. var here3=false;
  870. var itIsHere3;
  871. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  872.  
  873. if(finishedTasks[i].name==current.name
  874. && finishedTasks[i].date==current.date
  875. && finishedTasks[i].description==current.description )
  876. {
  877.  
  878. here3=true;
  879. itIsHere3=i;
  880.  
  881. }
  882.  
  883. }
  884. if(here3==true){
  885. finishedTasks.splice(itIsHere3,1);
  886.  
  887. }
  888. var here4=false;
  889. var itIsHere4;
  890. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  891.  
  892. if(archivedTasks[i].name==current.name
  893. && archivedTasks[i].date==current.date
  894. && archivedTasks[i].description==current.description )
  895. {
  896.  
  897. here4=true;
  898. itIsHere4=i;
  899.  
  900. }
  901.  
  902. }
  903. if(here4==true){
  904. archivedTasks.splice(itIsHere4,1);
  905.  
  906. }
  907.  
  908.  
  909.  
  910. }
  911.  
  912.  
  913.  
  914.  
  915. }
  916. else{
  917.  
  918. if (myKey ==2){
  919. var current = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  920. var here2=false;
  921. var itIsHere2;
  922. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  923.  
  924. if(inProgressTasks[i].name==current.name
  925. && inProgressTasks[i].date==current.date
  926. && inProgressTasks[i].description==current.description )
  927. {
  928.  
  929. here2=true;
  930. itIsHere2=i;
  931.  
  932. }
  933.  
  934. }
  935. if(here2==true){
  936. inProgressTasks.splice(itIsHere2,1);
  937. var here1=false;
  938. var itIsHere1;
  939. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  940.  
  941. if(allTasks[i].name==current.name
  942. && allTasks[i].date==current.date
  943. && allTasks[i].description==current.description )
  944. {
  945.  
  946. here1=true;
  947. itIsHere1=i;
  948.  
  949. }
  950.  
  951. }
  952. if(here1==true){
  953. allTasks.splice(itIsHere1,1);
  954. }
  955. }
  956. }
  957. else if (myKey ==3){
  958. var current = new inputObj (finishedTasks[index2].name,finishedTasks[index2].date,finishedTasks[index2].description);
  959. var here3=false;
  960. var itIsHere3;
  961. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  962.  
  963. if(finishedTasks[i].name==current.name
  964. && finishedTasks[i].date==current.date
  965. && finishedTasks[i].description==current.description )
  966. {
  967.  
  968. here3=true;
  969. itIsHere3=i;
  970.  
  971. }
  972.  
  973. }
  974. if(here3==true){
  975. finishedTasks.splice(itIsHere3,1);
  976. var here1=false;
  977. var itIsHere1;
  978. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  979.  
  980. if(allTasks[i].name==current.name
  981. && allTasks[i].date==current.date
  982. && allTasks[i].description==current.description )
  983. {
  984.  
  985. here1=true;
  986. itIsHere1=i;
  987.  
  988. }
  989.  
  990. } if(here1==true){
  991. allTasks.splice(itIsHere1,1);}
  992.  
  993. }
  994. }
  995. else if (myKey ==4){
  996. var current = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  997. var here4=false;
  998. var itIsHere4;
  999. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  1000.  
  1001. if(archivedTasks[i].name==current.name
  1002. && archivedTasks[i].date==current.date
  1003. && archivedTasks[i].description==current.description )
  1004. {
  1005.  
  1006. here4=true;
  1007. itIsHere4=i;
  1008.  
  1009. }
  1010.  
  1011. }
  1012. if(here4==true){
  1013. archivedTasks.splice(itIsHere4,1);
  1014. var here1=false;
  1015. var itIsHere1;
  1016. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  1017.  
  1018. if(allTasks[i].name==current.name
  1019. && allTasks[i].date==current.date
  1020. && allTasks[i].description==current.description )
  1021. {
  1022.  
  1023. here1=true;
  1024. itIsHere1=i;
  1025.  
  1026. }
  1027.  
  1028. }
  1029. if(here1==true){
  1030. allTasks.splice(itIsHere1,1);}
  1031.  
  1032. }
  1033.  
  1034. }
  1035. }
  1036. }
  1037. }
  1038. }
  1039.  
  1040. function deleteAndPrint(index,num) {
  1041. deleteTask(index);
  1042. if(myKey==1){
  1043. drawTable1(allTasks,myKey);
  1044. }
  1045. else if (myKey ==2){
  1046. drawTable2(inProgressTasks,myKey);
  1047. }
  1048. else if(myKey == 3){
  1049. drawTable3(finishedTasks,myKey);
  1050. }
  1051. else{
  1052. drawTable4(archivedTasks,myKey);
  1053. }
  1054. printButtons();
  1055. }
  1056. function searchFini(index) {
  1057.  
  1058. var index2 = index-1;
  1059. var createObj = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  1060.  
  1061.  
  1062. var here2=false;
  1063. var itIsHere2;
  1064. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  1065.  
  1066. if(inProgressTasks[i].name==createObj.name
  1067. && inProgressTasks[i].date==createObj.date
  1068. && inProgressTasks[i].description==createObj.description )
  1069. {
  1070.  
  1071. here2=true;
  1072. itIsHere2=i;
  1073.  
  1074. }
  1075.  
  1076. }
  1077.  
  1078. var here4=false;
  1079.  
  1080. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  1081.  
  1082. if(archivedTasks[i].name==createObj.name
  1083. && archivedTasks[i].date==createObj.date
  1084. && archivedTasks[i].description==createObj.description )
  1085. {
  1086.  
  1087. here4=true;
  1088. itIsHere2=i;
  1089.  
  1090. }
  1091.  
  1092. }
  1093. if(here4 == true){
  1094. delete4(itIsHere2+1);
  1095. }
  1096. else if(here2 == true){
  1097. delete2(itIsHere2+1);
  1098. }
  1099.  
  1100.  
  1101.  
  1102.  
  1103. if(true){
  1104.  
  1105. finishedTasks.push(createObj);
  1106.  
  1107. }
  1108.  
  1109. printButtons();
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117. editBool = false ;
  1118. }
  1119. function delete2(index){
  1120. inProgressTasks.splice(index - 1,1);
  1121. }
  1122. function delete3(index){
  1123. finishedTasks.splice(index - 1,1);
  1124. }
  1125. function delete4(index){
  1126. archivedTasks.splice(index - 1,1);
  1127. }
  1128.  
  1129. function search2(index) {
  1130. var index2 = index-1;
  1131. var createObj = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  1132.  
  1133. allTasks.splice(index - 1,1);
  1134.  
  1135.  
  1136. var here2=false;
  1137. var itIsHere2;
  1138. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  1139.  
  1140. if(inProgressTasks[i].name==createObj.name
  1141. && inProgressTasks[i].date==createObj.date
  1142. && inProgressTasks[i].description==createObj.description )
  1143. {
  1144.  
  1145. here2=true;
  1146. itIsHere2=i;
  1147.  
  1148. }
  1149.  
  1150. }
  1151.  
  1152. var here3=false;
  1153.  
  1154. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  1155.  
  1156. if(finishedTasks[i].name==createObj.name
  1157. && finishedTasks[i].date==createObj.date
  1158. && finishedTasks[i].description==createObj.description )
  1159. {
  1160.  
  1161. here3=true;
  1162. itIsHere2=i;
  1163.  
  1164. }
  1165.  
  1166. }
  1167. if(here3 == true){
  1168. delete3(itIsHere2+1);
  1169. }
  1170. else if(here2 == true){
  1171. delete2(itIsHere2+1);
  1172. }
  1173.  
  1174.  
  1175.  
  1176.  
  1177. if(true){
  1178.  
  1179. archivedTasks.push(createObj);
  1180.  
  1181. }
  1182.  
  1183. printButtons();
  1184.  
  1185.  
  1186.  
  1187. }
  1188.  
  1189.  
  1190.  
  1191. var sortN1 = false;
  1192. var sortD1 = false;
  1193. var sortN2 = false;
  1194. var sortD2 = false;
  1195. var sortN3 = false;
  1196. var sortD3 = false;
  1197. var sortN4 = false;
  1198. var sortD4 = false;
  1199.  
  1200.  
  1201. function sortDate(num) {
  1202.  
  1203. if(num==1){
  1204. sortD1 = true ;
  1205. sortN1 = false;
  1206. allTasks.sort(function(a, b){
  1207. var nameA=a.date; var nameB=b.date;
  1208. if (nameA < nameB) //sort string ascending
  1209. return -1 ;
  1210. if (nameA > nameB)
  1211. return 1;
  1212. return 0 ;//default return value (no sorting)
  1213. })
  1214. drawTable1(allTasks,num);
  1215.  
  1216.  
  1217. }else if(num==2){
  1218. sortD2 = true ;
  1219. sortN2 = false;
  1220. inProgressTasks.sort(function(a, b){
  1221. var nameA=a.date; var nameB=b.date;
  1222. if (nameA < nameB) //sort string ascending
  1223. return -1 ;
  1224. if (nameA > nameB)
  1225. return 1;
  1226. return 0 ;//default return value (no sorting)
  1227. })
  1228. drawTable2(inProgressTasks,num);
  1229.  
  1230. }else if(num==3){
  1231. sortD3 = true;
  1232. sortN3 = false;
  1233. finishedTasks.sort(function(a, b){
  1234. var nameA=a.date; var nameB=b.date;
  1235. if (nameA < nameB) //sort string ascending
  1236. return -1 ;
  1237. if (nameA > nameB)
  1238. return 1;
  1239. return 0 ;//default return value (no sorting)
  1240. })
  1241. drawTable3(finishedTasks,num);
  1242. }else if(num==4){
  1243. sortD4 = true;
  1244. sortN4 = false;
  1245. archrivedTasks.sort(function(a, b){
  1246. var nameA=a.date; var nameB=b.date;
  1247. if (nameA < nameB) //sort string ascending
  1248. return -1 ;
  1249. if (nameA > nameB)
  1250. return 1;
  1251. return 0 ;//default return value (no sorting)
  1252. })
  1253. drawTable4(archivedTasks,num);
  1254. }
  1255.  
  1256.  
  1257. }
  1258.  
  1259. function sortName(num) {
  1260.  
  1261. if(num==1){
  1262. sortN1 = true ;
  1263. sortD1 = false ;
  1264. allTasks.sort(function(a, b){
  1265. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1266. if (nameA < nameB) //sort string ascending
  1267. return -1 ;
  1268. if (nameA > nameB)
  1269. return 1;
  1270. return 0 ;//default return value (no sorting)
  1271. })
  1272. drawTable1(allTasks,num);
  1273.  
  1274.  
  1275. }else if(num==2){
  1276. sortN2 = true ;
  1277. sortD2 = false ;
  1278. inProgressTasks.sort(function(a, b){
  1279. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1280. if (nameA < nameB) //sort string ascending
  1281. return -1 ;
  1282. if (nameA > nameB)
  1283. return 1;
  1284. return 0 ;//default return value (no sorting)
  1285. })
  1286. drawTable2(inProgressTasks,num);
  1287.  
  1288. }else if(num==3){
  1289. sortN3 = true ;
  1290. sortD3 = false ;
  1291. finishedTasks.sort(function(a, b){
  1292. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1293. if (nameA < nameB) //sort string ascending
  1294. return -1 ;
  1295. if (nameA > nameB)
  1296. return 1;
  1297. return 0 ;//default return value (no sorting)
  1298. })
  1299. drawTable3(finishedTasks,num);
  1300. }else if(num==4){
  1301. sortN4 = true ;
  1302. sortD4 = false ;
  1303. archrivedTasks.sort(function(a, b){
  1304. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1305. if (nameA < nameB) //sort string ascending
  1306. return -1 ;
  1307. if (nameA > nameB)
  1308. return 1;
  1309. return 0 ;//default return value (no sorting)
  1310. })
  1311. drawTable4(archivedTasks,num);
  1312. }
  1313.  
  1314.  
  1315. }
  1316. function drawTable3(workOnArray,num){
  1317. if(sortD3== true){
  1318. sortD3 = true ;
  1319. sortN3 = false;
  1320. finishedTasks.sort(function(a, b){
  1321. var nameA=a.date; var nameB=b.date;
  1322. if (nameA < nameB) //sort string ascending
  1323. return -1 ;
  1324. if (nameA > nameB)
  1325. return 1;
  1326. return 0 ;//default return value (no sorting)
  1327. })
  1328. }
  1329. if(sortN3== true){
  1330. sortN3 = true ;
  1331. sortD3 = false ;
  1332. finishedTasks.sort(function(a, b){
  1333. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1334. if (nameA < nameB) //sort string ascending
  1335. return -1 ;
  1336. if (nameA > nameB)
  1337. return 1;
  1338. return 0 ;//default return value (no sorting)
  1339. })
  1340. }
  1341. for(var j=0;j<workOnArray.length;j++){
  1342.  
  1343. var create = new inputObj(workOnArray[j].name,workOnArray[j].date,workOnArray[j].description);
  1344. store.push(create);
  1345. }
  1346.  
  1347. myKey = num ;
  1348. var text = "<table class=\"table table-hover\" >";
  1349. text += "<th></th>";
  1350. text += "<th>Task Name </th>";
  1351. text += "<th>Date</th>";
  1352. text += "<th>Description</th>";
  1353. text += "<th></th>";
  1354. text += "<th></th>";
  1355. 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>";
  1356.  
  1357. for(var i = 0; i< workOnArray.length; i++){
  1358.  
  1359.  
  1360. text += "<tr>";
  1361. text += "<td></td>";
  1362.  
  1363. text += "<td>"+workOnArray[i].name + "</td>";
  1364.  
  1365.  
  1366. text += "<td>"+workOnArray[i].date + "</td>";
  1367. text += "<td>"+workOnArray[i].description + "</td>";
  1368. text += "<td><h4 style display=\"none\" >"+workOnArray[i].description + "</h4></td>";
  1369. text += "<td><input type=\"checkbox\" onclick='selecting(this,this.parentNode.parentNode)' id=\"myCheck\ ></td>";
  1370. 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>";
  1371.  
  1372.  
  1373. text += "</tr>"; }
  1374.  
  1375. text+= "</table>";
  1376. document.getElementById("myTable").innerHTML = text;
  1377. printButtons();
  1378. }
  1379. function drawTable4(workOnArray,num){
  1380. if(sortD4== true){
  1381. sortD4 = true ;
  1382. sortN4 = false;
  1383. archivedTasks.sort(function(a, b){
  1384. var nameA=a.date; var nameB=b.date;
  1385. if (nameA < nameB) //sort string ascending
  1386. return -1 ;
  1387. if (nameA > nameB)
  1388. return 1;
  1389. return 0 ;//default return value (no sorting)
  1390. })
  1391. }
  1392. if(sortN4== true){
  1393. sortN4 = true ;
  1394. sortD4 = false ;
  1395. archivedTasks.sort(function(a, b){
  1396. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1397. if (nameA < nameB) //sort string ascending
  1398. return -1 ;
  1399. if (nameA > nameB)
  1400. return 1;
  1401. return 0 ;//default return value (no sorting)
  1402. })
  1403. }
  1404.  
  1405. for(var j=0;j<workOnArray.length;j++){
  1406.  
  1407. var create = new inputObj(workOnArray[j].name,workOnArray[j].date,workOnArray[j].description);
  1408. store.push(create);
  1409. }
  1410.  
  1411. myKey = num ;
  1412. var text = "<table class=\"table table-hover\" >";
  1413. text += "<th></th>";
  1414. text += "<th>Task Name </th>";
  1415. text += "<th>Date</th>";
  1416. text += "<th>Description</th>";
  1417. text += "<th></th>";
  1418. text += "<th></th>";
  1419. 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>";
  1420.  
  1421. for(var i = 0; i< workOnArray.length; i++){
  1422.  
  1423.  
  1424. text += "<tr>";
  1425. text += "<td></td>";
  1426. if(myKey==3){
  1427.  
  1428. text += "<td><strike>"+workOnArray[i].name + "</strike></td>";
  1429.  
  1430.  
  1431.  
  1432. }else{
  1433. text += "<td>"+workOnArray[i].name + "</td>";
  1434.  
  1435. }
  1436. text += "<td>"+workOnArray[i].date + "</td>";
  1437. text += "<td>"+workOnArray[i].description + "</td>";
  1438. text += "<td><h4 style display=\"none\" >"+workOnArray[i].description + "</h4></td>";
  1439. text += "<td><input type=\"checkbox\" onclick='selecting(this,this.parentNode.parentNode)' id=\"myCheck\ ></td>";
  1440. 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>";
  1441.  
  1442. text += "</tr>"; }
  1443.  
  1444. text+= "</table>";
  1445. document.getElementById("myTable").innerHTML = text;
  1446. printButtons();
  1447. }
  1448.  
  1449. function drawTable2(workOnArray,num){
  1450. if(sortD2== true){
  1451. sortD2 = true ;
  1452. sortN2 = false;
  1453. inProgressTasks.sort(function(a, b){
  1454. var nameA=a.date; var nameB=b.date;
  1455. if (nameA < nameB) //sort string ascending
  1456. return -1 ;
  1457. if (nameA > nameB)
  1458. return 1;
  1459. return 0 ;//default return value (no sorting)
  1460. })
  1461. }
  1462. if(sortN2== true){
  1463. sortN2 = true ;
  1464. sortD2 = false ;
  1465. inProgressTasks.sort(function(a, b){
  1466. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1467. if (nameA < nameB) //sort string ascending
  1468. return -1 ;
  1469. if (nameA > nameB)
  1470. return 1;
  1471. return 0 ;//default return value (no sorting)
  1472. })
  1473. }
  1474. for(var j=0;j<workOnArray.length;j++){
  1475.  
  1476. var create = new inputObj(workOnArray[j].name,workOnArray[j].date,workOnArray[j].description);
  1477. store.push(create);
  1478. }
  1479.  
  1480. myKey = num ;
  1481. var text = "<table class=\"table table-hover\" >";
  1482. text += "<th></th>";
  1483. text += "<th>Task Name </th>";
  1484. text += "<th>Date</th>";
  1485. text += "<th>Description</th>";
  1486. text += "<th></th>";
  1487. text += "<th></th>";
  1488. 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>";
  1489.  
  1490. for(var i = 0; i< workOnArray.length; i++){
  1491.  
  1492.  
  1493. text += "<tr>";
  1494. text += "<td></td>";
  1495. if(myKey==3){
  1496.  
  1497. text += "<td><strike>"+workOnArray[i].name + "</strike></td>";
  1498.  
  1499.  
  1500.  
  1501. }else{
  1502. text += "<td>"+workOnArray[i].name + "</td>";
  1503.  
  1504. }
  1505. text += "<td>"+workOnArray[i].date + "</td>";
  1506. text += "<td>"+workOnArray[i].description + "</td>";
  1507. text += "<td><h4 style display=\"none\" >"+workOnArray[i].description + "</h4></td>";
  1508. text += "<td><input type=\"checkbox\" onclick='selecting(this,this.parentNode.parentNode)' id=\"myCheck\ ></td>";
  1509. 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>";
  1510.  
  1511. text += "</tr>"; }
  1512.  
  1513. text+= "</table>";
  1514. document.getElementById("myTable").innerHTML = text;
  1515. printButtons();
  1516. }
  1517. function drawTable1(workOnArray,num){
  1518. if(sortD1== true){
  1519. sortD1 = true ;
  1520. sortN1 = false;
  1521. allTasks.sort(function(a, b){
  1522. var nameA=a.date; var nameB=b.date;
  1523. if (nameA < nameB) //sort string ascending
  1524. return -1 ;
  1525. if (nameA > nameB)
  1526. return 1;
  1527. return 0 ;//default return value (no sorting)
  1528. })
  1529. }
  1530. if(sortN1== true){
  1531. sortN1 = true ;
  1532. sortD1 = false ;
  1533. allTasks.sort(function(a, b){
  1534. var nameA=a.name.toLowerCase(); var nameB=b.name.toLowerCase();
  1535. if (nameA < nameB) //sort string ascending
  1536. return -1 ;
  1537. if (nameA > nameB)
  1538. return 1;
  1539. return 0 ;//default return value (no sorting)
  1540. })
  1541. }
  1542.  
  1543. for(var j=0;j<workOnArray.length;j++){
  1544.  
  1545. var create = new inputObj(workOnArray[j].name,workOnArray[j].date,workOnArray[j].description);
  1546. store.push(create);
  1547. }
  1548.  
  1549. myKey = num ;
  1550. var text = "<table class=\"table table-hover\" id=\"tablehov\">";
  1551. text += "<th></th>";
  1552. text += "<th>Task Name </th>";
  1553. text += "<th>Date</th>";
  1554. text += "<th>Description</th>";
  1555. text += "<th></th>";
  1556. text += "<th></th>";
  1557. 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>";
  1558.  
  1559. for(var i = 0; i< workOnArray.length; i++){
  1560.  
  1561.  
  1562.  
  1563. var hereSr = false;
  1564. for (var ii = 0; ii < finishedTasks.length; ii++) {
  1565. if(workOnArray[i].name == finishedTasks[ii].name
  1566. &&workOnArray[i].date == finishedTasks[ii].date
  1567. &&workOnArray[i].description == finishedTasks[ii].description
  1568. ){text += "<tr>";
  1569. text += "<td></td>";
  1570. text += "<td><strike>"+workOnArray[i].name + "</strike></td>";
  1571. text += "<td><strike>"+workOnArray[i].date + "</strike></td>";
  1572. text += "<td><strike>"+workOnArray[i].description + "</strike></td>";
  1573. text += "<td><div id=\"hoverDes\" >"+workOnArray[i].description + "</div></td>";
  1574.  
  1575.  
  1576. text += "<td><input type=\"checkbox\" onclick='selecting(this,this.parentNode.parentNode)' id=\"myCheck\ ></td>";
  1577. 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>";
  1578. text += "</tr>";
  1579.  
  1580. hereSr = true;
  1581. }
  1582. }
  1583. var hereSr2 = false;
  1584. for (var ii = 0; ii < archivedTasks.length; ii++) {
  1585. if(workOnArray[i].name == archivedTasks[ii].name
  1586. &&workOnArray[i].date == archivedTasks[ii].date
  1587. &&workOnArray[i].description == archivedTasks[ii].description
  1588. ){
  1589.  
  1590. hereSr2 = true;
  1591. }
  1592. }
  1593. if(hereSr== false && hereSr2 == false){
  1594.  
  1595.  
  1596. text += "<tr>";
  1597. text += "<td></td>";
  1598.  
  1599. text += "<td>"+workOnArray[i].name + "</td>";
  1600. text += "<td>"+workOnArray[i].date + "</td>";
  1601. text += "<td>"+workOnArray[i].description + "</td>";
  1602. text += "<td><div id=\"hoverDes\" >"+workOnArray[i].description + "</div></td>";
  1603. text += "<td><input type=\"checkbox\" onclick='selecting(this,this.parentNode.parentNode)' id=\"myCheck\ ></td>";
  1604. 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>";
  1605. text += "</tr>";
  1606. }
  1607. }
  1608.  
  1609. text+= "</table>";
  1610. document.getElementById("myTable").innerHTML = text;
  1611. printButtons();
  1612. }
  1613.  
  1614. function printButtons(){
  1615. var allLength = allTasks.length - archivedTasks.length ;
  1616. document.getElementById("butAll").innerHTML="All Tasks "+allTasks.length;
  1617. document.getElementById("butPro").innerHTML="Progress "+inProgressTasks.length;
  1618. document.getElementById("butcom").innerHTML="Finished "+finishedTasks.length;
  1619. document.getElementById("butArc").innerHTML="Archived "+archivedTasks.length;
  1620. }
  1621.  
  1622. var x=true;
  1623.  
  1624. $(document).ready(function(){
  1625. $("#editConf").click(function(){
  1626. $("#myModal2").show();
  1627.  
  1628.  
  1629. });
  1630. });
  1631. $(document).ready(function(){
  1632. $("#butEdit").click(function(){
  1633. $("#myModal2").hide();
  1634.  
  1635.  
  1636. });
  1637. });
  1638.  
  1639. function edit(index){
  1640. var editable = new inputObj();
  1641. var index2 = index - 1;
  1642. var indexIn ;
  1643. $("#myModal2").show();
  1644. if(myKey==1){
  1645. var createObj = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  1646. allTasks[index2].name = createObj.name ;
  1647. allTasks[index2].date = createObj.date;
  1648. allTasks[index2].description = createObj.description;
  1649. for (var i = 0; i < inProgressTasks.length; i++) {
  1650. if(inProgressTasks[i].name==createObj.name
  1651. && inProgressTasks[i].date==createObj.date
  1652. && inProgressTasks[i].description==createObj.description ){
  1653. indexIn = i ;
  1654. }
  1655. }
  1656. inProgressTasks[indexIn].name = createObj.name;
  1657. inProgressTasks[indexIn].date = createObj.date;
  1658. inProgressTasks[indexIn].description = createObj.description;
  1659. for (var i = 0; i < finishedTasks.length; i++) {
  1660. if(finishedTasks[i].name==createObj.name
  1661. && finishedTasks[i].date==createObj.date
  1662. && finishedTasks[i].description==createObj.description ){
  1663. indexIn = i ;
  1664. }
  1665. }
  1666. finishedTasks[indexIn].name = createObj.name;
  1667. finishedTasks[indexIn].date = createObj.date;
  1668. finishedTasks[indexIn].description = createObj.description;
  1669. for (var i = 0; i < archivedTasks.length; i++) {
  1670. if(archivedTasks[i].name==createObj.name
  1671. && archivedTasks[i].date==createObj.date
  1672. && archivedTasks[i].description==createObj.description ){
  1673. indexIn = i ;
  1674. }
  1675. }
  1676.  
  1677. archivedTasks[indexIn].name = createObj.name;
  1678. archivedTasks[indexIn].date = createObj.date;
  1679. archivedTasks[indexIn].description = createObj.description;
  1680.  
  1681. }else if(myKey==2){
  1682. var createObj = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  1683. inProgressTasks[index2].name = createObj.name;
  1684. inProgressTasks[index2].date = createObj.date;
  1685. inProgressTasks[index2].description = createObj.description;
  1686.  
  1687. for (var i = 0; i < allTasks.length; i++) {
  1688. if(allTasks[i].name==createObj.name
  1689. && allTasks[i].date==createObj.date
  1690. && allTasks[i].description==createObj.description ){
  1691. indexIn = i ;
  1692. }
  1693. }
  1694. allTasks[indexIn].name = createObj.name ;
  1695. allTasks[indexIn].date = createObj.date;
  1696. allTasks[indexIn].description = createObj.description;
  1697.  
  1698. }else if(myKey==3){
  1699. var createObj = new inputObj (finishedTasks[index2].name,finishedTasks[index2].date,finishedTasks[index2].description);
  1700. finishedTasks[index2].name = createObj.name;
  1701. finishedTasks[index2].date = createObj.date;
  1702. finishedTasks[index2].description = createObj.description;
  1703. for (var i = 0; i < allTasks.length; i++) {
  1704. if(allTasks[i].name==createObj.name
  1705. && allTasks[i].date==createObj.date
  1706. && allTasks[i].description==createObj.description ){
  1707. indexIn = i ;
  1708. }
  1709. }
  1710. allTasks[indexIn].name = createObj.name ;
  1711. allTasks[indexIn].date = createObj.date;
  1712. allTasks[indexIn].description = createObj.description;
  1713. }
  1714. if(myKey==4){
  1715. var createObj = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  1716. archivedTasks[index2].name = createObj.name;
  1717. archivedTasks[index2].date = createObj.date;
  1718. archivedTasks[index2].description = createObj.description;
  1719. for (var i = 0; i < allTasks.length; i++) {
  1720. if(allTasks[i].name==createObj.name
  1721. && allTasks[i].date==createObj.date
  1722. && allTasks[i].description==createObj.description ){
  1723. indexIn = i ;
  1724. }
  1725. }
  1726. allTasks[indexIn].name = createObj.name ;
  1727. allTasks[indexIn].date = createObj.date;
  1728. allTasks[indexIn].description = createObj.description;
  1729. }
  1730.  
  1731.  
  1732. }
  1733. function deleteAndPrint2(index,myKey){
  1734. var index2 = index - 1 ;
  1735. if(myKey==1){
  1736. var here1=false;
  1737. var itIsHere1;
  1738. var current = new inputObj (allTasks[index2].name,allTasks[index2].date,allTasks[index2].description);
  1739. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  1740.  
  1741. if(allTasks[i].name==current.name
  1742. && allTasks[i].date==current.date
  1743. && allTasks[i].description==current.description )
  1744. {
  1745.  
  1746. here1=true;
  1747. itIsHere1=i;
  1748.  
  1749. }
  1750.  
  1751. }
  1752. if(here1==true){
  1753. allTasks.splice(itIsHere1,1);
  1754. var here2=false;
  1755. var itIsHere2;
  1756. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  1757.  
  1758. if(inProgressTasks[i].name==current.name
  1759. && inProgressTasks[i].date==current.date
  1760. && inProgressTasks[i].description==current.description )
  1761. {
  1762.  
  1763. here2=true;
  1764. itIsHere2=i;
  1765.  
  1766. }
  1767.  
  1768. }
  1769.  
  1770. if(here2==true){
  1771. inProgressTasks.splice(itIsHere2,1);
  1772. }
  1773. var here3=false;
  1774. var itIsHere3;
  1775. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  1776.  
  1777. if(finishedTasks[i].name==current.name
  1778. && finishedTasks[i].date==current.date
  1779. && finishedTasks[i].description==current.description )
  1780. {
  1781.  
  1782. here3=true;
  1783. itIsHere3=i;
  1784.  
  1785. }
  1786.  
  1787. }
  1788. if(here3==true){
  1789. finishedTasks.splice(itIsHere3,1);
  1790.  
  1791. }
  1792. var here4=false;
  1793. var itIsHere4;
  1794. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  1795.  
  1796. if(archivedTasks[i].name==current.name
  1797. && archivedTasks[i].date==current.date
  1798. && archivedTasks[i].description==current.description )
  1799. {
  1800.  
  1801. here4=true;
  1802. itIsHere4=i;
  1803.  
  1804. }
  1805.  
  1806. }
  1807. if(here4==true){
  1808. archivedTasks.splice(itIsHere4,1);
  1809.  
  1810. }
  1811.  
  1812.  
  1813.  
  1814. }
  1815.  
  1816.  
  1817.  
  1818.  
  1819. }
  1820. else{
  1821.  
  1822. if (myKey ==2){
  1823. var current = new inputObj (inProgressTasks[index2].name,inProgressTasks[index2].date,inProgressTasks[index2].description);
  1824. var here2=false;
  1825. var itIsHere2;
  1826. for(var i=0;i<inProgressTasks.length&&here2==false&&inProgressTasks.length>0;i++){
  1827.  
  1828. if(inProgressTasks[i].name==current.name
  1829. && inProgressTasks[i].date==current.date
  1830. && inProgressTasks[i].description==current.description )
  1831. {
  1832.  
  1833. here2=true;
  1834. itIsHere2=i;
  1835.  
  1836. }
  1837.  
  1838. }
  1839. if(here2==true){
  1840. inProgressTasks.splice(itIsHere2,1);
  1841. var here1=false;
  1842. var itIsHere1;
  1843. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  1844.  
  1845. if(allTasks[i].name==current.name
  1846. && allTasks[i].date==current.date
  1847. && allTasks[i].description==current.description )
  1848. {
  1849.  
  1850. here1=true;
  1851. itIsHere1=i;
  1852.  
  1853. }
  1854.  
  1855. }
  1856. if(here1==true){
  1857. allTasks.splice(itIsHere1,1);
  1858. }
  1859. }
  1860. }
  1861. else if (myKey ==3){
  1862. var current = new inputObj (finishedTasks[index2].name,finishedTasks[index2].date,finishedTasks[index2].description);
  1863. var here3=false;
  1864. var itIsHere3;
  1865. for(var i=0;i<finishedTasks.length&&here3==false&&finishedTasks.length>0;i++){
  1866.  
  1867. if(finishedTasks[i].name==current.name
  1868. && finishedTasks[i].date==current.date
  1869. && finishedTasks[i].description==current.description )
  1870. {
  1871.  
  1872. here3=true;
  1873. itIsHere3=i;
  1874.  
  1875. }
  1876.  
  1877. }
  1878. if(here3==true){
  1879. finishedTasks.splice(itIsHere3,1);
  1880. var here1=false;
  1881. var itIsHere1;
  1882. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  1883.  
  1884. if(allTasks[i].name==current.name
  1885. && allTasks[i].date==current.date
  1886. && allTasks[i].description==current.description )
  1887. {
  1888.  
  1889. here1=true;
  1890. itIsHere1=i;
  1891.  
  1892. }
  1893.  
  1894. } if(here1==true){
  1895. allTasks.splice(itIsHere1,1);}
  1896.  
  1897. }
  1898. }
  1899. else if (myKey ==4){
  1900. var current = new inputObj (archivedTasks[index2].name,archivedTasks[index2].date,archivedTasks[index2].description);
  1901. var here4=false;
  1902. var itIsHere4;
  1903. for(var i=0;i<archivedTasks.length&&here4==false&&archivedTasks.length>0;i++){
  1904.  
  1905. if(archivedTasks[i].name==current.name
  1906. && archivedTasks[i].date==current.date
  1907. && archivedTasks[i].description==current.description )
  1908. {
  1909.  
  1910. here4=true;
  1911. itIsHere4=i;
  1912.  
  1913. }
  1914.  
  1915. }
  1916. if(here4==true){
  1917. archivedTasks.splice(itIsHere4,1);
  1918. var here1=false;
  1919. var itIsHere1;
  1920. for(var i=0;i<allTasks.length&&here1==false&&allTasks.length>0;i++){
  1921.  
  1922. if(allTasks[i].name==current.name
  1923. && allTasks[i].date==current.date
  1924. && allTasks[i].description==current.description )
  1925. {
  1926.  
  1927. here1=true;
  1928. itIsHere1=i;
  1929.  
  1930. }
  1931.  
  1932. }
  1933. if(here1==true){
  1934. allTasks.splice(itIsHere1,1);}
  1935.  
  1936. }
  1937.  
  1938. }
  1939. }
  1940.  
  1941. if(myKey == 1){
  1942. drawTable1(allTasks,1);
  1943. }
  1944. else if(myKey == 2){
  1945. drawTable2(inProgressTasks,2);
  1946. }
  1947. else if (myKey == 3){
  1948. drawTable3(finishedTasks,3);
  1949. }
  1950. else if (myKey == 4){
  1951. drawTable4(archivedTasks,4);
  1952. }
  1953. printButtons();
  1954.  
  1955. }
  1956.  
  1957. function DeleteMultipleRows() {
  1958. var list = $(".Checked");
  1959. var i=0;
  1960. var numb ;
  1961. if (confirm("Are you Sure that you want to delete?") == true) {
  1962. for(numb = 0 ; numb <list.length;numb++) {
  1963. deleteAndPrint2(list[numb].rowIndex - i,myKey);
  1964. i++;
  1965. }
  1966. $("#butAdd").show();
  1967. $("#butremoveall").hide();
  1968. }
  1969.  
  1970. }
  1971. function deSelect() {
  1972. // body...
  1973.  
  1974. $("#butAdd").show();
  1975. $("#butremoveall").hide();
  1976. }
  1977. function selecting(x,y) {
  1978. if (x.checked === true) {
  1979. y.className = "Checked";
  1980. $("#butAdd").hide();
  1981. $("#butremoveall").show();
  1982. } else {
  1983. y.className = "";
  1984. if ($(".Checked").length == 0) {
  1985. $("#butAdd").show();
  1986. $("#butremoveall").hide();
  1987. }
  1988. }
  1989. }
  1990.  
  1991. $("#butremoveall").hide();
  1992.  
  1993.  
  1994. function printAtFirst(){
  1995. if(x==true){
  1996. drawTable1(allTasks,1);
  1997. boldedAll();
  1998.  
  1999. }
  2000. x=false;
  2001.  
  2002. }
  2003. printAtFirst();
  2004.  
  2005.  
  2006. </script>
  2007. </body>
  2008.  
  2009. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement