mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
refactor(task-modal): enhance timeblock loading and rendering logic with validation and improved display conditions
This commit is contained in:
1 parent
dd3b754fb2
commit
af1f946158
2 files changed
+42
-4
No files matched your search
+21
-3
@@ -93,8 +93,15 @@
|
||||
@mousedown.stop="handlePreviewMouseDown"
|
||||
>
|
||||
<div class="preview-time-label">
|
||||
{{ formatTime(previewBlock.start) }} -
|
||||
{{ formatTime(previewBlock.end) }}
|
||||
<div
|
||||
v-if="getTimeWidth(previewBlock.start, previewBlock.end) <= 58"
|
||||
>
|
||||
{{ formatTime(previewBlock.start) }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ formatTime(previewBlock.start) }} -
|
||||
{{ formatTime(previewBlock.end) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -146,7 +153,18 @@
|
||||
)}px`,
|
||||
}"
|
||||
>
|
||||
<div class="preview-time-label">
|
||||
<div
|
||||
v-if="
|
||||
getTimeWidth(
|
||||
resizedCurrentBlock.start,
|
||||
resizedCurrentBlock.end,
|
||||
) <= 58
|
||||
"
|
||||
class="preview-time-label"
|
||||
>
|
||||
{{ formatTime(resizedCurrentBlock.start) }}
|
||||
</div>
|
||||
<div v-else class="preview-time-label">
|
||||
{{ formatTime(resizedCurrentBlock.start) }} -
|
||||
{{ formatTime(resizedCurrentBlock.end) }}
|
||||
</div>
|
||||
|
||||
@@ -857,12 +857,21 @@ export default {
|
||||
// Load timeblocks from localStorage if they exist
|
||||
if (savedTimeblocks) {
|
||||
try {
|
||||
const parsedTimeblocks = JSON.parse(savedTimeblocks);
|
||||
let parsedTimeblocks = JSON.parse(savedTimeblocks);
|
||||
|
||||
// Filter out timeblocks that are not valid
|
||||
parsedTimeblocks = parsedTimeblocks.filter(
|
||||
(tb) =>
|
||||
tb.employee_id && tb.starts_at_time && tb.ends_at_time,
|
||||
);
|
||||
|
||||
if (Array.isArray(parsedTimeblocks)) {
|
||||
this.timeblocks = parsedTimeblocks.map((tb) => ({
|
||||
...tb,
|
||||
date: tb.date ? new Date(tb.date) : null,
|
||||
}));
|
||||
} else {
|
||||
this.timeblocks = [];
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error parsing saved timeblocks:', e);
|
||||
@@ -897,6 +906,17 @@ export default {
|
||||
this.subtask.employees = [employee];
|
||||
this.subtask.deadline = subtask.deadline;
|
||||
this.subtask._deadline_time = subtask._deadline_time;
|
||||
|
||||
setTimeout(() => {
|
||||
this.timeblocks = [
|
||||
{
|
||||
date: new Date(subtask.deadline),
|
||||
starts_at_time: subtask._deadline_time,
|
||||
ends_at_time: null,
|
||||
employee_id: subtask.employee_id,
|
||||
},
|
||||
];
|
||||
}, 500);
|
||||
}
|
||||
|
||||
if (subtask?.master_task_id && subtask?.project_code) {
|
||||
|
||||
Reference in new issue
Block a user