{{ $t('send') }}
@@ -26,7 +26,7 @@
-
+
@@ -57,6 +57,7 @@ import DashboardNavbar from './DashboardNavbar.vue'
import ContentFooter from './ContentFooter.vue'
// import DashboardContent from './Content.vue';
import { FadeTransition } from 'vue2-transitions'
+import communityAPI from '../../apis/communityAPI'
export default {
components: {
@@ -65,6 +66,11 @@ export default {
// DashboardContent,
FadeTransition,
},
+ data() {
+ return {
+ balance: 0,
+ }
+ },
methods: {
initScrollbar() {
let isWindows = navigator.platform.startsWith('Win')
@@ -78,10 +84,24 @@ export default {
this.$store.dispatch('logout')
this.$router.push('/login')
},
+ async loadBalance() {
+ const result = await communityAPI.balance(this.$store.state.session_id)
+ if (result.success) {
+ this.balance = result.result.data.balance / 10000
+ } else {
+ // what to do when loading balance fails?
+ }
+ },
+ updateBalance(ammount) {
+ this.balance -= ammount
+ },
},
mounted() {
this.initScrollbar()
},
+ created() {
+ this.loadBalance()
+ },
}
diff --git a/frontend/src/views/Pages/KontoOverview.spec.js b/frontend/src/views/Pages/KontoOverview.spec.js
index d2bb8403c..b0385cbc3 100644
--- a/frontend/src/views/Pages/KontoOverview.spec.js
+++ b/frontend/src/views/Pages/KontoOverview.spec.js
@@ -1,26 +1,17 @@
import { shallowMount } from '@vue/test-utils'
import KontoOverview from './KontoOverview'
-import Vuex from 'vuex'
const localVue = global.localVue
describe('KontoOverview', () => {
let wrapper
- let actions = {
- accountBalance: jest.fn(),
- }
-
- let store = new Vuex.Store({
- actions,
- })
-
let mocks = {
$t: jest.fn((t) => t),
}
const Wrapper = () => {
- return shallowMount(KontoOverview, { localVue, store, mocks })
+ return shallowMount(KontoOverview, { localVue, mocks })
}
describe('shallow Mount', () => {
@@ -44,37 +35,34 @@ describe('KontoOverview', () => {
expect(wrapper.find('gdd-table-stub').exists()).toBeTruthy()
})
- it('calls "accountBalance" action from store on creation', () => {
- const spy = jest.spyOn(actions, 'accountBalance')
- expect(spy).toHaveBeenCalled()
- })
-
it('updates transctions data when change-transactions is emitted', async () => {
wrapper.find('gdd-table-stub').vm.$emit('change-transactions', [0, 1])
await wrapper.vm.$nextTick()
expect(wrapper.vm.transactions).toEqual(expect.arrayContaining([0, 1]))
})
- describe('setRows method', () => {
+ describe('updateBalance method', () => {
beforeEach(async () => {
- wrapper.find('gdd-send-stub').vm.$emit('change-rows', {
- row_form: false,
- row_check: true,
- row_thx: true,
+ wrapper.find('gdd-send-stub').vm.$emit('update-balance', {
+ ammount: 42,
})
await wrapper.vm.$nextTick()
})
- it('updates row_form data when change-rows is emitted', () => {
- expect(wrapper.vm.row_form).toBeFalsy()
+ it('emmits updateBalance with correct value', () => {
+ expect(wrapper.emitted('update-balance')).toEqual([[42]])
+ })
+ })
+
+ describe('toggleShowList method', () => {
+ beforeEach(async () => {
+ wrapper.setProps({ showTransactionList: false })
+ wrapper.find('gdd-send-stub').vm.$emit('toggle-show-list', true)
+ await wrapper.vm.$nextTick()
})
- it('updates row_check data when change-rows is emitted', () => {
- expect(wrapper.vm.row_check).toBeTruthy()
- })
-
- it('updates row_thx data when change-rows is emitted', () => {
- expect(wrapper.vm.row_thx).toBeTruthy()
+ it('changes the value of property showTransactionList', () => {
+ expect(wrapper.vm.showTransactionList).toBeTruthy()
})
})
})
diff --git a/frontend/src/views/Pages/KontoOverview.vue b/frontend/src/views/Pages/KontoOverview.vue
index 10942b7f5..c65916887 100644
--- a/frontend/src/views/Pages/KontoOverview.vue
+++ b/frontend/src/views/Pages/KontoOverview.vue
@@ -2,17 +2,17 @@
-
+
@@ -28,25 +28,24 @@ export default {
name: 'Overview',
data() {
return {
- row_form: true,
- row_check: false,
- row_thx: false,
transactions: [],
+ showTransactionList: true,
}
},
+ props: {
+ balance: { type: Number, default: 0 },
+ },
components: {
GddStatus,
GddSend,
GddTable,
},
- created() {
- this.$store.dispatch('accountBalance', this.$store.state.session_id)
- },
methods: {
- setRows(rows) {
- this.row_form = rows.row_form
- this.row_check = rows.row_check
- this.row_thx = rows.row_thx
+ toggleShowList(bool) {
+ this.showTransactionList = bool
+ },
+ updateBalance(data) {
+ this.$emit('update-balance', data.ammount)
},
setTransactions(transactions) {
this.transactions = transactions
diff --git a/login_server/.gitignore b/login_server/.gitignore
index dd7d9573a..1d623d885 100644
--- a/login_server/.gitignore
+++ b/login_server/.gitignore
@@ -6,3 +6,5 @@ src/cpsp/*.cpp
src/cpp/proto/
build*/
/skeema/gradido_login/insert/crypto_key.sql
+
+src/LOCALE/messages.pot
diff --git a/login_server/src/cpp/model/table/PendingTask.cpp b/login_server/src/cpp/model/table/PendingTask.cpp
index 57115ea56..dfaf0c65d 100644
--- a/login_server/src/cpp/model/table/PendingTask.cpp
+++ b/login_server/src/cpp/model/table/PendingTask.cpp
@@ -10,13 +10,13 @@ namespace model
namespace table
{
PendingTask::PendingTask()
- : mUserId(0), mHederaId(0), mTaskTypeId(TASK_TYPE_NONE)
+ : mUserId(0), mHederaId(0), mTaskTypeId(TASK_TYPE_NONE), mChildPendingTaskId(0), mParentPendingTaskId(0)
{
}
PendingTask::PendingTask(int userId, std::string serializedProtoRequest, TaskType type)
: mUserId(userId), mHederaId(0), mRequest((const unsigned char*)serializedProtoRequest.data(), serializedProtoRequest.size()),
- mTaskTypeId(TASK_TYPE_NONE)
+ mTaskTypeId(TASK_TYPE_NONE), mChildPendingTaskId(0), mParentPendingTaskId(0)
{
}