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

@@ -9,21 +9,25 @@
"deadline": "2022-11-10T00:00:00+00:00",
"is_finished": false,
"project_code": "CO-2201",
"team": "Tim 1",
"team_id": 1,
"employees": [
{
"id": 1,
"duration": 1300000
"name": "Rastislav",
"surname": "Kuttner"
},
{
"id": 4,
"duration": 1000000
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 5,
"duration": 3100000
"name": "Pavel",
"surname": "Gajdos"
}
],
"files": []
@@ -5,7 +5,29 @@
"project_code": "CO-2201",
"title": "Nazov tasku 1 (Ongoing)",
"duration": 5400000,
"remaining_time": 2400000
"remaining_time": 2400000,
"employees": [
{
"id": 1,
"duration": 1300000,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 4,
"duration": 1000000,
"name": "Pavel",
"surname": "Gajdos"
},
{
"id": 5,
"duration": 3100000,
"name": "Francesca",
"surname": "Spinelli"
}
]
},
{
@@ -13,7 +35,22 @@
"project_code": "CO-2202",
"title": "Nazov tasku 2 (Ongoing)",
"duration": 5400000,
"remaining_time": 1300000
"remaining_time": 1300000,
"employees": [
{
"id": 2,
"duration": 1300000,
"name": "Simona",
"surname": "Tremkova"
},
{
"id": 3,
"duration": 1000000,
"name": "Matej",
"surname": "Macho"
}
]
},
{
@@ -21,7 +58,35 @@
"project_code": "CO-2203",
"title": "Nazov tasku 3 (Ongoing)",
"duration": 5400000,
"remaining_time": 4500000
"remaining_time": 4500000,
"employees": [
{
"id": 1,
"duration": 1300000,
"name": "Rastislav",
"surname": "Kuttner"
},
{
"id": 6,
"duration": 1000000,
"name": "Lenka",
"surname": "Nemeckova"
},
{
"id": 7,
"duration": 3100000,
"name": "Peter",
"surname": "Bucan"
},
{
"id": 9,
"duration": 3200000,
"name": "Viliam",
"surname": "Sedivy"
}
]
}
],
"status": 200
@@ -4,21 +4,77 @@
"id": 1,
"project_code": "CO-2201",
"title": "Nazov tasku 1 (Unscheduled)",
"duration": 5400000
"duration": 54000000,
"employees": [
{
"id": 1,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 4,
"name": "Pavel",
"surname": "Gajdos"
},
{
"id": 5,
"name": "Francesca",
"surname": "Spinelli"
}
]
},
{
"id": 2,
"project_code": "CO-2202",
"title": "Nazov tasku 2 (Unscheduled)",
"duration": 5400000
"duration": 1400000,
"employees": [
{
"id": 1,
"name": "Rastislav",
"surname": "Kuttner"
},
{
"id": 1,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 7,
"name": "Peter",
"surname": "Bucan"
},
{
"id": 9,
"name": "Viliam",
"surname": "Sedivy"
}
]
},
{
"id": 3,
"project_code": "CO-2203",
"title": "Nazov tasku 3 (Unscheduled)",
"duration": 5400000
"duration": 2900000,
"employees": [
{
"id": 2,
"name": "Simona",
"surname": "Tremkova"
},
{
"id": 3,
"name": "Matej",
"surname": "Macho"
}
]
}
],
"status": 200
+1 -1
View File
@@ -5,7 +5,7 @@
"project_code": "CO-2201",
"master_task_id": 1,
"team_id": 1,
"employe_id": 1,
"employee_id": 1,
"duration": 1000000,
"starts_at": "2022-11-10T11:00:00+00:00",
"ends_at": "2022-11-12T16:00:00+00:00",
+21 -1
View File
@@ -4,12 +4,32 @@
"description": "Nejaky popis tasku",
"project_code": "CO-2201",
"master_task_id": 1,
"master_task": "Master task 1",
"team_id": 1,
"employe_id": 1,
"employee_id": 1,
"duration": 1000000,
"is_finished": false,
"starts_at": "2022-11-10T11:00:00+00:00",
"ends_at": "2022-11-12T16:00:00+00:00",
"employees": [
{
"id": 1,
"name": "Viliam",
"surname": "Sedivy"
},
{
"id": 4,
"name": "Pavel",
"surname": "Gajdos"
},
{
"id": 5,
"name": "Francesca",
"surname": "Spinelli"
}
],
"files": []
},
@@ -17,10 +17,10 @@
</template>
<v-list>
<v-list-item class="cursor-pointer hover-background" @click="createMasterTaskDialog = true">MASTER TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createSubTaskDialog = true">SUB TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createMasterTaskModal()">MASTER TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createSubTaskModal()">SUB TASK</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createTeamModal()">TÍM</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createBlockerDialog = true">BLOCKER</v-list-item>
<v-list-item class="cursor-pointer hover-background" @click="createBlockerModal()">BLOCKER</v-list-item>
</v-list>
</v-menu>
@@ -50,10 +50,10 @@
</div>
</div>
<Z-master-task-modal :visible="createMasterTaskDialog ? true : false" @close="createMasterTaskDialog = false"/>
<Z-sub-task-modal :visible="createSubTaskDialog ? true : false" @close="createSubTaskDialog = false"/>
<Z-blocker-modal :visible="createBlockerDialog ? true : false" @close="createBlockerDialog = false" />
<Z-team-modal ref="z-team-modal" />
<Z-master-task-modal ref="z-master-task-modal" />
<Z-sub-task-modal ref="z-sub-task-modal" />
<Z-blocker-modal ref="z-blocker-modal" />
<Z-team-modal ref="z-team-modal" />
</v-app-bar>
</template>
@@ -73,10 +73,7 @@ export default {
data() {
return {
user: null,
createBlockerDialog: false,
createMasterTaskDialog: false,
createSubTaskDialog: false
user: null
}
},
@@ -101,6 +98,18 @@ export default {
createTeamModal() {
this.$refs['z-team-modal'].create()
},
createMasterTaskModal() {
this.$refs['z-master-task-modal'].create()
},
createSubTaskModal() {
this.$refs['z-sub-task-modal'].create()
},
createBlockerModal() {
this.$refs['z-blocker-modal'].create()
}
}
}
@@ -80,7 +80,7 @@ export default {
},
refreshPage() {
window.location = '/app/dashboard/tasks'
window.location = '/#/app/dashboard/tasks'
}
},
}
@@ -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: {
@@ -0,0 +1,88 @@
<template>
<v-row class="px-10 py-8 subheader">
<v-select
v-model="selectedEmployee"
class="subheader-input"
variant="outlined"
:items="allEmployees"
label="Zamestanec"
></v-select>
<v-text-field
v-model="searchQuery"
class="subheader-input"
variant="outlined"
placeholder="Vyhľadávanie"
prepend-inner-icon="mdi-magnify"
@input="onInput"
type="text"
></v-text-field>
</v-row>
</template>
<script>
export default {
data() {
return {
selectedEmployee: '',
employees: [],
searchQuery: ''
}
},
async created() {
try {
this.employees = await this.$axios.get_auth_data('v1/employees')
} catch (error) {
console.log(error)
}
},
methods: {
onInput() {
this.$emit('queryChange', this.searchQuery)
}
},
computed: {
allEmployees() {
const employees = this.employees.map((employee) => {
return `${employee.name} ${employee.surname}`
})
return employees
}
}
}
</script>
<style lang="sass" scoped>
.subheader
max-width: 100%
margin: 0
border-bottom: 1px solid rgba(33, 33, 33, 0.08)
gap: 25px
flex-wrap: wrap
position: sticky
top: 0
z-index: 9999
background: white
.subheader-input
max-width: 250px !important
min-width: 250px
&:deep(.v-input__details)
display: none
&.disabled
pointer-events: none !important
@media (max-width: 600px)
.subheader
gap: 15px
padding: 20px !important
.subheader-input
max-width: 100% !important
min-width: 100%
</style>
@@ -1,29 +1,58 @@
<template>
<W-loadable :content="ongoingTasks">
<A-ongoing-table :tasks="ongoingTasks" />
</W-loadable>
<div>
<Z-tasks-search @queryChange="filterOngoingTasks" />
<W-loadable :content="ongoingTasks">
<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>
</div>
</template>
<script>
import AOngoingTable from './_components/a-ongoing-table.vue'
import ZTasksSearch from '@/plugins/tm@overview/_components/z-tasks-search.vue'
import AOngoingTable from './_components/a-ongoing-table.vue'
export default {
components: {
ZTasksSearch,
AOngoingTable
},
data() {
return {
ongoingTasks: null
ongoingTasks: null,
filteredOngoingTasks: []
}
},
async created() {
try {
this.ongoingTasks = await this.$axios.get_auth_data('v1/overview/ongoing-tasks')
this.filterOngoingTasks()
} catch (error) {
this.ongoingTasks = {error: error.data.error}
this.$toast.error(error.data.error)
this.ongoingTasks = error
this.$toast.error(error)
}
},
methods: {
filterOngoingTasks(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) {
return row.toLowerCase().includes(searchQuery.toLowerCase())
}
}
}
@@ -13,7 +13,7 @@
<tr v-for="task in tasks" :key="task.id">
<td>{{ task.project_code }}</td>
<td>{{ task.title }}</td>
<td>{{ task.duration / 1000 / 60 / 60 }} h</td>
<td>{{ (task.duration / 1000 / 60 / 60).toFixed(2) }} h</td>
<td class="task-action">
<div class="d-flex justify-start">
<img class="pencil-icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" :style="{opacity: 0.3}">
@@ -1,29 +1,59 @@
<template>
<W-loadable :content="unscheduledTasks">
<A-unscheduled-table :tasks="unscheduledTasks" />
</W-loadable>
<div>
<Z-tasks-search @queryChange="filterUnscheduledTasks" />
<W-loadable :content="unscheduledTasks">
<A-unscheduled-table :tasks="filteredUnscheduledTasks" />
<h6
v-if="filteredUnscheduledTasks && !filteredUnscheduledTasks.length"
class="px-4"
>
Aktuálnemu hľadaniu nevyhovujú žiadne nenaplánované úlohy
</h6>
</W-loadable>
</div>
</template>
<script>
import AUnscheduledTable from './_components/a-unscheduled-table.vue'
import ZTasksSearch from '@/plugins/tm@overview/_components/z-tasks-search.vue'
import AUnscheduledTable from './_components/a-unscheduled-table.vue'
export default {
components: {
ZTasksSearch,
AUnscheduledTable
},
data() {
return {
unscheduledTasks: null
unscheduledTasks: null,
filteredUnscheduledTasks: []
}
},
async created() {
try {
this.unscheduledTasks = await this.$axios.get_auth_data('v1/overview/unscheduled-tasks')
this.filterUnscheduledTasks()
console.log(this.unscheduledTasks)
} catch (error) {
this.unscheduledTasks = {error: error.data.error}
this.$toast.error(error.data.error)
this.unscheduledTasks = error
this.$toast.error(error)
}
},
methods: {
filterUnscheduledTasks(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) {
return row.toLowerCase().includes(searchQuery.toLowerCase())
}
}
}
@@ -45,7 +45,6 @@ export default {
data() {
return {
editModal: null,
deleteModal: null
}
},