mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
avoid moment, use minus signs
This commit is contained in:
parent
d63f93149c
commit
10090756a1
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="decayinformation">
|
||||
<span v-if="decaytyp === 'short'">
|
||||
{{ decay ? ' - ' + $n(decay.balance, 'decimal') + ' ' + decayStartBlockTextShort : '' }}
|
||||
{{ decay ? ' − ' + $n(decay.balance, 'decimal') : '' }}
|
||||
</span>
|
||||
|
||||
<div v-if="decaytyp === 'new'">
|
||||
@ -21,12 +21,11 @@
|
||||
<div class="display-4">{{ $t('decay.Starting_block_decay') }}</div>
|
||||
<div>
|
||||
{{ $t('decay.decay_introduced') }} :
|
||||
{{ $d($moment.unix(decay.decayStart), 'long') }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<span v-if="decay.decayStart">
|
||||
{{ $d($moment.unix(decay.decayStart), 'long') }}
|
||||
{{ $d(new Date(decay.decayStart * 1000), 'long') }}
|
||||
{{ $i18n.locale === 'de' ? 'Uhr' : '' }}
|
||||
</span>
|
||||
</div>
|
||||
@ -59,7 +58,7 @@
|
||||
<div>{{ $t('decay.decay') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div>- {{ $n(decay.balance, 'decimal') }}</div>
|
||||
<div>− {{ $n(decay.balance, 'decimal') }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<hr class="mt-2 mb-2" />
|
||||
@ -75,7 +74,7 @@
|
||||
<div v-if="type === 'receive'">{{ $t('decay.received') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="type === 'send'">- {{ $n(balance, 'decimal') }}</div>
|
||||
<div v-if="type === 'send'">− {{ $n(balance, 'decimal') }}</div>
|
||||
<div v-if="type === 'receive'">+ {{ $n(balance, 'decimal') }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -85,7 +84,7 @@
|
||||
<div>{{ $t('decay.decay') }}</div>
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div>- {{ $n(decay.balance, 'decimal') }}</div>
|
||||
<div>− {{ $n(decay.balance, 'decimal') }}</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<!-- Total-->
|
||||
@ -95,13 +94,13 @@
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
<div v-if="type === 'send'">
|
||||
<b>- {{ $n(balance + decay.balance, 'decimal') }}</b>
|
||||
<b>− {{ $n(balance + decay.balance, 'decimal') }}</b>
|
||||
</div>
|
||||
<div v-if="type === 'receive'">
|
||||
<b>{{ $n(balance - decay.balance, 'decimal') }}</b>
|
||||
</div>
|
||||
<div v-if="type === 'creation'">
|
||||
<b>- {{ $n(balance - decay.balance, 'decimal') }}</b>
|
||||
<b>− {{ $n(balance - decay.balance, 'decimal') }}</b>
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -109,33 +108,26 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'DecayInformation',
|
||||
props: {
|
||||
balance: { type: Number },
|
||||
type: { type: String, default: '' },
|
||||
decay: {
|
||||
balance: '',
|
||||
decayDuration: '',
|
||||
decayStart: 0,
|
||||
decayEnd: 0,
|
||||
decayStartBlock: 0,
|
||||
},
|
||||
decaytyp: { type: String, default: '' },
|
||||
},
|
||||
computed: {
|
||||
decayStartBlockTextShort() {
|
||||
return this.decay.decayStartBlock
|
||||
? this.$t('decay.decayStart') + this.$d(this.$moment.unix(this.decay.decayStartBlock))
|
||||
: ''
|
||||
},
|
||||
duration() {
|
||||
return this.$moment.duration(
|
||||
this.$moment
|
||||
.unix(new Date(this.decay.decayEnd))
|
||||
.diff(this.$moment.unix(new Date(this.decay.decayStart))),
|
||||
)._data
|
||||
},
|
||||
},
|
||||
}
|
||||
import { duration } from 'moment'
|
||||
|
||||
export default {
|
||||
name: 'DecayInformation',
|
||||
props: {
|
||||
balance: { type: Number },
|
||||
type: { type: String, default: '' },
|
||||
decay: {
|
||||
balance: '',
|
||||
decayDuration: '',
|
||||
decayStart: 0,
|
||||
decayEnd: 0,
|
||||
decayStartBlock: 0,
|
||||
},
|
||||
decaytyp: { type: String, default: '' },
|
||||
},
|
||||
computed: {
|
||||
duration() {
|
||||
return duration((this.decay.decayEnd - this.decay.decayStart) * 1000)._data
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
{{ $t('form.date') }}
|
||||
</b-col>
|
||||
<b-col cols="6">
|
||||
{{ $d($moment(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}
|
||||
{{ $d(new Date(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}
|
||||
</b-col>
|
||||
</b-row>
|
||||
|
||||
|
||||
@ -69,8 +69,8 @@ const dateTimeFormats = {
|
||||
},
|
||||
long: {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
day: 'long',
|
||||
weekday: 'short',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
@ -84,9 +84,9 @@ const dateTimeFormats = {
|
||||
},
|
||||
long: {
|
||||
day: 'numeric',
|
||||
month: 'short',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
weekday: 'short',
|
||||
weekday: 'long',
|
||||
hour: 'numeric',
|
||||
minute: 'numeric',
|
||||
},
|
||||
|
||||
@ -11,8 +11,6 @@ import '@/assets/scss/gradido.scss'
|
||||
import FlatPickr from 'vue-flatpickr-component'
|
||||
import 'flatpickr/dist/flatpickr.css'
|
||||
|
||||
import VueMoment from 'vue-moment'
|
||||
|
||||
import Loading from 'vue-loading-overlay'
|
||||
import 'vue-loading-overlay/dist/vue-loading.css'
|
||||
|
||||
@ -24,7 +22,6 @@ export default {
|
||||
Vue.use(GlobalDirectives)
|
||||
Vue.use(BootstrapVue)
|
||||
Vue.use(IconsPlugin)
|
||||
Vue.use(VueMoment)
|
||||
Vue.use(PortalVue)
|
||||
Vue.use(FlatPickr)
|
||||
Vue.use(Loading)
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
</b-col>
|
||||
<b-col cols="7">
|
||||
<div class="gdd-transaction-list-item-date">
|
||||
{{ $d($moment(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}
|
||||
{{ $d(new Date(date), 'long') }} {{ $i18n.locale === 'de' ? 'Uhr' : '' }}
|
||||
</div>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -142,66 +142,66 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PaginationButtons from '../../../components/PaginationButtons'
|
||||
import DecayInformation from '../../../components/DecayInformation'
|
||||
import PaginationButtons from '../../../components/PaginationButtons'
|
||||
import DecayInformation from '../../../components/DecayInformation'
|
||||
|
||||
const iconsByType = {
|
||||
send: { icon: 'arrow-left-circle', classes: 'text-danger', operator: '-' },
|
||||
receive: { icon: 'arrow-right-circle', classes: 'gradido-global-color-accent', operator: '+' },
|
||||
creation: { icon: 'gift', classes: 'gradido-global-color-accent', operator: '+' },
|
||||
decay: { icon: 'droplet-half', classes: 'gradido-global-color-gray', operator: '-' },
|
||||
}
|
||||
const iconsByType = {
|
||||
send: { icon: 'arrow-left-circle', classes: 'text-danger', operator: '−' },
|
||||
receive: { icon: 'arrow-right-circle', classes: 'gradido-global-color-accent', operator: '+' },
|
||||
creation: { icon: 'gift', classes: 'gradido-global-color-accent', operator: '+' },
|
||||
decay: { icon: 'droplet-half', classes: 'gradido-global-color-gray', operator: '−' },
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'gdd-transaction-list',
|
||||
components: {
|
||||
PaginationButtons,
|
||||
DecayInformation,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentPage: 1,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
transactions: { default: () => [] },
|
||||
pageSize: { type: Number, default: 25 },
|
||||
timestamp: { type: Number, default: 0 },
|
||||
transactionCount: { type: Number, default: 0 },
|
||||
showPagination: { type: Boolean, default: false },
|
||||
},
|
||||
methods: {
|
||||
updateTransactions() {
|
||||
this.$emit('update-transactions', {
|
||||
currentPage: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
})
|
||||
window.scrollTo(0, 0)
|
||||
},
|
||||
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)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
currentPage() {
|
||||
this.updateTransactions()
|
||||
},
|
||||
timestamp: {
|
||||
immediate: true,
|
||||
handler: 'updateTransactions',
|
||||
},
|
||||
},
|
||||
}
|
||||
export default {
|
||||
name: 'gdd-transaction-list',
|
||||
components: {
|
||||
PaginationButtons,
|
||||
DecayInformation,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentPage: 1,
|
||||
}
|
||||
},
|
||||
props: {
|
||||
transactions: { default: () => [] },
|
||||
pageSize: { type: Number, default: 25 },
|
||||
timestamp: { type: Number, default: 0 },
|
||||
transactionCount: { type: Number, default: 0 },
|
||||
showPagination: { type: Boolean, default: false },
|
||||
},
|
||||
methods: {
|
||||
updateTransactions() {
|
||||
this.$emit('update-transactions', {
|
||||
currentPage: this.currentPage,
|
||||
pageSize: this.pageSize,
|
||||
})
|
||||
window.scrollTo(0, 0)
|
||||
},
|
||||
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)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
currentPage() {
|
||||
this.updateTransactions()
|
||||
},
|
||||
timestamp: {
|
||||
immediate: true,
|
||||
handler: 'updateTransactions',
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.el-table .cell {
|
||||
|
||||
@ -10,8 +10,6 @@ import { messages } from 'vee-validate/dist/locale/en.json'
|
||||
import RegeneratorRuntime from 'regenerator-runtime'
|
||||
import VueQrcode from 'vue-qrcode'
|
||||
|
||||
import VueMoment from 'vue-moment'
|
||||
|
||||
// import clickOutside from '@/directives/click-ouside.js'
|
||||
import { focus } from 'vue-focus'
|
||||
|
||||
@ -45,7 +43,6 @@ global.localVue.use(Vuex)
|
||||
global.localVue.use(IconsPlugin)
|
||||
global.localVue.use(RegeneratorRuntime)
|
||||
global.localVue.use(VueQrcode)
|
||||
global.localVue.use(VueMoment)
|
||||
global.localVue.component('validation-provider', ValidationProvider)
|
||||
global.localVue.component('validation-observer', ValidationObserver)
|
||||
// global.localVue.directive('click-outside', clickOutside)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user