mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into change-css-mobile
This commit is contained in:
commit
f8c7823b0d
@ -42,12 +42,12 @@
|
||||
"scann_code":"<strong>QR Code Scanner</strong> - Scanne den QR Code deines Partners",
|
||||
"max_gdd_info":"maximale anzahl GDD zum versenden erreicht!",
|
||||
"send_check":"Bestätige deine Zahlung. Prüfe bitte nochmal alle Daten!",
|
||||
"thx":"Danke!",
|
||||
"send_success":"Deine Zahlung wurde erfolgreich versendet."
|
||||
"thx":"Danke,",
|
||||
"send_success":"deine Transaktion wurde erfolgreich ausgeführt"
|
||||
},
|
||||
"transaction":{
|
||||
"show_part": "Die letzten <strong>{count}</strong> Transaktionen",
|
||||
"show_all":"Alle <strong>{count}</strong> Transaktionen ansehen",
|
||||
"nullTransactions":"Du hast noch keine Transaktionen auf deinem Konto.",
|
||||
"more": "mehr"
|
||||
},
|
||||
"site": {
|
||||
|
||||
@ -42,12 +42,12 @@
|
||||
"scann_code":"<strong>QR Code Scanner</strong> - Scanne den QR Code deines Partners",
|
||||
"max_gdd_info":"maximale anzahl GDD zum versenden erreicht!",
|
||||
"send_check":"Bestätige deine Zahlung. Prüfe bitte nochmal alle Daten!",
|
||||
"thx":"THX",
|
||||
"send_success":"Deine Zahlung wurde erfolgreich versendet."
|
||||
"thx":"Thank you,",
|
||||
"send_success":"your transaction was successfully completed"
|
||||
},
|
||||
"transaction":{
|
||||
"show_part": "The last <strong>{count}</strong> transactions",
|
||||
"show_all":"View all <strong>{count}</strong> transactions",
|
||||
"nullTransactions":"You don't have any transactions on your account yet.",
|
||||
"more": "more"
|
||||
},
|
||||
"site": {
|
||||
|
||||
@ -31,7 +31,9 @@
|
||||
<router-view
|
||||
:balance="balance"
|
||||
:gdt-balance="GdtBalance"
|
||||
:transactions="transactions"
|
||||
@update-balance="updateBalance"
|
||||
@update-transactions="updateTransactions"
|
||||
></router-view>
|
||||
</fade-transition>
|
||||
</div>
|
||||
@ -76,6 +78,7 @@ export default {
|
||||
return {
|
||||
balance: 0,
|
||||
GdtBalance: 0,
|
||||
transactions: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -99,10 +102,11 @@ export default {
|
||||
// what to do when loading balance fails?
|
||||
}
|
||||
},
|
||||
async loadGDTBalance() {
|
||||
async updateTransactions() {
|
||||
const result = await communityAPI.transactions(this.$store.state.session_id)
|
||||
if (result.success) {
|
||||
this.GdtBalance = result.result.data.gdtSum / 10000
|
||||
this.transactions = result.result.data.transactions
|
||||
} else {
|
||||
// what to do when loading balance fails?
|
||||
}
|
||||
@ -116,7 +120,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.loadBalance()
|
||||
this.loadGDTBalance()
|
||||
this.updateTransactions()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -35,12 +35,6 @@ describe('AccountOverview', () => {
|
||||
expect(wrapper.find('gdd-table-stub').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
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('updateBalance method', () => {
|
||||
beforeEach(async () => {
|
||||
wrapper.find('gdd-send-stub').vm.$emit('update-balance', {
|
||||
|
||||
@ -2,11 +2,7 @@
|
||||
<div>
|
||||
<base-header class="pb-4 pt-2 bg-transparent"></base-header>
|
||||
<b-container fluid class="p-2">
|
||||
<gdd-status
|
||||
:balance="balance"
|
||||
:gdt-balance="GdtBalance"
|
||||
:show-transaction-list="showTransactionList"
|
||||
/>
|
||||
<gdd-status v-if="showTransactionList" :balance="balance" :gdt-balance="GdtBalance" />
|
||||
<br />
|
||||
<gdd-send
|
||||
:balance="balance"
|
||||
@ -16,9 +12,9 @@
|
||||
/>
|
||||
<hr />
|
||||
<gdd-table
|
||||
:show-transaction-list="showTransactionList"
|
||||
v-if="showTransactionList"
|
||||
:transactions="transactions"
|
||||
@change-transactions="setTransactions"
|
||||
@update-transactions="updateTransactions"
|
||||
/>
|
||||
</b-container>
|
||||
</div>
|
||||
@ -32,13 +28,15 @@ export default {
|
||||
name: 'Overview',
|
||||
data() {
|
||||
return {
|
||||
transactions: [],
|
||||
showTransactionList: true,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
balance: { type: Number, default: 0 },
|
||||
GdtBalance: { type: Number, default: 0 },
|
||||
transactions: {
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
components: {
|
||||
GddStatus,
|
||||
@ -52,8 +50,8 @@ export default {
|
||||
updateBalance(data) {
|
||||
this.$emit('update-balance', data.ammount)
|
||||
},
|
||||
setTransactions(transactions) {
|
||||
this.transactions = transactions
|
||||
updateTransactions() {
|
||||
this.$emit('update-transactions')
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
export default {
|
||||
name: 'GddStatus',
|
||||
props: {
|
||||
showTransactionList: { type: Boolean, default: true },
|
||||
balance: { type: Number, default: 0 },
|
||||
GdtBalance: { type: Number, default: 0 },
|
||||
},
|
||||
|
||||
@ -2,26 +2,42 @@
|
||||
<div>
|
||||
<b-list-group v-show="showTransactionList">
|
||||
<b-list-group-item
|
||||
v-for="item in filteredItems"
|
||||
v-for="item in transactions"
|
||||
:key="item.id"
|
||||
style="background-color: #ebebeba3 !important"
|
||||
>
|
||||
<div class="d-flex w-100 justify-content-between">
|
||||
<b-icon
|
||||
v-if="item.type === 'send'"
|
||||
icon="box-arrow-left"
|
||||
class="m-1"
|
||||
icon="arrow-left-circle"
|
||||
class="m-1 text-danger"
|
||||
font-scale="2"
|
||||
style="color: red"
|
||||
></b-icon>
|
||||
<b-icon
|
||||
v-else
|
||||
icon="box-arrow-right"
|
||||
v-else-if="item.type === 'receive'"
|
||||
icon="arrow-right-circle"
|
||||
class="m-1"
|
||||
font-scale="2"
|
||||
style="color: green"
|
||||
></b-icon>
|
||||
<h1 class="mb-1">
|
||||
<b-icon
|
||||
v-else-if="item.type === 'creation'"
|
||||
icon="gift"
|
||||
class="m-1"
|
||||
font-scale="2"
|
||||
style="color: orange"
|
||||
></b-icon>
|
||||
<b-icon
|
||||
v-else
|
||||
icon="droplet-half"
|
||||
class="m-1"
|
||||
font-scale="2"
|
||||
style="color: orange"
|
||||
></b-icon>
|
||||
<h1 class="">
|
||||
<span v-if="item.type === 'receive' || item.type === 'creation'">+</span>
|
||||
<span v-else>-</span>
|
||||
{{ $n(item.balance / 10000) }}
|
||||
<small>GDD</small>
|
||||
</h1>
|
||||
@ -73,11 +89,11 @@
|
||||
</b-collapse>
|
||||
</b-list-group-item>
|
||||
<b-list-group-item v-show="this.$route.path == '/overview'">
|
||||
<b-alert v-if="count < 5" show variant="secondary">
|
||||
<span class="alert-text" v-html="$t('transaction.show_part', { count: count })"></span>
|
||||
<b-alert v-if="transactions.length === 0" show variant="secondary">
|
||||
<span class="alert-text">{{ $t('transaction.nullTransactions') }}</span>
|
||||
</b-alert>
|
||||
<router-link
|
||||
v-else
|
||||
v-else-if="transactions.length > 5"
|
||||
to="/transactions"
|
||||
v-html="$t('transaction.show_all', { count: count })"
|
||||
></router-link>
|
||||
@ -87,13 +103,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import communityAPI from '../../../apis/communityAPI'
|
||||
|
||||
export default {
|
||||
name: 'GddTable',
|
||||
props: {
|
||||
showTransactionList: { type: Boolean, default: true },
|
||||
transactions: { default: [] },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -103,16 +117,8 @@ export default {
|
||||
count: 0,
|
||||
}
|
||||
},
|
||||
|
||||
async created() {
|
||||
const result = await communityAPI.transactions(this.$store.state.session_id)
|
||||
|
||||
if (result.success) {
|
||||
this.items = result.result.data.transactions
|
||||
this.count = result.result.data.count
|
||||
} else {
|
||||
//console.log('error', result)
|
||||
}
|
||||
created() {
|
||||
this.$emit('change-transactions')
|
||||
},
|
||||
computed: {
|
||||
filteredItems() {
|
||||
@ -128,7 +134,6 @@ export default {
|
||||
})
|
||||
return result
|
||||
},
|
||||
|
||||
rowClass(item, type) {
|
||||
if (!item || type !== 'row') return
|
||||
if (item.type === 'receive') return 'table-success'
|
||||
|
||||
@ -7,9 +7,12 @@
|
||||
<b-container fluid class="mt--6">
|
||||
<b-row>
|
||||
<b-col class="order-xl-1">
|
||||
<gdd-table></gdd-table>
|
||||
<gdd-table :transactions="transactions" @update-transactions="updateTransactions" />
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row class="text-center mb-6" v-if="transactions.length == 0">
|
||||
<b-col class="h2">{{ $t('transaction.nullTransactions') }}</b-col>
|
||||
</b-row>
|
||||
</b-container>
|
||||
</div>
|
||||
</template>
|
||||
@ -20,6 +23,16 @@ export default {
|
||||
components: {
|
||||
GddTable,
|
||||
},
|
||||
props: {
|
||||
transactions: {
|
||||
default: [],
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateTransactions() {
|
||||
this.$emit('update-transactions')
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style></style>
|
||||
|
||||
@ -118,7 +118,7 @@ Poco::JSON::Object* JsonUnsecureLogin::handle(Poco::Dynamic::Var params)
|
||||
default:
|
||||
result->set("state", "error");
|
||||
result->set("msg", "unknown user state");
|
||||
result->set("details", USER_NO_GROUP);
|
||||
result->set("details", user_state);
|
||||
}
|
||||
|
||||
sm->releaseSession(session);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user