From 15f43d735113e4951cfaaabb388fccb940c76df4 Mon Sep 17 00:00:00 2001 From: ogerly Date: Wed, 17 Mar 2021 09:33:42 +0100 Subject: [PATCH 01/24] add work reprt in the community skellet --- frontend/src/App.vue | 29 ++- frontend/src/apis/communityAPI.js | 3 + frontend/src/apis/loginAPI.js | 3 + .../components/Breadcrumb/RouteBreadcrumb.vue | 2 +- .../src/components/SidebarPlugin/SideBar.vue | 44 ++-- frontend/src/plugins/dashboard-plugin.js | 2 + frontend/src/routes/routes.js | 15 +- frontend/src/store/store.js | 6 +- frontend/src/views/AdminOverview.vue | 2 + frontend/src/views/KontoOverview.vue | 36 +-- .../src/views/KontoOverview/GddAddWork.vue | 9 + .../src/views/KontoOverview/GddAddWork2.vue | 240 ++++++++++++++++++ frontend/src/views/KontoOverview/GddTable.vue | 3 + .../src/views/KontoOverview/GddWorkTable.vue | 27 +- frontend/src/views/Landing.vue | 2 +- frontend/src/views/Layout/AdminLayout.vue | 2 +- frontend/src/views/Layout/AuthLayout.vue | 4 +- frontend/src/views/Layout/AuthLayout_gdd.vue | 10 +- frontend/src/views/Layout/DashboardLayout.vue | 10 +- frontend/src/views/Layout/DashboardNavbar.vue | 12 +- frontend/src/views/NotFoundPage.vue | 2 +- .../src/views/Pages/UserProfile/UserCard.vue | 2 +- 22 files changed, 354 insertions(+), 111 deletions(-) create mode 100644 frontend/src/views/KontoOverview/GddAddWork2.vue diff --git a/frontend/src/App.vue b/frontend/src/App.vue index da80c328f..52976cf65 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -4,8 +4,7 @@
- - +
@@ -19,17 +18,25 @@ export default { components: { ParticlesBg }, - created () { - //console.log("this.$cookies.get('gdd_session_id') ", this.$cookies.get('gdd_session_id') ) - console.log(" $cookies.isKey('gdd_session_id') ", this.$cookies.isKey("gdd_session_id") ) - if ( this.$cookies.isKey('gdd_session_id') ) { + mounted() { + console.log("mounted") + console.log(" $cookies.get('gdd_session_id') ", $cookies.get("gdd_session_id") ) + console.log(" $cookies.isKey('gdd_session_id') ", $cookies.isKey("gdd_session_id") ) + const isSession = $cookies.isKey("gdd_session_id") + const getSession = $cookies.get("gdd_session_id") + console.log("this.isSession ", this.isSession ) + + if ( $cookies.isKey("gdd_session_id")) { //this.$store.state.email = this.$cookies.get('gdd_u') - console.log("login to kontooverview") - this.$router.push('/KontoOverview') + console.log("router to overview") + this.$router.push("/overview") }else { - console.log("login to LOGIN") - this.$router.push("/Login") + console.log("router to LOGIN") + //this.$router.push("/login") } + }, + created () { + console.log("created") }, data() { return { @@ -52,7 +59,7 @@ export default { } diff --git a/frontend/src/views/Layout/DashboardNavbar.vue b/frontend/src/views/Layout/DashboardNavbar.vue index 806afc6c5..a736e45d2 100755 --- a/frontend/src/views/Layout/DashboardNavbar.vue +++ b/frontend/src/views/Layout/DashboardNavbar.vue @@ -15,19 +15,7 @@ - - + {{this.$store.state.email}} diff --git a/frontend/src/views/Pages/Login.vue b/frontend/src/views/Pages/Login.vue index cf7427415..9550e5466 100755 --- a/frontend/src/views/Pages/Login.vue +++ b/frontend/src/views/Pages/Login.vue @@ -82,6 +82,18 @@ onSubmit() { this.$store.dispatch('login', {"email": this.model.email, "password": this.model.password}) } - } + }, + created () { + console.log("login.vue created") + + if ( $cookies.isKey("gdd_session_id")) { + //this.$store.state.email = this.$cookies.get('gdd_u') + console.log("login to overview") + this.$router.push("/overview") + }else { + console.log("login to LOGIN") + //this.$router.push("/login") + } + }, } diff --git a/frontend/src/views/Pages/UserProfile/UserCard.vue b/frontend/src/views/Pages/UserProfile/UserCard.vue index e698844a9..e55a9f1f5 100755 --- a/frontend/src/views/Pages/UserProfile/UserCard.vue +++ b/frontend/src/views/Pages/UserProfile/UserCard.vue @@ -4,7 +4,7 @@ From 1949260452d64b4ce8051aafba45b0befc1e5ac7 Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Thu, 18 Mar 2021 12:55:04 +0000 Subject: [PATCH 08/24] fix bugs with begin of decay implementation --- .../src/Model/Entity/StateBalance.php | 19 +++++++++++++++---- .../Model/Transactions/TransactionBody.php | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/community_server/src/Model/Entity/StateBalance.php b/community_server/src/Model/Entity/StateBalance.php index 174e785b4..871c55bd8 100644 --- a/community_server/src/Model/Entity/StateBalance.php +++ b/community_server/src/Model/Entity/StateBalance.php @@ -35,6 +35,15 @@ class StateBalance extends Entity protected $_virtual = ['decay']; + private function convertToTimestamp($dateOrTime) + { + if(method_exists($dateOrTime, 'getTimestamp')) { + return $dateOrTime->getTimestamp(); + } else { + return $dateOrTime->i18nFormat(Time::UNIX_TIMESTAMP_FORMAT); + } + } + protected function _getDecay() { // decay factor in seconds per year @@ -44,7 +53,7 @@ class StateBalance extends Entity // SELECT TIMESTAMPDIFF(SECOND, modified, CURDATE()) AS age_in_seconds from state_balances // decay_for_duration = decay_factor^seconds // decay = gradido_cent * decay_for_duration - $decay_duration = intval(Time::now()->getTimestamp() - $this->record_date->getTimestamp()); + $decay_duration = $this->decayDuration(Time::now()); if($decay_duration === 0) { return $this->amount; } @@ -53,7 +62,8 @@ class StateBalance extends Entity } public function partDecay($target_date) { - $decay_duration = intval($target_date->getTimestamp() - $this->record_date->getTimestamp()); + if($target_date == null) return 0; + $decay_duration = $this->decayDuration($target_date); if($decay_duration <= 0) { return $this->amount; } @@ -61,7 +71,8 @@ class StateBalance extends Entity } public function decayDuration($target_date) - { - return intval($target_date->getTimestamp() - $this->record_date->getTimestamp()); + { + if($this->record_date == null) return 0; + return intval($this->convertToTimestamp($target_date) - $this->record_date->getTimestamp()); } } diff --git a/community_server/src/Model/Transactions/TransactionBody.php b/community_server/src/Model/Transactions/TransactionBody.php index 8164f33f7..ef785705c 100644 --- a/community_server/src/Model/Transactions/TransactionBody.php +++ b/community_server/src/Model/Transactions/TransactionBody.php @@ -3,6 +3,7 @@ namespace Model\Transactions; use Cake\ORM\TableRegistry; +use Cake\I18n\Date; class TransactionBody extends TransactionBase { private $mProtoTransactionBody = null; @@ -75,6 +76,7 @@ class TransactionBody extends TransactionBase { $transactionEntity->transaction_type_id = $this->transactionTypeId; $transactionEntity->memo = $this->getMemo(); + $transactionEntity->received = new Date(); if ($transactionsTable->save($transactionEntity)) { // success From 21aa8b9cc2024a0cfdab11e0309b3b1f3c8cbfd9 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 18 Mar 2021 15:02:54 +0100 Subject: [PATCH 09/24] fix-cookies-get-set --- frontend/src/App.vue | 17 ++++++++++------- frontend/src/store/store.js | 4 ++-- frontend/src/views/Layout/DashboardNavbar.vue | 4 +++- frontend/src/views/Pages/Login.vue | 18 +++--------------- frontend/src/views/Pages/Password.vue | 4 ++-- frontend/src/views/Pages/Register.vue | 4 ++-- 6 files changed, 22 insertions(+), 29 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 28669abef..38fb24619 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -25,18 +25,21 @@ export default { console.log("created") // console.log(" $cookies.get('gdd_session_id') ", $cookies.get("gdd_session_id") ) - console.log("app.vue $cookies.isKey('gdd_session_id') ", $cookies.isKey("gdd_session_id") ) - const isSession = $cookies.isKey("gdd_session_id") - // const getSession = $cookies.get("gdd_session_id") - // console.log("this.isSession ", this.isSession ) - console.log("xx", ( isSession == true)) + // console.log("app.vue $cookies.isKey('gdd_session_id') ", $cookies.isKey("gdd_session_id") ) + // const isSession = $cookies.isKey("gdd_session_id") + // const getSession = $cookies.get("gdd_session_id") + // console.log("this.isSession ", this.isSession ) + // console.log("xx", ( isSession == true)) if ( $cookies.isKey("gdd_session_id") == true) { //this.$store.state.email = this.$cookies.get('gdd_u') + console.log("cookies to store.state") + this.$store.commit('session_id', $cookies.get("gdd_session_id")) + this.$store.commit('email', $cookies.get("gdd_u")) console.log("app to overview") this.$router.push("overview") }else { - console.log("router to LOGIN") - //this.$router.push("/login") + console.log("app.vue to LOout") + this.$store.dispatch('logout') } }, data() { diff --git a/frontend/src/store/store.js b/frontend/src/store/store.js index 4fdb4d201..f87db8347 100644 --- a/frontend/src/store/store.js +++ b/frontend/src/store/store.js @@ -154,8 +154,8 @@ export const store = new Vuex.Store({ console.log('action: dispatch', dispatch) console.log('action: state.session_id', state.session_id) console.log(" action: $cookies.get('gdd_session_id') ", $cookies.get("gdd_session_id") ) - commit('session_id', $cookies.get("gdd_session_id")) - commit('email', $cookies.get("gdd_u")) + // commit('session_id', $cookies.get("gdd_session_id")) + // commit('email', $cookies.get("gdd_u")) const result = await communityAPI.balance($cookies.get("gdd_session_id")) console.log("accountBalance result", result) if(result.success) { diff --git a/frontend/src/views/Layout/DashboardNavbar.vue b/frontend/src/views/Layout/DashboardNavbar.vue index a736e45d2..4c6f9f6c0 100755 --- a/frontend/src/views/Layout/DashboardNavbar.vue +++ b/frontend/src/views/Layout/DashboardNavbar.vue @@ -4,7 +4,9 @@ class="navbar-top navbar-expand" :class="{'navbar-dark': type === 'default'}" > - {{$route.name}} + + {{$route.name}} + diff --git a/frontend/src/views/Pages/Login.vue b/frontend/src/views/Pages/Login.vue index 9550e5466..71c1616f6 100755 --- a/frontend/src/views/Pages/Login.vue +++ b/frontend/src/views/Pages/Login.vue @@ -6,8 +6,8 @@
-

Gradido Wallet

-

{{ $t('site.login.community')}}

+

Gradido Wallet

+

{{ $t('site.login.community')}}

@@ -82,18 +82,6 @@ onSubmit() { this.$store.dispatch('login', {"email": this.model.email, "password": this.model.password}) } - }, - created () { - console.log("login.vue created") - - if ( $cookies.isKey("gdd_session_id")) { - //this.$store.state.email = this.$cookies.get('gdd_u') - console.log("login to overview") - this.$router.push("/overview") - }else { - console.log("login to LOGIN") - //this.$router.push("/login") - } - }, + } } diff --git a/frontend/src/views/Pages/Password.vue b/frontend/src/views/Pages/Password.vue index af1dc5bc2..dc18a1cc7 100644 --- a/frontend/src/views/Pages/Password.vue +++ b/frontend/src/views/Pages/Password.vue @@ -5,8 +5,8 @@
-

{{ $t('site.password.title')}}

-

{{ $t('site.password.subtitle')}}

+

{{ $t('site.password.title')}}

+

{{ $t('site.password.subtitle')}}

diff --git a/frontend/src/views/Pages/Register.vue b/frontend/src/views/Pages/Register.vue index e3eb84805..d6592addd 100755 --- a/frontend/src/views/Pages/Register.vue +++ b/frontend/src/views/Pages/Register.vue @@ -6,8 +6,8 @@
-

{{ $t('site.signup.title')}}

-

{{ $t('site.signup.subtitle')}}

+

{{ $t('site.signup.title')}}

+

{{ $t('site.signup.subtitle')}}

From e4e6cf967ecb548a9ac3c0f6b3858df364378eb1 Mon Sep 17 00:00:00 2001 From: ogerly Date: Thu, 18 Mar 2021 15:20:32 +0100 Subject: [PATCH 10/24] remove submodul --- .gitmodules | 4 +-- frontend/src/App.vue | 26 +++++-------------- frontend/src/components/Modal.vue | 2 +- frontend/src/views/AdminOverview.vue | 2 +- frontend/src/views/Dashboard.vue | 2 +- frontend/src/views/Layout/DashboardNavbar.vue | 14 +++++----- 6 files changed, 18 insertions(+), 32 deletions(-) diff --git a/.gitmodules b/.gitmodules index 116400a7b..fab7b5b5e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,6 +2,4 @@ path = gn url = https://github.com/gradido/gn.git branch = master -[submodule "login_server"] - path = login_server - url = git@github.com:gradido/gradido_login_server.git + diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 38fb24619..6a229f115 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -18,27 +18,15 @@ export default { components: { ParticlesBg }, - mounted() { - console.log("mounted") - }, - created () { - console.log("created") - - // console.log(" $cookies.get('gdd_session_id') ", $cookies.get("gdd_session_id") ) - // console.log("app.vue $cookies.isKey('gdd_session_id') ", $cookies.isKey("gdd_session_id") ) - // const isSession = $cookies.isKey("gdd_session_id") - // const getSession = $cookies.get("gdd_session_id") - // console.log("this.isSession ", this.isSession ) - // console.log("xx", ( isSession == true)) + created () { + console.log('%cWillkommen bei Gradido %cgreen text', 'font-weight:bold', 'color: green') if ( $cookies.isKey("gdd_session_id") == true) { - //this.$store.state.email = this.$cookies.get('gdd_u') - console.log("cookies to store.state") - this.$store.commit('session_id', $cookies.get("gdd_session_id")) - this.$store.commit('email', $cookies.get("gdd_u")) - console.log("app to overview") - this.$router.push("overview") + console.log('%cWillkommen zurück %c'+$cookies.get("gdd_u")+'', 'font-weight:bold', 'color: orange') + this.$store.commit('session_id', $cookies.get("gdd_session_id")) + this.$store.commit('email', $cookies.get("gdd_u")) + this.$router.push("overview") }else { - console.log("app.vue to LOout") + console.log("app.vue to Logout") this.$store.dispatch('logout') } }, diff --git a/frontend/src/components/Modal.vue b/frontend/src/components/Modal.vue index 44996d624..cc01518d1 100644 --- a/frontend/src/components/Modal.vue +++ b/frontend/src/components/Modal.vue @@ -26,7 +26,7 @@ diff --git a/frontend/src/views/AdminOverview.vue b/frontend/src/views/AdminOverview.vue index 6ed76740e..41c1b1d99 100644 --- a/frontend/src/views/AdminOverview.vue +++ b/frontend/src/views/AdminOverview.vue @@ -65,7 +65,7 @@
Charts
-
Geschöpft
+
Geschöpft
diff --git a/frontend/src/views/Dashboard.vue b/frontend/src/views/Dashboard.vue index d7313896d..79a1a03d7 100644 --- a/frontend/src/views/Dashboard.vue +++ b/frontend/src/views/Dashboard.vue @@ -68,7 +68,7 @@
Overview
-
Sales value
+
Sales value
diff --git a/frontend/src/views/Layout/DashboardNavbar.vue b/frontend/src/views/Layout/DashboardNavbar.vue index 4c6f9f6c0..1e77c16c5 100755 --- a/frontend/src/views/Layout/DashboardNavbar.vue +++ b/frontend/src/views/Layout/DashboardNavbar.vue @@ -5,7 +5,7 @@ :class="{'navbar-dark': type === 'default'}" > - {{$route.name}} + {{$route.name}} @@ -23,14 +23,14 @@ tag="li" title-tag="a" title-classes="nav-link pr-0"> - - + + - + - {{this.$store.state.email}} + {{ $store.state.email }} @@ -68,8 +68,8 @@