vorstand can set job_kinds for day with max persons

workers willsort to job_kinds
This commit is contained in:
Tim Gröger 2020-05-22 21:12:59 +02:00
parent 9bd854209e
commit bc2289173f
4 changed files with 526 additions and 129 deletions

View File

@ -86,9 +86,10 @@ export default {
if (this.date.getDate() < intDate) if (this.date.getDate() < intDate)
this.date = new Date(this.date.getFullYear(), this.date.getMonth(), 0) this.date = new Date(this.date.getFullYear(), this.date.getMonth(), 0)
} }
this.getAllJobKinds()
this.createMonth(this.date) this.createMonth(this.date)
this.getAllUsers() this.getAllUsers()
this.getDBUsers()
this.getUsers({ this.getUsers({
from_date: { from_date: {
year: this.startDate.getFullYear(), year: this.startDate.getFullYear(),
@ -107,7 +108,9 @@ export default {
createMonth: 'sm/createMonth', createMonth: 'sm/createMonth',
getAllUsers: 'sm/getAllUsers', getAllUsers: 'sm/getAllUsers',
getUsers: 'sm/getUsers', getUsers: 'sm/getUsers',
lockDay: 'sm/lockDay' lockDay: 'sm/lockDay',
getDBUsers: 'usermanager/getUsers',
getAllJobKinds: 'jkm/getAllJobKinds',
}), }),
changeMonth(value) { changeMonth(value) {
if (value === -1) { if (value === -1) {

View File

@ -2,9 +2,13 @@
<div v-if="day"> <div v-if="day">
<v-card :color="color(day)" max-width="250px" min-width="250px"> <v-card :color="color(day)" max-width="250px" min-width="250px">
<v-card-title v-if="day.date" class="subtitle-1 font-weight-bold"> <v-card-title v-if="day.date" class="subtitle-1 font-weight-bold">
{{ day.name }} den {{ day.date.getDate() }}.{{ {{ day.name }} {{ day.date.getDate() }}.{{ day.date.getMonth() + 1 }}.{{
day.date.getMonth() + 1 day.date.getFullYear()
}}.{{ day.date.getFullYear() }} }}
<v-spacer />
<v-btn icon small @click="dialog = true">
<v-icon>{{ menuIcon }}</v-icon>
</v-btn>
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-expand-transition> <v-expand-transition>
@ -12,22 +16,32 @@
<v-progress-circular indeterminate color="grey" /> <v-progress-circular indeterminate color="grey" />
</v-row> </v-row>
</v-expand-transition> </v-expand-transition>
<div v-for="(jobkinddateitem, index) in day.jobkinddate" :key="index">
<div
v-if="
jobkinddateitem.job_kind
? jobkinddateitem.job_kind.id !== 0
: false
"
>
<v-expand-transition> <v-expand-transition>
<div v-show="!day.loading"> <div v-show="!day.loading">
<v-autocomplete <v-autocomplete
chips chips
return-object return-object
multiple multiple
v-model="day.worker" :counter="jobkinddateitem.maxpersons"
:items="allUsers" v-model="jobkinddateitem.worker"
item-text="fullName" :items="filterUser(jobkinddateitem.job_kind)"
label="Dienste" :item-text="item => item.firstname + ' ' + item.lastname"
:label="jobkinddateitem.job_kind.name"
filled filled
color="green" color="green"
@input="searchInput = null"
:search-input.sync="searchInput"
@blur="focused = false" @blur="focused = false"
@focus="focused = true" @focus="focused = true"
:key="update"
@change="forceRenderer(jobkinddateitem)"
> >
<template v-slot:prepend-inner> <template v-slot:prepend-inner>
<v-icon>{{ account_add }}</v-icon> <v-icon>{{ account_add }}</v-icon>
@ -38,33 +52,160 @@
:input-value="data.selected" :input-value="data.selected"
close close
@click="data.select" @click="data.select"
@click:close="remove(data.item)" @click:close="remove(jobkinddateitem, data.item)"
>{{ data.item.firstname }} {{ data.item.lastname }}</v-chip> >{{ data.item.firstname }} {{ data.item.lastname }}
</template> </v-chip>
<template v-slot:item="data">
<v-list-item-content>
<v-list-item-title>
{{ data.item.firstname }}
{{ data.item.lastname }}
</v-list-item-title>
</v-list-item-content>
</template> </template>
</v-autocomplete> </v-autocomplete>
</div> </div>
</v-expand-transition> </v-expand-transition>
</div>
</div>
</v-card-text> </v-card-text>
<v-card-actions v-if="!day.loading"> <v-card-actions v-if="!day.loading">
<v-chip class="text-uppercase" :color="lockedColor">{{ lockedText }}</v-chip> <v-chip class="text-uppercase" :color="lockedColor">{{
lockedText
}}</v-chip>
<v-spacer /> <v-spacer />
<v-btn text @click="lock">{{ lockedTextBtn }}</v-btn> <v-btn text @click="lock">{{ lockedTextBtn }}</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
<v-dialog v-model="dialog">
<v-card>
<v-card-title>
Bearbeite Tag
</v-card-title>
<v-card-text>
<div>
<v-row v-if="!isBarDienstIn">
<v-col cols="8">
<v-text-field readonly outlined value="Bardienst" />
</v-col>
<v-col cols="2">
<v-text-field
outlined
label="Maximale Personen"
type="number"
v-model="maxpersons"
@change="createBarJobKindDate(maxpersons)"
/>
</v-col>
<v-col cols="2"> </v-col>
</v-row>
<v-row
v-for="(jobkinddateitem, index) in day.jobkinddate"
:key="index"
>
<v-col cols="8">
<v-text-field
v-if="!jobkinddateitem.new"
readonly
outlined
:value="jobkinddateitem.job_kind.name"
/>
<v-autocomplete
v-else
outlined
:items="filterJobKinds(jobkinddateitem, index)"
:rules="rules"
item-text="name"
item-value="id"
v-model="jobkinddateitem.job_kind"
return-object
></v-autocomplete>
</v-col>
<v-col cols="2">
<v-text-field
outlined
label="Maximale Personen"
type="number"
v-model="jobkinddateitem.maxpersons"
/>
</v-col>
<v-col cols="2">
<div v-if="jobkinddateitem.job_kind !== null">
<div v-if="jobkinddateitem.job_kind.id !== 1">
<v-btn
v-if="jobkinddateitem.id === 0"
fab
x-small
color="green"
@click="undoDelteJobKindDate(index)"
>
<v-icon>{{ plusIcon }}</v-icon>
</v-btn>
<v-btn
v-else
fab
x-small
color="red"
@click="deleteJobKindDate(index)"
>
<v-icon>{{ minusIcon }}</v-icon>
</v-btn>
</div>
</div>
<div v-else>
<v-btn
v-if="jobkinddateitem.id === 0"
fab
x-small
color="green"
@click="undoDelteJobKindDate(index)"
>
<v-icon>{{ plusIcon }}</v-icon>
</v-btn>
<v-btn
v-else
fab
x-small
color="red"
@click="deleteJobKindDate(index)"
>
<v-icon>{{ minusIcon }}</v-icon>
</v-btn>
</div>
</v-col>
<v-row v-if="jobkinddateitem.id === 0">
<v-col>
<v-alert dense type="info"
>{{ jobkinddateitem.job_kind.name }} wird beim Speichern
gelöscht.</v-alert
>
</v-col>
</v-row>
</v-row>
</div>
<v-row>
<v-spacer />
<v-btn
fab
small
color="green darken-1"
@click="addJobKindDate()"
:disabled="disableAddBtn"
>
<v-icon>{{ plusIcon }}</v-icon>
</v-btn>
</v-row>
</v-card-text>
<v-card-actions>
<v-spacer />
<v-btn text color="primary" @click="dialog = false">
Abbrechen
</v-btn>
<v-btn text color="primary" @click="saveJobKind()">
Speichern
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters, mapActions } from 'vuex'
import { mdiAccountPlus } from '@mdi/js' import { mdiAccountPlus, mdiDotsVertical, mdiPlus, mdiMinus } from '@mdi/js'
export default { export default {
name: 'Day', name: 'Day',
props: { props: {
@ -73,19 +214,37 @@ export default {
data() { data() {
return { return {
account_add: mdiAccountPlus, account_add: mdiAccountPlus,
menuIcon: mdiDotsVertical,
plusIcon: mdiPlus,
minusIcon: mdiMinus,
searchInput: null, searchInput: null,
focused: false focused: false,
dialog: false,
update: 0,
maxpersons: 2,
rules: [
data => {
if (data === null) return false
var list = this.day.jobkinddate.filter(a => {
if (a.job_kind === null) return false
else {
return a.job_kind.id === data.id
}
})
return list.length > 1 ? data.name + 'ist schon vorhanden' : false
}
],
workerRules: [
(data, test) => {
console.log(data, test)
return false
}
],
backup: null
} }
}, },
created() { created() {
this.setLoading(this.day.date) this.setLoading(this.day.date)
//this.getUser({
// date: this.day.date.getTime() / 1000,
// startdatetime: this.day.date,
// year: this.day.date.getFullYear(),
// month: this.day.date.getMonth() + 1,
// day: this.day.date.getDate()
//})
}, },
methods: { methods: {
...mapActions({ ...mapActions({
@ -94,15 +253,32 @@ export default {
deleteUser: 'sm/deleteUser', deleteUser: 'sm/deleteUser',
setLoading: 'sm/setDayLoading', setLoading: 'sm/setDayLoading',
setNotLoading: 'sm/setDayNotLoading', setNotLoading: 'sm/setDayNotLoading',
lockDay: 'sm/lockDay' lockDay: 'sm/lockDay',
updateJobKindDate: 'sm/updateJobKindDate'
}), }),
// eslint-disable-next-line no-unused-vars forceRenderer(jobkind) {
remove(deletedUser) { console.log(jobkind)
const obj = this.day.worker.find(a => { this.update += 1
return a.username === deletedUser.username console.log('before', jobkind.worker, jobkind.backupWorker)
if (jobkind.backupWorker !== jobkind.worker && this.focused) {
let addedUser = null
for (let user in jobkind.worker) {
if (!jobkind.backupWorker.includes(jobkind.worker[user])) {
addedUser = jobkind.worker[user]
this.addUser({
date: this.day.date.getTime() / 1000,
user: addedUser,
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate(),
job_kind: jobkind.job_kind
}) })
const index = this.day.worker.indexOf(obj) }
if (index >= 0) this.day.worker.splice(index, 1) }
let deletedUser = null
for (let user in jobkind.backupWorker) {
if (!jobkind.worker.includes(jobkind.backupWorker[user])) {
deletedUser = jobkind.backupWorker[user]
this.deleteUser({ this.deleteUser({
startdatetime: this.day.date, startdatetime: this.day.date,
date: this.day.date.getTime() / 1000, date: this.day.date.getTime() / 1000,
@ -111,17 +287,35 @@ export default {
month: this.day.date.getMonth() + 1, month: this.day.date.getMonth() + 1,
day: this.day.date.getDate() day: this.day.date.getDate()
}) })
}
}
}
jobkind.backupWorker = [...jobkind.worker]
}, },
color: day => { // eslint-disable-next-line no-unused-vars
remove(jobkind, deletedUser) {
jobkind.worker.indexOf()
const obj = jobkind.worker.find(a => {
return a.username === deletedUser.username
})
const index = jobkind.worker.indexOf(obj)
if (index >= 0) jobkind.worker.splice(index, 1)
this.forceRenderer(jobkind)
},
color(day) {
if (day) { if (day) {
if (day.date.getDay() === 0 || day.date.getDay() === 1) { if (day.date.getDay() === 0 || day.date.getDay() === 1) {
return 'grey lighten-4' return 'grey lighten-4'
} else { } else {
if (day.worker.length < 2) { var retVal = 'yellow'
retVal = 'light-green'
for (var jobkind in day.jobkinddate) {
if (day.jobkinddate[jobkind].worker.length >= day.jobkinddate[jobkind].maxpersons)
retVal = 'light-green'
else
return 'yellow' return 'yellow'
} else {
return 'light-green'
} }
return retVal
} }
} else { } else {
return 'grey lighten-4' return 'grey lighten-4'
@ -134,16 +328,122 @@ export default {
day: this.day.date.getDate(), day: this.day.date.getDate(),
locked: !this.day.locked locked: !this.day.locked
}) })
},
createBarJobKindDate(maxpersons) {
this.day.jobkinddate.push({
id: -1,
job_kind: Object.assign(
{},
this.jobkinds.find(a => {
return a.id === 1
})
),
maxpersons: maxpersons,
daydate: {
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
},
worker: [],
backupWorker: []
})
},
addJobKindDate() {
this.day.jobkinddate.push({
id: -1,
job_kind: null,
maxpersons: 2,
new: true,
daydate: {
year: this.day.date.getFullYear(),
month: this.day.date.getMonth() + 1,
day: this.day.date.getDate()
},
worker: [],
backupWorker: []
})
},
mop(jobkind) {
console.log(jobkind.worker)
},
deleteJobKindDate(index) {
if (this.day.jobkinddate[index].id === -1) {
this.day.jobkinddate.splice(index, 1)
} else {
this.day.jobkinddate[index].backupid = this.day.jobkinddate[index].id
this.day.jobkinddate[index].id = 0
}
},
undoDelteJobKindDate(index) {
this.day.jobkinddate[index].id = this.day.jobkinddate[index].backupid
},
saveJobKind() {
this.updateJobKindDate({
data: this.day.jobkinddate,
date: this.day.date
})
this.dialog = false
},
filterWorker() {},
filterUser(jobkind) {
var filtered = this.dbUsers.filter(user => {
var test = this.day.jobkinddate.find(item => {
if (item.job_kind === null) {
return false
}
if (item.job_kind.id === jobkind.id) {
return false
}
return item.worker.find(work => {
return work.id === user.id
})
})
if (test) {
return false
}
if (jobkind.workgroup === null) {
return true
}
return user.workgroups.find(workgroup => {
if (jobkind.workgroup && workgroup) {
return jobkind.workgroup.id === workgroup.id
} else return true
})
})
return filtered
},
// eslint-disable-next-line no-unused-vars
filterJobKinds(jobkinddateitem, index) {
var retVal = this.jobkinds.filter(jobkind => {
return jobkind.id !== 1
})
retVal = retVal.filter(jobkind => {
return !this.day.jobkinddate.find(item => {
if (item.job_kind === jobkinddateitem.job_kind) {
return false
} else {
if (item.job_kind !== null && jobkind !== null)
if (item.job_kind.id === jobkind.id) return true
}
return false
})
})
return retVal
} }
}, },
computed: { computed: {
...mapGetters({ ...mapGetters({
allUsers: 'sm/allUsers', allUsers: 'sm/allUsers',
disabled: 'sm/disabled' dbUsers: 'usermanager/users',
disabled: 'sm/disabled',
jobkinds: 'jkm/jobkinds'
}), }),
worker() { worker() {
return this.day.worker return this.day.worker
}, },
tada() {
return this.day.jobkinddate
},
lockedColor() { lockedColor() {
return this.day.locked ? 'red' : 'green' return this.day.locked ? 'red' : 'green'
}, },
@ -152,6 +452,27 @@ export default {
}, },
lockedTextBtn() { lockedTextBtn() {
return this.day.locked ? 'freigeben' : 'sperren' return this.day.locked ? 'freigeben' : 'sperren'
},
isBarDienstIn() {
for (var jobkinddate in this.day.jobkinddate) {
if (!(this.day.jobkinddate[jobkinddate].job_kind === null))
if (this.day.jobkinddate[jobkinddate].job_kind.id === 1) return true
}
return false
},
existJobKinds() {
var retVal = [...this.jobkinds]
retVal.splice(
retVal.findIndex(a => {
return a.id === 1
}),
1
)
return retVal
},
disableAddBtn() {
var barset = this.isBarDienstIn ? 0 : 1
return this.day.jobkinddate.length === this.jobkinds.length - barset
} }
}, },
watch: { watch: {
@ -185,16 +506,15 @@ export default {
} }
} }
} }
},
dialog(newValue) {
if (newValue) {
this.backup = [...this.day.jobkinddate]
} else {
this.day.jobkinddate = [...this.backup]
this.backup = []
}
} }
//day() {
// this.getUser({
// date: this.day.date.getTime() / 1000,
// startdatetime: this.day.date,
// year: this.day.date.getFullYear(),
// month: this.day.date.getMonth() + 1,
// day: this.day.date.getDate()
// })
//}
} }
} }
</script> </script>

View File

@ -31,13 +31,15 @@ const url = {
addUser: main + 'sm/addUser', addUser: main + 'sm/addUser',
deleteUser: main + 'sm/deleteUser', deleteUser: main + 'sm/deleteUser',
getUser: main + 'sm/getUser', getUser: main + 'sm/getUser',
getUsers: main + 'sm/getUsers', getUsers: main + 'user/jobs',
lockDay: main + 'sm/lockDay', lockDay: main + 'sm/lockDay',
searchUser: main + 'sm/searchWithExtern', searchUser: main + 'sm/searchWithExtern',
jobkind: main + 'sm/JobKind', jobkind: main + 'sm/JobKind',
getAllJobKindsbKinds: main + 'sm/getAllJobKinds', getAllJobKindsbKinds: main + 'sm/getAllJobKinds',
getJobKind: main + 'sm/getJobKind', getJobKind: main + 'sm/getJobKind',
deleteJobKind: main + 'sm/deleteJobKind' deleteJobKind: main + 'sm/deleteJobKind',
updateJobKindDates: main + 'jk/JobKindDate',
getJobKindDates: main + 'jk/JobKindDate'
}, },
um: { um: {
setStatus: main + 'um/setStatus', setStatus: main + 'um/setStatus',

View File

@ -48,7 +48,8 @@ const mutations = {
name: 'Montag', name: 'Montag',
worker: [], worker: [],
loading: false, loading: false,
locked: false locked: false,
jobkinddate: []
} }
break break
case 2: case 2:
@ -58,7 +59,8 @@ const mutations = {
name: 'Dienstag', name: 'Dienstag',
worker: [], worker: [],
loading: false, loading: false,
locked: false locked: false,
jobkinddate: []
} }
break break
case 3: case 3:
@ -73,7 +75,8 @@ const mutations = {
name: 'Mittwoch', name: 'Mittwoch',
worker: [], worker: [],
loading: false, loading: false,
locked: false locked: false,
jobkinddate: []
} }
} }
break break
@ -84,7 +87,8 @@ const mutations = {
name: 'Donnerstag', name: 'Donnerstag',
worker: [], worker: [],
loading: false, loading: false,
locked: false locked: false,
jobkinddate: []
} }
break break
case 5: case 5:
@ -94,7 +98,8 @@ const mutations = {
name: 'Freitag', name: 'Freitag',
worker: [], worker: [],
loading: false, loading: false,
locked: false locked: false,
jobkinddate: []
} }
break break
case 6: case 6:
@ -104,7 +109,8 @@ const mutations = {
name: 'Samstag', name: 'Samstag',
worker: [], worker: [],
loading: false, loading: false,
locked: false locked: false,
jobkinddate: []
} }
break break
case 0: case 0:
@ -114,7 +120,8 @@ const mutations = {
name: 'Sontag', name: 'Sontag',
worker: [], worker: [],
loading: false, loading: false,
locked: false locked: false,
jobkinddate: []
} }
break break
} }
@ -155,31 +162,71 @@ const mutations = {
week.endDate = week.days.monday.date week.endDate = week.days.monday.date
} }
}, },
updateMonth: (state, data) => { // eslint-disable-next-line no-unused-vars
const date = new Date(data.start.year, data.start.month - 1, data.start.day) updateMonthWorker: (state, { workers, date, getters }) => {
const user = data.user var day = getters.getDay(date)
for (let week = 0; week < state.month.length; week++) { for (var worker in workers) {
for (let day in state.month[week].days) { var jobkind = day.jobkinddate.find(jobkind => {
if (state.month[week].days[day].date - date === 0) { return (
if (user) { jobkind.job_kind.id ===
let worker = state.month[week].days[day].worker.find(a => { (workers[worker].job_kind ? workers[worker].job_kind.id : 1)
return a.username === user.username )
}) })
if (!worker && data.com === 'add') { if (jobkind) {
state.month[week].days[day].worker.push({ jobkind.worker.push(workers[worker].user)
firstname: user.firstname, jobkind.backupWorker.push(workers[worker].user)
lastname: user.lastname, }
username: user.username, }
fullName: user.firstname + ' ' + user.lastname },
updateMonthLocked: (state, { locked, date, getters }) => {
var day = getters.getDay(date)
day.locked = !!locked
},
updateMonthJobkind: (state, { data, date, getters }) => {
let day = getters.getDay(date)
var backup = []
for (let jobkind in day.jobkinddate) {
if (day.jobkinddate[jobkind].worker !== undefined) {
backup.push({
id: day.jobkinddate[jobkind].job_kind.id,
worker: day.jobkinddate[jobkind].worker,
backupWorker: day.jobkinddate[jobkind].backupWorker
})
} else {
backup.push({
id: day.jobkinddate[jobkind].job_kind.id,
worker: [],
backupWorker: []
}) })
} }
} }
if (data.day) { day.jobkinddate = [...data]
state.month[week].days[day].locked = data.day.locked var test = day.jobkinddate.find(jobkind => {
} return jobkind.job_kind.id === 1
} })
if (!test) {
day.jobkinddate.push({
id: -1,
job_kind: { id: 1, name: 'Bardienst' },
maxpersons: 2,
daydate: {
year: date.getFullYear(),
month: date.getMonth() + 1,
day: date.getDate()
},
worker: [],
backupWorker: []
})
} }
for (var jobkind in day.jobkinddate) {
var worker = backup.find(item => {
return item.id === day.jobkinddate[jobkind].job_kind.id
})
day.jobkinddate[jobkind].worker = worker ? worker.worker : []
day.jobkinddate[jobkind].backupWorker = worker ? worker.backupWorker : []
} }
}, },
setAllDayLoading: state => { setAllDayLoading: state => {
for (let week = 0; week < state.month.length; week++) { for (let week = 0; week < state.month.length; week++) {
@ -221,6 +268,7 @@ const actions = {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
async addUser({ commit, rootState, dispatch }, data) { async addUser({ commit, rootState, dispatch }, data) {
try { try {
// eslint-disable-next-line no-unused-vars
const response = await axios.post( const response = await axios.post(
url.vorstand.sm.addUser, url.vorstand.sm.addUser,
{ ...data }, { ...data },
@ -228,7 +276,7 @@ const actions = {
headers: { Token: rootState.login.user.accessToken } headers: { Token: rootState.login.user.accessToken }
} }
) )
commit('updateMonth', { ...response.data[0], com: 'add' }) //commit('updateMonth', { ...response.data[0], com: 'add' })
dispatch('getLifeTime', null, { root: true }) dispatch('getLifeTime', null, { root: true })
} catch (e) { } catch (e) {
if (e.response) if (e.response)
@ -244,24 +292,29 @@ const actions = {
{ ...data }, { ...data },
{ headers: { Token: rootState.login.user.accessToken } } { headers: { Token: rootState.login.user.accessToken } }
) )
for (let day in response.data) { console.log(response.data)
for (let item = 0; item < response.data[day].worker.length; item++) { for (var day in response.data) {
commit('updateMonth', {
...response.data[day].worker[item],
com: 'add',
day: response.data[day].day
})
}
commit('updateMonth', {
start: response.data[day].day.date,
day: response.data[day].day
})
var date = new Date( var date = new Date(
response.data[day].day.date.year, response.data[day].day.date.year,
response.data[day].day.date.month - 1, response.data[day].day.date.month - 1,
response.data[day].day.date.day response.data[day].day.date.day
) )
commit('setDayNotLoading', { date: date, getters }) commit('updateMonthJobkind', {
data: [...response.data[day].jobkinddate],
date,
getters
})
commit('updateMonthWorker', {
workers: [...response.data[day].worker],
date,
getters
})
commit('updateMonthLocked', {
locked: response.data[day].day.locked,
date,
getters
})
commit('setDayNotLoading', { date, getters })
} }
} catch (e) { } catch (e) {
if (e.response) if (e.response)
@ -303,7 +356,7 @@ const actions = {
{ ...data }, { ...data },
{ headers: { Token: rootState.login.user.accessToken } } { headers: { Token: rootState.login.user.accessToken } }
) )
commit('updateMonth', { ...data, com: 'delete' }) //commit('updateMonth', { ...data, com: 'delete' })
dispatch('getLifeTime', null, { root: true }) dispatch('getLifeTime', null, { root: true })
} catch (e) { } catch (e) {
if (e.response) if (e.response)
@ -324,6 +377,25 @@ const actions = {
if (e.response.status === 401) dispatch('logout', null, { root: true }) if (e.response.status === 401) dispatch('logout', null, { root: true })
} }
}, },
async updateJobKindDate(
{ commit, rootState, dispatch, getters },
{ data, date }
) {
try {
commit('setDayLoading', { date, getters })
const response = await axios.post(
url.vorstand.sm.updateJobKindDates,
[...data],
{ headers: { Token: rootState.login.user.accessToken } }
)
commit('updateMonthJobkind', { data: response.data, date, getters })
commit('setDayNotLoading', { date, getters })
dispatch('getLifeTime', null, { root: true })
} catch (e) {
if (e.response)
if (e.response.status === 401) dispatch('logout', null, { root: true })
}
},
setDayLoading({ commit, getters }, date) { setDayLoading({ commit, getters }, date) {
commit('setDayLoading', { date, getters }) commit('setDayLoading', { date, getters })
}, },