mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +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
@@ -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