Refactoring

This commit is contained in:
Matej Glasnák committed 2022-11-30 20:29:19 +01:00
1 parent 66996747f4
commit 628c6afcb0
12 files changed
+27 -78

No files matched your search

@@ -55,7 +55,7 @@ export default {
components: { components: {
WAutocomplete WAutocomplete
}, },
props: { props: {
show: { show: {
@@ -71,7 +71,6 @@ export default {
data() { data() {
return { return {
selectedEmployee: "",
selectedEmployees: [], selectedEmployees: [],
employees: null, employees: null,
teamName: this.team.name teamName: this.team.name
@@ -111,14 +110,9 @@ export default {
computed: { computed: {
employeesOptions() { employeesOptions() {
const selectedEmployeesIds = this.selectedEmployees.map( const unselectedEmployees = this.employees.filter(employee => this.selectedEmployees.find(e => e.id == employee.od))
(employee) => employee.id
)
const employees = this.employees.filter(
(employee) => !selectedEmployeesIds.includes(employee.id)
)
return employees.map(employee => { return unselectedEmployees.map(employee => {
return { return {
key: employee.id, key: employee.id,
value: `${employee.name} ${employee.surname}` value: `${employee.name} ${employee.surname}`
@@ -129,21 +123,7 @@ export default {
showModal() { showModal() {
return this.show return this.show
} }
}, }
watch: {
selectedEmployee() {
const selectedEmployee = this.selectedEmployee.split(" ")
const employee = this.employees.find(
(e) =>
e.name == selectedEmployee[0] &&
e.surname == selectedEmployee[1]
)
this.selectedEmployees.push(JSON.parse(JSON.stringify(employee)))
},
},
} }
</script> </script>
@@ -29,10 +29,10 @@
</v-text-field> </v-text-field>
<v-icon <v-icon
class="remove-input" class="remove-input"
@click="removeInput(index)" @click.stop="removeInput(index)"
icon="mdi-close" icon="mdi-close"
size="small" size="small"
></v-icon ></v-icon
> >
</div> </div>
+1 -7
View File
@@ -4,10 +4,4 @@
<router-view /> <router-view />
</v-main> </v-main>
</v-app> </v-app>
</template> </template>
<script>
export default {
name: 'App'
}
</script>
+4 -16
View File
@@ -1,20 +1,16 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import vuetify from './vuetify' import { IonicVue } from '@ionic/vue'
import { loadFonts } from './webfontloader' import { loadFonts } from './webfontloader'
import vuetify from './vuetify'
import loader from 'vue-loading-overlay' import loader from 'vue-loading-overlay'
import App from './App.vue' import App from './App.vue'
import { IonicVue } from '@ionic/vue'
import router from './router' import router from './router'
import store from '../../../store' import store from '@/store'
import wToast from '@/plugins/w/toast'
import i18n from '@/plugins/w/i18n'
import w from '@/plugins/w/w' import w from '@/plugins/w/w'
import vueCal from '@/plugins/app@vendor/vue-cal' import vueCal from '@/plugins/app@vendor/vue-cal'
import { Options } from '@/plugins/w/w/types' import { Options } from '@/plugins/w/w/types'
import '@ionic/vue/css/core.css' import '@ionic/vue/css/core.css'
import '@ionic/vue/css/normalize.css' import '@ionic/vue/css/normalize.css'
import '@ionic/vue/css/structure.css' import '@ionic/vue/css/structure.css'
@@ -29,15 +25,9 @@ import '@ionic/vue/css/display.css'
import '@/plugins/app/_theme/index.sass' import '@/plugins/app/_theme/index.sass'
import 'vue-loading-overlay/dist/vue-loading.css' import 'vue-loading-overlay/dist/vue-loading.css'
// vue cal
import VueCal from '@/plugins/app@vendor/vue-cal/index'
loadFonts() loadFonts()
const options: Options = { const options: Options = {
ionic: {
disabled: false
},
i18n: { i18n: {
languages: [ languages: [
{ {
@@ -89,12 +79,10 @@ const app = createApp(App)
.use(w, options) .use(w, options)
.use(IonicVue) .use(IonicVue)
.use(vuetify) .use(vuetify)
// .use(wToast) .use(vueCal)
.use(VueCal)
.use(loader, { .use(loader, {
color: '#6200EE' color: '#6200EE'
}) })
.use(vueCal)
.mount('#app') .mount('#app')
// @ts-expect-error // @ts-expect-error
+5
View File
@@ -82,6 +82,11 @@ const routes: Array<RouteRecordRaw> = [
] ]
} }
] ]
},
{
path: '/:catchAll(.*)',
name: '404',
component: () => import('@/plugins/w@screen/404/404.vue')
} }
] ]
+4 -8
View File
@@ -1,9 +1,5 @@
// Styles import { createVuetify } from "vuetify"
import "@mdi/font/css/materialdesignicons.css"; import "@mdi/font/css/materialdesignicons.css"
import "vuetify/styles"; import "vuetify/styles"
// Vuetify export default createVuetify()
import { createVuetify } from "vuetify";
export default createVuetify();
// https://vuetifyjs.com/en/introduction/why-vuetify/#feature-guides
+6 -14
View File
@@ -1,17 +1,9 @@
/**
* plugins/webfontloader.js
*
* webfontloader documentation: https://github.com/typekit/webfontloader
*/
export async function loadFonts() { export async function loadFonts() {
const webFontLoader = await import( const webFontLoader = await import('webfontloader')
/* webpackChunkName: "webfontloader" */ "webfontloader"
);
webFontLoader.load({ webFontLoader.load({
google: { google: {
families: ["Roboto:100,300,400,500,700,900&display=swap"], families: ['Roboto:100,300,400,500,700,900&display=swap']
}, }
}); })
} }
-3
View File
@@ -1,3 +0,0 @@
span.highlight {
color: #7F39FB;
}/*# sourceMappingURL=global.css.map */
@@ -1 +0,0 @@
{"version":3,"sources":["global.sass","global.css"],"names":[],"mappings":"AAAA;EACC,cAAA;ACCD","file":"global.css"}
@@ -55,7 +55,6 @@ export default {
try { try {
await this.$axios.delete(`v1/teams/${id}`) await this.$axios.delete(`v1/teams/${id}`)
this.showDeleteModal = false this.showDeleteModal = false
this.$toast.success('Úspešne ste odstránili task')
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }
@@ -53,7 +53,6 @@ export default {
try { try {
await this.$axios.delete(`v1/teams/${id}`) await this.$axios.delete(`v1/teams/${id}`)
this.showDeleteModal = false this.showDeleteModal = false
this.$toast.success('Úspešne ste odstránili task')
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }
@@ -14,6 +14,7 @@
<div class="d-flex justify-start"> <div class="d-flex justify-start">
<img class="pencil-icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="showEditModal = true" /> <img class="pencil-icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="showEditModal = true" />
<img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="showDeleteModal = true" /> <img class="trash-icon" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="showDeleteModal = true" />
<A-edit-team-modal :show="showEditModal" :team="team" @close-modal="showEditModal = false" /> <A-edit-team-modal :show="showEditModal" :team="team" @close-modal="showEditModal = false" />
<A-delete-team-modal :show="showDeleteModal" :team="team" @delete-team="deleteTeam" @close-modal="showDeleteModal = false" /> <A-delete-team-modal :show="showDeleteModal" :team="team" @delete-team="deleteTeam" @close-modal="showDeleteModal = false" />
</div> </div>
@@ -52,7 +53,6 @@ export default {
try { try {
await this.$axios.delete(`v1/teams/${id}`) await this.$axios.delete(`v1/teams/${id}`)
this.showDeleteModal = false this.showDeleteModal = false
this.$toast.success('Úspešne ste odstránili tím')
} catch (error) { } catch (error) {
this.$toast.error(error) this.$toast.error(error)
} }