mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
Merge branch 'main' of https://bitbucket.org/studiotem/jandl-taskmanager-app
This commit is contained in:
commit
263dd868d9
10 files changed
+147
-83
No files matched your search
@@ -8,9 +8,21 @@
|
||||
</div>
|
||||
</v-sheet>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="7">
|
||||
<v-sheet class="py-3 d-flex flex-wrap flex-column">
|
||||
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ team?.name || 'Nepriradený' }}</p>
|
||||
<template v-if="team">
|
||||
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">{{ team.name }}</p>
|
||||
<div class="d-flex align-center flex-shrink-0 mt-2 task-badge px-4 py-2 rounded-pill" v-for="employee in enrichedTeamEmployees" :key="employee.id">
|
||||
<p class="employee-selected-avatar d-flex justify-center align-center">
|
||||
{{ employee._initials }}
|
||||
</p>
|
||||
<p class="ml-2">{{ employee._fullName }}</p>
|
||||
</div>
|
||||
<div class="mb-4"></div>
|
||||
</template>
|
||||
|
||||
<p class="task-badge px-4 py-2 rounded-pill flex-shrink-0">Nepriradený</p>
|
||||
<div class="d-flex align-center flex-shrink-0 mt-2 task-badge px-4 py-2 rounded-pill" v-for="employee in enrichedEmployees" :key="employee.id">
|
||||
<p class="employee-selected-avatar d-flex justify-center align-center">
|
||||
{{ employee._initials }}
|
||||
@@ -40,6 +52,12 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
enrichedTeamEmployees() {
|
||||
if (!this.team?.employees)
|
||||
return []
|
||||
|
||||
return tmUtils.enrichEmployees(this.team.employees)
|
||||
},
|
||||
enrichedEmployees() {
|
||||
return tmUtils.enrichEmployees(this.employees)
|
||||
}
|
||||
|
||||
@@ -8,24 +8,25 @@
|
||||
</div>
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field @focus="onInputFocus" class="modal-input" label="Názov blockeru" :class="{ error: v$.blocker.name.$errors.length }" :hint="v$.blocker.name.$errors ? errorUtils.parseErrors(v$.blocker.name.$errors) : null" v-model="blocker.name" variant="solo"></v-text-field>
|
||||
|
||||
<v-autocomplete
|
||||
clearable
|
||||
label="Vyhľadať zamestnanca"
|
||||
:items="[...enrichedEmployees]"
|
||||
item-title="_fullName"
|
||||
item-value="id"
|
||||
variant="solo"
|
||||
class="modal-input"
|
||||
<v-text-field @focus="onInputFocus" class="modal-input" label="Názov blockeru"
|
||||
:class="{ error: v$.blocker.name.$errors.length }"
|
||||
:hint="v$.blocker.name.$errors ? errorUtils.parseErrors(v$.blocker.name.$errors) : null"
|
||||
v-model="blocker.name" variant="solo"></v-text-field>
|
||||
|
||||
v-model="blocker.employee_id"
|
||||
/>
|
||||
<v-autocomplete :custom-filter="customFilter" :match-any="true" clearable label="Vyhľadať zamestnanca"
|
||||
:items="[...enrichedEmployees]" item-title="_fullName" item-value="id" variant="solo"
|
||||
class="modal-input" v-model="blocker.employee_id" />
|
||||
<!-- <Z-autocomplete label="Vyhľadať zamestnanca" :value="blocker?.employee ? `${blocker?.employee?.name} ${blocker?.employee?.surname}` : ''" :options="enrichedEmployees.map(employee => ({key: employee.id, value: employee._fullName}))" :clear-on-submit="false" :class="{ error: v$.blocker.employee.$errors.length }" class="modal-input" @option-selected="onEmployeeSelected" /> -->
|
||||
<Datepicker class="modal-input mb-5" v-model="datepicker" format="dd.MM.yyyy" locale="sk" :class="{ error: v$.datepicker.$errors?.length }" :validations="v$.datepicker" select-text="Vybrať" cancel-text="Zrušiť" placeholder="Dátum" :enable-time-picker="false" ref="datepicker" />
|
||||
<Datepicker class="modal-input mb-5" v-model="datepicker" format="dd.MM.yyyy" locale="sk"
|
||||
:class="{ error: v$.datepicker.$errors?.length }" :validations="v$.datepicker" select-text="Vybrať"
|
||||
cancel-text="Zrušiť" placeholder="Dátum" :enable-time-picker="false" ref="datepicker" />
|
||||
|
||||
<v-text-field v-model="starts_at_time" type="time" variant="solo" bg-color="white" :hint="v$.starts_at_time.$errors ? errorUtils.parseErrors(v$.starts_at_time.$errors) : null" :class="{ error: v$.starts_at_time.$errors.length }" class="mb-1 modal-input" label="Začiatok" />
|
||||
<v-text-field v-model="ends_at_time" type="time" variant="solo" bg-color="white" :hint="v$.ends_at_time.$errors ? errorUtils.parseErrors(v$.ends_at_time.$errors) : null" :class="{ error: v$.ends_at_time.$errors.length }" class="modal-input" label="Koniec" />
|
||||
<v-text-field v-model="starts_at_time" type="time" variant="solo" bg-color="white"
|
||||
:hint="v$.starts_at_time.$errors ? errorUtils.parseErrors(v$.starts_at_time.$errors) : null"
|
||||
:class="{ error: v$.starts_at_time.$errors.length }" class="mb-1 modal-input" label="Začiatok" />
|
||||
<v-text-field v-model="ends_at_time" type="time" variant="solo" bg-color="white"
|
||||
:hint="v$.ends_at_time.$errors ? errorUtils.parseErrors(v$.ends_at_time.$errors) : null"
|
||||
:class="{ error: v$.ends_at_time.$errors.length }" class="modal-input" label="Koniec" />
|
||||
</v-card-actions>
|
||||
|
||||
<v-btn class="button primary" @click="save()">{{ blocker.id ? "UPRAVIŤ" : "VYTVORIŤ" }}</v-btn>
|
||||
@@ -35,17 +36,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Datepicker from "@vuepic/vue-datepicker"
|
||||
import useVuelidate from "@vuelidate/core"
|
||||
import { required } from "@vuelidate/validators"
|
||||
import errorUtils from "@/plugins/lib@auth/_utils/error.utils"
|
||||
import Datepicker from "@vuepic/vue-datepicker"
|
||||
import useVuelidate from "@vuelidate/core"
|
||||
import { required } from "@vuelidate/validators"
|
||||
import errorUtils from "@/plugins/lib@auth/_utils/error.utils"
|
||||
import VuetifyFixFocusMixin from "@/plugins/tm@modal/_mixins/vuetify-fix-focus"
|
||||
import { mapGetters } from "vuex"
|
||||
import moment from "moment"
|
||||
// import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
|
||||
import { mapGetters } from "vuex"
|
||||
import moment from "moment"
|
||||
import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin'
|
||||
|
||||
export default {
|
||||
mixins: [VuetifyFixFocusMixin],
|
||||
mixins: [VuetifyFixFocusMixin, AutocompleteMixin],
|
||||
|
||||
emits: ["close"],
|
||||
|
||||
|
||||
@@ -53,6 +53,24 @@ export default {
|
||||
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
|
||||
}
|
||||
|
||||
return employee
|
||||
})
|
||||
|
||||
this.mastertask.duration = totalDuration
|
||||
}
|
||||
},
|
||||
@@ -62,7 +80,7 @@ export default {
|
||||
if (!value) return
|
||||
|
||||
this.mastertask.team = this.teams.find(team => team.id == value)
|
||||
this.mastertask.employees = this.mastertask.team.employees
|
||||
// this.mastertask.employees = this.mastertask.team.employees
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
</div>
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-autocomplete v-model="mastertask.project_id" :label="$t('Project code')" :class="{error: v$.mastertask.project_id.$errors.length}" :items="projectsOptions" item-title="code" item-value="id" variant="solo" class="modal-input" clearable @update:search="projectCodeSearch = $event" />
|
||||
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="mastertask.project_id" :label="$t('Project code')" :class="{error: v$.mastertask.project_id.$errors.length}" :items="projectsOptions" item-title="code" item-value="id" variant="solo" class="modal-input" clearable @update:search="projectCodeSearch = $event" />
|
||||
|
||||
<v-text-field v-model="mastertask.name" @focus="onInputFocus" class="modal-input" label="Názov mastertasku" variant="solo" :class="{ error: v$.mastertask.name.$errors.length }" :hint="v$.mastertask.name.$errors ? errorUtils.parseErrors(v$.mastertask.name.$errors) : null"></v-text-field>
|
||||
|
||||
@@ -21,28 +21,31 @@
|
||||
:class="{ error: v$.mastertask._deadline_time.$errors.length }" :hint="v$.mastertask._deadline_time.$errors ? errorUtils.parseErrors(v$.mastertask._deadline_time.$errors) : null" />
|
||||
</div>
|
||||
|
||||
<v-text-field v-model="mastertask.duration" @focus="onInputFocus" class="modal-input" variant="solo" type="number" :label="`${mastertask.duration} h`"></v-text-field>
|
||||
<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" :class="{ error: v$.mastertask.employees.$errors.length }" 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" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name"></v-select>
|
||||
|
||||
<template v-if="!mastertask.id && mastertask.team_id">
|
||||
<template v-if="mastertask.team && mastertask.team_id">
|
||||
<v-text-field v-for="(employee, index) in mastertask.team.employees" :key="employee.id" @focus="onInputFocus" class="modal-input" :label="`${employee.name} ${employee.surname}`" variant="solo" placeholder="h" v-model="mastertask.team.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>
|
||||
|
||||
<v-icon @click.stop="removeEmployeeFromTeam(employee)" class="remove-input" icon="mdi-close" size="small"></v-icon>
|
||||
</v-text-field>
|
||||
</template>
|
||||
|
||||
<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">
|
||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||
{{ employee?.name.charAt(0) + employee?.surname.charAt(0) }}
|
||||
</p>
|
||||
<v-icon @click.stop="removeMemberAlert(employee)" class="remove-input" icon="mdi-close" size="small"></v-icon>
|
||||
</v-text-field>
|
||||
</template>
|
||||
<template v-if="!mastertask.id && !mastertask.team_id && 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">
|
||||
<p class="employee-select-avatar d-flex justify-center align-center">
|
||||
{{ employee?.name.charAt(0) + employee?.surname.charAt(0) }}
|
||||
</p>
|
||||
<!-- <v-icon @click.stop="removeMemberAlert(employee)" class="remove-input" icon="mdi-close" size="small"></v-icon> -->
|
||||
|
||||
<v-icon @click.stop="removeEmployee(employee)" class="remove-input" icon="mdi-close" size="small"></v-icon>
|
||||
</v-text-field>
|
||||
</template>
|
||||
|
||||
<v-autocomplete v-if="showAddEmployeeInput" :label="$t('Search for employee')" :class="{error: v$.mastertask.project_id.$errors.length}" :items="employeesOptions" item-title="_fullName" item-value="id" variant="solo" class="modal-input" clearable @update:model-value="onEmployeeSelected" />
|
||||
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-if="showAddEmployeeInput" :label="$t('Search for employee')" :class="{error: v$.mastertask.project_id.$errors.length}" :items="employeesOptions" item-title="_fullName" item-value="id" variant="solo" class="modal-input" clearable @update:model-value="onEmployeeSelected" />
|
||||
|
||||
<!-- <Z-autocomplete label="Vyhľadať zamestnanca" :options="employeesOptions" class="modal-input" @option-selected="onEmployeeSelected" /> -->
|
||||
|
||||
@@ -109,6 +112,7 @@ import SelectsMixin from './_mixins/selects.mixin'
|
||||
import ATasksTable from './_components/a-tasks-table.vue'
|
||||
import AMastertaskDescription from './_components/a-mastertask-description.vue'
|
||||
import { mapGetters } from 'vuex'
|
||||
import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin'
|
||||
|
||||
export default {
|
||||
// MIXINS
|
||||
@@ -117,7 +121,7 @@ export default {
|
||||
// watch: mastertask.team_id
|
||||
|
||||
emits: ['master-task-edited', 'close'],
|
||||
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
||||
mixins: [VuetifyFixFocusMixin, SelectsMixin, AutocompleteMixin],
|
||||
|
||||
components: {
|
||||
AMastertaskDescription,
|
||||
@@ -170,7 +174,6 @@ export default {
|
||||
return {
|
||||
mastertask: {
|
||||
project_id: { required },
|
||||
employees: { required },
|
||||
name: { required },
|
||||
description: { required },
|
||||
deadline: { required },
|
||||
@@ -215,6 +218,17 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
removeEmployeeFromTeam({ id }) {
|
||||
const employees = this.mastertask.team.employees.filter(employee => employee.id != id)
|
||||
this.mastertask.employees = [...employees, ...this.mastertask.employees]
|
||||
this.mastertask.team_id = null
|
||||
this.mastertask.team = null
|
||||
},
|
||||
|
||||
removeEmployee({ id }) {
|
||||
this.mastertask.employees = this.mastertask.employees.filter(employee => employee.id != id)
|
||||
},
|
||||
|
||||
removeMemberAlert(member) {
|
||||
const team = this.mastertask.team
|
||||
this.$events.emit('show-delete-team-member-modal', { member, team })
|
||||
@@ -244,7 +258,7 @@ export default {
|
||||
|
||||
this.editMode = editMode || !this.mastertask.id
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
this.$toast.error(error.message || error)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -254,6 +268,7 @@ export default {
|
||||
},
|
||||
|
||||
async save() {
|
||||
console.log(this.mastertask)
|
||||
if (!(await this.v$.$validate())) return
|
||||
|
||||
if (this.$refs['description'])
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field v-model="subtask.project_code" label="Kód projektu" :value="subtask.project_code" @focus="onInputFocus" class="modal-input" variant="solo" disabled></v-text-field>
|
||||
|
||||
<v-autocomplete v-model="subtask.master_task_id" label="Master task" :class="{error: v$.subtask.master_task_id.$errors.length}" :items="mastertasks" item-title="name" item-value="id" variant="solo" class="modal-input" clearable />
|
||||
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="subtask.master_task_id" label="Master task" :class="{error: v$.subtask.master_task_id.$errors.length}" :items="mastertasks" item-title="name" item-value="id" variant="solo" class="modal-input" clearable />
|
||||
|
||||
<v-text-field v-model="subtask.title" @focus="onInputFocus" class="modal-input" label="Názov subtasku" variant="solo"></v-text-field>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</div> -->
|
||||
|
||||
<template v-if="subtask.id">
|
||||
<v-autocomplete v-model="subtask.employee_id" label="Priradený" :items="enrichedEmployees" item-title="_fullName" item-value="id" variant="solo" class="modal-input" :class="{ error: employeeValidations[0]?.employee }"
|
||||
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="subtask.employee_id" label="Priradený" :items="enrichedEmployees" item-title="_fullName" item-value="id" variant="solo" class="modal-input" :class="{ error: employeeValidations[0]?.employee }"
|
||||
@update:model-value="employeeValidations[0] ? employeeValidations[0].employee = false : null" />
|
||||
<v-text-field v-model="subtask.duration" class="modal-input" variant="solo" type="number" label="Časový odhad" :class="{ error: employeeValidations[0]?.duration }" append-inner-icon="mdi-clock-outline" @focus="onInputFocus"
|
||||
@update:model-value="employeeValidations[0] ? employeeValidations[0].duration = false : null" />
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
<template v-else>
|
||||
<div v-for="(employee, index) in subtask.employees" :key="`employee-${index}`" class="splitted-inputs">
|
||||
<v-autocomplete v-model="employee.id" label="Priradený" :items="enrichedEmployees" item-title="_fullName" item-value="id" variant="solo" class="modal-input left" :class="{ error: employeeValidations[index]?.employee }"
|
||||
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="employee.id" label="Priradený" :items="enrichedEmployees" item-title="_fullName" item-value="id" variant="solo" class="modal-input left" :class="{ error: employeeValidations[index]?.employee }"
|
||||
@update:model-value="employeeValidations[index] ? employeeValidations[index].employee = false : null" />
|
||||
<v-text-field v-model="employee.duration" class="modal-input right" variant="solo" type="number" label="Časový odhad" append-inner-icon="mdi-clock-outline" :class="{ error: employeeValidations[index]?.duration }" @focus="onInputFocus"
|
||||
@update:model-value="employeeValidations[index] ? employeeValidations[index].duration = false : null" />
|
||||
@@ -115,13 +115,14 @@ import * as FileSaver from "file-saver"
|
||||
import tmUtils from "@/plugins/tm@_utils/tm.utils"
|
||||
import moment from 'moment'
|
||||
import "@vueup/vue-quill/dist/vue-quill.snow.css"
|
||||
import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin'
|
||||
|
||||
import ZTaskReadonlyInfo from "./_components/z-task-readonly-info.vue"
|
||||
import { mapGetters } from "vuex"
|
||||
|
||||
export default {
|
||||
emits: ["close", "refresh"],
|
||||
mixins: [VuetifyFixFocusMixin, SelectsMixin],
|
||||
mixins: [VuetifyFixFocusMixin, SelectsMixin, AutocompleteMixin],
|
||||
|
||||
components: {
|
||||
ZTaskReadonlyInfo,
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
size="small"></v-icon>
|
||||
</div>
|
||||
|
||||
<v-autocomplete v-model="employeeSelect" label="Priradený"
|
||||
<v-autocomplete :custom-filter="customFilter" :match-any="true" v-model="employeeSelect" label="Priradený"
|
||||
:class="{ error: v$.team.employees.$errors.length }" :items="employeesOptions"
|
||||
item-title="_fullName" item-value="id" variant="solo" class="modal-input" clearable
|
||||
ref="autocomplete" />
|
||||
@@ -42,10 +42,12 @@ import { required } from '@vuelidate/validators'
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
import { mapGetters } from 'vuex'
|
||||
import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin'
|
||||
|
||||
const atLeastOne = (value) => value.length
|
||||
|
||||
export default {
|
||||
mixins: [AutocompleteMixin],
|
||||
emits: ['close', 'update'],
|
||||
|
||||
data() {
|
||||
|
||||
Reference in new issue
Block a user