added actions for finanzer to send automaticly emails
some bugfixes
This commit is contained in:
parent
32a01cb5e3
commit
bb400f29d0
|
@ -10,9 +10,26 @@
|
||||||
</v-toolbar-items>
|
</v-toolbar-items>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<v-toolbar-items>
|
<v-toolbar-items>
|
||||||
|
<v-btn text @click="sendMails">Emails senden</v-btn>
|
||||||
<v-text-field v-model="filter" @input="filterUser" style="margin-top: 3px" append-icon="search" outlined></v-text-field>
|
<v-text-field v-model="filter" @input="filterUser" style="margin-top: 3px" append-icon="search" outlined></v-text-field>
|
||||||
</v-toolbar-items>
|
</v-toolbar-items>
|
||||||
</v-toolbar>
|
</v-toolbar>
|
||||||
|
<v-expand-transition>
|
||||||
|
<v-card style="margin-top: 3px" v-show="emailErrors">
|
||||||
|
<v-row>
|
||||||
|
<v-spacer/>
|
||||||
|
<v-btn text icon style="margin-right: 5px"
|
||||||
|
@click="errorExpand ? errorExpand = false : errorExpand = true">
|
||||||
|
<v-icon :class="isExpand(errorExpand)" dense>$expand</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</v-row>
|
||||||
|
<v-alert v-for="error in emailErrors" :key="emailErrors.indexOf(error)"
|
||||||
|
dense
|
||||||
|
:type="computeError(error.error)"
|
||||||
|
v-show="errorExpand">{{errorMessage(error)}}
|
||||||
|
</v-alert>
|
||||||
|
</v-card>
|
||||||
|
</v-expand-transition>
|
||||||
<div v-for="user in filteredUsers" :key="filteredUsers.indexOf(user)">
|
<div v-for="user in filteredUsers" :key="filteredUsers.indexOf(user)">
|
||||||
<v-card v-if="user.creditList[year]"
|
<v-card v-if="user.creditList[year]"
|
||||||
style="margin-top: 3px">
|
style="margin-top: 3px">
|
||||||
|
@ -107,10 +124,13 @@
|
||||||
components: {Table},
|
components: {Table},
|
||||||
props: {
|
props: {
|
||||||
users: Array,
|
users: Array,
|
||||||
|
emailErrors: Array,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
|
errorExpand: false,
|
||||||
|
|
||||||
year: new Date().getFullYear(),
|
year: new Date().getFullYear(),
|
||||||
filter: "",
|
filter: "",
|
||||||
filteredUsers: [],
|
filteredUsers: [],
|
||||||
|
@ -196,6 +216,17 @@
|
||||||
},
|
},
|
||||||
getLockedColor (value) {
|
getLockedColor (value) {
|
||||||
return value ? 'red' : 'green'
|
return value ? 'red' : 'green'
|
||||||
|
},
|
||||||
|
sendMails() {
|
||||||
|
this.$emit("send:mails")
|
||||||
|
},
|
||||||
|
computeError(error) {
|
||||||
|
if (error) return 'error'
|
||||||
|
else return 'success'
|
||||||
|
},
|
||||||
|
errorMessage(error) {
|
||||||
|
if (error.error) return 'Konnte Email an ' + error.user.firstname + ' ' + error.user.lastname + ' nicht senden!'
|
||||||
|
else return 'Email wurde an ' + error.user.firstname + ' ' + error.user.lastname + ' versandt.'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -2,7 +2,18 @@
|
||||||
<div>
|
<div>
|
||||||
<v-toolbar tile>
|
<v-toolbar tile>
|
||||||
<v-toolbar-title>{{user.lastname}}, {{user.firstname}}</v-toolbar-title>
|
<v-toolbar-title>{{user.lastname}}, {{user.firstname}}</v-toolbar-title>
|
||||||
|
<v-spacer/>
|
||||||
|
<v-toolbar-items>
|
||||||
|
<v-btn @click="sendEmail" text>Email senden</v-btn>
|
||||||
|
</v-toolbar-items>
|
||||||
</v-toolbar>
|
</v-toolbar>
|
||||||
|
<v-expand-transition>
|
||||||
|
<v-card style="margin-top: 3px" v-show="emailError">
|
||||||
|
<v-alert dense :type="computeError(emailError)">
|
||||||
|
{{errorMessage(emailError)}}
|
||||||
|
</v-alert>
|
||||||
|
</v-card>
|
||||||
|
</v-expand-transition>
|
||||||
<v-card style="margin-top: 3px;">
|
<v-card style="margin-top: 3px;">
|
||||||
<v-card-title>Konfiguration</v-card-title>
|
<v-card-title>Konfiguration</v-card-title>
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
|
@ -105,6 +116,7 @@
|
||||||
components: {Table},
|
components: {Table},
|
||||||
props: {
|
props: {
|
||||||
user: Object,
|
user: Object,
|
||||||
|
emailError: null,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -181,6 +193,21 @@
|
||||||
this.selectedMonth = {value: new Date().getMonth() + 1, text: ["Januar", "Februar", "März", "April", "Mai", "Juni",
|
this.selectedMonth = {value: new Date().getMonth() + 1, text: ["Januar", "Februar", "März", "April", "Mai", "Juni",
|
||||||
"Juli", "August", "September", "Oktober", "November", "Dezember"
|
"Juli", "August", "September", "Oktober", "November", "Dezember"
|
||||||
][new Date().getMonth()]}
|
][new Date().getMonth()]}
|
||||||
|
},
|
||||||
|
sendEmail() {
|
||||||
|
this.$emit("send:mail", {username: this.user.username})
|
||||||
|
},
|
||||||
|
computeError(error) {
|
||||||
|
if (error) {
|
||||||
|
if (error.error) return 'error'
|
||||||
|
else return 'success'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
errorMessage(error) {
|
||||||
|
if (error) {
|
||||||
|
if (error.error) return 'Konnte Email an ' + error.user.firstname + ' ' + error.user.lastname + ' nicht senden!'
|
||||||
|
else return 'Email wurde an ' + error.user.firstname + ' ' + error.user.lastname + ' versandt.'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -41,10 +41,17 @@ class Service {
|
||||||
finanzerAddUser(token, data) {
|
finanzerAddUser(token, data) {
|
||||||
return axios.post(this.url+'finanzerAddUser', {...data}, {headers: {Token: token}})
|
return axios.post(this.url+'finanzerAddUser', {...data}, {headers: {Token: token}})
|
||||||
}
|
}
|
||||||
|
finanzerSendAllMail(token) {
|
||||||
|
return axios.get(this.url+"finanzerSendAllMail", {headers: {Token: token}})
|
||||||
|
}
|
||||||
|
finanzerSendOneMail(token, data) {
|
||||||
|
return axios.post(this.url+"finanzerSendOneMail", {...data}, {headers: {Token: token}})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpClient = new Service("http://localhost:5000/")
|
//const httpClient = new Service("http://localhost:5000/")
|
||||||
//const httpClient = new Service("http://192.168.5.118:5000/")
|
//const httpClient = new Service("http://192.168.5.118:5000/")
|
||||||
//const httpClient = new Service("http://groeger-clan.duckdns.org:5000/")
|
//const httpClient = new Service("http://192.168.5.128:5000/")
|
||||||
|
const httpClient = new Service("http://groeger-clan.duckdns.org:5000/")
|
||||||
|
|
||||||
export default httpClient
|
export default httpClient
|
||||||
|
|
|
@ -91,8 +91,8 @@
|
||||||
firstname: response.data.firstname,
|
firstname: response.data.firstname,
|
||||||
lastname: response.data.lastname,
|
lastname: response.data.lastname,
|
||||||
locked: response.data.locked,
|
locked: response.data.locked,
|
||||||
amount: 0,
|
amount: response.data.amount,
|
||||||
type: null
|
type: response.data.type
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -39,10 +39,12 @@
|
||||||
</template>
|
</template>
|
||||||
</v-navigation-drawer>
|
</v-navigation-drawer>
|
||||||
<v-content v-if="!activeUser.username">
|
<v-content v-if="!activeUser.username">
|
||||||
<Overview v-bind:users="users" @add:amount="addAmount" @add:credit="addCredit"/>
|
<Overview v-bind:users="users" v-bind:emailErrors="errorMails" @add:amount="addAmount" @add:credit="addCredit" @send:mails="sendMails"/>
|
||||||
</v-content>
|
</v-content>
|
||||||
<v-content v-else>
|
<v-content v-else>
|
||||||
<User v-bind:user="activeUser"
|
<User v-bind:user="activeUser"
|
||||||
|
v-bind:emailError="errorMail"
|
||||||
|
@send:mail="sendMail"
|
||||||
@add:amount="addAmount" @add:credit="addCredit"
|
@add:amount="addAmount" @add:credit="addCredit"
|
||||||
@do:lock="doLock" @save:config="saveConfig"/>
|
@do:lock="doLock" @save:config="saveConfig"/>
|
||||||
</v-content>
|
</v-content>
|
||||||
|
@ -76,15 +78,19 @@
|
||||||
username: null,
|
username: null,
|
||||||
},
|
},
|
||||||
allUsers: [],
|
allUsers: [],
|
||||||
user: null
|
user: null,
|
||||||
|
errorMails: null,
|
||||||
|
errorMail: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
test (e) {
|
test (e) {
|
||||||
if (this.activeUser.username === e.username) {
|
if (this.activeUser.username === e.username) {
|
||||||
this.activeUser = {username: null}
|
this.activeUser = {username: null}
|
||||||
|
this.errorMail = null
|
||||||
} else {
|
} else {
|
||||||
this.activeUser = e
|
this.activeUser = e
|
||||||
|
this.errorMail = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
createAmount(creditList) {
|
createAmount(creditList) {
|
||||||
|
@ -319,6 +325,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
sendMails() {
|
||||||
|
httpClient.finanzerSendAllMail(this.$store.getters.getToken)
|
||||||
|
.then(response => {
|
||||||
|
this.errorMails = response.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sendMail(data) {
|
||||||
|
httpClient.finanzerSendOneMail(this.$store.getters.getToken, {userId: data.username})
|
||||||
|
.then(response => {
|
||||||
|
this.errorMail = response.data
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue