uprava modalov, [ongoing, unscheduled tasks] filter

This commit is contained in:
romankko2 committed 2022-12-26 13:04:54 +01:00
1 parent 278bdeabc7
commit 67afa56736
16 files changed
+647 -353

No files matched your search

@@ -1,11 +1,11 @@
<template>
<v-dialog v-model="show" max-width="650" max-height="90%" height="700px">
<W-loadable :content="allEmployees" class="h-100">
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
<W-loadable :content="blocker && allEmployees" class="h-100">
<v-card height="100%" class="d-flex flex-column">
<div class="d-flex justify-space-between align-center modal-header">
<h1>{{ blocker.id ? 'Upraviť' : 'Vytvoriť'}} blocker</h1>
<v-icon
@click.stop="show = false"
@click.stop="close()"
icon="mdi-close"
size="large"
></v-icon>
@@ -83,34 +83,20 @@ import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
const atLeastOne = (value) => value.length
export default {
emits: ['close'],
components: {
ZAutocomplete,
Datepicker,
},
props: {
visible: {
type: Boolean,
required: true
},
blockerId: {
type: Number || null,
required: false,
default: null
}
},
data() {
return {
visible: false,
allEmployees: null,
v$: useVuelidate(),
errorUtils,
blocker: {
name: '',
date: null,
employees: []
}
blocker: null
}
},
@@ -125,9 +111,6 @@ export default {
},
async created() {
if (this.blockerId)
await this._load()
try {
const allEmployees = await this.$axios.get_auth_data('v1/employees')
this.allEmployees = this._enrichEmployeesByFullName(allEmployees)
@@ -137,13 +120,29 @@ export default {
},
methods: {
async create(blocker = null) {
if (blocker) {
this.blocker = blocker
await this._load()
} else {
this.blocker = {
name: '',
date: null,
employees: []
}
}
this.visible = true
},
employeeSelected(selectedOption) {
const employee = this.allEmployees.find((empl) => empl.id == selectedOption.key)
this.blocker.employees.push(employee)
},
async save() {
if (!(await this.v$.$validate())) return console.log(this.v$)
if (!(await this.v$.$validate()))
return
try {
if (this.blocker.id)
@@ -151,13 +150,19 @@ export default {
else
await this._create()
this.close()
this.$router.push({ name: 'Dashboard - Tasks' })
this.show = false
} catch (error) {
console.log(error)
}
},
close() {
this.visible = false
this.$emit('close', this.blocker)
this.blocker = null
},
async _create() {
try {
await this.$axios.post_auth('v1/blockers', this.blocker)
@@ -176,7 +181,7 @@ export default {
async _load() {
try {
const blocker = await this.$axios.get_auth_data(`v1/blockers/${this.blockerId}`)
const blocker = await this.$axios.get_auth_data(`v1/blockers/${this.blocker.id}`)
blocker.employees = this._enrichEmployeesByFullName(blocker.employees)
this.blocker = blocker
@@ -222,17 +227,7 @@ export default {
value: `${employee.name} ${employee.surname}`,
}
})
},
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
}
}
}
</script>
@@ -1,120 +1,122 @@
<template>
<v-dialog v-model="show" max-width="650" max-height="90%" height="700px">
<v-card height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center modal-header">
<h1>Vytvoriť master task</h1>
<v-icon
@click.stop="show = false"
icon="mdi-close"
size="large"
></v-icon>
</div>
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
<W-loadable :content="masterTask" class="h-100">
<v-card height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center modal-header">
<h1>Vytvoriť master task</h1>
<v-icon
@click.stop="close()"
icon="mdi-close"
size="large"
></v-icon>
</div>
<v-card-actions class="d-flex flex-column modal-content">
<v-text-field
v-model="masterTask.project_code"
@focus="onInputFocus"
class="modal-input"
label="Kód projektu"
variant="solo"
:class="{ error: v$.masterTask.project_code.$errors.length }"
:hint="
v$.masterTask.project_code.$errors
? errorUtils.parseErrors(v$.masterTask.project_code.$errors)
: null
"
></v-text-field>
<v-card-actions class="d-flex flex-column modal-content">
<v-text-field
v-model="masterTask.project_code"
@focus="onInputFocus"
class="modal-input"
label="Kód projektu"
variant="solo"
:class="{ error: v$.masterTask.project_code.$errors.length }"
:hint="
v$.masterTask.project_code.$errors
? errorUtils.parseErrors(v$.masterTask.project_code.$errors)
: null
"
></v-text-field>
<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>
<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>
<Datepicker
v-model="masterTask.deadline"
@focus="onDateFocus"
class="modal-input"
format="dd.MM.yyyy, HH:mm"
locale="sk"
:class="{ error: v$.masterTask.deadline.$errors.length }"
select-text="Vybrať"
cancel-text="Zrušiť"
placeholder="Deadline"
/>
<Datepicker
v-model="masterTask.deadline"
@focus="onDateFocus"
class="modal-input"
format="dd.MM.yyyy, HH:mm"
locale="sk"
:class="{ error: v$.masterTask.deadline.$errors.length }"
select-text="Vybrať"
cancel-text="Zrušiť"
placeholder="Deadline"
/>
<v-text-field
v-model="masterTask.duration"
@focus="onInputFocus"
class="modal-input mt-5"
variant="solo"
type="number"
:value="totalHours"
disabled
:label="totalHours + ' h'"
></v-text-field>
<v-text-field
v-model="masterTask.duration"
@focus="onInputFocus"
class="modal-input mt-5"
variant="solo"
type="number"
:value="totalHours"
disabled
:label="totalHours + ' h'"
></v-text-field>
<v-select
v-model="selectedTeam"
@focus="onInputFocus"
class="modal-input border-select"
label="Tím"
variant="solo"
:items="teamsOptions"
></v-select>
<v-select
v-model="selectedTeam"
@focus="onInputFocus"
class="modal-input border-select"
label="Tím"
variant="solo"
:items="teamsOptions"
></v-select>
<v-text-field
v-for="(employee, index) in masterTask.employees"
:key="employee.id"
@focus="onInputFocus"
:class="{ error: masterTask.employees[index].hours < 0 }"
class="modal-input"
:label="`${employee.name} ${employee.surname}`"
variant="solo"
placeholder="h"
v-model="masterTask.employees[index].hours"
type="number"
min="1"
>
<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.employees"
:key="employee.id"
@focus="onInputFocus"
:class="{ error: masterTask.employees[index].hours < 0 }"
class="modal-input"
:label="`${employee.name} ${employee.surname}`"
variant="solo"
placeholder="h"
v-model="masterTask.employees[index].hours"
type="number"
min="1"
>
<p class="employee-select-avatar d-flex justify-center align-center">
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
</p>
</v-text-field>
<Z-autocomplete
v-if="showAddEmployeeInput"
:options="employeesOptions"
:validations="v$.masterTask.employees"
:class="{ error: v$.masterTask.employees.$errors.length }"
class="modal-input"
@option-selected="employeeSelected"
/>
<Z-autocomplete
v-if="showAddEmployeeInput"
:options="employeesOptions"
:validations="v$.masterTask.employees"
:class="{ error: v$.masterTask.employees.$errors.length }"
class="modal-input"
@option-selected="employeeSelected"
/>
<v-btn class="w-100 mb-5 add-employee-btn" :disabled="!masterTask.team.employees" @click="showAddEmployeeInput = true">
<v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca
</v-btn>
<v-btn class="w-100 mb-5 add-employee-btn" :disabled="!masterTask.team.employees" @click="showAddEmployeeInput = true">
<v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca
</v-btn>
<v-textarea
:class="{ error: v$.masterTask.description.$errors.length }"
label="Popis"
class="modal-input"
variant="solo"
v-model="masterTask.description"
></v-textarea>
<v-textarea
:class="{ error: v$.masterTask.description.$errors.length }"
label="Popis"
class="modal-input"
variant="solo"
v-model="masterTask.description"
></v-textarea>
<Z-files-upload @files-uploaded="filesUploaded"/>
</v-card-actions>
<Z-files-upload @files-uploaded="filesUploaded"/>
</v-card-actions>
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
</v-card>
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
</v-card>
</W-loadable>
</v-dialog>
</template>
@@ -129,44 +131,25 @@ import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
const atLeastOne = (value) => value.length
export default {
emits: ['close'],
components: {
Datepicker,
ZFilesUpload,
ZAutocomplete
},
props: {
visible: {
type: Boolean,
required: true
},
masterTaskId: {
type: Number || null,
required: false,
default: null
}
},
data() {
return {
masterTask: {
project_code: null,
name: null,
deadline: null,
duration: null,
team: {},
description: null,
employees: [],
files: []
},
visible: false,
errorUtils,
v$: useVuelidate(),
preventInputFocus: false,
teams: null,
employees: null,
selectedTeam: '',
showAddEmployeeInput: false
showAddEmployeeInput: false,
masterTask: null
}
},
@@ -187,7 +170,6 @@ export default {
try {
this.teams = await this.$axios.get_auth_data('v1/teams')
this.employees = await this.$axios.get_auth_data('v1/employees')
// this.masterTask = await this.$axios.get_auth_data(`v1/master-task/${this.masterTaksId}`)
// this.selectedTeam = `${this.masterTask.team.name} - ${this.masterTask.team.id}`)
} catch (error) {
@@ -196,8 +178,29 @@ export default {
},
methods: {
async create(masterTask = null) {
if (masterTask) {
this.masterTask = masterTask
await this._load()
} else {
this.masterTask = {
project_code: null,
name: null,
deadline: null,
duration: null,
team: {},
description: null,
employees: [],
files: []
}
}
this.visible = true
},
async save() {
if (!(await this.v$.$validate())) return console.log(this.v$)
if (!(await this.v$.$validate()))
return
try {
if (this.masterTask.id)
@@ -205,13 +208,19 @@ export default {
else
await this._create()
this.close()
this.$router.push({ name: 'Dashboard - Tasks' })
this.show = false
} catch (error) {
console.log(error)
}
},
close() {
this.visible = false
this.$emit('close', this.masterTask)
this.masterTask = null
},
async _create() {
try {
await this.$axios.post_auth('v1/master-tasks')
@@ -283,17 +292,7 @@ export default {
value: `${employee.name} ${employee.surname}`,
}
})
},
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
}
},
watch: {
Whitespace-only changes.
@@ -1,113 +1,115 @@
<template>
<v-dialog v-model="show" max-width="650" max-height="90%" height="700px">
<v-card height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center modal-header">
<h1>Vytvoriť subtask</h1>
<v-icon
@click.stop="show = false"
icon="mdi-close"
size="large"
></v-icon>
</div>
<v-dialog v-model="visible" max-width="650" max-height="90%" height="700px">
<W-loadable :content="subTask" class="h-100">
<v-card height="100%" class="d-flex flex-column scrolling">
<div class="d-flex justify-space-between align-center modal-header">
<h1>Vytvoriť subtask</h1>
<v-icon
@click.stop="close()"
icon="mdi-close"
size="large"
></v-icon>
</div>
<v-card-actions class="d-flex flex-column modal-content">
<v-text-field
v-model="subTask.project_code"
@focus="onInputFocus"
class="modal-input"
label="Kód projektu"
variant="solo"
disabled
></v-text-field>
<v-card-actions class="d-flex flex-column modal-content">
<v-text-field
v-model="subTask.project_code"
@focus="onInputFocus"
class="modal-input"
label="Kód projektu"
variant="solo"
disabled
></v-text-field>
<v-select
v-model="selectedMasterTask"
@focus="onInputFocus"
class="modal-input border-select"
label="MasterTask"
variant="solo"
:items="masterTaskOptions"
></v-select>
<v-select
v-model="selectedMasterTask"
@focus="onInputFocus"
class="modal-input border-select"
label="MasterTask"
variant="solo"
:items="masterTaskOptions"
></v-select>
<p v-if="subTask.team.employees" class="d-flex justify-start align-center w-100 mb-3 text-grey">Priradení zamestnanci</p>
<p v-if="subTask.team.employees" class="d-flex justify-start align-center w-100 mb-3 text-grey">Priradení zamestnanci</p>
<v-text-field
v-for="(employee, index) in subTask.employees"
:key="employee.id"
@focus="onInputFocus"
class="modal-input"
:value="`${employee.name} ${employee.surname}`"
variant="solo"
v-model="subTask.employees[index].name"
disabled
>
<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 subTask.employees"
:key="employee.id"
@focus="onInputFocus"
class="modal-input"
:value="`${employee.name} ${employee.surname}`"
variant="solo"
v-model="subTask.employees[index].name"
disabled
>
<p class="employee-select-avatar d-flex justify-center align-center">
{{ employee.name.charAt(0) + employee.surname.charAt(0) }}
</p>
</v-text-field>
<Z-autocomplete
v-if="showAddEmployeeInput"
:options="employeesOptions"
:validations="v$.subTask.employees"
:class="{ error: v$.subTask.employees.$errors.length }"
class="modal-input"
@option-selected="employeeSelected"
/>
<Z-autocomplete
v-if="showAddEmployeeInput"
:options="employeesOptions"
:validations="v$.subTask.employees"
:class="{ error: v$.subTask.employees.$errors.length }"
class="modal-input"
@option-selected="employeeSelected"
/>
<v-btn class="w-100 mb-5 add-employee-btn" :disabled="!subTask.team.employees" @click="showAddEmployeeInput = true">
<v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca
</v-btn>
<v-btn class="w-100 mb-5 add-employee-btn" :disabled="!subTask.team.employees" @click="showAddEmployeeInput = true">
<v-icon class="mx-1" icon="mdi-plus" />Pridať zamestnanca
</v-btn>
<Datepicker
class="modal-input mb-5"
v-model="subTask.date"
format="dd.MM.yyyy, HH:mm"
locale="sk"
:class="{ error: v$.subTask.date.$errors.length }"
@focus="onDateFocus"
:validations="v$.subTask.date"
select-text="Vybrať"
cancel-text="Zrušiť"
placeholder="Trvanie od - do"
:start-time="startTime"
range
/>
<Datepicker
class="modal-input mb-5"
v-model="subTask.date"
format="dd.MM.yyyy, HH:mm"
locale="sk"
:class="{ error: v$.subTask.date.$errors.length }"
@focus="onDateFocus"
:validations="v$.subTask.date"
select-text="Vybrať"
cancel-text="Zrušiť"
placeholder="Trvanie od - do"
:start-time="startTime"
range
/>
<v-text-field
v-model="subTask.duration"
@focus="onInputFocus"
class="modal-input"
variant="solo"
type="number"
label="Časový odhad"
:class="{ error: v$.subTask.duration.$errors.length }"
:hint="
v$.subTask.duration.$errors
? errorUtils.parseErrors(v$.subTask.duration.$errors)
: null
"
append-inner-icon="mdi-clock-outline"
></v-text-field>
<v-text-field
v-model="subTask.duration"
@focus="onInputFocus"
class="modal-input"
variant="solo"
type="number"
label="Časový odhad"
:class="{ error: v$.subTask.duration.$errors.length }"
:hint="
v$.subTask.duration.$errors
? errorUtils.parseErrors(v$.subTask.duration.$errors)
: null
"
append-inner-icon="mdi-clock-outline"
></v-text-field>
<v-textarea
label="Popis"
class="modal-input"
variant="solo"
:class="{ error: v$.subTask.description.$errors.length }"
:hint="
v$.subTask.description.$errors
? errorUtils.parseErrors(v$.subTask.description.$errors)
: null
"
v-model="subTask.description"
></v-textarea>
<v-textarea
label="Popis"
class="modal-input"
variant="solo"
:class="{ error: v$.subTask.description.$errors.length }"
:hint="
v$.subTask.description.$errors
? errorUtils.parseErrors(v$.subTask.description.$errors)
: null
"
v-model="subTask.description"
></v-textarea>
<Z-files-upload @files-uploaded="filesUploaded"/>
</v-card-actions>
<Z-files-upload @files-uploaded="filesUploaded"/>
</v-card-actions>
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
</v-card>
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
</v-card>
</W-loadable>
</v-dialog>
</template>
@@ -122,36 +124,18 @@ import ZAutocomplete from '@/plugins/tm@_components/z-autocomplete.vue'
const atLeastOne = (value) => value.length
export default {
emits: ['close'],
components: {
Datepicker,
ZFilesUpload,
ZAutocomplete
},
props: {
visible: {
type: Boolean,
required: true
},
subTaskId: {
type: Number || null,
required: false,
default: null
}
},
data() {
return {
subTask: {
project_code: null,
date: null,
team: {},
employees: [],
duration: null,
description: null,
files: []
},
visible: false,
subTask: null,
errorUtils,
v$: useVuelidate(),
preventInputFocus: false,
@@ -185,8 +169,28 @@ export default {
},
methods: {
async create(subTask = null) {
if (subTask) {
this.subTask = subTask
await this._load()
} else {
this.subTask = {
project_code: null,
date: null,
team: {},
employees: [],
duration: null,
description: null,
files: []
}
}
this.visible = true
},
async save() {
if (!(await this.v$.$validate())) return console.log(this.v$)
if (!(await this.v$.$validate()))
return
try {
if (this.subTask.id)
@@ -194,13 +198,19 @@ export default {
else
await this._create()
this.close()
this.$router.push({ name: 'Dashboard - Tasks' })
this.show = false
} catch (error) {
console.log(error)
}
},
close() {
this.visible = false
this.$emit('close', this.subTask)
this.subTask = null
},
async _create() {
try {
await this.$axios.post_auth('v1/master-tasks')
@@ -261,17 +271,7 @@ export default {
value: `${employee.name} ${employee.surname}`,
}
})
},
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
}
},
watch: {