Skip to content

Open source personal finance application

update 3.19.1

ilkome39c01d3f3329
diff --git a/store/ui/colors.js b/assets/js/colorsPopular.js
similarity index 68%
rename from store/ui/colors.js
rename to assets/js/colorsPopular.js
index 1a0595c9..4cc79206 100644
--- a/store/ui/colors.js
+++ b/assets/js/colorsPopular.js
@@ -1,6 +1,38 @@
-export default [
- '#ffebee',
- '#ffcdd2',
+export const popularColors = [
+ '#0288d1',
+ '#039be5',
+ '#03a9f4',
+ '#1976d2',
+ '#00bcd4',
+ '#c0ca33',
+ '#26a69a',
+ '#26c6da',
+ '#42a5f5',
+ '#4caf50',
+ '#4fc3f7',
+ '#5c6bc0',
+ '#689f38',
+ '#78909c',
+ '#8bc34a',
+ '#8d6e63',
+ '#9575cd',
+ '#a1887f',
+ '#ba68c8',
+ '#ce93d8',
+ '#d4e157',
+ '#d84315',
+ '#ec407a',
+ '#ef5350',
+ '#f06292',
+ '#f48fb1',
+ '#f57f17',
+ '#fb8c00',
+ '#fdd835',
+ '#ff8a65',
+ '#ffc107'
+]
+
+export const allColors = [
'#ef9a9a',
'#e57373',
'#ef5350',
@@ -9,8 +41,6 @@ export default [
'#d32f2f',
'#c62828',
'#b71c1c',
- '#fce4ec',
- '#f8bbd0',
'#f48fb1',
'#f06292',
'#ec407a',
@@ -19,8 +49,6 @@ export default [
'#c2185b',
'#ad1457',
'#880e4f',
- '#f3e5f5',
- '#e1bee7',
'#ce93d8',
'#ba68c8',
'#ab47bc',
@@ -28,9 +56,7 @@ export default [
'#8e24aa',
'#7b1fa2',
'#6a1b9a',
- '#4a148c',
- '#ede7f6',
- '#d1c4e9',
+ '',
'#b39ddb',
'#9575cd',
'#7e57c2',
@@ -38,19 +64,15 @@ export default [
'#5e35b1',
'#512da8',
'#4527a0',
- '#311b92',
- '#e8eaf6',
- '#c5cae9',
+ '',
'#9fa8da',
'#7986cb',
'#5c6bc0',
'#3f51b5',
'#3949ab',
'#303f9f',
- '#283593',
- '#1a237e',
- '#e3f2fd',
- '#bbdefb',
+ '',
+ '',
'#90caf9',
'#64b5f6',
'#42a5f5',
@@ -59,8 +81,6 @@ export default [
'#1976d2',
'#1565c0',
'#0d47a1',
- '#e1f5fe',
- '#b3e5fc',
'#81d4fa',
'#4fc3f7',
'#29b6f6',
@@ -69,8 +89,6 @@ export default [
'#0288d1',
'#0277bd',
'#01579b',
- '#e0f7fa',
- '#b2ebf2',
'#80deea',
'#4dd0e1',
'#26c6da',
@@ -79,8 +97,6 @@ export default [
'#0097a7',
'#00838f',
'#006064',
- '#e0f2f1',
- '#b2dfdb',
'#80cbc4',
'#4db6ac',
'#26a69a',
@@ -89,9 +105,6 @@ export default [
'#00796b',
'#00695c',
'#004d40',
- '#e8f5e9',
- '#c8e6c9',
- '#a5d6a7',
'#81c784',
'#66bb6a',
'#4caf50',
@@ -99,9 +112,7 @@ export default [
'#388e3c',
'#2e7d32',
'#1b5e20',
- '#f1f8e9',
- '#dcedc8',
- '#c5e1a5',
+ '',
'#aed581',
'#9ccc65',
'#8bc34a',
@@ -109,9 +120,7 @@ export default [
'#689f38',
'#558b2f',
'#33691e',
- '#f9fbe7',
- '#f0f4c3',
- '#e6ee9c',
+ '',
'#dce775',
'#d4e157',
'#cddc39',
@@ -119,18 +128,15 @@ export default [
'#afb42b',
'#9e9d24',
'#827717',
- '#fffde7',
- '#fff9c4',
- '#fff59d',
- '#fff176',
- '#ffee58',
+ '',
'#ffeb3b',
'#fdd835',
'#fbc02d',
'#f9a825',
'#f57f17',
- '#fff8e1',
- '#ffecb3',
+ '',
+ '',
+ '',
'#ffe082',
'#ffd54f',
'#ffca28',
@@ -139,8 +145,6 @@ export default [
'#ffa000',
'#ff8f00',
'#ff6f00',
- '#fff3e0',
- '#ffe0b2',
'#ffcc80',
'#ffb74d',
'#ffa726',
@@ -149,8 +153,6 @@ export default [
'#f57c00',
'#ef6c00',
'#e65100',
- '#fbe9e7',
- '#ffccbc',
'#ffab91',
'#ff8a65',
'#ff7043',
@@ -159,36 +161,26 @@ export default [
'#e64a19',
'#d84315',
'#bf360c',
- '#efebe9',
- '#d7ccc8',
'#bcaaa4',
'#a1887f',
'#8d6e63',
'#795548',
'#6d4c41',
'#5d4037',
- '#4e342e',
- '#3e2723',
- '#fafafa',
- '#f5f5f5',
- '#eeeeee',
- '#e0e0e0',
+ '',
+ '',
'#bdbdbd',
'#9e9e9e',
'#757575',
'#616161',
- '#424242',
- '#212121',
- '#eceff1',
- '#cfd8dc',
+ '',
+ '',
+ '',
+ '',
'#b0bec5',
'#90a4ae',
'#78909c',
'#607d8b',
'#546e7a',
- '#455a64',
- '#37474f',
- '#263238',
- '#ffffff',
- '#000000'
+ '#455a64'
]
diff --git a/assets/js/emo.js b/assets/js/emo.js
index 7a5f2d6d..2ecaf37b 100755
--- a/assets/js/emo.js
+++ b/assets/js/emo.js
@@ -1,6 +1,6 @@
const successEmo = ['🤟', '🤘', '🤙', '👌', '👍', '💪', '👏', '🤗', '🥰', '😍']
const errorEmo = ['🤷‍♀️', '🤦‍♀️', '🤔', '😲']
-const greetEmo = ['🤟', '🤘', '🤙', '✌️', '🖖', '🤗', '😘', '😜', '🤪']
+const updateEmo = ['🤟', '💃', '✨', '🔥', '💥', '🎉', '🤘', '🤙']
function random (icons) {
return icons[Math.floor(Math.random() * icons.length)]
@@ -9,6 +9,6 @@ function random (icons) {
export {
successEmo,
errorEmo,
- greetEmo,
+ updateEmo,
random
}
diff --git a/assets/stylus/common/inputText.styl b/assets/stylus/common/inputText.styl
index dc5cbd94..96753706 100644
--- a/assets/stylus/common/inputText.styl
+++ b/assets/stylus/common/inputText.styl
@@ -11,25 +11,16 @@ textarea
&__value
width 100% !important
- padding $m7
+ padding $m7 $m7
color var(--c-font-1)
- font-size 18px
+ font-size 14px
background transparent
- border 1px solid var(--c-bg-8)
+ border 1px solid var(--c-item-bd-main)
border-radius $m5
anim()
/.light-mode &
color var(--c-font-2)
- &:hover
- border 1px solid var(--c-bg-9)
- &:focus
- border-color var(--c-blue-1)
-
-
- +media-laptop()
- font-size 14px
-
&._color
width 100px
min-height 60px
@@ -38,10 +29,9 @@ textarea
opacity .6
padding-bottom $m5
color var(--c-font-3)
- font-size 10px
- font-weight 500
+ font-size 11px
+ font-weight 400
text-align left
- text-transform uppercase
.colors
display grid
diff --git a/assets/stylus/variables/colors-dark.styl b/assets/stylus/variables/colors-dark.styl
index 0cc4d7f4..d23e7854 100644
--- a/assets/stylus/variables/colors-dark.styl
+++ b/assets/stylus/variables/colors-dark.styl
@@ -43,9 +43,9 @@ html.dark-mode
--color-link-bg #1c1f24
--c-item-bg-main #1e1e1e
- --c-item-bd-main #3f3f3f
+ --c-item-bd-main #2c2c2c
--c-item-bg-hover #232323
- --c-item-bd-hover #3f3f3f
+ --c-item-bd-hover #232323 //#3f3f3f
--c-item-bg-active #232323
--c-item2-bg-hover #1c1c1c
diff --git a/components/amount/Amount.vue b/components/amount/Amount.vue
index aa6bcc21..6a7c0436 100644
--- a/components/amount/Amount.vue
+++ b/components/amount/Amount.vue
@@ -169,7 +169,6 @@ export default {
font-size 26px
~/._base &
- padding-top 10px
font-size 12px
~/._base._size_xl &
diff --git a/components/app/UpdateAppModal.vue b/components/app/UpdateAppModal.vue
index d50ded52..4e57577f 100644
--- a/components/app/UpdateAppModal.vue
+++ b/components/app/UpdateAppModal.vue
@@ -1,27 +1,57 @@
<script>
+import { computed } from '@nuxtjs/composition-api'
+import { updateEmo, random } from '~/assets/js/emo'
+
export default {
- name: 'AppUpdateAppModal'
+ name: 'AppUpdateAppModal',
+
+ setup () {
+ const emo = computed(() => random(updateEmo))
+ return {
+ emo
+ }
+ }
}
</script>
<template lang="pug">
-ModalBottom(
- @onClose="$emit('onClose')"
- @afterClose="$emit('afterClose')"
-)
- .ta_center
- //- template(slot="header")
- h3 {{ $t('app.update.title') }}
- p {{ $t('app.update.text') }}
-
- SharedButton(
- className="_blue2 _text-center"
- :title="$t('base.ok')"
- @onClick="$emit('onClose')"
- )
+TrnFormModal(@closed="$emit('onClose')")
+ template(#default="{ close }")
+ .scrollerBlock
+ .wrap
+ .emo {{ emo }}
+ .header {{ $t('app.update.title') }}
+ .text {{ $t('app.update.text') }}
+
+ SharedButton(
+ className="_blue2 _text-center _maxWidth"
+ :title="$t('base.ok')"
+ @onClick="$emit('onClose')"
+ )
</template>
<style lang="stylus" scoped>
-.ta_center
+@import '~assets/stylus/variables'
+
+.wrap
+ padding 0 $m7
text-align center
+
+.header
+ padding-bottom $m6
+ color var(--c-font-3)
+ font-size 22px
+ font-weight 700
+ fontFamilyNunito()
+
+ /.light-mode &
+ color var(--c-font-4)
+
+.text
+ padding-bottom $m9
+
+.emo
+ padding-top $m8
+ padding-bottom $m9
+ font-size 86px
</style>
diff --git a/components/categories/EditModal.vue b/components/categories/EditModal.vue
index 1e64b9ee..1e20f5f4 100644
--- a/components/categories/EditModal.vue
+++ b/components/categories/EditModal.vue
@@ -1,30 +1,67 @@
<script>
+import { ref, useContext, onMounted } from '@nuxtjs/composition-api'
import { saveData } from '~/services/firebaseHelpers'
import generateId from '~/utils/id'
-import colors from '~/assets/js/colors'
+import { popularColors, allColors } from '~/assets/js/colorsPopular'
+import { random } from '~/assets/js/emo'
import icons from '~/assets/js/icons'
-function random (icons) {
- return icons[Math.floor(Math.random() * icons.length)]
-}
-
export default {
+ setup () {
+ const { store } = useContext()
+
+ const showColors = ref(false)
+ const activeTab = ref('data')
+
+ const category = ref({
+ color: '',
+ icon: '',
+ name: null,
+ parentId: 0,
+ showInLastUsed: true,
+ showInQuickSelector: false,
+ showStat: true
+ })
+
+ function findCategoryWithThisColor (color) {
+ const categories = store.state.categories.items
+ if (categories) {
+ const categoryIdWithThisColor = store.getters['categories/categoriesRootIds']?.find(id => categories[id]?.color === color)
+ if (categoryIdWithThisColor)
+ return categories[categoryIdWithThisColor]?.icon
+ }
+ }
+
+ function onSelectColor (color) {
+ if (color)
+ category.value.color = color
+ }
+
+ const documentHeight = ref('100%')
+ onMounted(() => {
+ documentHeight.value = `${document.documentElement.clientHeight}px`
+ })
+
+ return {
+ activeTab,
+ category,
+ findCategoryWithThisColor,
+
+ onSelectColor,
+ showColors,
+
+ popularColors,
+ allColors,
+ documentHeight
+ }
+ },
+
data () {
return {
originalParentId: null,
showParents: false,
- showColors: false,
showIcons: false,
- applyChildColor: true,
- category: {
- color: '',
- icon: '',
- name: null,
- parentId: 0,
- showInLastUsed: true,
- showInQuickSelector: false,
- showStat: true
- }
+ applyChildColor: true
}
},
@@ -51,11 +88,11 @@ export default {
},
created () {
- this.colors = colors
+ this.colors = allColors
this.icons = icons
if (!this.$store.state.categories.editId) {
this.category.icon = random(random(icons))
- this.category.color = colors[Math.floor(Math.random() * colors.length)]
+ this.category.color = random(popularColors)
}
},
@@ -69,11 +106,6 @@ export default {
this.$store.dispatch('ui/setActiveTab', null)
},
- handleColorSelect (color) {
- this.category.color = color
- this.showColors = false
- },
-
handleIconSelect (icon) {
this.category.icon = icon
this.showIcons = false
@@ -128,6 +160,8 @@ export default {
saveData(`users/${uid}/categories/${this.category.parentId}`, {
...parenCategory,
+ showInLastUsed: false,
+ showInQuickSelector: false,
childIds
})
}
@@ -143,13 +177,8 @@ export default {
// update child categories colors
if (this.applyChildColor) {
- for (const childId of childIds) {
- const category = categories[childId]
- saveData(`users/${uid}/categories/${childId}`, {
- ...category,
- color: categoriesValues.color
- })
- }
+ for (const childId of childIds)
+ saveData(`users/${uid}/categories/${childId}/color`, categoriesValues.color)
}
close()
@@ -194,231 +223,451 @@ export default {
</script>
<template lang="pug">
-Portal(
- key="categoryFormModal"
- to="modal"
-)
- BaseBottomSheet(
- :show="true"
- :maxHeight="$store.state.ui.height"
- @closed="closed()"
- )
- template(#handler="{ close }")
- BaseBottomSheetClose(@onClick="close")
-
- template(#header)
- .header
- template(v-if="!categoryId") {{ $t('categories.createNewTitle') }}
- template(v-else) {{ $t('categories.editTitle') }}
-
- template(#default="{ close }")
- .content
- .form-line._text
- .inputText
- .inputText__label {{ $t('categories.form.name.label') }}
- input(
- type="text"
- :placeholder="$t('categories.form.name.placeholder')"
- v-model="category.name"
- ).inputText__value
-
- //- can not change root category if inside this category already has some categories
- template(v-if="$store.getters['categories/getChildCategoriesIds'](categoryId).length === 0 && $store.getters['categories/hasCategories']")
- .form__btns__i._full
- .form-line(@click="showParents = true")
- .inputModal._flex
- .inputModal__content
- template(v-if="category.parentId !== 0")
- .inputModal__icon
- div(
- :class="$store.state.categories.items[category.parentId].icon"
- :style="{ color: $store.state.categories.items[category.parentId].color }"
- )
- .inputModal__name {{ $store.state.categories.items[category.parentId].name }}
- template(v-else)
- .inputModal__icon: .mdi.mdi-folder-star
- .inputModal__name {{ $t('categories.form.parent.no') }}
- .inputModal__label {{ $t('categories.form.parent.label') }}
-
- .form__btns
- .form__btns__i
- .form-line(@click="showColors = true")
- .inputModal._flex
- .inputModal__value: .inputModal__color(:style="{ background: category.color }")
- .inputModal__label {{ $t('categories.form.color.label') }}
-
- .form__btns__i
- .form-line(@click="showIcons = true")
- .inputModal._flex
- .inputModal__icon: div(:class="category.icon", :style="{ color: category.color }")
- .inputModal__label {{ $t('categories.form.icon.label') }}
-
- template(v-if="$store.getters['categories/getChildCategoriesIds'](categoryId).length")
- .form-line._p0._clean
- SharedContextMenuItem(
- :checkboxValue="applyChildColor"
- :title="$t('categories.form.childColor')"
- showCheckbox
- @onClick="applyChildColor = !applyChildColor"
- )
-
- template(v-if="$store.getters['categories/getChildCategoriesIds'](categoryId).length === 0")
- SharedContextMenuItem(
- :checkboxValue="category.showInLastUsed"
- :title="$t('categories.form.lastUsed')"
- showCheckbox
- @onClick="category.showInLastUsed = !category.showInLastUsed"
- )
- SharedContextMenuItem(
- :checkboxValue="category.showInQuickSelector"
- :title="$t('categories.form.quickSelector')"
- showCheckbox
- @onClick="category.showInQuickSelector = !category.showInQuickSelector"
- )
-
- .col(style="padding-top: 16px; text-align: center")
- SharedButton(
- :class="['_text-center _blue2 _ml-big', { _inline: $store.state.ui.pc }]"
- :title="$t('categories.form.save')"
- @onClick="handleSubmit(close)"
- )
-
- //- colors
+div
Portal(
- v-if="showColors"
+ key="categoryFormModal"
to="modal"
)
- ModalBottom(
- :center="true"
- :title="$t('categories.form.color.placeholder')"
- @onClose="showColors = false"
+ BaseBottomSheet(
+ show
+ @closed="closed()"
)
- .inputText
- .inputText__colors
- .colors
- .colorItem(
- :class="{ _active: category.color === color }"
- :style="{ background: color }"
- v-for="color in colors"
- @click="handleColorSelect(color)"
+ template(#handler="{ close }")
+ BaseBottomSheetClose(@onClick="close")
+
+ template(#default="{ close }")
+ .content(:style="{ maxHeight: documentHeight }")
+ //- Header
+ .header
+ template(v-if="!categoryId") {{ $t('categories.createNewTitle') }}
+ template(v-else) {{ $t('categories.editTitle') }}
+
+ //-
+ //- Menu
+ //-
+ .menu
+ .menuItem(
+ :class="{ _active: activeTab === 'data' }"
+ @click="activeTab = 'data'"
+ ) {{ $t('categories.form.data.label') }}
+ .menuItem(
+ :class="{ _active: activeTab === 'colors' }"
+ @click="activeTab = 'colors'"
+ ) {{ $t('categories.form.color.label') }}
+ .menuItem(
+ :class="{ _active: activeTab === 'icons' }"
+ @click="activeTab = 'icons'"
+ ) {{ $t('categories.form.icons.label') }}
+
+ .preview(v-if="activeTab !== 'data'")
+ .previewIcon
+ Icon(
+ :icon="category.icon"
+ :background="category.color"
+ round
+ )
+ .categoryParentItem(style="width: 100%")
+ .categoryParentItem__icon
+ Icon(
+ :icon="category.icon"
+ :color="category.color"
+ )
+ .categoryParentItem__name {{ category.name || $t('categories.form.name.label') }}
+
+ //-
+ //- Content
+ //-
+ .scrollerBlock
+ //- Data
+ template(v-if="activeTab === 'data'")
+ .form
+ .inputText
+ .inputText__label {{ $t('categories.form.name.label') }}
+ input(
+ type="text"
+ :placeholder="$t('categories.form.name.placeholder')"
+ v-model="category.name"
+ ).inputText__value
+
+ //- can not change root category if inside this category already has some categories
+ div(
+ v-if="$store.getters['categories/getChildCategoriesIds'](categoryId).length === 0 && $store.getters['categories/hasCategories']"
+ style="paddingBottom: 8px"
+ )
+ .inputText__label {{ $t('categories.form.parent.label') }}
+
+ div(@click="showParents = true")
+ template(v-if="category.parentId !== 0")
+ CategoriesItemCategoryItem(
+ :category="$store.state.categories.items[category.parentId]"
+ :id="category.parentId"
+ )
+ template(v-else)
+ .categoryParentItem
+ .categoryParentItem__icon
+ Icon(icon="mdi mdi-folder-star")
+ .categoryParentItem__name {{ $t('categories.form.parent.no') }}
+
+ LazySharedContextMenuItem(
+ v-if="$store.getters['categories/getChildCategoriesIds'](categoryId).length"
+ :checkboxValue="applyChildColor"
+ :title="$t('categories.form.childColor')"
+ showCheckbox
+ @onClick="applyChildColor = !applyChildColor"
+ )
+ LazySharedContextMenuItem(
+ v-if="$store.getters['categories/getChildCategoriesIds'](categoryId).length === 0"
+ :checkboxValue="category.showInLastUsed"
+ :title="$t('categories.form.lastUsed')"
+ showCheckbox
+ @onClick="category.showInLastUsed = !category.showInLastUsed"
+ )
+ SharedContextMenuItem(
+ :checkboxValue="category.showInQuickSelector"
+ :title="$t('categories.form.quickSelector')"
+ showCheckbox
+ @onClick="category.showInQuickSelector = !category.showInQuickSelector"
+ )
+
+ //-
+ //- Colors
+ //-
+ template(v-if="activeTab === 'colors'")
+ .form
+ .subTitle {{ $t('popularColors') }}
+ .colors
+ .iconItem(
+ v-for="(color, idx) in popularColors"
+ :key="idx"
+ :class="{ _active: color === category.color }"
+ :style="{ background: color === category.color ? color : 'transparent' }"
+ @click="onSelectColor(color)"
+ )
+ template(v-if="color")
+ //- .colorPreview(:style="{ background: color }")
+ template(v-if="findCategoryWithThisColor(color)")
+ Icon(
+ :icon="findCategoryWithThisColor(color)"
+ :color="color === category.color ? null : color"
+ big
+ )
+ template(v-else-if="color === category.color")
+ Icon(
+ :icon="category.icon"
+ background="transparent"
+ big
+ )
+ template(v-else)
+ .colorPreview(:style="{ background: color }")
+ //- Icon(
+ //- :icon="category.icon"
+ //- :color="color"
+ //- big
+ //- )
+
+ .subTitle {{ $t('palette') }}
+ .colors
+ .iconItem(
+ v-for="(color, idx) in allColors"
+ :key="idx"
+ :class="{ _active: color === category.color, _empty: !color }"
+ :style="{ background: color === category.color ? color : 'transparent' }"
+ @click="onSelectColor(color)"
+ )
+
+ template(v-if="color")
+ template(v-if="findCategoryWithThisColor(color)")
+ Icon(
+ :icon="findCategoryWithThisColor(color)"
+ :color="color === category.color ? null : color"
+ big
+ )
+ template(v-else-if="color === category.color")
+ Icon(
+ :icon="category.icon"
+ background="transparent"
+ big
+ )
+ template(v-else)
+ .colorPreview(:style="{ background: color }")
+ //- Icon(
+ //- icon="mdi mdi-folder-star"
+ //- :color="color"
+ //- big
+ //- )
+
+ .subTitle {{ $t('categories.form.color.custom') }}
+ .customColor
+ input.customColor__value(v-model="category.color" type="color")
+
+ template(v-if="activeTab === 'icons'")
+ .form
+ .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)"
+ )
+ div(:class="icon")
+
+ //- Submit
+ .col(style="padding-top: 16px; text-align: center")
+ SharedButton(
+ :class="['_text-center _blue2 _ml-big', { _inline: $store.state.ui.pc }]"
+ :title="$t('categories.form.save')"
+ @onClick="handleSubmit(close)"
)
- .customColor
- .customColor__title {{ $t('categories.form.color.custom') }}
- input.customColor__value(v-model="category.color" type="color")
-
- //- parent
- Portal(
- v-if="showParents"
- to="modal"
- )
- ModalBottom(
- key="parent"
- :center="true"
- :title="$t('categories.form.parent.label')"
- @onClose="showParents = false"
- )
- .padding-bottom
- ModalButton(
- :name="$t('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
- Portal(
- v-if="showIcons"
- to="modal"
- )
- ModalBottom(
- :center="true"
- :title="$t('categories.form.icon.placeholder')"
- @onClose="showIcons = false"
+ //-
+ //- Parent Modal
+ //-
+ Portal(to="modal")
+ LazyBaseBottomSheet(
+ v-if="showParents"
+ @closed="showParents = false"
)
- .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)"
- )
- div(:class="icon")
+ template(#handler="{ close }")
+ BaseBottomSheetClose(@onClick="close")
+
+ template(#default="{ close }")
+ .content(:style="{ maxHeight: documentHeight }")
+ .scrollerBlock
+ .wrap
+ //- Header
+ .header {{ $t('categories.form.parent.label') }}
+
+ .padding-bottom
+ ModalButton(
+ :name="$t('categories.form.parent.no')"
+ icon="mdi mdi-folder-star"
+ @onClick="() => handleParenCategorySelect(0)")
+
+ CategoriesView(
+ :activeItemId="category.parentId"
+ :noPadding="true"
+ :ids="$store.getters['categories/categoriesForBeParent'].filter(cId => cId !== categoryId)"
+ @onClick="handleParenCategorySelect"
+ )
</template>
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
-.header
- padding $m8
- flex-grow 1
- fontFamilyNunito()
- color var(--c-font-2)
- font-size 28px
- font-weight 700
+.preview
+ display flex
+ align-items center
+ justify-content space-between
+ padding $m5 $m7
+ gap $m7
+
+.subTitle
+ padding 0 $m5
+ padding-bottom $m6
+ color var(--c-font-4)
+ font-size 13px
+ font-weight 500
+
+.categoryParentItem
+ overflow hidden
+ cursor pointer
+ position relative
+ display flex
+ flex-flow row nowrap
+ align-items center
+ justify-content center
+ min-height 48px
+ padding $m6
+ color var(--c-font-1)
+ background var(--c-item-bg-main)
+ border 1px solid transparent
+ border-radius $m5
+ anim()
+ +media-hover()
+ color var(--c-text-1)
+ background var(--c-item-bg-hover)
+ border 1px solid var(--c-item-bd-hover)
+
+ &__icon
+ padding-right $m6
+ +media(700px)
+ padding-right $m8
+
+ &__name
+ overflow hidden
+ display flex
+ flex-grow 1
+ text-overflow ellipsis
+ padding-right 0
+ font-size 14px
+
+.menu
+ overflow hidden
+ z-index 10
+ display flex
+ align-items center
+ justify-content space-between
+ max-width 480px
+ overflow-x auto
+ margin 0 auto
+ padding $m5 $m6
+
+ +media(600px)
+ overflow initial
+
+.menuItem
+ cursor pointer
+ display flex
+ align-items center
+ justify-content center
+ min-height 38px
+ min-width 70px
+ margin 0 $m5
+ padding $m6 $m7
+ color var(--c-font-4)
+ font-size 12px
+ font-weight 500
+ font-roboto()
text-align center
- background var(--c-bg-3)
- border-radius $m7 $m7 0 0
+ border-radius $m6
+ anim()
+
+ +media(400px)
+ min-width 80px
+ margin 0 $m5
+ padding-right $m7
+ padding-left $m7
+
+ +media(600px)
+ padding-right $m9
+ padding-left $m9
+
+ +media-hover()
+ &:not(._active)
+ cursor pointer
+ color var(--c-font-3)
+ background var(--c-item2-bg-hover)
+
+ &._active
+ cursor default
+ color var(--c-blue-1)
+ background var(--c-item-bg-active)
+
+.wrap
+ padding 0 $m8
+ padding-top $m6
+
+.button
+ button-base-1()
+
+.form
+ padding $m6
+
+ .inputText
+ margin-bottom 0
+ padding-bottom $m8
+
+ h2
+ padding-bottom $m6
+
+.scrollerBlock
+ overflow hidden
+ overflow-y auto
+ height 100%
+
+.colorPreview
+ display flex
+ align-items center
+ justify-content center
+ width 90%
+ height 90%
+ border-radius 50%
+
+.colors
+ display grid
+ grid-template-columns repeat(8, minmax(auto, 1fr))
+ padding-bottom $m8
+ &:last-child
+ padding-bottom 0
.icons
&__group
display grid
- grid-template-columns repeat(auto-fill, minmax(50px, 1fr))
- padding-bottom 20px
+ grid-template-columns repeat(auto-fill, minmax(40px, 1fr))
+ padding-bottom $m8
.iconItem
display flex
align-items center
justify-content center
- min-height 50px
- padding 8px
- font-size 30px
- border-radius 4px
+ width 40px
+ height 40px
+ max-width 40px
+ max-height 40px
+ padding 4px
+ font-size 24px
+ border-radius 50%
+media-hover()
- &:not(._active)
+ &:not(._empty)
cursor pointer
- background var(--c-item-bg-hover)
- border 1px solid var(--c-item-bd-hover)
+ background var(--c-item-bd-hover)
&._active
- background var(--c-item-bg-hover)
- border 1px solid var(--c-item-bd-hover)
+ padding 0
+ background var(--c-item-bd-hover)
-.customColor
- margin (- $m7)
- margin-top 0
+.header
+ position relative
+ display flex
+ align-items center
+ justify-content center
padding $m7
- background var(--c-bg-3)
+ padding-top 0
+ padding-bottom $m5
+ color var(--c-font-3)
+ font-size 18px
+ font-weight 700
+ letter-spacing 1px
+ fontFamilyNunito()
- @media $media-laptop
- margin (- $m9)
- margin-top 0
- padding $m9
+ /.light-mode &
+ color var(--c-font-4)
+
+.customColor
+ padding 0 $m4
+ background var(--c-bg-3)
&__title
padding-bottom $m6
color var(--c-font-4)
&__value
+ overflow hidden
+ display block
+ appearance none
width 100%
- height 40px
+ height 48px
margin 0
padding 0
+ background none
border 0
+ border-radius $borderRadiusMd
.padding-bottom
padding-bottom $m8
.content
- padding $m8
- background var(--c-bg-3)
+ overflow hidden
+ display grid
+ padding-top $m7
+ background var(--color-bg-canvas)
+ border-radius $m8 $m8 0 0
+
+media(600px)
- border-radius 0 0 $m7 $m7
+ border-radius 16px
.form__actions
@media $media-phone
diff --git a/components/categories/Form.vue b/components/categories/Form.vue
index 361b4c3e..0870173e 100644
--- a/components/categories/Form.vue
+++ b/components/categories/Form.vue
@@ -1,4 +1,5 @@
<script>
+import { ref, computed, watch, onMounted, useContext } from '@nuxtjs/composition-api'
import { saveData } from '~/services/firebaseHelpers'
import generateId from '~/utils/id'
import colors from '~/assets/js/colors'
@@ -279,15 +280,18 @@ export default {
)
//- colors
- Portal(
+ LazyBaseBottomSheet(
v-if="showColors"
- to="modal"
+ @closed="showColors = false"
)
- ModalBottom(
- :center="true"
- :title="$t('categories.form.color.placeholder')"
- @onClose="showColors = false"
- )
+ template(#handler="{ close }")
+ BaseBottomSheetClose(@onClick="close")
+
+ template(#header)
+ .header
+ .header__title {{ $t('colors') }}
+
+ template(#default="{ close }")
.inputText
.inputText__colors
.colors
@@ -348,6 +352,29 @@ export default {
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
+.handler
+ z-index 2
+ position absolute
+ top 0
+ left 0
+ display flex
+ align-items center
+ justify-content center
+ width 100%
+ height 16px
+
+ &:after
+ content ''
+ display block
+ width 32px
+ height 4px
+ background var(--c-bg-8)
+ border-radius 4px
+
+.content
+ +media(600px)
+ border-radius 0 0 $m7 $m7
+
.header
padding $m8
flex-grow 1
diff --git a/components/categories/item/CategoryItem.vue b/components/categories/item/CategoryItem.vue
index 93f42aa5..05dc0ea5 100644
--- a/components/categories/item/CategoryItem.vue
+++ b/components/categories/item/CategoryItem.vue
@@ -37,6 +37,7 @@ export default {
<template lang="pug">
.categoryItem(
+ v-if="category"
:class="{ [ui]: ui, _active: activeItemId === id }"
@click="onClickItem"
)
@@ -74,14 +75,13 @@ export default {
border 1px solid transparent
border-radius $m5
anim()
-
+media-hover()
color var(--c-text-1)
background var(--c-item-bg-hover)
border 1px solid var(--c-item-bd-hover)
-
- +media(700px)
- padding $m7 $m8
+ &._active
+ background var(--c-item-bg-hover)
+ border 1px solid var(--c-item-bd-hover)
&._flat
flex-flow row
diff --git a/components/categories/list/CategoriesView.vue b/components/categories/list/CategoriesView.vue
index dc46a722..38f69363 100644
--- a/components/categories/list/CategoriesView.vue
+++ b/components/categories/list/CategoriesView.vue
@@ -43,7 +43,4 @@ export default {
.categories._flat
overflow hidden
padding 0
-
- .categories__list
- // grid-template-columns repeat(3, 1fr)
</style>
diff --git a/components/categories/list/categories.styl b/components/categories/list/categories.styl
index b564253e..30ee24d8 100644
--- a/components/categories/list/categories.styl
+++ b/components/categories/list/categories.styl
@@ -39,6 +39,6 @@
&__desc
padding $m7
padding-bottom 0
- font-size 12px
color var(--c-font-4)
+ font-size 12px
text-align center
diff --git a/components/chart/Periods.vue b/components/chart/Periods.vue
index 8479aa7e..ad47a9d6 100644
--- a/components/chart/Periods.vue
+++ b/components/chart/Periods.vue
@@ -1,23 +1,17 @@
<script>
-import { ref, computed, useContext } from '@nuxtjs/composition-api'
-import useChart from '~/components/chart/useChart'
-import usePeriods from '~/components/periods/usePeriods'
+import { useContext } from '@nuxtjs/composition-api'
import useFilter from '~/modules/filter/useFilter'
-import useUIView from '~/components/layout/useUIView'
-import useStat from '~/modules/stat/useStat'
+import usePeriods from '~/components/periods/usePeriods'
export default {
name: 'ChartPeriods',
setup () {
const { store } = useContext()
- const { isEmptyStat } = useStat()
// Filter
const { filterPeriodNameAllReplacedToYear } = useFilter()
- // Chart
- const { isShowDataLabels, toogleChartsView } = useChart()
function saveChartsPeriodsToLocalStorage () {
store.dispatch('ui/saveUiView')
}
@@ -42,32 +36,13 @@ export default {
}
// Periods
- const periods = computed(() => store.state.chart.periods)
const { periodsNames } = usePeriods()
- const { ui, setUI } = useUIView()
- function toogleView (name) {
- setUI({ name, value: !ui[name] })
- }
-
- const visibleContextMenu = ref(false)
-
return {
- isEmptyStat,
- isShowDataLabels,
- toogleChartsView,
addPeriodOrGroup,
removePeriodOrGroup,
-
- periods,
- periodsNames,
-
filterPeriodNameAllReplacedToYear,
-
- ui,
- toogleView,
-
- visibleContextMenu
+ periodsNames
}
}
}
@@ -92,14 +67,6 @@ export default {
.periodItem(
@click="addPeriodOrGroup"
): .mdi.mdi-plus
-
- .periods__group(v-if="!isEmptyStat")
- .periodItem(@click="toogleChartsView")
- .mdi.mdi-chart-line(v-if="periods[filterPeriodNameAllReplacedToYear].grouped")
- .mdi.mdi-chart-bar(v-else)
-
- .periodItem(@click="isShowDataLabels = !isShowDataLabels")
- .mdi.mdi-subtitles-outline
</template>
<style lang="stylus" scoped>
@@ -108,7 +75,7 @@ export default {
.periods
position relative
display grid
- grid-template-columns auto 1fr auto auto
+ grid-template-columns 1fr auto
grid-column-gap $m5
align-items center
@@ -123,7 +90,7 @@ export default {
display flex
align-items center
justify-content center
- justify-self center
+ justify-self start
.periodItem
cursor pointer
diff --git a/components/chart/StatChartLines.vue b/components/chart/StatChartLines.vue
index 61290ec1..5147186c 100644
--- a/components/chart/StatChartLines.vue
+++ b/components/chart/StatChartLines.vue
@@ -28,11 +28,6 @@ export default {
default: true
},
- chartColor: {
- type: String,
- default: null
- },
-
categoryId: {
type: String,
default: null
@@ -188,20 +183,20 @@ export default {
visible: periodsTotalIncomes > 0 && this.isShowIncomes,
type: this.chartType,
name: this.$t('money.incomes'),
- color: this.chartColor || 'var(--c-incomes-1)',
+ color: 'var(--c-incomes-1)',
data: incomesData,
marker: {
- lineColor: this.categoryId ? this.$store.state.categories.items[this.categoryId].color : 'var(--c-incomes-1)'
+ lineColor: 'var(--c-incomes-1)'
}
}, {
zIndex: 2,
visible: periodsTotalExpenses > 0 && this.isShowExpenses,
type: this.chartType,
name: this.$t('money.expenses'),
- color: this.chartColor || 'var(--c-expenses-1)',
+ color: 'var(--c-expenses-1)',
data: expensesData,
marker: {
- lineColor: this.categoryId ? this.$store.state.categories.items[this.categoryId].color : 'var(--c-expenses-1)'
+ lineColor: 'var(--c-expenses-1)'
}
// Fake data to make good hover on bar chart
}, {
@@ -223,6 +218,9 @@ export default {
lineWidth: 0
}
}
+ },
+ dataLabels: {
+ enabled: false
}
}],
categories,
diff --git a/components/chart/Total.vue b/components/chart/Total.vue
index b8844d2a..44bbd6cd 100644
--- a/components/chart/Total.vue
+++ b/components/chart/Total.vue
@@ -39,7 +39,6 @@ export default {
.chart__content
LazyChartStatChartLines(
:categoryId="filter.categoryId"
- :chartColor="filter.categoryId && $store.state.categories.items[filter.categoryId].color"
:chartType="chartType"
:isShowExpenses="activeTabStat === 'expenses' || activeTabStat === 'details' || activeTabStat === 'history'"
:isShowIncomes="activeTabStat === 'incomes' || activeTabStat === 'details' || activeTabStat === 'history'"
diff --git a/components/filter/FilterItem.vue b/components/filter/FilterItem.vue
index 1abc5a9f..b6b2fd28 100644
--- a/components/filter/FilterItem.vue
+++ b/components/filter/FilterItem.vue
@@ -55,6 +55,7 @@ export default {
vertical="center"
)
.filterItem__name {{ wallet.name }}
+ .filterItem__close: .mdi.mdi-close
//- Category
template(v-if="!walletId")
@@ -64,6 +65,7 @@ export default {
:icon="icon"
)
.filterItem__name {{ name }}
+ .filterItem__close: .mdi.mdi-close
</template>
<style lang="stylus" scoped>
@@ -130,4 +132,12 @@ export default {
font-size 13px
text-align center
anim()
+
+ &__close
+ opacity .8
+ position absolute
+ top $m3
+ right $m3
+ color var(--c-font-5)
+ font-size 14px
</style>
diff --git a/components/layout/BottomMenu.vue b/components/layout/BottomMenu.vue
index b0b42fef..78c56785 100644
--- a/components/layout/BottomMenu.vue
+++ b/components/layout/BottomMenu.vue
@@ -55,6 +55,8 @@ export default {
function getClassName (tabName) {
if (route.value.name === tabName)
return true
+ else if (tabName === 'stat' && route.value.name === 'index')
+ return true
}
return {
diff --git a/components/modal/ModalButton.vue b/components/modal/ModalButton.vue
index 9dbd5ddb..cd3a629d 100644
--- a/components/modal/ModalButton.vue
+++ b/components/modal/ModalButton.vue
@@ -39,7 +39,6 @@ export default {
text-align center
border 1px solid transparent
border-radius $m6
- anim()
&._active
cursor default
diff --git a/components/shared/button/Button.vue b/components/shared/button/Button.vue
index da9f2ade..99e79dd9 100644
--- a/components/shared/button/Button.vue
+++ b/components/shared/button/Button.vue
@@ -229,6 +229,9 @@ export default {
+media-hover()
background var(--c-blue-1)
+ &._maxWidth
+ max-width 280px
+
&._size_lg
padding 16px
font-size 16px
diff --git a/components/stat/Dashboard.vue b/components/stat/Dashboard.vue
index 4c10c968..a051321e 100644
--- a/components/stat/Dashboard.vue
+++ b/components/stat/Dashboard.vue
@@ -1,10 +1,12 @@
<script lang="ts">
import dayjs from 'dayjs'
import { computed, useContext } from '@nuxtjs/composition-api'
-import useUIView from '~/components/layout/useUIView'
-import useStat from '~/modules/stat/useStat'
import getStat from '~/modules/stat/getStat'
+import useChart from '~/components/chart/useChart'
+import useFilter from '~/modules/filter/useFilter'
+import useStat from '~/modules/stat/useStat'
import useTrns from '~/modules/trns/useTrns'
+import useUIView from '~/components/layout/useUIView'
export default {
name: 'StatDashboard',
@@ -13,6 +15,10 @@ export default {
const { store, app: { $day } } = useContext()
const { getTrnsIds } = useTrns()
const { getStatBy } = getStat()
+ const { filterPeriodNameAllReplacedToYear } = useFilter()
+
+ // Chart
+ const { isShowDataLabels, toogleChartsView } = useChart()
const activeTabStat = computed(() => store.state.ui.activeTabStat)
const statCurrentPeriod = computed(() => store.getters['stat/statCurrentPeriod'])
@@ -120,6 +126,11 @@ export default {
}
return {
+ isShowDataLabels,
+ toogleChartsView,
+
+ filterPeriodNameAllReplacedToYear,
+
isShowChart,
activeTabStat,
@@ -150,81 +161,15 @@ export default {
<template lang="pug">
.pageWrapScroll
- .baseBox._date
+ .baseBox._date(v-if="activeTabStat !== 'history'")
StatPeriodArrows
StatPeriodSelector
//-
//- Chart graph
//-
- .baseBox._total
+ .baseBox._total(v-if="activeTabStat !== 'history'")
.baseBoxIn
- template(v-if="(activeTabStat === 'details' || activeTabStat === 'history') && $store.state.filter.period !== 'all'")
- div
- .baseBox__title {{ $t('money.total') }}
- .boxSummary2
- .boxSummary2__item
- Amount(
- :currency="$store.state.currencies.base"
- :type="(statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total) > 0 ? 1 : 0"
- :value="statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total"
- size="xl"
- vertical="left"
- )
- StatSummaryRowItemView(
- :type="(statAverage.incomes - statAverage.expenses) > 0 ? 1 : 0"
- :amount="statAverage.incomes - statAverage.expenses"
- :title="$t('money.averageTotal')"
- )
-
- template(v-if="activeTabStat === 'incomes' || activeTabStat === 'expenses'")
- .sumBox
- .baseBox__title {{ $t(`money.${activeTabStat}`) }}
- .boxSummary2(@click="onClickTitle()")
- .boxSummary2__item
- Amount(
- :currency="$store.state.currencies.base"
- :type="activeTabStat === 'incomes' ? 1 : 0"
- :value="statCurrentPeriod[activeTabStat].total"
- size="xl"
- vertical="left"
- )
- StatSummaryRowItemView(
- :type="activeTabStat === 'incomes' ? 1 : 0"
- :amount="statAverage[activeTabStat]"
- :title="$t(`money.average.${activeTabStat}`)"
- )
- StatSummaryRowItemView(
- v-if="statToday && statToday[activeTabStat].total !== 0 && $store.state.filter.period !== 'day'"
- :type="activeTabStat === 'incomes' ? 1 : 0"
- :amount="statToday[activeTabStat].total"
- :title="$t('dates.day.today')"
- )
-
- .total__custom(
- v-if="statCurrentPeriod[activeTabStat].total !== 0"
- style="padding-right: 12px"
- )
- .periodItem(
- :class="{ _active: ui.showPieChart }"
- @click="toogleView('showPieChart')"
- ): .mdi.mdi-chart-pie
-
- .periodItem(
- :class="{ _active: ui.showCatsVerticalChart }"
- @click="toogleView('showCatsVerticalChart')"
- ): .mdi.mdi-poll
-
- .periodItem(
- :class="{ _active: ui.showRoundCats }"
- @click="toogleView('showRoundCats')"
- ): .mdi.mdi-chart-bubble
-
- .periodItem(
- :class="{ _active: ui.showCatsHorizontalList }"
- @click="toogleView('showCatsHorizontalList')"
- ): .mdi.mdi-chart-timeline
-
//- Control
ChartPeriods
@@ -232,6 +177,78 @@ export default {
.baseBox._chart(v-if="ui.showMainChart && isShowChart")
LazyChartTotal(v-if="ui.showMainChart && isShowChart")
+ //- Controls
+ .statWiews(v-if="activeTabStat !== 'history'")
+ .periodItem(
+ :class="{ _active: ui.showPieChart }"
+ @click="toogleView('showPieChart')"
+ ): .mdi.mdi-chart-pie
+
+ .periodItem(
+ :class="{ _active: ui.showCatsVerticalChart }"
+ @click="toogleView('showCatsVerticalChart')"
+ ): .mdi.mdi-poll
+
+ .periodItem(
+ :class="{ _active: ui.showRoundCats }"
+ @click="toogleView('showRoundCats')"
+ ): .mdi.mdi-chart-bubble
+
+ .periodItem(
+ :class="{ _active: ui.showCatsHorizontalList }"
+ @click="toogleView('showCatsHorizontalList')"
+ ): .mdi.mdi-chart-timeline
+
+ template(v-if="!isEmptyStat")
+ .periodItem(@click="toogleChartsView")
+ .mdi.mdi-chart-line(v-if="periods[filterPeriodNameAllReplacedToYear].grouped")
+ .mdi.mdi-chart-bar(v-else)
+
+ .periodItem(@click="isShowDataLabels = !isShowDataLabels")
+ .mdi.mdi-subtitles-outline
+
+ //-
+ //-
+ //-
+ .totalSum(v-if="activeTabStat !== 'history'")
+ template(v-if="(activeTabStat === 'details' || activeTabStat === 'history') && $store.state.filter.period !== 'all'")
+ div
+ .baseBox__title {{ $t('money.total') }}
+ .boxSummary2
+ .boxSummary2__item
+ Amount(
+ :currency="$store.state.currencies.base"
+ :type="(statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total) > 0 ? 1 : 0"
+ :value="statCurrentPeriod.incomes.total - statCurrentPeriod.expenses.total"
+ size="xl"
+ vertical="left"
+ )
+ LazyStatSummaryRowItemView(
+ v-if="statAverage.incomes - statAverage.expenses !== 0"
+ :type="(statAverage.incomes - statAverage.expenses) > 0 ? 1 : 0"
+ :amount="statAverage.incomes - statAverage.expenses"
+ :title="$t('money.averageTotal')"
+ )
+
+ template(v-else-if="$store.state.filter.period !== 'all'")
+ div
+ .baseBox__title {{ $t('money.total') }}
+ .boxSummary2
+ .boxSummary2__item
+ Amount(
+ :currency="$store.state.currencies.base"
+ :type="activeTabStat === 'incomes' ? 1 : 0"
+ :value="statCurrentPeriod[activeTabStat].total"
+ size="xl"
+ vertical="left"
+ )
+ LazyStatSummaryRowItemView(
+ v-if="statAverage[activeTabStat] !== 0"
+ :type="activeTabStat === 'incomes' ? 1 : 0"
+ :amount="statAverage[activeTabStat]"
+ :title="$t('money.averageTotal')"
+ )
+
//-
//- Menu
//-
@@ -253,14 +270,14 @@ export default {
//-
//- Loop throw incomes / expenses
//-
- .statMoneyTypes
+ .statMoneyTypes(v-if="activeTabStat !== 'history'")
template(
v-for="item in moneyTypes"
v-if="activeTabStat === 'details' || (activeTabStat === 'incomes' && item.id === 'incomes') || (activeTabStat === 'expenses' && item.id === 'expenses')"
)
template(v-if="statCurrentPeriod[item.id].total > 0 || (statAverage && statAverage[item.id] !== 0) || $store.state.filter.period === 'all'")
.baseBox._noBdMedia._mw
- template(v-if="activeTabStat === 'details' && (statAverage.incomes !== 0 && statAverage.expenses !== 0)")
+ template(v-if="activeTabStat === 'details'")
.sumBox
.baseBox__title {{ $t(`money.${item.id}`) }}
.boxSummary2
@@ -274,40 +291,19 @@ export default {
vertical="left"
)
//- Average
- StatSummaryRowItemView(
+ LazyStatSummaryRowItemView(
+ v-if="statAverage[item.id] !== 0"
:type="item.type"
:amount="statAverage[item.id]"
:title="$t(`money.average.${item.id}`)"
)
//- Today
- StatSummaryRowItemView(
+ LazyStatSummaryRowItemView(
v-if="statToday && statToday[item.id].total !== 0"
:type="item.type"
:amount="statToday[item.id].total"
:title="$t('dates.day.today')"
- )
-
- //- Views
- .total__custom(v-if="statCurrentPeriod[item.id].total !== 0")
- .periodItem(
- :class="{ _active: ui.showPieChart }"
- @click="toogleView('showPieChart')"
- ): .mdi.mdi-chart-pie
-
- .periodItem(
- :class="{ _active: ui.showCatsVerticalChart }"
- @click="toogleView('showCatsVerticalChart')"
- ): .mdi.mdi-poll
-
- .periodItem(
- :class="{ _active: ui.showRoundCats }"
- @click="toogleView('showRoundCats')"
- ): .mdi.mdi-chart-bubble
-
- .periodItem(
- :class="{ _active: ui.showCatsHorizontalList }"
- @click="toogleView('showCatsHorizontalList')"
- ): .mdi.mdi-chart-timeline
+ )
.boxEmpty(v-if="statCurrentPeriod[item.id].categoriesIds.length === 0") {{ $t('stat.empty') }}
@@ -363,9 +359,9 @@ export default {
:type="item.type"
)
- template(v-if="(activeTabStat !== 'history' && statAverage && (statAverage.incomes === 0 || statAverage.expenses === 0)) || (activeTabStat === 'incomes' && statAverage.incomes !== 0 || activeTabStat === 'expenses' && statAverage.expenses !== 0)")
+ template(v-if="!isEmptyStat && (activeTabStat !== 'history' && statAverage && (statAverage.incomes === 0 || statAverage.expenses === 0)) || (activeTabStat === 'incomes' && statAverage.incomes !== 0 || activeTabStat === 'expenses' && statAverage.expenses !== 0)")
.baseBox._mw(v-if="$store.getters['trns/selectedTrnsIdsWithDate'].length > 0")
- .baseBox__title {{ $t('trns.history') }}
+ .baseBox__title {{ $t('trns.inPeriodTitle') }}
.baseBox__content
TrnsList3(
:incomes="activeTabStat === 'incomes'"
@@ -374,12 +370,18 @@ export default {
)
//- history
- .history(v-if="activeTabStat === 'history' || statAverage && (statAverage.incomes !== 0 && statAverage.expenses !== 0) && ui.showHistory && $store.getters['trns/selectedTrnsIdsWithDate'].length > 0 && (activeTabStat !== 'incomes' && activeTabStat !== 'expenses')")
- .baseBox__title(v-if="activeTabStat !== 'history'") {{ $t('trns.history') }}
+ .history(v-if="activeTabStat !== 'history' && statAverage && (statAverage.incomes !== 0 && statAverage.expenses !== 0) && ui.showHistory && $store.getters['trns/selectedTrnsIdsWithDate'].length > 0 && (activeTabStat !== 'incomes' && activeTabStat !== 'expenses')")
+ .baseBox__title(v-if="activeTabStat !== 'history'") {{ $t('trns.inPeriodTitle') }}
TrnsList(
:size="50"
:isShowFilter="activeTabStat === 'history'"
)
+
+ .history(v-if="activeTabStat === 'history'")
+ TrnsListHistory(
+ :size="50"
+ isShowFilter
+ )
</template>
<style lang="stylus">
@@ -427,12 +429,15 @@ export default {
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
-.total__custom
- position absolute
- top $m5
- right 0
+.totalSum
+ padding 0 $m6
+
+.statWiews
display flex
- margin-left (- $m6)
+ justify-content flex-end
+ margin-bottom (- $m5)
+ padding 0 $m6
+ padding-top $m4
.periodItem
padding $m5
@@ -581,6 +586,7 @@ export default {
padding-top 0
padding-right 0
padding-bottom 0
+ padding-left $m5
background none
border none
@@ -614,6 +620,8 @@ export default {
// ------------------------------------
.boxSummary2
+ overflow hidden
+ overflow-y auto
z-index 9
display flex
align-items center
diff --git a/components/stat/DashboardMenu.vue b/components/stat/DashboardMenu.vue
index 3e12d542..beb00660 100644
--- a/components/stat/DashboardMenu.vue
+++ b/components/stat/DashboardMenu.vue
@@ -55,7 +55,7 @@ export default {
max-width 480px
overflow-x auto
margin 0 auto
- padding $m7 $m6
+ padding $m5 $m6
padding-bottom 0
+media(600px)
@@ -67,7 +67,7 @@ export default {
align-items center
justify-content center
min-height 38px
- min-width 80px
+ min-width 70px
margin 0 $m5
padding $m6 $m6
color var(--c-font-4)
@@ -79,6 +79,8 @@ export default {
anim()
+media(400px)
+ min-width 80px
+ margin 0 $m5
padding-right $m7
padding-left $m7
diff --git a/components/stat/PeriodSelector.vue b/components/stat/PeriodSelector.vue
index 47fadaae..99b36a0a 100644
--- a/components/stat/PeriodSelector.vue
+++ b/components/stat/PeriodSelector.vue
@@ -19,7 +19,7 @@ export default {
}
const periodCounts = {
- items: [1, 3, 6, 12, 16, 24, 36, 48, 60],
+ items: [1, 3, 6, 7, 12, 14, 16, 24, 30, 36, 48, 60],
onSelect: (value) => {
store.commit('chart/setElementsToChart', {
period: filterPeriod.value,
@@ -59,6 +59,7 @@ export default {
.title {{ $t('dates.period') }}
.content
+ //- Periods
.modalLinks
ModalButton(
v-for="periodItem in periodsNames"
@@ -76,15 +77,15 @@ export default {
@onClick="onSelectPeriod('all')"
)
+ //- Counts
.title {{ $t('dates.count') }}
- .modalLinks
- ModalButton(
+ .counts
+ .countsItem(
v-for="periodCount in periodCounts.items"
:key="periodCount"
- :isActive="periodCount === $store.state.chart.periods[filterPeriodNameAllReplacedToYear].showedPeriods"
- :name="periodCount"
- @onClick="periodCounts.onSelect(periodCount)"
- )
+ :class="{ _active: periodCount === $store.state.chart.periods[filterPeriodNameAllReplacedToYear].showedPeriods }"
+ @click="periodCounts.onSelect(periodCount)"
+ ) {{ periodCount }}
.wrap
.button(
@@ -95,6 +96,38 @@ export default {
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
+.counts
+ display flex
+ flex-flow row wrap
+ justify-content center
+ gap $m7
+ padding $m6 $m9
+
+ &Item
+ cursor pointer
+ display flex
+ align-items center
+ justify-content center
+ width 48px
+ height 48px
+ padding $m8 $m7
+ font-secondary()
+ font-size 18px
+ text-align center
+ background #1c1c1c
+ border 1px solid transparent
+ border-radius 50%
+
+ +media-hover()
+ &:not(._active)
+ color var(--c-text-1)
+ background var(--c-item-bg-hover)
+ border-color var(--c-item-bd-hover)
+
+ &._active
+ background var(--c-item-bg-active)
+ border-color var(--c-item-bd-main)
+
.handler
z-index 2
position absolute
diff --git a/components/stat/StatItem.vue b/components/stat/StatItem.vue
index 3059afc4..36d06595 100644
--- a/components/stat/StatItem.vue
+++ b/components/stat/StatItem.vue
@@ -23,7 +23,7 @@ export default {
data () {
return {
- showInside: false
+ isShowInside: false
}
},
@@ -57,7 +57,7 @@ export default {
methods: {
toogleShowInside () {
- this.showInside = !this.showInside
+ this.isShowInside = !this.isShowInside
}
}
}
@@ -65,27 +65,27 @@ export default {
<template lang="pug">
.statItem(
- :class="{ _active: showInside }"
+ :class="{ _active: isShowInside }"
@click="toogleShowInside"
)
.statItem__content
.statItem__graph: .statItem__graph__in(:style="styles")
.statItem__icon(@click.stop="setCategoryFilter(categoryId)")
Icon(
- :background="showInside ? category.color : 'var(--c-item-stat-bg)'"
- :color="showInside ? 'var(--c-item-stat-icon)' : category.color"
+ :background="isShowInside ? category.color : 'var(--c-item-stat-bg)'"
+ :color="isShowInside ? 'var(--c-item-stat-icon)' : category.color"
:icon="category.icon"
round
)
- .statItem__name {{ category.name }}
+ .statItem__name {{ category.name }} {{ showChildCategories ? '...' : '' }}
.statItem__amount
Amount(
:currency="currency"
:value="total"
)
- template(v-if="showInside")
+ template(v-if="isShowInside")
.statItem__inside(@click.stop="")
template(v-if="showChildCategories")
StatItemChildCats(
@@ -129,20 +129,19 @@ export default {
position relative
padding $m5 $m5
border 1px solid transparent
- border-radius $borderRadiusLg
+ border-radius $borderRadiusMd
+media-hover()
&:not(._active)
z-index 2
- background var(--c-item2-bg-hover)
+ background var(--c-item-bg-hover)
&._active
- margin-top $m6
- margin-right (- $m4)
- margin-bottom $m6
- margin-left (- $m4)
- padding $m5
- border 1px solid var(--c-item2-bd-hover)
+ margin-bottom $m5
+ background var(--c-item2-bg-hover)
+
+ &:not(:first-child)
+ margin-top $m5
&__content
display grid
@@ -150,10 +149,9 @@ export default {
grid-template-rows repeat(2, minmax(10px, max-content))
grid-column-gap 20px
- ^[0]._active &
- padding $m5 $m5
-
&__inside
+ margin (- $m5)
+ margin-top $m3
padding 0
&__graph
diff --git a/components/stat/StatItemChildCatsItem.vue b/components/stat/StatItemChildCatsItem.vue
index 90d75dfc..e977d60b 100644
--- a/components/stat/StatItemChildCatsItem.vue
+++ b/components/stat/StatItemChildCatsItem.vue
@@ -47,14 +47,11 @@ export default {
@click="toogleShowInside(categoryId)"
)
.statItemChild__content
- .statItemChild__graph
- .statItemChild__graph__in(:style="styles")
-
.statItemChild__icon(@click.stop="setCategoryFilter(categoryId)")
Icon(
- :color="category.color"
+ :background="isShowInside ? category.color : 'var(--c-item-stat-bg)'"
+ :color="isShowInside ? 'var(--c-item-stat-icon)' : category.color"
:icon="category.icon"
- :background="isShowInside ? 'var(--c-bg-5)' : 'transparent'"
round
)
@@ -88,42 +85,35 @@ export default {
.trnItem._stat
padding-right $m5
padding-left $m6
+
+ &__icon
+ .icon
+ width 36px !important
+ height 36px !important
+ background var(--c-bg-4)
+
+ .icon__image
+ font-size 22px
</style>
<style lang="stylus" scoped>
@import '~assets/stylus/variables'
.statItemChild
+ cursor default
border 1px solid transparent
border-radius $borderRadiusMd
+media-hover()
&:not(._active)
- background var(--c-item2-bg-hover)
+ background var(--c-item-bg-hover)
&__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
margin 0
- padding $m6 $m5
-
- &__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
-
- ~/:hover &
- background var(--c-bg-7)
-
- &__in
- height 4px
- min-width 2px
+ padding $m5 $m5
&__name
overflow hidden
@@ -137,12 +127,17 @@ export default {
color var(--c-font-2)
&__icon
- display flex
- justify-content center
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
diff --git a/components/stat/StatItemRound.vue b/components/stat/StatItemRound.vue
index 7fa3a719..fe4357a7 100644
--- a/components/stat/StatItemRound.vue
+++ b/components/stat/StatItemRound.vue
@@ -40,11 +40,13 @@ export default {
})
})
+ const isCategoryHasChildren = computed(() => store.getters['categories/isCategoryHasChildren'](categoryId.value))
const filterPeriod = computed(() => store.state.filter.period)
const statCurrentPeriod = computed(() => store.getters['stat/statCurrentPeriod'])
// long press
const item = ref(document.createElement('div'))
+
onMounted(() => {
// Long press for delete
const element: HTMLElement = item.value
@@ -53,8 +55,6 @@ export default {
action: 'create'
})
- const isCategoryHasChildren = computed(() => store.getters['categories/isCategoryHasChildren'](categoryId.value))
-
if (isCategoryHasChildren.value) {
store.commit('trnForm/showTrnFormModal', 'categories')
store.commit('trnForm/showTrnFormModal', 'categoriesChild')
@@ -73,7 +73,8 @@ export default {
trnsIds,
filterPeriod,
statCurrentPeriod,
- item
+ item,
+ isCategoryHasChildren
}
}
}
@@ -81,6 +82,7 @@ export default {
<template lang="pug">
.statItemRound(
+ v-if="category"
:class="{ _prevStat: total === 0 }"
ref="item"
data-long-press-delay="300"
@@ -94,7 +96,7 @@ export default {
round
)
- .statItemRound__name {{ category.name }}
+ .statItemRound__name(:class="{ _isCategoryHasChildren: isCategoryHasChildren }") {{ category.name }}{{ isCategoryHasChildren ? '...' : '' }}
.statItemRound__amount
Amount(
:currency="currency"
@@ -153,6 +155,9 @@ export default {
color var(--c-font-2)
font-weight 500
+ &._isCategoryHasChildren
+ margin-right -8px
+
&__amount
align-self center
</style>
diff --git a/components/stat/chartOptions.js b/components/stat/chartOptions.js
index 1e03d352..6a514631 100644
--- a/components/stat/chartOptions.js
+++ b/components/stat/chartOptions.js
@@ -122,6 +122,7 @@ export default {
},
yAxis: {
+ opposite: false,
endOnTick: false,
cursor: 'pointer',
alternateGridColor: '',
diff --git a/components/trnForm/TrnForm.vue b/components/trnForm/TrnForm.vue
index 24d68408..4196ce86 100644
--- a/components/trnForm/TrnForm.vue
+++ b/components/trnForm/TrnForm.vue
@@ -94,7 +94,7 @@ export default {
*/
function onCategoryClick (categoryId) {
store.commit('trnForm/setTrnFormValues', { categoryId })
- sliderObj.value.slideTo(1, 300)
+ // sliderObj.value.slideTo(1, 300)
}
/**
@@ -102,7 +102,7 @@ export default {
*/
function onClickWallet (walletId) {
store.commit('trnForm/setTrnFormValues', { walletId })
- sliderObj.value.slideTo(1, 300)
+ // sliderObj.value.slideTo(1, 300)
}
/**
diff --git a/components/trnForm/TrnFormHeaderTransfer.vue b/components/trnForm/TrnFormHeaderTransfer.vue
index 50c2ccdf..ec5227c4 100644
--- a/components/trnForm/TrnFormHeaderTransfer.vue
+++ b/components/trnForm/TrnFormHeaderTransfer.vue
@@ -24,13 +24,13 @@ export default {
return this.$store.state.trnForm.values.walletFromId || this.$store.state.trnForm.values.walletId || this.$store.getters['wallets/walletsSortedIds'][0]
},
walletFrom () {
- return this.$store.state.wallets.items[this.walletFromId]
+ return this.$store.state.wallets.items && this.$store.state.wallets.items[this.walletFromId]
},
walletToId () {
return this.$store.state.trnForm.values.walletToId || this.$store.getters['wallets/walletsSortedIds'][1] || this.$store.state.trnForm.values.walletId
},
walletTo () {
- return this.$store.state.wallets.items[this.walletToId]
+ return this.$store.state.wallets.items && this.$store.state.wallets.items[this.walletToId]
}
}
}
diff --git a/components/trnForm/TrnFormModals.vue b/components/trnForm/TrnFormModals.vue
deleted file mode 100644
index 85b57c20..00000000
--- a/components/trnForm/TrnFormModals.vue
+++ /dev/null
@@ -1,19 +0,0 @@
-<script>
-import { defineComponent } from '@nuxtjs/composition-api'
-
-export default defineComponent({
- name: 'TrnFormModals'
-})
-</script>
-
-<template lang="pug">
-.modals
- TrnFormModalCats
- TrnFormModalCatsChild
- TrnFormModalCalendar
- TrnFormModalDescription
- TrnFormModalWallets
- TrnFormModalTransferFrom
- TrnFormModalTransferTo
- TrnFormModalTrn
-</template>
diff --git a/components/trnForm/modal/TrnFormModal.vue b/components/trnForm/modal/TrnFormModal.vue
index c775f45c..5f14ab47 100644
--- a/components/trnForm/modal/TrnFormModal.vue
+++ b/components/trnForm/modal/TrnFormModal.vue
@@ -17,7 +17,7 @@ export default defineComponent({
<template lang="pug">
Portal(to="modal")
BaseBottomSheet(
- :show="true"
+ show
@closed="$emit('closed')"
)
template(#handler="{ close }")
@@ -25,8 +25,11 @@ Portal(to="modal")
BaseBottomSheetClose(@onClick="close")
template(#default="{ close }")
- .content(:style="{ maxHeight: documentHeight }")
- .header
+ .content(
+ :class="{ _withHeader: $slots.header }"
+ :style="{ maxHeight: documentHeight }"
+ )
+ .header(v-if="$slots.header")
slot(name="header")
slot(name="default" :close="close")
@@ -57,7 +60,6 @@ Portal(to="modal")
.content
overflow hidden
display grid
- grid-template-rows minmax(min-content, auto) minmax(50px, min-content)
padding-top $m7
background var(--color-bg-canvas)
border-radius $m8 $m8 0 0
@@ -65,13 +67,17 @@ Portal(to="modal")
+media(600px)
border-radius 16px
+ &._withHeader
+ grid-template-rows minmax(min-content, auto) minmax(50px, min-content)
+
.header
position relative
display flex
align-items center
justify-content center
padding $m7
- padding-bottom $m7
+ padding-top $m4
+ padding-bottom $m8
color var(--c-font-3)
font-size 22px
font-weight 700
diff --git a/components/trnForm/modal/TrnFormModalCalendar.vue b/components/trnForm/modal/TrnFormModalCalendar.vue
index 8a496c02..64f7cfc0 100644
--- a/components/trnForm/modal/TrnFormModalCalendar.vue
+++ b/components/trnForm/modal/TrnFormModalCalendar.vue
@@ -106,19 +106,17 @@ TrnFormModal(@closed="afterClose")
.prev
.next
+ width 48px
+ height 48px
+ min-width 48px
margin 0
- padding $m6 $m9
- background none
- border 1px solid var(--c-bg-5)
- border-radius 3px
+ background var(--c-item-bg-main)
+ border-radius 50%
anim()
&.disabled
opacity 0
- &:hover
- background none
-
.prev:after
border-right 10px solid var(--c-bg-9)
@@ -153,7 +151,7 @@ TrnFormModal(@closed="afterClose")
position relative
padding-top $m2
text-align center
- border-radius $m5
+ border-radius 24px
.today
color var(--c-font-1)
@@ -162,7 +160,11 @@ TrnFormModal(@closed="afterClose")
.disabled
color var(--c-font-4)
- .selected
+ .cell.selected
color var(--c-font-1)
background var(--c-blue-1)
+
+ .cell.month
+ .cell.year
+ border-radius $m5
</style>
diff --git a/components/trnForm/modal/TrnFormModalWallets.vue b/components/trnForm/modal/TrnFormModalWallets.vue
index e011731b..46bc50c0 100644
--- a/components/trnForm/modal/TrnFormModalWallets.vue
+++ b/components/trnForm/modal/TrnFormModalWallets.vue
@@ -22,9 +22,7 @@ TrnFormModal(@closed="afterClose")
.trnFormWalletsList.scrollerBlock
WalletsList3(
:activeItemId="$store.state.trnForm.values.walletId"
- :limit="6"
:showBase="false"
- showToogle
ui="widget"
@onClick="walletId => handleSetWallet(walletId, close)"
)
diff --git a/components/trns/list/TrnsList.vue b/components/trns/list/TrnsList.vue
index 22f7a777..65ab0a0e 100644
--- a/components/trns/list/TrnsList.vue
+++ b/components/trns/list/TrnsList.vue
@@ -144,7 +144,6 @@ export default {
.filter
display flex
- justify-content flex-end
padding-bottom $m6
.button
diff --git a/components/trns/list/TrnsListHistory.vue b/components/trns/list/TrnsListHistory.vue
new file mode 100644
index 00000000..2e9bd586
--- /dev/null
+++ b/components/trns/list/TrnsListHistory.vue
@@ -0,0 +1,190 @@
+<script>
+export default {
+ name: 'TrnsList',
+
+ props: {
+ isShowFilter: { type: Boolean, default: false },
+ limit: { type: Number, default: 0 },
+ size: { type: Number, required: false, default: 30 }
+ },
+
+ data () {
+ return {
+ pageNumber: 1,
+ sortByEditDate: false,
+ isShowTrnsWithDesc: false
+ }
+ },
+
+ computed: {
+ trnsIds () {
+ return this.$store.getters['trns/selectedTrnsIds']
+ },
+
+ isShowedAllTrns () {
+ return this.paginatedTrnsIds.length === this.trnsIdsWithLimit.length
+ },
+
+ isTrnsWithDescription () {
+ const trns = this.$store.state.trns.items
+ return this.trnsIds.filter(id => trns[id].description).length > 0
+ },
+
+ trnsIdsWithLimit () {
+ const trns = this.$store.state.trns.items
+
+ if (this.isShowFilter && this.isShowTrnsWithDesc && this.isTrnsWithDescription)
+ return this.trnsIds.filter(id => trns[id].description)
+
+ if (this.limit > 0)
+ return this.trnsIds.slice(0, this.limit)
+
+ return this.trnsIds
+ },
+
+ paginatedTrnsIds () {
+ const end = this.pageNumber * this.size
+ return this.trnsIdsWithLimit.slice(0, end)
+ },
+
+ groupedTrns () {
+ const trns = this.$store.state.trns.items
+ const trnsList = {}
+
+ for (const trnId of this.paginatedTrnsIds) {
+ let dayDate
+ this.sortByEditDate
+ ? dayDate = this.$day(trns[trnId].edited).startOf('day').valueOf()
+ : dayDate = this.$day(trns[trnId].date).startOf('day').valueOf()
+
+ !trnsList[dayDate]
+ ? trnsList[dayDate] = [trnId]
+ : trnsList[dayDate].push(trnId)
+ }
+
+ return trnsList
+ }
+ },
+
+ methods: {
+ showMoreTrns () {
+ this.pageNumber = this.pageNumber + 1
+ },
+
+ showTrnsWithDesc () {
+ this.isShowTrnsWithDesc = !this.isShowTrnsWithDesc
+ }
+ }
+}
+</script>
+
+<template lang="pug">
+.trnsList
+ template(v-if="isShowFilter && isTrnsWithDescription")
+ .filter
+ SharedContextMenuItem(
+ :checkboxValue="isShowTrnsWithDesc"
+ :grow="false"
+ :title="$t('trns.filter.showTrnsWithDesc')"
+ icon="mdi mdi-comment-text-outline"
+ showCheckbox
+ @onClick="isShowTrnsWithDesc = !isShowTrnsWithDesc"
+ )
+
+ .trnsList__content
+ template(v-if="trnsIds.length > 0")
+ .trnsList__grid
+ .trnsList__day(v-for="(trnsIds, date) in groupedTrns")
+ .trnsList__header: TrnsListDate(:date="date")
+ .trnsList__trns
+ TrnsItemTrnItem(
+ 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(@click="showMoreTrns") {{ $t('trns.more') }}
+</template>
+
+<style lang="stylus" scoped>
+@import '~assets/stylus/variables'
+
+.filter
+ display flex
+ padding-bottom $m6
+
+.button
+ button-base-1()
+ margin-top $m7
+
+.trnsList
+ max-width 400px
+ padding-bottom 8px
+
+ &:last-child
+ padding-bottom 0
+
+ +media(600px)
+ max-width 100%
+ padding 0
+
+ &__grid
+ display grid
+ grid-template-rows 1fr
+ grid-template-columns 1fr
+ grid-column-gap 8px
+ grid-row-gap 8px
+ padding 8px
+ padding-bottom 0
+
+ +media(600px)
+ grid-column-gap 20px
+ grid-row-gap 20px
+ grid-template-columns repeat(auto-fill, minmax(260px, 1fr))
+ padding 0
+
+ &__day
+ overflow hidden
+ margin-bottom 16px
+ padding-bottom 16px
+
+ +media(600px)
+ margin 0
+ padding 16px 0px
+ background var(--c-bg-4)
+ border-bottom 1px solid var(--c-bg-2)
+ border-radius 12px
+
+ &:first-child
+ margin-top $m9
+ border-top 0
+
+ +media(600px)
+ margin 0
+
+ &__header
+ display flex
+ align-items center
+ justify-content space-between
+ padding 0 12px
+ padding-bottom 12px
+
+ &__pages
+ padding 16px 8px
+
+ +media(600px)
+ padding 0
+ padding-top 20px
+
+ &__sort
+ padding 0
+ padding-bottom $m8
+
+ +media-laptop('less')
+ padding $m7
+ padding-bottom $m6
+</style>
diff --git a/components/wallets/form/WalletForm.vue b/components/wallets/form/WalletForm.vue
index 9ff75e63..80b120a9 100644
--- a/components/wallets/form/WalletForm.vue
+++ b/components/wallets/form/WalletForm.vue
@@ -8,11 +8,12 @@ export default {
showColors: false,
showCurrencies: false,
wallet: {
- name: null,
- order: 1,
+ color: this.$store.state.ui.defaultBgColor,
countTotal: true,
currency: 'RUB',
- color: this.$store.state.ui.defaultBgColor
+ isCredit: false,
+ name: null,
+ order: Object.keys(this.$store.state.wallets.items).length || 1
}
}
},
@@ -65,6 +66,7 @@ export default {
color: this.wallet.color,
countTotal: this.wallet.countTotal,
currency: this.wallet.currency,
+ isCredit: this.wallet.isCredit,
name: this.wallet.name,
order: this.wallet.order
}
@@ -140,7 +142,7 @@ LayoutBaseWrap
v-model="wallet.name"
).inputText__value
- .form__btns
+ .form__btns(style="paddingBottom: 8px")
.form__btns__i
.form-line(@click="showCurrencies = true")
.inputModal._flex
@@ -154,13 +156,19 @@ LayoutBaseWrap
.inputModal__value: .inputModal__color(:style="{ background: wallet.color }")
.inputModal__label {{ $t('wallets.form.color.label') }}
- .form-line._p0._clean
- SharedContextMenuItem(
- :checkboxValue="wallet.countTotal"
- :title="$t('wallets.form.total.placeholder')"
- showCheckbox
- @onClick="wallet.countTotal = !wallet.countTotal"
- )
+ SharedContextMenuItem(
+ :checkboxValue="wallet.countTotal"
+ :title="$t('wallets.form.total.placeholder')"
+ showCheckbox
+ @onClick="wallet.countTotal = !wallet.countTotal"
+ )
+
+ SharedContextMenuItem(
+ :checkboxValue="wallet.isCredit"
+ :title="$t('isCredit')"
+ showCheckbox
+ @onClick="wallet.isCredit = !wallet.isCredit"
+ )
//- colors
Portal(
@@ -310,3 +318,14 @@ LayoutBaseWrap
background var(--c-blue-1)
border none
</style>
+
+<i18n lang="json5">
+{
+ en: {
+ isCredit: 'Credit account'
+ },
+ ru: {
+ isCredit: 'Кредитный счёт'
+ }
+}
+</i18n>
diff --git a/components/wallets/list/WalletsList.vue b/components/wallets/list/WalletsList.vue
index e4a7a64b..335aee41 100644
--- a/components/wallets/list/WalletsList.vue
+++ b/components/wallets/list/WalletsList.vue
@@ -2,20 +2,9 @@
export default {
props: {
- ui: {
- type: String,
- default: null
- },
-
- limit: {
- type: [Number, Boolean],
- default: null
- },
-
- showToogle: {
- type: Boolean,
- default: false
- }
+ limit: { type: [Number, Boolean], default: null },
+ showToogle: { type: Boolean, default: false },
+ ui: { type: String, default: null }
},
data () {
@@ -35,7 +24,9 @@ export default {
walletsIds () {
const walletsIds = this.$store.getters['wallets/walletsSortedIds']
- if (this.stateLimit) { return walletsIds.slice(0, this.stateLimit) }
+ if (this.stateLimit)
+ return walletsIds.slice(0, this.stateLimit)
+
return walletsIds
}
},
@@ -46,12 +37,9 @@ export default {
methods: {
toogleWallets () {
- if (this.stateLimit > 0) {
- this.stateLimit = 0
- }
- else {
- this.stateLimit = this.limit
- }
+ this.stateLimit > 0
+ ? this.stateLimit = 0
+ : this.stateLimit = this.limit
}
}
}
diff --git a/components/wallets/total/WalletsTotal.vue b/components/wallets/total/WalletsTotal.vue
index a8edfac6..0c291d05 100644
--- a/components/wallets/total/WalletsTotal.vue
+++ b/components/wallets/total/WalletsTotal.vue
@@ -1,12 +1,18 @@
<script>
export default {
+ props: {
+ isShowCredits: { type: Boolean, default: false },
+ isShowTotal: { type: Boolean, default: false }
+ },
+
computed: {
totalInWallets () {
const walletsItems = this.$store.state.wallets.items
const walletsTotal = this.$store.getters['wallets/walletsTotal']
const total = {
counted: 0,
- other: 0
+ other: 0,
+ credits: 0
}
for (const walletId in walletsItems) {
@@ -21,9 +27,12 @@ export default {
})
}
- walletsItems[walletId].countTotal
- ? total.counted = total.counted + walletTotal
- : total.other = total.other + walletTotal
+ if (walletsItems[walletId].countTotal)
+ total.counted = total.counted + walletTotal
+ else if (walletsItems[walletId].isCredit)
+ total.credits = total.credits + walletTotal
+ else
+ total.other = total.other + walletTotal
}
return total
}
@@ -35,18 +44,31 @@ export default {
.walletsTotal(
v-if="$store.getters['wallets/hasWallets']"
)
+ //- Credits
+ .walletsTotal__item(v-if="isShowCredits && totalInWallets.credits !== 0")
+ .walletsTotal__title {{ $t('credits') }}
+ .walletsTotal__value
+ Amount(
+ :currency="$store.state.currencies.base"
+ :value="totalInWallets.credits"
+ size="lg"
+ vertical="center"
+ )
+
+ //- Savings
.walletsTotal__item(v-if="totalInWallets.other !== 0")
- .walletsTotal__title {{ $t('money.all') }}
+ .walletsTotal__title {{ $t('savings') }}
.walletsTotal__value
Amount(
:currency="$store.state.currencies.base"
- :value="totalInWallets.other + totalInWallets.counted"
+ :value="totalInWallets.other"
size="lg"
vertical="center"
)
+ //- Avaliable
.walletsTotal__item
- .walletsTotal__title {{ $t('money.wallets') }}
+ .walletsTotal__title {{ $t('avaliable') }}
.walletsTotal__value
Amount(
:currency="$store.state.currencies.base"
@@ -54,6 +76,17 @@ export default {
size="lg"
vertical="center"
)
+
+ //- Total
+ .walletsTotal__item(v-if="isShowTotal")
+ .walletsTotal__title {{ $t('total') }}
+ .walletsTotal__value
+ Amount(
+ :currency="$store.state.currencies.base"
+ :value="totalInWallets.counted + totalInWallets.other - Math.abs(totalInWallets.credits)"
+ size="lg"
+ vertical="center"
+ )
</template>
<style lang="stylus" scoped>
@@ -85,3 +118,20 @@ export default {
font-size 12px
text-align center
</style>
+
+<i18n lang="json5">
+{
+ en: {
+ avaliable: 'Avaliable',
+ credits: 'Credits',
+ savings: 'Savings',
+ total: 'Total'
+ },
+ ru: {
+ avaliable: 'Доступные',
+ credits: 'Кредиты',
+ savings: 'Вложения',
+ total: 'Всего'
+ }
+}
+</i18n>
diff --git a/layouts/default.vue b/layouts/default.vue
index 47f0f4a7..13235a63 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -148,8 +148,9 @@ export default {
//- notifications
Notifications(
- :position="$store.state.ui.mobile ? 'top center' : 'top left'"
- :width="$store.state.ui.mobile ? '94%' : '380px'"
+ :max="2"
+ :position="$store.state.ui.width < 600 ? 'top center' : 'top center'"
+ :width="$store.state.ui.width < 600 ? '94%' : '380px'"
classes="notifications"
)
diff --git a/locales/en-US.js b/locales/en-US.js
index 98322ece..c491ea57 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -172,7 +172,7 @@ export default {
error: 'Select currency'
},
total: {
- placeholder: 'Count amount in total balance'
+ placeholder: 'Сash withdrawal'
},
save: 'Save'
}
@@ -206,14 +206,14 @@ export default {
placeholder: 'Select parent category'
},
color: {
- label: 'Color',
- placeholder: 'Select color',
- error: 'Select color',
+ label: 'Colors',
custom: 'Custom color'
},
- icon: {
- label: 'Icon',
- placeholder: 'Select icon'
+ icons: {
+ label: 'Icons'
+ },
+ data: {
+ label: 'Data'
},
lastUsed: 'Show in last used categories',
quickSelector: 'Favorite category',
@@ -259,6 +259,7 @@ export default {
},
trns: {
+ inPeriodTitle: 'Transactions',
shortTitle: 'Trns',
history: 'History',
more: 'Show more',
@@ -328,5 +329,9 @@ export default {
users: {
title: 'Users'
- }
+ },
+
+ colors: 'Colors',
+ palette: 'Palette',
+ popularColors: 'Popular colors'
}
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index 23ab7528..0bd08348 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -174,7 +174,7 @@ export default {
error: 'Выберите валюту'
},
total: {
- placeholder: 'Считать в общем балансе'
+ placeholder: 'Деньги доступны для снятия'
},
save: 'Сохранить'
}
@@ -208,14 +208,14 @@ export default {
placeholder: 'Выберите категрию'
},
color: {
- label: 'Цвет',
- placeholder: 'Выберите цвет',
- error: 'Выберите цвет',
+ label: 'Цвета',
custom: 'Кастомный цвет'
},
- icon: {
- label: 'Иконка',
- placeholder: 'Выберите иконку'
+ icons: {
+ label: 'Иконки'
+ },
+ data: {
+ label: 'Данные'
},
lastUsed: 'Показывать в списке недавних категорий',
quickSelector: 'Любимая категория',
@@ -261,6 +261,7 @@ export default {
},
trns: {
+ inPeriodTitle: 'Транзакции',
shortTitle: 'Транзакции',
history: 'История',
more: 'Показать еще',
@@ -283,7 +284,7 @@ export default {
incomes: 'Средний доход',
expenses: 'Средний расход'
},
- averageTotal: 'Средний баланс',
+ averageTotal: 'Обычно',
also: 'Еще',
wallets: 'Кошельки',
all: 'Всего'
@@ -330,5 +331,29 @@ export default {
users: {
title: 'Пользователи'
+ },
+
+ colors: 'Цвета',
+ palette: 'Палитра',
+ popularColors: 'Популярные',
+
+ groups: {
+ id: 'groups',
+ title: 'Группы',
+ show: 'Показать группы',
+ form: {
+ title: 'Create new group',
+ name: 'Group name',
+ amount: 'Group amount',
+ button: 'Create'
+ },
+ trns: {
+ name: 'Group transactions'
+ },
+ stat: {
+ expenses: 'Рассход',
+ incomes: 'Доход',
+ total: 'Итого'
+ }
}
}
diff --git a/modules/stat/useStat.ts b/modules/stat/useStat.ts
index 05e6f556..9bb1fdfd 100644
--- a/modules/stat/useStat.ts
+++ b/modules/stat/useStat.ts
@@ -11,11 +11,14 @@ const moneyTypes = [{
export default function useStat () {
const { store } = useContext()
const isEmptyStat = computed(() => {
- const total = store.getters['stat/statAverage'].total === 0
- const incomes = store.getters['stat/statAverage'].incomes === 0
- const expenses = store.getters['stat/statAverage'].expenses === 0
+ const statCurrentPeriod = store.getters['stat/statCurrentPeriod']
- return total && incomes && expenses
+ if (store.state.ui.activeTabStat === 'details')
+ return statCurrentPeriod.total === 0
+ else if (store.state.ui.activeTabStat === 'incomes')
+ return statCurrentPeriod.incomes.total === 0
+ else if (store.state.ui.activeTabStat === 'expenses')
+ return statCurrentPeriod.expenses.total === 0
})
return {
diff --git a/nuxt.config.js b/nuxt.config.js
index b6f7b8c3..984c9c07 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -118,6 +118,7 @@ export default {
},
seo: false,
lazy: true,
+ vueI18nLoader: true,
langDir: 'locales/'
},
diff --git a/package.json b/package.json
index 1a6e84b6..7474c070 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "finapp",
- "version": "3.18.7",
+ "version": "3.19.1",
"scripts": {
"dev": "cross-env NUXT_HOST=0.0.0.0 nuxt",
"build": "nuxt build",
diff --git a/pages/wallets.vue b/pages/wallets.vue
index cbfba914..612b7170 100644
--- a/pages/wallets.vue
+++ b/pages/wallets.vue
@@ -23,11 +23,12 @@ LayoutBaseWrap(:contentPadding="false")
.header {{ $t('wallets.name') }}
div(style="padding: 0 0 16px 0")
- WalletsTotal
+ WalletsTotal(
+ isShowCredits
+ isShowTotal
+ )
WalletsList3(
- :limit="6"
- showToogle
@onClick="(id) => handleShowWalletsModalWalletModal(id)"
)
diff --git a/store/categories/actions.js b/store/categories/actions.js
index 00013e23..9cb77f01 100644
--- a/store/categories/actions.js
+++ b/store/categories/actions.js
@@ -15,6 +15,17 @@ export default {
}
}
+ for (const categoryId in items) {
+ const cat = items[categoryId]
+ if (cat.childIds) {
+ items[categoryId] = {
+ ...cat,
+ showInLastUsed: false,
+ showInQuickSelector: false
+ }
+ }
+ }
+
dispatch('setCategories', items)
})
},
diff --git a/store/chart/index.js b/store/chart/index.js
index 404a10c2..83cd00bc 100644
--- a/store/chart/index.js
+++ b/store/chart/index.js
@@ -1,8 +1,5 @@
export const state = () => ({
- hoveredPeriod: {
- values: null,
- position: null
- },
+ isShowDataLabels: true,
periods: {
day: {
diff --git a/store/trns/getters.js b/store/trns/getters.js
index 0059794a..18d92cd9 100644
--- a/store/trns/getters.js
+++ b/store/trns/getters.js
@@ -1,7 +1,7 @@
import dayjs from 'dayjs'
export default {
- hasTrns (state, getters, rootState) {
+ hasTrns (_state, _getters, rootState) {
if (rootState.trns.items) {
if (Object.keys(rootState.trns.items).length > 0)
return true
@@ -11,7 +11,7 @@ export default {
/**
* Return total amounts of trnsIds
- * * Refactor params should be Object
+ * * Refactor: params should be Object
*
* @param {Array} trnsIds
* @return {Object} return
@@ -19,7 +19,7 @@ export default {
* @return {String} return.incomes
* @return {String} return.total
*/
- getTotalOfTrnsIds: (state, getters, rootState, rootGetters) => (trnsIds, inculdeTrnasfers = false, isConvertToBase = true, walletId) => {
+ getTotalOfTrnsIds: (_state, _getters, rootState, rootGetters) => (trnsIds, inculdeTrnasfers = false, isConvertToBase = true, walletId) => {
const trns = rootState.trns.items
const currencies = rootState.currencies.rates
const wallets = rootState.wallets.items
diff --git a/store/wallets/actions.js b/store/wallets/actions.js
index 259e588b..9191cab5 100644
--- a/store/wallets/actions.js
+++ b/store/wallets/actions.js
@@ -21,6 +21,7 @@ export default {
color: values.color,
countTotal: values.countTotal,
currency: values.currency,
+ isCredit: values.isCredit,
name: values.name,
order: parseInt(values.order) || 1
}
diff --git a/store/wallets/getters.js b/store/wallets/getters.js
index da4c6ad4..844d4b2e 100644
--- a/store/wallets/getters.js
+++ b/store/wallets/getters.js
@@ -5,9 +5,8 @@
export default {
hasWallets (state, getters, rootState) {
if (rootState.wallets.items) {
- if (Object.keys(rootState.wallets.items).length > 0) {
+ if (Object.keys(rootState.wallets.items).length > 0)
return true
- }
}
return false
},
@@ -20,7 +19,7 @@ export default {
},
walletsTotal (state, getters, rootState, rootGetters) {
- if (!getters.hasWallets) { return {} }
+ if (!getters.hasWallets) return {}
const walletsTotal = {}
const wallets = rootState.wallets.items
@@ -41,10 +40,10 @@ export default {
},
walletsSortedIds (state, getters) {
- if (!getters.hasWallets) { return [] }
+ 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 }
- if (parseInt(state.items[a].order) > parseInt(state.items[b].order)) { return 1 }
+ if (parseInt(state.items[a].order) < parseInt(state.items[b].order)) return -1
+ if (parseInt(state.items[a].order) > parseInt(state.items[b].order)) return 1
return 0
})
},