Skip to content

Open source personal finance application

feat (groups): remove

ilkomec8342d723a86
diff --git a/components/groups/GroupForm.vue b/components/groups/GroupForm.vue
deleted file mode 100644
index d2b1e2bd..00000000
--- a/components/groups/GroupForm.vue
+++ /dev/null
@@ -1,131 +0,0 @@
-<script>
-export default {
- data () {
- return {
- groupName: '',
- groupAmount: null,
- groupTrnsIds: []
- }
- },
-
- methods: {
- async handleCreateGroup () {
- const isFormValid = this.validateForm()
- if (isFormValid) {
- const values = {
- amount: this.groupAmount,
- currency: this.$store.state.currencies.base,
- name: this.groupName,
- trnsIds: this.groupTrnsIds
- }
-
- await this.$store.dispatch('groups/createGroup', values)
- this.groupName = null
- this.groupAmount = null
- }
- },
-
- validateForm () {
- if (!this.groupName) {
- const groupNameRef = this.$refs.groupNameRef
- this.focusInputName(groupNameRef)
- groupNameRef.classList.remove('_error')
- setTimeout(() => { groupNameRef.classList.add('_error') }, 10)
- return false
- }
-
- return true
- },
-
- focusInputName (ref) {
- ref.querySelector('.inputText__value').focus()
- },
-
- isSelectedTrn (trnId) {
- return this.groupTrnsIds.includes(trnId)
- },
-
- handleSelectTrn (trnId) {
- this.groupTrnsIds.includes(trnId)
- ? this.groupTrnsIds = this.groupTrnsIds.filter(item => item !== trnId)
- : this.groupTrnsIds.push(trnId)
- }
- }
-}
-</script>
-
-<template lang="pug">
-.form
- .form__title {{ $t('groups.form.title') }}
- .form__group(ref="groupNameRef")
- .inputText__label {{ $t('groups.form.name') }}
- .inputText
- input.inputText__value(
- type="text"
- :placeholder="`${$t('groups.form.name')}...`"
- v-model="groupName")
-
- SharedButton(
- className="_new"
- :title="$t('groups.form.button')"
- @onClick="handleCreateGroup")
-</template>
-
-<style lang="stylus" scoped>
-@import '~assets/stylus/variables'
-
-.form
- overflow hidden
- padding 25px 20px
- background var(--c-bg-3)
- border 1px solid var(--c-bg-4)
-
- &__title
- font-header-1()
- margin-bottom 30px
-
- &__group
- padding-bottom 30px
- &._error
- animation shake .5s linear
-
-.inputText__value
- height 40px
- padding 0 16px
- font-size 16px
- background var(--c-bg-1)
- border 1px solid var(--c-bg-7)
- border-radius 3px
-
- &._number
- font-size 22px
- font-secondary()
- &::placeholder
- font-primary()
- font-size 16px
-
- &:focus
- border-color var(--c-bg-9)
-
-.inputText__label
- margin 0
- padding 0
- padding-bottom 10px
- font-size 11px;
- border 0
-
-@keyframes shake
- 8%
- 41%
- transform translateX(-10px)
- 25%
- 58%
- transform translateX(10px)
- 75%
- transform translateX(-5px)
- 92%
- transform translateX(5px)
- 0%
- 100%
- transform translateX(0)
-</style>
diff --git a/components/groups/GroupFormTrn.vue b/components/groups/GroupFormTrn.vue
deleted file mode 100644
index d8a70434..00000000
--- a/components/groups/GroupFormTrn.vue
+++ /dev/null
@@ -1,129 +0,0 @@
-<script>
-import { formatDate } from '~/utils/formatDate'
-
-export default {
- props: {
- category: {
- type: Object,
- required: true
- },
- trn: {
- type: Object,
- required: true
- },
- id: {
- type: String,
- required: true
- },
- wallet: {
- type: Object,
- required: true
- },
- className: {
- type: Object,
- default: () => {}
- }
- },
-
- computed: {
- formatedDate () {
- return formatDate(this.trn.date, 'number')
- }
- }
-}
-</script>
-
-<template lang="pug">
-.trnItem(@click="$emit('onClick')" :class="className")
-
- .trnItem__date {{ formatedDate }}
-
- .trnItem__wallet
- .walletIcon
- Icon(
- :abbr="wallet.name"
- :background="wallet.color"
- :small="true")
- .walletName {{ wallet.name }}
-
- .trnItem__wallet
- .walletIcon
- Icon(
- :abbr="category.name"
- :background="category.color"
- :small="true")
- .walletName {{ category.name }}
-
- //- .trnItem__desc(v-if="trn.description") {{ trn.description }}
-
- .trnItem__amount
- Amount(
- :currency="wallet.currency"
- :value="trn.amount"
- :type="trn.type")
-</template>
-
-<style lang="stylus" scoped>
-@import "~assets/stylus/variables/media"
-
-.trnItem
- position relative
- display flex
- align-items center
- padding 10px 0
- border-bottom 1px solid var(--c-bg-6)
- color var(--c-font-4)
-
- &:hover
- @media $media-laptop
- margin -1px -20px 0 -20px
- padding 11px 20px 10px 20px
- background var(--c-bg-5)
- border-color transparent
-
- /.light-mode &
- background var(--c-bg-5)
-
- &:last-child
- border-color transparent
-
- &._selected
- margin -1px -20px 0 -20px
- padding 10px 20px 10px 20px
- background var(--c-bg-1)
- border-bottom 1px solid var(--c-bg-6)
- border-top 1px solid var(--c-bg-6)
-
- &__amount
- align-self center
- margin-left auto
-
- &__categoryName
- white-space nowrap
- overflow hidden
- text-overflow ellipsis
-
- &__date
- padding-right 20px
- font-size 13px
-
- &__desc
- overflow hidden
- padding-right 10px
- color var(--c-font-3)
- font-size 12px
- white-space nowrap
- text-overflow ellipsis
-
- &__wallet
- display flex
- align-items center
- padding-right 20px
-
- .walletIcon
- margin-right 8px
-
- .walletName
- font-size 14px
- white-space nowrap
-</style>
diff --git a/components/groups/GroupItem.vue b/components/groups/GroupItem.vue
deleted file mode 100644
index e623d9d1..00000000
--- a/components/groups/GroupItem.vue
+++ /dev/null
@@ -1,201 +0,0 @@
-<script>
-import { formatDate } from '~/utils/formatDate'
-import { db } from '~/services/firebaseConfig'
-
-export default {
- props: {
- group: {
- type: Object,
- required: true
- }
- },
-
- data () {
- return {
- isTrnsVisible: false
- }
- },
-
- computed: {
- formatedDate () {
- return formatDate(this.group.date, 'number')
- },
-
- totalAmount () {
- return this.gotAmount.incomes - this.gotAmount.expenses || 0
- },
-
- trnsIds () {
- if (this.group.trnsIds) {
- return Object.keys(this.group.trnsIds)
- .sort((a, b) => {
- if (!this.$store.state.trns.items[a]) return
- if (this.$store.state.trns.items[a].date > this.$store.state.trns.items[b].date) return -1
- if (this.$store.state.trns.items[a].date < this.$store.state.trns.items[b].date) return 1
- return 0
- })
- }
- return []
- },
-
- gotAmount () {
- if (this.trnsIds)
- return this.$store.getters['trns/getTotalOfTrnsIds'](this.trnsIds)
-
- return 0
- },
-
- styles () {
- return {
- width: `${Math.abs(this.gotAmount.incomes - this.gotAmount.expenses) / Math.abs(this.gotAmount.incomes) * 100}%`
- }
- }
- },
-
- async mounted () {
- if (this.group.trnsIds) {
- for (const trnId of Object.keys(this.group.trnsIds)) {
- if (!this.$store.state.trns.items[trnId]) {
- await this.$store.dispatch('groups/removeTrnFromGroup', {
- groupId: this.group.id,
- trnId
- })
- }
-
- if (!this.$store.state.trns.items[trnId].groups) {
- db
- .ref(`users/${this.$store.state.user.user.uid}/trns/${trnId}/groups/${this.group.id}`)
- .set(this.group.id)
- }
- }
- }
- },
-
- methods: {
- handleTrnItemClick (trnId) {
- this.$store.commit('categories/hideCategoryModal')
- this.$store.commit('trns/showTrnModal')
- this.$store.commit('trns/setTrnModalId', trnId)
- }
- }
-}
-</script>
-
-<template lang="pug">
-.groupItem
- .groupItem__top
- .groupItem__meta
- .groupItem__name {{ group.name }}
- .groupItem__description(v-if="group.description") {{ group.description }}
-
- //- total
- .groupItem__total
- .sum._right
- .sum__title {{ $t('groups.stat.total') }}
- .sum__amount
- Amount(:currency="group.currency" :value="totalAmount")
-
- //- info
- .groupItem__info(@click="isTrnsVisible = !isTrnsVisible")
- .groupItem__amounts
- //- expenses
- .sum
- .sum__title {{ $t('groups.stat.expenses') }}
- .sum__amount
- Amount(:currency="group.currency" :type="0" :value="gotAmount.expenses")
-
- //- incomes
- .sum._right
- .sum__title {{ $t('groups.stat.incomes') }}
- .sum__amount
- Amount(:currency="group.currency" :type="1" :value="gotAmount.incomes")
-
- .groupItem__graph: .groupItem__graph__in(:style="styles")
-
- .groupItem__trns(v-if="group.trnsIds" v-show="isTrnsVisible")
- TrnsList2(:ids="trnsIds" v-slot="{ trns }")
- GroupsGroupItemTrn(
- v-for="trnId in trnsIds"
- @onClick="handleTrnItemClick"
- :category="trns[trnId].category"
- :id="trns[trnId].id"
- :key="trns[trnId].id"
- :trn="trns[trnId].trn"
- :wallet="trns[trnId].wallet"
- )
-</template>
-
-<style lang="stylus" scoped>
-@import '~assets/stylus/variables'
-
-.sum
- &__title
- opacity .6
- padding-bottom 5px
- color var(--c-font-4)
- font-size 10px
-
- +media-laptop()
- font-size 11px
-
- &._right
- text-align right
-
-.groupItem
- overflow hidden
- font-size 14px
- background var(--c-bg-4)
- border 1px solid var(--c-bg-5)
- border-radius 3px
-
- &:last-child
- margin-bottom 0
-
- &__top
- display flex
- align-items center
- justify-content space-between
- padding 12px
-
- +media-laptop()
- padding 16px
-
- &__name
- font-size 14px
-
- &__description
- padding-top 5px
- color var(--c-font-4)
- font-size 11px
-
- &__info
- padding 16px
- background var(--c-bg-3)
- border-top 1px solid var(--c-bg-2)
-
- +media-laptop()
- padding 16px
-
- &__amounts
- display flex
- justify-content space-between
- padding-bottom 8px
-
- &__graph
- overflow hidden
- background var(--c-bg-7)
- border-radius 3px
-
- &__in
- height 6px
- min-width 0px
- background rgba(44, 173, 34, .7)
-
- &__trns
- margin-top 1px
- padding 0 12px
- border-top 1px solid var(--c-bg-2)
-
- +media-laptop()
- padding 0 16px
-</style>
diff --git a/components/groups/GroupItemTrn.vue b/components/groups/GroupItemTrn.vue
deleted file mode 100644
index 9cf90933..00000000
--- a/components/groups/GroupItemTrn.vue
+++ /dev/null
@@ -1,118 +0,0 @@
-<script>
-import { formatDate } from '~/utils/formatDate'
-
-export default {
- props: {
- category: {
- type: Object,
- required: true
- },
- trn: {
- type: Object,
- required: true
- },
- id: {
- type: String,
- required: true
- },
- wallet: {
- type: Object,
- required: true
- }
- },
-
- computed: {
- formatedDate () {
- return formatDate(this.trn.date, 'number')
- }
- }
-}
-</script>
-
-<template lang="pug">
-.trnItem(@click="$emit('onClick', id)")
- .trnItem__date {{ formatedDate }}
-
- .trnItem__wallet
- .walletIcon
- Icon(
- :abbr="wallet.name"
- :background="wallet.color"
- :small="true")
- .walletName {{ wallet.name }}
-
- .trnItem__wallet
- .walletIcon
- Icon(
- :abbr="category.name"
- :background="category.color"
- :small="true")
- .walletName {{ category.name }}
-
- //- .trnItem__desc(v-if="trn.description") {{ trn.description }}
-
- .trnItem__amount
- Amount(
- :currency="wallet.currency"
- :value="trn.amount"
- :type="trn.type")
-</template>
-
-<style lang="stylus" scoped>
-@import "~assets/stylus/variables/media"
-
-.trnItem
- position relative
- display flex
- flex-flow wrap
- align-items center
- padding 10px 0
- border-bottom 1px solid var(--c-bg-6)
- color var(--c-font-4)
-
- &:hover
- @media $media-laptop
- margin -1px -20px 0 -20px
- padding 11px 20px 10px 20px
- background var(--c-bg-5)
- border-color transparent
-
- /.light-mode &
- background var(--c-bg-5)
-
- &:last-child
- border-color transparent
-
- &__amount
- align-self center
- margin-left auto
-
- &__categoryName
- white-space nowrap
- overflow hidden
- text-overflow ellipsis
-
- &__date
- padding-right 20px
- font-size 13px
-
- &__desc
- overflow hidden
- padding-right 10px
- color var(--c-font-3)
- font-size 12px
- white-space nowrap
- text-overflow ellipsis
-
- &__wallet
- display flex
- align-items center
- padding-right 20px
-
- .walletIcon
- margin-right 8px
-
- .walletName
- font-size 14px
- white-space nowrap
-</style>
diff --git a/components/groups/Groups.vue b/components/groups/Groups.vue
deleted file mode 100644
index 9946a9c9..00000000
--- a/components/groups/Groups.vue
+++ /dev/null
@@ -1,61 +0,0 @@
-<script>
-export default {
- data () {
- return {
- isShowForm: false
- }
- },
-
- computed: {
- groups () {
- const formatedGroups = {}
- if (!this.$store.state.groups)
- return
-
- for (const id in this.$store.state.groups.items) {
- formatedGroups[id] = {
- id,
- ...this.$store.state.groups.items[id]
- }
- }
-
- return formatedGroups
- }
- },
-
- async created () {
- await this.$store.dispatch('groups/initGroups')
- }
-}
-</script>
-
-<template lang="pug">
-LayoutBaseWrap
- template(slot="headerLeft")
- div {{ $t('groups.name') }}
-
- template(slot="contentLeft")
- .list
- GroupsGroupItem(
- v-for="group in groups"
- :group="group"
- :key="group.id"
- )
-
- template(slot="contentRight")
- GroupsGroupForm
-</template>
-
-<style lang="stylus" scoped>
-@import "~assets/stylus/variables"
-
-.list
- display grid
- grid-template-columns repeat(auto-fill, minmax(auto, 1fr))
- grid-column-gap 12px
- grid-row-gap 12px
-
- +media-laptop()
- grid-column-gap 16px
- grid-row-gap 16px
-</style>
diff --git a/components/layout/SidebarMenu.vue b/components/layout/SidebarMenu.vue
index dc4cdf39..e5bf2cda 100644
--- a/components/layout/SidebarMenu.vue
+++ b/components/layout/SidebarMenu.vue
@@ -21,11 +21,6 @@ export default {
icon: 'mdi mdi-folder-star',
name: this.$t('categories.name')
},
- users: {
- icon: 'mdi mdi-account-multiple',
- name: this.$t('users.title'),
- private: true
- },
settings: {
icon: 'mdi mdi-cog-outline',
name: this.$t('settings.title')
@@ -50,7 +45,6 @@ export default {
.menu
template(v-for="(menuItem, menuId) in menu")
.menuItem(
- v-if="$store.getters['user/isTester'] || !menuItem.private"
:class="{ _active: $route.name === menuId }"
@click="onClickMenu(menuId)"
)
diff --git a/components/trns/Modal.vue b/components/trns/Modal.vue
index b4f4fe85..b44e89c0 100644
--- a/components/trns/Modal.vue
+++ b/components/trns/Modal.vue
@@ -25,8 +25,7 @@ export default {
data () {
return {
- showModalConfirm: false,
- showModalGroups: false
+ showModalConfirm: false
}
},
@@ -42,9 +41,6 @@ export default {
},
wallet () {
return this.$store.state.wallets.items[this.$store.state.trns.items[this.trnId].walletId]
- },
- groups () {
- return this.$store.getters['groups/groups']
}
},
@@ -57,6 +53,7 @@ export default {
this.$store.commit('stat/setCategoryModal', { id: null, type: null })
this.$store.dispatch('ui/setActiveTabStat', 'details')
},
+
handleSetFilterWallet () {
this.setWalletFilter(this.$store.state.trns.items[this.trnId].walletId)
this.$store.commit('trns/hideTrnModal')
@@ -64,6 +61,7 @@ export default {
this.$store.commit('filter/setFilterDateNow')
this.$store.dispatch('ui/setActiveTabStat', 'details')
},
+
handleDublicateTrn () {
const trnId = this.trnId
this.$store.dispatch('trnForm/openTrnForm', { action: 'duplicate', trnId })
@@ -71,6 +69,7 @@ export default {
this.$store.commit('trns/setTrnModalId', null)
this.$store.commit('stat/setCategoryModal', { id: null, type: null })
},
+
handleEditClick () {
const trn = this.trn
const trnId = this.trnId
@@ -82,9 +81,11 @@ export default {
const { setExpression } = useCalculator()
setExpression(trn.amount)
},
+
handleDeleteClick () {
this.showModalConfirm = true
},
+
handleDeleteConfirm () {
const trnId = this.trnId
setTimeout(() => { this.$store.dispatch('trns/deleteTrn', trnId) }, 100)
@@ -92,10 +93,6 @@ export default {
this.showModalConfirm = false
this.$store.commit('trns/hideTrnModal')
this.$store.commit('trns/setTrnModalId', null)
- },
- toogleAddToGroup (groupId) {
- this.$store.dispatch('groups/toogleAddToGroup', { groupId, trnId: this.trnId })
- this.showModalGroups = false
}
}
}
@@ -169,37 +166,11 @@ Portal(
:background="wallet.color"
)
- ModalButton(
- v-if="groups && $store.getters['user/isTester']"
- :name="$t('groups.show')"
- icon="mdi mdi-folder-multiple-outline"
- @onClick="showModalGroups = true"
- )
-
.wrap
.button(
@click="close()"
) {{ $t('close') }}
- //- groups
- Portal(
- v-if="groups && $store.getters['user/isTester'] && showModalGroups"
- to="modal"
- )
- ModalBottom(
- :title="$t('groups.title')"
- paddingless
- @onClose="showModalGroups = false"
- )
- template(v-for="(group, groupId) in groups")
- .groupItem(@click="toogleAddToGroup(groupId)")
- .groupItem__active
- template(v-if="trn && trn.groups && trn.groups[groupId]")
- .mdi.mdi-check
- template(v-else)
- .mdi.mdi-plus
- .groupItem__name {{ group.name }}
-
//- delete confirm
ModalBottomConfirm(
:show="showModalConfirm"
diff --git a/components/trns/item/TrnItem.vue b/components/trns/item/TrnItem.vue
index 9d10e75f..e4c109a1 100644
--- a/components/trns/item/TrnItem.vue
+++ b/components/trns/item/TrnItem.vue
@@ -240,7 +240,6 @@ export default {
.trnItem__center
.trnItem__categoryName
| {{ category.name }}
- .trnItem__groups(v-if="trn.groups") In group
.trnItem__wallet
.trnItem__walletIcon
@@ -386,12 +385,6 @@ export default {
^[0]._stat &
padding-right 20px
- &__groups
- &__budgest
- display inline-block
- padding-left 10px
- font-size 10px
-
// Stat
// ----------------------------------------------------------------------------
.trnItem._stat._history
diff --git a/components/trns/item/TrnItemForm.vue b/components/trns/item/TrnItemForm.vue
deleted file mode 100644
index edc385cb..00000000
--- a/components/trns/item/TrnItemForm.vue
+++ /dev/null
@@ -1,243 +0,0 @@
-<script>
-import { formatDate } from '~/utils/formatDate'
-
-export default {
- name: 'TrnItemForm',
-
- props: {
- category: {
- type: Object,
- required: true
- },
- trn: {
- type: Object,
- required: true
- },
- trnId: {
- type: String,
- required: true
- },
- wallet: {
- type: Object,
- required: true
- }
- },
-
- computed: {
- formatedDate () {
- const date = formatDate(this.trn.date, 'full')
- return `${date.weekday}, ${date.day} ${date.month} ${date.year}`
- },
- formatedDateDay () {
- return formatDate(this.trn.date, 'numberDay')
- },
- formatedDateDay2 () {
- return formatDate(this.trn.date, 'trnItem')
- }
- },
-
- methods: {
- setTrnEdit () {
- const trnId = this.trnId
- this.$store.commit('trnForm/setTrnFormModalTrnId', trnId)
-
- if (this.trnId === this.$store.state.trnForm.values.trnId) {
- this.$store.commit('trnForm/setTrnFormValues', { trnId: null, amountEvaluation: null, amount: '0' })
- }
- else {
- this.$store.dispatch('trnForm/openTrnForm', { action: 'edit', trnId })
- if (this.$listeners.onClickValue) {
- this.$emit('onClickValue')
- }
- }
- }
- }
-}
-</script>
-
-<template lang="pug">
-.trnItem._lastTrns(
- :class="{ _active: $store.state.trnForm.values.trnId === trnId }"
- v-if="category && wallet"
- @click="setTrnEdit"
-)
- .trnItem__statWrap
- .trnItem__date {{ formatedDateDay2 }}
- //- base
- .trnItem__wallet
- Icon(
- :abbr="wallet.name"
- :background="wallet.color"
- :medium="true"
- :small="true")
- .trnItem__categoryIcon
- Icon(
- :background="category.color"
- :icon="category.icon"
- :medium="true"
- :round="true")
- .trnItem__categoryName {{ category.name }}
- .trnItem__desc(v-if="trn.description") {{ trn.description }}
- .trnItem__amount
- Amount(
- :currency="wallet.currency"
- :value="trn.amount"
- :type="trn.type"
- )
-</template>
-
-<style lang="stylus" scoped>
-@import "~assets/stylus/variables/margins"
-@import "~assets/stylus/variables/media"
-
-.trnItem
- position relative
- margin-top -1px
- padding-top 10px
- padding-right $m9
- padding-left $m9
- color var(--c-font-4)
-
- &._active
- background var(--c-bg-1)
-
- &:hover
- &._history
- &._stat
- &._lastTrns
- @media $media-laptop
- background var(--c-bg-5)
-
- /.light-mode &
- background var(--c-bg-5)
-
- &__amount
- align-self center
-
- ^[0]._detailed &
- grid-column 3 / 4
- grid-row 1 / 3
-
- ^[0]._history &
- grid-column 3 / 4
- grid-row 1 / 2
-
- ^[0]._stat &
- ^[0]._lastTrns &
- margin-left auto
-
- &__categoryIcon
- ^[0]._detailed &
- grid-column 1 / 2
- grid-row 1 / 3
- align-self center
-
- ^[0]._lastTrns &
- flex 0 0 24px
- padding-right 10px
-
- &__categoryName
- white-space nowrap
- overflow hidden
- text-overflow ellipsis
-
- ^[0]._detailed &
- grid-column 2 / 3
- grid-row 2 / 3
- font-size 16px
-
- ^[0]._history &
- grid-column 2 / 3
- grid-row 1 / 2
- align-self center
-
- ^[0]._lastTrns &
- padding-right 20px
-
- &__date
- font-size 13px
- padding-right 10px
- flex 0 0 80px
-
- &__desc
- color var(--c-font-2)
- font-size 14px
-
- ^[0]._detailed &
- grid-column 2
- grid-row 4
-
- ^[0]._history &
- grid-column 2 / 4
- grid-row 2 / 3
- padding-top 5px
- padding-bottom 5px
-
- ^[0]._stat &
- ^[0]._lastTrns &
- padding-right 10px
- white-space nowrap
- overflow hidden
- text-overflow ellipsis
-
- &__line
- ^[0]._history &
- grid-column 2 / 4
- grid-row 4 / 5
- padding-top 9px
- border-bottom 1px solid var(--c-bg-6)
-
- ^[0]._history:hover &
- @media $media-laptop
- border-color transparent
-
- ^[0]._history:last-child &
- border-color transparent
-
- &__statWrap
- display flex
- align-items center
- padding-bottom 10px
- border-bottom 1px solid var(--c-bg-6)
-
- ^[0]._stat:hover &
- ^[0]._lastTrns:hover &
- @media $media-laptop
- border-color transparent
-
- ^[0]._stat:last-child &
- ^[0]._lastTrns:last-child &
- border-color transparent
-
- &__wallet
- ^[0]._detailed &
- ^[0]._stat &
- ^[0]._lastTrns &
- display flex
- align-items center
- .walletIcon
- margin-right 8px
- .walletName
- font-size 14px
- white-space nowrap
-
- ^[0]._detailed &
- grid-column 2 / 3
- grid-row 3 / 4
-
- ^[0]._stat &
- padding-right 20px
- ^[0]._lastTrns &
- padding-right 20px
-
- &__walletFloatIcon
- position absolute
- left 35px
- top 24px
-
- &__groups
- &__budgest
- display inline-block
- padding-left 10px
- font-size 10px
-</style>
diff --git a/locales/en-US.js b/locales/en-US.js
index 574072de..03236549 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -246,7 +246,6 @@ export default {
remove: 'Remove',
toogle: 'Toogle chart view',
showed: 'Showed',
- groupsName: 'groups',
periodsName: 'periods',
simpleTitle: 'Line view',
groupedTitle: 'Column view',
@@ -323,26 +322,6 @@ export default {
nextStep: 'Next step'
},
- groups: {
- id: 'groups',
- title: 'Groups',
- show: 'Show groups',
- form: {
- title: 'Create new group',
- name: 'Group name',
- amount: 'Group amount',
- button: 'Create'
- },
- trns: {
- name: 'Group transactions'
- },
- stat: {
- expenses: 'Epenses',
- incomes: 'Incomes',
- total: 'Total'
- }
- },
-
users: {
title: 'Users'
}
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index d66bd327..8295f394 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -248,7 +248,6 @@ export default {
remove: 'Удалить',
toogle: 'Изменить график',
showed: 'Показано',
- groupsName: 'групп',
periodsName: 'период',
simpleTitle: 'График линия',
groupedTitle: 'График колонки',
@@ -325,26 +324,6 @@ export default {
nextStep: 'Далее'
},
- groups: {
- id: 'groups',
- title: 'Группы',
- show: 'Показать группы',
- form: {
- title: 'Create new group',
- name: 'Group name',
- amount: 'Group amount',
- button: 'Create'
- },
- trns: {
- name: 'Group transactions'
- },
- stat: {
- expenses: 'Рассход',
- incomes: 'Доход',
- total: 'Итого'
- }
- },
-
users: {
title: 'Пользователи'
}
diff --git a/store/app/actions.js b/store/app/actions.js
index 07f3bb8a..f15a3cb7 100644
--- a/store/app/actions.js
+++ b/store/app/actions.js
@@ -22,7 +22,6 @@ export default {
await dispatch('categories/initCategories', null, { root: true })
await dispatch('wallets/initWallets', null, { root: true })
await dispatch('trns/initTrns', null, { root: true })
- await dispatch('groups/initGroups', null, { root: true })
await dispatch('lang/initDbLang', null, { root: true })
dispatch('trns/uploadOfflineTrns', null, { root: true })
diff --git a/store/groups/actions.js b/store/groups/actions.js
deleted file mode 100644
index 2e3d1fe5..00000000
--- a/store/groups/actions.js
+++ /dev/null
@@ -1,83 +0,0 @@
-import dayjs from 'dayjs'
-import { db } from '~/services/firebaseConfig'
-import generateId from '~/utils/id'
-
-export default {
- initGroups ({ dispatch, rootGetters }) {
- const uid = rootGetters['user/userUid']
- const path = `users/${uid}/groups`
-
- if (uid) {
- db.ref(path).on('value', (snapshot) => {
- const items = Object.freeze(snapshot.val())
- dispatch('setGroups', items)
- }, e => console.error(e))
- }
- },
-
- setGroups ({ commit }, items) {
- commit('setGroups', items)
- },
-
- async createGroup ({ rootGetters }, values) {
- const id = generateId(dayjs().valueOf())
- const uid = rootGetters['user/userUid']
- const path = `users/${uid}/groups/${id}`
-
- await db.ref(path)
- .set({
- currency: 'RUB',
- name: values.name,
- date: dayjs().valueOf()
- })
- .then(() => { return true })
-
- return false
- },
-
- async removeGroup ({ rootGetters }, id) {
- const uid = rootGetters['user/userUid']
- const path = `users/${uid}/groups/${id}`
- await db.ref(path)
- .remove()
- .then(() => { return true })
- },
-
- async addTrnToGroup ({ rootGetters }, { groupId, trnId }) {
- const uid = rootGetters['user/userUid']
-
- // add to group
- await db.ref(`users/${uid}/groups/${groupId}/trnsIds/${trnId}`)
- .set(trnId)
- .then(() => { return true })
-
- // info in trn
- await db.ref(`users/${uid}/trns/${trnId}/groups/${groupId}`)
- .set(groupId)
- .then(() => { return true })
- },
-
- removeTrnFromGroup ({ dispatch, rootGetters }, { groupId, trnId }) {
- const uid = rootGetters['user/userUid']
-
- // remove from group
- db.ref(`users/${uid}/groups/${groupId}/trnsIds/${trnId}`).set(null)
- .then(() => { return true })
-
- // remove from trn
- db.ref(`users/${uid}/trns/${trnId}/groups/${groupId}`)
- .remove()
- .then(() => { return true })
- },
-
- toogleAddToGroup ({ dispatch, rootState, rootGetters }, { groupId, trnId }) {
- const trn = rootState.trns.items[trnId]
-
- if (trn.groups && trn.groups[groupId]) {
- dispatch('removeTrnFromGroup', { groupId, trnId })
- }
- else {
- dispatch('addTrnToGroup', { groupId, trnId })
- }
- }
-}
diff --git a/store/groups/getters.js b/store/groups/getters.js
deleted file mode 100644
index aaf53538..00000000
--- a/store/groups/getters.js
+++ /dev/null
@@ -1,11 +0,0 @@
-export default {
- /**
- * Return groups
- *
- * @return {Object} Object
- * @return {String} {}.name
- */
- groups (state, getters, rootState, rootGetters) {
- return rootState.groups.items
- }
-}
diff --git a/store/groups/index.js b/store/groups/index.js
deleted file mode 100644
index f8c40da0..00000000
--- a/store/groups/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-import actions from './actions'
-import mutations from './mutations'
-import getters from './getters'
-
-const state = () => ({
- items: {}
-})
-
-export default {
- state,
- actions,
- mutations,
- getters
-}
diff --git a/store/groups/mutations.js b/store/groups/mutations.js
deleted file mode 100644
index 1e10ffac..00000000
--- a/store/groups/mutations.js
+++ /dev/null
@@ -1,5 +0,0 @@
-export default {
- setGroups (state, items) {
- state.items = items
- }
-}
diff --git a/store/user/actions.js b/store/user/actions.js
index ca318ca4..8ddf2442 100644
--- a/store/user/actions.js
+++ b/store/user/actions.js
@@ -31,7 +31,6 @@ export default {
await dispatch('trns/unsubcribeTrns', null, { root: true })
await dispatch('wallets/unsubcribeWallets', null, { root: true })
await dispatch('app/clearUserData', null, { root: true })
- db.ref(`users/${uid}/groups`).off()
}
if (this.$router.currentRoute.name !== 'login')