diff --git a/website/app/static/js/my_assignment/my_assignment_filter.js b/website/app/static/js/my_assignment/my_assignment_filter.js deleted file mode 100644 index 532d46e4..00000000 --- a/website/app/static/js/my_assignment/my_assignment_filter.js +++ /dev/null @@ -1,126 +0,0 @@ -export default { - delimiters: ['[[', ']]'], - props: { - tasks_list: Object - }, - emits: ['tasks_list', 'current_filter'], - setup(props, {emit}) { - let show_ongoing = true - let current_filter = "" - let asc_desc = true - - async function filter_ongoing(ongoing){ - show_ongoing = ongoing - - if(show_ongoing){ - const res = await fetch('/my_assignment/sort_by_ongoing?page=1') - let loc = await res.json() - emit('tasks_list', loc) - }else{ - const res = await fetch('/my_assignment/sort_by_finished?page=1') - let loc = await res.json() - emit('tasks_list', loc) - } - } - - function sort_by_title(){ - current_filter = "title" - asc_desc_filter() - } - - function sort_by_last_modif(){ - current_filter = "last_modif" - asc_desc_filter() - } - - function sort_by_deadline(){ - current_filter = "deadline" - asc_desc_filter() - } - - function sort_by_status(){ - current_filter = "status_id" - asc_desc_filter() - } - - async function asc_desc_filter(change=false){ - emit("current_filter", current_filter) - if(change) - asc_desc = !asc_desc - - let res - if (current_filter){ - if(show_ongoing) - res = await fetch('/my_assignment/tasks/ongoing?page=1&filter=' + current_filter) - else - res = await fetch('/my_assignment/tasks/finished?page=1&filter=' + current_filter) - let loc = await res.json() - if(asc_desc) - emit('tasks_list', loc) - else - loc["tasks"] = loc["tasks"].reverse() - emit('tasks_list', loc) - } - - } - - - return { - filter_ongoing, - sort_by_last_modif, - sort_by_title, - sort_by_deadline, - sort_by_status, - asc_desc_filter - } - }, - template: ` - -