parent
9082b00567
commit
917690eba3
|
@ -14,23 +14,35 @@
|
||||||
</v-expand-transition>
|
</v-expand-transition>
|
||||||
<v-expand-transition>
|
<v-expand-transition>
|
||||||
<div v-show="!day.loading">
|
<div v-show="!day.loading">
|
||||||
<v-chip
|
<div v-for="worker in day.worker" :key="day.worker.indexOf(worker)">
|
||||||
style="margin: 3px;"
|
<v-chip
|
||||||
v-for="worker in day.worker"
|
style="margin: 3px;"
|
||||||
:key="day.worker.indexOf(worker)"
|
:close="user(worker) && !day.locked"
|
||||||
>{{ worker.firstname }} {{ worker.lastname }}</v-chip
|
@click:close="
|
||||||
>
|
deleteJob({
|
||||||
|
year: day.date.getFullYear(),
|
||||||
|
month: day.date.getMonth() + 1,
|
||||||
|
day: day.date.getDate()
|
||||||
|
})
|
||||||
|
"
|
||||||
|
>{{ worker.firstname }} {{ worker.lastname }}
|
||||||
|
</v-chip>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</v-expand-transition>
|
</v-expand-transition>
|
||||||
</v-card-text>
|
</v-card-text>
|
||||||
<v-card-actions class="text--secondary">
|
<v-card-actions class="text--secondary">
|
||||||
<div v-if="day.locked">
|
<div v-if="!userInWorker">
|
||||||
Du kannst dich nicht zum Bardienst eintragen, da der Tag gesperrt ist.
|
<div v-if="day.locked">
|
||||||
|
Du kannst dich nicht zum Bardienst eintragen, da der Tag gesperrt
|
||||||
|
ist.
|
||||||
|
</div>
|
||||||
|
<div v-else-if="day.worker.length >= 2">
|
||||||
|
Du kannst dich nicht Bardienst eintragen, da mehr als 2 Personen
|
||||||
|
schon eingetragen sind.
|
||||||
|
</div>
|
||||||
|
<div v-else>Hier kannst du dich zum Bardienst eintragen.</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="day.worker.length >= 2">
|
|
||||||
Du kannst dich nicht Bardienst eintragen, da mehr als 2 Personen schon eingetragen sind.
|
|
||||||
</div>
|
|
||||||
<div v-else>Hier kannst du dich zum Bardienst eintragen.</div>
|
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn
|
<v-btn
|
||||||
v-if="!day.locked && !day.loading && day.worker.length < 2"
|
v-if="!day.locked && !day.loading && day.worker.length < 2"
|
||||||
|
@ -77,7 +89,8 @@ export default {
|
||||||
getUser: 'jobs/getUser',
|
getUser: 'jobs/getUser',
|
||||||
setLoading: 'jobs/setDayLoading',
|
setLoading: 'jobs/setDayLoading',
|
||||||
setNotLoading: 'jobs/setDayNotLoading',
|
setNotLoading: 'jobs/setDayNotLoading',
|
||||||
addJob: 'jobs/addJob'
|
addJob: 'jobs/addJob',
|
||||||
|
deleteJob: 'jobs/deleteJob'
|
||||||
}),
|
}),
|
||||||
test(event) {
|
test(event) {
|
||||||
console.log('blur', event)
|
console.log('blur', event)
|
||||||
|
@ -96,12 +109,21 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
return 'grey lighten-4'
|
return 'grey lighten-4'
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
user(worker) {
|
||||||
|
return worker.username === this.activeUser.username
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
disabled: 'jobs/disabled'
|
disabled: 'jobs/disabled',
|
||||||
})
|
activeUser: 'user'
|
||||||
|
}),
|
||||||
|
userInWorker() {
|
||||||
|
return this.day.worker.find(a => {
|
||||||
|
return a.username === this.activeUser.username
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
day() {
|
day() {
|
||||||
|
|
|
@ -31,7 +31,8 @@ const url = {
|
||||||
user: {
|
user: {
|
||||||
config: main + 'user/saveConfig',
|
config: main + 'user/saveConfig',
|
||||||
job: main + 'user/job',
|
job: main + 'user/job',
|
||||||
addJob: main + 'user/addJob'
|
addJob: main + 'user/addJob',
|
||||||
|
deleteJob: main + 'user/deleteJob'
|
||||||
},
|
},
|
||||||
barU: {
|
barU: {
|
||||||
storno: main + 'bar/storno'
|
storno: main + 'bar/storno'
|
||||||
|
|
|
@ -130,6 +130,10 @@ const mutations = {
|
||||||
fullName: user.firstname + ' ' + user.lastname
|
fullName: user.firstname + ' ' + user.lastname
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (worker && data.com === 'delete') {
|
||||||
|
const index = state.month[week].days[day].worker.indexOf(worker)
|
||||||
|
state.month[week].days[day].worker.splice(index, 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (data.day) {
|
if (data.day) {
|
||||||
state.month[week].days[day].locked = data.day.locked
|
state.month[week].days[day].locked = data.day.locked
|
||||||
|
@ -235,6 +239,21 @@ const actions = {
|
||||||
if (e.response)
|
if (e.response)
|
||||||
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
async deleteJob({ commit, rootState, dispatch }, data) {
|
||||||
|
try {
|
||||||
|
const response = await axios.post(
|
||||||
|
url.user.deleteJob,
|
||||||
|
{ ...data },
|
||||||
|
{ headers: { Token: rootState.login.user.accessToken } }
|
||||||
|
)
|
||||||
|
commit('updateMonth', {start: {...data}, user: rootState.login.user, com: 'delete'})
|
||||||
|
console.log(response)
|
||||||
|
} catch (e) {
|
||||||
|
if (e.response)
|
||||||
|
if (e.response.status === 401) dispatch('logout', null, { root: true })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue