mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[review, add time modal]
This commit is contained in:
1 parent
90cd75349c
commit
17a044b118
19 files changed
+211
-141
No files matched your search
@@ -31,7 +31,7 @@
|
|||||||
},
|
},
|
||||||
"employee_id": 1,
|
"employee_id": 1,
|
||||||
"duration": 1000000,
|
"duration": 1000000,
|
||||||
"remaining_time": 150,
|
"spent_time": 150,
|
||||||
"is_finished": false,
|
"is_finished": false,
|
||||||
"starts_at": "2022-11-10T11:00:00+00:00",
|
"starts_at": "2022-11-10T11:00:00+00:00",
|
||||||
"ends_at": "2022-11-12T16:00:00+00:00",
|
"ends_at": "2022-11-12T16:00:00+00:00",
|
||||||
|
|||||||
@@ -29,11 +29,11 @@
|
|||||||
<v-btn class="menu-dropdown" v-bind="props">
|
<v-btn class="menu-dropdown" v-bind="props">
|
||||||
<div class="d-flex justify-between align-center">
|
<div class="d-flex justify-between align-center">
|
||||||
<p class="employee-select-avatar d-flex justify-center align-center" @click.stop="$router.push({name: 'Dashboard - User'})">
|
<p class="employee-select-avatar d-flex justify-center align-center" @click.stop="$router.push({name: 'Dashboard - User'})">
|
||||||
{{ user.user.name.charAt(0) + user.user.surname.charAt(0) }}
|
{{ user.name.charAt(0) + user.surname.charAt(0) }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<span class="employee-name ml-4">{{ `${user.user.name} ${user.user.surname}` }}</span>
|
<span class="employee-name ml-4">{{ `${user.name} ${user.surname}` }}</span>
|
||||||
<v-icon class="ml-3" icon="mdi-chevron-down" size="x-small"></v-icon>
|
<v-icon class="ml-3" icon="mdi-chevron-down" size="x-small"></v-icon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<v-list class="text-center">
|
<v-list class="text-center">
|
||||||
<v-list-item class="cursor-pointer hover-background">Working hours </v-list-item>
|
<v-list-item class="cursor-pointer hover-background" @click.stop="$router.push({name: 'Dashboard - User'})">Profil</v-list-item>
|
||||||
<v-list-item>
|
<v-list-item>
|
||||||
<v-btn class="button" @click="logOut()">Odhlásiť sa</v-btn>
|
<v-btn class="button" @click="logOut()">Odhlásiť sa</v-btn>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
import ZTeamModal from '@/plugins/tm@modal/team/z-team-modal.vue'
|
import ZTeamModal from '@/plugins/tm@modal/team/z-team-modal.vue'
|
||||||
import ZBlockerModal from '@/plugins/tm@modal/blocker/z-blocker-modal.vue'
|
import ZBlockerModal from '@/plugins/tm@modal/blocker/z-blocker-modal.vue'
|
||||||
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'
|
||||||
@@ -71,19 +72,13 @@ export default {
|
|||||||
ZSubTaskModal
|
ZSubTaskModal
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
computed: {
|
||||||
return {
|
...mapGetters('auth', ['user']),
|
||||||
user: null,
|
|
||||||
search: ''
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async created() {
|
data() {
|
||||||
// Kravarik: Toto negetuj takto ale cez ...mapGetters z auth store
|
return {
|
||||||
try {
|
search: ''
|
||||||
this.user = await this.$axios.get_auth_data('v1/auth/info')
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -94,8 +89,7 @@ export default {
|
|||||||
this.$router.push('/')
|
this.$router.push('/')
|
||||||
this.$toast.success('Boli ste odhlásený')
|
this.$toast.success('Boli ste odhlásený')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: Do toastu posielaj len error, on si to vo vnutri vyparsuje (ak ne tak to treba dokodit v toaste)
|
this.$toast.error(error)
|
||||||
this.$toast.error(error.data.error)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ export default {
|
|||||||
await this.$axios.post_data('v1/auth/forgot', this.form)
|
await this.$axios.post_data('v1/auth/forgot', this.form)
|
||||||
this.$router.push({ name: 'Reset password' })
|
this.$router.push({ name: 'Reset password' })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: Error upravit
|
this.$toast.error(error)
|
||||||
this.$toast.error(error.data.error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,7 @@ export default {
|
|||||||
await this.$axios.post_data('v1/auth/login', this.form)
|
await this.$axios.post_data('v1/auth/login', this.form)
|
||||||
this.$router.push({ name: 'Overview - Ongoing tasks'})
|
this.$router.push({ name: 'Overview - Ongoing tasks'})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: Error upravit
|
this.$toast.error(error)
|
||||||
this.$toast.error(error.data.error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ export default {
|
|||||||
await this.$axios.post_data('v1/auth/reset', this.form)
|
await this.$axios.post_data('v1/auth/reset', this.form)
|
||||||
this.$router.push({ name: 'Login' })
|
this.$router.push({ name: 'Login' })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: Error upravit
|
this.$toast.error(error)
|
||||||
this.$toast.error(error.data.error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
>
|
>
|
||||||
<template v-slot:split-label="{ split }">
|
<template v-slot:split-label="{ split }">
|
||||||
<div class="w-100 h-100 d-flex flex-column">
|
<div class="w-100 h-100 d-flex flex-column">
|
||||||
|
<h1 @click="addTimeModal()">Tu mas napojeny modal</h1>
|
||||||
<span v-if="split.date" class="d-flex align-center">
|
<span v-if="split.date" class="d-flex align-center">
|
||||||
<img v-if="getHeadingDate(split.date) == 'Dnes'" :src="require('./_img/home-icon.svg')" class="mr-2">
|
<img v-if="getHeadingDate(split.date) == 'Dnes'" :src="require('./_img/home-icon.svg')" class="mr-2">
|
||||||
<p class="weekday-label">{{ getHeadingDate(split.date) }}</p>
|
<p class="weekday-label">{{ getHeadingDate(split.date) }}</p>
|
||||||
@@ -87,6 +88,7 @@
|
|||||||
<!-- Kravarik: Prerobit modaly na novy sposob -->
|
<!-- Kravarik: Prerobit modaly na novy sposob -->
|
||||||
<Z-complete-task-modal v-if="showCompleteModal" :visible="showCompleteModal ? true : false" :task="showCompleteModal.task" @completeTask="completeTask" @close="showCompleteModal = null" />
|
<Z-complete-task-modal v-if="showCompleteModal" :visible="showCompleteModal ? true : false" :task="showCompleteModal.task" @completeTask="completeTask" @close="showCompleteModal = null" />
|
||||||
<Z-delete-task-modal v-if="showDeleteModal" :visible="showDeleteModal ? true : false" :task="showDeleteModal.task" @deleteTask="deleteTask" @close="showDeleteModal = null" />
|
<Z-delete-task-modal v-if="showDeleteModal" :visible="showDeleteModal ? true : false" :task="showDeleteModal.task" @deleteTask="deleteTask" @close="showDeleteModal = null" />
|
||||||
|
<Z-add-time-task-modal ref="z-add-time-task-modal" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -94,12 +96,15 @@
|
|||||||
import ZCompleteTaskModal from '@/plugins/tm@modal/task/z-complete-task-modal.vue'
|
import ZCompleteTaskModal from '@/plugins/tm@modal/task/z-complete-task-modal.vue'
|
||||||
import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
|
import ZDeleteTaskModal from '@/plugins/tm@modal/task/z-delete-task-modal.vue'
|
||||||
import ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-modal.vue'
|
import ZSubTaskModal from '@/plugins/tm@modal/sub-task/z-sub-task-modal.vue'
|
||||||
|
import ZAddTimeTaskModal from '@/plugins/tm@modal/sub-task/z-add-time-task-modal.vue'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ZCompleteTaskModal,
|
ZCompleteTaskModal,
|
||||||
ZDeleteTaskModal,
|
ZDeleteTaskModal,
|
||||||
ZSubTaskModal
|
ZSubTaskModal,
|
||||||
|
ZAddTimeTaskModal
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
@@ -216,6 +221,10 @@ export default {
|
|||||||
this.$refs['z-sub-task-modal'].create(subTask, editMode)
|
this.$refs['z-sub-task-modal'].create(subTask, editMode)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
addTimeModal() {
|
||||||
|
this.$refs['z-add-time-task-modal'].showModal()
|
||||||
|
},
|
||||||
|
|
||||||
deleteTask(id) {
|
deleteTask(id) {
|
||||||
this.$emit('deleteTask', id)
|
this.$emit('deleteTask', id)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,16 +15,16 @@ export default {
|
|||||||
ZMasterTaskModal
|
ZMasterTaskModal
|
||||||
},
|
},
|
||||||
|
|
||||||
// Kravarik: Prepisat propy na objektovy zapis
|
props: {
|
||||||
props: ['events', 'month'],
|
events: {
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
month: {
|
||||||
editTask(masterTask, editMode) {
|
required: true
|
||||||
this.$refs['z-master-task-modal'].create(masterTask, editMode)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Kravarik: Comuted ma byt za data hned
|
|
||||||
computed: {
|
computed: {
|
||||||
calendarOptions() {
|
calendarOptions() {
|
||||||
return {
|
return {
|
||||||
@@ -36,31 +36,34 @@ export default {
|
|||||||
firstDay: 1,
|
firstDay: 1,
|
||||||
dayHeaderClassNames: ['w-day-header'],
|
dayHeaderClassNames: ['w-day-header'],
|
||||||
events: this.events,
|
events: this.events,
|
||||||
// Kravarik: Skus toto prepisat na arrow function ako je v eventClick
|
eventContent: (eventInfo) => {
|
||||||
eventContent: function (eventInfo) {
|
|
||||||
return { html: eventInfo.event.extendedProps.title_html }
|
return { html: eventInfo.event.extendedProps.title_html }
|
||||||
},
|
},
|
||||||
eventClick: (info) => {
|
eventClick: (info) => {
|
||||||
this.editTask(info.event._def.publicId, false)
|
return this.editTask(info.event._def.publicId, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Kravarik: Toto nechat na konci
|
mounted() {
|
||||||
|
const currentYear = new Date().getFullYear()
|
||||||
|
this.calendarOptions.events = this.events
|
||||||
|
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, this.month, 1))
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
editTask(masterTask, editMode) {
|
||||||
|
this.$refs['z-master-task-modal'].create(masterTask, editMode)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
month(selectedMonth) {
|
month(selectedMonth) {
|
||||||
const currentYear = new Date().getFullYear()
|
const currentYear = new Date().getFullYear()
|
||||||
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, selectedMonth, 1))
|
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, selectedMonth, 1))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Kravarik: Posunut nad methods
|
|
||||||
mounted() {
|
|
||||||
const currentYear = new Date().getFullYear()
|
|
||||||
this.calendarOptions.events = this.events
|
|
||||||
this.$refs.fullCalendar?.getApi().gotoDate(new Date(currentYear, this.month, 1))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="sass" scoped>
|
<style lang="sass" scoped>
|
||||||
@@ -94,11 +97,16 @@ export default {
|
|||||||
background: white
|
background: white
|
||||||
a
|
a
|
||||||
background: #3700B3
|
background: #3700B3
|
||||||
width: 32px
|
width: 28px
|
||||||
height: 32px
|
|
||||||
color: white
|
color: white
|
||||||
text-align: center
|
text-align: center
|
||||||
border-radius: 50%
|
border-radius: 50%
|
||||||
border: 5px solid white
|
height: 28px
|
||||||
line-height: 15px
|
line-height: 27px
|
||||||
|
position: relative
|
||||||
|
padding: 0
|
||||||
|
margin: 0
|
||||||
|
border: none
|
||||||
|
top: 2px
|
||||||
|
right: 4px
|
||||||
</style>
|
</style>
|
||||||
@@ -17,6 +17,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
emits: ['filterChanged'],
|
||||||
|
|
||||||
|
props: ['projects', 'teams', 'employees'],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
months: [
|
months: [
|
||||||
@@ -43,12 +47,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Kravarik: Props hodit nad data
|
|
||||||
props: ['projects', 'teams', 'employees'],
|
|
||||||
|
|
||||||
// Kravarik: Emits ma byt uplne prve
|
|
||||||
emits: ['filterChanged'],
|
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
filter: {
|
filter: {
|
||||||
handler() {
|
handler() {
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- Kravarik: Dat velke A -->
|
<A-project-filter :projects="projects" @filterChanged="onFilterChanged" />
|
||||||
<a-project-filter :projects="projects" @filterChanged="onFilterChanged"></a-project-filter>
|
<A-project-calendar :events="filteredEvents" :month="filterSettings.selectedMonth" />
|
||||||
<a-project-calendar :events="filteredEvents" :month="filter.selectedMonth"></a-project-calendar>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -17,8 +16,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// Kravarik: Toto premenuj na nejaky filterSettings alebo co to je
|
filterSettings: {
|
||||||
filter: {
|
|
||||||
selectedEmployee: null,
|
selectedEmployee: null,
|
||||||
selectedMonth: new Date().getMonth(),
|
selectedMonth: new Date().getMonth(),
|
||||||
selectedProject: null,
|
selectedProject: null,
|
||||||
@@ -33,10 +31,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
// Kravarik: Toto preco nieje v trycatch?
|
try {
|
||||||
const events = await this.$axios.get_auth_data('v1/overview/projects')
|
const events = await this.$axios.get_auth_data('v1/overview/projects')
|
||||||
|
|
||||||
// Kravarik: Nemusis nahodou z map returnovat? Ci ked {} obalis to () tak nemusis potom?
|
|
||||||
this.events = events.map((item) => ({
|
this.events = events.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
title: `${item.project_code} - ${item.name}`,
|
title: `${item.project_code} - ${item.name}`,
|
||||||
@@ -49,6 +45,9 @@ export default {
|
|||||||
borderColor: item.color
|
borderColor: item.color
|
||||||
}))
|
}))
|
||||||
this.filteredEvents = this.events.filter((item) => !item.is_finished)
|
this.filteredEvents = this.events.filter((item) => !item.is_finished)
|
||||||
|
} catch (error) {
|
||||||
|
this.$toast.error(error)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// Kravarik: TODO prepojit filtrovanie na BE
|
// Kravarik: TODO prepojit filtrovanie na BE
|
||||||
|
|||||||
@@ -353,8 +353,7 @@ export default {
|
|||||||
// this.masterTask = await this.$axios.get_auth_data(`v1/master-task/${this.masterTaksId}`)
|
// this.masterTask = await this.$axios.get_auth_data(`v1/master-task/${this.masterTaksId}`)
|
||||||
// this.selectedTeam = `${this.masterTask.team.name} - ${this.masterTask.team.id}`)
|
// this.selectedTeam = `${this.masterTask.team.name} - ${this.masterTask.team.id}`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: Pridaj toast
|
this.$toast(error)
|
||||||
console.log(error)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<template>
|
||||||
|
<v-dialog v-model="show" max-width="650">
|
||||||
|
<v-card>
|
||||||
|
<div class="d-flex justify-space-between align-center">
|
||||||
|
<h1>Prosím zadajte odpracovaný čas</h1>
|
||||||
|
|
||||||
|
<v-icon
|
||||||
|
@click.stop="close()"
|
||||||
|
icon="mdi-close"
|
||||||
|
size="large"
|
||||||
|
></v-icon>
|
||||||
|
</div>
|
||||||
|
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
||||||
|
<v-text-field
|
||||||
|
class="modal-input"
|
||||||
|
label="Odpracovaný čas"
|
||||||
|
variant="solo"
|
||||||
|
type="number"
|
||||||
|
placeholder="h"
|
||||||
|
append-inner-icon="mdi-timer-outline"
|
||||||
|
></v-text-field>
|
||||||
|
</v-card-actions>
|
||||||
|
<v-btn class="z-btn mt-5">Potvrdiť</v-btn>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
emits: ['close'],
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
showModal() {
|
||||||
|
this.visible = true
|
||||||
|
},
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.visible = false
|
||||||
|
this.$emit('close', this.blocker)
|
||||||
|
this.blocker = null
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
show: {
|
||||||
|
get() {
|
||||||
|
return this.visible
|
||||||
|
},
|
||||||
|
|
||||||
|
set(value) {
|
||||||
|
if (!value) this.$emit('close')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.z-btn
|
||||||
|
height: 48px !important
|
||||||
|
|
||||||
|
h1
|
||||||
|
font-size: 34px
|
||||||
|
</style>
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
<v-col cols="7">
|
<v-col cols="7">
|
||||||
<v-sheet class="ma-2">
|
<v-sheet class="ma-2">
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="task.nieco"
|
v-model="task.spent_time"
|
||||||
class="modal-input"
|
class="modal-input"
|
||||||
variant="solo"
|
variant="solo"
|
||||||
type="number"
|
type="number"
|
||||||
@@ -264,7 +264,7 @@
|
|||||||
</v-col>
|
</v-col>
|
||||||
<v-col cols="7">
|
<v-col cols="7">
|
||||||
<v-sheet class="ma-2">
|
<v-sheet class="ma-2">
|
||||||
<p>{{ task.remaining_time }} h</p>
|
<p>{{ remaining_time }} h</p>
|
||||||
</v-sheet>
|
</v-sheet>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -345,8 +345,7 @@ export default {
|
|||||||
this.masterTasks = await this.$axios.get_auth_data('v1/master-tasks')
|
this.masterTasks = await this.$axios.get_auth_data('v1/master-tasks')
|
||||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: Pridaj toast
|
this.$toast(error)
|
||||||
console.log(error)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async create(team = null) {
|
||||||
|
if (team) {
|
||||||
|
this.team = team
|
||||||
|
await this._load()
|
||||||
|
} else {
|
||||||
|
this.team = {
|
||||||
|
name: '',
|
||||||
|
employees: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.visible = true
|
||||||
|
},
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.visible = false
|
this.visible = false
|
||||||
this.$emit('close', this.team)
|
this.$emit('close', this.team)
|
||||||
|
|||||||
@@ -33,8 +33,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
this.employees = await this.$axios.get_auth_data('v1/employees')
|
this.employees = await this.$axios.get_auth_data('v1/employees')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: Pridaj toast
|
this.$toast(error)
|
||||||
console.log(error)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<Z-tasks-search @queryChange="filterOngoingTasks" />
|
<Z-tasks-search @queryChange="onSearch" />
|
||||||
|
|
||||||
<W-loadable :content="ongoingTasks">
|
<W-loadable :content="filteredOngoingTasks" :emptyMessage="searchQuery.length ? 'Neboli nájdené žiadne úlohy' : 'Nenašli sa žiadne záznamy'">
|
||||||
<A-ongoing-table :tasks="filteredOngoingTasks" />
|
<A-ongoing-table :tasks="filteredOngoingTasks" />
|
||||||
<h6
|
|
||||||
v-if="filteredOngoingTasks && !filteredOngoingTasks.length"
|
|
||||||
class="px-4"
|
|
||||||
>
|
|
||||||
Aktuálnemu hľadaniu nevyhovujú žiadne prebiehajúce úlohy
|
|
||||||
</h6>
|
|
||||||
</W-loadable>
|
</W-loadable>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -28,30 +22,36 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
ongoingTasks: null,
|
searchQuery: '',
|
||||||
filteredOngoingTasks: []
|
ongoingTasks: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
filteredOngoingTasks() {
|
||||||
|
if (!this.ongoingTasks)
|
||||||
|
return null
|
||||||
|
|
||||||
|
if (!this.searchQuery)
|
||||||
|
return this.ongoingTasks
|
||||||
|
|
||||||
|
return this.ongoingTasks.filter((task) => {
|
||||||
|
return this.filterParams(this.searchQuery, task.title) || this.filterParams(this.searchQuery, task.project_code)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
try {
|
try {
|
||||||
this.ongoingTasks = await this.$axios.get_auth_data('v1/overview/ongoing-tasks')
|
this.ongoingTasks = await this.$axios.get_auth_data('v1/overview/ongoing-tasks')
|
||||||
this.filterOngoingTasks()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: ked to je takto ze idu data do w-loadable tak musis dat this.ongoingTasks = {error}
|
this.ongoingTasks = {error}
|
||||||
// Ten toast vyhod a to kde nastavujes error musis dat do {} ako v riadku hore lebo ono to pozera if (content.error)
|
|
||||||
this.ongoingTasks = error
|
|
||||||
this.$toast.error(error)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
// Kravarik: Toto sprav cez computed. A bude tam ze if (!searchQuerry) return this.ongoing tasks. Else to prefiltrujes
|
onSearch(searchQuery) {
|
||||||
filterOngoingTasks(searchQuery) {
|
this.searchQuery = searchQuery
|
||||||
if(!searchQuery) return this.filteredOngoingTasks = this.ongoingTasks
|
|
||||||
this.filteredOngoingTasks = this.ongoingTasks.filter((task) => {
|
|
||||||
return this.filterParams(searchQuery, task.title) || this.filterParams(searchQuery, task.project_code)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
filterParams(searchQuery, row) {
|
filterParams(searchQuery, row) {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<Z-tasks-search @queryChange="filterUnscheduledTasks" />
|
<Z-tasks-search @queryChange="onSearch" />
|
||||||
|
|
||||||
<W-loadable :content="unscheduledTasks">
|
<W-loadable :content="filteredUnscheduledTasks" :emptyMessage="searchQuery.length ? 'Neboli nájdené žiadne úlohy' : 'Nenašli sa žiadne záznamy'">
|
||||||
<A-unscheduled-table :tasks="filteredUnscheduledTasks" />
|
<A-unscheduled-table :tasks="filteredUnscheduledTasks" />
|
||||||
<h6
|
<h6
|
||||||
v-if="filteredUnscheduledTasks && !filteredUnscheduledTasks.length"
|
v-if="filteredUnscheduledTasks && !filteredUnscheduledTasks.length"
|
||||||
@@ -28,30 +28,36 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
unscheduledTasks: null,
|
searchQuery: '',
|
||||||
filteredUnscheduledTasks: []
|
unscheduledTasks: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
filteredUnscheduledTasks() {
|
||||||
|
if (!this.unscheduledTasks)
|
||||||
|
return null
|
||||||
|
|
||||||
|
if (!this.searchQuery)
|
||||||
|
return this.unscheduledTasks
|
||||||
|
|
||||||
|
return this.unscheduledTasks.filter((task) => {
|
||||||
|
return this.filterParams(this.searchQuery, task.title) || this.filterParams(this.searchQuery, task.project_code)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
try {
|
try {
|
||||||
this.unscheduledTasks = await this.$axios.get_auth_data('v1/overview/unscheduled-tasks')
|
this.unscheduledTasks = await this.$axios.get_auth_data('v1/overview/unscheduled-tasks')
|
||||||
this.filterUnscheduledTasks()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: ked to je takto ze idu data do w-loadable tak musis dat this.ongoingTasks = {error}
|
this.unscheduledTasks = {error}
|
||||||
// Ten toast vyhod a to kde nastavujes error musis dat do {} ako v riadku hore lebo ono to pozera if (content.error)
|
|
||||||
this.unscheduledTasks = error
|
|
||||||
this.$toast.error(error)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
// Kravarik: Toto sprav cez computed. A bude tam ze if (!searchQuerry) return this.unscheduled tasks. Else to prefiltrujes
|
onSearch(searchQuery) {
|
||||||
filterUnscheduledTasks(searchQuery) {
|
this.searchQuery = searchQuery
|
||||||
if(!searchQuery) return this.filteredUnscheduledTasks = this.unscheduledTasks
|
|
||||||
this.filteredUnscheduledTasks = this.unscheduledTasks.filter((task) => {
|
|
||||||
return this.filterParams(searchQuery, task.title) || this.filterParams(searchQuery, task.project_code)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
filterParams(searchQuery, row) {
|
filterParams(searchQuery, row) {
|
||||||
|
|||||||
@@ -22,10 +22,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
this.teams = await this.$axios.get_auth_data('v1/teams')
|
this.teams = await this.$axios.get_auth_data('v1/teams')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: ked to je takto ze idu data do w-loadable tak musis dat this.ongoingTasks = {error}
|
this.teams = {error}
|
||||||
// Ten toast vyhod a to kde nastavujes error musis dat do {} ako v riadku hore lebo ono to pozera if (content.error)
|
|
||||||
this.teams = {error: error.data.error}
|
|
||||||
this.$toast.error(error.data.error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,15 +84,6 @@ export default {
|
|||||||
...mapGetters('auth', ['user']),
|
...mapGetters('auth', ['user']),
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
|
||||||
// TEMP
|
|
||||||
// Kravarik: Vyhodit
|
|
||||||
this.$store.dispatch('auth/login', {
|
|
||||||
email: 'xx@asdasd.asd',
|
|
||||||
password: 'sdfsdfsdf'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
validations() {
|
validations() {
|
||||||
return {
|
return {
|
||||||
user: {
|
user: {
|
||||||
@@ -112,8 +103,7 @@ export default {
|
|||||||
|
|
||||||
this.$toast.success('Profil bol úspešne zmenený')
|
this.$toast.success('Profil bol úspešne zmenený')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Kravarik: Posli iba errror
|
this.$toast.error(error)
|
||||||
this.$toast.error(error.response.data.error)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,18 +4,13 @@ import './refreshExpired'
|
|||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
status: '',
|
token: localStorage.getItem('wzo_vue_user_token') || '',
|
||||||
_token: localStorage.getItem('wzo_vue_user_token') || '',
|
|
||||||
user: JSON.parse(localStorage.getItem('wzo_vue_user_user') || '{}'),
|
user: JSON.parse(localStorage.getItem('wzo_vue_user_user') || '{}'),
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
auth_request(state: any) {
|
|
||||||
state.status = 'loading'
|
|
||||||
},
|
|
||||||
auth_success(state: any, data: any) {
|
auth_success(state: any, data: any) {
|
||||||
state.status = 'success'
|
|
||||||
if (data.token) {
|
if (data.token) {
|
||||||
state._token = data.token
|
state.token = data.token
|
||||||
localStorage.setItem('wzo_vue_user_token', data.token)
|
localStorage.setItem('wzo_vue_user_token', data.token)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,24 +20,21 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
auth_error(state: any) {
|
auth_error(state: any) {
|
||||||
state.status = 'error'
|
state.token = ''
|
||||||
state._token = ''
|
|
||||||
localStorage.removeItem('wzo_vue_user_token')
|
localStorage.removeItem('wzo_vue_user_token')
|
||||||
localStorage.removeItem('wzo_vue_user_user')
|
localStorage.removeItem('wzo_vue_user_user')
|
||||||
},
|
},
|
||||||
logout(state: any) {
|
logout(state: any) {
|
||||||
state.status = ''
|
state.token = ''
|
||||||
state._token = ''
|
|
||||||
state.user = null
|
state.user = null
|
||||||
localStorage.removeItem('wzo_vue_user_token')
|
localStorage.removeItem('wzo_vue_user_token')
|
||||||
localStorage.removeItem('wzo_vue_user_user')
|
localStorage.removeItem('wzo_vue_user_user')
|
||||||
|
window.open(location.origin, "_self")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
login({commit}: {commit: any}, credentials: any) {
|
login({commit}: {commit: any}, credentials: any) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
commit('auth_request')
|
|
||||||
|
|
||||||
axios.post_data('v1/auth/login', credentials)
|
axios.post_data('v1/auth/login', credentials)
|
||||||
.then((response: any) => {
|
.then((response: any) => {
|
||||||
const token = response.token
|
const token = response.token
|
||||||
@@ -81,6 +73,7 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// eslint-disable-next-line
|
||||||
logout({commit}: {commit: any}) {
|
logout({commit}: {commit: any}) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
axios.post_auth_data('v1/auth/invalidate')
|
axios.post_auth_data('v1/auth/invalidate')
|
||||||
@@ -90,14 +83,16 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
forgotPassword(credentials: any) {
|
// eslint-disable-next-line
|
||||||
|
forgotPassword({commit}: {commit: any}, credentials: any) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.post_auth_data('v1/auth/forgot', credentials)
|
axios.post_auth_data('v1/auth/forgot', credentials)
|
||||||
.then(response => resolve(response))
|
.then(response => resolve(response))
|
||||||
.catch(error => reject(error))
|
.catch(error => reject(error))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
resetPassword(credentials: any) {
|
// eslint-disable-next-line
|
||||||
|
resetPassword({commit}: {commit: any}, credentials: any) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.post_auth_data('v1/auth/reset', credentials)
|
axios.post_auth_data('v1/auth/reset', credentials)
|
||||||
.then(response => resolve(response))
|
.then(response => resolve(response))
|
||||||
@@ -157,17 +152,13 @@ export default {
|
|||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
isLoggedIn: (state: any) => {
|
isLoggedIn: (state: any) => {
|
||||||
return !!state._token
|
return !!state.token
|
||||||
},
|
},
|
||||||
// authStatus: (state: any) => {
|
|
||||||
// return state.status
|
|
||||||
// },
|
|
||||||
user: (state: any) => {
|
user: (state: any) => {
|
||||||
return state.user
|
return state.user
|
||||||
|
},
|
||||||
|
token: (state: any) => {
|
||||||
|
return state.token
|
||||||
}
|
}
|
||||||
// token: (state: any) => {
|
|
||||||
// return state._token
|
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user