[Master Task Modal] refactor

This commit is contained in:
Matej Glasnák committed 2022-12-06 19:50:26 +01:00
1 parent e1d9e6302f
commit dd05c715b5
4 files changed
+54 -12

No files matched your search

@@ -3,7 +3,7 @@
<W-loadable :content="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>Vytvoriť blocker</h1>
<h1>{{ blocker.id ? 'Upraviť' : 'Vytvoriť'}} blocker</h1>
<v-icon
@click.stop="show = false"
icon="mdi-close"
@@ -57,7 +57,7 @@
/>
</v-card-actions>
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
<v-btn class="z-btn" @click="save()">{{ blocker.id ? 'UPRAVIŤ' : 'VYTVORIŤ'}}</v-btn>
</v-card>
</W-loadable>
</v-dialog>
@@ -12,6 +12,7 @@
<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"
@@ -19,6 +20,7 @@
></v-text-field>
<v-text-field
v-model="masterTask.name"
@focus="onInputFocus"
class="modal-input"
label="Názov mastertasku"
@@ -26,9 +28,9 @@
></v-text-field>
<Datepicker
v-model="masterTask.deadline"
@focus="onDateFocus"
class="modal-input"
v-model="date"
format="dd.MM.yyyy, HH:mm"
locale="sk"
select-text="Vybrať"
@@ -37,12 +39,14 @@
/>
<v-text-field
v-model="masterTask.duration"
@focus="onInputFocus"
class="modal-input mt-5"
label="Celkový odhad"
variant="solo"
type="number"
placeholder="h"
disabled
></v-text-field>
<v-select
@@ -56,11 +60,13 @@
label="Popis"
class="modal-input"
variant="solo"
v-model="masterTask.description"
></v-textarea>
<Z-files-upload @files-uploaded="filesUploaded"/>
</v-card-actions>
<v-btn class="z-btn" @click="createMasterTask()">VYTVORIŤ</v-btn>
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
</v-card>
</v-dialog>
</template>
@@ -79,24 +85,58 @@ export default {
visible: {
type: Boolean,
required: true
},
masterTaskId: {
type: Number || null,
required: false,
default: null
}
},
data() {
return {
date: '',
masterTask: {
project_code: null,
name: null,
deadilne: null,
duration: null,
team: {},
description: null,
files: []
},
preventInputFocus: false
}
},
methods: {
async createMasterTask() {
async save() {
try {
await this.$axios.post_auth('v1/master-tasks')
if (this.masterTask.id)
await this._update()
else
await this._create()
this.$router.push({ name: 'Dashboard - Tasks' })
this.show = false
} catch (error) {
this.$toast.error(error.response.data.error)
console.log(error)
}
},
async _create() {
try {
await this.$axios.post_auth('v1/master-tasks')
} catch (error) {
this.$toast.error(error)
}
},
async _update() {
try {
await this.$axios.post_auth(`v1/master-tasks/${this.masterTask.id}`)
} catch (error) {
this.$toast.error(error)
}
},
@@ -115,7 +155,7 @@ export default {
},
filesUploaded(files) {
console.log(files.length)
this.masterTask.files = files
}
},
@@ -3,7 +3,7 @@
<W-loadable :content="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>Vytvoriť tím</h1>
<h1>{{ team.id ? 'Upraviť tím' : 'Vytvoriť tím' }}</h1>
<v-icon
@click.stop="show = false"
icon="mdi-close"
@@ -54,7 +54,7 @@
/>
</v-card-actions>
<v-btn class="z-btn" @click="save()">VYTVORIŤ</v-btn>
<v-btn class="z-btn" @click="save()">{{ team.id ? 'UPRAVIŤ' : 'VYTVORIŤ' }}</v-btn>
</v-card>
</W-loadable>
</v-dialog>