mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
Merge branch 'main' of bitbucket.org:studiotem/jandl-taskmanager-app
This commit is contained in:
commit
6b3402235c
3 files changed
+28
-25
No files matched your search
@@ -45,27 +45,11 @@ export default {
|
||||
if (typeof employee.duration == 'string') {
|
||||
totalDuration += parseFloat(employee.duration)
|
||||
employee.duration = parseFloat(employee.duration)
|
||||
employee.invalid = false
|
||||
}
|
||||
else if (typeof employee.duration == 'number') {
|
||||
totalDuration += employee.duration
|
||||
}
|
||||
|
||||
return employee
|
||||
})
|
||||
|
||||
if (!this.mastertask.team)
|
||||
return this.mastertask.duration = totalDuration
|
||||
|
||||
this.mastertask.team.employees = this.mastertask.team.employees.map(employee => {
|
||||
if (isNaN(employee.duration) || isNaN(parseFloat(employee.duration)))
|
||||
return employee
|
||||
|
||||
if (typeof employee.duration == 'string') {
|
||||
totalDuration += parseFloat(employee.duration)
|
||||
employee.duration = parseFloat(employee.duration)
|
||||
}
|
||||
else if (typeof employee.duration == 'number') {
|
||||
totalDuration += employee.duration
|
||||
employee.invalid = false
|
||||
}
|
||||
|
||||
return employee
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
|
||||
<v-text-field v-model="mastertask.duration" @focus="onInputFocus" class="modal-input" variant="solo" type="number" :label="`${mastertask.duration} h`" :disabled="true"></v-text-field>
|
||||
|
||||
<v-select v-model="mastertask.team_id" @focus="onInputFocus" class="modal-input border-select" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name"></v-select>
|
||||
<v-select v-model="mastertask.team_id" @focus="onInputFocus" class="modal-input border-select" :class="{error: v$.mastertask.employees.$errors.length}" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name"></v-select>
|
||||
|
||||
<template v-if="mastertask.employees">
|
||||
<v-text-field v-for="(employee, index) in mastertask.employees" :key="employee.id" @focus="onInputFocus" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="mastertask.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
|
||||
<v-text-field v-for="(employee, index) in mastertask.employees" :key="employee.id" @focus="onInputFocus" class="modal-input" :class="{error: employee.invalid}" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="mastertask.employees[index].duration" type="number" min="1" @input="onEmployeeDurationChanged">
|
||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||
{{ employee?.name.charAt(0) + employee?.surname.charAt(0) }}
|
||||
</p>
|
||||
@@ -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
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<div class="d-flex align-center flex-start width-100">
|
||||
<p class="task-badge rounded-pill">{{ timesheet.time }}</p>
|
||||
<p class="ml-5">{{ timesheet.timestamp }}</p>
|
||||
<p class="ml-5">{{ timesheet.employee_name }} ({{ moment(timesheet.timestamp).format('M.D.YYYY') }})</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -50,6 +50,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment'
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
import useVuelidate from '@vuelidate/core'
|
||||
import { required, numeric, minValue } from '@vuelidate/validators'
|
||||
@@ -69,6 +70,7 @@ export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
moment,
|
||||
v$: useVuelidate(),
|
||||
errorUtils,
|
||||
showModal: false,
|
||||
|
||||
Reference in new issue
Block a user