Skip to content

Open source personal finance application

update 3.1.3

ilkome4414ab72b38b
diff --git a/assets/stylus/common/animations.styl b/assets/stylus/common/animations.styl
index aa238951..e201e29f 100644
--- a/assets/stylus/common/animations.styl
+++ b/assets/stylus/common/animations.styl
@@ -1,3 +1,5 @@
+$transition-style = cubic-bezier(.17, .04, .03, 1)
+
.fadeIn
&-enter-active
&-leave-active
@@ -25,19 +27,30 @@
.slide
&-enter-active
- &-leave-active
opacity 1
- transform translate(0, 0)
- transition opacity 100ms ease-out, transform 200ms ease-out
+ anim()
+
+ @media $media-phone
+ transform translate(0, 0)
+ transition opacity 200ms ease-out, transform 250ms ease-out
+
+ @media $media-laptop
+ transform translate(0, 0)
&-enter
- &-leave-to
opacity 0
- transform translate(0, 10px)
- transition opacity 100ms ease-out, transform 200ms ease-out
+ transition opacity 200ms ease-out, transform 250ms ease-out
+
+ @media $media-phone
+ transform translate(0, 10px)
+
+ @media $media-laptop
+ transform translate(10px, 0)
+ &-leave-active
&-leave-to
- transform translate(0, 100px)
+ opacity 0
+ transition none
.slide2
&-enter-active
diff --git a/assets/stylus/mixins/animations.styl b/assets/stylus/mixins/animations.styl
index 454c8e2e..73d5af67 100644
--- a/assets/stylus/mixins/animations.styl
+++ b/assets/stylus/mixins/animations.styl
@@ -1,6 +1,8 @@
-// TODO: move to variables
-anim()
- transition $transition-time $transition-style
+$transition-time = 350ms
+$transition-style = cubic-bezier(.17, .04, .03, 1)
+
+anim($time = $transition-time, $style = $transition-style)
+ transition $time $style
anim-all($time = $transition-time)
transition all $time $transition-style
diff --git a/assets/stylus/variables/colors-dark.styl b/assets/stylus/variables/colors-dark.styl
index c5674c0a..8295dfe2 100644
--- a/assets/stylus/variables/colors-dark.styl
+++ b/assets/stylus/variables/colors-dark.styl
@@ -14,6 +14,7 @@ html.dark-mode
--c-bg-1 rgba(10, 10, 10, 1)
--c-bg-2 rgba(17, 17, 17, 1)
--c-bg-3 rgba(23, 23, 23, 1)
+ --c-bg-33 #161616
--c-bg-4 rgba(28, 28, 28, 1)
--c-bg-5 rgba(35, 35, 35, 1)
--c-bg-6 rgba(39, 39, 39, 1)
diff --git a/assets/stylus/variables/colors-light.styl b/assets/stylus/variables/colors-light.styl
index 5aa0398b..80d0e64b 100644
--- a/assets/stylus/variables/colors-light.styl
+++ b/assets/stylus/variables/colors-light.styl
@@ -13,6 +13,7 @@ html
// --------------------------------------------
--c-bg-1 rgba(229, 229, 229, 1)
--c-bg-2 rgba(250, 250, 250, 1)
+ --c-bg-33 rgba(244, 244, 244, 1)
--c-bg-3 rgba(244, 244, 244, 1)
--c-bg-4 rgba(240, 240, 240, 1)
--c-bg-5 rgba(220, 220, 220, 1)
diff --git a/components/SummaryRow2.vue b/components/SummaryRow2.vue
new file mode 100644
index 00000000..5d7fd019
--- /dev/null
+++ b/components/SummaryRow2.vue
@@ -0,0 +1,91 @@
+<script>
+export default {
+ props: {
+ incomesAmount: {
+ type: Number,
+ default: 0
+ },
+ expensesAmount: {
+ type: Number,
+ default: 0
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.summary
+ //- Incomes
+ .summary__item._incomes
+ .summary__item__title._incomes {{ $lang.money.incomes }}
+ .summary__item__amount
+ Amount(
+ :center="true"
+ :currency="$store.state.currencies.base"
+ :type="1"
+ :value="incomesAmount || 0"
+ size="md"
+ )
+
+ //- Expenses
+ .summary__item._expenses
+ .summary__item__title._expenses {{ $lang.money.expenses }}
+ .summary__item__amount
+ Amount(
+ :center="true"
+ :currency="$store.state.currencies.base"
+ :value="expensesAmount || 0"
+ :type="0"
+ size="md"
+ )
+
+ //- Total
+ .summary__item._total
+ template(v-if="(incomesAmount - expensesAmount) !== 0")
+ .summary__item__title {{ $lang.money.total }}
+ .summary__item__amount
+ Amount(
+ v-if="incomesAmount > 0 || expensesAmount > 0"
+ :center="true"
+ :currency="$store.state.currencies.base"
+ :value="incomesAmount - expensesAmount"
+ size="md"
+ )
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables/margins"
+
+.summary
+ display flex
+ // padding $m6 0
+ // background var(--c-bg-4)
+ // border-radius $m5
+
+ &__item
+ position relative
+ padding-right 32px
+ display flex
+ flex-flow column
+ justify-content center
+
+ &:after
+ position absolute
+ right 16px
+ top 50%
+ content ""
+ width 1px
+ height 32px
+ background var(--c-bg-7)
+ transform translateY(-50%)
+
+ &:last-child
+ padding-right 0
+ &:after
+ display none
+
+ &__title
+ padding-bottom $m5
+ color var(--c-font-3)
+ font-size 12px
+</style>
diff --git a/components/categories/CategoryStatModal.vue b/components/categories/CategoryStatModal.vue
new file mode 100644
index 00000000..368efdf4
--- /dev/null
+++ b/components/categories/CategoryStatModal.vue
@@ -0,0 +1,73 @@
+<script>
+export default {
+ name: 'CategoryStatModal',
+
+ data () {
+ return {
+ show: true
+ }
+ },
+
+ computed: {
+ categoryId () {
+ return this.$store.state.stat.categoryModal.id
+ },
+
+ category () {
+ return this.$store.state.categories.items[this.categoryId]
+ },
+
+ showChildCategories () {
+ const childCategoriesIds = this.$store.getters['categories/getChildCategoriesIds'](this.categoryId)
+
+ const childCatsIdsWithTrns = []
+ for (const childCategoryId of childCategoriesIds) {
+ const trnsIds = this.$store.getters['trns/getTrnsIdsByFilter']({
+ categoryId: childCategoryId,
+ type: this.type
+ })
+ if (trnsIds.length > 0) { childCatsIdsWithTrns.push(childCategoryId) }
+ }
+
+ if (childCatsIdsWithTrns.length > 0) { return true }
+ return false
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+Portal(
+ v-if="$store.state.stat.categoryModal.show"
+ to="modal"
+)
+ ModalBottom(
+ @onClose="$store.commit('stat/setCategoryModalShow', false)"
+ @afterClose="$store.commit('stat/setCategoryModalId', null)"
+ )
+ template(#header)
+ .modalBottom__header__title {{ category.name }}
+ .modalBottom__icon
+ Icon(
+ :icon="category.icon"
+ :background="category.color || $store.state.ui.defaultBgColor"
+ :round="true"
+ :big="true"
+ )
+
+ template(v-if="showChildCategories")
+ StatItemChildCats2(:categoryId="categoryId", :type="0")
+ StatItemChildCats2(:categoryId="categoryId", :type="1")
+
+ template(v-else)
+ TrnsList(
+ ui="stat"
+ :incomes="true"
+ :expenses="false"
+ :categoryId="categoryId"
+ )
+</template>
+
+<style lang="stylus" scoped>
+//
+</style>
diff --git a/components/categories/form/CategoryForm.vue b/components/categories/form/CategoryForm.vue
index 1cc35116..9438940e 100644
--- a/components/categories/form/CategoryForm.vue
+++ b/components/categories/form/CategoryForm.vue
@@ -157,9 +157,8 @@ export default {
ComponentWrap
template(slot="headerLeft")
template(v-if="!categoryId")
- div Categories
div {{ $lang.categories.createNewTitle }}
- template(v-else) Categories __ {{ $lang.categories.editTitle }}
+ template(v-else) {{ $lang.categories.editTitle }}
template(slot="content")
.form
@@ -224,65 +223,72 @@ ComponentWrap
:alt="true")
//- colors
- ModalBottom(
- :center="true"
- :show="showColors"
- :title="$lang.categories.form.color.placeholder"
- @onClose="showColors = false")
- .inputText
- .inputText__colors
- .colors
- .colorItem(
- :class="{ _active: category.color === color }"
- :style="{ background: color }"
- v-for="color in colors"
- @click="handleColorSelect(color)"
- )
- .customColor
- .customColor__title {{ $lang.categories.form.color.custom }}
- input.customColor__value(v-model="category.color" type="color")
+ Portal(
+ v-if="showColors"
+ to="modal"
+ )
+ ModalBottom(
+ :center="true"
+ :title="$lang.categories.form.color.placeholder"
+ @onClose="showColors = false"
+ )
+ .inputText
+ .inputText__colors
+ .colors
+ .colorItem(
+ :class="{ _active: category.color === color }"
+ :style="{ background: color }"
+ v-for="color in colors"
+ @click="handleColorSelect(color)"
+ )
+ .customColor
+ .customColor__title {{ $lang.categories.form.color.custom }}
+ input.customColor__value(v-model="category.color" type="color")
//- parent
- ModalBottom(
- :center="true"
- :show="showParents"
- :title="$lang.categories.form.parent.label"
- @onClose="showParents = false")
- .padding-bottom
- ModalButton(
- :name="$lang.categories.form.parent.no"
- icon="mdi mdi-folder-star"
- @onClick="() => handleParenCategorySelect(0)")
- CategoriesView(
- :noPadding="true"
- :ids="$store.getters['categories/categoriesForBeParent'].filter(cId => cId !== categoryId)"
- @onClick="handleParenCategorySelect")
+ Portal(
+ v-if="showParents"
+ to="modal"
+ )
+ ModalBottom(
+ key="parent"
+ :center="true"
+ :title="$lang.categories.form.parent.label"
+ @onClose="showParents = false"
+ )
+ .padding-bottom
+ ModalButton(
+ :name="$lang.categories.form.parent.no"
+ icon="mdi mdi-folder-star"
+ @onClick="() => handleParenCategorySelect(0)")
+ CategoriesView(
+ :noPadding="true"
+ :ids="$store.getters['categories/categoriesForBeParent'].filter(cId => cId !== categoryId)"
+ @onClick="handleParenCategorySelect")
//- icons
- ModalBottom(
- :center="true"
- :show="showIcons"
- :title="$lang.categories.form.icon.placeholder"
- @onClose="showIcons = false"
+ Portal(
+ v-if="showIcons"
+ to="modal"
)
- .icons
- .icons__group(
- v-for="iconGroup in icons"
- )
- .iconItem(
- v-for="icon in iconGroup"
- :class="{ _active: category.icon === icon }"
- :style="{ color: category.color }"
- @click="handleIconSelect(icon)"
+ ModalBottom(
+ :center="true"
+ :title="$lang.categories.form.icon.placeholder"
+ @onClose="showIcons = false"
+ )
+ .icons
+ .icons__group(
+ v-for="iconGroup in icons"
)
- div(:class="icon")
+ .iconItem(
+ v-for="icon in iconGroup"
+ :class="{ _active: category.icon === icon }"
+ :style="{ color: category.color }"
+ @click="handleIconSelect(icon)"
+ )
+ div(:class="icon")
template(slot="bottom")
- .col
- Button(
- :class="['_text-center _ml-big', { _inline: $store.state.ui.pc }]"
- :title="$lang.base.cancel"
- @onClick="$router.push('/cool')")
.col
Button(
:class="['_text-center _blue _ml-big', { _inline: $store.state.ui.pc }]"
diff --git a/components/categories/item/CategoryItem.vue b/components/categories/item/CategoryItem.vue
index 7e0fb7ea..b2cde3b2 100644
--- a/components/categories/item/CategoryItem.vue
+++ b/components/categories/item/CategoryItem.vue
@@ -50,15 +50,16 @@ export default {
Icon(
@click="handleIconClick"
:icon="category.icon"
- :small="ui === '_flat'"
:color="category.color || $store.state.ui.defaultBgColor"
:category="true"
)
.categoryItem__name
+ .parent(v-if="childCategoriesIds.length > 0") {{ childCategoriesIds.length }}
.parent(v-if="ui === '_flat' && parentCategory") {{ parentCategory.name }}
.child {{ category.name }}
- .categoryItem__childNum(v-if="childCategoriesIds.length > 0") {{ childCategoriesIds.length }}
+
+ .categoryItem__dots(v-if="childCategoriesIds.length > 0"): .mdi.mdi-dots-vertical
</template>
<style lang="stylus" scoped>
@@ -68,22 +69,23 @@ export default {
.categoryItem
overflow hidden
+ cursor pointer
position relative
display flex
flex-flow column nowrap
align-items center
justify-content center
- padding $m7 0
+ padding $m6
color var(--c-font-1)
- background var(--c-bg-6)
- border-radius $m4
+ background var(--c-bg-3)
+ border-radius $m5
&._flat
- flex-flow row nowrap
+ flex-flow column
align-items center
- justify-content flex-start
+ justify-content center
flex 1 1 auto
- padding 10px 12px
+ padding $m6
@media $media-laptop
padding $m6 0
@@ -95,8 +97,7 @@ export default {
padding-bottom $m4
^[0]._flat &
- padding-bottom 0
- padding-right $m5
+ padding-bottom $m3
&__name
overflow hidden
@@ -108,29 +109,29 @@ export default {
^[0]._flat &
min-height inherit
- padding-top 1px
- color var(--c-font-3)
- text-align left
-
- .parent
- padding-bottom $m2
- font-size 12px
-
- .child
- font-size 16px
&:last-child
padding-bottom 0
- &__childNum
+ .parent
+ padding-bottom $m3
+ color var(--c-font-4)
+ font-size 12px
+ text-align center
+
+ .child
+ color var(--c-font-1)
+ font-size 14px
+ text-align center
+
+ /.light-mode &
+ color var(--c-font-2)
+
+
+ &__dots
position absolute
top $m5
- right $m6
- display flex
- align-items center
- justify-content center
- font-secondary()
- color var(--c-font-4)
+ right $m4
+ color var(--c-font-5)
font-size 18px
- font-weight 500
</style>
diff --git a/components/categories/list/CategoriesView.vue b/components/categories/list/CategoriesView.vue
index 00703f8f..7ab1fd9f 100644
--- a/components/categories/list/CategoriesView.vue
+++ b/components/categories/list/CategoriesView.vue
@@ -21,10 +21,6 @@ export default {
type: Boolean,
default: false
},
- borderTop: {
- type: Boolean,
- default: false
- },
ui: {
type: String,
default: null
@@ -41,16 +37,16 @@ export default {
</script>
<template lang="pug">
-.categories(:class="{ _noPadding: noPadding, _noPaddingBottom: noPaddingBottom, _borderTop: borderTop, [ui]: ui }")
+.categories(:class="{ _noPadding: noPadding, _noPaddingBottom: noPaddingBottom, [ui]: ui }")
.categories__title(v-if="title") {{ title }}
.categories__list
CategoryItem(
v-for="categoryId in categoresIds"
+ :category="$store.state.categories.items[categoryId]"
:id="categoryId"
- :ui="ui"
:key="categoryId"
- :category="$store.state.categories.items[categoryId]"
+ :ui="ui"
v-on="$listeners"
)
</template>
@@ -59,10 +55,4 @@ export default {
.categories._flat
overflow hidden
padding 0
-
- .categories__list
- display grid
- grid-template-columns repeat(auto-fit, minmax(160px, 1fr))
- grid-column-gap $m7
- grid-row-gap $m7
</style>
diff --git a/components/categories/list/categories.styl b/components/categories/list/categories.styl
index 63e6ce89..499e22fb 100644
--- a/components/categories/list/categories.styl
+++ b/components/categories/list/categories.styl
@@ -27,9 +27,9 @@
padding-bottom 0
^[0]._borderTop &
- margin-top $m7
- padding-top $m7
- border-top 1px solid var(--c-bg-6)
+ margin-top $m6
+ padding-top $m8
+ border-top 1px solid var(--c-bg-4)
&__desc
padding $m7
diff --git a/components/categories/modal/CategoryModal.vue b/components/categories/modal/CategoryModal.vue
index 089edf21..1ab69f95 100644
--- a/components/categories/modal/CategoryModal.vue
+++ b/components/categories/modal/CategoryModal.vue
@@ -2,6 +2,13 @@
import { db } from '~/services/firebaseConfig'
export default {
+ props: {
+ slider: {
+ type: Object,
+ default: () => {}
+ }
+ },
+
data () {
return {
showModalConfirm: false
@@ -40,6 +47,12 @@ export default {
this.$store.dispatch('ui/setActiveTab', 'stat')
this.$store.commit('filter/setFilterDateNow')
this.$store.dispatch('filter/setFilterCategoryId', this.categoryId)
+ this.$store.commit('categories/hideCategoryModal')
+ this.$store.commit('categories/setCategoryModalId', null)
+
+ if (this.slider) {
+ this.slider.slideTo(1)
+ }
},
handleEditClick () {
@@ -78,7 +91,7 @@ export default {
this.$store.commit('categories/setCategoryModalId', null)
setTimeout(async () => {
- await this.$store.dispatch('deleteTrnsByIds', trnsIds)
+ await this.$store.dispatch('trns/deleteTrnsByIds', trnsIds)
db.ref(`users/${uid}/categories/${id}`)
.remove()
.then(() => { console.log('category deleted') })
@@ -89,42 +102,46 @@ export default {
</script>
<template lang="pug">
-ModalBottom(
- v-if="$store.state.categories.modal.id"
- :show="$store.state.categories.modal.show"
- @onClose="$store.commit('categories/hideCategoryModal')"
- @afterClose="$store.commit('categories/setCategoryModalId', null)")
- template(slot="header")
- .modalBottom__header__back: .mdi.mdi-chevron-left
- .modalBottom__header__title {{ category.name }}
- .modalBottom__child(v-if="childCategoriesIds.length > 0") {{ childCategoriesIds.length }}
- .modalBottom__icon
- Icon(
- :icon="category.icon"
- :background="category.color || $store.state.ui.defaultBgColor"
- :round="true"
- :big="true")
-
- template(slot="btns")
- ModalButton(
- :name="$lang.base.delete"
- icon="mdi mdi-delete"
- @onClick="handleDeleteClick")
- ModalButton(
- :name="$lang.base.edit"
- icon="mdi mdi-pencil"
- @onClick="handleEditClick")
- ModalButton(
- :name="$lang.base.filter"
- icon="mdi mdi-filter-outline"
- @onClick="handleSetFilterCategory")
-
- template(v-if="childCategoriesIds.length")
- CategoriesView(
- :borderTop="true"
- :ids="childCategoriesIds"
- :noPadding="true"
- @onClick="id => $store.dispatch('categories/showCategoryModal', id)")
+div
+ Portal(
+ v-if="$store.state.categories.modal.id"
+ to="modal"
+ )
+ ModalBottom(
+ :key="$store.state.categories.modal.id"
+ @onClose="$store.commit('categories/hideCategoryModal')"
+ @afterClose="$store.commit('categories/setCategoryModalId', null)"
+ )
+ template(slot="header")
+ .modalBottom__header__title {{ category.name }}
+ .modalBottom__child(v-if="childCategoriesIds.length > 0") {{ childCategoriesIds.length }}
+ .modalBottom__icon
+ Icon(
+ :icon="category.icon"
+ :background="category.color || $store.state.ui.defaultBgColor"
+ :round="true"
+ :big="true")
+
+ template(slot="btns")
+ ModalButton(
+ :name="$lang.base.delete"
+ icon="mdi mdi-delete"
+ @onClick="handleDeleteClick")
+ ModalButton(
+ :name="$lang.base.edit"
+ icon="mdi mdi-pencil"
+ @onClick="handleEditClick")
+ ModalButton(
+ :name="$lang.base.filter"
+ icon="mdi mdi-filter-outline"
+ @onClick="handleSetFilterCategory")
+
+ template(v-if="childCategoriesIds.length")
+ CategoriesView(
+ :borderTop="true"
+ :ids="childCategoriesIds"
+ :noPadding="true"
+ @onClick="id => $store.dispatch('categories/showCategoryModal', id)")
ModalBottomConfirm(
:show="showModalConfirm"
diff --git a/components/currencies/CurrencyModal.vue b/components/currencies/CurrencyModal.vue
index d1056ce0..e9029f43 100644
--- a/components/currencies/CurrencyModal.vue
+++ b/components/currencies/CurrencyModal.vue
@@ -10,11 +10,15 @@ export default {
</script>
<template lang="pug">
+Portal(
+ v-if="$store.state.currencies.modal.show"
+ to="modal"
+)
ModalBottom(
:center="true"
- :show="$store.state.currencies.modal.show"
title="Select base currency"
- @onClose="$store.commit('currencies/hideBaseCurrenciesModal')")
+ @onClose="$store.commit('currencies/hideBaseCurrenciesModal')"
+ )
.inputText
.currencies
.currencies__item(
diff --git a/components/dashboard/DashboardNav.vue b/components/dashboard/DashboardNav.vue
index eeb2bde5..7f2432fe 100644
--- a/components/dashboard/DashboardNav.vue
+++ b/components/dashboard/DashboardNav.vue
@@ -103,7 +103,7 @@ export default {
ContextMenuItem(
icon="mdi mdi-currency-usd"
title="Change base currency"
- @onClick="$store.commit('showBaseCurrenciesModal')"
+ @onClick="$store.commit('currencies/showBaseCurrenciesModal')"
@onClose="visibleContextMenu = !visibleContextMenu")
</template>
diff --git a/components/filter/FilterItem.vue b/components/filter/FilterItem.vue
index d1989ef9..bc577bde 100644
--- a/components/filter/FilterItem.vue
+++ b/components/filter/FilterItem.vue
@@ -32,7 +32,8 @@ export default {
.filterItem(
:class="className"
:style="{ background: color }"
- @click="$emit('onClick')")
+ @click="$emit('onClick')"
+)
.filterItem__icon
Icon(
:icon="icon"
@@ -53,10 +54,10 @@ export default {
display flex
flex-flow row
align-items center
- padding 8px 12px
+ padding 6px 12px
color var(--c-font-1)
white-space nowrap
- border-radius $m3
+ border-radius $m5
&._pc
margin-right 20px
@@ -69,8 +70,8 @@ export default {
margin-right 0
&._clear
- margin-left auto
margin-right 0
+ margin-left auto
color var(--c-font-4)
&:hover
diff --git a/components/groups/GroupItem.vue b/components/groups/GroupItem.vue
index 96081968..513bd799 100644
--- a/components/groups/GroupItem.vue
+++ b/components/groups/GroupItem.vue
@@ -29,6 +29,7 @@ export default {
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
@@ -55,11 +56,16 @@ export default {
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 })
+ 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)
+ db
+ .ref(`users/${this.$store.state.user.user.uid}/trns/${trnId}/groups/${this.group.id}`)
+ .set(this.group.id)
}
}
}
diff --git a/components/groups/Groups.vue b/components/groups/Groups.vue
index 5dc464ba..034cdf6c 100644
--- a/components/groups/Groups.vue
+++ b/components/groups/Groups.vue
@@ -9,6 +9,7 @@ export default {
computed: {
groups () {
const formatedGroups = {}
+ if (!this.$store.state.groups) { return }
for (const id in this.$store.state.groups.items) {
formatedGroups[id] = {
id,
diff --git a/components/layout/Layout.vue b/components/layout/Layout.vue
index 80f8bfa5..13aff86f 100644
--- a/components/layout/Layout.vue
+++ b/components/layout/Layout.vue
@@ -5,8 +5,8 @@ export default {
<template lang="pug">
.layout
- LayoutMobile(v-if="$store.state.ui.mobile")
- LayoutPc(v-if="$store.state.ui.pc")
+ LazyLayoutMobile2(v-if="$store.state.ui.mobile")
+ LazyLayoutPc(v-if="$store.state.ui.pc")
</template>
<style lang="stylus" scoped>
diff --git a/components/layout/LayoutMobile.vue b/components/layout/LayoutMobile.vue
index 35f85188..8b2cb30f 100644
--- a/components/layout/LayoutMobile.vue
+++ b/components/layout/LayoutMobile.vue
@@ -3,6 +3,8 @@ import Swiper from 'swiper'
import 'swiper/swiper-bundle.min.css'
export default {
+ name: 'LayoutMobile',
+
data () {
return {
slider: null
@@ -20,7 +22,10 @@ export default {
slidesPerView: 'auto',
initialSlide: 1,
resistanceRatio: 0,
- touchReleaseOnEdges: true
+ touchReleaseOnEdges: true,
+ shortSwipes: false,
+ longSwipesRatio: 0.1,
+ longSwipesMs: 60
})
},
@@ -106,7 +111,7 @@ export default {
//- stat
transition(name="animation-tab")
.tab(v-show="activeTab === 'stat'")
- LayoutMobileStat
+ LayoutMobile2
//- trns
transition(name="animation-tab")
diff --git a/components/layout/LayoutMobile2.vue b/components/layout/LayoutMobile2.vue
new file mode 100644
index 00000000..88259bef
--- /dev/null
+++ b/components/layout/LayoutMobile2.vue
@@ -0,0 +1,413 @@
+<script>
+import Swiper from 'swiper'
+import 'swiper/swiper-bundle.min.css'
+
+export default {
+ name: 'LayoutMobile',
+
+ data () {
+ return {
+ slider: null,
+ visibleContextMenu: false,
+
+ selectedPeriodAmount: {
+ label: '',
+ incomes: '',
+ expenses: ''
+ },
+
+ periods: [{
+ slug: 'day',
+ name: this.$lang.dates.day.simple
+ }, {
+ slug: 'week',
+ name: this.$lang.dates.week.simple
+ }, {
+ slug: 'month',
+ name: this.$lang.dates.month.simple
+ }, {
+ slug: 'year',
+ name: this.$lang.dates.year.simple
+ }]
+ }
+ },
+
+ computed: {
+ activeTab () {
+ return this.$store.state.ui.activeTab
+ },
+
+ stat () {
+ return this.$store.getters['stat/statCurrentPeriod']
+ },
+
+ periodName () {
+ return this.$store.state.filter.period
+ }
+ },
+
+ mounted () {
+ this.slider = this.slider = new Swiper(this.$refs.slider, {
+ slidesPerView: 'auto',
+ initialSlide: 1,
+ resistanceRatio: 0,
+ touchReleaseOnEdges: true,
+ shortSwipes: false,
+ longSwipesRatio: 0.1,
+ longSwipesMs: 60
+ })
+ },
+
+ methods: {
+ clickHandler () {
+ const index = this.slider.activeIndex
+ index === 0 && this.slider.slideNext()
+ },
+
+ handleShowWalletModal (id) {
+ this.$store.commit('wallets/showWalletModal')
+ this.$store.commit('wallets/setWalletModalId', id)
+ },
+
+ changePeriod (period) {
+ this.$store.dispatch('filter/setPeriod', period)
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.wrap
+ .layoutMobile
+ .layoutMobile__content
+ .swiper-container(ref="slider")
+ .swiper-wrapper
+ //- Wallets
+ .swiper-slide
+ ComponentWrap(:contentPadding="false")
+ template(slot="content")
+ WalletsTotal
+ WalletsList3(
+ @onClick="(id) => handleShowWalletModal(id)"
+ )
+
+ template(slot="bottom")
+ .flex
+ .col
+ Button(
+ :title="$lang.wallets.new"
+ className="_inline _small"
+ @onClick="$store.dispatch('ui/setActiveTab', 'createWallet')"
+ )
+ .col
+ Button(
+ :title="$lang.base.sort"
+ className="_inline _small"
+ @onClick="$store.dispatch('ui/setActiveTab', 'walletsSort')"
+ )
+
+ //- Stat
+ //------------------------------------------------------------------------------
+ .swiper-slide
+ .page
+ .page__wrap
+ .page__nav
+ h1: Date
+ .page__customize
+ ContextMenu(
+ :position="{ right: '0px', top: '0px' }"
+ :visible="visibleContextMenu"
+ @onClickOpener="visibleContextMenu = !visibleContextMenu")
+
+ template(slot="opener")
+ .opener
+ .mdi.mdi-tune
+
+ template(slot="content")
+ ContextMenuItem(
+ icon="mdi mdi-chart-bar-stacked"
+ title="Periods chart"
+ :showCheckbox="true"
+ :checkboxValue="$store.state.ui.statGraphsVisibility === 'visible'"
+ @onClick="$store.dispatch('ui/toogleShowStatGraphs')")
+
+ ContextMenuItem(
+ icon="mdi mdi-folder-star"
+ title="Cats chart"
+ :showCheckbox="true"
+ :checkboxValue="$store.state.ui.catsChart === 'visible'"
+ @onClick="$store.dispatch('ui/toogleVisibleCatsChart')")
+
+ ContextMenuItem(
+ icon="mdi mdi-chart-gantt"
+ title="Cats stat"
+ :showCheckbox="true"
+ :checkboxValue="$store.state.ui.statItems === 'visible'"
+ @onClick="$store.dispatch('ui/toogleVisibilityStatItems')")
+
+ .context-menu-sep
+
+ ContextMenuItem(
+ icon="mdi mdi-palette"
+ title="Change theme"
+ @onClick="$store.dispatch('ui/changeTheme')")
+
+ .page__content
+ .chartBar(v-show="$store.state.ui.statGraphsVisibility === 'visible'")
+ ChartMenu2
+ StatChartsLine2
+
+ .switcher
+ .switcher__content
+ .switcher__item._arrow(
+ :class="{ _disable: $store.state.filter.period === 'all' || $store.getters['stat/isLastPeriodSelected'] }"
+ @click="$store.dispatch('filter/setPeriodNext')"
+ ): .mdi.mdi-chevron-left
+ .switcher__item(
+ v-for="periodItem in periods"
+ :key="periodItem.slug"
+ :class="{ _active: $store.state.filter.period === periodItem.slug }"
+ @click="changePeriod(periodItem.slug)"
+ ) {{ periodItem.name }}
+ .switcher__item._arrow(
+ :class="{ _disable: $store.state.filter.period === 'all' || $store.getters['stat/isFirstPeriodSelected'] }"
+ @click="$store.dispatch('filter/setPeriodPrev')"
+ ): .mdi.mdi-chevron-right
+
+ StatMobile2
+
+ //- Categories
+ .swiper-slide
+ ComponentWrap(:contentPadding="false")
+ template(slot="headerLeft") {{ $lang.categories.name }}
+
+ template(slot="content")
+ CategoriesList(
+ :style="{ paddingTop: '16px' }"
+ @onClick="(id) => $store.dispatch('categories/showCategoryModal', id)"
+ )
+
+ template(slot="bottom")
+ .flex
+ .col
+ Button(
+ :title="$lang.categories.new"
+ className="_inline _small"
+ @onClick="$store.dispatch('ui/setActiveTab', 'createCategory')"
+ )
+
+ .swiper-slide._sidebar
+ .menuWrap
+ Menu(
+ @onClickMenuCalback="slider.slideNext()"
+ :slider="slider"
+ )
+
+ .layoutMobile__menu
+ LayoutMobileMenu2(:slider="slider")
+
+ //- Modals
+ CategoryModal(:slider="slider")
+ CurrencyModal
+ TrnForm
+ TrnModal
+ WalletModal(:slider="slider")
+ CategoryStatModal
+
+ //- Caegory Form: create or edit
+ //------------------------------------------------------------------------------
+ Portal(
+ v-if="activeTab === 'createCategory'"
+ to="modal"
+ )
+ ModalBottom(
+ key="createCategory"
+ @onClose="$store.dispatch('ui/setActiveTab', 'stat')"
+ )
+ CategoryForm
+
+ //- Settings
+ //------------------------------------------------------------------------------
+ Portal(
+ v-if="activeTab === 'settings'"
+ to="modal"
+ )
+ ModalBottom(@onClose="$store.dispatch('ui/setActiveTab', 'stat')")
+ Settings(v-if="activeTab === 'settings'")
+
+ //- Wallet Form: create or edit
+ //------------------------------------------------------------------------------
+ Portal(
+ v-if="activeTab === 'createWallet'"
+ to="modal"
+ )
+ ModalBottom(
+ :key="$store.state.wallets.editId"
+ @onClose="$store.dispatch('ui/setActiveTab', 'stat')"
+ )
+ WalletForm
+
+ //- Wallet Sort
+ //------------------------------------------------------------------------------
+ Portal(
+ v-if="activeTab === 'walletsSort'"
+ to="modal"
+ )
+ ModalBottom(
+ @onClose="$store.dispatch('ui/setActiveTab', 'stat')"
+ )
+ template(#default="{ closeModal }")
+ WalletsSort(
+ v-if="activeTab === 'walletsSort'"
+ @closeModal="closeModal"
+ )
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables/animations"
+@import "~assets/stylus/variables/margins"
+@import "~assets/stylus/variables/media"
+@import "~assets/stylus/variables/fonts"
+@import "~assets/stylus/variables/scroll"
+
+.opener
+ opacity .6
+ padding 8px 0 0 0
+ font-size 20px
+
+.page
+ overflow hidden
+ position relative
+ width 100%
+ height 100%
+
+ &__nav
+ z-index 100
+ opacity .95
+ position sticky
+ top 0
+ padding $m7
+ background var(--c-bg-2)
+
+ &__wrap
+ overflow hidden
+ overflow-y auto
+ scrollbar()
+ position relative
+ height 100%
+
+ h1
+ padding-bottom 0
+ font-size 18px
+
+ &__content
+ padding 0 $m7
+
+ &__customize
+ z-index 20
+ position absolute
+ top $m5
+ right $m7
+
+.chartBar
+ position relative
+ margin 0 -8px
+ padding 8px
+ padding-top 0
+ background var(--c-bg-3)
+ border-left 1px solid var(--c-bg-4)
+ border-right 1px solid var(--c-bg-4)
+ border-radius 8px 8px 0 0
+
+.switcher
+ position relative
+ display flex
+ align-items center
+ margin 0 -8px
+
+ &._sb
+ z-index 15
+ justify-content space-between
+
+ &__name
+ flex-grow 1
+ color var(--c-font-3)
+ font-size 10px
+ text-transform uppercase
+
+ &__content
+ overflow hidden
+ display flex
+ align-items stretch
+ justify-content space-between
+ background var(--c-bg-4)
+ border-radius 0 0 8px 8px
+ flex-grow 1
+
+ &__item
+ opacity .6
+ flex-grow 1
+ display flex
+ align-items center
+ justify-content center
+ min-width 48px
+ padding $m6 $m7
+ font-size 12px
+ text-align center
+ border-radius $m9
+
+ +media-hover()
+ background var(--c-bg-3)
+
+ &._arrow
+ padding $m5 $m6
+ font-size 18px
+
+ &._active
+ opacity 1
+ background var(--c-bg-8)
+
+ &._disable
+ opacity .3
+
+.block
+ margin-bottom 8px
+ background var(--c-bg-3)
+ border-bottom 1px solid var(--c-bg-2)
+
+.layoutMobile
+ display grid
+ grid-template-rows 1fr minmax(30px, min-content)
+ height 100%
+ background var(--c-bg-2)
+
+ &__content
+ overflow hidden
+
+.swiper-slide-active
+ .handler
+ width 16px
+ background none
+ transition background 0ms
+
+.swiper-container
+ height 100%
+
+._sidebar
+ overflow hidden
+ overflow-y auto
+ z-index 10
+ height 100%
+ max-width 70vw
+ background var(--c-bg-4)
+ border-right 1px solid var(--c-bg-1)
+ scrollbar()
+
+.wrap
+ overflow hidden
+ position absolute
+ top 0
+ left 0
+ width 100%
+ height 100%
+</style>
diff --git a/components/layout/LayoutMobileMenu.vue b/components/layout/LayoutMobileMenu.vue
index cdf781ac..69b2384c 100644
--- a/components/layout/LayoutMobileMenu.vue
+++ b/components/layout/LayoutMobileMenu.vue
@@ -58,6 +58,7 @@ export default {
default:
this.$store.dispatch('ui/setActiveTab', tab)
}
+ this.$router.push('/')
}
}
}
@@ -66,8 +67,8 @@ export default {
<template lang="pug">
.menu
.menu__wrap
- .menu__row(v-show="activeTab === 'stat'")
- PeriodNavMobile
+ //- .menu__row(v-show="activeTab === 'stat'")
+ //- PeriodNavMobile
.menu__row
.menu__item(
diff --git a/components/layout/LayoutMobileMenu2.vue b/components/layout/LayoutMobileMenu2.vue
new file mode 100644
index 00000000..4e96e462
--- /dev/null
+++ b/components/layout/LayoutMobileMenu2.vue
@@ -0,0 +1,211 @@
+<script>
+export default {
+ name: 'LayoutMobileMenu2',
+
+ props: {
+ slider: {
+ type: Object,
+ required: true
+ }
+ },
+
+ computed: {
+ activeTab () {
+ return this.$store.state.ui.activeTab
+ },
+ menu () {
+ return {
+ stat: {
+ icon: 'mdi mdi-poll',
+ id: 'stat',
+ name: this.$lang.stat.shortTitle
+ },
+ wallets: {
+ icon: 'mdi mdi-credit-card-multiple',
+ id: 'wallets',
+ name: this.$lang.wallets.name
+ },
+ categories: {
+ icon: 'mdi mdi-folder-star',
+ id: 'categories',
+ name: this.$lang.categories.shortTitle
+ },
+ history: {
+ icon: 'mdi mdi-menu',
+ id: 'history',
+ name: this.$lang.trns.shortTitle
+ }
+ }
+ }
+ },
+
+ methods: {
+ getClassName (tab) {
+ // if ()
+ // if (this.$store.state.ui.activeTab === 'stat') {
+ // if (tab === this.$store.state.ui.stat.activeTab) {
+ // return {
+ // _active: true
+ // }
+ // }
+ // }
+ // else if (this.$store.state.ui.activeTab === tab) {
+ // return {
+ // _active: true
+ // }
+ // }
+ },
+ handleSetActiveTab (tab) {
+ switch (tab) {
+ case 'wallets':
+ // this.$store.dispatch('ui/setActiveTab', 'stat')
+ // this.$store.dispatch('ui/setActiveTabStat', 'stat')
+ this.slider.slideTo(0)
+ break
+ case 'stat':
+ // this.$store.dispatch('ui/setActiveTab', 'stat')
+ // this.$store.dispatch('ui/setActiveTabStat', 'stat')
+ this.slider.slideTo(1)
+ break
+ case 'history':
+ // this.$store.dispatch('ui/setActiveTab', 'stat')
+ // this.$store.dispatch('ui/setActiveTabStat', 'history')
+ this.slider.slideTo(3)
+ break
+ case 'categories':
+ // this.$store.dispatch('ui/setActiveTab', 'stat')
+ // this.$store.dispatch('ui/setActiveTabStat', 'history')
+ this.slider.slideTo(2)
+ break
+ default:
+ // this.$store.dispatch('ui/setActiveTab', tab)
+ this.slider.slideTo(0)
+ }
+ // this.$router.push('/')
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.menu
+ .menu__wrap
+ //- .menu__row(v-show="activeTab === 'stat'")
+ //- PeriodNavMobile
+
+ .menu__row
+ //- Wallets
+ .menu__item(
+ :class="getClassName(menu.wallets.id)"
+ @click="handleSetActiveTab(menu.wallets.id)"
+ )
+ .menu__item__icon: div(:class="menu.wallets.icon")
+ //- .menu__item__text {{ menu.wallets.name }}
+
+ //- Stat
+ .menu__item(
+ :class="getClassName(menu.stat.id)"
+ @click="handleSetActiveTab(menu.stat.id)"
+ )
+ .menu__item__icon: div(:class="menu.stat.icon")
+ //- .menu__item__text {{ menu.stat.name }}
+
+ .openTrnForm(@click="$store.dispatch('trnForm/openTrnForm', { action: 'create' })")
+ svg(
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 24 24"
+ )
+ path(d='M0,12a1.5,1.5,0,0,0,1.5,1.5h8.75a.25.25,0,0,1,.25.25V22.5a1.5,1.5,0,0,0,3,0V13.75a.25.25,0,0,1,.25-.25H22.5a1.5,1.5,0,0,0,0-3H13.75a.25.25,0,0,1-.25-.25V1.5a1.5,1.5,0,0,0-3,0v8.75a.25.25,0,0,1-.25.25H1.5A1.5,1.5,0,0,0,0,12Z')
+
+ //- Categories
+ .menu__item(
+ :class="getClassName(menu.categories.id)"
+ @click="handleSetActiveTab(menu.categories.id)"
+ )
+ .menu__item__icon: div(:class="menu.categories.icon")
+ //- .menu__item__text {{ menu.categories.name }}
+
+ //- History
+ .menu__item(
+ :class="getClassName(menu.history.id)"
+ @click="handleSetActiveTab(menu.history.id)"
+ )
+ .menu__item__icon: div(:class="menu.history.icon")
+ //- .menu__item__text {{ menu.history.name }}
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables/animations"
+@import "~assets/stylus/variables/margins"
+@import "~assets/stylus/variables/media"
+
+.create-btn
+ flex-grow 1
+ padding-left $m7
+
+.customize
+ display flex
+ justify-content flex-end
+ flex-grow 1
+ padding-right $m7
+
+.openTrnForm
+ flex-grow 1
+ cursor pointer
+ display flex
+ align-items center
+ justify-content center
+ padding 17px 0 16px 0
+ border-radius 8px
+ anim()
+
+ +media-hover()
+ background var(--c-bg-1)
+
+ svg
+ width 24px
+ height 24px
+ fill #0094FF
+
+.menu
+ background var(--c-bg-3)
+
+ &__wrap
+ display grid
+ max-width 620px
+ margin 0 auto
+
+ /.light-mode &
+ background var(--c-bg-4)
+
+ &__row
+ display flex
+ align-items center
+ justify-content center
+
+ &__item
+ display flex
+ align-items center
+ justify-content center
+ flex-grow 1
+ flex-flow column
+ padding 16px 0
+ color var(--c-font-4)
+ anim()
+
+ &:active
+ background var(--c-bg-1)
+
+ &._active
+ color var(--c-font-1)
+
+ /.light-mode &
+ color var(--c-font-5)
+
+ &__icon
+ font-size 26px
+
+ &__text
+ margin-top $m5
+ font-size 12px
+</style>
diff --git a/components/layout/LayoutPc.vue b/components/layout/LayoutPc.vue
index 286759a2..a83a5453 100644
--- a/components/layout/LayoutPc.vue
+++ b/components/layout/LayoutPc.vue
@@ -69,9 +69,9 @@ export default {
template(slot="headerLeft") {{ $lang.wallets.title }}
template(slot="content")
- WalletsList.dashboardItems(
- ui="tile"
- @onClick="(id) => handleShowWalletModal(id)")
+ WalletsList3.dashboardItems(
+ @onClick="(id) => handleShowWalletModal(id)"
+ )
template(slot="bottom")
.flex
@@ -117,6 +117,31 @@ export default {
<style lang="stylus">
@import "~assets/stylus/variables/margins"
+.component__content-main
+ .walllets.dashboardItems
+ padding 0
+
+ .walllets__grid
+ grid-template-columns repeat(3, 1fr)
+ grid-column-gap $m8
+ grid-row-gap $m8
+
+ .walletItemGrid
+ width 100%
+ padding $m8
+ padding-top 0
+ border-radius $m6 $m6 0 0
+
+ &__name
+ padding-bottom $m6
+ font-size 18px
+
+ &__line
+ height 6px
+ margin-right (- $m8)
+ margin-bottom $m8
+ margin-left (- $m8)
+
.dashboardItems .categoryItem
.dashboardItems .walletItemTile
padding $m8
diff --git a/components/layout/LayoutPcSidebar.vue b/components/layout/LayoutPcSidebar.vue
index 4309d904..30361ec4 100644
--- a/components/layout/LayoutPcSidebar.vue
+++ b/components/layout/LayoutPcSidebar.vue
@@ -63,6 +63,7 @@ export default {
:class="{ _active: activeTab === 'stat'}"
@click="$store.dispatch('ui/setActiveTab', 'stat')"
): .mdi.mdi-poll
+
Menu
.sidebar__content
diff --git a/components/layout/PeriodNavMobile.vue b/components/layout/PeriodNavMobile.vue
index e140fb33..c0c741bd 100644
--- a/components/layout/PeriodNavMobile.vue
+++ b/components/layout/PeriodNavMobile.vue
@@ -29,7 +29,8 @@ export default {
.customize
StatCustomizeMenuMobile(
icon="mdi mdi-tune"
- :position="{ right: true, bottom: true }")
+ :position="{ right: true, bottom: true }"
+ )
.periodNav__link(
@click="$store.dispatch('filter/setPeriodNext')"
diff --git a/components/layout/sidebar/Menu.vue b/components/layout/sidebar/Menu.vue
index f5c7077e..1a4400cf 100644
--- a/components/layout/sidebar/Menu.vue
+++ b/components/layout/sidebar/Menu.vue
@@ -1,8 +1,19 @@
<script>
export default {
- data () {
- return {
- menu: {
+ props: {
+ slider: {
+ type: Object,
+ default: () => {}
+ }
+ },
+
+ computed: {
+ activeTab () {
+ return this.$store.state.ui.activeTab
+ },
+
+ menu () {
+ return {
trnForm: {
icon: 'mdi mdi-plus',
name: this.$lang.createTrn,
@@ -50,18 +61,9 @@ export default {
}
},
- computed: {
- activeTab () {
- return this.$store.state.ui.activeTab
- }
- },
-
methods: {
handleClickMenu (menuId) {
- if (this.$listeners.onClickMenuCalback) {
- this.$listeners.onClickMenuCalback()
- }
- else if (menuId === 'users') {
+ if (menuId === 'users') {
this.$router.push('/users')
return
}
@@ -69,6 +71,36 @@ export default {
this.$store.dispatch('trnForm/openTrnForm', { action: 'create' })
return
}
+ else if (menuId === 'groups') {
+ this.$store.dispatch('ui/setActiveTab', 'groups')
+ }
+ else {
+ this.$router.push('/')
+ }
+
+ if (this.$listeners.onClickMenuCalback) {
+ this.$listeners.onClickMenuCalback()
+ }
+
+ if (this.slider) {
+ switch (menuId) {
+ case 'wallets':
+ this.slider.slideTo(0)
+ break
+ case 'stat':
+ this.slider.slideTo(1)
+ break
+ case 'history':
+ this.slider.slideTo(3)
+ break
+ case 'categories':
+ this.slider.slideTo(2)
+ break
+ default:
+ this.slider.slideTo(0)
+ }
+ }
+
this.$store.dispatch('ui/setActiveTab', menuId)
}
}
@@ -80,8 +112,9 @@ export default {
template(v-for="(menuItem, menuId) in menu")
.menuItem(
v-if="$store.getters['user/isTester'] || !menuItem.private"
+ :class="{ _active: activeTab === menuId, [`_${menuId}`]: true }"
@click="handleClickMenu(menuId)"
- :class="{ _active: activeTab === menuId, [`_${menuId}`]: true }")
+ )
.menuItem__icon: div(:class="menuItem.icon")
.menuItem__text {{ menuItem.name }}
</template>
diff --git a/components/modal/ModalBottom.vue b/components/modal/ModalBottom.vue
index d2516195..5a927d49 100644
--- a/components/modal/ModalBottom.vue
+++ b/components/modal/ModalBottom.vue
@@ -12,30 +12,36 @@ export default {
type: String,
default: null
},
- show: {
- type: Boolean,
- required: true
- },
paddingless: {
type: Boolean,
default: false
}
},
+ data () {
+ return {
+ isShowed: false
+ }
+ },
+
setup (props, ctx) {
const scrollContainer = ref(null)
const scrollContent = ref(null)
const scrollOverflow = ref(null)
const scrollDragger = ref(null)
- useTouchClose({
+ const { onCloseModal } = useTouchClose({
container: scrollContainer,
content: scrollContent,
overflow: scrollOverflow,
dragger: scrollDragger,
onClose: () => {
- ctx.listeners.onClose && ctx.listeners.onClose()
- ctx.listeners.afterClose && ctx.listeners.afterClose()
+ if (ctx.listeners.onClose) {
+ ctx.listeners.onClose()
+ }
+ if (ctx.listeners && ctx.listeners.afterClose) {
+ ctx.listeners.afterClose()
+ }
}
})
@@ -43,16 +49,13 @@ export default {
scrollContainer,
scrollContent,
scrollOverflow,
- scrollDragger
+ scrollDragger,
+ onCloseModal
}
},
- methods: {
- afterClose () {
- if (this.$listeners.afterClose) {
- this.$listeners.afterClose()
- }
- }
+ mounted () {
+ this.isShowed = true
}
}
</script>
@@ -63,48 +66,79 @@ export default {
:class="{ _center: center, _paddingless: paddingless }"
ref="scrollContainer"
)
-
+ //- Overflow
+ //--------------------------------------
transition(name="fadeIn" appear)
.modalBottom__overflow(
- v-show="show"
+ v-if="isShowed"
ref="scrollOverflow"
- @click="$listeners.onClose"
+ @click="onCloseModal"
)
- transition(name="slide" appear @after-leave="afterClose")
+ //- Wrap
+ //--------------------------------------
+ transition(
+ appear
+ name="slide"
+ @after-leave="afterClose"
+ )
.modalBottom__wrap(
- v-show="show"
+ v-if="isShowed"
ref="scrollDragger"
)
+ .modalBottom__line
+ //- Empty Header
+ //--------------------------------------
+ div(
+ v-if="$slots.emptyHeader"
+ @click="onCloseModal"
+ )
+ slot(name="emptyHeader")
+
//- Header
+ //--------------------------------------
.modalBottom__header(
- @click="$listeners.onClose"
- ref="header")
+ v-if="$slots.header || title"
+ @click="onCloseModal"
+ )
+ //- Slot
template(v-if="$slots.header")
slot(name="header")
- template(v-else)
- .modalBottom__header__back: .mdi.mdi-chevron-left
+
+ //- Title
+ template(v-if="title")
.modalBottom__header__title(v-if="title") {{ title }}
//- Content
+ //--------------------------------------
.modalBottom__scroll(
:style="{ maxHeight: `${$store.state.ui.height - 100}px`}"
ref="scrollContent"
)
+ //- Description
slot(name="description")
+ //- Buttons 3 collumns
template(v-if="$slots.btns")
- .modalLinks._noPadding
+ .modalLinks
slot(name="btns")
- slot
+ //- Buttons 2 collumns
+ .modalLinks._two
+ slot(name="btnsTwo" :closeModal="onCloseModal")
+
+ //- Default
+ slot(:closeModal="onCloseModal")
</template>
<style lang="stylus" scoped>
-@import "~assets/stylus/variables/media"
+@import "~assets/stylus/variables"
.modalBottom
&__wrap
+ &._anim
+ anim()
+
^[0]._center &
@media $media-laptop
margin 0 auto
@@ -138,18 +172,28 @@ export default {
flex-flow column nowrap
max-width 440px
margin-right auto
+ border-radius 0 0 $m7 $m7
@media $media-laptop
max-width 460px
margin 100px
+ &__line
+ position absolute
+ top -12px
+ left 50%
+ width 60px
+ height 6px
+ background var(--c-bg-8)
+ border-radius 4px
+ transform translateX(-50%)
+
&__scroll
overflow hidden
overflow-y auto
max-height calc(90vh - 80px)
padding $m7
- background var(--c-bg-3)
- border-radius 0 0 $m3 $m3
+ background var(--c-bg-2)
scrollbar()
@media $media-laptop
@@ -158,17 +202,16 @@ export default {
^[0]._paddingless &
padding 0
-
/.light-mode &
background var(--c-bg-2)
&__header
+ position relative
display flex
align-items center
- position relative
padding $m7
color var(--c-font-1)
- background var(--c-bg-3)
+ background var(--c-bg-2)
border-radius $m6 $m6 0 0
/.light-mode &
@@ -195,25 +238,13 @@ export default {
.walletItem__line
padding 0
- &:active
- background var(--c-bg-6)
-
- &:hover
- @media $media-laptop
- background var(--c-bg-6)
-
&__title
font-size 18px
- &__back
- margin-top $m2
- margin-right $m5
- font-size 18px
-
&__icon
position absolute
- right $m7
top (- $m5)
+ right $m7
&__child
display flex
diff --git a/components/modal/ModalBottomConfirm.vue b/components/modal/ModalBottomConfirm.vue
index 0027a31a..c3ec9a26 100644
--- a/components/modal/ModalBottomConfirm.vue
+++ b/components/modal/ModalBottomConfirm.vue
@@ -14,26 +14,29 @@ export default {
</script>
<template lang="pug">
-ModalBottom(
- :show="show"
- title="Are you sure?"
- @onClose="$emit('onClose')"
+Portal(
+ v-if="show"
+ to="modal"
)
- template(v-if="description")
- template(slot="description")
- .descError {{ description }}
+ ModalBottom(
+ :title="$t('base.sure')"
+ @onClose="$emit('onClose')"
+ )
+ template(v-if="description")
+ template(slot="description")
+ .descError {{ description }}
- template(slot="btns")
- ModalButton(
- name="Yes"
- icon="mdi mdi-check"
- @onClick="$emit('onConfirm')"
- )
- ModalButton(
- name="Cancel"
- icon="mdi mdi-close-circle"
- @onClick="$emit('onClose')"
- )
+ template(#btnsTwo="{ closeModal }")
+ ModalButton(
+ :name="$t('base.no')"
+ icon="mdi mdi-close"
+ @onClick="closeModal"
+ )
+ ModalButton(
+ :name="$t('base.yes')"
+ icon="mdi mdi-check"
+ @onClick="$emit('onConfirm')"
+ )
</template>
<style lang="stylus">
diff --git a/components/modal/ModalButton.vue b/components/modal/ModalButton.vue
index 203489e4..a928727e 100644
--- a/components/modal/ModalButton.vue
+++ b/components/modal/ModalButton.vue
@@ -23,23 +23,23 @@ export default {
@import "~assets/stylus/variables"
.button-link
+ cursor pointer
width auto
max-width 100%
padding $m7 0
white-space nowrap
text-align center
- background var(--c-bg-5)
border-radius $m3
/.light-mode &
- background var(--c-bg-1)
color var(--c-font-2)
+ background var(--c-bg-1)
&__icon
- font-size 32px
- padding-bottom $m6
- color var(--c-font-4)
opacity .8
+ padding-bottom $m6
+ color var(--c-font-2)
+ font-size 32px
&:hover
@media $media-laptop
@@ -49,5 +49,6 @@ export default {
background var(--c-bg-6)
&__name
+ color var(--c-font-3)
font-size 12px
</style>
diff --git a/components/modal/styles/modalLinks.styl b/components/modal/styles/modalLinks.styl
index 7a7dc2bd..212cf61a 100644
--- a/components/modal/styles/modalLinks.styl
+++ b/components/modal/styles/modalLinks.styl
@@ -4,6 +4,10 @@
grid-column-gap $m7
grid-row-gap $m7
padding 0 $m7
+ padding-bottom $m5
+
+ &._two
+ grid-template-columns repeat(2, 1fr)
&._noPadding
padding 0
diff --git a/components/shared/BaseModal.vue b/components/shared/BaseModal.vue
index faf45ddc..3cb15cc8 100644
--- a/components/shared/BaseModal.vue
+++ b/components/shared/BaseModal.vue
@@ -67,7 +67,7 @@ export default {
</script>
<template lang="pug">
-portal(to="default" v-if="show")
+portal(to="modal" v-if="show")
.baseModal(
ref="scrollContainer"
:class="{ _opened: show }"
diff --git a/components/shared/button/Button.vue b/components/shared/button/Button.vue
index b9a1cf00..2f90eb09 100644
--- a/components/shared/button/Button.vue
+++ b/components/shared/button/Button.vue
@@ -52,7 +52,10 @@ export default {
.d-button__icon(v-if="icon")
div(:class="icon")
.d-button__title(v-if="title") {{ title }}
- .d-button__check(v-if="showCheckbox" @click.prevent="")
+ .d-button__check(
+ v-if="showCheckbox"
+ @click.prevent=""
+ )
Checkbox._small(v-model="checkboxValue")
</template>
@@ -67,11 +70,8 @@ export default {
justify-content center
width 40px
height 40px
- font-size 16px
color var(--c-font-4)
- // background var(--c-bg-2)
- // border 1px solid var(--c-bg-7)
- // box-shadow 2px 2px 6px 0px var(--c-bg-2)
+ font-size 16px
border-radius 50px
/.light-mode &
@@ -123,9 +123,10 @@ export default {
&._borderBottom
margin-bottom 0
- padding-left $m6
padding-right $m6
+ padding-left $m6
border-bottom 1px solid var(--c-bg-7)
+
&:last-child
border-bottom 0
@@ -133,10 +134,10 @@ export default {
display flex
align-items center
justify-content center
- background var(--c-bg-2)
- border 1px solid var(--c-bg-7)
- box-shadow 2px 2px 6px 0px var(--c-bg-2)
+ background var(--c-bg-3)
+ border 1px solid var(--c-bg-4)
border-radius 3px
+ box-shadow 2px 2px 6px 0px var(--c-bg-2)
anim()
/.light-mode &
@@ -144,7 +145,7 @@ export default {
&:active:not(._disable)
color var(--c-font-3)
- transform scale(0.96)
+ transform scale(.96)
+media-laptop()
&:hover
@@ -164,16 +165,21 @@ export default {
background var(--c-bg-5)
&._inline
- display inline-flex
- width auto
+ display flex
+ width 100%
+ max-width 400px
+ margin 0 auto
+
+ @media $media-laptop
+ width auto
&._center
align-items center
justify-content center
&._grey
- background var(--c-bg-5)
color var(--c-font-2)
+ background var(--c-bg-5)
border-radius $m3
/.light-mode &
@@ -192,15 +198,15 @@ export default {
color var(--c-font-4)
background var(--c-bg-2)
border 1px solid var(--c-bg-7)
- box-shadow 2px 2px 6px 0px var(--c-bg-2)
border-radius $m3
+ box-shadow 2px 2px 6px 0px var(--c-bg-2)
/.light-mode &
box-shadow 2px 2px 6px 0px var(--c-bg-11)
^[0]:active &
color var(--c-font-3)
- transform scale(0.96)
+ transform scale(.96)
^[0]:hover &
@media $media-laptop
@@ -211,7 +217,6 @@ export default {
&._blue
color var(--c-font-1)
background var(--c-blue-1)
- // border 1px solid transparent
&:hover
@media $media-laptop
@@ -228,20 +233,20 @@ export default {
border-radius 6px
&__icon
+ opacity .85
width 22px
- margin-left -5px
margin-right $m6
+ margin-left -5px
font-size 18px
text-align center
- opacity .85
&:last-child
margin-right 0
margin-right -5px
+media-laptop()
- margin-left -8px
margin-right 10px
+ margin-left -8px
font-size 14px
&__check
diff --git a/components/shared/contextMenu/ContextMenu.vue b/components/shared/contextMenu/ContextMenu.vue
index 5fdc1a1d..06449fb5 100644
--- a/components/shared/contextMenu/ContextMenu.vue
+++ b/components/shared/contextMenu/ContextMenu.vue
@@ -94,8 +94,8 @@ export default {
top 48px
min-width 200px
padding $m3
- background var(--c-bg-2)
- border 1px solid var(--c-bg-8)
+ background var(--c-bg-3)
+ border 1px solid var(--c-bg-4)
border-radius $m3
box-shadow 0 10px 20px -5px var(--c-bg-1)
diff --git a/components/slider/Slider.vue b/components/slider/Slider.vue
index 7ebc8b9b..bb93f776 100644
--- a/components/slider/Slider.vue
+++ b/components/slider/Slider.vue
@@ -47,6 +47,9 @@ export default {
loop: this.loop,
slidesPerColumn: this.slidesPerColumn,
slidesPerView: this.slidesPerView,
+ shortSwipes: false,
+ longSwipesRatio: 0.1,
+ longSwipesMs: 60,
on: {
slideChange: () => {
if (this.onSlideChange) {
diff --git a/components/stat/StatChartDonut.vue b/components/stat/StatChartDonut.vue
index a439e3ab..b96bd5eb 100644
--- a/components/stat/StatChartDonut.vue
+++ b/components/stat/StatChartDonut.vue
@@ -1,8 +1,12 @@
<script>
import dayjs from 'dayjs'
import { Chart } from 'highcharts-vue'
+import Highcharts from 'highcharts'
+import borderRadius from 'highcharts-border-radius'
import chartOptions from './chartOptions'
+borderRadius(Highcharts)
+
export default {
components: {
Chart
@@ -149,13 +153,13 @@ export default {
data: totalData
}, {
visible: true,
- type: 'spline',
+ // type: 'spline',
name: 'Incomes',
color: 'var(--c-incomes-1)',
data: incomesData
}, {
visible: true,
- type: 'spline',
+ // type: 'spline',
name: 'Expenses',
color: 'var(--c-expenses-1)',
data: expensesData
diff --git a/components/stat/StatChartsLine2.vue b/components/stat/StatChartsLine2.vue
new file mode 100644
index 00000000..3690fdb4
--- /dev/null
+++ b/components/stat/StatChartsLine2.vue
@@ -0,0 +1,280 @@
+<script>
+import dayjs from 'dayjs'
+
+export default {
+ name: 'StatChartsLine2',
+
+ computed: {
+ periods () {
+ return this.$store.state.chart.periods
+ },
+ filterPeriod () {
+ return this.$store.state.filter.period
+ },
+ activePeriodNumber () {
+ const statFromDate = dayjs().startOf(this.$store.state.filter.period)
+ return statFromDate.diff(this.$store.state.filter.date, this.$store.state.filter.period) + 1
+ },
+ periodsValues () {
+ const trns = this.$store.state.trns.items
+ const transferCategoryId = this.$store.getters['categories/transferCategoryId']
+ const trnsIds = this.$store.getters['trns/selectedTrnsIds']
+ const filterPeriod = this.$store.state.filter.period
+ const diff = this.getNumberShowedPeriods()
+
+ const values = {}
+ for (let period = 0; period < diff; period++) {
+ const periodStartDate = dayjs().subtract(period, filterPeriod).startOf(filterPeriod)
+ const periodEndDate = dayjs().subtract(period, filterPeriod).endOf(filterPeriod)
+ const ids = trnsIds
+ .filter((trnId) => {
+ return trns[trnId].date >= periodStartDate &&
+ trns[trnId].date <= periodEndDate &&
+ trns[trnId].categoryId !== transferCategoryId
+ })
+
+ values[periodStartDate.valueOf()] = {
+ date: periodStartDate.valueOf(),
+ ...this.$store.getters['trns/getTotalOfTrnsIds'](ids)
+ }
+ }
+
+ return values
+ },
+ periodsGroupedValues () {
+ const filterPeriod = this.$store.state.filter.period
+ const periodsValues = this.periodsValues
+ const groupedBy = this.periods[filterPeriod].groupedBy
+ const groupedValues = {}
+
+ for (const date in periodsValues) {
+ const periodStartDateValue = dayjs(parseInt(date)).startOf(groupedBy).valueOf()
+ const periodEndDateValue = dayjs(parseInt(date)).endOf(groupedBy).valueOf()
+
+ if (date >= periodStartDateValue && date <= periodEndDateValue) {
+ groupedValues[periodStartDateValue]
+ ? groupedValues[periodStartDateValue].push({ date, ...periodsValues[date] })
+ : groupedValues[periodStartDateValue] = [{ date, ...periodsValues[date] }]
+ }
+ }
+
+ return groupedValues
+ },
+ maxAmountValue () {
+ const periodsValues = this.periodsValues
+ let biggest = 0
+
+ for (const date in periodsValues) {
+ const incomes = periodsValues[date].incomes
+ const expenses = periodsValues[date].expenses
+ if (incomes > biggest) { biggest = incomes }
+ if (expenses > biggest) { biggest = expenses }
+ }
+ return biggest
+ }
+ },
+
+ created () {
+ this.defaultPeriods = this.$store.state.chart.periods
+ },
+
+ methods: {
+ getNumberShowedPeriods () {
+ const filterPeriod = this.$store.state.filter.period
+ let diff = 0
+
+ if (this.periods[filterPeriod].grouped) {
+ diff = this.getGroupedPeriods()
+ }
+ else {
+ this.activePeriodNumber > this.periods[filterPeriod].showedPeriods
+ ? diff = this.activePeriodNumber
+ : diff = this.periods[filterPeriod].showedPeriods
+ }
+ if (diff <= 0) { diff = 1 }
+ this.$store.dispatch('stat/setDiffPeriods', diff)
+
+ return diff
+ },
+
+ getGroupedPeriods () {
+ const filterPeriod = this.filterPeriod
+ const groupedBy = this.periods[filterPeriod].groupedBy
+ const showedGroups = this.periods[filterPeriod].showedGroups
+ let numberOfPeriods = 0
+
+ // periods in current group
+ const getPeriodsInCurrentGroup = () => {
+ let currentGroupPeriods
+ if (filterPeriod === 'day') { currentGroupPeriods = parseInt(dayjs().format('D')) }
+ if (filterPeriod === 'week') { currentGroupPeriods = dayjs().week() - dayjs().startOf('month').week() + 1 }
+ if (filterPeriod === 'month') { currentGroupPeriods = parseInt(dayjs().format('MM')) }
+ return currentGroupPeriods
+ }
+
+ // periods in prev group
+ const getPeriodsInPrevGroup = () => {
+ let prevGroupsPeriods = 0
+ for (let index = 1; index < showedGroups; index++) {
+ prevGroupsPeriods = prevGroupsPeriods + getPeriodsInPrevGroup2(index)
+ }
+ return prevGroupsPeriods
+ }
+
+ const getPeriodsInPrevGroup2 = (hey) => {
+ const groupDateStart = dayjs().subtract(hey, groupedBy).startOf(groupedBy)
+ const groupDateEnd = dayjs().subtract(hey, groupedBy).endOf(groupedBy)
+
+ let periodsInGroup = 0
+ filterPeriod === 'week'
+ ? periodsInGroup = groupDateEnd.week() - groupDateStart.week()
+ : periodsInGroup = groupDateEnd.diff(groupDateStart, filterPeriod) + 1
+
+ return periodsInGroup
+ }
+
+ const periodsInCurrentGroup = getPeriodsInCurrentGroup()
+
+ showedGroups === 1
+ ? numberOfPeriods = periodsInCurrentGroup
+ : numberOfPeriods = periodsInCurrentGroup + getPeriodsInPrevGroup()
+
+ // when view old data
+ if (this.activePeriodNumber >= numberOfPeriods) {
+ numberOfPeriods = periodsInCurrentGroup
+ let index = 1
+ while (this.activePeriodNumber >= numberOfPeriods) {
+ numberOfPeriods = numberOfPeriods + getPeriodsInPrevGroup2(index)
+ index++
+ }
+ }
+
+ return numberOfPeriods
+ },
+
+ formatGroupName (date, groupedBy) {
+ const dateValueOf = parseInt(date)
+ let format
+ switch (groupedBy) {
+ case 'month':
+ format = 'MMMM'
+ break
+ case 'year':
+ format = 'YYYY'
+ break
+ }
+ return dayjs(dateValueOf).format(format)
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.charts.swiper-no-swiping
+ template(v-if="$store.state.filter.period === 'all'")
+ .charts__allData Change period to see chart
+
+ template(v-if="$store.state.filter.period !== 'all'")
+ .charts__content
+ //- grouped
+ template(v-if="periods[filterPeriod].grouped")
+ .charts__items._grouped
+ template(v-for="(periodGroups, groupDate) in periodsGroupedValues")
+ .chart-group(:class="{ _grouped: periods[filterPeriod].grouped }")
+ .chart-group__name(v-show="periods[filterPeriod].grouped")
+ template(v-if="periods[filterPeriod].grouped") {{ formatGroupName(groupDate, periods[filterPeriod].groupedBy) }}
+
+ .chart-group__content
+ template(v-for="period in periodGroups")
+ ChartItem2(
+ :key="period.date"
+ :maxAmountValue="maxAmountValue"
+ :period="period"
+ parentClassName=".charts__items")
+
+ //- simple
+ template(v-else)
+ .charts__items
+ template(v-for="period in periodsValues")
+ ChartItem2(
+ :key="period.date"
+ :maxAmountValue="maxAmountValue"
+ :period="period"
+ parentClassName=".charts__items")
+
+ //- popup
+ template(v-if="$store.state.ui.pc && $store.state.chart.hoveredPeriod.values")
+ ChartPopup
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables/animations"
+@import "~assets/stylus/variables/margins"
+@import "~assets/stylus/variables/fonts"
+@import "~assets/stylus/variables/media"
+@import "~assets/stylus/variables/scroll"
+
+.charts
+ z-index 5
+ position relative
+
+ &__allData
+ display flex
+ align-items center
+ justify-content center
+ font-size 14px
+ opacity .7
+
+ &__items
+ cursor grab
+ scrollbar()
+ overflow hidden
+ overflow-x auto
+ display flex
+ flex-direction row-reverse
+
+ &._grouped
+ padding 0 $m4
+
+ &__nav
+ z-index 2
+ position absolute
+ right $m7
+ bottom $m7
+
+.chart-group
+ position relative
+ flex-grow 1
+ margin-left 20px
+ padding-left 20px
+ border-left 1px solid var(--c-bg-4)
+
+ &:last-child
+ margin-left 0
+ padding-left 0
+ border 0
+
+ &__name
+ opacity .7
+ position absolute
+ right 0
+ width 100%
+ height 42px
+ padding-top 0
+ padding-bottom $m4
+ font-secondary()
+ font-size 14px
+ text-transform uppercase
+ white-space nowrap
+ text-align center
+ letter-spacing .5px
+
+ &__content
+ display flex
+ flex-direction row-reverse
+ padding-top 20px
+
+.chart-space
+ &:last-child
+ min-width 40px
+</style>
diff --git a/components/stat/StatCustomizeMenuMobile.vue b/components/stat/StatCustomizeMenuMobile.vue
index ccb932b3..8e0864ad 100644
--- a/components/stat/StatCustomizeMenuMobile.vue
+++ b/components/stat/StatCustomizeMenuMobile.vue
@@ -105,5 +105,4 @@ div
icon="mdi mdi-palette"
@onClick="$store.dispatch('ui/changeTheme')"
)
- LangDropdown
</template>
diff --git a/components/stat/StatItem.vue b/components/stat/StatItem.vue
index fc8391ab..edc63787 100644
--- a/components/stat/StatItem.vue
+++ b/components/stat/StatItem.vue
@@ -102,12 +102,14 @@ export default {
@import "~assets/stylus/variables"
.statItem
+ overflow hidden
cursor pointer
position relative
margin (- 10px) 0
margin-bottom 10px
padding 10px
border 1px solid transparent
+ border-radius $m5
&:hover
@media $media-laptop
diff --git a/components/stat/StatItem2.vue b/components/stat/StatItem2.vue
new file mode 100644
index 00000000..211a2cfd
--- /dev/null
+++ b/components/stat/StatItem2.vue
@@ -0,0 +1,189 @@
+<script>
+export default {
+ name: 'StatItem2',
+
+ props: {
+ category: {
+ type: Object,
+ required: true
+ },
+ categoryId: {
+ type: String,
+ required: true
+ },
+ currency: {
+ type: String,
+ required: true
+ },
+ total: {
+ type: Number,
+ required: true
+ },
+ biggest: {
+ type: Number,
+ required: true
+ },
+ type: {
+ type: Number,
+ required: true
+ }
+ },
+
+ data () {
+ return {
+ showInside: false
+ }
+ },
+
+ computed: {
+ showChildCategories () {
+ const childCategoriesIds = this.$store.getters['categories/getChildCategoriesIds'](this.categoryId)
+
+ const childCatsIdsWithTrns = []
+ for (const childCategoryId of childCategoriesIds) {
+ const trnsIds = this.$store.getters['trns/getTrnsIdsByFilter']({
+ categoryId: childCategoryId,
+ type: this.type
+ })
+ if (trnsIds.length > 0) { childCatsIdsWithTrns.push(childCategoryId) }
+ }
+
+ if (childCatsIdsWithTrns.length > 0) { return true }
+ return false
+ },
+
+ styles () {
+ return {
+ width: `${Math.abs(this.total) / Math.abs(this.biggest) * 100}%`,
+ background: this.category.color
+ }
+ }
+ },
+
+ methods: {
+ toogleShowInside (categoryId) {
+ this.$store.commit('stat/setCategoryModalId', categoryId)
+ this.$store.commit('stat/setCategoryModalShow', true)
+ // this.showInside = !this.showInside
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.statItem(
+ @click="toogleShowInside(categoryId)"
+ :class="{ _active: showInside }")
+
+ .statItem__content
+ .statItem__graph: .statItem__graph__in(:style="styles")
+ .statItem__icon(@click.stop="showInside = !showInside")
+ Icon(
+ :background="category.color"
+ :icon="category.icon"
+ :round="true")
+
+ .statItem__name {{ category.name }}
+ .statItem__amount
+ Amount(
+ :currency="currency"
+ :value="total")
+
+ template(v-if="showInside")
+ .statItem__inside(@click.stop="")
+ template(v-if="showChildCategories")
+ StatItemChildCats2(:categoryId="categoryId", :type="type")
+
+ template(v-else)
+ TrnsList(
+ ui="stat"
+ :incomes="type === 1"
+ :expenses="type === 0"
+ :categoryId="categoryId")
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables"
+
+.statItem
+ overflow hidden
+ cursor pointer
+ position relative
+ margin (- 10px) 0
+ margin-bottom 10px
+ padding 10px
+ border 1px solid transparent
+ border-radius $m5
+
+ &:hover
+ @media $media-laptop
+ z-index 2
+ background var(--c-bg-1)
+ border 1px solid var(--c-bg-5)
+
+ /.light-mode &
+ background var(--c-bg-3)
+
+ &._active
+ padding 0
+ margin-bottom 30px
+ background var(--c-bg-2)
+ border 1px solid var(--c-bg-7)
+
+ &:first-child
+ margin-top (- 10px)
+
+ &__content
+ display grid
+ grid-template-columns minmax(10px, max-content) 1fr minmax(10px, max-content)
+ grid-template-rows repeat(2, minmax(10px, max-content))
+ grid-column-gap 20px
+
+ ^[0]._active &
+ padding 10px 10px
+ background var(--c-bg-5)
+ border-bottom 1px solid var(--c-bg-7)
+
+ /.light-mode &
+ background var(--c-bg-10)
+ border-bottom 1px solid var(--c-bg-5)
+
+ &__graph
+ overflow hidden
+ grid-column 2 / -1
+ grid-row 2 / -1
+ align-self center
+ margin-top 6px
+ background var(--c-bg-8)
+ border-radius 2px
+
+ &__in
+ height 4px
+ min-width 2px
+
+ &__name
+ overflow hidden
+ align-self center
+ color var(--c-font-4)
+ font-size 16px
+ white-space nowrap
+ text-overflow ellipsis
+
+ ^[0]._active &
+ color var(--c-font-2)
+
+ &__icon
+ width 32px
+ grid-column 1 / 2
+ grid-row 1 / -1
+
+ &:active
+ opacity .8
+
+ @media $media-laptop
+ &:hover
+ transform scale(1.3)
+
+ &__amount
+ align-self center
+</style>
diff --git a/components/stat/StatItemChildCats2.vue b/components/stat/StatItemChildCats2.vue
new file mode 100644
index 00000000..475999ff
--- /dev/null
+++ b/components/stat/StatItemChildCats2.vue
@@ -0,0 +1,78 @@
+
+<script>
+export default {
+ name: 'StatItemChildCats2',
+
+ props: {
+ categoryId: {
+ type: String,
+ required: true
+ },
+ type: {
+ type: Number,
+ required: true
+ }
+ },
+
+ computed: {
+ statCategories () {
+ const categoriesIds = this.$store.getters['categories/getChildCategoriesIds'](this.categoryId)
+ let stat = []
+
+ for (const categoryId of categoriesIds) {
+ const trnsIds = this.getTrnsByCategoryId(categoryId)
+ if (trnsIds.length > 0) {
+ const categoryStat = this.getCategoryStat({ categoryId, trnsIds })
+ stat.push(categoryStat)
+ }
+ }
+
+ stat = stat.sort((a, b) => {
+ if (a[this.typeName] > b[this.typeName]) { return -1 }
+ if (a[this.typeName] < b[this.typeName]) { return 1 }
+ return 0
+ })
+
+ return stat
+ },
+
+ typeName () {
+ return this.type === 1 ? 'incomes' : 'expenses'
+ }
+ },
+
+ methods: {
+ getTrnsByCategoryId (categoryId) {
+ const trns = this.$store.state.trns.items
+ let trnsIds = this.$store.getters['trns/selectedTrnsIdsWithDate']
+ trnsIds = trnsIds.filter(id => trns[id].categoryId === categoryId)
+ trnsIds = trnsIds.filter(id => trns[id].type === this.type)
+ return trnsIds
+ },
+
+ getCategoryStat ({ categoryId, trnsIds }) {
+ return {
+ categoryId,
+ ...this.$store.getters['trns/getTotalOfTrnsIds'](trnsIds)
+ }
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.items
+ template(v-for="category in statCategories")
+ StatItemChildCatsItem2(
+ :biggest="$store.getters['stat/statCurrentPeriod'][typeName].biggest"
+ :category="$store.state.categories.items[category.categoryId]"
+ :categoryId="category.categoryId"
+ :key="category.categoryId"
+ :type="type"
+ :total="category[typeName]"
+ )
+</template>
+
+<style lang="stylus" scoped>
+
+</style>
diff --git a/components/stat/StatItemChildCatsItem2.vue b/components/stat/StatItemChildCatsItem2.vue
new file mode 100644
index 00000000..aa6f97a3
--- /dev/null
+++ b/components/stat/StatItemChildCatsItem2.vue
@@ -0,0 +1,128 @@
+<script>
+export default {
+ props: {
+ category: {
+ type: Object,
+ required: true
+ },
+ categoryId: {
+ type: String,
+ required: true
+ },
+ total: {
+ type: Number,
+ required: true
+ },
+ type: {
+ type: Number,
+ required: true
+ },
+ biggest: {
+ type: Number,
+ required: true
+ }
+ },
+
+ data () {
+ return {
+ showTrns: false
+ }
+ },
+
+ computed: {
+ styles () {
+ return {
+ width: `${Math.abs(this.total) / Math.abs(this.biggest) * 100}%`,
+ background: this.category.color
+ }
+ }
+ },
+
+ methods: {
+ toogleShowTrnsInCategory (categoryId) {
+ this.$store.commit('stat/setCategoryModalId', categoryId)
+ this.$store.commit('stat/setCategoryModalShow', true)
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.statItemChild(
+ @click="toogleShowTrnsInCategory(categoryId)"
+ :class="{ _active: showTrns }")
+
+ .statItemChild__content
+ .statItemChild__graph: .statItemChild__graph__in(:style="styles")
+
+ .statItemChild__icon(
+ @click.stop="showTrns = !showTrns")
+ Icon(
+ :background="category.color"
+ :icon="category.icon"
+ :round="true")
+
+ .statItemChild__name {{ category.name }}
+
+ .statItemChild__amount
+ Amount(
+ :currency="$store.state.currencies.base"
+ :value="total")
+
+ .statItemChild__trns(@click.stop="" v-if="showTrns")
+ TrnsList(
+ ui="stat"
+ :incomes="type === 1"
+ :expenses="type === 0"
+ :categoryId="categoryId")
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables/margins"
+@import "~assets/stylus/variables/fonts"
+@import "~assets/stylus/variables/media"
+@import "~assets/stylus/variables/scroll"
+
+.statItemChild
+ border-bottom 1px solid var(--c-bg-5)
+ &:last-child
+ border 0
+
+ &__content
+ display grid
+ grid-template-columns minmax(10px, max-content) 1fr minmax(10px, max-content)
+ grid-template-rows repeat(2, minmax(10px, max-content))
+ grid-column-gap 20px
+ padding 10px 10px
+
+ &__graph
+ overflow hidden
+ grid-column 2 / -1
+ grid-row 2 / -1
+ align-self center
+ margin-top 6px
+ background var(--c-bg-6)
+ border-radius 2px
+
+ &__in
+ height 4px
+ min-width 2px
+
+ &__name
+ overflow hidden
+ align-self center
+ color var(--c-font-4)
+ font-size 16px
+ white-space nowrap
+ text-overflow ellipsis
+
+ &__icon
+ display flex
+ justify-content center
+ width 32px
+ grid-column 1 / 2
+ grid-row 1 / -1
+
+ &__amount
+ align-self center
+</style>
diff --git a/components/stat/StatMobile2.vue b/components/stat/StatMobile2.vue
new file mode 100644
index 00000000..bedf02bf
--- /dev/null
+++ b/components/stat/StatMobile2.vue
@@ -0,0 +1,294 @@
+<script>
+export default {
+ data () {
+ return {
+ view: 'expenses'
+ }
+ },
+
+ computed: {
+ activeTabStat () {
+ return this.$store.state.ui.stat.activeTab
+ },
+
+ statCurrentPeriod () {
+ return this.$store.getters['stat/statCurrentPeriod']
+ },
+
+ isEmptyData () {
+ return this.statCurrentPeriod.incomes.categoriesIds.length === 0 &&
+ this.statCurrentPeriod.expenses.categoriesIds.length === 0 &&
+ this.$store.getters['trns/selectedTrnsIdsWithDate'].length === 0
+ },
+
+ filterCategory () {
+ return this.$store.state.categories.items[this.$store.state.filter.categoryId]
+ },
+
+ filterCategoryParent () {
+ return this.$store.state.categories.items[this.filterCategory.parentId]
+ },
+
+ filterWallet () {
+ return this.$store.state.wallets.items[this.$store.state.filter.walletId]
+ },
+
+ isShowIncomes () {
+ return this.view === 'incomes' && this.statCurrentPeriod.incomes.categoriesIds.length
+ },
+
+ isShowExpenses () {
+ return this.view === 'expenses' && this.statCurrentPeriod.expenses.categoriesIds.length
+ },
+
+ isShowHistory () {
+ return this.view === 'trns'
+ }
+ },
+
+ methods: {
+ clearCategoryFilter () {
+ const nextCategory = this.filterCategory.parentId !== 0 ? this.filterCategory.parentId : null
+ this.$store.dispatch('filter/setFilterCategoryId', nextCategory)
+ },
+
+ clearParentCategoryFilter () {
+ this.$store.dispatch('filter/setFilterCategoryId', null)
+ },
+
+ clearWalletFilter () {
+ this.$store.dispatch('filter/setFilterWalletId', null)
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.stat
+ .stat__filter.swiper-no-swiping(v-if="$store.state.filter.categoryId || $store.state.filter.walletId")
+ template(v-if="$store.state.filter.walletId")
+ FilterItem(
+ :color="filterWallet.color || $store.state.ui.defaultBgColor"
+ :name="filterWallet.name"
+ icon="mdi mdi-credit-card-multiple"
+ @onClick="clearWalletFilter")
+
+ template(v-if="$store.state.filter.categoryId")
+ template(v-if="filterCategory.parentId !== 0")
+ FilterItem(
+ :color="filterCategoryParent.color || $store.state.ui.defaultBgColor"
+ :icon="filterCategoryParent.icon"
+ :name="filterCategoryParent.name"
+ @onClick="clearParentCategoryFilter")
+ FilterItem(
+ :color="filterCategory.color || $store.state.ui.defaultBgColor"
+ :icon="filterCategory.icon"
+ :name="filterCategory.name"
+ @onClick="clearCategoryFilter")
+
+ //- stat
+ //------------------------------------------------
+ .stat__view(:class="{ _withFilter: ($store.state.filter.categoryId || $store.state.filter.walletId) }")
+ .statItem-header(
+ :class="{ _active: view === 'incomes' }"
+ @click="view = 'incomes'"
+ )
+ .statItem-total
+ .statItem-total__title {{ $lang.money.incomes }}
+ .statItem-total__amount
+ Amount(
+ size="md"
+ :currency="$store.state.currencies.base"
+ :type="1"
+ :value="statCurrentPeriod.incomes.total")
+
+ .statItem-header(
+ :class="{ _active: view === 'expenses' }"
+ @click="view = 'expenses'"
+ )
+ .statItem-total
+ .statItem-total__title {{ $lang.money.expenses }}
+ .statItem-total__amount
+ Amount(
+ size="md"
+ :currency="$store.state.currencies.base"
+ :type="0"
+ :value="statCurrentPeriod.expenses.total")
+
+ .statItem-header(
+ :class="{ _active: view === 'trns' }"
+ @click="view = 'trns'"
+ )
+ .statItem-total
+ .statItem-total__title {{ $lang.trns.shortTitle }}
+ .statItem-total__amount
+ Amount(
+ size="md"
+ :currency="$store.state.currencies.base"
+ :type="3"
+ :value="statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total"
+ )
+
+ //-
+ .stat__content
+ //- incomes
+ .statGroup(v-show="isShowIncomes")
+ //- incomes: cats charts
+ .stat__charts(v-show="$store.state.ui.catsChart === 'visible'")
+ PeriodCatsChart(type="incomes")
+
+ //- incomes: cats stat item
+ .stat__cats(v-show="$store.state.ui.statItems === 'visible'")
+ StatItem(
+ v-for="categoryId in statCurrentPeriod.incomes.categoriesIds"
+ :biggest="statCurrentPeriod.incomes.biggest"
+ :category="$store.state.categories.items[categoryId]"
+ :categoryId="categoryId"
+ :currency="$store.state.currencies.base"
+ :key="categoryId"
+ :type="1"
+ :total="statCurrentPeriod.categories[categoryId].incomes")
+
+ //- expenses
+ .statGroup(v-show="isShowExpenses")
+ //- expenses: cats charts
+ .stat__charts(v-show="$store.state.ui.catsChart === 'visible'")
+ PeriodCatsChart(type="expenses")
+
+ //- expenses: cats stat item
+ .stat__cats(v-show="$store.state.ui.statItems === 'visible'")
+ StatItem(
+ v-for="categoryId in statCurrentPeriod.expenses.categoriesIds"
+ :biggest="statCurrentPeriod.expenses.biggest"
+ :category="$store.state.categories.items[categoryId]"
+ :categoryId="categoryId"
+ :currency="$store.state.currencies.base"
+ :key="categoryId"
+ :type="0"
+ :total="statCurrentPeriod.categories[categoryId].expenses")
+
+ //- expenses
+ .statGroup(v-show="isShowHistory")
+ TrnsList
+
+ //- empty
+ //------------------------------------------------
+ EmptyData(
+ v-if="isEmptyData && $store.getters['trns/hasTrns']"
+ :text="$lang.stat.empty"
+ )
+</template>
+
+<style lang="stylus">
+.stat
+ .cats-chart__items
+ padding-right 8px
+ padding-left 8px
+
+ .trnsList
+ .trnsList__grid
+ padding 0
+
+ .trnsList__day
+ margin-top 0
+
+ &:last-child
+ margin-bottom 0
+ padding-bottom 0
+ border-bottom 0
+</style>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables/margins"
+@import "~assets/stylus/variables/media"
+@import "~assets/stylus/variables/flex"
+@import "~assets/stylus/variables/fonts"
+@import "~assets/stylus/variables/scroll"
+
+.swiper-slide
+ overflow hidden
+ overflow-y auto
+ height 100%
+
+.stat
+ position relative
+ margin 0 -8px
+
+ &__filter
+ overflow auto
+ z-index 10
+ opacity .95
+ position sticky
+ top 34px
+ display flex
+ padding-top 16px
+ background var(--c-bg-2)
+ scrollbar()
+
+ &__view
+ z-index 10
+ opacity .95
+ position sticky
+ top 50px
+ display flex
+ align-items center
+ justify-content space-between
+ margin-top $m5
+ background var(--c-bg-2)
+
+ &._withFilter
+ top 86px
+
+ &__charts
+ padding-bottom $m7
+ &:last-child
+ padding-bottom 0
+
+ &__name
+ padding 0 10px
+ padding-bottom 10px
+ font-header-1()
+
+ &__trns
+ padding 0 10px
+ padding-bottom 20px
+
+.statGroup
+ padding-top $m7
+
+.statItem-header
+ flex-grow 1
+ padding $m3
+ padding-top $m6
+ padding-bottom $m6
+ border-bottom 2px solid transparent
+
+ &._active
+ opacity 1
+ border-bottom 2px solid var(--c-bg-9)
+
+.statItem-total
+ display flex
+ align-items center
+ flex-flow column
+ flex-grow 1
+ padding 0 $m2
+
+ &__amount
+ padding-top $m5
+
+ &__title
+ flex-grow 1
+ font-size 12px
+ color var(--c-font-3)
+
+ &._incomes
+ color var(--c-incomes-1)
+
+ &._expenses
+ color var(--c-expenses-1)
+
+.statItem
+ &__trns
+ padding-bottom $m8
+</style>
diff --git a/components/stat/StatPc.vue b/components/stat/StatPc.vue
index 00301311..d9f0383e 100644
--- a/components/stat/StatPc.vue
+++ b/components/stat/StatPc.vue
@@ -59,6 +59,7 @@ export default {
.stat
position relative
padding 0 60px
+ padding-top $m9
&__content
display grid
diff --git a/components/stat/StatSummaryMobile2.vue b/components/stat/StatSummaryMobile2.vue
new file mode 100644
index 00000000..b0f9cbc6
--- /dev/null
+++ b/components/stat/StatSummaryMobile2.vue
@@ -0,0 +1,89 @@
+<script>
+export default {
+ name: 'StatSummaryMobile2',
+
+ computed: {
+ stat () {
+ return this.$store.getters['stat/statCurrentPeriod']
+ },
+ statAverage () {
+ return this.$store.getters['stat/statAverage']
+ },
+ period () {
+ return this.$store.state.filter.period
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.summary
+ .summary__item._incomes(@click="$store.dispatch('ui/setActiveTabStat', 'incomes')")
+ template(v-if="statAverage.incomes > 0 || period === 'all'")
+ .summary__item__title._incomes {{ $lang.money.incomes }}
+ .summary__item__amount
+ Amount(
+ :center="true"
+ :currency="$store.state.currencies.base"
+ :type="1"
+ :value="stat.incomes.total"
+ )
+ template(v-else) .
+
+ .summary__item._total(@click="$store.dispatch('ui/setActiveTabStat', 'stat')")
+ template(v-if="statAverage.total !== 0")
+ template(v-if="stat.incomes.total > 0 || stat.expenses.total > 0")
+ .summary__item__title {{ $lang.money.total }}
+ .summary__item__amount
+ Amount(
+ :center="true"
+ :currency="$store.state.currencies.base"
+ :value="stat.incomes.total - stat.expenses.total"
+ )
+ template(v-else) .
+
+ .summary__item._expenses(@click="$store.dispatch('ui/setActiveTabStat', 'expenses')")
+ template(v-if="statAverage.expenses > 0 || period === 'all'")
+ .summary__item__title._expenses {{ $lang.money.expenses }}
+ .summary__item__amount
+ Amount(
+ :center="true"
+ :currency="$store.state.currencies.base"
+ :value="stat.expenses.total"
+ :type="0"
+ )
+ template(v-else) .
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables/margins"
+
+.summary
+ display flex
+ margin $m6
+ margin-bottom 0
+ padding $m6 0
+ background var(--c-bg-4)
+ // border-bottom 1px solid var(--c-bg-1)
+ border-radius $m5
+
+ &__item
+ flex 1
+ text-align center
+ display flex
+ flex-flow column
+ align-items center
+ justify-content center
+
+ &:first-child
+ align-items flex-start
+ padding-left $m7
+
+ &:last-child
+ align-items flex-end
+ padding-right $m7
+
+ &__title
+ padding-bottom $m5
+ color var(--c-font-4)
+</style>
diff --git a/components/stat/cats/PeriodCatsChart.vue b/components/stat/cats/PeriodCatsChart.vue
index 447ecc1e..7c37a460 100644
--- a/components/stat/cats/PeriodCatsChart.vue
+++ b/components/stat/cats/PeriodCatsChart.vue
@@ -99,7 +99,7 @@ export default {
overflow-x auto
scrollbar()
display flex
- padding $m7
+ padding $m7 $m6
@media $media-laptop
padding 10px 10px
diff --git a/components/stat/cats/PeriodCatsChartItem.vue b/components/stat/cats/PeriodCatsChartItem.vue
index e77a5267..a5de7e99 100644
--- a/components/stat/cats/PeriodCatsChartItem.vue
+++ b/components/stat/cats/PeriodCatsChartItem.vue
@@ -63,7 +63,7 @@ export default {
</script>
<template lang="pug">
-.statCatsItem(
+.statCatsItem.statCatsItem.swiper-no-swiping(
@click="() => $store.dispatch('filter/handleSetFilterCategory', categoryId)"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave")
diff --git a/components/stat/chart/ChartItem2.vue b/components/stat/chart/ChartItem2.vue
new file mode 100644
index 00000000..d3cc872d
--- /dev/null
+++ b/components/stat/chart/ChartItem2.vue
@@ -0,0 +1,205 @@
+<script>
+import dayjs from 'dayjs'
+
+export default {
+ name: 'ChartItem2',
+
+ props: {
+ period: {
+ type: Object,
+ required: true
+ },
+ maxAmountValue: {
+ type: Number,
+ required: true
+ },
+ parentClassName: {
+ type: String,
+ required: true
+ }
+ },
+
+ data () {
+ return {
+ activeChartLeftOffset: null,
+ hoverChart: null
+ }
+ },
+
+ computed: {
+ className () {
+ const filterDate = this.$store.state.filter.date
+ const filterPeriod = this.$store.state.filter.period
+ const currentPeriodDate = this.period.date
+ const hasTrns = this.period.expenses > 0 || this.period.incomes > 0
+
+ return {
+ _active: dayjs(parseInt(currentPeriodDate)).isSame(filterDate, filterPeriod),
+ [`_${filterPeriod}`]: true,
+ _grouped: this.$store.state.chart.periods[filterPeriod].grouped,
+ _empty: !hasTrns && this.$store.state.chart.periods[filterPeriod].hideEmpty
+ }
+ },
+ formatedPeriodName () {
+ const dateValueOf = parseInt(this.period.date)
+ const filterPeriod = this.$store.state.filter.period
+ let formatedDate
+
+ switch (filterPeriod) {
+ case 'day':
+ formatedDate = dayjs(dateValueOf).format('D')
+ if (!this.$store.state.chart.periods[filterPeriod].grouped) {
+ dayjs().isSame(dateValueOf, 'year')
+ ? formatedDate = dayjs(dateValueOf).format('D.MM')
+ : formatedDate = dayjs(dateValueOf).format('D.MM.YY')
+ }
+ return formatedDate
+
+ case 'week':
+ return dayjs(parseInt(dateValueOf)).week()
+
+ case 'month':
+ formatedDate = dayjs(dateValueOf).format('MMM')
+ if (!this.$store.state.chart.periods[filterPeriod].grouped) {
+ dayjs().isSame(dateValueOf, 'year')
+ ? formatedDate = dayjs(dateValueOf).format('MMM')
+ : formatedDate = dayjs(dateValueOf).format('MMM YY')
+ }
+ return formatedDate
+
+ case 'year':
+ return dayjs(dateValueOf).format('YYYY')
+ }
+ },
+ periods () {
+ return this.$store.state.chart.periods
+ }
+ },
+
+ methods: {
+ getStyle (amount) {
+ return {
+ height: `${Math.abs(amount) / Math.abs(this.maxAmountValue) * 100}%`
+ }
+ },
+ handlePerioSelect () {
+ this.$store.dispatch('filter/setDate', parseInt(this.period.date))
+ },
+ onMouseEnterChartItem (event) {
+ const filterPeriod = this.$store.state.filter.period
+ const isPeriodGrouped = this.$store.state.chart.periods[filterPeriod].grouped
+ const values = this.period
+ const parent = document.querySelector(this.parentClassName)
+ const parentScrollLeft = parent.scrollLeft
+ const targetOffset = event.target.offsetLeft
+ const targetWidth = event.target.clientWidth
+ const parentOffset = event.target.parentNode.parentNode.offsetLeft
+ let offset
+ isPeriodGrouped
+ ? offset = `${targetOffset + (targetWidth / 2) + parentOffset - parentScrollLeft}px`
+ : offset = `${targetOffset + (targetWidth / 2) - parentScrollLeft}px`
+ this.$store.commit('chart/setHoveredPeriodValues', { values, offset })
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.chartItem(
+ :class="className"
+ @click="handlePerioSelect"
+ @mouseenter="onMouseEnterChartItem"
+ @mouseleave="$store.commit('chart/clearHoveredPeriodValues')")
+ .chartItem__graph
+ .chartItem__graph-box(v-if="period.expenses <= 0 && period.incomes <= 0")
+ .chartItem__graph-line._empty
+ .chartItem__graph-box(v-if="period.incomes > 0")
+ .chartItem__graph-line._incomes(:style="getStyle(period.incomes)")
+ .chartItem__graph-box(v-if="period.expenses > 0")
+ .chartItem__graph-line._expenses(:style="getStyle(period.expenses)")
+ .chartItem__name {{ formatedPeriodName }}
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables/margins"
+@import "~assets/stylus/variables/fonts"
+@import "~assets/stylus/variables/media"
+@import "~assets/stylus/variables/scroll"
+
+.chartItem
+ cursor pointer
+ min-width 30px
+ padding $m5 $m5
+ padding-top $m6
+ flex-grow 1
+ border-radius 4px
+
+ &._empty
+ display none
+
+ &._week
+ padding-left $m4
+ padding-right $m4
+
+ &._month
+ padding-left $m4
+ padding-right $m4
+
+ &._year
+ padding-left $m4
+ padding-right $m4
+
+ &._grouped
+ // min-width 0
+
+ &._grouped._day
+ padding-left 2px
+ padding-right 2px
+
+ &._grouped._week
+ &._grouped._month
+ padding-left 2px
+ padding-right 2px
+
+ &:hover
+ background var(--c-bg-3)
+
+ &._active
+ color var(--c-font-2)
+ background var(--c-bg-4)
+
+ &__name
+ text-align center
+ typo-small-upper(10px)
+ padding-top 4px
+ white-space nowrap
+
+ &__graph
+ display flex
+ justify-content center
+
+ &-box
+ display flex
+ flex-flow column
+ justify-content flex-end
+ height 78px
+
+ ^[0]._grouped &
+ height 58px
+
+ &-line
+ width 6px
+ margin 0 1px
+ min-height 1px
+ border-radius 6px
+
+ &._expenses
+ background var(--c-expenses-1)
+
+ &._incomes
+ background var(--c-incomes-1)
+
+ &._empty
+ width 2px
+ background grey
+</style>
diff --git a/components/stat/chart/ChartMenu2.vue b/components/stat/chart/ChartMenu2.vue
new file mode 100644
index 00000000..fd20d8dd
--- /dev/null
+++ b/components/stat/chart/ChartMenu2.vue
@@ -0,0 +1,145 @@
+<script>
+import localforage from 'localforage'
+
+export default {
+ name: 'ChartMenu2',
+
+ props: {
+ showDropdown: {
+ type: Boolean,
+ default: false
+ }
+ },
+
+ data () {
+ return {
+ visibleContextMenu: false
+ }
+ },
+
+ computed: {
+ filterPeriod () {
+ return this.$store.state.filter.period
+ },
+ periods () {
+ return this.$store.state.chart.periods
+ },
+ periodName () {
+ return this.$store.state.filter.period
+ }
+ },
+
+ methods: {
+ toogleView () {
+ this.$store.commit('chart/toogleChartPeriodView', { periodName: this.periodName })
+ },
+
+ addPeriodOrGroup () {
+ this.periods[this.filterPeriod].grouped
+ ? this.$store.commit('chart/addElementsToChart', { periodName: this.filterPeriod, periodType: 'showedGroups' })
+ : this.$store.commit('chart/addElementsToChart', { periodName: this.filterPeriod, periodType: 'showedPeriods' })
+ this.saveChartsPeriodsToLocalStorage()
+ },
+
+ removePeriodOrGroup () {
+ this.periods[this.filterPeriod].grouped
+ ? this.$store.commit('chart/removeElementsFromChart', { periodName: this.filterPeriod, periodType: 'showedGroups' })
+ : this.$store.commit('chart/removeElementsFromChart', { periodName: this.filterPeriod, periodType: 'showedPeriods' })
+ this.saveChartsPeriodsToLocalStorage()
+ },
+
+ toogleChartsView () {
+ this.visibleContextMenu = !this.visibleContextMenu
+ this.$store.commit('chart/toogleChartPeriodView', { periodName: this.filterPeriod })
+ this.saveChartsPeriodsToLocalStorage()
+ },
+
+ saveChartsPeriodsToLocalStorage () {
+ localforage.setItem('next.chart.periods', this.periods)
+ this.$store.dispatch('ui/saveUiView')
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.switcher
+ .switcher__name(@click="toogleView")
+ template(v-if="periods[filterPeriod].grouped") {{ periods[filterPeriod].showedGroups }} groups
+ template(v-else) {{ periods[filterPeriod].showedPeriods }} {{ periodName }}
+
+ .switcher__content(:class="{ _active: visibleContextMenu}")
+ .switcher__item(
+ v-if="!visibleContextMenu"
+ @click="visibleContextMenu = !visibleContextMenu"
+ ): .mdi.mdi-dots-horizontal
+
+ template(v-if="visibleContextMenu")
+ .switcher__item(@click="toogleView") View
+ .switcher__item(
+ v-if="(periods[filterPeriod].grouped && periods[filterPeriod].showedGroups > 1) || (!periods[filterPeriod].grouped && periods[filterPeriod].showedPeriods > 1)"
+ @click="removePeriodOrGroup"
+ ) Remove
+ .switcher__item(@click="addPeriodOrGroup") Add
+ .switcher__item(
+ @click="visibleContextMenu = !visibleContextMenu"
+ ): .mdi.mdi-close
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables"
+
+.switcher
+ position relative
+ display flex
+ align-items center
+ justify-content space-between
+ z-index 15
+ // padding 0 $m5
+ margin-bottom $m6
+ border-radius 8px 8px 0 0
+ overflow hidden
+ border-bottom 1px solid var(--c-bg-4)
+
+ &__name
+ flex-grow 1
+ font-size 10px
+ text-transform uppercase
+ color var(--c-font-5)
+ padding-left $m6
+
+ &__content
+ display flex
+ align-items stretch
+ justify-content stretch
+
+ &._active
+ border-left 1px solid var(--c-bg-4)
+
+ &._grow
+ flex-grow 1
+ justify-content space-between
+
+ &__item
+ display flex
+ align-items center
+ justify-content center
+ text-align center
+ opacity .6
+ min-width 48px
+ padding $m5 $m7
+ font-size 12px
+
+ .mdi
+ font-size 16px
+
+ &._grow
+ flex-grow 1
+
+ +media-hover()
+ background var(--c-bg-3)
+
+ &._active
+ opacity 1
+ background var(--c-bg-8)
+</style>
diff --git a/components/stat/chart/ChartPopup.vue b/components/stat/chart/ChartPopup.vue
index 815d50f4..47bf179f 100644
--- a/components/stat/chart/ChartPopup.vue
+++ b/components/stat/chart/ChartPopup.vue
@@ -5,24 +5,10 @@ export default {
<template lang="pug">
.chart-popup(:style="{ left: $store.state.chart.hoveredPeriod.offset }")
-
- .chart-popup__item
- Amount(
- :value="$store.state.chart.hoveredPeriod.values.incomes"
- :currency="$store.state.currencies.base"
- :type="1")
-
- .chart-popup__item
- Amount(
- :value="$store.state.chart.hoveredPeriod.values.expenses"
- :currency="$store.state.currencies.base"
- :type="0")
-
- template(v-if="$store.state.chart.hoveredPeriod.values.incomes !== 0 && $store.state.chart.hoveredPeriod.values.expenses !== 0")
- .chart-popup__item
- Amount(
- :value="$store.state.chart.hoveredPeriod.values.incomes - $store.state.chart.hoveredPeriod.values.expenses"
- :currency="$store.state.currencies.base")
+ SummaryRow2(
+ :incomesAmount="$store.state.chart.hoveredPeriod.values.incomes"
+ :expensesAmount="$store.state.chart.hoveredPeriod.values.expenses"
+ )
</template>
<style lang="stylus" scoped>
@@ -35,8 +21,8 @@ export default {
display block
position absolute
bottom 0px
- background var(--c-bg-1)
- padding $m7 $m9
+ background var(--c-bg-2)
+ padding $m7 $m7
border-radius $m4
transform translate(-50%, calc(100% + 16px))
@@ -47,7 +33,7 @@ export default {
content ""
border-left 8px solid transparent
border-right 8px solid transparent
- border-bottom 8px solid var(--c-bg-1)
+ border-bottom 8px solid var(--c-bg-2)
transform translateX(-50%)
&__item
diff --git a/components/stat/chartOptions.js b/components/stat/chartOptions.js
index 5351a515..9e93972e 100644
--- a/components/stat/chartOptions.js
+++ b/components/stat/chartOptions.js
@@ -43,8 +43,12 @@ export default {
},
column: {
groupPadding: 0.2,
- pointPadding: 0.2,
- borderWidth: 0
+ pointPadding: 0.1,
+ borderWidth: 0,
+ column: {
+ borderRadiusTopLeft: 5,
+ borderRadiusTopRight: 5
+ }
},
spline: {
lineWidth: 2,
diff --git a/components/trnForm/TrnForm.vue b/components/trnForm/TrnForm.vue
index 05866f66..4bfc90df 100644
--- a/components/trnForm/TrnForm.vue
+++ b/components/trnForm/TrnForm.vue
@@ -18,7 +18,7 @@ export default {
const scrollOverflow = ref(null)
const scrollDragger = ref(null)
- useTouchClose({
+ const { onCloseModal } = useTouchClose({
container: scrollContainer,
content: scrollContent,
overflow: scrollOverflow,
@@ -31,7 +31,8 @@ export default {
scrollContainer,
scrollContent,
scrollOverflow,
- scrollDragger
+ scrollDragger,
+ onCloseModal
}
},
@@ -75,7 +76,9 @@ export default {
slidesPerView: 1,
autoHeight: true,
initialSlide: 0,
- resistanceRatio: 0
+ shortSwipes: false,
+ longSwipesRatio: 0.1,
+ longSwipesMs: 60
})
}
})
@@ -107,9 +110,9 @@ export default {
// this.$store.commit('trnForm/closeTrnForm')
// }
- setTimeout(() => {
- this.showSuccess()
- }, 200)
+ this.showSuccess()
+ // setTimeout(() => {
+ // }, 200)
setTimeout(() => {
this.isTransfer
@@ -262,11 +265,6 @@ export default {
text: 'Excellent transaction!',
title: emo
})
- },
-
- onClose () {
- this.$store.dispatch('trnForm/closeTrnForm')
- this.slider.slideTo(0, 0)
}
}
}
@@ -282,7 +280,7 @@ export default {
.trnForm__overflow(
ref="scrollOverflow"
v-if="show"
- @click.prevent="onClose"
+ @click.prevent="onCloseModal"
)
//- wrap
@@ -333,7 +331,10 @@ export default {
.swiper-slide(:style="{ minHeight: `${$store.state.trnForm.height}px` }")
template(v-if="slider")
- TrnFormTrns(:slider="slider")
+ TrnFormTrns(
+ :slider="slider"
+ onlyList
+ )
//- Modals
TrnFormModalCats
diff --git a/components/trnForm/TrnFormCalculator.vue b/components/trnForm/TrnFormCalculator.vue
index 5ba359c3..85238063 100644
--- a/components/trnForm/TrnFormCalculator.vue
+++ b/components/trnForm/TrnFormCalculator.vue
@@ -249,7 +249,7 @@ export default {
~/._num &
color var(--c-font-3)
- background var(--c-bg-5)
+ background var(--c-bg-3)
~/._act &
color var(--c-font-4)
diff --git a/components/trnForm/TrnFormHeader.vue b/components/trnForm/TrnFormHeader.vue
index 4f15e0bc..f023e443 100644
--- a/components/trnForm/TrnFormHeader.vue
+++ b/components/trnForm/TrnFormHeader.vue
@@ -17,40 +17,13 @@ export default {
@import "~assets/stylus/variables/animations"
.trnFormHeaderItem
+ cursor pointer
position relative
- display flex
flex-grow 1
- padding $m7 $m7
color var(--c-bg-5)
border-radius $m5
anim()
- @media $media-laptop
- min-height 61px
-
- &__in
- ~/._category &
- display flex
- align-items center
-
- &__icon
- z-index 2
- margin-left -8px
- padding-right 4px
-
- &__total
- padding-top $m5
-
- &__name
- color var(--c-font-1)
-
- .parent
- font-size 12px
- padding-bottom $m2
-
- .child
- font-size 16px
-
&__dots
position absolute
top $m6
diff --git a/components/trnForm/TrnFormHeaderItemCategory.vue b/components/trnForm/TrnFormHeaderItemCategory.vue
index b3ac7624..28d833f1 100644
--- a/components/trnForm/TrnFormHeaderItemCategory.vue
+++ b/components/trnForm/TrnFormHeaderItemCategory.vue
@@ -18,22 +18,45 @@ export default {
<template lang="pug">
.trnFormHeaderItem._category(
v-if="category"
- :style="{ background: category.color || $store.state.ui.defaultBgColor }"
+ :style="{ background: category.color }"
@click="$store.commit('trnForm/toogleTrnFormModal', 'categories')"
)
- .trnFormHeaderItem__in
- transition(name="slide")
- .trnFormHeaderItem__icon(
- v-show="true"
- :key="category.icon"
- )
- Icon(:icon="category.icon")
- .trnFormHeaderItem__name
- .parent(v-if="parentCategory") {{ parentCategory.name }}
- .child {{ category.name }}
+ transition(name="slide")
+ .trnFormHeaderItem__icon(
+ v-show="true"
+ :key="category.icon"
+ )
+ Icon(:icon="category.icon")
+ .trnFormHeaderItem__name
+ .parent(v-if="parentCategory") {{ parentCategory.name }}
+ .child {{ category.name }}
+
.trnFormHeaderItem__dots: .mdi.mdi-dots-vertical
</template>
<style lang="stylus" scoped>
-//
+@import "~assets/stylus/variables"
+
+.trnFormHeaderItem
+ &._category
+ display flex
+ align-items center
+ padding $m5 $m6
+ background var(--c-bg-3)
+
+ .trnFormHeaderItem__icon
+ padding-right $m4
+
+ .trnFormHeaderItem__name
+ flex-grow 1
+ color var(--c-font-1)
+ text-align left
+
+ .parent
+ padding-bottom $m2
+ color var(--c-font-2)
+ font-size 12px
+
+ .child
+ font-size 16px
</style>
diff --git a/components/trnForm/TrnFormHeaderItemWallet.vue b/components/trnForm/TrnFormHeaderItemWallet.vue
index a9145a18..a38b296e 100644
--- a/components/trnForm/TrnFormHeaderItemWallet.vue
+++ b/components/trnForm/TrnFormHeaderItemWallet.vue
@@ -14,27 +14,21 @@ export default {
<template lang="pug">
.trnFormHeaderItem(
v-if="wallet"
- :style="{ background: wallet.color || $store.state.ui.defaultBgColor }"
@click="$store.commit('trnForm/toogleTrnFormModal', 'wallets')"
)
- .trnFormHeaderItem__in
- .trnFormHeaderItem__name {{ wallet.name }}
- .trnFormHeaderItem__total
- template(v-if="$store.getters['wallets/walletsTotal'][$store.state.trnForm.values.walletId]")
- Amount(
- :value="$store.getters['wallets/walletsTotal'][$store.state.trnForm.values.walletId].base"
- :currency="wallet.currency"
- vertical="left"
- )
- template(v-else)
- Amount(
- :value="0"
- :currency="$store.state.currencies.base"
- vertical="left"
- )
+ WalletItem(
+ ui="tile"
+ :id="$store.state.trnForm.values.walletId"
+ :showBase="false"
+ )
+
.trnFormHeaderItem__dots: .mdi.mdi-dots-vertical
</template>
<style lang="stylus" scoped>
-//
+.trnFormHeaderItem
+ padding 0
+
+ .walletItemGrid
+ width 100%
</style>
diff --git a/components/trnForm/TrnFormHeaderTransfer.vue b/components/trnForm/TrnFormHeaderTransfer.vue
index beabf58a..8d56030a 100644
--- a/components/trnForm/TrnFormHeaderTransfer.vue
+++ b/components/trnForm/TrnFormHeaderTransfer.vue
@@ -35,37 +35,27 @@ export default {
)
//- Wallet from
template(v-if="walletFrom")
- .trnFormHeaderItem(
- :style="{ background: walletFrom.color || $store.state.ui.defaultBgColor }"
- @click="$store.commit('trnForm/toogleTrnFormModal', 'transferFrom')"
- )
- .trnFormHeaderItem__in
- .trnFormHeaderItem__desc From wallet
- .trnFormHeaderItem__name {{ walletFrom.name }}
- .trnFormHeaderItem__total
- Amount(
- :value="$store.getters['wallets/walletsTotal'][walletFromId].base"
- :currency="$store.state.currencies.base"
- vertical="left"
- )
+ .trnFormHeaderItem
+ .trnFormHeaderItem__desc From wallet
+ WalletItem(
+ :id="walletFromId"
+ :showBase="false"
+ ui="tile"
+ @onClick="$store.commit('trnForm/toogleTrnFormModal', 'transferFrom')"
+ )
.trnFormHeaderSeparator: .mdi.mdi-chevron-right
//- Wallet to
template(v-if="walletTo")
- .trnFormHeaderItem(
- :style="{ background: walletTo.color || $store.state.ui.defaultBgColor }"
- @click="$store.commit('trnForm/toogleTrnFormModal', 'transferTo')"
- )
- .trnFormHeaderItem__in
- .trnFormHeaderItem__desc To wallet
- .trnFormHeaderItem__name {{ walletTo.name }}
- .trnFormHeaderItem__total
- Amount(
- :value="$store.getters['wallets/walletsTotal'][walletToId].base"
- :currency="$store.state.currencies.base"
- vertical="left"
- )
+ .trnFormHeaderItem
+ .trnFormHeaderItem__desc To wallet
+ WalletItem(
+ :id="walletToId"
+ :showBase="false"
+ ui="tile"
+ @onClick="$store.commit('trnForm/toogleTrnFormModal', 'transferTo')"
+ )
</template>
<style lang="stylus" scoped>
@@ -75,7 +65,7 @@ export default {
.trnFormHeaderSeparator
z-index 2
position absolute
- top 19px
+ top 28px
left 50%
color var(--c-font-1)
font-size 32px
@@ -83,9 +73,10 @@ export default {
.trnFormHeaderItem
&__desc
+ margin-bottom 2px
color var(--c-font-2)
font-size 12px
- margin-bottom 12px
- padding-bottom 6px
- border-bottom 1px solid var(--c-bg-10)
+
+ .walletItemGrid
+ width 100%
</style>
diff --git a/components/trnForm/TrnFormModal.vue b/components/trnForm/TrnFormModal.vue
index 3fb772a8..6531b224 100644
--- a/components/trnForm/TrnFormModal.vue
+++ b/components/trnForm/TrnFormModal.vue
@@ -15,6 +15,11 @@ export default {
position: {
type: String,
default: null
+ },
+
+ noPadding: {
+ type: Boolean,
+ default: false
}
},
@@ -24,7 +29,7 @@ export default {
const scrollOverflow = ref(null)
const scrollDragger = ref(null)
- useTouchClose({
+ const { onCloseModal } = useTouchClose({
container: scrollContainer,
content: scrollContent,
overflow: scrollOverflow,
@@ -36,7 +41,8 @@ export default {
scrollContainer,
scrollContent,
scrollOverflow,
- scrollDragger
+ scrollDragger,
+ onCloseModal
}
},
@@ -101,7 +107,7 @@ export default {
.trnFormModal__overflow(
v-show="show"
ref="scrollOverflow"
- @click="onClose"
+ @click="onCloseModal"
)
transition(name="slide" appear @after-leave="afterClose")
@@ -111,13 +117,14 @@ export default {
)
.trnFormModal__header(
ref="header"
- @click="onClose"
+ @click="onCloseModal"
)
.trnFormModal__header__title(v-if="title") {{ title }}
.trnFormModal__header__close: .mdi.mdi-close
.trnFormModal__scroll(
:style="modalStyle"
+ :class="{ _noPadding: noPadding }"
ref="scrollContent"
)
slot()
@@ -160,7 +167,7 @@ export default {
display flex
flex-grow 1
flex-flow column nowrap
- background var(--c-bg-4)
+ background var(--c-bg-2)
border-radius $m6
&._anim
@@ -179,6 +186,10 @@ export default {
padding $m7 0
scrollbar()
+ &._noPadding
+ overflow hidden
+ padding-bottom 0
+
&__header
cursor pointer
position relative
diff --git a/components/trnForm/TrnFormModalCats.vue b/components/trnForm/TrnFormModalCats.vue
index 734564ef..b1c62b4d 100644
--- a/components/trnForm/TrnFormModalCats.vue
+++ b/components/trnForm/TrnFormModalCats.vue
@@ -1,5 +1,47 @@
<script>
+import Swiper from 'swiper'
+import 'swiper/swiper-bundle.css'
+
export default {
+ data () {
+ return {
+ slider: null
+ }
+ },
+
+ computed: {
+ show () {
+ return this.$store.state.trnForm.modal.categories
+ },
+
+ modalStyle () {
+ return { height: `${this.$store.state.trnForm.height - 48}px` }
+ }
+ },
+
+ watch: {
+ show: {
+ handler (isShow) {
+ this.$nextTick(() => {
+ if (this.slider) {
+ this.slider.update()
+ }
+ else {
+ this.slider = new Swiper(this.$refs.slider, {
+ slidesPerView: 1,
+ autoHeight: false,
+ initialSlide: 1,
+ shortSwipes: false,
+ longSwipesRatio: 0.1,
+ longSwipesMs: 60
+ })
+ }
+ })
+ },
+ immediate: true
+ }
+ },
+
methods: {
handleCategoryClick (categoryId) {
if (this.$store.getters['categories/getChildCategoriesIds'](categoryId).length > 0) {
@@ -17,44 +59,112 @@ export default {
</script>
<template lang="pug">
-LazyTrnFormModal(
+TrnFormModal(
:show="$store.state.trnForm.modal.categories"
:title="$lang.categories.name"
:position="$store.state.ui.mobile ? 'bottom' : null"
+ noPadding
@onClose="$store.commit('trnForm/toogleTrnFormModal', 'categories')"
)
- template(v-if="$store.getters['categories/quickSelectorCategoriesIds'].length")
- .marginBottom
- .formTitle Favorite categories
- CategoriesView(
- :ids="$store.getters['categories/quickSelectorCategoriesIds']"
- ui="_flat"
- :noPaddingBottom="true"
- @onClick="handleCategoryClick"
- )
-
- template(v-if="$store.state.ui.lastUsedCatsInTrnForm === 'visible' && $store.getters['categories/lastUsedCategoriesIdsByDate'].length > 0")
- .marginBottom
- .formTitle Last used categories
- CategoriesView(
- :ids="$store.getters['categories/lastUsedCategoriesIdsByDate']"
- ui="_flat"
- :noPaddingBottom="true"
- @onClick="handleCategoryClick"
- )
- .formTitle All categories
-
- CategoriesView(
- :ids="$store.getters['categories/categoriesRootIds']"
- :noPaddingBottom="true"
- @onClick="handleCategoryClick"
- )
+ .bottomNav
+ .switcher(v-if="slider")
+ .switcher__item(
+ :class="{ _active: slider.activeIndex === 0 }"
+ @click="slider.slideTo(0)"
+ ) Last used
+ .switcher__item(
+ :class="{ _active: slider.activeIndex === 1 }"
+ @click="slider.slideTo(1)"
+ ) Favorites
+ .switcher__item(
+ :class="{ _active: slider.activeIndex === 2 }"
+ @click="slider.slideTo(2)"
+ ) All
+
+ .swiper-container(ref="slider")
+ .swiper-wrapper
+
+ .swiper-slide
+ .scrollBlock.waitForScroll(
+ v-if="$store.state.ui.lastUsedCatsInTrnForm === 'visible' && $store.getters['categories/lastUsedCategoriesIdsByDate'].length > 0"
+ :style="modalStyle"
+ )
+ .marginBottom
+ CategoriesView(
+ :ids="$store.getters['categories/lastUsedCategoriesIdsByDate']"
+ ui="_flat"
+ :noPaddingBottom="true"
+ @onClick="handleCategoryClick"
+ )
+
+ .swiper-slide
+ .scrollBlock.waitForScroll(
+ v-if="$store.getters['categories/quickSelectorCategoriesIds'].length"
+ :style="modalStyle"
+ )
+ .marginBottom
+ CategoriesView(
+ :ids="$store.getters['categories/quickSelectorCategoriesIds']"
+ ui="_flat"
+ :noPaddingBottom="true"
+ @onClick="handleCategoryClick"
+ )
+
+ .swiper-slide
+ .scrollBlock.waitForScroll(:style="modalStyle")
+ .marginBottom
+ CategoriesView(
+ :ids="$store.getters['categories/categoriesRootIds']"
+ :noPaddingBottom="true"
+ @onClick="handleCategoryClick"
+ )
</template>
<style lang="stylus" scoped>
@import "~assets/stylus/variables/margins"
+@import "~assets/stylus/variables/media"
+@import "~assets/stylus/variables/scroll"
+
+.scrollBlock
+ overflow hidden
+ overflow-y auto
+ scrollbar()
.marginBottom
- margin-top (- $m8)
- margin-bottom $m10
+ margin-bottom 80px
+
+.bottomNav
+ z-index 10
+ position absolute
+ left 0
+ bottom 0
+ width 100%
+ padding 0
+
+.switcher
+ overflow hidden
+ opacity .96
+ position relative
+ display flex
+ align-items stretch
+ justify-content stretch
+ background var(--c-bg-4)
+
+ &__item
+ opacity .6
+ flex-grow 1
+ display flex
+ align-items center
+ justify-content center
+ min-width 48px
+ padding $m7 $m7
+ font-size 14px
+ border-radius 4px
+
+ +media-hover()
+ background var(--c-bg-3)
+
+ &._active
+ opacity 1
+ background var(--c-bg-8)
</style>
diff --git a/components/trnForm/TrnFormModalTransferFrom.vue b/components/trnForm/TrnFormModalTransferFrom.vue
index 1dc9d28b..9c14cfa3 100644
--- a/components/trnForm/TrnFormModalTransferFrom.vue
+++ b/components/trnForm/TrnFormModalTransferFrom.vue
@@ -19,8 +19,7 @@ TrnFormModal(
title="Transfer from wallet"
@onClose="$store.commit('trnForm/toogleTrnFormModal', 'transferFrom')"
)
- WalletsList(
- ui="tile"
+ WalletsList3(
@onClick="handleSetWallet"
)
</template>
diff --git a/components/trnForm/TrnFormModalTransferTo.vue b/components/trnForm/TrnFormModalTransferTo.vue
index 681cb14e..5e23e0f7 100644
--- a/components/trnForm/TrnFormModalTransferTo.vue
+++ b/components/trnForm/TrnFormModalTransferTo.vue
@@ -19,8 +19,7 @@ TrnFormModal(
title="Transfer to wallet"
@onClose="$store.commit('trnForm/toogleTrnFormModal', 'transferTo')"
)
- WalletsList(
- ui="tile"
+ WalletsList3(
@onClick="handleSetWallet"
)
</template>
diff --git a/components/trnForm/TrnFormModalTrn.vue b/components/trnForm/TrnFormModalTrn.vue
index 54e35d09..6e677a7d 100644
--- a/components/trnForm/TrnFormModalTrn.vue
+++ b/components/trnForm/TrnFormModalTrn.vue
@@ -84,7 +84,7 @@ TrnFormModal(
:position="$store.state.ui.mobile ? 'bottom' : null"
@onClose="$store.commit('trnForm/toogleTrnFormModal', 'trn')"
)
- .modalLinks._noPadding
+ .modalLinks
ModalButton(
name="Delete"
icon="mdi mdi-delete"
diff --git a/components/trnForm/TrnFormModalWallets.vue b/components/trnForm/TrnFormModalWallets.vue
index 12ddbbb9..508de739 100644
--- a/components/trnForm/TrnFormModalWallets.vue
+++ b/components/trnForm/TrnFormModalWallets.vue
@@ -11,14 +11,16 @@ export default {
<template lang="pug">
TrnFormModal(
+ v-if="$store.state.trnForm.modal.wallets"
:show="$store.state.trnForm.modal.wallets"
:title="$lang.wallets.title"
:position="$store.state.ui.mobile ? 'bottom' : null"
@onClose="$store.commit('trnForm/toogleTrnFormModal', 'wallets')"
)
.trnFormWalletsList
- WalletsList(
+ WalletsList3(
:limit="6"
+ :showBase="false"
showToogle
ui="widget"
@onClick="handleSetWallet"
@@ -45,4 +47,6 @@ TrnFormModal(
.walletsList__toogle
border-top 0
padding-bottom 0
+ margin 0
+ text-align center
</style>
diff --git a/components/trnForm/TrnFormTrns.vue b/components/trnForm/TrnFormTrns.vue
index 2a796135..2a770969 100644
--- a/components/trnForm/TrnFormTrns.vue
+++ b/components/trnForm/TrnFormTrns.vue
@@ -1,10 +1,16 @@
<script>
+import dayjs from 'dayjs'
+
export default {
props: {
ui: {
type: String,
default: 'history'
},
+ onlyList: {
+ type: Boolean,
+ default: false
+ },
limit: {
type: Number,
default: 0
@@ -80,6 +86,27 @@ export default {
// limit
if (this.limit > 0) { return trnsIds.slice(0, this.limit) }
return trnsIds
+ },
+
+ groupedTrns () {
+ const trns = this.$store.state.trns.items
+ const trnsIds = this.paginatedTrnsIds
+ const trnsList = {}
+
+ for (const trnId of trnsIds) {
+ let dayDate
+ this.sortByEditDate
+ ? dayDate = dayjs(trns[trnId].edited).startOf('day').valueOf()
+ : dayDate = dayjs(trns[trnId].date).startOf('day').valueOf()
+
+ if (!trnsList[dayDate]) {
+ trnsList[dayDate] = [trnId]
+ }
+ else {
+ trnsList[dayDate].push(trnId)
+ }
+ }
+ return trnsList
}
},
@@ -125,16 +152,18 @@ export default {
.container(v-if="trnsIds.length === 0") No transactions
.trnsList__content
- template(v-if="trnsIds.length > 0")
- template(v-for="trnId of paginatedTrnsIds")
- TrnItemForm(
- :category="$store.state.categories.items[$store.state.trns.items[trnId].categoryId]"
- :key="trnId"
- :trn="$store.state.trns.items[trnId]"
- :trnId="trnId"
- :wallet="$store.state.wallets.items[$store.state.trns.items[trnId].walletId]"
- @onClickValue="onClickValue"
- )
+ .trnsList__grid(:class={ _onlyList: onlyList })
+ .trnsList__day(v-for="(trnsIds, date) in groupedTrns")
+ .trnsList__header: TrnsListDate(:date="date")
+ .trnsList__trns
+ TrnItem(
+ v-for="trnId in trnsIds"
+ :category="$store.state.categories.items[$store.state.trns.items[trnId].categoryId]"
+ :key="trnId"
+ :trn="$store.state.trns.items[trnId]"
+ :trnId="trnId"
+ :wallet="$store.state.wallets.items[$store.state.trns.items[trnId].walletId]"
+ )
.trnsList__pages(v-if="!isShowedAllTrns")
Button(
@@ -151,8 +180,8 @@ export default {
display flex
align-items center
justify-content center
- min-height 100%
height 100%
+ min-height 100%
padding $m10 $m7
color var(--c-font-3)
font-size 26px
@@ -206,6 +235,8 @@ export default {
opacity 1
.trnsList
+ padding-bottom 8px
+
+media-laptop()
padding 0
@@ -215,18 +246,41 @@ export default {
grid-template-columns 1fr
grid-column-gap 8px
grid-row-gap 8px
+ padding 8px
padding-bottom 0
&__day
overflow hidden
+ border-bottom 1px solid var(--c-bg-3)
+ margin-bottom 16px
+ padding-bottom 16px
+
+ &:first-child
+ margin-top $m9
+ border-top 0
+
+ +media-laptop()
+ margin 0
&__header
display flex
align-items center
justify-content space-between
- padding 12px 12px
+ padding 0 12px
+ padding-bottom 12px
&__pages
- padding $m9
- text-align center
+ padding 16px 8px
+
+ +media-laptop()
+ padding 0
+ padding-top 20px
+
+ &__sort
+ padding 0
+ padding-bottom $m8
+
+ +media-laptop("less")
+ padding $m7
+ padding-bottom $m6
</style>
diff --git a/components/trnForm/styles/trnForm.styl b/components/trnForm/styles/trnForm.styl
index 389b150b..d727988c 100644
--- a/components/trnForm/styles/trnForm.styl
+++ b/components/trnForm/styles/trnForm.styl
@@ -29,7 +29,7 @@
flex-flow column nowrap
max-width 500px
margin 0 auto
- background var(--c-bg-4)
+ background var(--c-bg-2)
/.light-mode &
background var(--c-bg-2)
@@ -74,21 +74,20 @@
position relative
&__value
- position relative
z-index 2
+ position relative
width 100%
padding $m8 $m9
color var(--c-font-2)
font-header-1()
- font-weight 500
font-size 36px
+ font-weight 500
text-align right
background 0
border 0
.trnFormAnimation
&-enter-active
- &-leave-active
opacity 1
anim()
@@ -100,7 +99,6 @@
transform translate(0, 0)
&-enter
- &-leave-to
opacity 0
transition opacity 200ms ease-out, transform 250ms ease-out
@@ -110,6 +108,7 @@
@media $media-laptop
transform translate(10px, 0)
+ &-leave-active
&-leave-to
- @media $media-phone
- transform translate(0, 100px)
+ opacity 0
+ transition none
diff --git a/components/trns/item/TrnItem.vue b/components/trns/item/TrnItem.vue
index 823f2d73..af5ab138 100644
--- a/components/trns/item/TrnItem.vue
+++ b/components/trns/item/TrnItem.vue
@@ -44,6 +44,18 @@ export default {
},
formatedDateDay2 () {
return formatDate(this.trn.date, 'trnItem')
+ },
+
+ filterTrnsDate () {
+ const date = this.trn.date
+ const walletId = this.trn.walletId
+
+ const trns = this.$store.state.trns.items
+ const trnsIds = Object.keys(trns)
+ .filter(id => trns[id].date <= date && trns[id].walletId === walletId)
+
+ const total = this.$store.getters['trns/getTotalOfTrnsIds'](trnsIds, true)
+ return total
}
},
@@ -197,7 +209,17 @@ export default {
:value="trn.amount"
:type="trn.type"
)
- .trnItem__desc(v-if="trn.description") {{ trn.description }}
+ .trnItem__desc
+ div(v-if="trn.description") {{ trn.description }}
+ //- div
+ //- span Баланс
+ //- Amount(
+ //- :currency="wallet.currency"
+ //- :value="filterTrnsDate.total"
+ //- :type="3"
+ //- size="sm"
+ //- vertical="left"
+ //- )
.trnItem__line
</template>
diff --git a/components/trns/modal/TrnModal.vue b/components/trns/modal/TrnModal.vue
index b55be4f0..ad3e82d7 100644
--- a/components/trns/modal/TrnModal.vue
+++ b/components/trns/modal/TrnModal.vue
@@ -77,112 +77,121 @@ export default {
</script>
<template lang="pug">
-ModalBottom(
- v-if="$store.getters['trns/hasTrns']"
- :show="$store.state.trns.modal.show"
- @onClose="$store.commit('trns/hideTrnModal')"
- @afterClose="$store.commit('trns/setTrnModalId', null)")
-
- template(v-if="trnId")
- template(slot="header")
- //- trn
- TrnItem(
- :category="category"
- :trn="$store.state.trns.items[trnId]"
- :trnId="trnId"
- :wallet="wallet"
- ui="detailed")
-
- //- btns
- template(slot="btns")
- ModalButton(
- name="Delete"
- icon="mdi mdi-delete"
- @onClick="handleDeleteClick")
-
- ModalButton(
- name="Edit"
- icon="mdi mdi-pencil"
- @onClick="handleEditClick")
-
- ModalButton(
- name="Dublicate"
- icon="mdi mdi-content-copy"
- @onClick="handleDublicateTrn")
-
- .moreActions
- Button.marginBottom(
- className="_borderBottom"
- title="Set category filter"
- icon="mdi mdi-folder-star"
- @onClick="handleSetFilterCategory"
+Portal(
+ v-if="$store.getters['trns/hasTrns'] && $store.state.trns.modal.show"
+ to="modal"
+)
+ ModalBottom(
+ :key="trnId"
+ @onClose="$store.commit('trns/hideTrnModal')"
+ @afterClose="$store.commit('trns/setTrnModalId', null)"
+ )
+ template(v-if="trnId")
+ template(slot="header")
+ //- trn
+ TrnItem(
+ :category="category"
+ :trn="$store.state.trns.items[trnId]"
+ :trnId="trnId"
+ :wallet="wallet"
+ ui="detailed")
+
+ //- btns
+ template(slot="btns")
+ ModalButton(
+ name="Delete"
+ icon="mdi mdi-delete"
+ @onClick="handleDeleteClick")
+
+ ModalButton(
+ name="Edit"
+ icon="mdi mdi-pencil"
+ @onClick="handleEditClick")
+
+ ModalButton(
+ name="Dublicate"
+ icon="mdi mdi-content-copy"
+ @onClick="handleDublicateTrn")
+
+ .moreActions
+ Button.marginBottom(
+ className="_borderBottom"
+ title="Set category filter"
+ icon="mdi mdi-folder-star"
+ @onClick="handleSetFilterCategory"
+ )
+
+ Button.marginBottom(
+ :class="{ marginBottom: budgets }"
+ className="_borderBottom"
+ icon="mdi mdi-credit-card-multiple"
+ title="Set wallet filter"
+ @onClick="handleSetFilterWallet"
+ )
+
+ Button(
+ v-if="budgets && $store.getters['user/isTester']"
+ :class="{ marginBottom: groups }"
+ className="_borderBottom"
+ icon="mdi mdi-hand-saw"
+ title="Show budgets"
+ @onClick="showModalBudgets = true"
+ )
+
+ Button(
+ v-if="groups && $store.getters['user/isTester']"
+ className="_borderBottom"
+ icon="mdi mdi-folder-multiple-outline"
+ title="Show groups"
+ @onClick="showModalGroups = true"
+ )
+
+ //- budgets
+ template(v-if="groups && $store.getters['user/isTester']")
+ Portal(
+ v-if="showModalBudgets"
+ to="modal"
)
-
- Button.marginBottom(
- :class="{ marginBottom: budgets }"
- className="_borderBottom"
- icon="mdi mdi-credit-card-multiple"
- title="Set wallet filter"
- @onClick="handleSetFilterWallet"
- )
-
- Button(
- v-if="budgets && $store.getters['user/isTester']"
- :class="{ marginBottom: groups }"
- className="_borderBottom"
- icon="mdi mdi-hand-saw"
- title="Show budgets"
- @onClick="showModalBudgets = true"
+ ModalBottom(
+ paddingless
+ title="Budgets"
+ @onClose="showModalBudgets = false"
+ )
+ template(v-for="(budget, budgetId) in budgets")
+ .item(@click="toogleAddToBudget(budgetId)")
+ .item__active
+ template(v-if="trn && trn.budgets && trn.budgets[budgetId]")
+ .mdi.mdi-check
+ template(v-else)
+ .mdi.mdi-plus
+ .item__name {{ budget.name }}
+ .item__amount
+ Amount(:currency="budget.currency" :value="budget.amount")
+
+ template(v-if="groups && $store.getters['user/isTester']")
+ Portal(
+ v-if="showModalGroups"
+ to="modal"
)
-
- Button(
- v-if="groups && $store.getters['user/isTester']"
- className="_borderBottom"
- icon="mdi mdi-folder-multiple-outline"
- title="Show groups"
- @onClick="showModalGroups = true"
- )
-
- //- budgets
- template(v-if="groups && $store.getters['user/isTester']")
- ModalBottom(
- :show="showModalBudgets"
- paddingless
- title="Budgets"
- @onClose="showModalBudgets = false"
- )
- template(v-for="(budget, budgetId) in budgets")
- .item(@click="toogleAddToBudget(budgetId)")
- .item__active
- template(v-if="trn && trn.budgets && trn.budgets[budgetId]")
- .mdi.mdi-check
- template(v-else)
- .mdi.mdi-plus
- .item__name {{ budget.name }}
- .item__amount
- Amount(:currency="budget.currency" :value="budget.amount")
-
- template(v-if="groups && $store.getters['user/isTester']")
- ModalBottom(
- :show="showModalGroups"
- title="groups"
- @onClose="showModalGroups = false"
- paddingless
- )
- template(v-for="(group, groupId) in groups")
- .item(@click="toogleAddToGroup(groupId)")
- .item__active
- template(v-if="trn && trn.groups && trn.groups[groupId]")
- .mdi.mdi-check
- template(v-else)
- .mdi.mdi-plus
- .item__name {{ group.name }}
-
- //- confirm
- ModalBottomConfirm(
- :show="showModalConfirm"
- @onClose="showModalConfirm = false"
- @onConfirm="handleDeleteConfirm")
+ ModalBottom(
+ paddingless
+ title="groups"
+ @onClose="showModalGroups = false"
+ )
+ template(v-for="(group, groupId) in groups")
+ .item(@click="toogleAddToGroup(groupId)")
+ .item__active
+ template(v-if="trn && trn.groups && trn.groups[groupId]")
+ .mdi.mdi-check
+ template(v-else)
+ .mdi.mdi-plus
+ .item__name {{ group.name }}
+
+ //- confirm
+ ModalBottomConfirm(
+ :show="showModalConfirm"
+ @onClose="showModalConfirm = false"
+ @onConfirm="handleDeleteConfirm")
</template>
<style lang="stylus" scoped>
diff --git a/components/wallets/form/WalletForm.vue b/components/wallets/form/WalletForm.vue
index d045f364..5b9b7eb1 100644
--- a/components/wallets/form/WalletForm.vue
+++ b/components/wallets/form/WalletForm.vue
@@ -167,36 +167,44 @@ ComponentWrap
:alt="true")
//- colors
- ModalBottom(
- :center="true"
- :show="showColors"
- :title="$lang.wallets.form.color.placeholder"
- @onClose="showColors = false")
- .inputText
- .inputText__colors
- .colors
- .colorItem(
- :class="{ _active: wallet.color === color }"
- :style="{ background: color }"
- @click="handleColorSelect(color)"
- v-for="color in colors")
- .customColor
- .customColor__title {{ $lang.wallets.form.color.custom }}
- input.customColor__value(v-model="wallet.color" type="color")
+ Portal(
+ v-if="showColors"
+ to="modal"
+ )
+ ModalBottom(
+ :center="true"
+ :title="$lang.wallets.form.color.placeholder"
+ @onClose="showColors = false"
+ )
+ .inputText
+ .inputText__colors
+ .colors
+ .colorItem(
+ :class="{ _active: wallet.color === color }"
+ :style="{ background: color }"
+ @click="handleColorSelect(color)"
+ v-for="color in colors")
+ .customColor
+ .customColor__title {{ $lang.wallets.form.color.custom }}
+ input.customColor__value(v-model="wallet.color" type="color")
//- currencies
- ModalBottom(
- :center="true"
- :show="showCurrencies"
- :title="$lang.wallets.form.currency.placeholder"
- @onClose="showCurrencies = false")
- .inputText
- .currencies
- .currencies__item(
- :class="{ _active: wallet.currency === currency }"
- @click="handleCurrencySelect(currency)"
- v-for="(item, currency) in $store.state.currencies.rates"
- ) {{ currency }}
+ Portal(
+ v-if="showCurrencies"
+ to="modal"
+ )
+ ModalBottom(
+ :center="true"
+ :title="$lang.wallets.form.currency.placeholder"
+ @onClose="showCurrencies = false"
+ )
+ .inputText
+ .currencies
+ .currencies__item(
+ :class="{ _active: wallet.currency === currency }"
+ @click="handleCurrencySelect(currency)"
+ v-for="(item, currency) in $store.state.currencies.rates"
+ ) {{ currency }}
template(slot="bottom")
.col
diff --git a/components/wallets/item/WalletItem.vue b/components/wallets/item/WalletItem.vue
index 0fe4c688..d3714cd6 100644
--- a/components/wallets/item/WalletItem.vue
+++ b/components/wallets/item/WalletItem.vue
@@ -77,6 +77,7 @@ div(
:alwaysShowSymbol="true"
:currency="wallet.currency"
:value="wallet.total"
+ vertical="left"
)
//- list
diff --git a/components/wallets/item/WalletItem2.vue b/components/wallets/item/WalletItem2.vue
new file mode 100644
index 00000000..09fdf193
--- /dev/null
+++ b/components/wallets/item/WalletItem2.vue
@@ -0,0 +1,78 @@
+<script>
+export default {
+ name: 'WalletItem2',
+
+ props: {
+ id: {
+ type: String,
+ required: true
+ },
+
+ showBase: {
+ type: Boolean,
+ default: true
+ }
+ },
+
+ computed: {
+ wallet () {
+ return {
+ ...this.$store.state.wallets.items[this.id],
+ total: this.$store.getters['wallets/walletsTotal'][this.id].base
+ }
+ }
+ },
+
+ methods: {
+ handleClick () {
+ if (this.$listeners.onClick) {
+ this.$listeners.onClick(this.id)
+ }
+ },
+
+ handleIconClick () {
+ this.$store.dispatch('ui/setActiveTab', 'stat')
+ this.$store.dispatch('filter/setFilterWalletId', this.id)
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.walletItemGrid(
+ @click="handleClick"
+)
+ .walletItemGrid__line(:style="{ background: wallet.color || $store.state.ui.defaultBgColor }")
+ .walletItemGrid__name {{ wallet.name }}
+ .walletItemGrid__amount
+ Amount(
+ :alwaysShowSymbol="true"
+ :currency="wallet.currency"
+ :value="wallet.total"
+ :showBase="showBase"
+ vertical="left"
+ )
+</template>
+
+<style lang="stylus">
+@import "~assets/stylus/variables"
+
+.walletItemGrid
+ overflow hidden
+ cursor pointer
+ padding $m6 $m6
+ padding-top 0
+ background var(--c-bg-3)
+ border-radius $m5
+
+ &__line
+ opacity 1
+ height 4px
+ margin 0 (- $m6)
+ margin-bottom $m6
+
+ &__name
+ padding-bottom $m5
+ color var(--c-font-2)
+ font-size 16px
+</style>
diff --git a/components/wallets/item/walletItem.styl b/components/wallets/item/walletItem.styl
index 602ece48..508ab735 100644
--- a/components/wallets/item/walletItem.styl
+++ b/components/wallets/item/walletItem.styl
@@ -92,20 +92,21 @@
position relative
display flex
flex-flow column nowrap
- align-items flex-end
+ align-items flex-start
justify-content center
min-height 61px
- padding $m7
+ padding $m6 $m7
color var(--c-font-1)
- border-radius $m4
+ border-radius $m5
@media $media-laptop
min-height 66px
&__name
- min-height 16px
overflow hidden
+ min-height 16px
padding-bottom $m5
+ text-align left
fs-m()
.amount
diff --git a/components/wallets/list/WalletsList3.vue b/components/wallets/list/WalletsList3.vue
new file mode 100644
index 00000000..75f03ef3
--- /dev/null
+++ b/components/wallets/list/WalletsList3.vue
@@ -0,0 +1,81 @@
+<script>
+
+export default {
+ name: 'WalletsList3',
+
+ props: {
+ limit: {
+ type: [Number, Boolean],
+ default: null
+ },
+
+ showToogle: {
+ type: Boolean,
+ default: false
+ },
+
+ showBase: {
+ type: Boolean,
+ default: true
+ }
+ },
+
+ data () {
+ return {
+ stateLimit: 0
+ }
+ },
+
+ computed: {
+ walletsIds () {
+ const walletsIds = this.$store.getters['wallets/walletsSortedIds']
+ if (this.stateLimit) { return walletsIds.slice(0, this.stateLimit) }
+ return walletsIds
+ }
+ },
+
+ mounted () {
+ this.stateLimit = this.limit
+ },
+
+ methods: {
+ toogleWallets () {
+ if (this.stateLimit > 0) {
+ this.stateLimit = 0
+ }
+ else {
+ this.stateLimit = this.limit
+ }
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.walllets
+ .walllets__grid
+ WalletItem2(
+ v-for="walletId in walletsIds"
+ :id="walletId"
+ :key="walletId"
+ :showBase="showBase"
+ v-on="$listeners"
+ )
+
+ .walletsList__toogle(v-if="showToogle && $store.getters['wallets/walletsSortedIds'].length > limit" @click="toogleWallets")
+ template(v-if="stateLimit > 0") {{ this.$lang.wallets.showAll }}
+ template(v-else) {{ this.$lang.wallets.showOnly }} {{ limit }}
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables"
+
+.walllets
+ padding 0 $m7
+
+.walllets__grid
+ display grid
+ grid-template-columns repeat(2, 1fr)
+ grid-column-gap $m7
+ grid-row-gap $m7
+</style>
diff --git a/components/wallets/modal/WalletModal.vue b/components/wallets/modal/WalletModal.vue
index 7953dc16..2e0c8e26 100644
--- a/components/wallets/modal/WalletModal.vue
+++ b/components/wallets/modal/WalletModal.vue
@@ -2,6 +2,13 @@
import { db } from '~/services/firebaseConfig'
export default {
+ props: {
+ slider: {
+ type: Object,
+ default: () => {}
+ }
+ },
+
data () {
return {
showModalConfirm: false
@@ -34,6 +41,11 @@ export default {
this.$store.dispatch('ui/setActiveTab', 'stat')
this.$store.commit('filter/setFilterDateNow')
this.$store.dispatch('filter/setFilterWalletId', this.walletId)
+ this.$store.commit('wallets/setWalletModalId', null)
+
+ if (this.slider) {
+ this.slider.slideTo(1)
+ }
},
handleEditClick () {
@@ -68,32 +80,35 @@ export default {
</script>
<template lang="pug">
-ModalBottom(
+Portal(
v-if="$store.state.wallets.modal.id"
- :show="$store.state.wallets.modal.show"
- @onClose="$store.commit('wallets/hideWalletModal')"
- @afterClose="$store.commit('wallets/setWalletModalId', null)")
- template(v-if="walletId")
- template(slot="header")
- WalletItem(:id="walletId")
-
- template(slot="description")
- template(v-if="$store.state.wallets.items[walletId].desc")
- div(style="padding-bottom:20px") {{ $store.state.wallets.items[walletId].desc }}
-
- template(slot="btns")
- ModalButton(
- :name="$lang.base.delete"
- icon="mdi mdi-delete"
- @onClick="handleDeleteClick")
- ModalButton(
- :name="$lang.base.edit"
- icon="mdi mdi-pencil"
- @onClick="handleEditClick")
- ModalButton(
- :name="$lang.base.filter"
- icon="mdi mdi-filter-outline"
- @onClick="handleSetFilterWallet")
+ to="modal"
+)
+ ModalBottom(
+ @onClose="$store.commit('wallets/hideWalletModal')"
+ @afterClose="$store.commit('wallets/setWalletModalId', null)"
+ )
+ template(v-if="walletId")
+ template(slot="emptyHeader")
+ WalletItem2(:id="walletId")
+
+ template(slot="description")
+ template(v-if="$store.state.wallets.items[walletId].desc")
+ div(style="padding-bottom:20px") {{ $store.state.wallets.items[walletId].desc }}
+
+ template(slot="btns")
+ ModalButton(
+ :name="$lang.base.delete"
+ icon="mdi mdi-delete"
+ @onClick="handleDeleteClick")
+ ModalButton(
+ :name="$lang.base.edit"
+ icon="mdi mdi-pencil"
+ @onClick="handleEditClick")
+ ModalButton(
+ :name="$lang.base.filter"
+ icon="mdi mdi-filter-outline"
+ @onClick="handleSetFilterWallet")
ModalBottomConfirm(
:show="showModalConfirm"
@@ -101,3 +116,24 @@ ModalBottom(
@onClose="showModalConfirm = false"
@onConfirm="handleDeleteConfirm")
</template>
+
+<style lang="stylus">
+@import "~assets/stylus/variables"
+
+.modalBottom
+ .walletItemGrid
+ width 100%
+ padding $m8
+ padding-top 0
+ border-radius $m6 $m6 0 0
+
+ &__name
+ padding-bottom $m7
+ font-size 22px
+
+ &__line
+ height 6px
+ margin-right (- $m8)
+ margin-bottom $m8
+ margin-left (- $m8)
+</style>>
diff --git a/components/wallets/sort/WalletsSort.vue b/components/wallets/sort/WalletsSort.vue
index 1b384048..1b53f665 100644
--- a/components/wallets/sort/WalletsSort.vue
+++ b/components/wallets/sort/WalletsSort.vue
@@ -28,7 +28,8 @@ export default {
const result = await this.$store.dispatch('wallets/saveWalletsOrder', sortedWallets)
if (result.succsess) {
- this.$store.dispatch('ui/setActiveTab', 'wallets')
+ if (this.$listeners.closeModal) { this.$listeners.closeModal() }
+ // this.$store.dispatch('ui/setActiveTab', 'wallets')
this.$notify({
type: 'success',
title: random(successEmo),
@@ -51,7 +52,8 @@ ComponentWrap(:contentPadding="$store.state.ui.pc")
draggable(
v-model="sortedWalletsIds"
handle=".handle"
- ghost-class="_draggable")
+ ghost-class="_draggable"
+ )
template(v-for="walletId in sortedWalletsIds")
.walletItem2(:key="walletId")
.walletItem2__icon.handle
@@ -60,14 +62,15 @@ ComponentWrap(:contentPadding="$store.state.ui.pc")
:background="$store.state.wallets.items[walletId].color || $store.state.ui.defaultBgColor")
.walletItem2__name {{ $store.state.wallets.items[walletId].name }}
- .walletItem2__drag.handle: .mdi.mdi-arrow-split-horizontal
+ .walletItem2__drag.handle.doNotCloseModal: .mdi.mdi-arrow-split-horizontal
template(slot="bottom")
.col
Button(
className="_small _blue _text-center"
:title="$lang.base.save"
- @onClick="saveWalletsOrder")
+ @onClick="saveWalletsOrder"
+ )
</template>
<style lang="stylus" scoped>
diff --git a/composables/useTouchClose.js b/composables/useTouchClose.js
index 139d97e0..741d5d65 100644
--- a/composables/useTouchClose.js
+++ b/composables/useTouchClose.js
@@ -12,7 +12,9 @@ export default function useOnTouch ({ container, overflow, dragger, content, onC
if (currentY.value === 0) {
dragger.value.style.transform = ''
- overflow.value.style.opacity = ''
+ if (overflow.value) {
+ overflow.value.style.opacity = ''
+ }
}
else if (currentY.value > 0) {
const containerHeight = container.value.clientHeight
@@ -34,6 +36,18 @@ export default function useOnTouch ({ container, overflow, dragger, content, onC
// wait until content scroll up to top
if (content.value && content.value.scrollTop > 0) { return }
+ if (event.target.closest('.doNotCloseModal')) {
+ this.isDragging = false
+ return
+ }
+
+ // wait
+ const waitForScrollSlider = content.value.querySelector('.swiper-slide-active .waitForScroll')
+ if (waitForScrollSlider && waitForScrollSlider.scrollTop > 0) { return }
+
+ const waitForScroll = content.value.querySelector('.waitForScroll')
+ if (waitForScroll && waitForScroll.scrollTop > 0) { return }
+
if (dragger.value) {
dragger.value.classList.remove('_anim')
@@ -94,16 +108,28 @@ export default function useOnTouch ({ container, overflow, dragger, content, onC
})
const resetPosition = () => {
- isDragging.value = false
- initialY.value = 0
- currentY.value = 0
- currentX.value = 0
- onClose && onClose()
+ onCloseModal()
+ }
- dragger.value.ontransitionend = () => {
- if (initialY.value === 0 && currentY.value === 0 && dragger.value.style.transform) {
+ const onCloseModal = () => {
+ isDragging.value = false
+ dragger.value.classList.add('_anim')
+ currentY.value = container.value.clientHeight
+ setTranslate()
+
+ if (onClose) {
+ setTimeout(() => {
+ onClose()
+ dragger.value.classList.remove('_anim')
+ initialY.value = 0
+ currentY.value = 0
+ currentX.value = 0
setTranslate()
- }
+ }, 300)
}
}
+
+ return {
+ onCloseModal
+ }
}
diff --git a/layouts/default.vue b/layouts/default.vue
index d351000d..12b0e2ab 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -27,9 +27,6 @@ export default {
},
async mounted () {
- this.$nextTick(() => {
- this.$store.commit('app/setAppStatus', 'ready')
- })
this.getPageDimensions()
window.addEventListener('resize', debounce(this.getPageDimensions, 600))
@@ -38,7 +35,11 @@ export default {
workbox.addEventListener('installed', (event) => {
// If we don't do this we'll be displaying the notification after the initial installation, which isn't perferred.
if (event.isUpdate) {
- console.log('whatever logic you want to use to notify the user that they need to refresh the page.')
+ this.$notify({
+ title: 'New version available',
+ text: 'Please reload the app'
+ })
+ console.log('whatever logic you want to use to notify the user that they need to refresh the page.2')
}
})
}
@@ -61,13 +62,10 @@ export default {
Loader
//- Continue to app
- transition(name="fadeInSlow")
+ transition(name="fadeInSlow" appear)
template(v-if="$store.state.app.status.ready")
Nuxt
- //- template(v-if="$store.state.app.status.ready")
- //- TrnForm
-
//- Notifications
Notifications(
:position="$store.state.ui.mobile ? 'top center' : 'top left'"
@@ -75,7 +73,11 @@ export default {
classes="notifications"
)
- PortalTarget(name="default")
+ //- Modals
+ PortalTarget(
+ multiple
+ name="modal"
+ )
LazyMetrica(v-if="isProduction")
</template>
diff --git a/locales/en-US.js b/locales/en-US.js
index 51431b9a..39b07774 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -15,5 +15,11 @@ export default {
filterWalletAndCategory: 'Wallet & Category',
filterWallet: 'Wallet only',
filterAll: 'Everything'
+ },
+
+ base: {
+ sure: 'Are you sure?',
+ yes: 'Yes',
+ no: 'No'
}
}
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index 7e781492..ac43408e 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -16,5 +16,11 @@ export default {
filterWalletAndCategory: 'Кошелек и Категория',
filterWallet: 'Только Кошелек',
filterAll: 'Все'
+ },
+
+ base: {
+ sure: 'Ты уверен?',
+ yes: 'Да',
+ no: 'Нет'
}
}
diff --git a/locales/ru.json b/locales/ru.json
index 9efe23d2..c3d02533 100644
--- a/locales/ru.json
+++ b/locales/ru.json
@@ -63,7 +63,7 @@
"lang": "Язык приложения",
"options": "Опции",
"open": "Открыть настройки",
- "customize": "Настроить внешний вид",
+ "customize": "Внешний вид",
"app": "Приложение",
"delete": "Удаление данных",
"demo": "Демо режим"
diff --git a/nuxt.config.js b/nuxt.config.js
index 8cd3a009..9ba4e9ff 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -31,7 +31,7 @@ export default {
silent: true,
performance: false,
productionTip: false,
- devtools: true
+ devtools: process.env.NODE_ENV !== 'production'
}
},
diff --git a/package-lock.json b/package-lock.json
index db904cba..1970a5b5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3052,9 +3052,9 @@
}
},
"@firebase/analytics": {
- "version": "0.5.0",
- "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.5.0.tgz",
- "integrity": "sha512-WyQ8BT6JSoXpg4q7SV9Yg5EPXbGbG8FkkXAIhV/AnslCglhpxegO1FU33qbuT4Grzc525hZJA97oqtQS8tm4Wg==",
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.6.0.tgz",
+ "integrity": "sha512-6qYEOPUVYrMhqvJ46Z5Uf1S4uULd6d7vGpMP5Qz+u8kIWuOQGcPdJKQap+Hla6Rq164or9gC2HRXuYXKlgWfpw==",
"requires": {
"@firebase/analytics-types": "0.4.0",
"@firebase/component": "0.1.19",
@@ -3138,9 +3138,9 @@
}
},
"@firebase/firestore": {
- "version": "1.17.0",
- "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.17.0.tgz",
- "integrity": "sha512-ZELQC7nC0Ueexxy/K9zk0lqFuGs7LatEK9Ybr2BwH6KbkvNUovToTiaRUhSOv5IDxjrEu2k6sY1xwnxE4qpqMA==",
+ "version": "1.17.3",
+ "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.17.3.tgz",
+ "integrity": "sha512-wRdrgeSBJ50eo63x8GnO8NgVNe3vBw2xhKhyMXl0JTWQIbxnlMjAHcz7b85VvsqPLI7U70PgWQnfQtJOXRCNUA==",
"requires": {
"@firebase/component": "0.1.19",
"@firebase/firestore-types": "1.13.0",
@@ -3159,14 +3159,14 @@
"integrity": "sha512-QF5CAuYOHE6Zbsn1uEg6wkl836iP+i6C0C/Zs3kF60eebxZvTWp8JSZk19Ar+jj4w+ye8/7H5olu5CqDNjWpEA=="
},
"@firebase/functions": {
- "version": "0.4.51",
- "resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.4.51.tgz",
- "integrity": "sha512-PPx8eZcr4eoU9BITOUGUVurs4WZu8Thj3uCWx766dU3mV1W/7kRgtiptmW0XJUB18FZ1PT3+Hadd6V6vjtLgYw==",
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.5.1.tgz",
+ "integrity": "sha512-yyjPZXXvzFPjkGRSqFVS5Hc2Y7Y48GyyMH+M3i7hLGe69r/59w6wzgXKqTiSYmyE1pxfjxU4a1YqBDHNkQkrYQ==",
"requires": {
"@firebase/component": "0.1.19",
"@firebase/functions-types": "0.3.17",
"@firebase/messaging-types": "0.5.0",
- "isomorphic-fetch": "2.2.1",
+ "node-fetch": "2.6.1",
"tslib": "^1.11.1"
}
},
@@ -3216,9 +3216,9 @@
"integrity": "sha512-QaaBswrU6umJYb/ZYvjR5JDSslCGOH6D9P136PhabFAHLTR4TWjsaACvbBXuvwrfCXu10DtcjMxqfhdNIB1Xfg=="
},
"@firebase/performance": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.4.1.tgz",
- "integrity": "sha512-eAqS3/456xnUwuTg4w58x2fYbvTtQpgt67lpBUX3DuhOqwiM8+JELRte52nDgum2lTaTZWiu5de9mPuAYx2WDg==",
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.4.2.tgz",
+ "integrity": "sha512-irHTCVWJ/sxJo0QHg+yQifBeVu8ZJPihiTqYzBUz/0AGc51YSt49FZwqSfknvCN2+OfHaazz/ARVBn87g7Ex8g==",
"requires": {
"@firebase/component": "0.1.19",
"@firebase/installations": "0.4.17",
@@ -3241,13 +3241,6 @@
"core-js": "3.6.5",
"promise-polyfill": "8.1.3",
"whatwg-fetch": "2.0.4"
- },
- "dependencies": {
- "whatwg-fetch": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
- "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng=="
- }
}
},
"@firebase/remote-config": {
@@ -3326,11 +3319,10 @@
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
},
"ansi-styles": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
- "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"requires": {
- "@types/color-name": "^1.1.1",
"color-convert": "^2.0.1"
}
},
@@ -6439,9 +6431,9 @@
"integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ=="
},
"bignumber.js": {
- "version": "9.0.0",
- "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
- "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz",
+ "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA=="
},
"binary-extensions": {
"version": "1.13.1",
@@ -8107,9 +8099,9 @@
}
},
"decimal.js": {
- "version": "10.2.0",
- "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.0.tgz",
- "integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw=="
+ "version": "10.2.1",
+ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz",
+ "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw=="
},
"decode-uri-component": {
"version": "0.2.0",
@@ -8470,14 +8462,6 @@
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
- "encoding": {
- "version": "0.1.13",
- "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
- "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
- "requires": {
- "iconv-lite": "^0.6.2"
- }
- },
"end-of-stream": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
@@ -10057,20 +10041,20 @@
}
},
"firebase": {
- "version": "7.21.0",
- "resolved": "https://registry.npmjs.org/firebase/-/firebase-7.21.0.tgz",
- "integrity": "sha512-aERVRK3oxll+lzcDUzOFjww39G1h1dRlEdCqZEl5NL/3CC4GcVhX64At1RdDKcNoW/5jAtHaIvKFaNgC2B91EA==",
+ "version": "7.23.0",
+ "resolved": "https://registry.npmjs.org/firebase/-/firebase-7.23.0.tgz",
+ "integrity": "sha512-0b1zi0H8jT4KqyPabldzPhyKTeptw5E5a7KkjWW3MBMVV/LjbC6/NKhRR8sGQNbsbS2LnTvyEENWbqkZP2ZXtw==",
"requires": {
- "@firebase/analytics": "0.5.0",
+ "@firebase/analytics": "0.6.0",
"@firebase/app": "0.6.11",
"@firebase/app-types": "0.6.1",
"@firebase/auth": "0.14.9",
"@firebase/database": "0.6.13",
- "@firebase/firestore": "1.17.0",
- "@firebase/functions": "0.4.51",
+ "@firebase/firestore": "1.17.3",
+ "@firebase/functions": "0.5.1",
"@firebase/installations": "0.4.17",
"@firebase/messaging": "0.7.1",
- "@firebase/performance": "0.4.1",
+ "@firebase/performance": "0.4.2",
"@firebase/polyfill": "0.3.36",
"@firebase/remote-config": "0.1.28",
"@firebase/storage": "0.3.43",
@@ -10515,9 +10499,9 @@
}
},
"google-auth-library": {
- "version": "6.0.6",
- "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.0.6.tgz",
- "integrity": "sha512-fWYdRdg55HSJoRq9k568jJA1lrhg9i2xgfhVIMJbskUmbDpJGHsbv9l41DGhCDXM21F9Kn4kUwdysgxSYBYJUw==",
+ "version": "6.1.1",
+ "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-6.1.1.tgz",
+ "integrity": "sha512-0WfExOx3FrLYnY88RICQxvpaNzdwjz44OsHqHkIoAJfjY6Jck6CZRl1ASWadk+wbJ0LhkQ8rNY4zZebKml4Ghg==",
"requires": {
"arrify": "^2.0.0",
"base64-js": "^1.3.0",
@@ -10525,7 +10509,7 @@
"fast-text-encoding": "^1.0.0",
"gaxios": "^3.0.0",
"gcp-metadata": "^4.1.0",
- "gtoken": "^5.0.0",
+ "gtoken": "^5.0.4",
"jws": "^4.0.0",
"lru-cache": "^6.0.0"
}
@@ -10550,12 +10534,12 @@
"dev": true
},
"gtoken": {
- "version": "5.0.3",
- "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.0.3.tgz",
- "integrity": "sha512-Nyd1wZCMRc2dj/mAD0LlfQLcAO06uKdpKJXvK85SGrF5+5+Bpfil9u/2aw35ltvEHjvl0h5FMKN5knEU+9JrOg==",
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-5.0.4.tgz",
+ "integrity": "sha512-U9wnSp4GZ7ov6zRdPuRHG4TuqEWqRRgT1gfXGNArhzBUn9byrPeH8uTmBWU/ZiWJJvTEmkjhDIC3mqHWdVi3xQ==",
"requires": {
"gaxios": "^3.0.0",
- "google-p12-pem": "^3.0.0",
+ "google-p12-pem": "^3.0.3",
"jws": "^4.0.0",
"mime": "^2.2.0"
}
@@ -10888,6 +10872,11 @@
"resolved": "https://registry.npmjs.org/highcharts/-/highcharts-8.2.0.tgz",
"integrity": "sha512-s3R7UEaMWUDJNxFfdjuiOtI8rnSvhEZUNN4TA7LiDRc9Tw7DUKvTv5WXSTYzxojokLbybwwlf9t3jg/meAUTnQ=="
},
+ "highcharts-border-radius": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/highcharts-border-radius/-/highcharts-border-radius-0.0.2.tgz",
+ "integrity": "sha512-lN9vxrzOx8AFwX3ZmR8lNy/TV68hNz2zZ5HatCFUGVofP7nzxw+rwIh1aYDLVzp5Oprwkw2CBAcARitfDhtCVg=="
+ },
"highcharts-vue": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/highcharts-vue/-/highcharts-vue-1.3.5.tgz",
@@ -11128,14 +11117,6 @@
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz",
"integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw=="
},
- "iconv-lite": {
- "version": "0.6.2",
- "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.2.tgz",
- "integrity": "sha512-2y91h5OpQlolefMPmUlivelittSWy0rP+oYVpn6A7GwVHNE8AWzoYOBNmlwks3LobaJxgHCYZAnyNo2GgpNRNQ==",
- "requires": {
- "safer-buffer": ">= 2.1.2 < 3.0.0"
- }
- },
"icss-utils": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-4.1.1.tgz",
@@ -11781,31 +11762,6 @@
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8="
},
- "isomorphic-fetch": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz",
- "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=",
- "requires": {
- "node-fetch": "^1.0.1",
- "whatwg-fetch": ">=0.10.0"
- },
- "dependencies": {
- "is-stream": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
- "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
- },
- "node-fetch": {
- "version": "1.7.3",
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz",
- "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==",
- "requires": {
- "encoding": "^0.1.11",
- "is-stream": "^1.0.1"
- }
- }
- }
- },
"javascript-natural-sort": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
@@ -12559,12 +12515,12 @@
}
},
"mathjs": {
- "version": "7.2.0",
- "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-7.2.0.tgz",
- "integrity": "sha512-9UBMWBB94eyrxX8gskBzkVJZBEig2BUL8CBglQoRW4X/ljdW6hBVm8sT6Jp1MhyEp+2flKJo81qwml6twScxFw==",
+ "version": "7.5.0",
+ "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-7.5.0.tgz",
+ "integrity": "sha512-fSl/f4XmXSkc217jaExXBbl1qG792yH9X9d03jfJTMijPvA/C0slTymCCeOcLkKXOSzd0L5l60iY5kwTMExjMA==",
"requires": {
"complex.js": "^2.0.11",
- "decimal.js": "^10.2.0",
+ "decimal.js": "^10.2.1",
"escape-latex": "^1.2.0",
"fraction.js": "^4.0.12",
"javascript-natural-sort": "^0.7.1",
@@ -15250,9 +15206,9 @@
},
"dependencies": {
"@types/node": {
- "version": "13.13.21",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.21.tgz",
- "integrity": "sha512-tlFWakSzBITITJSxHV4hg4KvrhR/7h3xbJdSFbYJBVzKubrASbnnIFuSgolUh7qKGo/ZeJPKUfbZ0WS6Jp14DQ=="
+ "version": "13.13.24",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.24.tgz",
+ "integrity": "sha512-ry1JlHIVcmQFNq5KWgdEo1NVu7qFDi+vQPknWWDCc05cekTLVr2y0FHAKXTfv4OLWw+GOzdVe8eFWPoYEdk05w=="
}
}
},
@@ -16777,13 +16733,13 @@
"dev": true
},
"style-loader": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-1.2.1.tgz",
- "integrity": "sha512-ByHSTQvHLkWE9Ir5+lGbVOXhxX10fbprhLvdg96wedFZb4NDekDPxVKv5Fwmio+QcMlkkNfuK+5W1peQ5CUhZg==",
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-1.3.0.tgz",
+ "integrity": "sha512-V7TCORko8rs9rIqkSrlMfkqA63DfoGBBJmK1kKGCcSi+BWb4cqz0SRsnp4l6rU5iwOEd0/2ePv68SV22VXon4Q==",
"dev": true,
"requires": {
"loader-utils": "^2.0.0",
- "schema-utils": "^2.6.6"
+ "schema-utils": "^2.7.0"
},
"dependencies": {
"loader-utils": {
@@ -19041,9 +18997,9 @@
"integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg=="
},
"whatwg-fetch": {
- "version": "3.4.1",
- "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.4.1.tgz",
- "integrity": "sha512-sofZVzE1wKwO+EYPbWfiwzaKovWiZXf4coEzjGP9b2GBVgQRLQUZ2QcuPpQExGDAW5GItpEm6Tl4OU5mywnAoQ=="
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
+ "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng=="
},
"when": {
"version": "3.6.4",
diff --git a/package.json b/package.json
index 0b0f957e..c4b47806 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "finapp",
- "version": "3.0.13",
+ "version": "3.1.3",
"scripts": {
"dev": "cross-env NUXT_HOST=0.0.0.0 nuxt",
"build": "nuxt build",
@@ -15,11 +15,12 @@
"axios": "^0.20.0",
"dayjs": "^1.8.36",
"fancy-log": "^1.3.3",
- "firebase": "^7.21.0",
+ "firebase": "^7.23.0",
"highcharts": "^8.2.0",
+ "highcharts-border-radius": "0.0.2",
"highcharts-vue": "^1.3.5",
"localforage": "^1.9.0",
- "mathjs": "^7.2.0",
+ "mathjs": "^7.5.0",
"nuxt": "^2.14.5",
"nuxt-composition-api": "^0.11.0",
"nuxt-i18n": "^6.15.1",
@@ -38,20 +39,20 @@
"@nuxtjs/pwa": "3.0.2",
"babel-eslint": "^10.1.0",
"cross-env": "^7.0.2",
- "eslint-plugin-nuxt": "^1.0.0",
"eslint": "^7.9.0",
+ "eslint-plugin-nuxt": "^1.0.0",
+ "gulp": "^4.0.2",
"gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.1",
- "gulp": "^4.0.2",
"node-notifier": "^8.0.0",
- "pug-plain-loader": "^1.0.0",
"pug": "^3.0.0",
- "style-loader": "^1.2.1",
+ "pug-plain-loader": "^1.0.0",
+ "style-loader": "^1.3.0",
+ "stylelint": "^13.7.1",
"stylelint-order": "^4.1.0",
"stylelint-plugin-stylus": "^0.9.0",
- "stylelint": "^13.7.1",
- "stylus-loader": "^3.0.2",
"stylus": "^0.54.8",
+ "stylus-loader": "^3.0.2",
"vinyl-ftp": "^0.6.1"
}
}
diff --git a/pages/stat.vue b/pages/stat.vue
new file mode 100644
index 00000000..405e0f84
--- /dev/null
+++ b/pages/stat.vue
@@ -0,0 +1,70 @@
+<script>
+export default {
+ name: 'StatPage',
+
+ data () {
+ return {
+ visibleContextMenu: false,
+
+ selectedPeriodAmount: {
+ label: '',
+ incomes: '',
+ expenses: ''
+ },
+
+ periods: [{
+ slug: 'day',
+ name: this.$lang.dates.day.simple
+ }, {
+ slug: 'week',
+ name: this.$lang.dates.week.simple
+ }, {
+ slug: 'month',
+ name: this.$lang.dates.month.simple
+ }, {
+ slug: 'year',
+ name: this.$lang.dates.year.simple
+ }]
+ }
+ },
+
+ computed: {
+ stat () {
+ return this.$store.getters['stat/statCurrentPeriod']
+ },
+
+ periodName () {
+ return this.$store.state.filter.period
+ }
+ },
+
+ mounted () {
+ },
+
+ methods: {
+ changePeriod (period) {
+ this.$store.dispatch('filter/setPeriod', period)
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+LayoutMobile2
+ template(#content)
+
+
+ template(#modals)
+ CategoryModal
+ CurrencyModal
+ TrnForm
+ TrnModal
+ WalletModal
+ CategoryStatModal
+</template>
+
+<style lang="stylus" scoped>
+@import "~assets/stylus/variables"
+
+
+</style>
diff --git a/store/app/actions.js b/store/app/actions.js
index 005ff2b8..71de1e11 100644
--- a/store/app/actions.js
+++ b/store/app/actions.js
@@ -19,7 +19,6 @@ export default {
if (rootState.user.user && rootState.user.user.uid && rootState.user.user.uid !== user.uid) {
dispatch('clearUserData')
}
- // commit('setAppStatus', 'loading')
dispatch('trns/initOfflineTrns', null, { root: true })
await dispatch('user/initUser', user, { root: true })
await dispatch('currencies/initCurrencies', null, { root: true })
@@ -75,16 +74,11 @@ export default {
this.app.context.redirect('/')
}
resolve()
- // console.log('resolve')
}
else {
- if (this.$router.currentRoute.name !== 'login') {
- // this.app.context.redirect('/login')
- }
- // commit('setAppStatus', 'ready')
resolve()
- // console.log('resolve')
}
+ commit('setAppStatus', 'ready')
},
async clearUserData ({ commit, dispatch }) {
@@ -94,6 +88,8 @@ export default {
await dispatch('categories/setCategories', null, { root: true })
await dispatch('wallets/setWallets', null, { root: true })
await dispatch('trns/setTrns', null, { root: true })
- commit('setAppStatus', 'ready')
+ setTimeout(() => {
+ commit('setAppStatus', 'ready')
+ }, 100)
}
}
diff --git a/store/categories/getters.js b/store/categories/getters.js
index a31c4961..cf8107de 100644
--- a/store/categories/getters.js
+++ b/store/categories/getters.js
@@ -82,7 +82,7 @@ export default {
if (lastCategoriesIds.length < 12) {
const categoryId = trns[trnId].categoryId
const category = state.items[categoryId]
- if (category && (category.showInLastUsed || category.showInLastUsed === undefined) && !category.showInQuickSelector) {
+ if (category && (category.showInLastUsed || category.showInLastUsed === undefined)) {
if (categoryId !== transferCategoryId) {
if (!lastCategoriesIds.includes(categoryId)) { lastCategoriesIds.push(categoryId) }
}
@@ -92,8 +92,8 @@ export default {
return lastCategoriesIds.sort((a, b) => {
if (state.items[a] && state.items[b]) {
- if (state.items[a].order < state.items[b].order) { return -1 }
- if (state.items[a].order > state.items[b].order) { return 1 }
+ if (state.items[a].name < state.items[b].name) { return -1 }
+ if (state.items[a].name > state.items[b].name) { return 1 }
return 0
}
})
@@ -106,8 +106,8 @@ export default {
return Object.keys(state.items)
.filter(key => state.items[key].showInQuickSelector)
.sort((a, b) => {
- if (state.items[a].order < state.items[b].order) { return -1 }
- if (state.items[a].order > state.items[b].order) { return 1 }
+ if (state.items[a].name < state.items[b].name) { return -1 }
+ if (state.items[a].name > state.items[b].name) { return 1 }
return 0
})
},
diff --git a/store/chart/actions.js b/store/chart/actions.js
index 5a8c8f1c..506cdefe 100644
--- a/store/chart/actions.js
+++ b/store/chart/actions.js
@@ -5,7 +5,11 @@ export default {
const localPeriods = await localforage.getItem('next.chart.periods')
let showedGroups, showedPeriods
+ if (!localPeriods) { return }
+
for (const periodName in localPeriods) {
+ if (!localPeriods[periodName] || localPeriods[periodName].showedGroups) { return }
+
Number.isInteger(localPeriods[periodName].showedGroups)
? showedGroups = localPeriods[periodName].showedGroups
: showedGroups = rootState.chart.periods[periodName].showedGroups
diff --git a/store/stat/index.js b/store/stat/index.js
index 238717fc..ccbe6232 100644
--- a/store/stat/index.js
+++ b/store/stat/index.js
@@ -3,7 +3,11 @@ import getters from './getters'
import mutations from './mutations'
const state = () => ({
- showedPeriods: 10
+ showedPeriods: 10,
+ categoryModal: {
+ id: null,
+ show: false
+ }
})
export default {
diff --git a/store/stat/mutations.js b/store/stat/mutations.js
index 0772f165..7148d8ba 100644
--- a/store/stat/mutations.js
+++ b/store/stat/mutations.js
@@ -2,5 +2,13 @@ export default {
setDiffPeriods (state, value) {
const number = parseInt(value) || 1
state.showedPeriods = number
+ },
+
+ setCategoryModalId (state, id) {
+ state.categoryModal.id = id
+ },
+
+ setCategoryModalShow (state, value) {
+ state.categoryModal.show = value
}
}
diff --git a/store/trns/actions.js b/store/trns/actions.js
index 372da285..354dea11 100644
--- a/store/trns/actions.js
+++ b/store/trns/actions.js
@@ -101,7 +101,6 @@ export default {
}
}
}
- // commit('app/setAppStatus', 'ready', { root: true })
dispatch('setTrns', items)
}, e => console.error(e))
},
diff --git a/store/ui/index.js b/store/ui/index.js
index 3bca7f36..0d88395b 100644
--- a/store/ui/index.js
+++ b/store/ui/index.js
@@ -8,7 +8,7 @@ const state = () => ({
mobile: false,
pc: false,
catsChart: 'visible',
- lastUsedCatsInTrnForm: 'hidden',
+ lastUsedCatsInTrnForm: 'visible',
statGraphsVisibility: 'visible',
statItems: 'visible',
statLastTrnsVisibility: 'hidden',
diff --git a/store/wallets/getters.js b/store/wallets/getters.js
index 6ab6d88a..eaf35729 100644
--- a/store/wallets/getters.js
+++ b/store/wallets/getters.js
@@ -60,7 +60,7 @@ export default {
return walletsTotal
},
- walletsSortedIds (state, getters, rootState, rootGetters) {
+ walletsSortedIds (state, getters) {
if (!getters.hasWallets) { return [] }
return Object.keys(state.items).sort((a, b) => {
if (parseInt(state.items[a].order) < parseInt(state.items[b].order)) { return -1 }
diff --git a/stylelint.config.js b/stylelint.config.js
index cfe645b6..ea5a8843 100644
--- a/stylelint.config.js
+++ b/stylelint.config.js
@@ -16,7 +16,7 @@ module.exports = {
'rule-empty-line-before': [
'always', {
except: ['first-nested'],
- ignore: ['after-comment']
+ ignore: ['after-comment', 'inside-block']
}],
'selector-attribute-brackets-space-inside': 'never',
'selector-attribute-operator-space-after': 'never',
@@ -26,7 +26,7 @@ module.exports = {
'stylus/at-rule-empty-line-before': [
'always', {
except: ['blockless-after-same-name-blockless'],
- ignore: ['after-comment']
+ ignore: ['after-comment', 'inside-block']
}],
'stylus/at-rule-no-unknown': true,
'stylus/declaration-colon': 'never',
@@ -36,7 +36,6 @@ module.exports = {
'stylus/selector-list-comma': 'never',
'stylus/selector-type-no-unknown': true,
'stylus/semicolon': 'never',
- 'stylus/single-line-comment-no-empty': true,
'stylus/single-line-comment': 'always',
'order/order': [
@@ -67,7 +66,15 @@ module.exports = {
'min-height',
'min-width',
'margin',
+ 'margin-top',
+ 'margin-right',
+ 'margin-bottom',
+ 'margin-left',
'padding',
+ 'padding-top',
+ 'padding-right',
+ 'padding-bottom',
+ 'padding-left',
'color',
'font-family',
'font-size',
diff --git a/useEvent/useEvent.js b/useEvent/useEvent.js
index 5c91900e..d3ed604c 100644
--- a/useEvent/useEvent.js
+++ b/useEvent/useEvent.js
@@ -1,9 +1,6 @@
import { onMounted, onUnmounted } from 'nuxt-composition-api'
export default function (el = window, name, handler) {
- console.log(el)
- console.log(name)
- console.log(handler)
const remove = () => el && el.removeEventListener(name, handler)
onMounted(() => el && el.addEventListener(name, handler))