Task duration (#13)

This commit is contained in:
konrad 2018-12-22 20:50:32 +00:00 committed by Gitea
parent 4e324ac38a
commit de6104dda6
2 changed files with 48 additions and 12 deletions

View file

@ -107,6 +107,34 @@
</div> </div>
</div> </div>
<div class="field">
<label class="label" for="">Duration</label>
<div class="control columns">
<div class="column">
<flat-pickr
:class="{ 'disabled': loading}"
class="input"
:disabled="loading"
v-model="taskEditTask.startDate"
:config="flatPickerConfig"
id="taskduedate"
placeholder="Start date">
</flat-pickr>
</div>
<div class="column">
<flat-pickr
:class="{ 'disabled': loading}"
class="input"
:disabled="loading"
v-model="taskEditTask.endDate"
:config="flatPickerConfig"
id="taskduedate"
placeholder="Start date">
</flat-pickr>
</div>
</div>
</div>
<div class="field"> <div class="field">
<label class="label" for="">Repeat after</label> <label class="label" for="">Repeat after</label>
<div class="control repeat-after-input columns"> <div class="control repeat-after-input columns">
@ -339,8 +367,10 @@
const cancel = message.setLoading(this) const cancel = message.setLoading(this)
// Convert the date in a unix timestamp // Convert the date in a unix timestamp
let duedate = (+ new Date(this.taskEditTask.dueDate)) / 1000 this.taskEditTask.dueDate = (+ new Date(this.taskEditTask.dueDate)) / 1000
this.taskEditTask.dueDate = duedate this.taskEditTask.startDate = (+ new Date(this.taskEditTask.startDate)) / 1000
this.taskEditTask.endDate = (+ new Date(this.taskEditTask.endDate)) / 1000
// remove all nulls // remove all nulls
this.taskEditTask.reminderDates = this.removeNullsFromArray(this.taskEditTask.reminderDates) this.taskEditTask.reminderDates = this.removeNullsFromArray(this.taskEditTask.reminderDates)
@ -381,7 +411,7 @@
this.updateTaskByID(this.taskEditTask.id, response.data) this.updateTaskByID(this.taskEditTask.id, response.data)
// Also update the current taskedit object so the ui changes // Also update the current taskedit object so the ui changes
this.$set(this, 'taskEditTask', response.data) this.$set(this, 'taskEditTask', this.fixStuffComingFromAPI(response.data))
this.handleSuccess({message: 'The task was successfully updated.'}) this.handleSuccess({message: 'The task was successfully updated.'})
cancel() // cancel the timers cancel() // cancel the timers
}) })
@ -413,16 +443,13 @@
}, },
fixStuffComingFromAPI(task) { fixStuffComingFromAPI(task) {
// Make date objects from timestamps // Make date objects from timestamps
let dueDate = new Date(task.dueDate * 1000) task.dueDate = this.parseDateIfNessecary(task.dueDate)
if (dueDate === 0) { task.startDate = this.parseDateIfNessecary(task.startDate)
task.dueDate = null task.endDate = this.parseDateIfNessecary(task.endDate)
} else {
task.dueDate = dueDate
}
for (const rd in task.reminderDates) { for (const rd in task.reminderDates) {
task.reminderDates[rd] = new Date(task.reminderDates[rd] * 1000) task.reminderDates[rd] = this.parseDateIfNessecary(task.reminderDates[rd])
} }
// Make subtasks into empty array if null // Make subtasks into empty array if null
if (task.subtasks === null) { if (task.subtasks === null) {
@ -430,6 +457,15 @@
} }
return task return task
}, },
parseDateIfNessecary(dateUnix) {
let dateobj = (+new Date(dateUnix * 1000))
if (dateobj === 0 || dateUnix === 0) {
dateUnix = null
} else {
dateUnix = dateobj
}
return dateUnix
},
updateLastReminderDate(selectedDates) { updateLastReminderDate(selectedDates) {
this.lastReminder = +new Date(selectedDates[0]) this.lastReminder = +new Date(selectedDates[0])
}, },

View file

@ -85,6 +85,7 @@
* [ ] Teams with access to a list * [ ] Teams with access to a list
* [ ] Teams with access to a namespace * [ ] Teams with access to a namespace
* [x] Subtasks * [x] Subtasks
* [x] Start/Enddatum für Tasks
* [ ] Priorities * [ ] Priorities
* [ ] Sachen mit hoher Prio irgendwie hervorheben (rotes Dreieck zb) * [ ] Sachen mit hoher Prio irgendwie hervorheben (rotes Dreieck zb)
* [ ] Listen Kopieren * [ ] Listen Kopieren
@ -95,7 +96,6 @@
* [ ] Assignees * [ ] Assignees
* [ ] Timeline/Calendar view * [ ] Timeline/Calendar view
* [ ] In und Out webhooks, mit Templates vom Payload * [ ] In und Out webhooks, mit Templates vom Payload
* [ ] Start/Enddatum für Tasks
* [ ] Timeline/Calendar view -> Dazu tasks die in einem Bestimmten Bereich due sind, macht dann das Frontend * [ ] Timeline/Calendar view -> Dazu tasks die in einem Bestimmten Bereich due sind, macht dann das Frontend
* [ ] "Smart Lists", Listen nach bestimmten Kriterien gefiltert -> nur UI? * [ ] "Smart Lists", Listen nach bestimmten Kriterien gefiltert -> nur UI?
* [ ] "Performance-Statistik" -> Wie viele Tasks man in bestimmten Zeiträumen so geschafft hat etc * [ ] "Performance-Statistik" -> Wie viele Tasks man in bestimmten Zeiträumen so geschafft hat etc