mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
Merge branch 'main' of bitbucket.org:studiotem/jandl-taskmanager-app into production
This commit is contained in:
commit
6f7d309f62
1 file changed
+32
-17
@@ -635,6 +635,8 @@ export default {
|
|||||||
|
|
||||||
if (!(await this.v$.$validate())) return;
|
if (!(await this.v$.$validate())) return;
|
||||||
if (!employeesValid || !timeblocksValid) return;
|
if (!employeesValid || !timeblocksValid) return;
|
||||||
|
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
async handleOnRemoveEmployee() {
|
async handleOnRemoveEmployee() {
|
||||||
@@ -757,28 +759,41 @@ export default {
|
|||||||
this.employeeValidations = [];
|
this.employeeValidations = [];
|
||||||
|
|
||||||
if (this.subtask.id) {
|
if (this.subtask.id) {
|
||||||
if (this.subtask.employee && this.subtask.duration) return;
|
// For existing subtasks, require both employee and duration
|
||||||
|
if (!this.subtask.employee_id || !this.subtask.duration) {
|
||||||
this.employeeValidations[0] = {};
|
this.employeeValidations[0] = {
|
||||||
|
employee: !this.subtask.employee_id,
|
||||||
if (!this.subtask.employee_id)
|
duration: !this.subtask.duration,
|
||||||
this.employeeValidations[0].employee = true;
|
};
|
||||||
|
}
|
||||||
if (!this.subtask.duration)
|
|
||||||
this.employeeValidations[0].duration = true;
|
|
||||||
} else {
|
} else {
|
||||||
// For new subtasks, only validate non-empty employee entries
|
// For new subtasks, require at least one employee with duration
|
||||||
|
let hasValidEmployee = false;
|
||||||
|
|
||||||
this.subtask.employees.forEach((employee, index) => {
|
this.subtask.employees.forEach((employee, index) => {
|
||||||
// Skip validation if both id and duration are empty
|
// Skip validation if both id and duration are empty
|
||||||
if (!employee.id && !employee.duration) return;
|
if (!employee.id && !employee.duration) {
|
||||||
|
// If this is the first employee and no valid employee exists yet, show validation
|
||||||
|
if (index === 0 && !hasValidEmployee) {
|
||||||
|
this.employeeValidations[index] = {
|
||||||
|
employee: true,
|
||||||
|
duration: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Only validate if either id or duration is filled
|
// Validate if either id or duration is filled
|
||||||
if (employee.id || employee.duration) {
|
if (employee.id || employee.duration) {
|
||||||
this.employeeValidations[index] = {};
|
this.employeeValidations[index] = {
|
||||||
|
employee: !employee.id,
|
||||||
|
duration: !employee.duration,
|
||||||
|
};
|
||||||
|
|
||||||
if (!employee.id) this.employeeValidations[index].employee = true;
|
// If both id and duration are present, mark as valid
|
||||||
if (!employee.duration)
|
if (employee.id && employee.duration) {
|
||||||
this.employeeValidations[index].duration = true;
|
hasValidEmployee = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -855,7 +870,7 @@ export default {
|
|||||||
subtask: {
|
subtask: {
|
||||||
handler(val) {
|
handler(val) {
|
||||||
if (this.editMode && !this.subtask?.id) {
|
if (this.editMode && !this.subtask?.id) {
|
||||||
const employees = val.employees.filter(
|
const employees = val?.employees?.filter(
|
||||||
(employee) => employee?.id || employee?.duration,
|
(employee) => employee?.id || employee?.duration,
|
||||||
) || [{}];
|
) || [{}];
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user