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

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: {