{{ employee?.name.charAt(0) + employee?.surname.charAt(0) }}
@@ -88,7 +88,7 @@ import Datepicker from '@vuepic/vue-datepicker' import ZFilesUpload from '@/plugins/tm@_components/z-files-upload.vue' import useVuelidate from '@vuelidate/core' -import { required } from '@vuelidate/validators' +import { required, minLength } from '@vuelidate/validators' import errorUtils from '@/plugins/lib@auth/_utils/error.utils' // import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue' import VuetifyFixFocusMixin from '@/plugins/tm@modal/_mixins/vuetify-fix-focus' @@ -163,6 +163,7 @@ export default { validations() { return { mastertask: { + employees: { required, minLength: minLength(1), $each: {duration: { required}} }, project_id: { required }, name: { required }, description: { required }, @@ -209,7 +210,7 @@ export default { methods: { removeEmployee({ id }) { - const isEmployeeInTeam = this.mastertask.team.employees.find(employee => employee.id == id) + const isEmployeeInTeam = this.mastertask.team?.employees.find(employee => employee.id == id) if (isEmployeeInTeam) { this.mastertask.team_id = null @@ -258,8 +259,9 @@ export default { }, async save() { - console.log(this.mastertask) - if (!(await this.v$.$validate())) return + const vuelidateValid = await this.v$.$validate() + const employeesValid = await this._validateEmployees() + if (!vuelidateValid || !employeesValid) return if (this.$refs['description']) this.mastertask.description = this.$refs['description'].getHTML() @@ -302,6 +304,21 @@ export default { date.setMinutes(parseInt(timeParts[1])); this.mastertask.deadline = date + }, + + _validateEmployees() { + let isValid = true + + this.mastertask.employees = this.mastertask.employees.map(employee => { + if (!employee.duration) { + employee.invalid = true + isValid = false + } + + return employee + }) + + return isValid } }, diff --git a/app/src/plugins/tm@modal/task/_components/_components/a-task-spent-time.vue b/app/src/plugins/tm@modal/task/_components/_components/a-task-spent-time.vue index e354127..c69de3a 100644 --- a/app/src/plugins/tm@modal/task/_components/_components/a-task-spent-time.vue +++ b/app/src/plugins/tm@modal/task/_components/_components/a-task-spent-time.vue @@ -26,7 +26,7 @@{{ timesheet.time }}
-{{ timesheet.timestamp }}
+{{ timesheet.employee_name }} ({{ moment(timesheet.timestamp).format('M.D.YYYY') }})