yassmin

Untitled

Apr 22nd, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.69 KB | None | 0 0
  1. <!douctype html>
  2. <html>
  3. <head>
  4. <script src="jquery.js"></script>
  5. <script src="jquery-1.9.1.js"></script>
  6. <script src="jquery-ui.js"></script>
  7. <script src="js/bootstrap.min.js"></script>
  8. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <link rel="stylesheet" href="css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
  10. <link rel="stylesheet" href="css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
  11. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  12. <style >
  13. #flip {
  14. text-align: center;
  15. font-size: 90%;
  16. font-weight: bold;
  17. background-color: #e5eecc;
  18. border: solid 1px #c3c3c3;
  19.  
  20. }
  21. #panel{
  22. text-align: left;
  23. font-size: 90%;
  24. font-weight: bold;
  25. background-color: #e5eecc;
  26. border: solid 1px #c3c3c3;
  27. }
  28.  
  29. #panel {
  30. display: none;
  31. }
  32. .buttonadd{
  33. background-color: rgb(53, 0, 254);
  34. width: 13%;
  35. border: 1px solid #c3c3c3;
  36. position:absolute;
  37. text-align-last: center;
  38. text-rendering: optimizeLegibility;
  39. font-size: 15;
  40. font-weight: bold;
  41. }
  42. .bb{
  43. background-color: rgb(53, 0, 254);
  44. width: 7%;
  45. border: 1px solid #c3c3c3;
  46. position:absolute;
  47. text-align-last: center;
  48. text-rendering: optimizeLegibility;
  49. font-size: 100%;
  50. }
  51. </style>
  52. <script>
  53.  
  54.  
  55.  
  56. var id =0 ;
  57. function task(name,date,description ){
  58. //this.id = id;
  59. this.name = name;
  60. this.date = date;
  61. this.description =description ;
  62. //this.states=states;
  63. }
  64.  
  65. var countElement =0;
  66. var taskslist = [];
  67. var i;
  68. var allTasksarray =[];
  69. var inProgressarray =[];
  70. var archivedarray = [];
  71. var completedarray =[];
  72. var countAll=0;
  73. var countComplete=0;
  74. var countArchive=0;
  75. var countProg=0;
  76. var add1;
  77. var add2;
  78. var add3;
  79. var add4;
  80. var addto;
  81. var count1;
  82. var count;
  83. var count2;
  84. var count3;
  85.  
  86. var x = new task("task_1",Date.now(),"gfuoh;o");
  87. allTasksarray =[x];
  88. //taskslist =[x];
  89. function drawTable(choose,word ){ //var text = //document.getElementById("myTable").innerHTML;
  90. var mark =0;
  91. if (choose == "all"){
  92. taskslist = allTasksarray;
  93. addto = 1;
  94. //taskslist= taskslist.concat(allTasks);
  95. }
  96. else if (choose == "complete"){
  97. taskslist = completedarray;
  98. addto =3;
  99. mark =1;
  100. }
  101. else if( choose == "prog"){
  102. taskslist = inProgressarray ;
  103. addto =2;
  104.  
  105. }
  106. else if ( choose == "archive"){
  107. taskslist = archivedarray ;
  108. addto = 4;
  109.  
  110. }
  111. var text = "<table style=\"width:100% padding-top:10%;padding-bottom: 30%;\" >";
  112. text += "<tr>";
  113. text += "<td style =\" text-align:left; font-size:200%;font:bold;width:30%\">"+word+"</td>";
  114. text+="<td style =\"width:10%; text-align:center;\"><div class=\"dropdown\">"+
  115. "<button class=\"btn btn-primary dropdown-toggle\"type=\"button\" data-toggle=\"dropdown\">sort"+
  116. "<span class=\"caret\"></span></button>"+
  117. "<ul class=\"dropdown-menu\">"+
  118. "<li><a onclick = \"Sort(name,word);\"href=\"#\">by name</a></li>"+
  119. "<li><a onclick = \"Sort(name,word);\"href=\"#\">by date</a></li>"+
  120. "</div>"+
  121. "</td>";
  122. text += "</tr>";
  123. //text += "<th>Date</th>";
  124. text += "<th></th>";
  125. if (mark == 0){
  126. for(i = 0; i< taskslist.length; i++){
  127. text += "<tr>";
  128. text += "<td style=\"width:5%\"> <INPUT TYPE=\"checkbox\" NAME=\"Item1\" VALUE=\"0\" UNCHECKED onclick=\"showbutton\"></td>";
  129. text += "<td style=\"width:45%;text-align:left;\">"+taskslist[i].name + "</td>";
  130. text += "<td style=\"width:20%\">"+taskslist[i].date + "</td>";
  131. text += "<td style =\"width:20%; text-align:center;\"><div class=\"dropdown\">"+
  132. "<button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\">options"+
  133. "<span class=\"caret\"></span></button>"+
  134. "<ul class=\"dropdown-menu\">"+
  135. "<li><a onclick = \"Tobearchived(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex,addto);\"href=\"#\">archived</a></li>"+
  136. "<li><a onclick = \"editt(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex,addto);\"href=\"#\">Edit</a></li>"+
  137. "<li><a onclick = \"Delete(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex,addto);\"href=\"#\">delete</a></li>"+
  138. "<li><a onclick = \"Tobedone(this.parentNode.parentNode.parentNode.parentNode.parentNode.rowIndex,addto);\"href=\"#\">mark as done</a></li>"+
  139. "</ul>"+
  140. "</ul>"+
  141. "</div>"+
  142. "</td>"
  143. text += "</tr>";}
  144. text += "<tr><button onclick = \"addTask()\" id=\"button_\"></tr>";
  145. text += "<form>Task<input type=\"text\"id=\"taskname\" name=\"task\">"+
  146. "</input>Date<input type=\"date\" id=\"datepicker\" name=\"date\"></input>"+
  147. "<br>description<input type=\"text\" id=\"desc\" name=\"desc\"></input><br>"+
  148. "</form>";
  149. text += "<tr>";
  150. text+= "</table>";}
  151. else if (mark == 1){
  152. for(i = 0; i< taskslist.length; i++){
  153. text += "<tr>";
  154. text += "<td style=\"width:5%\"> <INPUT TYPE=\"checkbox\" NAME=\"Item1\" VALUE=\"0\" id =\"del\" UNCHECKED onclick=\"showbutton\"></td>";
  155. text += "<td style=\"width:45%;text-align:left;\"><strike>"+taskslist[i].name + "</strike></td>";
  156. text += "<td style=\"width:20%\">"+taskslist[i].date + "</td>";
  157. text += "<td style =\"width:20%; text-align:center;\"><div class=\"dropdown\">"+
  158. "<button class=\"btn btn-primary dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\">options"+
  159. "<span class=\"caret\"></span></button>"+
  160. "<ul class=\"dropdown-menu\">"+
  161. "<li><a onclick = \"Tobearchived(this.parentNode.parentNode.parentNode.parentNode.rowIndex,addto);\"href=\"#\">archived</a></li>"+
  162. "<li><a onclick = \"editt(this.parentNode.parentNode.parentNode.parentNode.rowIndex,addto);\"href=\"#\">Edit</a></li>"+
  163. "<li><a onclick = \"Delete(this.parentNode.parentNode.parentNode.parentNode.rowIndex,addto);\"href=\"#\">delete</a></li>"+
  164. "<li><a onclick = \"Tobedone(this.parentNode.parentNode.parentNode.parentNode.rowIndex,addto);\"href=\"#\">mark as done</a></li>"+
  165. "</ul>"+
  166. "</div>"+
  167. "</td>"
  168. text += "</tr>";}
  169. text += "<tr><button onclick = \"addTask()\" id=\"button_\"></tr>";
  170. text += "<form>Task<input type=\"text\"id=\"taskname\" name=\"task\">"+
  171. "</input>Date<input type=\"date\" id=\"datepicker\" name=\"date\"></input>"+
  172. "<br>description<input type=\"text\" id=\"desc\" name=\"desc\"></input><br>"+
  173. "</form>";
  174. text += "<tr>";
  175. text+= "</table>";}
  176.  
  177. document.getElementById("myTable").innerHTML = text;
  178. taskslist =[];
  179. }
  180.  
  181.  
  182.  
  183. function showbutton(){
  184. var delbut ="<form>";
  185. delbut += "<button type\"button\" class=\"btn btn-danger\">Danger</button>";
  186. //"<button style=\"width:30%;color:red;\"onclick=\"Delete\">Delete";
  187. delbut += "<\form>";
  188. document.getElementByName("Item1").innerHTML = delbut;
  189. }
  190. function Sort(type1,type2){
  191.  
  192. }
  193. function Tobearchived(index,array){
  194. //index=index-2
  195. }
  196. function editt(index,array){
  197. //index=index-2
  198. }
  199. function Tobedone(index,array){
  200. //index=index-2
  201. }
  202. function Delete(index,array){
  203. if (array == 1){
  204. if(confirm("are you sure")==true){
  205. allTasksarray.splice((index-2),1);}
  206. drawTable("all","ALL Tasks");
  207. }
  208. else if ( array== 3){
  209. if(confirm("are you sure")==true){
  210. completedarray.splice((index-2),1);}
  211. drawTable("complete","Completed");
  212. }
  213. else if( array == 2){
  214. if(confirm("are you sure")==true){
  215. inProgressarray.splice((index-2),1);}
  216. drawTable("prog","In Progress");
  217. }
  218. else if ( array == 4){
  219. if(confirm("are you sure")==true){
  220. archivedarray.splice((index-2),1);}
  221. drawTable("archive","Archived");
  222. }
  223. }
  224.  
  225.  
  226.  
  227.  
  228. function addTask(id){
  229. var name_1 = document.getElementById("taskname").value;
  230. var date_1 = document.getElementById("datepicker").value;
  231. var description_1= document.getElementById("desc").value;
  232. var tasknow = new task(name_1,date_1,description_1);
  233. if(addto == 1){
  234. allTasksarray.push(tasknow);
  235. var choose = "all";
  236. var word ="ALL tasks";
  237. taskslist =[];
  238. drawTable(choose,word);
  239. }
  240. else if(addto == 2){
  241. inProgressarray.push(tasknow);
  242. allTasksarray.push(tasknow);
  243. var choose = "prog";
  244. var word ="In Progress";
  245. taskslist =[];
  246. drawTable(choose,word);
  247. }
  248. else if(addto == 3){
  249. completedarray.push(tasknow)
  250. tasknow.name= "<strike>"+tasknow.name+"</strike>";
  251. allTasksarray.push(tasknow);
  252. var choose = "complete";
  253. var word ="Completed";
  254. taskslist =[];
  255. drawTable(choose,word);
  256.  
  257. }
  258. else if(addto == 4){
  259. archivedarray.push(tasknow);
  260. allTasksarray.push(tasknow);
  261. var choose = "archive";
  262. var word ="Archived";
  263. taskslist =[];
  264. drawTable(choose,word);
  265. }
  266. }
  267.  
  268.  
  269. </script>
  270. <script>
  271. $(document).ready(function() {
  272. $("#datepicker").datepicker();
  273. });
  274.  
  275. $(document).ready(function(){
  276. $("#flip").click(function(){
  277. $("#panel").slideDown("slow");
  278. });
  279. });
  280.  
  281. $(document).ready(function(){
  282. $("#flip2").click(function(){
  283. $("#panel").slideUp("slow");
  284. });
  285. });
  286.  
  287. </script>
  288. </head>
  289. <body style="background-color:rgb(135, 148, 165);">
  290. <h1 class="text" style=" background-color:rgb(146, 111, 247);color:white;text-align:center;padding:0.25%">Welcome to our to-do-list </h1>
  291. <table style ="text-align:center ; width:100%">
  292. <td style="width:30% ; background-color:rgb(96, 193, 113);text-align:center-left; padding-top:10%;padding-bottom: 30%;">
  293. <br>
  294. <ui>
  295. <button style=" border-radius:4%;background-color:rgb(85, 165, 255); width :90%;" id="all" value="ALL tasks" onclick="drawTable(this.id, this.value);">All tasks<span class="badge">0</span></button>
  296. </ui>
  297. </br>
  298. <br>
  299. <ui>
  300. <button style="background-color:rgb(85, 165, 255); width :90%;" value="In Progress" id ="prog" onclick="drawTable(this.id, this.value);">In Progress<span class="badge">0</span></button>
  301. </ui>
  302. </br>
  303. <br>
  304. <ui>
  305. <button style="background-color:rgb(85, 165, 255); width :90%;" value="Completed" id="complete" onclick="drawTable(this.id, this.value);">Completed<span class="badge">0</span></button>
  306. </ui>
  307. </br>
  308. <br>
  309. <ui>
  310. <button style="background-color:rgb(85, 165, 255); width :90%; " value="Archived"id ="archive" onclick="drawTable(this.id, this.value);">Archived<span class="badge">0</span></button>
  311. </ui>
  312. </br>
  313. </td>
  314. <td style="width:70% padding-top:10%;padding-bottom: 30%;">
  315. <p id="myTable"/>
  316. <table>
  317. <h2>All Tasks </h2>
  318.  
  319. <td style="width:5%">
  320. <INPUT TYPE="checkbox" NAME="Item1" VALUE="0" UCHECKED onClick="showbutton">
  321. </td>
  322. <td style="width:45%;text-align:left;"><b>task_1</b></td>
  323.  
  324. <td style="width:20%">
  325. <form style=" text-align:center;">
  326. <input type="text" id="datepicker" name="date"/>
  327. </form>
  328. </td>
  329. <td style =" width:20%; text-align:center;">
  330. <div class="dropdown">
  331. <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">options
  332. <span class="caret"></span></button>
  333. <ul class="dropdown-menu">
  334. <li><a href="#" >archived</a></li>
  335. <li><a href="#">Edit</a></li>
  336. <li><a href="#">delete</a></li>
  337. <li><a href="#">mark as done</a></li>
  338. </ul>
  339. </div>
  340. </td>
  341. </table>
  342.  
  343. </td>
  344. </table>
  345.  
  346. </body>
  347. </html>
Add Comment
Please, Sign In to add comment