From e90dbf65137246c3668ccab753616fbd4c7056c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 25 Feb 2020 22:34:45 +0100 Subject: [PATCH] finished ##169 and ##170 user can transact a Job, if the transact accepted the user can delete his job user can decline or accept a jobrequest --- src/components/user/JobRequests.vue | 250 +++++++++++++++++++++++++ src/components/user/Jobs.vue | 4 +- src/components/user/Jobs/Day.vue | 91 ++++++++- src/components/user/UserNavigation.vue | 29 ++- src/plugins/routes.js | 7 +- src/router/index.js | 6 + src/store/index.js | 4 +- src/store/modules/jobRequests.js | 161 ++++++++++++++++ src/store/modules/jobs.js | 50 ++++- 9 files changed, 584 insertions(+), 18 deletions(-) create mode 100644 src/components/user/JobRequests.vue create mode 100644 src/store/modules/jobRequests.js diff --git a/src/components/user/JobRequests.vue b/src/components/user/JobRequests.vue new file mode 100644 index 0000000..1260bb8 --- /dev/null +++ b/src/components/user/JobRequests.vue @@ -0,0 +1,250 @@ + + + + + diff --git a/src/components/user/Jobs.vue b/src/components/user/Jobs.vue index a50bef1..77e322d 100644 --- a/src/components/user/Jobs.vue +++ b/src/components/user/Jobs.vue @@ -73,10 +73,12 @@ export default { }, created() { this.createMonth(this.date) + this.getAllUsers() }, methods: { ...mapActions({ - createMonth: 'jobs/createMonth' + createMonth: 'jobs/createMonth', + getAllUsers: 'jobs/getAllUsers' }), changeMonth(value) { if (value === -1) { diff --git a/src/components/user/Jobs/Day.vue b/src/components/user/Jobs/Day.vue index f14941a..7c14f9c 100644 --- a/src/components/user/Jobs/Day.vue +++ b/src/components/user/Jobs/Day.vue @@ -17,7 +17,7 @@
+ + + + + + + + senden + +
@@ -45,7 +74,10 @@
Eintragen + >Eintragen +
@@ -71,7 +103,8 @@ export default { data() { return { account_add: mdiAccountPlus, - searchInput: null + searchInput: null, + requestUser: null } }, created() { @@ -83,18 +116,36 @@ export default { month: this.day.date.getMonth() + 1, day: this.day.date.getDate() }) + this.getTransactJobs({}) + this.getTransactJobs({ + year: this.day.date.getFullYear(), + month: this.day.date.getMonth() + 1, + day: this.day.date.getDate() + }) }, methods: { ...mapActions({ + getTransactJobs: 'requestJobs/getTransactJobs', getUser: 'jobs/getUser', setLoading: 'jobs/setDayLoading', setNotLoading: 'jobs/setDayNotLoading', addJob: 'jobs/addJob', - deleteJob: 'jobs/deleteJob' + deleteJob: 'jobs/deleteJob', + transactJob: 'jobs/transactJob' }), test(event) { console.log('blur', event) }, + send() { + this.transactJob({ + user: this.requestUser.username, + year: this.day.date.getFullYear(), + month: this.day.date.getMonth() + 1, + day: this.day.date.getDate() + }) + this.requestUser = null + this.searchInput = null + }, color: day => { if (day) { if (day.date.getDay() === 0 || day.date.getDay() === 1) { @@ -117,12 +168,38 @@ export default { computed: { ...mapGetters({ disabled: 'jobs/disabled', - activeUser: 'user' + activeUser: 'user', + allUsers: 'jobs/allUsers', + transactJobs: 'requestJobs/transactJobs' }), userInWorker() { return this.day.worker.find(a => { return a.username === this.activeUser.username }) + }, + specifiedUsers() { + var users = [...this.allUsers] + for (var i in this.day.worker) { + var worker = users.find(a => { + return a.username === this.day.worker[i].username + }) + var index = users.indexOf(worker) + if (worker) users.splice(index, 1) + } + return users + }, + canDelete() { + console.log(this.day.date) + console.log(this.transactJobs) + var transactJob = this.transactJobs.filter(a => { + return a.date - this.day.date === 0 + }) + console.log('filter', transactJob) + var test = transactJob.find(a => { + return a.accepted && a.answerd + }) + console.log('find', test) + return test } }, watch: { diff --git a/src/components/user/UserNavigation.vue b/src/components/user/UserNavigation.vue index ade5ca4..a9aa1b0 100644 --- a/src/components/user/UserNavigation.vue +++ b/src/components/user/UserNavigation.vue @@ -2,7 +2,7 @@ - {{account}} + {{ account }} Home @@ -10,21 +10,29 @@ - {{bank}} + {{ bank }} Finanzübersicht - {{briefcase}} + {{ briefcase }} Dienstübersicht + + + + {{ switchAccount }} + + + Dienstanfragen + - {{account_card_details}} + {{ account_card_details }} Einstellung @@ -32,15 +40,22 @@