[tm@store] Added store

This commit is contained in:
Matej Glasnák committed 2023-02-15 15:56:24 +01:00
1 parent a1a410c54d
commit 774ca7b607
44 files changed
+989 -720

No files matched your search

@@ -1,5 +1,5 @@
<template>
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
<v-dialog v-model="visible" max-width="750" max-height="90%" height="700px">
<W-loadable :content="masterTask" class="h-100">
<v-card v-if="editMode" height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center modal-header">
@@ -18,17 +18,13 @@
<v-select v-model="this.masterTask.team_id" @focus="onInputFocus" class="modal-input border-select" :class="{ error: v$.masterTask.team_id.$errors.length }" label="Tím" variant="solo" :items="teams" item-value="id" item-title="name"></v-select>
<v-text-field v-for="(employee, index) in masterTask.employees" :key="employee.id" @focus="onInputFocus" :class="{ error: !masterTask.employees[index].duration }" 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-text-field>
<!-- <v-text-field v-for="(employee, index) in masterTask.team?.employees" :key="employee.id" @focus="onInputFocus" :class="{ error: !masterTask.team.employees[index].duration }" 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-text-field> -->
<template v-if="!masterTask.id">
<v-text-field v-for="(employee, index) in masterTask.employees" :key="employee.id" @focus="onInputFocus" :class="{ error: !masterTask.employees[index].duration }" 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-text-field>
</template>
<Z-autocomplete label="Vyhľadať zamestnanca" v-if="showAddEmployeeInput" :options="employeesOptions" class="modal-input" @option-selected="onEmployeeSelected" />
@@ -59,7 +55,8 @@
<v-card-actions class="d-flex flex-column modal-content">
<div class="w-100">
<A-task-description :master-task="masterTask" />
<A-mastertask-description :master-task="masterTask" />
<div class="d-flex justify-start align-center mt-8">
<v-btn class="button primary" @click="save()">Ukončiť mastertask</v-btn>
</div>
@@ -92,7 +89,7 @@ import '@vueup/vue-quill/dist/vue-quill.snow.css'
import SelectsMixin from './_mixins/selects.mixin'
import ATasksTable from './_components/a-tasks-table.vue'
import ATaskDescription from './_components/a-task-description.vue'
import AMastertaskDescription from './_components/a-mastertask-description.vue'
export default {
// MIXINS
@@ -104,7 +101,7 @@ export default {
mixins: [VuetifyFixFocusMixin, SelectsMixin],
components: {
ATaskDescription,
AMastertaskDescription,
ATasksTable,
Datepicker,
ZFilesUpload,
@@ -149,7 +146,7 @@ export default {
})
this.$events.on('on-task-edited', (task) => {
if (!this.masterTask.subtasks) return
if (!this.masterTask?.subtasks) return
if (this.masterTask.subtasks.find(subtask => subtask.id == task.id)) {
this.masterTask.subtasks = this.masterTask.subtasks.map(t => t.id == task.id ? task : t)
@@ -172,10 +169,10 @@ export default {
this.masterTask = null
try {
this.teams = await this.$axios.get_auth_data('v1/teams')
this.projects = await this.$axios.get_auth_data('v1/projects')
const employees = await this.$axios.get_auth_data('v1/employees')
this.employees = tmUtils.enrichEmployeesByFullName(employees)
this.teams = await this.$axios.get_auth_data('v1/teams')
this.projects = await this.$axios.get_auth_data('v1/projects')
const employees = await this.$axios.get_auth_data('v1/employees')
this.employees = tmUtils.enrichEmployeesByFullName(employees)
if (masterTask?.id) {
this.masterTask = await this.$axios.get_auth_data(`v1/mastertasks/${masterTask.id}`)
@@ -185,16 +182,6 @@ export default {
this.masterTask.team_id = this.masterTask.team.id
this.masterTask.project_id = project.id
this.masterTask.project_code = project.code
// TODO refactor
this.masterTask.employees = this.masterTask.employees.map(employee => {
const subtask = this.masterTask?.subtasks.find(subtask => subtask.employee_id == employee.id)
employee.duration = subtask.duration
return employee
})
console.log(this.masterTask.employees)
} else {
this.masterTask = { employees: [], duration: 0 }
}