pre final step gradido transform transaction list

This commit is contained in:
ogerly 2021-08-10 11:52:37 +02:00
parent b48bbbb711
commit fac1cd6a78
8 changed files with 160 additions and 100 deletions

View File

@ -93,7 +93,9 @@
"show_all":"Alle <strong>{count}</strong> Transaktionen ansehen",
"nullTransactions":"Du hast noch keine Transaktionen auf deinem Konto.",
"more": "mehr",
"receiverNotFound":"Empfänger nicht gefunden"
"receiverNotFound":"Empfänger nicht gefunden",
"gdd-text":"Gradido Transaktionen",
"gdt-text":"Gradido Transform Transaktionen"
},
"site": {
"login": {
@ -164,5 +166,13 @@
"title": "Passwort zurücksetzen",
"text": "Jetzt kannst du ein neues Passwort speichern, mit dem du dich zukünftig in der Gradido-App anmelden kannst.",
"not-authenticated": "Leider konnten wir dich nicht authentifizieren. Bitte wende dich an den Support."
},
"gdt": {
"gdt-received":"Gradido Transform (GDT) erhalten",
"factor":"Factor",
"conversion-gdt-euro":"Umrechnung Euro / Gradido Transform (GDT)",
"calculation":"Berechnung der Gradido Transform",
"conversion":"Umrechnung",
"formula":"Berechungsformel"
}
}

View File

@ -93,7 +93,9 @@
"show_all":"View all <strong>{count}</strong> transactions.",
"nullTransactions":"You don't have any transactions on your account yet.",
"more": "more",
"receiverNotFound":"Recipient not found"
"receiverNotFound":"Recipient not found",
"gdd-text":"Gradido Transactions",
"gdt-text":"Gradido Transform Transactions"
},
"site": {
"login": {
@ -165,5 +167,13 @@
"title": "Reset Password",
"text": "Now you can save a new password to login to the Gradido-App in the future.",
"not-authenticated": "Unfortunately we could not authenticate you. Please contact the support."
}
},
"gdt": {
"gdt-received": "Gradido Transform (GDT) received",
"factor": "Factor",
"conversion-gdt-euro": "Conversion Euro / Gradido Transform (GDT)",
"calculation": "Calculation of Gradido Transform",
"conversion": "Conversion",
"formula": "Calculation formula"
}
}

View File

@ -145,76 +145,9 @@ export default {
}
},
async updateGdt() {
const result2 = await communityAPI.transactionsgdt(this.$store.state.sessionId)
console.log(' communityAPI.transactionsgdt')
console.log(result2.result)
console.log(result2.result.data.gdtEntries)
this.transactionsGdt = result2.result.data.gdtEntries
this.transactionGdtCount = result2.result.data.count
/*
this.transactionsGdt =
{
state: 'success',
gdt: [
{
id: 8821,
amount: 1000,
date: '2021-08-05T14:12:00+00:00',
email: 'foerderkreis-1@gradido.org',
comment: null,
coupon_code: '',
gdt_entry_type_id: 4,
factor: '20.0000',
amount2: 0,
factor2: '0.0500',
gdt: 1000,
},
{
id: 8810,
amount: 1500,
date: '2021-08-04T16:12:00+00:00',
email: 'eopage-gradido-foerderpaket@gradido.org',
comment: null,
coupon_code: '',
gdt_entry_type_id: 7,
factor: '15.0000',
amount2: 0,
factor2: '0.0500',
gdt: 1500,
},
{
id: 8552,
amount: 1000,
date: '2021-06-03T14:12:00+00:00',
email: 'foerderkreis-1@gradido.org',
comment: null,
coupon_code: '',
gdt_entry_type_id: 4,
factor: '20.0000',
amount2: 0,
factor2: '0.0500',
gdt: 1000,
},
{
id: 8317,
amount: 1000,
date: '2021-03-16T14:12:00+00:00',
email: 'foerderkreis-1@gradido.org',
comment: null,
coupon_code: '',
gdt_entry_type_id: 4,
factor: '20.0000',
amount2: 0,
factor2: '0.0500',
gdt: 1000,
},
],
transactionGdtExecutingCount: 4500,
count: 4,
}
*/
//this.transactionGdtCount = this.transactionsGdt.count
// console.log('transactionGdtCount', this.transactionGdtCount)
const result2 = await communityAPI.transactionsgdt(this.$store.state.sessionId)
this.transactionsGdt = result2.result.data.gdtEntries
this.transactionGdtCount = result2.result.data.count
},
updateBalance(ammount) {
this.balance -= ammount
@ -226,9 +159,3 @@ export default {
},
}
</script>
<style lang="scss">
.xxx {
position: relative;
right: 0px;
}
</style>

View File

@ -119,15 +119,15 @@ describe('GddTransactionList', () => {
})
it('shows the message of the transaction', () => {
expect(transaction.findAll('div').at(5).text()).toContain('Alles Gute zum Geburtstag')
expect(transaction.findAll('div').at(6).text()).toContain('Alles Gute zum Geburtstag')
})
it('shows the date of the transaction', () => {
expect(transaction.findAll('div').at(8).text()).toContain('Tue May 25 2021')
expect(transaction.findAll('div').at(9).text()).toContain('Tue May 25 2021')
})
it('shows the decay calculation', () => {
expect(transaction.findAll('div').at(9).text()).toContain('-0.5')
expect(transaction.findAll('div').at(10).text()).toContain('-0.5')
})
})

View File

@ -24,8 +24,10 @@
{{ $t('form.memo') }}
</small>
</div>
<div v-if="decay">
<br />
<div v-if="date" class="text-sm">
{{ $t('form.date') }}
</div>
<div v-if="decay" class="pt-2">
<b-icon v-if="type != 'decay'" icon="droplet-half" height="15" class="mb-3" />
</div>
</div>

View File

@ -6,42 +6,153 @@
id,
amount,
date,
email,
/*email,*/
comment,
coupon_code,
/*coupon_code,*/
gdt_entry_type_id,
factor,
amount2,
factor2,
/*amount2,*/
/*factor2,*/
gdt,
} in this.transactionsGdt"
:key="id"
>
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1"> Gradido Transform (GDT) erhalten {{ comment ? ': '+comment : '' }}</h5>
<div class="d-flex w-100 justify-content-between pb-3">
<h5 class="mb-1">
{{ $t('gdt.gdt-received') }} {{ comment ? ': [' + comment + ']' : '' }}
</h5>
<small>{{ $d($moment(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}</small>
</div>
<!-- ROW Start -->
<div class="d-flex gdt-transaction-list-item" v-b-toggle="'a' + date + ''">
<!-- ICON -->
<div style="width: 8%"></div>
<!-- Text Links -->
<div class="font1_2em pr-2 text-right" style="width: 36%">
<div>
<div>
<span v-if="gdt_entry_type_id != 7">-</span>
{{ $n(amount, 'decimal') }}
</div>
<div v-if="gdt_entry_type_id != 7">+{{ $n(gdt, 'decimal') }}</div>
</div>
<div v-if="gdt_entry_type_id === 7">{{ amount }} GDT * {{factor}} = {{gdt}}</div>
<div v-else>{{ amount }} {{ gdt}} GDT</div>
<small>
{{ id }} {{ amount }} {{ date }} {{ email }} {{ comment }} {{ coupon_code }}
{{ gdt_entry_type_id }} {{ factor }} {{ amount2 }} {{ factor2 }} {{ gdt }}
</small>
<div v-if="comment">
<small>
{{ $t('form.memo') }}
</small>
</div>
<div v-if="date" class="text-sm">
{{ $t('form.date') }}
</div>
<div v-if="gdt_entry_type_id != 7">
<small>{{ $t('gdt.factor') }}</small>
</div>
</div>
<!-- Text Rechts -->
<div class="font1_2em text-left pl-2" style="width: 55%">
<div>
<div v-if="gdt_entry_type_id != 7">EURO</div>
<div>GDT</div>
</div>
<div v-if="comment">
<small>
{{ comment }}
</small>
</div>
<div v-if="date" class="text-sm">
{{ $d($moment(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}
</div>
<div v-if="gdt_entry_type_id != 7">
<small>{{ factor }}</small>
</div>
</div>
<!-- Collaps Toggle Button -->
<div v-if="gdt_entry_type_id" class="text-right" style="width: 5%">
<b-button class="btn-sm">
<b>i</b>
</b-button>
</div>
</div>
<!-- ROW End -->
<!-- Collaps Start -->
<b-collapse v-if="gdt_entry_type_id" :id="'a' + date + ''" class="pb-4">
<b-list-group style="border: 0px; background-color: #f1f1f1">
<div v-if="gdt_entry_type_id != '7'" class="text-center pt-3">
{{ $t('gdt.conversion-gdt-euro') }}
</div>
<div v-else class="text-center pt-3">
{{ $t('gdt.calculation') }}
</div>
<!--EURO / GDT -->
<b-list-group-item
v-if="gdt_entry_type_id != '7'"
style="border: 0px; background-color: #f1f1f1"
>
<div class="d-flex">
<div style="width: 40%" class="text-right pr-3 mr-2">
<div>{{ $t('gdt.factor') }}</div>
<div>{{ $t('gdt.conversion') }}</div>
</div>
<div style="width: 60%">
<div>{{ factor }}</div>
<div>{{ amount }} {{ gdt }} GDT</div>
</div>
</div>
</b-list-group-item>
<!-- Only GDT -->
<b-list-group-item v-else style="border: 0px; background-color: #f1f1f1">
<div class="d-flex">
<div style="width: 40%" class="text-right pr-3 mr-2">{{ $t('gdt.formula') }}:</div>
<div style="width: 60%">{{ amount }} GDT * {{ factor }} = {{ gdt }}</div>
</div>
</b-list-group-item>
</b-list-group>
</b-collapse>
<!-- Collaps End -->
</b-list-group-item>
</b-list-group>
</div>
</template>
<script>
const iconsByType = {
1: { icon: 'arrow-left-circle', classes: 'text-success', operator: '+' },
2: { icon: 'arrow-left-circle', classes: 'text-success', operator: '+' },
3: { icon: 'arrow-left-circle', classes: 'text-success', operator: '+' },
4: { icon: 'arrow-left-circle', classes: 'text-success', operator: '+' },
5: { icon: 'arrow-left-circle', classes: 'text-success', operator: '+' },
6: { icon: 'arrow-left-circle', classes: 'text-success', operator: '+' },
7: { icon: 'arrow-left-circle', classes: 'text-info', operator: '+' },
}
export default {
name: 'gdt-transaction-list',
props: {
transactionsGdt: { default: () => [] },
transactionGdtCount: { type: Number, default: 0 },
},
methods: {
getProperties(givenType) {
const type = iconsByType[givenType]
if (type)
return {
icon: type.icon,
class: type.classes + ' m-mb-1 font2em',
operator: type.operator,
}
this.throwError('no icon to given type')
},
throwError(msg) {
throw new Error(msg)
},
},
}
</script>
<style>

View File

@ -25,7 +25,7 @@ describe('UserProfileTransactionList', () => {
})
it('emits update-transactions after creation', () => {
expect(wrapper.emitted('update-transactions')).toEqual(
expect(wrapper.emitted('update-transactions')).toEqual(
expect.arrayContaining([expect.arrayContaining([{ firstPage: 1, items: 25 }])]),
)
})

View File

@ -2,7 +2,7 @@
<div class="pb-4">
<b-tabs content-class="mt-3 pt-4 pb-4" justified>
<b-tab :title="'Gradido (' + $n(balance, 'decimal') + ' GDD)'" class="px-4">
<p class="tab-tex">Gradido Transaktionen</p>
<p class="tab-tex">{{ $t('transaction.gdd-text') }}</p>
<gdd-transaction-list
:timestamp="timestamp"
@ -14,7 +14,7 @@
</b-tab>
<b-tab :title="'Gradido Transform (' + $n(GdtBalance, 'decimal') + ' GDT)'" class="px-4">
<p class="">Gradido Transform Transaktionen</p>
<p class="">{{ $t('transaction.gdt-text') }}</p>
<gdt-transaction-list
:transactionsGdt="transactionsGdt"