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-spacer></v-spacer>
|
||||
<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-toolbar-items>
|
||||
</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)">
|
||||
<v-card v-if="user.creditList[year]"
|
||||
style="margin-top: 3px">
|
||||
|
@ -107,10 +124,13 @@
|
|||
components: {Table},
|
||||
props: {
|
||||
users: Array,
|
||||
emailErrors: Array,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
||||
errorExpand: false,
|
||||
|
||||
year: new Date().getFullYear(),
|
||||
filter: "",
|
||||
filteredUsers: [],
|
||||
|
@ -196,6 +216,17 @@
|
|||
},
|
||||
getLockedColor (value) {
|
||||
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: {
|
||||
|
|
|
@ -2,7 +2,18 @@
|
|||
<div>
|
||||
<v-toolbar tile>
|
||||
<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-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-title>Konfiguration</v-card-title>
|
||||
<v-card-text>
|
||||
|
@ -105,6 +116,7 @@
|
|||
components: {Table},
|
||||
props: {
|
||||
user: Object,
|
||||
emailError: null,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
@ -181,6 +193,21 @@
|
|||
this.selectedMonth = {value: new Date().getMonth() + 1, text: ["Januar", "Februar", "März", "April", "Mai", "Juni",
|
||||
"Juli", "August", "September", "Oktober", "November", "Dezember"
|
||||
][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: {
|
||||
|
|
|
@ -41,10 +41,17 @@ class Service {
|
|||
finanzerAddUser(token, data) {
|
||||
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://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
|
||||
|
|
|
@ -91,8 +91,8 @@
|
|||
firstname: response.data.firstname,
|
||||
lastname: response.data.lastname,
|
||||
locked: response.data.locked,
|
||||
amount: 0,
|
||||
type: null
|
||||
amount: response.data.amount,
|
||||
type: response.data.type
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -39,10 +39,12 @@
|
|||
</template>
|
||||
</v-navigation-drawer>
|
||||
<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-else>
|
||||
<User v-bind:user="activeUser"
|
||||
v-bind:emailError="errorMail"
|
||||
@send:mail="sendMail"
|
||||
@add:amount="addAmount" @add:credit="addCredit"
|
||||
@do:lock="doLock" @save:config="saveConfig"/>
|
||||
</v-content>
|
||||
|
@ -76,15 +78,19 @@
|
|||
username: null,
|
||||
},
|
||||
allUsers: [],
|
||||
user: null
|
||||
user: null,
|
||||
errorMails: null,
|
||||
errorMail: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
test (e) {
|
||||
if (this.activeUser.username === e.username) {
|
||||
this.activeUser = {username: null}
|
||||
this.errorMail = null
|
||||
} else {
|
||||
this.activeUser = e
|
||||
this.errorMail = null
|
||||
}
|
||||
},
|
||||
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