computed za data

This commit is contained in:
romankko2 committed 2023-01-17 17:46:26 +01:00
1 parent 8a4a919a29
commit 313de98c91
8 files changed
+71 -71

No files matched your search

@@ -72,16 +72,16 @@ export default {
ZSubTaskModal ZSubTaskModal
}, },
computed: {
...mapGetters('auth', ['user']),
},
data() { data() {
return { return {
search: '' search: ''
} }
}, },
computed: {
...mapGetters('auth', ['user']),
},
methods: { methods: {
async logOut() { async logOut() {
try { try {
@@ -5,8 +5,8 @@
</div> </div>
</template> </template>
<script> <script>
import VFullCalendar from '@fullcalendar/vue3' import VFullCalendar from '@fullcalendar/vue3'
import dayGridPlugin from '@fullcalendar/daygrid' import dayGridPlugin from '@fullcalendar/daygrid'
import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue' import ZMasterTaskModal from '@/plugins/tm@modal/master-task/z-master-task-modal.vue'
export default { export default {
@@ -7,7 +7,7 @@
<script> <script>
import AProjectCalendar from './_components/a-project-calendar.vue' import AProjectCalendar from './_components/a-project-calendar.vue'
import AProjectFilter from './_components/a-project-filter.vue' import AProjectFilter from './_components/a-project-filter.vue'
export default { export default {
components: { components: {
@@ -15,7 +15,7 @@
<v-text-field <v-text-field
@focus="onInputFocus" @focus="onInputFocus"
class="modal-input" class="modal-input"
label="Názov blocker" label="Názov blockeru"
:class="{ error: v$.blocker.name.$errors.length }" :class="{ error: v$.blocker.name.$errors.length }"
:hint=" :hint="
v$.blocker.name.$errors v$.blocker.name.$errors
@@ -100,6 +100,24 @@ export default {
} }
}, },
computed: {
employeesOptions() {
const selectedEmployeesIds = this.blocker.employees.map(
(employee) => employee.id
)
const employees = this.allEmployees.filter(
(employee) => !selectedEmployeesIds.includes(employee.id)
)
return employees.map((employee) => {
return {
key: employee.id,
value: `${employee.name} ${employee.surname}`,
}
})
}
},
validations() { validations() {
return { return {
blocker: { blocker: {
@@ -210,24 +228,6 @@ export default {
return employee return employee
}) })
} }
},
computed: {
employeesOptions() {
const selectedEmployeesIds = this.blocker.employees.map(
(employee) => employee.id
)
const employees = this.allEmployees.filter(
(employee) => !selectedEmployeesIds.includes(employee.id)
)
return employees.map((employee) => {
return {
key: employee.id,
value: `${employee.name} ${employee.surname}`,
}
})
}
} }
} }
</script> </script>
@@ -35,18 +35,6 @@ export default {
} }
}, },
methods: {
showModal() {
this.visible = true
},
close() {
this.visible = false
this.$emit('close', this.blocker)
this.blocker = null
},
},
computed: { computed: {
show: { show: {
get() { get() {
@@ -57,6 +45,18 @@ export default {
if (!value) this.$emit('close') if (!value) this.$emit('close')
} }
}, },
},
methods: {
showModal() {
this.visible = true
},
close() {
this.visible = false
this.$emit('close', this.blocker)
this.blocker = null
},
} }
} }
</script> </script>
@@ -34,6 +34,18 @@ export default {
} }
}, },
computed: {
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
},
methods: { methods: {
async complete() { async complete() {
try { try {
@@ -49,18 +61,6 @@ export default {
this.$toast.error(error) this.$toast.error(error)
} }
} }
},
computed: {
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
} }
} }
</script> </script>
@@ -33,17 +33,6 @@ export default {
} }
}, },
methods: {
async deleteTeam() {
try {
await this.$axios.delete(`v1/teams/${this.team.id}`)
this.show = false
} catch (error) {
this.$toast.error(error)
}
}
},
computed: { computed: {
show: { show: {
get() { get() {
@@ -54,6 +43,17 @@ export default {
if (!value) this.$emit('close') if (!value) this.$emit('close')
} }
}, },
},
methods: {
async deleteTeam() {
try {
await this.$axios.delete(`v1/teams/${this.team.id}`)
this.show = false
} catch (error) {
this.$toast.error(error)
}
}
} }
} }
</script> </script>
@@ -29,6 +29,16 @@ export default {
} }
}, },
computed: {
allEmployees() {
const employees = this.employees.map((employee) => {
return `${employee.name} ${employee.surname}`
})
return employees
}
},
async created() { async created() {
try { try {
this.employees = await this.$axios.get_auth_data('v1/employees') this.employees = await this.$axios.get_auth_data('v1/employees')
@@ -41,16 +51,6 @@ export default {
onInput() { onInput() {
this.$emit('queryChange', this.searchQuery) this.$emit('queryChange', this.searchQuery)
} }
},
computed: {
allEmployees() {
const employees = this.employees.map((employee) => {
return `${employee.name} ${employee.surname}`
})
return employees
}
} }
} }
</script> </script>