mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 22:39:34 +00:00
build(dev): rebuild, file formatting, removed console logs
This commit is contained in:
1 parent
734a3fac6c
commit
f69e55859b
34 files changed
+1537
-1177
No files matched your search
@@ -1,77 +1,96 @@
|
||||
<template>
|
||||
<v-dialog v-model="visible" :width="modalWidth" :height="modalHeight" persistent :retain-focus="false">
|
||||
<v-card style="position: relative">
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<h1>
|
||||
Ste si istý, že chcete zmazať tím <b>{{ team.name }}</b>?
|
||||
</h1>
|
||||
<div class="d-flex align-center">
|
||||
<a-reset-size-button @reset="resetModalSize" />
|
||||
<a-close-button @close="closeModal()" />
|
||||
</div>
|
||||
</div>
|
||||
<v-dialog
|
||||
v-model="visible"
|
||||
:width="modalWidth"
|
||||
:height="modalHeight"
|
||||
persistent
|
||||
:retain-focus="false"
|
||||
>
|
||||
<v-card style="position: relative">
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<h1>
|
||||
Ste si istý, že chcete zmazať tím <b>{{ team.name }}</b
|
||||
>?
|
||||
</h1>
|
||||
<div class="d-flex align-center">
|
||||
<a-reset-size-button @reset="resetModalSize" />
|
||||
<a-close-button @close="closeModal()" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<v-card-actions class="mt-10 d-flex justify-start align-center mobile-view">
|
||||
<v-btn class="button primary half" variant="flat" :disabled="isDeleting" @click="deleteTeam()">ÁNO</v-btn>
|
||||
<v-btn class="button primary half outline" @click.stop="closeModal()">ZRUŠIŤ</v-btn>
|
||||
</v-card-actions>
|
||||
<a-resize-handle :current-width="modalWidthPx" :current-height="modalHeightPx" @resize="handleModalResize" @resize-end="handleResizeEnd" />
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-card-actions
|
||||
class="mt-10 d-flex justify-start align-center mobile-view"
|
||||
>
|
||||
<v-btn
|
||||
class="button primary half"
|
||||
variant="flat"
|
||||
:disabled="isDeleting"
|
||||
@click="deleteTeam()"
|
||||
>ÁNO</v-btn
|
||||
>
|
||||
<v-btn class="button primary half outline" @click.stop="closeModal()"
|
||||
>ZRUŠIŤ</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
<a-resize-handle
|
||||
:current-width="modalWidthPx"
|
||||
:current-height="modalHeightPx"
|
||||
@resize="handleModalResize"
|
||||
@resize-end="handleResizeEnd"
|
||||
/>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
|
||||
import AResizeHandle from '@/plugins/tm@modal/_components/a-resize-handle.vue'
|
||||
import AResetSizeButton from '@/plugins/tm@modal/_components/a-reset-size-button.vue'
|
||||
import ACloseButton from '@/plugins/tm@modal/_components/a-close-button.vue'
|
||||
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin';
|
||||
import AResizeHandle from '@/plugins/tm@modal/_components/a-resize-handle.vue';
|
||||
import AResetSizeButton from '@/plugins/tm@modal/_components/a-reset-size-button.vue';
|
||||
import ACloseButton from '@/plugins/tm@modal/_components/a-close-button.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AResizeHandle,
|
||||
AResetSizeButton,
|
||||
ACloseButton,
|
||||
},
|
||||
mixins: [modalMixin],
|
||||
emits: ['update'],
|
||||
|
||||
components: {
|
||||
AResizeHandle,
|
||||
AResetSizeButton, ACloseButton,
|
||||
},
|
||||
mixins: [ modalMixin ],
|
||||
emits: ['update'],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
team: null,
|
||||
isDeleting: false,
|
||||
modalName: 'z-delete-team-modal',
|
||||
};
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
team: null,
|
||||
isDeleting: false,
|
||||
modalName: 'z-delete-team-modal',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async showModal({ team }) {
|
||||
this.team = team;
|
||||
this.visible = true;
|
||||
},
|
||||
|
||||
methods: {
|
||||
async showModal({team}) {
|
||||
this.team = team
|
||||
this.visible = true
|
||||
},
|
||||
closeModal() {
|
||||
this.visible = false;
|
||||
},
|
||||
|
||||
closeModal() {
|
||||
this.visible = false
|
||||
},
|
||||
async deleteTeam() {
|
||||
if (this.isDeleting) return;
|
||||
|
||||
async deleteTeam() {
|
||||
if (this.isDeleting) return
|
||||
|
||||
this.isDeleting = true
|
||||
try {
|
||||
await this.$axios.delete_auth(`v1/teams/${this.team.id}`)
|
||||
this.visible = false
|
||||
this.$emit('update', this.team)
|
||||
this.$store.commit('tm/delete_team', this.team)
|
||||
} catch (error) {
|
||||
this.$toast.error(this.$parseError(error))
|
||||
|
||||
if (process.env.NODE_ENV === 'development')
|
||||
/* eslint-disable *//* eslint-disable */console.log(...oo_oo(`11593241_70_25_70_116_4`,...oo_oo(`1957043750_57_5_57_60_4`,'[z-delete-team-modal.vue] Error: ', error)))
|
||||
} finally {
|
||||
this.isDeleting = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
this.isDeleting = true;
|
||||
try {
|
||||
await this.$axios.delete_auth(`v1/teams/${this.team.id}`);
|
||||
this.visible = false;
|
||||
this.$emit('update', this.team);
|
||||
this.$store.commit('tm/delete_team', this.team);
|
||||
} catch (error) {
|
||||
this.$toast.error(this.$parseError(error));
|
||||
} finally {
|
||||
this.isDeleting = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -1,174 +1,217 @@
|
||||
<template>
|
||||
<v-dialog v-model="visible" :width="modalWidth" :height="modalHeight" persistent :retain-focus="false">
|
||||
<W-loadable :content="team" class="h-100">
|
||||
<v-card height="100%" class="d-flex flex-column" style="position: relative">
|
||||
<div class="d-flex justify-space-between align-center modal-header">
|
||||
<h1>{{ team.id ? 'Upraviť tím' : 'Vytvoriť tím' }}</h1>
|
||||
<div class="d-flex align-center">
|
||||
<a-reset-size-button @reset="resetModalSize" />
|
||||
<a-close-button @close="closeModal()" />
|
||||
</div>
|
||||
</div>
|
||||
<v-dialog
|
||||
v-model="visible"
|
||||
:width="modalWidth"
|
||||
:height="modalHeight"
|
||||
persistent
|
||||
:retain-focus="false"
|
||||
>
|
||||
<W-loadable :content="team" class="h-100">
|
||||
<v-card
|
||||
height="100%"
|
||||
class="d-flex flex-column"
|
||||
style="position: relative"
|
||||
>
|
||||
<div class="d-flex justify-space-between align-center modal-header">
|
||||
<h1>{{ team.id ? 'Upraviť tím' : 'Vytvoriť tím' }}</h1>
|
||||
<div class="d-flex align-center">
|
||||
<a-reset-size-button @reset="resetModalSize" />
|
||||
<a-close-button @close="closeModal()" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field
|
||||
v-model="team.name" class="modal-input" label="Názov tímu"
|
||||
variant="solo" :class="{ error: v$.team.name.$errors.length }" :hint="
|
||||
v$.team.name.$errors
|
||||
? errorUtils.parseErrors(v$.team.name.$errors)
|
||||
: null
|
||||
"></v-text-field>
|
||||
<v-card-actions class="d-flex flex-column modal-content">
|
||||
<v-text-field
|
||||
v-model="team.name"
|
||||
class="modal-input"
|
||||
label="Názov tímu"
|
||||
variant="solo"
|
||||
:class="{ error: v$.team.name.$errors.length }"
|
||||
:hint="
|
||||
v$.team.name.$errors
|
||||
? errorUtils.parseErrors(v$.team.name.$errors)
|
||||
: null
|
||||
"
|
||||
></v-text-field>
|
||||
|
||||
<div v-for="(employee, index) in team.employees" :key="employee.id" class="relative w-100">
|
||||
<v-text-field
|
||||
v-model="team.employees[index]._fullName" class="modal-input" disabled label="Zamestanec"
|
||||
variant="solo">
|
||||
</v-text-field>
|
||||
<div
|
||||
v-for="(employee, index) in team.employees"
|
||||
:key="employee.id"
|
||||
class="relative w-100"
|
||||
>
|
||||
<v-text-field
|
||||
v-model="team.employees[index]._fullName"
|
||||
class="modal-input"
|
||||
disabled
|
||||
label="Zamestanec"
|
||||
variant="solo"
|
||||
>
|
||||
</v-text-field>
|
||||
|
||||
<v-icon
|
||||
class="remove-input" icon="mdi-close" size="small"
|
||||
@click.stop="team.employees.splice(index, 1)"></v-icon>
|
||||
</div>
|
||||
<v-icon
|
||||
class="remove-input"
|
||||
icon="mdi-close"
|
||||
size="small"
|
||||
@click.stop="team.employees.splice(index, 1)"
|
||||
></v-icon>
|
||||
</div>
|
||||
|
||||
<v-autocomplete
|
||||
ref="autocomplete" v-model="employeeSelect" :custom-filter="customFilter" :match-any="true"
|
||||
label="Priradený" :class="{ error: v$.team.employees.$errors.length }"
|
||||
:items="employeesOptions" item-title="_fullName" item-value="id" variant="solo" class="modal-input"
|
||||
clearable />
|
||||
</v-card-actions>
|
||||
<v-autocomplete
|
||||
ref="autocomplete"
|
||||
v-model="employeeSelect"
|
||||
:custom-filter="customFilter"
|
||||
:match-any="true"
|
||||
label="Priradený"
|
||||
:class="{ error: v$.team.employees.$errors.length }"
|
||||
:items="employeesOptions"
|
||||
item-title="_fullName"
|
||||
item-value="id"
|
||||
variant="solo"
|
||||
class="modal-input"
|
||||
clearable
|
||||
/>
|
||||
</v-card-actions>
|
||||
|
||||
<v-btn class="button primary block" @click="save()">{{ team.id ? 'UPRAVIŤ' : 'VYTVORIŤ' }}</v-btn>
|
||||
<a-resize-handle :current-width="modalWidthPx" :current-height="modalHeightPx" @resize="handleModalResize" @resize-end="handleResizeEnd" />
|
||||
</v-card>
|
||||
</W-loadable>
|
||||
</v-dialog>
|
||||
<v-btn class="button primary block" @click="save()">{{
|
||||
team.id ? 'UPRAVIŤ' : 'VYTVORIŤ'
|
||||
}}</v-btn>
|
||||
<a-resize-handle
|
||||
:current-width="modalWidthPx"
|
||||
:current-height="modalHeightPx"
|
||||
@resize="handleModalResize"
|
||||
@resize-end="handleResizeEnd"
|
||||
/>
|
||||
</v-card>
|
||||
</W-loadable>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import useVuelidate from '@vuelidate/core'
|
||||
import { required } from '@vuelidate/validators'
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils'
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils'
|
||||
import { mapGetters } from 'vuex'
|
||||
import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin'
|
||||
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin'
|
||||
import AResizeHandle from '@/plugins/tm@modal/_components/a-resize-handle.vue'
|
||||
import AResetSizeButton from '@/plugins/tm@modal/_components/a-reset-size-button.vue'
|
||||
import ACloseButton from '@/plugins/tm@modal/_components/a-close-button.vue'
|
||||
import useVuelidate from '@vuelidate/core';
|
||||
import { required } from '@vuelidate/validators';
|
||||
import errorUtils from '@/plugins/lib@auth/_utils/error.utils';
|
||||
import tmUtils from '@/plugins/tm@_utils/tm.utils';
|
||||
import { mapGetters } from 'vuex';
|
||||
import AutocompleteMixin from '@/plugins/tm@_mixins/autocomplete.mixin';
|
||||
import modalMixin from '@/plugins/tm@modal/_mixins/modal.mixin';
|
||||
import AResizeHandle from '@/plugins/tm@modal/_components/a-resize-handle.vue';
|
||||
import AResetSizeButton from '@/plugins/tm@modal/_components/a-reset-size-button.vue';
|
||||
import ACloseButton from '@/plugins/tm@modal/_components/a-close-button.vue';
|
||||
|
||||
const atLeastOne = (value) => value.length
|
||||
const atLeastOne = (value) => value.length;
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AResizeHandle,
|
||||
AResetSizeButton,
|
||||
ACloseButton,
|
||||
},
|
||||
mixins: [AutocompleteMixin, modalMixin],
|
||||
emits: ['close', 'update'],
|
||||
|
||||
components: {
|
||||
AResizeHandle,
|
||||
AResetSizeButton,
|
||||
ACloseButton,
|
||||
},
|
||||
mixins: [AutocompleteMixin, modalMixin],
|
||||
emits: ['close', 'update'],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
v$: useVuelidate(),
|
||||
errorUtils,
|
||||
employeeSelect: null,
|
||||
team: null,
|
||||
modalName: 'z-team-modal',
|
||||
};
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
v$: useVuelidate(),
|
||||
errorUtils,
|
||||
employeeSelect: null,
|
||||
team: null,
|
||||
modalName: 'z-team-modal',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters('tm', ['enrichedEmployees']),
|
||||
|
||||
computed: {
|
||||
...mapGetters('tm', [
|
||||
'enrichedEmployees'
|
||||
]),
|
||||
employeesOptions() {
|
||||
const selectedEmployeesIds = this.team.employees.map(
|
||||
(employee) => employee.id,
|
||||
);
|
||||
|
||||
employeesOptions() {
|
||||
const selectedEmployeesIds = this.team.employees.map(
|
||||
(employee) => employee.id
|
||||
)
|
||||
return this.enrichedEmployees.filter(
|
||||
(employee) => !selectedEmployeesIds.includes(employee.id),
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
return this.enrichedEmployees.filter(employee => !selectedEmployeesIds.includes(employee.id))
|
||||
}
|
||||
},
|
||||
validations() {
|
||||
return {
|
||||
team: {
|
||||
name: { required },
|
||||
employees: { atLeastOne },
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
validations() {
|
||||
return {
|
||||
team: {
|
||||
name: { required },
|
||||
employees: { atLeastOne }
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async showModal({ team = null }) {
|
||||
this.visible = true;
|
||||
this.team = null;
|
||||
this.$nextTick(() => this.v$.$reset());
|
||||
|
||||
methods: {
|
||||
async showModal({ team = null }) {
|
||||
this.visible = true
|
||||
this.team = null
|
||||
this.$nextTick(() => this.v$.$reset())
|
||||
try {
|
||||
if (team?.id) {
|
||||
const t = await this.$axios.get_auth_data(`v1/teams/${team.id}`);
|
||||
this.team = this._enrichTeam(t);
|
||||
} else {
|
||||
this.team = { employees: [] };
|
||||
}
|
||||
} catch (error) {
|
||||
this.$toast.error(this.$parseError(error));
|
||||
}
|
||||
},
|
||||
|
||||
try {
|
||||
if (team?.id) {
|
||||
const t = await this.$axios.get_auth_data(`v1/teams/${team.id}`)
|
||||
this.team = this._enrichTeam(t)
|
||||
} else {
|
||||
this.team = { employees: [] }
|
||||
}
|
||||
} catch (error) {
|
||||
this.$toast.error(this.$parseError(error))
|
||||
closeModal() {
|
||||
this.visible = false;
|
||||
this.$emit('close', this.team);
|
||||
},
|
||||
|
||||
if (process.env.NODE_ENV === 'development')
|
||||
/* eslint-disable *//* eslint-disable */console.log(...oo_oo(`3722708094_122_25_122_111_4`,...oo_oo(`1718904172_104_5_104_53_4`,'[z-team-modal.vue] Error: ', error)))
|
||||
}
|
||||
},
|
||||
async save() {
|
||||
if (!(await this.v$.$validate())) return;
|
||||
|
||||
closeModal() {
|
||||
this.visible = false
|
||||
this.$emit('close', this.team)
|
||||
},
|
||||
try {
|
||||
if (this.team.id) {
|
||||
const { team } = await this.$axios.put_auth(
|
||||
`v1/teams/${this.team.id}`,
|
||||
this.team,
|
||||
);
|
||||
|
||||
async save() {
|
||||
if (!(await this.v$.$validate())) return
|
||||
const fullTeamResource = await this.$axios.get_auth_data(
|
||||
`v1/teams/${team.id}`,
|
||||
);
|
||||
this.$store.commit('tm/update_team', fullTeamResource);
|
||||
} else {
|
||||
const { team } = await this.$axios.post_auth(`v1/teams`, this.team);
|
||||
|
||||
try {
|
||||
if (this.team.id) {
|
||||
const { team } = await this.$axios.put_auth(`v1/teams/${this.team.id}`, this.team)
|
||||
const fullTeamResource = await this.$axios.get_auth_data(
|
||||
`v1/teams/${team.id}`,
|
||||
);
|
||||
this.$store.commit('tm/save_team', fullTeamResource);
|
||||
}
|
||||
|
||||
const fullTeamResource = await this.$axios.get_auth_data(`v1/teams/${team.id}`)
|
||||
this.$store.commit('tm/update_team', fullTeamResource)
|
||||
} else {
|
||||
const { team } = await this.$axios.post_auth(`v1/teams`, this.team)
|
||||
this.closeModal();
|
||||
} catch (error) {
|
||||
this.$toast.error(this.$parseError(error));
|
||||
}
|
||||
},
|
||||
|
||||
const fullTeamResource = await this.$axios.get_auth_data(`v1/teams/${team.id}`)
|
||||
this.$store.commit('tm/save_team', fullTeamResource)
|
||||
}
|
||||
_enrichTeam(team) {
|
||||
team.employees = tmUtils.enrichEmployees(team.employees);
|
||||
return team;
|
||||
},
|
||||
},
|
||||
|
||||
this.closeModal()
|
||||
} catch (error) {
|
||||
this.$toast.error(this.$parseError(error))
|
||||
watch: {
|
||||
employeeSelect(employeeId) {
|
||||
if (!employeeId) return;
|
||||
|
||||
if (process.env.NODE_ENV === 'development')
|
||||
/* eslint-disable *//* eslint-disable */console.log(...oo_oo(`3722708094_152_25_152_111_4`,...oo_oo(`1718904172_134_5_134_53_4`,'[z-team-modal.vue] Error: ', error)))
|
||||
}
|
||||
},
|
||||
|
||||
_enrichTeam(team) {
|
||||
team.employees = tmUtils.enrichEmployees(team.employees)
|
||||
return team
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
employeeSelect(employeeId) {
|
||||
if (!employeeId)
|
||||
return
|
||||
|
||||
const employee = this.enrichedEmployees.find(employee => employee.id == employeeId)
|
||||
this.team.employees.push(employee)
|
||||
this.employeeSelect = null
|
||||
this.$refs.autocomplete.search = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
const employee = this.enrichedEmployees.find(
|
||||
(employee) => employee.id == employeeId,
|
||||
);
|
||||
this.team.employees.push(employee);
|
||||
this.employeeSelect = null;
|
||||
this.$refs.autocomplete.search = '';
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in new issue
Block a user