summaryrefslogtreecommitdiffstats
path: root/js/master.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/master.js')
-rw-r--r--js/master.js84
1 files changed, 73 insertions, 11 deletions
diff --git a/js/master.js b/js/master.js
index edcf397..0590e5a 100644
--- a/js/master.js
+++ b/js/master.js
@@ -1,19 +1,81 @@
+var title, status, task;
+function modalFix(task_s, status_s, title_s){
+ document.getElementById("modal-title").value = title_s;
+ title = title_s;
+ document.getElementById("modalstatus").value = status_s;
+ status = status_s;
+ document.getElementById("modaltask").value = task_s;
+ task = task_s;
+ console.log("modalFix");
+
+}
function addTask(){
+ var xmlhttp = new XMLHttpRequest();
+ var tasktitle = document.getElementById("tasktitle").value;
+ var taskbody = document.getElementById("taskbody").value;
+ var taskperson = document.getElementById("taskperson").value;
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+ document.getElementById("tasktitle").value = "";
+ document.getElementById("taskbody").value = "";
+ document.getElementById("taskperson").value = "";
+ getLastTask();
+ }
+ };
+ xmlhttp.open("POST", "App/formhandler/add_listitem.php", true);
+ xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xmlhttp.send("tasktitle="+tasktitle+"&taskbody="+taskperson+"&taskperson="+taskperson);
+}
+function getLastTask(){
+ var xmlhttp = new XMLHttpRequest();
+ console.log("Häre är jag!");
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+ $("#feed").prepend(xmlhttp.responseText);
+ }
+ };
+ xmlhttp.open("POST", "App/ajax/lasttask.php", true);
+ xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xmlhttp.send();
}
function changeStatus(){
-
+ var xmlhttp = new XMLHttpRequest();
+ var user = document.getElementById("modalname").value;
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+ $('#statusmodal').modal('hide');
+ UpdateTaskVisuals(task);
+ }
+ };
+ xmlhttp.open("POST", "App/formhandler/changestatus.php", true);
+ xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xmlhttp.send("task="+task+"&status="+status+"&user"+user);
}
-function updateFeed(){
-
+function UpdateTaskVisuals(taskID){
+ var xmlhttp = new XMLHttpRequest();
+ var user = document.getElementById("modalname").value;
+ xmlhttp.onreadystatechange = function() {
+ if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+ document.getElementById("task_nr_"+taskID).innerHTML = xmlhttp.responseText;
+ }
+ };
+ xmlhttp.open("POST", "App/ajax/gettask_inner.php", true);
+ xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ xmlhttp.send("task="+taskID);
+}
+function getStatusHistory(task){
}
-function getFeedArguments(){
- var arguments = [];
- arguments.push(document.getElementById("done").value);
- arguments.push(document.getElementById("undone").value);
- arguments.push(document.getElementById("indev").value);
- arguments.push(document.getElementById("prio1").value);
- console.debug(arguments);
- //updateFeed(arguments);
+
+function applyFilter(){
+ var status_options = ["done","indev","prio1"];
+ for(var i = 0; i < status_options.length;i++){
+ console.log("Häre är jag!");
+ if(document.getElementById(status_options[i]).checked){
+ $(".status-"+status_options[i]).hide();
+ }else{
+ $(".status-"+status_options[i]).show();
+ }
+ }
}