mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
* initial dependency update with initial setup * initial dependency update with initial setup * lock update * Revert "initial dependency update with initial setup" This reverts commit aa71afc3eca20042a1e13066bee1730a15606dd2. * admin - moved to vite * feat(admin): migration packages update (#3327) * bump apollo package * extend vue config * create useCreationMonths composable * WIP * temporary * install dependencies * adjust configs * rework footer component * remove not needed spaces, * rework overview page * rework component * rework user search page * rework navbar * navbar adjustments * add depenedencies * style adjustment in footer * composable adjustments * update node version * rework search and pagination * feat(admin) - disable unit tests for migration time * feat(admin) - update eslint * wip on search user * rework creation formular component * feat(admin) - update eslint babel * feat(admin) - change stylelint version, fix eslint errors * feat(admin) - update dependency * feat(admin) - update dependency * feat(admin) - update dependency * feat(admin) - update dependency * feat(admin) - update dependency * feat(admin) - update dependency * feat(admin) - update dependency, update node * feat(admin) - update icons --------- Co-authored-by: Mateusz Michałowski <mateusz.michalowski@monterail.com> --------- Co-authored-by: Kamila Lach <80581523+unnunhexium@users.noreply.github.com>
71 lines
1.7 KiB
JavaScript
71 lines
1.7 KiB
JavaScript
import { ref, computed, watch } from 'vue'
|
|
import { adminOpenCreations } from '../graphql/adminOpenCreations'
|
|
import { useQuery } from '@vue/apollo-composable'
|
|
import { useI18n } from 'vue-i18n'
|
|
import toast from 'bootstrap/js/src/toast'
|
|
|
|
export default () => {
|
|
const { d } = useI18n()
|
|
|
|
const creation = ref([1000, 1000, 1000])
|
|
const userId = ref(0)
|
|
|
|
const creationDates = computed(() => {
|
|
const now = new Date(Date.now())
|
|
const dates = [now]
|
|
for (let i = 1; i < 3; i++) {
|
|
dates.push(new Date(now.getFullYear(), now.getMonth() - i, 1))
|
|
}
|
|
return dates.reverse()
|
|
})
|
|
|
|
const creationDateObjects = computed(() => {
|
|
const result = []
|
|
creationDates.value.forEach((date) => {
|
|
result.push({
|
|
short: d(date, 'month'),
|
|
long: d(date, 'long'),
|
|
year: d(date, 'year'),
|
|
date: d(date, 'short', 'en'),
|
|
})
|
|
})
|
|
return result
|
|
})
|
|
|
|
const radioOptions = () => {
|
|
return creationDateObjects.value.map((obj, idx) => {
|
|
return {
|
|
item: { ...obj, creation: creation.value[idx] },
|
|
name: obj.short + (creation.value[idx] ? ' ' + creation.value[idx] + ' GDD' : ''),
|
|
}
|
|
})
|
|
}
|
|
|
|
const creationLabel = () => {
|
|
return creationDates.value.map((date) => d(date, 'monthShort')).join(' | ')
|
|
}
|
|
|
|
const { result, error } = useQuery(adminOpenCreations, { userId }, { fetchPolicy: 'no-cache' })
|
|
|
|
watch(result, (newResult) => {
|
|
if (newResult && newResult.adminOpenCreations) {
|
|
creation.value = newResult.adminOpenCreations.map((obj) => obj.amount)
|
|
}
|
|
})
|
|
|
|
watch(error, (err) => {
|
|
if (err) {
|
|
toast.error(err.message)
|
|
}
|
|
})
|
|
|
|
return {
|
|
creation,
|
|
userId,
|
|
creationDates,
|
|
creationDateObjects,
|
|
radioOptions,
|
|
creationLabel,
|
|
}
|
|
}
|