mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
refactor: Mixin for Creation Labels
This commit is contained in:
parent
0d00c170e5
commit
bb86be723b
@ -195,6 +195,7 @@ export default {
|
|||||||
creation: {
|
creation: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: false,
|
required: false,
|
||||||
|
default: () => [null, null, null],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
export const creationMonths = {
|
export const creationMonths = {
|
||||||
props: {
|
props: {
|
||||||
creation: [1000, 1000, 1000],
|
creation: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [1000, 1000, 1000],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
creationDates() {
|
creationDates() {
|
||||||
@ -31,5 +34,8 @@ export const creationMonths = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
creationLabel() {
|
||||||
|
return this.creationDates.map((date) => this.$d(date, 'monthShort')).join(' | ')
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,9 +55,11 @@
|
|||||||
import CreationFormular from '../components/CreationFormular.vue'
|
import CreationFormular from '../components/CreationFormular.vue'
|
||||||
import UserTable from '../components/UserTable.vue'
|
import UserTable from '../components/UserTable.vue'
|
||||||
import { searchUsers } from '../graphql/searchUsers'
|
import { searchUsers } from '../graphql/searchUsers'
|
||||||
|
import { creationMonths } from '../mixins/creationMonths'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Creation',
|
name: 'Creation',
|
||||||
|
mixins: [creationMonths],
|
||||||
components: {
|
components: {
|
||||||
CreationFormular,
|
CreationFormular,
|
||||||
UserTable,
|
UserTable,
|
||||||
@ -69,7 +71,6 @@ export default {
|
|||||||
itemsMassCreation: this.$store.state.userSelectedInMassCreation,
|
itemsMassCreation: this.$store.state.userSelectedInMassCreation,
|
||||||
radioSelectedMass: '',
|
radioSelectedMass: '',
|
||||||
criteria: '',
|
criteria: '',
|
||||||
creation: [null, null, null],
|
|
||||||
rows: 0,
|
rows: 0,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
perPage: 25,
|
perPage: 25,
|
||||||
@ -163,16 +164,6 @@ export default {
|
|||||||
{ key: 'bookmark', label: this.$t('remove') },
|
{ key: 'bookmark', label: this.$t('remove') },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
creationLabel() {
|
|
||||||
const now = new Date(this.now)
|
|
||||||
const lastMonth = new Date(now.getFullYear(), now.getMonth() - 1, 1)
|
|
||||||
const beforeLastMonth = new Date(now.getFullYear(), now.getMonth() - 2, 1)
|
|
||||||
return [
|
|
||||||
this.$d(beforeLastMonth, 'monthShort'),
|
|
||||||
this.$d(lastMonth, 'monthShort'),
|
|
||||||
this.$d(now, 'monthShort'),
|
|
||||||
].join(' | ')
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currentPage() {
|
currentPage() {
|
||||||
|
|||||||
@ -35,9 +35,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import UserTable from '../components/UserTable.vue'
|
import UserTable from '../components/UserTable.vue'
|
||||||
import { searchUsers } from '../graphql/searchUsers'
|
import { searchUsers } from '../graphql/searchUsers'
|
||||||
|
import { creationMonths } from '../mixins/creationMonths'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UserSearch',
|
name: 'UserSearch',
|
||||||
|
mixins: [creationMonths],
|
||||||
components: {
|
components: {
|
||||||
UserTable,
|
UserTable,
|
||||||
},
|
},
|
||||||
@ -85,14 +87,6 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
lastMonthDate() {
|
|
||||||
const now = new Date(this.now)
|
|
||||||
return new Date(now.getFullYear(), now.getMonth() - 1, 1)
|
|
||||||
},
|
|
||||||
beforeLastMonthDate() {
|
|
||||||
const now = new Date(this.now)
|
|
||||||
return new Date(now.getFullYear(), now.getMonth() - 2, 1)
|
|
||||||
},
|
|
||||||
fields() {
|
fields() {
|
||||||
return [
|
return [
|
||||||
{ key: 'email', label: this.$t('e_mail') },
|
{ key: 'email', label: this.$t('e_mail') },
|
||||||
@ -100,14 +94,7 @@ export default {
|
|||||||
{ key: 'lastName', label: this.$t('lastname') },
|
{ key: 'lastName', label: this.$t('lastname') },
|
||||||
{
|
{
|
||||||
key: 'creation',
|
key: 'creation',
|
||||||
label: [
|
label: this.creationLabel,
|
||||||
this.$d(this.beforeLastMonthDate, 'monthShort'),
|
|
||||||
this.$d(this.lastMonthDate, 'monthShort'),
|
|
||||||
this.$d(this.now, 'monthShort'),
|
|
||||||
].join(' | '),
|
|
||||||
formatter: (value, key, item) => {
|
|
||||||
return value.join(' | ')
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{ key: 'show_details', label: this.$t('details') },
|
{ key: 'show_details', label: this.$t('details') },
|
||||||
{ key: 'confirm_mail', label: this.$t('confirmed') },
|
{ key: 'confirm_mail', label: this.$t('confirmed') },
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user