mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
refactor(task-modals): updated timeblocks to new local dat format
This commit is contained in:
1 parent
eaf83bf0cc
commit
0035251080
8 files changed
+1059
-597
No files matched your search
@@ -248,7 +248,7 @@
|
||||
:on-input-focus="onInputFocus"
|
||||
:on-date-open="onDateOpen"
|
||||
/>
|
||||
<div class="end-button w-100">
|
||||
<div class="end-button w-100" v-if="!subtask.id">
|
||||
<button @click="addTimeblock">Pridať časový blok</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -466,10 +466,36 @@ export default {
|
||||
|
||||
data.deadline = splittedDeadline[0];
|
||||
data._deadline_time = splittedDeadline[1];
|
||||
|
||||
// Convert BE format timeblocks to internal format
|
||||
const convertedTimeblocks = [];
|
||||
if (data.timeblocks && data.timeblocks.length > 0) {
|
||||
data.timeblocks.forEach((timeblock) => {
|
||||
// If already in internal format, keep as is
|
||||
if (timeblock.date) {
|
||||
convertedTimeblocks.push(timeblock);
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert from BE format to internal format
|
||||
if (timeblock.start && timeblock.end) {
|
||||
const startMoment = moment(timeblock.start, 'YYYY-MM-DD HH:mm:ss');
|
||||
const endMoment = moment(timeblock.end, 'YYYY-MM-DD HH:mm:ss');
|
||||
convertedTimeblocks.push({
|
||||
id: timeblock.id || null,
|
||||
date: startMoment.toDate(),
|
||||
starts_at_time: startMoment.format('HH:mm'),
|
||||
ends_at_time: endMoment.format('HH:mm'),
|
||||
is_finished: timeblock.is_finished || 0,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
data.timeblocks = convertedTimeblocks;
|
||||
|
||||
this.subtask = this._enrichTask(data);
|
||||
|
||||
// TODO: Remove? riesil som neodstranovanie jedineho zanamu v trvani a odpracovanom case
|
||||
console.log('2', this.subtask);
|
||||
this.$forceUpdate();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user