Skip to content

Open source personal finance application

feat (Pages): update wallets, categories

ilkome9a2a93457c5d
diff --git a/components/categories/EditModal.vue b/components/categories/EditModal.vue
index 644968b1..3d5a16ca 100644
--- a/components/categories/EditModal.vue
+++ b/components/categories/EditModal.vue
@@ -252,7 +252,7 @@ div
.menuItem(
:class="{ _active: activeTab === 'colors' }"
@click="activeTab = 'colors'"
- ) {{ $t('categories.form.color.label') }}
+ ) {{ $t('categories.form.colors.label') }}
.menuItem(
:class="{ _active: activeTab === 'icons' }"
@click="activeTab = 'icons'"
@@ -389,7 +389,7 @@ div
//- big
//- )
- .subTitle {{ $t('categories.form.color.custom') }}
+ .subTitle {{ $t('categories.form.colors.custom') }}
.customColor
input.customColor__value(v-model="category.color" type="color")
diff --git a/components/categories/Form.vue b/components/categories/Form.vue
index a9554c7f..a65044ce 100644
--- a/components/categories/Form.vue
+++ b/components/categories/Form.vue
@@ -241,7 +241,7 @@ export default {
.form-line(@click="showColors = true")
.inputModal._flex
.inputModal__value: .inputModal__color(:style="{ background: category.color }")
- .inputModal__label {{ $t('categories.form.color.label') }}
+ .inputModal__label {{ $t('categories.form.colors.label') }}
//- icons
.form__btns__i.cursor-pointer
@@ -305,7 +305,7 @@ export default {
@click="handleColorSelect(color)"
)
.customColor
- .customColor__title {{ $t('categories.form.color.custom') }}
+ .customColor__title {{ $t('categories.form.colors.custom') }}
input.customColor__value(v-model="category.color" type="color")
//- Icons
diff --git a/components/categories/pages/id/Edit.vue b/components/categories/pages/id/Edit.vue
new file mode 100644
index 00000000..ecaa6600
--- /dev/null
+++ b/components/categories/pages/id/Edit.vue
@@ -0,0 +1,647 @@
+<script lang="ts">
+import { saveData } from '~/services/firebase/api'
+import generateId from '~/utils/id'
+import { allColors, popularColors } from '~/assets/js/colorsPopular'
+import { random } from '~/assets/js/emo'
+import icons from '~/assets/js/icons'
+
+export default defineComponent({
+ setup() {
+ const { $store } = useNuxtApp()
+ 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,
+
+ popularColors,
+ allColors,
+ documentHeight,
+ }
+ },
+
+ data() {
+ return {
+ originalParentId: null,
+ showParents: false,
+ showIcons: false,
+ applyChildColor: true,
+ }
+ },
+
+ computed: {
+ categoryId() {
+ return this.$route.params.id
+ },
+ },
+
+ watch: {
+ categoryId: {
+ handler(categoryId) {
+ if (categoryId) {
+ this.category = {
+ ...this.category,
+ ...this.$store.state.categories.items[this.categoryId],
+ }
+
+ this.originalParentId = this.category.parentId
+ }
+ },
+ immediate: true,
+ },
+ },
+
+ created() {
+ this.colors = allColors
+ this.icons = icons
+ if (!this.categoryId) {
+ this.category.icon = random(random(icons))
+ this.category.color = random(popularColors)
+ }
+ },
+
+ beforeUnmount() {
+ this.$store.commit('categories/setCategoryEditId', null)
+ },
+
+ methods: {
+ closed() {
+ this.$store.commit('categories/setCategoryEditId', null)
+ this.$store.dispatch('ui/setActiveTab', null)
+ },
+
+ handleIconSelect(icon) {
+ this.category.icon = icon
+ this.showIcons = false
+ },
+
+ handleParenCategorySelect(categoryId) {
+ const parentCategory = this.$store.state.categories.items[categoryId]
+ if (parentCategory)
+ this.category.color = parentCategory.color
+
+ this.category.parentId = categoryId
+ this.showParents = false
+ },
+
+ handleSubmit() {
+ if (this.validateForm()) {
+ const uid = this.$store.state.user.user.uid
+ const id = this.categoryId || generateId()
+ const categories = this.$store.state.categories.items
+
+ const categoriesValues = {
+ order: this.category.order || null,
+ color: this.category.color,
+ icon: this.category.icon,
+ name: this.category.name,
+ childIds: this.category.childIds || [],
+ parentId: this.category.parentId,
+ showInLastUsed: this.category.showInLastUsed,
+ showInQuickSelector: this.category.showInQuickSelector,
+ showStat: true,
+ }
+
+ // ad or remove from parent
+ if (this.originalParentId !== this.category.parentId) {
+ // remove from old parent
+ if (this.originalParentId !== 0) {
+ const originalParent = categories[this.originalParentId]
+ if (originalParent) {
+ saveData(`users/${uid}/categories/${this.originalParentId}`, {
+ ...originalParent,
+ childIds: originalParent.childIds.filter(cId => cId !== id),
+ })
+ }
+ }
+
+ // add to new parent
+ if (this.category.parentId !== 0) {
+ const parenCategory = categories[this.category.parentId]
+ const childIds = parenCategory.childIds
+ ? [...parenCategory.childIds.filter(cId => cId !== id), id]
+ : [id]
+
+ saveData(`users/${uid}/categories/${this.category.parentId}`, {
+ ...parenCategory,
+ showInLastUsed: false,
+ showInQuickSelector: false,
+ childIds,
+ })
+ }
+ }
+
+ const childIds = this.$store.getters['categories/getChildCategoriesIds'](id)
+
+ // update category
+ saveData(`users/${uid}/categories/${id}`, {
+ ...categoriesValues,
+ childIds,
+ })
+
+ // update child categories colors
+ if (this.applyChildColor) {
+ for (const childId of childIds)
+ saveData(`users/${uid}/categories/${childId}/color`, categoriesValues.color)
+ }
+ }
+ },
+
+ validateForm() {
+ const categories = this.$store.state.categories.items
+ if (!this.category.name) {
+ this.$notify({
+ title: '😮',
+ text: this.$t('categories.form.name.error'),
+ })
+ return false
+ }
+
+ for (const categoryId in categories) {
+ if (categories[categoryId].name === this.category.name && categories[categoryId].parentId === this.category.parentId) {
+ if (this.categoryId) {
+ if (this.categoryId !== categoryId) {
+ this.$notify({
+ title: '😮',
+ text: this.$t('categories.form.name.exist'),
+ })
+ return false
+ }
+ }
+ else {
+ this.$notify({
+ title: '😮',
+ text: this.$t('categories.form.name.exist'),
+ })
+ return false
+ }
+ }
+ }
+
+ return true
+ },
+ },
+})
+</script>
+
+<template lang="pug">
+.relative.h-full.overflow.overflow-x-auto(v-if="category")
+ router-link(
+ v-slot='{ href, navigate }'
+ :to='`/categories/${categoryId}`'
+ custom
+ )
+ a.grow.cursor-pointer.block.py-5.pb-5.mb-3.px-3.font-nunito.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
+ :href='href'
+ @click='navigate'
+ )
+ .pb-2.text-xs.font-medium(class="text-white/50") {{ $t('categories.editTitle') }}
+
+ .flex.items-center.gap-3
+ .text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold {{ category.name }}
+ .w-8.h-8.rounded-full.flex-center.text-xl.text-neutral-50(
+ :style="{ background: category.color }"
+ )
+ div(:class="category.icon")
+
+ //- Menu
+ //-----------------------------------
+ .px-3.pb-4
+ .overflow-hidden.rounded-md.scrollbar.mb-4.bg-gray-50.dark_bg-dark4.dark_shadow
+ .overflow-hidden.overflow-x-auto.flex.items-center.text-sm.text-center.max-w-md
+ .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ :class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': activeTab === 'data' }"
+ @click="activeTab = 'data'"
+ ) {{ $t('categories.form.data.label') }}
+
+ .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ :class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': activeTab === 'colors' }"
+ @click="activeTab = 'colors'"
+ ) {{ $t('categories.form.colors.label') }}
+
+ .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ :class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': activeTab === 'icons' }"
+ @click="activeTab = 'icons'"
+ ) {{ $t('categories.form.icons.label') }}
+
+ //- Content
+ //-----------------------------------
+ .px-3.max-w-md
+ 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")
+ 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 }")
+
+ .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 }")
+
+ .subTitle {{ $t('categories.form.colors.custom') }}
+ .customColor
+ input.customColor__value(v-model="category.color" type="color")
+
+ //- Icons
+ //---------------------------------
+ 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
+ .pt-4.pb-6
+ SharedButton(
+ :class="['_text-center _blue2 _ml-big', { _inline: $store.state.ui.pc }]"
+ :title="$t('categories.form.save')"
+ @onClick="handleSubmit()"
+ )
+
+ //-
+ //- Parent Modal
+ //-
+ Portal(to="modal")
+ LazyBaseBottomSheet(
+ v-if="showParents"
+ @closed="showParents = false"
+ )
+ template(#handler="{ close }")
+ BaseBottomSheetClose(@onClick="close")
+
+ template()
+ .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"
+ :ids="$store.getters['categories/categoriesForBeParent'].filter(cId => cId !== categoryId)"
+ noPadding
+ @onClick="handleParenCategorySelect"
+ )
+</template>
+
+<style lang="stylus" scoped>
+.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)
+ /.light &
+ color var(--c-font-2)
+
+.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
+ 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
+
+.form
+ .inputText
+ margin-bottom 0
+ padding-bottom $m8
+
+ h2
+ padding-bottom $m6
+
+.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(40px, 1fr))
+ padding-bottom $m8
+
+.iconItem
+ display flex
+ align-items center
+ justify-content center
+ width 40px
+ height 40px
+ max-width 40px
+ max-height 40px
+ padding 4px
+ font-size 24px
+ border-radius 50%
+
+ +media-hover()
+ &:not(._empty)
+ cursor pointer
+ background var(--c-item-bd-hover)
+
+ &._active
+ padding 0
+ background var(--c-item-bd-hover)
+
+.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 48px
+ margin 0
+ padding 0
+ background none
+ border 0
+ border-radius $borderRadiusMd
+
+.padding-bottom
+ padding-bottom $m8
+
+.content
+ overflow hidden
+ display grid
+ padding-top $m7
+ background var(--c-bg-3)
+ border-radius $m8 $m8 0 0
+
+ +media(600px)
+ border-radius 16px
+
+.form__actions
+ @media $media-phone
+ text-align center
+
+.form__btns
+ display grid
+ grid-template-columns repeat(2, 1fr)
+ grid-column-gap $m9
+ grid-row-gap $m9
+ padding-bottom $m9
+
+ @media $media-laptop
+ grid-column-gap $m10
+ grid-row-gap $m10
+
+ &__i._full
+ grid-column 1 / -1
+
+ .form-line
+ display flex
+ align-items center
+ justify-content center
+ height 100%
+ height 56px
+ margin-bottom 0
+
+.inputModal
+ &._flex
+ flex 1
+ display flex
+ align-items center
+ justify-content space-between
+
+ &__content
+ display flex
+
+ &__label
+ margin 0
+ padding 0
+ font-size 10px
+</style>
+
+<style lang="stylus">
+@import '~assets/stylus/variables'
+</style>
diff --git a/components/categories/pages/id/Index.vue b/components/categories/pages/id/Index.vue
new file mode 100644
index 00000000..d2288c9f
--- /dev/null
+++ b/components/categories/pages/id/Index.vue
@@ -0,0 +1,119 @@
+<script setup lang="ts">
+import useFilter from '~/modules/filter/useFilter'
+import { getTrnsIds } from '~/components/trns/functions/getTrns'
+
+const { $store } = useNuxtApp()
+const { setFilterCatsId } = useFilter()
+
+const route = useRoute()
+const router = useRouter()
+
+const categoryId = computed(() => route.params.id)
+const category = computed(() => $store.state.categories.items[categoryId.value])
+if (!category.value)
+ router.replace('/categories')
+
+const trnsItems = computed(() => $store.state.trns.items)
+const backLink = computed(() => category.value?.parentId ? `/categories/${category.value.parentId}` : '/categories')
+
+const filter = reactive({ trnType: null })
+
+const categoryChildIds = computed(() => category.value.childIds?.sort((a, b) => {
+ if ($store.state.categories.items[a].name < $store.state.categories.items[b].name) return -1
+ if ($store.state.categories.items[a].name > $store.state.categories.items[b].name) return 1
+ return 0
+}))
+
+const trnsIds = computed(() =>
+ getTrnsIds({
+ categoriesIds: category.value?.childIds ? category.value?.childIds : [categoryId.value],
+ trnType: filter.trnType,
+ trnsItems: trnsItems.value,
+ }))
+
+function handleSetFilterCategory() {
+ setFilterCatsId(categoryId.value)
+ $store.commit('filter/setFilterDateNow')
+ $store.dispatch('ui/setActiveTabStat', 'details')
+}
+
+function handleEditClick() {
+ router.push(`/categories/${categoryId.value}/edit`)
+}
+</script>
+
+<template lang="pug">
+.relative.h-full.overflow.overflow-x-auto(v-if="category")
+ router-link(
+ v-slot='{ href, navigate }'
+ :to='backLink'
+ custom
+ )
+ .flex.items-start
+ a.grow.cursor-pointer.block.py-5.mb-3.px-3.font-nunito.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
+ :href='href'
+ @click='navigate'
+ )
+ .pb-2.text-xs.font-medium(class="text-white/50")
+ | {{ $t('categories.title') }}
+ template(v-if="category.parentId")
+ |
+ | • {{ $store.state.categories.items[category.parentId].name }}
+
+ .flex.items-center.gap-3
+ .text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold {{ category.name }}
+ .w-8.h-8.rounded-full.flex-center.text-xl.text-neutral-50(
+ :style="{ background: category.color }"
+ )
+ div(:class="category.icon")
+
+ .mdi.mdi-pencil-outline.cursor-pointer.rounded-full.mt-3.mr-2.w-16.h-16.flex-center.text-2xl.p-4.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
+ @click="handleEditClick"
+ )
+
+ .pb-12
+ .px-3.flex
+ .cursor-pointer.p-1.px-3.flex.items-center.gap-3.bg-gray-50.dark_bg-dark4.rounded-md.hocus_bg-gray-100.dark_hocus_bg-neutral-800.shadow.hocus_shadow-lg(
+ class="dark_text-white/60"
+ @click="handleSetFilterCategory"
+ )
+ .mdi.mdi-poll.text-xl
+ .text-xs.leading-none {{ $t('statBy') }} {{ category.name }}
+ .mdi.mdi-chevron-right.opacity-70.text-lg.leading-none
+
+ //- Childs categories
+ .pb-12(v-if="category.childIds && category.childIds.length > 0")
+ .statTitle.flex.gap-2.px-3(class="!pb-3")
+ div {{ $t('categories.title') }}:
+ div {{ category.childIds.length }}
+
+ .px-3
+ CategoriesView(
+ :ids="categoryChildIds"
+ :slider="() => ({})"
+ isHideParentCategory
+ borderTop
+ noPadding
+ @onClick="id => $router.push(`/categories/${id}`)"
+ )
+
+ //- History
+ .px-3
+ TrnsHistory(
+ :trnsIds="trnsIds"
+ :trnType="filter.trnType"
+ hideTransfers
+ @setFilterTrnType="value => filter.trnType = value"
+ )
+</template>
+
+<i18n lang="json5">
+{
+ "en": {
+ "statBy": "Statistics: ",
+ },
+ "ru": {
+ "statBy": "Статистика: ",
+ },
+}
+</i18n>
diff --git a/components/currencies/currencies.js b/components/currencies/currencies.js
new file mode 100644
index 00000000..b5132569
--- /dev/null
+++ b/components/currencies/currencies.js
@@ -0,0 +1,1711 @@
+
+export const currencies = [
+ {
+ code: 'AED',
+ number: '784',
+ digits: 2,
+ currency: 'UAE Dirham',
+ countries: [
+ 'United Arab Emirates (The)',
+ ],
+ },
+ {
+ code: 'AFN',
+ number: '971',
+ digits: 2,
+ currency: 'Afghani',
+ countries: [
+ 'Afghanistan',
+ ],
+ },
+ {
+ code: 'ALL',
+ number: '008',
+ digits: 2,
+ currency: 'Lek',
+ countries: [
+ 'Albania',
+ ],
+ },
+ {
+ code: 'AMD',
+ number: '051',
+ digits: 2,
+ currency: 'Armenian Dram',
+ countries: [
+ 'Armenia',
+ ],
+ },
+ {
+ code: 'ANG',
+ number: '532',
+ digits: 2,
+ currency: 'Netherlands Antillean Guilder',
+ countries: [
+ 'Curaçao',
+ 'Sint Maarten (Dutch Part)',
+ ],
+ },
+ {
+ code: 'AOA',
+ number: '973',
+ digits: 2,
+ currency: 'Kwanza',
+ countries: [
+ 'Angola',
+ ],
+ },
+ {
+ code: 'ARS',
+ number: '032',
+ digits: 2,
+ currency: 'Argentine Peso',
+ countries: [
+ 'Argentina',
+ ],
+ },
+ {
+ code: 'AUD',
+ number: '036',
+ digits: 2,
+ currency: 'Australian Dollar',
+ countries: [
+ 'Australia',
+ 'Christmas Island',
+ 'Cocos (Keeling) Islands (The)',
+ 'Heard Island and Mcdonald Islands',
+ 'Kiribati',
+ 'Nauru',
+ 'Norfolk Island',
+ 'Tuvalu',
+ ],
+ },
+ {
+ code: 'AWG',
+ number: '533',
+ digits: 2,
+ currency: 'Aruban Florin',
+ countries: [
+ 'Aruba',
+ ],
+ },
+ {
+ code: 'AZN',
+ number: '944',
+ digits: 2,
+ currency: 'Azerbaijan Manat',
+ countries: [
+ 'Azerbaijan',
+ ],
+ },
+ {
+ code: 'BAM',
+ number: '977',
+ digits: 2,
+ currency: 'Convertible Mark',
+ countries: [
+ 'Bosnia and Herzegovina',
+ ],
+ },
+ {
+ code: 'BBD',
+ number: '052',
+ digits: 2,
+ currency: 'Barbados Dollar',
+ countries: [
+ 'Barbados',
+ ],
+ },
+ {
+ code: 'BDT',
+ number: '050',
+ digits: 2,
+ currency: 'Taka',
+ countries: [
+ 'Bangladesh',
+ ],
+ },
+ {
+ code: 'BGN',
+ number: '975',
+ digits: 2,
+ currency: 'Bulgarian Lev',
+ countries: [
+ 'Bulgaria',
+ ],
+ },
+ {
+ code: 'BHD',
+ number: '048',
+ digits: 3,
+ currency: 'Bahraini Dinar',
+ countries: [
+ 'Bahrain',
+ ],
+ },
+ {
+ code: 'BIF',
+ number: '108',
+ digits: 0,
+ currency: 'Burundi Franc',
+ countries: [
+ 'Burundi',
+ ],
+ },
+ {
+ code: 'BMD',
+ number: '060',
+ digits: 2,
+ currency: 'Bermudian Dollar',
+ countries: [
+ 'Bermuda',
+ ],
+ },
+ {
+ code: 'BND',
+ number: '096',
+ digits: 2,
+ currency: 'Brunei Dollar',
+ countries: [
+ 'Brunei Darussalam',
+ ],
+ },
+ {
+ code: 'BOB',
+ number: '068',
+ digits: 2,
+ currency: 'Boliviano',
+ countries: [
+ 'Bolivia (Plurinational State Of)',
+ ],
+ },
+ {
+ code: 'BOV',
+ number: '984',
+ digits: 2,
+ currency: 'Mvdol',
+ countries: [
+ 'Bolivia (Plurinational State Of)',
+ ],
+ },
+ {
+ code: 'BRL',
+ number: '986',
+ digits: 2,
+ currency: 'Brazilian Real',
+ countries: [
+ 'Brazil',
+ ],
+ },
+ {
+ code: 'BSD',
+ number: '044',
+ digits: 2,
+ currency: 'Bahamian Dollar',
+ countries: [
+ 'Bahamas (The)',
+ ],
+ },
+ {
+ code: 'BTN',
+ number: '064',
+ digits: 2,
+ currency: 'Ngultrum',
+ countries: [
+ 'Bhutan',
+ ],
+ },
+ {
+ code: 'BWP',
+ number: '072',
+ digits: 2,
+ currency: 'Pula',
+ countries: [
+ 'Botswana',
+ ],
+ },
+ {
+ code: 'BYN',
+ number: '933',
+ digits: 2,
+ currency: 'Belarusian Ruble',
+ countries: [
+ 'Belarus',
+ ],
+ },
+ {
+ code: 'BZD',
+ number: '084',
+ digits: 2,
+ currency: 'Belize Dollar',
+ countries: [
+ 'Belize',
+ ],
+ },
+ {
+ code: 'CAD',
+ number: '124',
+ digits: 2,
+ currency: 'Canadian Dollar',
+ countries: [
+ 'Canada',
+ ],
+ },
+ {
+ code: 'CDF',
+ number: '976',
+ digits: 2,
+ currency: 'Congolese Franc',
+ countries: [
+ 'Congo (The Democratic Republic of The)',
+ ],
+ },
+ {
+ code: 'CHE',
+ number: '947',
+ digits: 2,
+ currency: 'WIR Euro',
+ countries: [
+ 'Switzerland',
+ ],
+ },
+ {
+ code: 'CHF',
+ number: '756',
+ digits: 2,
+ currency: 'Swiss Franc',
+ countries: [
+ 'Liechtenstein',
+ 'Switzerland',
+ ],
+ },
+ {
+ code: 'CHW',
+ number: '948',
+ digits: 2,
+ currency: 'WIR Franc',
+ countries: [
+ 'Switzerland',
+ ],
+ },
+ {
+ code: 'CLF',
+ number: '990',
+ digits: 4,
+ currency: 'Unidad de Fomento',
+ countries: [
+ 'Chile',
+ ],
+ },
+ {
+ code: 'CLP',
+ number: '152',
+ digits: 0,
+ currency: 'Chilean Peso',
+ countries: [
+ 'Chile',
+ ],
+ },
+ {
+ code: 'CNY',
+ number: '156',
+ digits: 2,
+ currency: 'Yuan Renminbi',
+ countries: [
+ 'China',
+ ],
+ },
+ {
+ code: 'COP',
+ number: '170',
+ digits: 2,
+ currency: 'Colombian Peso',
+ countries: [
+ 'Colombia',
+ ],
+ },
+ {
+ code: 'COU',
+ number: '970',
+ digits: 2,
+ currency: 'Unidad de Valor Real',
+ countries: [
+ 'Colombia',
+ ],
+ },
+ {
+ code: 'CRC',
+ number: '188',
+ digits: 2,
+ currency: 'Costa Rican Colon',
+ countries: [
+ 'Costa Rica',
+ ],
+ },
+ {
+ code: 'CUC',
+ number: '931',
+ digits: 2,
+ currency: 'Peso Convertible',
+ countries: [
+ 'Cuba',
+ ],
+ },
+ {
+ code: 'CUP',
+ number: '192',
+ digits: 2,
+ currency: 'Cuban Peso',
+ countries: [
+ 'Cuba',
+ ],
+ },
+ {
+ code: 'CVE',
+ number: '132',
+ digits: 2,
+ currency: 'Cabo Verde Escudo',
+ countries: [
+ 'Cabo Verde',
+ ],
+ },
+ {
+ code: 'CZK',
+ number: '203',
+ digits: 2,
+ currency: 'Czech Koruna',
+ countries: [
+ 'Czechia',
+ ],
+ },
+ {
+ code: 'DJF',
+ number: '262',
+ digits: 0,
+ currency: 'Djibouti Franc',
+ countries: [
+ 'Djibouti',
+ ],
+ },
+ {
+ code: 'DKK',
+ number: '208',
+ digits: 2,
+ currency: 'Danish Krone',
+ countries: [
+ 'Denmark',
+ 'Faroe Islands (The)',
+ 'Greenland',
+ ],
+ },
+ {
+ code: 'DOP',
+ number: '214',
+ digits: 2,
+ currency: 'Dominican Peso',
+ countries: [
+ 'Dominican Republic (The)',
+ ],
+ },
+ {
+ code: 'DZD',
+ number: '012',
+ digits: 2,
+ currency: 'Algerian Dinar',
+ countries: [
+ 'Algeria',
+ ],
+ },
+ {
+ code: 'EGP',
+ number: '818',
+ digits: 2,
+ currency: 'Egyptian Pound',
+ countries: [
+ 'Egypt',
+ ],
+ },
+ {
+ code: 'ERN',
+ number: '232',
+ digits: 2,
+ currency: 'Nakfa',
+ countries: [
+ 'Eritrea',
+ ],
+ },
+ {
+ code: 'ETB',
+ number: '230',
+ digits: 2,
+ currency: 'Ethiopian Birr',
+ countries: [
+ 'Ethiopia',
+ ],
+ },
+ {
+ code: 'EUR',
+ number: '978',
+ digits: 2,
+ currency: 'Euro',
+ countries: [
+ 'Åland Islands',
+ 'Andorra',
+ 'Austria',
+ 'Belgium',
+ 'Cyprus',
+ 'Estonia',
+ 'European Union',
+ 'Finland',
+ 'France',
+ 'French Guiana',
+ 'French Southern Territories (The)',
+ 'Germany',
+ 'Greece',
+ 'Guadeloupe',
+ 'Holy See (The)',
+ 'Ireland',
+ 'Italy',
+ 'Latvia',
+ 'Lithuania',
+ 'Luxembourg',
+ 'Malta',
+ 'Martinique',
+ 'Mayotte',
+ 'Monaco',
+ 'Montenegro',
+ 'Netherlands (The)',
+ 'Portugal',
+ 'Réunion',
+ 'Saint Barthélemy',
+ 'Saint Martin (French Part)',
+ 'Saint Pierre and Miquelon',
+ 'San Marino',
+ 'Slovakia',
+ 'Slovenia',
+ 'Spain',
+ ],
+ },
+ {
+ code: 'FJD',
+ number: '242',
+ digits: 2,
+ currency: 'Fiji Dollar',
+ countries: [
+ 'Fiji',
+ ],
+ },
+ {
+ code: 'FKP',
+ number: '238',
+ digits: 2,
+ currency: 'Falkland Islands Pound',
+ countries: [
+ 'Falkland Islands (The) [Malvinas]',
+ ],
+ },
+ {
+ code: 'GBP',
+ number: '826',
+ digits: 2,
+ currency: 'Pound Sterling',
+ countries: [
+ 'Guernsey',
+ 'Isle of Man',
+ 'Jersey',
+ 'United Kingdom of Great Britain and Northern Ireland (The)',
+ ],
+ },
+ {
+ code: 'GEL',
+ number: '981',
+ digits: 2,
+ currency: 'Lari',
+ countries: [
+ 'Georgia',
+ ],
+ },
+ {
+ code: 'GHS',
+ number: '936',
+ digits: 2,
+ currency: 'Ghana Cedi',
+ countries: [
+ 'Ghana',
+ ],
+ },
+ {
+ code: 'GIP',
+ number: '292',
+ digits: 2,
+ currency: 'Gibraltar Pound',
+ countries: [
+ 'Gibraltar',
+ ],
+ },
+ {
+ code: 'GMD',
+ number: '270',
+ digits: 2,
+ currency: 'Dalasi',
+ countries: [
+ 'Gambia (The)',
+ ],
+ },
+ {
+ code: 'GNF',
+ number: '324',
+ digits: 0,
+ currency: 'Guinean Franc',
+ countries: [
+ 'Guinea',
+ ],
+ },
+ {
+ code: 'GTQ',
+ number: '320',
+ digits: 2,
+ currency: 'Quetzal',
+ countries: [
+ 'Guatemala',
+ ],
+ },
+ {
+ code: 'GYD',
+ number: '328',
+ digits: 2,
+ currency: 'Guyana Dollar',
+ countries: [
+ 'Guyana',
+ ],
+ },
+ {
+ code: 'HKD',
+ number: '344',
+ digits: 2,
+ currency: 'Hong Kong Dollar',
+ countries: [
+ 'Hong Kong',
+ ],
+ },
+ {
+ code: 'HNL',
+ number: '340',
+ digits: 2,
+ currency: 'Lempira',
+ countries: [
+ 'Honduras',
+ ],
+ },
+ {
+ code: 'HRK',
+ number: '191',
+ digits: 2,
+ currency: 'Kuna',
+ countries: [
+ 'Croatia',
+ ],
+ },
+ {
+ code: 'HTG',
+ number: '332',
+ digits: 2,
+ currency: 'Gourde',
+ countries: [
+ 'Haiti',
+ ],
+ },
+ {
+ code: 'HUF',
+ number: '348',
+ digits: 2,
+ currency: 'Forint',
+ countries: [
+ 'Hungary',
+ ],
+ },
+ {
+ code: 'IDR',
+ number: '360',
+ digits: 2,
+ currency: 'Rupiah',
+ countries: [
+ 'Indonesia',
+ ],
+ },
+ {
+ code: 'ILS',
+ number: '376',
+ digits: 2,
+ currency: 'New Israeli Sheqel',
+ countries: [
+ 'Israel',
+ ],
+ },
+ {
+ code: 'INR',
+ number: '356',
+ digits: 2,
+ currency: 'Indian Rupee',
+ countries: [
+ 'Bhutan',
+ 'India',
+ ],
+ },
+ {
+ code: 'IQD',
+ number: '368',
+ digits: 3,
+ currency: 'Iraqi Dinar',
+ countries: [
+ 'Iraq',
+ ],
+ },
+ {
+ code: 'IRR',
+ number: '364',
+ digits: 2,
+ currency: 'Iranian Rial',
+ countries: [
+ 'Iran (Islamic Republic Of)',
+ ],
+ },
+ {
+ code: 'ISK',
+ number: '352',
+ digits: 0,
+ currency: 'Iceland Krona',
+ countries: [
+ 'Iceland',
+ ],
+ },
+ {
+ code: 'JMD',
+ number: '388',
+ digits: 2,
+ currency: 'Jamaican Dollar',
+ countries: [
+ 'Jamaica',
+ ],
+ },
+ {
+ code: 'JOD',
+ number: '400',
+ digits: 3,
+ currency: 'Jordanian Dinar',
+ countries: [
+ 'Jordan',
+ ],
+ },
+ {
+ code: 'JPY',
+ number: '392',
+ digits: 0,
+ currency: 'Yen',
+ countries: [
+ 'Japan',
+ ],
+ },
+ {
+ code: 'KES',
+ number: '404',
+ digits: 2,
+ currency: 'Kenyan Shilling',
+ countries: [
+ 'Kenya',
+ ],
+ },
+ {
+ code: 'KGS',
+ number: '417',
+ digits: 2,
+ currency: 'Som',
+ countries: [
+ 'Kyrgyzstan',
+ ],
+ },
+ {
+ code: 'KHR',
+ number: '116',
+ digits: 2,
+ currency: 'Riel',
+ countries: [
+ 'Cambodia',
+ ],
+ },
+ {
+ code: 'KMF',
+ number: '174',
+ digits: 0,
+ currency: 'Comorian Franc ',
+ countries: [
+ 'Comoros (The)',
+ ],
+ },
+ {
+ code: 'KPW',
+ number: '408',
+ digits: 2,
+ currency: 'North Korean Won',
+ countries: [
+ 'Korea (The Democratic People’s Republic Of)',
+ ],
+ },
+ {
+ code: 'KRW',
+ number: '410',
+ digits: 0,
+ currency: 'Won',
+ countries: [
+ 'Korea (The Republic Of)',
+ ],
+ },
+ {
+ code: 'KWD',
+ number: '414',
+ digits: 3,
+ currency: 'Kuwaiti Dinar',
+ countries: [
+ 'Kuwait',
+ ],
+ },
+ {
+ code: 'KYD',
+ number: '136',
+ digits: 2,
+ currency: 'Cayman Islands Dollar',
+ countries: [
+ 'Cayman Islands (The)',
+ ],
+ },
+ {
+ code: 'KZT',
+ number: '398',
+ digits: 2,
+ currency: 'Tenge',
+ countries: [
+ 'Kazakhstan',
+ ],
+ },
+ {
+ code: 'LAK',
+ number: '418',
+ digits: 2,
+ currency: 'Lao Kip',
+ countries: [
+ 'Lao People’s Democratic Republic (The)',
+ ],
+ },
+ {
+ code: 'LBP',
+ number: '422',
+ digits: 2,
+ currency: 'Lebanese Pound',
+ countries: [
+ 'Lebanon',
+ ],
+ },
+ {
+ code: 'LKR',
+ number: '144',
+ digits: 2,
+ currency: 'Sri Lanka Rupee',
+ countries: [
+ 'Sri Lanka',
+ ],
+ },
+ {
+ code: 'LRD',
+ number: '430',
+ digits: 2,
+ currency: 'Liberian Dollar',
+ countries: [
+ 'Liberia',
+ ],
+ },
+ {
+ code: 'LSL',
+ number: '426',
+ digits: 2,
+ currency: 'Loti',
+ countries: [
+ 'Lesotho',
+ ],
+ },
+ {
+ code: 'LYD',
+ number: '434',
+ digits: 3,
+ currency: 'Libyan Dinar',
+ countries: [
+ 'Libya',
+ ],
+ },
+ {
+ code: 'MAD',
+ number: '504',
+ digits: 2,
+ currency: 'Moroccan Dirham',
+ countries: [
+ 'Morocco',
+ 'Western Sahara',
+ ],
+ },
+ {
+ code: 'MDL',
+ number: '498',
+ digits: 2,
+ currency: 'Moldovan Leu',
+ countries: [
+ 'Moldova (The Republic Of)',
+ ],
+ },
+ {
+ code: 'MGA',
+ number: '969',
+ digits: 2,
+ currency: 'Malagasy Ariary',
+ countries: [
+ 'Madagascar',
+ ],
+ },
+ {
+ code: 'MKD',
+ number: '807',
+ digits: 2,
+ currency: 'Denar',
+ countries: [
+ 'Macedonia (The Former Yugoslav Republic Of)',
+ ],
+ },
+ {
+ code: 'MMK',
+ number: '104',
+ digits: 2,
+ currency: 'Kyat',
+ countries: [
+ 'Myanmar',
+ ],
+ },
+ {
+ code: 'MNT',
+ number: '496',
+ digits: 2,
+ currency: 'Tugrik',
+ countries: [
+ 'Mongolia',
+ ],
+ },
+ {
+ code: 'MOP',
+ number: '446',
+ digits: 2,
+ currency: 'Pataca',
+ countries: [
+ 'Macao',
+ ],
+ },
+ {
+ code: 'MRU',
+ number: '929',
+ digits: 2,
+ currency: 'Ouguiya',
+ countries: [
+ 'Mauritania',
+ ],
+ },
+ {
+ code: 'MUR',
+ number: '480',
+ digits: 2,
+ currency: 'Mauritius Rupee',
+ countries: [
+ 'Mauritius',
+ ],
+ },
+ {
+ code: 'MVR',
+ number: '462',
+ digits: 2,
+ currency: 'Rufiyaa',
+ countries: [
+ 'Maldives',
+ ],
+ },
+ {
+ code: 'MWK',
+ number: '454',
+ digits: 2,
+ currency: 'Malawi Kwacha',
+ countries: [
+ 'Malawi',
+ ],
+ },
+ {
+ code: 'MXN',
+ number: '484',
+ digits: 2,
+ currency: 'Mexican Peso',
+ countries: [
+ 'Mexico',
+ ],
+ },
+ {
+ code: 'MXV',
+ number: '979',
+ digits: 2,
+ currency: 'Mexican Unidad de Inversion (UDI)',
+ countries: [
+ 'Mexico',
+ ],
+ },
+ {
+ code: 'MYR',
+ number: '458',
+ digits: 2,
+ currency: 'Malaysian Ringgit',
+ countries: [
+ 'Malaysia',
+ ],
+ },
+ {
+ code: 'MZN',
+ number: '943',
+ digits: 2,
+ currency: 'Mozambique Metical',
+ countries: [
+ 'Mozambique',
+ ],
+ },
+ {
+ code: 'NAD',
+ number: '516',
+ digits: 2,
+ currency: 'Namibia Dollar',
+ countries: [
+ 'Namibia',
+ ],
+ },
+ {
+ code: 'NGN',
+ number: '566',
+ digits: 2,
+ currency: 'Naira',
+ countries: [
+ 'Nigeria',
+ ],
+ },
+ {
+ code: 'NIO',
+ number: '558',
+ digits: 2,
+ currency: 'Cordoba Oro',
+ countries: [
+ 'Nicaragua',
+ ],
+ },
+ {
+ code: 'NOK',
+ number: '578',
+ digits: 2,
+ currency: 'Norwegian Krone',
+ countries: [
+ 'Bouvet Island',
+ 'Norway',
+ 'Svalbard and Jan Mayen',
+ ],
+ },
+ {
+ code: 'NPR',
+ number: '524',
+ digits: 2,
+ currency: 'Nepalese Rupee',
+ countries: [
+ 'Nepal',
+ ],
+ },
+ {
+ code: 'NZD',
+ number: '554',
+ digits: 2,
+ currency: 'New Zealand Dollar',
+ countries: [
+ 'Cook Islands (The)',
+ 'New Zealand',
+ 'Niue',
+ 'Pitcairn',
+ 'Tokelau',
+ ],
+ },
+ {
+ code: 'OMR',
+ number: '512',
+ digits: 3,
+ currency: 'Rial Omani',
+ countries: [
+ 'Oman',
+ ],
+ },
+ {
+ code: 'PAB',
+ number: '590',
+ digits: 2,
+ currency: 'Balboa',
+ countries: [
+ 'Panama',
+ ],
+ },
+ {
+ code: 'PEN',
+ number: '604',
+ digits: 2,
+ currency: 'Sol',
+ countries: [
+ 'Peru',
+ ],
+ },
+ {
+ code: 'PGK',
+ number: '598',
+ digits: 2,
+ currency: 'Kina',
+ countries: [
+ 'Papua New Guinea',
+ ],
+ },
+ {
+ code: 'PHP',
+ number: '608',
+ digits: 2,
+ currency: 'Philippine Peso',
+ countries: [
+ 'Philippines (The)',
+ ],
+ },
+ {
+ code: 'PKR',
+ number: '586',
+ digits: 2,
+ currency: 'Pakistan Rupee',
+ countries: [
+ 'Pakistan',
+ ],
+ },
+ {
+ code: 'PLN',
+ number: '985',
+ digits: 2,
+ currency: 'Zloty',
+ countries: [
+ 'Poland',
+ ],
+ },
+ {
+ code: 'PYG',
+ number: '600',
+ digits: 0,
+ currency: 'Guarani',
+ countries: [
+ 'Paraguay',
+ ],
+ },
+ {
+ code: 'QAR',
+ number: '634',
+ digits: 2,
+ currency: 'Qatari Rial',
+ countries: [
+ 'Qatar',
+ ],
+ },
+ {
+ code: 'RON',
+ number: '946',
+ digits: 2,
+ currency: 'Romanian Leu',
+ countries: [
+ 'Romania',
+ ],
+ },
+ {
+ code: 'RSD',
+ number: '941',
+ digits: 2,
+ currency: 'Serbian Dinar',
+ countries: [
+ 'Serbia',
+ ],
+ },
+ {
+ code: 'RUB',
+ number: '643',
+ digits: 2,
+ currency: 'Russian Ruble',
+ countries: [
+ 'Russian Federation (The)',
+ ],
+ },
+ {
+ code: 'RWF',
+ number: '646',
+ digits: 0,
+ currency: 'Rwanda Franc',
+ countries: [
+ 'Rwanda',
+ ],
+ },
+ {
+ code: 'SAR',
+ number: '682',
+ digits: 2,
+ currency: 'Saudi Riyal',
+ countries: [
+ 'Saudi Arabia',
+ ],
+ },
+ {
+ code: 'SBD',
+ number: '090',
+ digits: 2,
+ currency: 'Solomon Islands Dollar',
+ countries: [
+ 'Solomon Islands',
+ ],
+ },
+ {
+ code: 'SCR',
+ number: '690',
+ digits: 2,
+ currency: 'Seychelles Rupee',
+ countries: [
+ 'Seychelles',
+ ],
+ },
+ {
+ code: 'SDG',
+ number: '938',
+ digits: 2,
+ currency: 'Sudanese Pound',
+ countries: [
+ 'Sudan (The)',
+ ],
+ },
+ {
+ code: 'SEK',
+ number: '752',
+ digits: 2,
+ currency: 'Swedish Krona',
+ countries: [
+ 'Sweden',
+ ],
+ },
+ {
+ code: 'SGD',
+ number: '702',
+ digits: 2,
+ currency: 'Singapore Dollar',
+ countries: [
+ 'Singapore',
+ ],
+ },
+ {
+ code: 'SHP',
+ number: '654',
+ digits: 2,
+ currency: 'Saint Helena Pound',
+ countries: [
+ 'Saint Helena, Ascension and Tristan Da Cunha',
+ ],
+ },
+ {
+ code: 'SLL',
+ number: '694',
+ digits: 2,
+ currency: 'Leone',
+ countries: [
+ 'Sierra Leone',
+ ],
+ },
+ {
+ code: 'SOS',
+ number: '706',
+ digits: 2,
+ currency: 'Somali Shilling',
+ countries: [
+ 'Somalia',
+ ],
+ },
+ {
+ code: 'SRD',
+ number: '968',
+ digits: 2,
+ currency: 'Surinam Dollar',
+ countries: [
+ 'Suriname',
+ ],
+ },
+ {
+ code: 'SSP',
+ number: '728',
+ digits: 2,
+ currency: 'South Sudanese Pound',
+ countries: [
+ 'South Sudan',
+ ],
+ },
+ {
+ code: 'STN',
+ number: '930',
+ digits: 2,
+ currency: 'Dobra',
+ countries: [
+ 'Sao Tome and Principe',
+ ],
+ },
+ {
+ code: 'SVC',
+ number: '222',
+ digits: 2,
+ currency: 'El Salvador Colon',
+ countries: [
+ 'El Salvador',
+ ],
+ },
+ {
+ code: 'SYP',
+ number: '760',
+ digits: 2,
+ currency: 'Syrian Pound',
+ countries: [
+ 'Syrian Arab Republic',
+ ],
+ },
+ {
+ code: 'SZL',
+ number: '748',
+ digits: 2,
+ currency: 'Lilangeni',
+ countries: [
+ 'Eswatini',
+ ],
+ },
+ {
+ code: 'THB',
+ number: '764',
+ digits: 2,
+ currency: 'Baht',
+ countries: [
+ 'Thailand',
+ ],
+ },
+ {
+ code: 'TJS',
+ number: '972',
+ digits: 2,
+ currency: 'Somoni',
+ countries: [
+ 'Tajikistan',
+ ],
+ },
+ {
+ code: 'TMT',
+ number: '934',
+ digits: 2,
+ currency: 'Turkmenistan New Manat',
+ countries: [
+ 'Turkmenistan',
+ ],
+ },
+ {
+ code: 'TND',
+ number: '788',
+ digits: 3,
+ currency: 'Tunisian Dinar',
+ countries: [
+ 'Tunisia',
+ ],
+ },
+ {
+ code: 'TOP',
+ number: '776',
+ digits: 2,
+ currency: 'Pa’anga',
+ countries: [
+ 'Tonga',
+ ],
+ },
+ {
+ code: 'TRY',
+ number: '949',
+ digits: 2,
+ currency: 'Turkish Lira',
+ countries: [
+ 'Turkey',
+ ],
+ },
+ {
+ code: 'TTD',
+ number: '780',
+ digits: 2,
+ currency: 'Trinidad and Tobago Dollar',
+ countries: [
+ 'Trinidad and Tobago',
+ ],
+ },
+ {
+ code: 'TWD',
+ number: '901',
+ digits: 2,
+ currency: 'New Taiwan Dollar',
+ countries: [
+ 'Taiwan (Province of China)',
+ ],
+ },
+ {
+ code: 'TZS',
+ number: '834',
+ digits: 2,
+ currency: 'Tanzanian Shilling',
+ countries: [
+ 'Tanzania, United Republic Of',
+ ],
+ },
+ {
+ code: 'UAH',
+ number: '980',
+ digits: 2,
+ currency: 'Hryvnia',
+ countries: [
+ 'Ukraine',
+ ],
+ },
+ {
+ code: 'UGX',
+ number: '800',
+ digits: 0,
+ currency: 'Uganda Shilling',
+ countries: [
+ 'Uganda',
+ ],
+ },
+ {
+ code: 'USD',
+ number: '840',
+ digits: 2,
+ currency: 'US Dollar',
+ countries: [
+ 'American Samoa',
+ 'Bonaire, Sint Eustatius and Saba',
+ 'British Indian Ocean Territory (The)',
+ 'Ecuador',
+ 'El Salvador',
+ 'Guam',
+ 'Haiti',
+ 'Marshall Islands (The)',
+ 'Micronesia (Federated States Of)',
+ 'Northern Mariana Islands (The)',
+ 'Palau',
+ 'Panama',
+ 'Puerto Rico',
+ 'Timor-Leste',
+ 'Turks and Caicos Islands (The)',
+ 'United States Minor Outlying Islands (The)',
+ 'United States of America (The)',
+ 'Virgin Islands (British)',
+ 'Virgin Islands (U.S.)',
+ ],
+ },
+ {
+ code: 'USN',
+ number: '997',
+ digits: 2,
+ currency: 'US Dollar (Next day)',
+ countries: [
+ 'United States of America (The)',
+ ],
+ },
+ {
+ code: 'UYI',
+ number: '940',
+ digits: 0,
+ currency: 'Uruguay Peso en Unidades Indexadas (UI)',
+ countries: [
+ 'Uruguay',
+ ],
+ },
+ {
+ code: 'UYU',
+ number: '858',
+ digits: 2,
+ currency: 'Peso Uruguayo',
+ countries: [
+ 'Uruguay',
+ ],
+ },
+ {
+ code: 'UYW',
+ number: '927',
+ digits: 4,
+ currency: 'Unidad Previsional',
+ countries: [
+ 'Uruguay',
+ ],
+ },
+ {
+ code: 'UZS',
+ number: '860',
+ digits: 2,
+ currency: 'Uzbekistan Sum',
+ countries: [
+ 'Uzbekistan',
+ ],
+ },
+ {
+ code: 'VES',
+ number: '928',
+ digits: 2,
+ currency: 'Bolívar Soberano',
+ countries: [
+ 'Venezuela (Bolivarian Republic Of)',
+ ],
+ },
+ {
+ code: 'VND',
+ number: '704',
+ digits: 0,
+ currency: 'Dong',
+ countries: [
+ 'Viet Nam',
+ ],
+ },
+ {
+ code: 'VUV',
+ number: '548',
+ digits: 0,
+ currency: 'Vatu',
+ countries: [
+ 'Vanuatu',
+ ],
+ },
+ {
+ code: 'WST',
+ number: '882',
+ digits: 2,
+ currency: 'Tala',
+ countries: [
+ 'Samoa',
+ ],
+ },
+ {
+ code: 'XAF',
+ number: '950',
+ digits: 0,
+ currency: 'CFA Franc BEAC',
+ countries: [
+ 'Cameroon',
+ 'Central African Republic (The)',
+ 'Chad',
+ 'Congo (The)',
+ 'Equatorial Guinea',
+ 'Gabon',
+ ],
+ },
+ {
+ code: 'XAG',
+ number: '961',
+ digits: 0,
+ currency: 'Silver',
+ countries: [
+ 'Zz11_silver',
+ ],
+ },
+ {
+ code: 'XAU',
+ number: '959',
+ digits: 0,
+ currency: 'Gold',
+ countries: [
+ 'Zz08_gold',
+ ],
+ },
+ {
+ code: 'XBA',
+ number: '955',
+ digits: 0,
+ currency: 'Bond Markets Unit European Composite Unit (EURCO)',
+ countries: [
+ 'Zz01_bond Markets Unit European_eurco',
+ ],
+ },
+ {
+ code: 'XBB',
+ number: '956',
+ digits: 0,
+ currency: 'Bond Markets Unit European Monetary Unit (E.M.U.-6)',
+ countries: [
+ 'Zz02_bond Markets Unit European_emu-6',
+ ],
+ },
+ {
+ code: 'XBC',
+ number: '957',
+ digits: 0,
+ currency: 'Bond Markets Unit European Unit of Account 9 (E.U.A.-9)',
+ countries: [
+ 'Zz03_bond Markets Unit European_eua-9',
+ ],
+ },
+ {
+ code: 'XBD',
+ number: '958',
+ digits: 0,
+ currency: 'Bond Markets Unit European Unit of Account 17 (E.U.A.-17)',
+ countries: [
+ 'Zz04_bond Markets Unit European_eua-17',
+ ],
+ },
+ {
+ code: 'XCD',
+ number: '951',
+ digits: 2,
+ currency: 'East Caribbean Dollar',
+ countries: [
+ 'Anguilla',
+ 'Antigua and Barbuda',
+ 'Dominica',
+ 'Grenada',
+ 'Montserrat',
+ 'Saint Kitts and Nevis',
+ 'Saint Lucia',
+ 'Saint Vincent and the Grenadines',
+ ],
+ },
+ {
+ code: 'XDR',
+ number: '960',
+ digits: 0,
+ currency: 'SDR (Special Drawing Right)',
+ countries: [
+ 'International Monetary Fund (Imf) ',
+ ],
+ },
+ {
+ code: 'XOF',
+ number: '952',
+ digits: 0,
+ currency: 'CFA Franc BCEAO',
+ countries: [
+ 'Benin',
+ 'Burkina Faso',
+ 'Côte d\'Ivoire',
+ 'Guinea-Bissau',
+ 'Mali',
+ 'Niger (The)',
+ 'Senegal',
+ 'Togo',
+ ],
+ },
+ {
+ code: 'XPD',
+ number: '964',
+ digits: 0,
+ currency: 'Palladium',
+ countries: [
+ 'Zz09_palladium',
+ ],
+ },
+ {
+ code: 'XPF',
+ number: '953',
+ digits: 0,
+ currency: 'CFP Franc',
+ countries: [
+ 'French Polynesia',
+ 'New Caledonia',
+ 'Wallis and Futuna',
+ ],
+ },
+ {
+ code: 'XPT',
+ number: '962',
+ digits: 0,
+ currency: 'Platinum',
+ countries: [
+ 'Zz10_platinum',
+ ],
+ },
+ {
+ code: 'XSU',
+ number: '994',
+ digits: 0,
+ currency: 'Sucre',
+ countries: [
+ 'Sistema Unitario De Compensacion Regional De Pagos "Sucre"',
+ ],
+ },
+ {
+ code: 'XTS',
+ number: '963',
+ digits: 0,
+ currency: 'Codes specifically reserved for testing purposes',
+ countries: [
+ 'Zz06_testing_code',
+ ],
+ },
+ {
+ code: 'XUA',
+ number: '965',
+ digits: 0,
+ currency: 'ADB Unit of Account',
+ countries: [
+ 'Member Countries of the African Development Bank Group',
+ ],
+ },
+ {
+ code: 'XXX',
+ number: '999',
+ digits: 0,
+ currency: 'The codes assigned for transactions where no currency is involved',
+ countries: [
+ 'Zz07_no_currency',
+ ],
+ },
+ {
+ code: 'YER',
+ number: '886',
+ digits: 2,
+ currency: 'Yemeni Rial',
+ countries: [
+ 'Yemen',
+ ],
+ },
+ {
+ code: 'ZAR',
+ number: '710',
+ digits: 2,
+ currency: 'Rand',
+ countries: [
+ 'Lesotho',
+ 'Namibia',
+ 'South Africa',
+ ],
+ },
+ {
+ code: 'ZMW',
+ number: '967',
+ digits: 2,
+ currency: 'Zambian Kwacha',
+ countries: [
+ 'Zambia',
+ ],
+ },
+ {
+ code: 'ZWL',
+ number: '932',
+ digits: 2,
+ currency: 'Zimbabwe Dollar',
+ countries: [
+ 'Zimbabwe',
+ ],
+ },
+]
diff --git a/components/shared/button/Button.vue b/components/shared/button/Button.vue
index 677bdc25..2bfde04f 100644
--- a/components/shared/button/Button.vue
+++ b/components/shared/button/Button.vue
@@ -104,9 +104,9 @@ export default {
border-radius $m3
anim-background()
- +media-laptop()
- padding 12px 20px
- font-size 14px
+ // +media-laptop()
+ // padding 12px 20px
+ // font-size 14px
+media-hover()
color var(--c-font-1)
@@ -166,10 +166,10 @@ export default {
max-width 220px
margin 0 auto
- @media $media-laptop
- display inline-flex
- width auto
- margin 0
+ // @media $media-laptop
+ // display inline-flex
+ // width auto
+ // margin 0
&._center
align-items center
@@ -251,9 +251,9 @@ export default {
margin-right 0
margin-right -5px
- +media-laptop()
- margin-right 10px
- margin-left -8px
+ // +media-laptop()
+ // margin-right 10px
+ // margin-left -8px
&__check
margin-left auto
diff --git a/components/trnForm/TrnFormCategories.vue b/components/trnForm/TrnFormCategories.vue
index d719279a..2f9b949c 100644
--- a/components/trnForm/TrnFormCategories.vue
+++ b/components/trnForm/TrnFormCategories.vue
@@ -84,17 +84,17 @@ export default {
.py-2.px-3(v-if="slider")
.overflow-hidden.flex.items-center.text-center.text-xs.rounded-md.bg-gray-50.dark_bg-dark4.dark_shadow
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': slider.activeIndex === 0 }"
@click="slider.slideTo(0)"
) {{ $t('categories.lastUsedTitle') }}
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': slider.activeIndex === 1 }"
@click="slider.slideTo(1)"
) {{ $t('categories.allTitle') }}
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': slider.activeIndex === 2 }"
@click="slider.slideTo(2)"
) {{ $t('categories.favoriteTitle') }}
diff --git a/components/trnForm/TrnFormTrns.vue b/components/trnForm/TrnFormTrns.vue
index 6dba2b89..c37c3f71 100644
--- a/components/trnForm/TrnFormTrns.vue
+++ b/components/trnForm/TrnFormTrns.vue
@@ -128,17 +128,17 @@ export default defineComponent({
.pt-2.pb-5.px-3
.overflow-hidden.rounded-md.items-center.flex.text-xs.text-center.bg-gray-50.dark_bg-dark4.dark_shadow
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': filterBy === 'wallet' }"
@click="changeFilter('wallet')"
) {{ $t('trnForm.filterWallet') }}
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': filterBy === 'walletAndCategory' }"
@click="changeFilter('walletAndCategory')"
) {{ $t('trnForm.filterWalletAndCategory') }}
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': filterBy === 'all' }"
@click="changeFilter('all')"
) {{ $t('trnForm.filterAll') }}
diff --git a/components/trnForm/TrnFormTypes.vue b/components/trnForm/TrnFormTypes.vue
index 30494dbe..ff08ea93 100644
--- a/components/trnForm/TrnFormTypes.vue
+++ b/components/trnForm/TrnFormTypes.vue
@@ -24,17 +24,17 @@ export default {
<template lang="pug">
.px-4.pb-4.text-center
.overflow-hidden.flex.items-center.text-sm.rounded-md.bg-gray-50.dark_bg-dark4.dark_shadow
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': amountType === 0 }"
@click="() => setAmountType(0)"
) {{ $t('money.expenses') }}
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': amountType === 1 }"
@click="() => setAmountType(1)"
) {{ $t('money.incomes') }}
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
v-if="$store.getters['wallets/walletsSortedIds'].length > 1"
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': amountType === 2 }"
@click="() => setAmountType(2)"
diff --git a/components/trns/History.vue b/components/trns/History.vue
index 18011dd9..8395faa1 100644
--- a/components/trns/History.vue
+++ b/components/trns/History.vue
@@ -29,22 +29,22 @@ div
//- Trns: TypeSelector
.overflow-hidden.rounded-md.scrollbar.mb-4.bg-gray-50.dark_bg-dark4.dark_shadow
.overflow-hidden.overflow-x-auto.flex.items-center.text-sm.text-center.max-w-md
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': props.trnType === null }"
@click="setTrnType(null)"
) {{ $t('common.all') }}
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': props.trnType === 0 }"
@click="setTrnType(0)"
) {{ $t('money.expenses') }}
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': props.trnType === 1 }"
@click="setTrnType(1)"
) {{ $t('money.incomes') }}
- .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ .cursor-pointer.px-5.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
v-if="!hideTransfers"
:class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': trnType === 2 }"
@click="setTrnType(2)"
diff --git a/components/trns/pages/History.vue b/components/trns/pages/History.vue
new file mode 100644
index 00000000..3832f812
--- /dev/null
+++ b/components/trns/pages/History.vue
@@ -0,0 +1,64 @@
+<script setup lang="ts">
+import useStatPage from '~/components/stat/useStatPage'
+import { getTrnsIds } from '~/components/trns/functions/getTrns'
+
+const { $store } = useNuxtApp()
+const { statPage } = useStatPage()
+const catsItems = computed(() => $store.state.categories.items)
+const trnsItems = computed(() => $store.state.trns.items)
+const storeFilter = computed(() => $store.state.filter)
+const filterTrnType = ref(null)
+
+// TODO: shared functions
+function getCatsIds(catsIds) {
+ const ids = []
+
+ for (const catId of catsIds) {
+ const category = catsItems.value[catId]
+ category?.childIds
+ ? ids.push(...category.childIds)
+ : ids.push(catId)
+ }
+
+ return ids
+}
+
+const trnsIds = computed(() => {
+ const categoriesIds = storeFilter.value.catsIds.length > 0 ? getCatsIds(storeFilter.value.catsIds) : null
+ const walletsIds = storeFilter.value.walletsIds.length > 0 ? storeFilter.value.walletsIds : null
+
+ return getTrnsIds({
+ categoriesIds,
+ walletsIds,
+ trnType: filterTrnType.value,
+ trnsItems: trnsItems.value,
+ })
+})
+</script>
+
+<script lang="ts">
+export default defineComponent({
+ head() {
+ return {
+ title: this.$t('trns.history'),
+ }
+ },
+})
+</script>
+
+<template lang="pug">
+.h-full.overflow.overflow-x-auto
+ .py-6.px-3.font-nunito.text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold
+ | {{ $t('trns.history') }}
+
+ .px-3
+ .pb-8(v-if="statPage.filter.isShow")
+ LazyStatFilter
+
+ //- History
+ TrnsHistory(
+ :trnsIds="trnsIds"
+ :trnType="filterTrnType"
+ @setFilterTrnType="value => filterTrnType = value"
+ )
+</template>
diff --git a/components/wallets/form/WalletForm.vue b/components/wallets/form/WalletForm.vue
index 5f24a276..75020d39 100644
--- a/components/wallets/form/WalletForm.vue
+++ b/components/wallets/form/WalletForm.vue
@@ -93,7 +93,7 @@ export default {
if (!this.wallet.currency) {
this.$notify({
title: '😮',
- text: this.$t('wallets.form.currency.error'),
+ text: this.$t('wallets.form.currencies.error'),
})
return false
}
@@ -147,13 +147,13 @@ export default {
.inputModal._flex
.inputModal__value {{ wallet.currency }}
.inputModal__content
- .inputModal__label {{ $t('wallets.form.currency.label') }}
+ .inputModal__label {{ $t('wallets.form.currencies.label') }}
.form__btns__i
.form-line(@click="showColors = true")
.inputModal._flex
.inputModal__value: .inputModal__color(:style="{ background: wallet.color }")
- .inputModal__label {{ $t('wallets.form.color.label') }}
+ .inputModal__label {{ $t('wallets.form.colors.label') }}
SharedContextMenuItem(
:checkboxValue="wallet.countTotal"
@@ -182,7 +182,7 @@ export default {
)
ModalBottom(
:center="true"
- :title="$t('wallets.form.color.placeholder')"
+ :title="$t('wallets.form.colors.placeholder')"
@onClose="showColors = false"
)
.inputText
@@ -194,7 +194,7 @@ export default {
@click="handleColorSelect(color)"
v-for="color in colors")
.customColor
- .customColor__title {{ $t('wallets.form.color.custom') }}
+ .customColor__title {{ $t('wallets.form.colors.custom') }}
input.customColor__value(v-model="wallet.color" type="color")
//- currencies
@@ -204,7 +204,7 @@ export default {
)
ModalBottom(
:center="true"
- :title="$t('wallets.form.currency.placeholder')"
+ :title="$t('wallets.form.currencies.placeholder')"
@onClose="showCurrencies = false"
)
.inputText
diff --git a/components/wallets/pages/id/Edit.vue b/components/wallets/pages/id/Edit.vue
new file mode 100644
index 00000000..6ac82680
--- /dev/null
+++ b/components/wallets/pages/id/Edit.vue
@@ -0,0 +1,480 @@
+<script lang="ts">
+import generateId from '~/utils/id'
+import { allColors, popularColors } from '~/assets/js/colorsPopular'
+import { random } from '~/assets/js/emo'
+import { currencies } from '~/components/currencies/currencies'
+
+export default defineComponent({
+ setup() {
+ console.log(currencies)
+
+ const { $store } = useNuxtApp()
+ const activeTab = ref('data')
+
+ const wallet = ref({
+ color: $store.state.ui.defaultBgColor,
+ countTotal: true,
+ currency: 'RUB',
+ isCredit: false,
+ name: null,
+ order: Object.keys($store.state.wallets.items).length || 1,
+ })
+
+ function findWalletWithThisColor(color) {
+ const wallets = $store.state.wallets.items
+ if (wallets) {
+ const categoryIdWithThisColor = Object.keys($store.state.wallets.items)?.find(id => wallets[id]?.color === color)
+ if (categoryIdWithThisColor)
+ return 'mdi mdi-credit-card-multiple'
+ }
+ }
+
+ function onSelectColor(color) {
+ if (color)
+ wallet.value.color = color
+ }
+
+ return {
+ currencies,
+ wallet,
+ activeTab,
+ popularColors,
+ allColors,
+ onSelectColor,
+ findWalletWithThisColor,
+ }
+ },
+
+ data() {
+ return {
+ showColors: false,
+ showCurrencies: false,
+ }
+ },
+
+ head() {
+ return {
+ title: `${this.$t('base.edit')}: ${this.wallet.name}`,
+ }
+ },
+
+ computed: {
+ walletId() {
+ return this.$route.params.id
+ },
+ },
+
+ watch: {
+ walletId: {
+ handler(walletId) {
+ if (walletId) {
+ this.wallet = {
+ ...this.wallet,
+ ...this.$store.state.wallets.items[this.walletId],
+ }
+ }
+ },
+ immediate: true,
+ },
+ },
+
+ created() {
+ this.colors = allColors
+
+ this.colors = allColors
+ if (!this.walletId)
+ this.wallet.color = random(popularColors)
+ },
+
+ methods: {
+ handleColorSelect(color) {
+ this.wallet.color = color
+ this.showColors = false
+ },
+ handleCurrencySelect(currency) {
+ this.wallet.currency = currency
+ this.showCurrencies = false
+ },
+
+ handleSubmit() {
+ if (this.validateForm()) {
+ const id = this.walletId || generateId()
+
+ const walletsValues = {
+ color: this.wallet.color,
+ countTotal: this.wallet.countTotal,
+ currency: this.wallet.currency,
+ isCredit: this.wallet.isCredit,
+ name: this.wallet.name,
+ order: this.wallet.order,
+ }
+
+ this.$store.dispatch('wallets/addWallet', { id, values: walletsValues })
+ this.$router.replace(`/wallets/${id}`)
+ }
+ },
+
+ validateForm() {
+ const wallets = this.$store.state.wallets.items
+ // name
+ if (!this.wallet.name) {
+ this.$notify({
+ title: '😮',
+ text: this.$t('wallets.form.name.error'),
+ })
+ return false
+ }
+
+ // currency
+ if (!this.wallet.currency) {
+ this.$notify({
+ title: '😮',
+ text: this.$t('wallets.form.currencies.error'),
+ })
+ return false
+ }
+
+ for (const walletId in wallets) {
+ if (wallets[walletId].name === this.wallet.name) {
+ if (this.walletId) {
+ if (this.walletId !== walletId) {
+ this.$notify({
+ title: '😮',
+ text: this.$t('wallets.form.name.exist'),
+ })
+ return false
+ }
+ }
+ else {
+ this.$notify({
+ title: '😮',
+ text: this.$t('wallets.form.name.exist'),
+ })
+ return false
+ }
+ }
+ }
+
+ return true
+ },
+ },
+})
+</script>
+
+<template lang="pug">
+.relative.h-full.overflow.overflow-x-auto(v-if="wallet")
+ router-link(
+ v-slot='{ href, navigate }'
+ :to='`/wallets/${walletId}`'
+ custom
+ )
+ a.grow.cursor-pointer.block.py-5.pb-5.mb-4.px-3.font-nunito.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
+ :href='href'
+ @click='navigate'
+ )
+ .pb-1.text-xs.font-medium(class="text-white/50") {{ $t('wallets.editTitle') }}
+
+ .flex.items-center.gap-3
+ .text-neutral-800.dark_text-white.text-2xl.font-semibold {{ wallet.name }}
+ .p-1.px-1.rounded.flex-center.text-2xs.text-neutral-50(
+ :style="{ background: wallet.color }"
+ ) {{ wallet.currency }}
+
+ //- Menu
+ //-----------------------------------
+ .px-3.pb-4
+ .overflow-hidden.rounded-md.scrollbar.mb-4.bg-gray-50.dark_bg-dark4.dark_shadow
+ .overflow-hidden.overflow-x-auto.flex.items-center.text-sm.text-center.max-w-md
+ .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ :class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': activeTab === 'data' }"
+ @click="activeTab = 'data'"
+ ) {{ $t('categories.form.data.label') }}
+
+ .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ :class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': activeTab === 'currencies' }"
+ @click="activeTab = 'currencies'"
+ ) {{ $t('wallets.form.currencies.label') }}
+
+ .cursor-pointer.px-6.py-3.grow.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ :class="{ '_active cursor-default text-blue3 dark_text-blue1 bg-gray-100 dark_bg-232323': activeTab === 'colors' }"
+ @click="activeTab = 'colors'"
+ ) {{ $t('categories.form.colors.label') }}
+
+ //- Content
+ //-----------------------------------
+ .px-3.max-w-md
+
+ //- Data
+ //-----------------------------------
+ template(v-if="activeTab === 'data'")
+ .mb-4
+ .inputText
+ .inputText__label {{ $t('wallets.form.name.label') }}
+ input(
+ type="text"
+ :placeholder="$t('wallets.form.name.placeholder')"
+ v-model="wallet.name"
+ ).inputText__value
+
+ 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"
+ )
+
+ //- Currencies
+ //-----------------------------------
+ template(v-if="activeTab === 'currencies'")
+ div
+ .border-b.border-gray-50.dark_border-neutral-800.p-3.hocus_bg-gray-200.dark_hocus_bg-neutral-800(
+ v-for="(item, currency) in $store.state.currencies.rates"
+ :key="item"
+ :class="{ '_active cursor-default text-blue3 dark_text-blue1': wallet.currency === currency }"
+ @click="handleCurrencySelect(currency)"
+ )
+ .flex.items-center
+ template(v-if="currencies.find(c => c.code === currency)")
+ .grow {{ currencies.find(c => c.code === currency).currency }}
+ div {{ currency }}
+
+ template(v-else)
+ .grow
+ div {{ currency }}
+
+ //- Colors
+ //---------------------------------
+ template(v-if="activeTab === 'colors'")
+ .form
+ .subTitle {{ $t('popularColors') }}
+ .colors
+ .iconItem(
+ v-for="(color, idx) in popularColors"
+ :key="idx"
+ :class="{ _active: color === wallet.color }"
+ :style="{ background: color === wallet.color ? color : 'transparent' }"
+ @click="onSelectColor(color)"
+ )
+ template(v-if="color")
+ template(v-if="findWalletWithThisColor(color)")
+ Icon(
+ icon="mdi mdi-credit-card-multiple"
+ :color="color === wallet.color ? null : color"
+ big
+ )
+ template(v-else-if="color === wallet.color")
+ Icon(
+ icon="mdi mdi-credit-card-multiple"
+ background="transparent"
+ big
+ )
+ template(v-else)
+ .colorPreview(:style="{ background: color }")
+
+ .subTitle {{ $t('palette') }}
+ .colors
+ .iconItem(
+ v-for="(color, idx) in allColors"
+ :key="idx"
+ :class="{ _active: color === wallet.color, _empty: !color }"
+ :style="{ background: color === wallet.color ? color : 'transparent' }"
+ @click="onSelectColor(color)"
+ )
+
+ template(v-if="color")
+ template(v-if="findWalletWithThisColor(color)")
+ Icon(
+ icon="mdi mdi-credit-card-multiple"
+ :color="color === wallet.color ? null : color"
+ big
+ )
+ template(v-else-if="color === wallet.color")
+ Icon(
+ icon="mdi mdi-credit-card-multiple"
+ background="transparent"
+ big
+ )
+ template(v-else)
+ .colorPreview(:style="{ background: color }")
+
+ .subTitle {{ $t('categories.form.colors.custom') }}
+ .customColor
+ input.customColor__value(v-model="wallet.color" type="color")
+
+ .pt-4.pb-6
+ SharedButton(
+ :class="['_text-center _blue2 _ml-big', { _inline: $store.state.ui.pc }]"
+ :title="$t('wallets.form.save')"
+ @onClick="handleSubmit()"
+ )
+</template>
+
+<style lang="stylus" scoped>
+.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
+
+.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 48px
+ margin 0
+ padding 0
+ background none
+ border 0
+ border-radius $borderRadiusMd
+
+.form__actions
+ @media $media-phone
+ text-align center
+
+.form__btns
+ display grid
+ grid-template-columns repeat(2, 1fr)
+ grid-column-gap $m9
+ grid-row-gap $m9
+ padding-bottom $m9
+
+ +media-laptop()
+ grid-column-gap $m10
+ grid-row-gap $m10
+
+ &__i._full
+ grid-column 1 / -1
+
+.inputModal
+ &._flex
+ flex 1
+ display flex
+ align-items center
+ justify-content space-between
+
+ &__content
+ display flex
+
+ &__label
+ margin 0
+ padding 0
+ font-size 10px
+
+.currencies
+ display grid
+ grid-template-columns repeat(auto-fill, minmax(120px, 1fr))
+ grid-column-gap $m7
+ grid-row-gap $m7
+
+ &__item
+ cursor pointer
+ display flex
+ align-items center
+ justify-content center
+ height 44px
+ padding $m6
+ text-align center
+ border 1px solid var(--c-bg-6)
+ border-radius $m4
+
+ +media-hover()
+ &:not(._active)
+ background var(--c-bg-6)
+
+ &._active
+ cursor default
+ color var(--c-font-1)
+ background var(--c-blue-1)
+ border none
+
+.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
+
+.iconItem
+ display flex
+ align-items center
+ justify-content center
+ width 40px
+ height 40px
+ max-width 40px
+ max-height 40px
+ padding 4px
+ font-size 24px
+ border-radius 50%
+
+ +media-hover()
+ &:not(._empty)
+ cursor pointer
+ background var(--c-item-bd-hover)
+
+ &._active
+ padding 0
+ background var(--c-item-bd-hover)
+
+.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 48px
+ margin 0
+ padding 0
+ background none
+ border 0
+ border-radius $borderRadiusMd
+</style>
+
+<i18n lang="json5">
+{
+ "en": {
+ "isCredit": "Credit account"
+ },
+ "ru": {
+ "isCredit": "Кредитный счёт"
+ }
+}
+</i18n>
diff --git a/components/wallets/pages/id/Index.vue b/components/wallets/pages/id/Index.vue
new file mode 100644
index 00000000..19a48e4d
--- /dev/null
+++ b/components/wallets/pages/id/Index.vue
@@ -0,0 +1,154 @@
+<script setup lang="ts">
+import { removeData } from '~/services/firebase/api'
+import useFilter from '~/modules/filter/useFilter'
+import { getTrnsIds } from '~/components/trns/functions/getTrns'
+
+const { $store } = useNuxtApp()
+const { setFilterWalletsId } = useFilter()
+
+const route = useRoute()
+const router = useRouter()
+
+const walletId = computed(() => route.params.id)
+const wallet = computed(() => $store.state.wallets.items[walletId.value])
+if (!wallet.value)
+ router.replace('/wallets')
+
+const trnsItems = computed(() => $store.state.trns.items)
+const total = computed(() => $store.getters['wallets/walletsTotal'][walletId.value].base)
+
+const filter = reactive({ trnType: null })
+const trnsIds = computed(() =>
+ getTrnsIds({
+ walletsIds: [walletId.value],
+ trnType: filter.trnType,
+ trnsItems: trnsItems.value,
+ }))
+
+const filteredTrnsIds = computed(() => $store.getters['trns/selectedTrnsIdsWithDate'].filter(trnId => $store.state.trns.items[trnId].walletId === walletId.value))
+
+const showModalConfirm = ref(false)
+const deleteInfo = computed(() => {
+ if (trnsIds.value.length > 0)
+ return `It's also will delete ${trnsIds.value.length} trns in this wallet`
+ return false
+})
+
+function handleSetFilterWallet() {
+ setFilterWalletsId(walletId.value)
+ $store.commit('filter/setFilterDateNow')
+ $store.dispatch('ui/setActiveTabStat', 'details')
+}
+
+function handleEditClick() {
+ router.push(`/wallets/${walletId.value}/edit`)
+}
+
+function handleDeleteClick() {
+ showModalConfirm.value = true
+}
+
+function handleDeleteConfirm() {
+ const uid = $store.state.user.user.uid
+ const id = JSON.parse(JSON.stringify(walletId.value))
+ const trnsIdsForDelete = JSON.parse(JSON.stringify(trnsIds.value))
+
+ showModalConfirm.value = false
+ router.replace('/wallets')
+
+ setTimeout(async() => {
+ await $store.dispatch('trns/deleteTrnsByIds', trnsIdsForDelete)
+ removeData(`users/${uid}/accounts/${id}`)
+ .then(() => console.log('wallet deleted'))
+ }, 200)
+}
+</script>
+
+<script lang="ts">
+export default defineComponent({
+ head() {
+ return {
+ title: `${this.$t('wallets.title')}: ${this.wallet.name}`,
+ }
+ },
+})
+</script>
+
+<template lang="pug">
+.relative.h-full.overflow-y-auto(v-if="wallet")
+ router-link(
+ v-slot='{ href, navigate }'
+ to='/wallets'
+ custom
+ )
+ .flex.items-start
+ a.grow.cursor-pointer.block.py-5.mb-3.px-3.font-nunito.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
+ :href='href'
+ @click='navigate'
+ )
+ .pb-2.text-xs.font-medium(class="text-white/50") {{ $t('wallets.title') }}
+
+ .flex.items-center.gap-3.pb-3
+ .text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold {{ wallet.name }}
+ .p-1.px-1.rounded.flex-center.text-2xs.text-neutral-50(
+ :style="{ background: wallet.color }"
+ ) {{ wallet.currency }}
+
+ .flex
+ Amount(
+ :currency="wallet.currency"
+ :value="total"
+ showBase
+ size="lg"
+ vertical="right"
+ )
+
+ .mdi.mdi-pencil-outline.cursor-pointer.rounded-full.mt-3.mr-2.w-16.h-16.flex-center.text-2xl.p-4.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
+ @click="handleEditClick"
+ )
+
+ .pb-6
+ .px-3.flex
+ .cursor-pointer.p-1.px-3.flex.items-center.gap-3.bg-gray-50.dark_bg-dark4.rounded-md.hocus_bg-gray-100.dark_hocus_bg-neutral-800.shadow.hocus_shadow-lg(
+ class="dark_text-white/60"
+ @click="handleSetFilterWallet"
+ )
+ .mdi.mdi-poll.text-xl
+ .text-xs.leading-none {{ $t('statBy') }}: {{ wallet.name }}
+ .mdi.mdi-chevron-right.opacity-70.text-lg.leading-none
+
+ //- Stat
+ .overflow-hidden.relative.bg-white.dark_bg-custom4.mx-3.mb-12.p-3.rounded-md
+ SharedDate.text-xs.font-medium(class="-mb-1 text-white/50")
+ div(class="-mb-3")
+ StatGroupSum2(
+ :trnsIds="filteredTrnsIds"
+ )
+
+ //- History
+ .px-3
+ TrnsHistory(
+ :trnsIds="trnsIds"
+ :trnType="filter.trnType"
+ @setFilterTrnType="value => filter.trnType = value"
+ )
+
+ //- Delete?
+ ModalBottomConfirm(
+ :show="showModalConfirm"
+ :description="deleteInfo"
+ @onClose="showModalConfirm = false"
+ @onConfirm="handleDeleteConfirm"
+ )
+</template>
+
+<i18n lang="json5">
+{
+ "en": {
+ "statBy": "Statistics",
+ },
+ "ru": {
+ "statBy": "Статистика",
+ },
+}
+</i18n>
diff --git a/locales/en-US.js b/locales/en-US.js
index 24bf83c3..e38909ef 100644
--- a/locales/en-US.js
+++ b/locales/en-US.js
@@ -146,13 +146,13 @@ export default {
error: 'Write wallet name',
exist: 'Wallet with same name is exist',
},
- color: {
+ colors: {
label: 'Color',
placeholder: 'Select color',
error: 'Select color',
custom: 'Custom color',
},
- currency: {
+ currencies: {
label: 'Currency',
placeholder: 'Select currency',
error: 'Select currency',
@@ -191,7 +191,7 @@ export default {
label: 'Parent category',
placeholder: 'Select parent category',
},
- color: {
+ colors: {
label: 'Colors',
custom: 'Custom color',
},
diff --git a/locales/ru-RU.js b/locales/ru-RU.js
index 09d41f71..fb0f45d0 100644
--- a/locales/ru-RU.js
+++ b/locales/ru-RU.js
@@ -73,7 +73,7 @@ export default {
madeBy: {
text: 'Разработал',
name: 'Илья Комичев',
- }
+ },
},
userLogout: 'Выход',
@@ -129,7 +129,7 @@ export default {
customize: 'Внешний вид',
app: 'Приложение',
caution: 'C осторожностью',
- deleteButton: 'Удалить все мои данные'
+ deleteButton: 'Удалить все мои данные',
},
wallets: {
@@ -148,13 +148,13 @@ export default {
error: 'Напишите имя кошелька',
exist: 'Кошелек с таким именем уже существует',
},
- color: {
+ colors: {
label: 'Цвет',
placeholder: 'Выберите цвет',
error: 'Выберите цвет',
custom: 'Кастомный цвет',
},
- currency: {
+ currencies: {
label: 'Валюта',
placeholder: 'Выберите валюту',
error: 'Выберите валюту',
@@ -193,7 +193,7 @@ export default {
label: 'Категория',
placeholder: 'Выберите категрию',
},
- color: {
+ colors: {
label: 'Цвета',
custom: 'Кастомный цвет',
},
diff --git a/package.json b/package.json
index e8d2ba3b..fc3df3dc 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "finapp",
- "version": "3.5.0",
+ "version": "3.5.1",
"scripts": {
"dev": "cross-env NUXT_HOST=0.0.0.0 PORT=3010 nuxi dev",
"build": "nuxi generate",
diff --git a/pages/categories/_id/edit.vue b/pages/categories/_id/edit.vue
new file mode 100644
index 00000000..ab5c9516
--- /dev/null
+++ b/pages/categories/_id/edit.vue
@@ -0,0 +1,3 @@
+<template lang="pug">
+CategoriesPagesIdEdit
+</template>
diff --git a/pages/categories/_id/index.vue b/pages/categories/_id/index.vue
index 5cc52620..98cc70bc 100644
--- a/pages/categories/_id/index.vue
+++ b/pages/categories/_id/index.vue
@@ -1,120 +1,3 @@
-<script setup lang="ts">
-import useFilter from '~/modules/filter/useFilter'
-import { getTrnsIds } from '~/components/trns/functions/getTrns'
-
-const { $store } = useNuxtApp()
-const { setFilterCatsId } = useFilter()
-
-const route = useRoute()
-const router = useRouter()
-
-const categoryId = computed(() => route.params.id)
-const category = computed(() => $store.state.categories.items[categoryId.value])
-if (!category.value)
- router.replace('/categories')
-
-const trnsItems = computed(() => $store.state.trns.items)
-const backLink = computed(() => category.value?.parentId ? `/categories/${category.value.parentId}` : '/categories')
-
-const filter = reactive({ trnType: null })
-
-const categoryChildIds = computed(() => category.value.childIds?.sort((a, b) => {
- if ($store.state.categories.items[a].name < $store.state.categories.items[b].name) return -1
- if ($store.state.categories.items[a].name > $store.state.categories.items[b].name) return 1
- return 0
-}))
-
-const trnsIds = computed(() =>
- getTrnsIds({
- categoriesIds: category.value?.childIds ? category.value?.childIds : [categoryId.value],
- trnType: filter.trnType,
- trnsItems: trnsItems.value,
- }))
-
-function handleSetFilterCategory() {
- setFilterCatsId(categoryId.value)
- $store.commit('filter/setFilterDateNow')
- $store.dispatch('ui/setActiveTabStat', 'details')
-}
-
-function handleEditClick() {
- $store.commit('categories/setCategoryEditId', categoryId.value)
- $store.dispatch('ui/setActiveTab', 'createCategory')
-}
-</script>
-
<template lang="pug">
-.h-full.overflow.overflow-x-auto(v-if="category")
- router-link(
- v-slot='{ href, navigate }'
- :to='backLink'
- custom
- )
- .flex.items-start
- a.grow.cursor-pointer.block.py-5.mb-3.px-3.font-nunito.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
- :href='href'
- @click='navigate'
- )
- .pb-2.text-2xs.font-medium(class="text-white/50")
- | {{ $t('categories.title') }}
- template(v-if="category.parentId")
- |
- | • {{ $store.state.categories.items[category.parentId].name }}
-
- .pb-0.flex.items-center.gap-3
- .text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold {{ category.name }}
- .w-6.h-6.rounded-full.flex-center.text-sm.text-neutral-50(
- :style="{ background: category.color }"
- )
- div(:class="category.icon")
-
- .mdi.mdi-pencil-outline.cursor-pointer.rounded-full.mt-3.mr-2.w-16.h-16.flex-center.text-2xl.p-4.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
- @click="handleEditClick"
- )
-
- .pb-12
- .px-4.flex
- .cursor-pointer.p-1.px-3.flex.items-center.gap-3.bg-gray-50.dark_bg-dark4.rounded-md.hocus_bg-gray-100.dark_hocus_bg-neutral-800.shadow.hocus_shadow-lg(
- class="dark_text-white/60"
- @click="handleSetFilterCategory"
- )
- .mdi.mdi-poll.text-xl
- .text-xs.leading-none {{ $t('statBy') }} {{ category.name }}
- .mdi.mdi-chevron-right.opacity-70.text-lg.leading-none
-
- //- Childs categories
- .pb-12(v-if="category.childIds && category.childIds.length > 0")
- .statTitle.flex.gap-2.px-3(class="!pb-3")
- div {{ $t('categories.title') }}:
- div {{ category.childIds.length }}
-
- .px-3
- CategoriesView(
- :ids="categoryChildIds"
- :slider="() => ({})"
- isHideParentCategory
- borderTop
- noPadding
- @onClick="id => $router.push(`/categories/${id}`)"
- )
-
- //- History
- .px-3
- TrnsHistory(
- :trnsIds="trnsIds"
- :trnType="filter.trnType"
- hideTransfers
- @setFilterTrnType="value => filter.trnType = value"
- )
+CategoriesPagesId
</template>
-
-<i18n lang="json5">
-{
- "en": {
- "statBy": "Statistics: ",
- },
- "ru": {
- "statBy": "Статистика: ",
- },
-}
-</i18n>
diff --git a/pages/categories/index.vue b/pages/categories/index.vue
index 6be377c7..10e1b116 100644
--- a/pages/categories/index.vue
+++ b/pages/categories/index.vue
@@ -20,7 +20,7 @@ export default defineComponent({
<template lang="pug">
.h-full.overflow.overflow-x-auto
- .py-6.pb-8.px-4.font-nunito.text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold
+ .py-6.px-3.font-nunito.text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold
| {{ $t('categories.name') }}
.pb-4
@@ -38,7 +38,7 @@ export default defineComponent({
@onClick="id => $router.push(`/categories/${category.id}`)"
)
- .pb-4.px-4.flex.gap-4.pt-4
+ .pb-4.px-3.flex.gap-4.pt-4
.button(@click="$store.dispatch('ui/setActiveTab', 'createCategory')") {{ $t('categories.new') }}
</template>
diff --git a/pages/history.vue b/pages/history.vue
index 3832f812..7e14be29 100644
--- a/pages/history.vue
+++ b/pages/history.vue
@@ -1,64 +1,3 @@
-<script setup lang="ts">
-import useStatPage from '~/components/stat/useStatPage'
-import { getTrnsIds } from '~/components/trns/functions/getTrns'
-
-const { $store } = useNuxtApp()
-const { statPage } = useStatPage()
-const catsItems = computed(() => $store.state.categories.items)
-const trnsItems = computed(() => $store.state.trns.items)
-const storeFilter = computed(() => $store.state.filter)
-const filterTrnType = ref(null)
-
-// TODO: shared functions
-function getCatsIds(catsIds) {
- const ids = []
-
- for (const catId of catsIds) {
- const category = catsItems.value[catId]
- category?.childIds
- ? ids.push(...category.childIds)
- : ids.push(catId)
- }
-
- return ids
-}
-
-const trnsIds = computed(() => {
- const categoriesIds = storeFilter.value.catsIds.length > 0 ? getCatsIds(storeFilter.value.catsIds) : null
- const walletsIds = storeFilter.value.walletsIds.length > 0 ? storeFilter.value.walletsIds : null
-
- return getTrnsIds({
- categoriesIds,
- walletsIds,
- trnType: filterTrnType.value,
- trnsItems: trnsItems.value,
- })
-})
-</script>
-
-<script lang="ts">
-export default defineComponent({
- head() {
- return {
- title: this.$t('trns.history'),
- }
- },
-})
-</script>
-
<template lang="pug">
-.h-full.overflow.overflow-x-auto
- .py-6.px-3.font-nunito.text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold
- | {{ $t('trns.history') }}
-
- .px-3
- .pb-8(v-if="statPage.filter.isShow")
- LazyStatFilter
-
- //- History
- TrnsHistory(
- :trnsIds="trnsIds"
- :trnType="filterTrnType"
- @setFilterTrnType="value => filterTrnType = value"
- )
+TrnsPagesHistory
</template>
diff --git a/pages/wallets/_id/edit.vue b/pages/wallets/_id/edit.vue
index ebcd9183..1d002280 100644
--- a/pages/wallets/_id/edit.vue
+++ b/pages/wallets/_id/edit.vue
@@ -1,323 +1,3 @@
-<script>
-import generateId from '~/utils/id'
-import colors from '~/assets/js/colors'
-
-export default {
- data() {
- return {
- showColors: false,
- showCurrencies: false,
- wallet: {
- color: this.$store.state.ui.defaultBgColor,
- countTotal: true,
- currency: 'RUB',
- isCredit: false,
- name: null,
- order: Object.keys(this.$store.state.wallets.items).length || 1,
- },
- }
- },
-
- computed: {
- walletId() {
- return this.$route.params.id
- },
- },
-
- watch: {
- walletId: {
- handler(walletId) {
- if (walletId) {
- this.wallet = {
- ...this.wallet,
- ...this.$store.state.wallets.items[this.walletId],
- }
- }
- },
- immediate: true,
- },
- },
-
- created() {
- this.colors = colors
- if (!this.walletId)
- this.wallet.color = colors[Math.floor(Math.random() * colors.length)]
- },
-
- methods: {
- handleColorSelect(color) {
- this.wallet.color = color
- this.showColors = false
- },
- handleCurrencySelect(currency) {
- this.wallet.currency = currency
- this.showCurrencies = false
- },
-
- handleSubmit() {
- if (this.validateForm()) {
- const id = this.walletId || generateId()
-
- const walletsValues = {
- color: this.wallet.color,
- countTotal: this.wallet.countTotal,
- currency: this.wallet.currency,
- isCredit: this.wallet.isCredit,
- name: this.wallet.name,
- order: this.wallet.order,
- }
-
- this.$store.dispatch('wallets/addWallet', { id, values: walletsValues })
- this.$router.replace(`/wallets/${id}`)
- }
- },
-
- validateForm() {
- const wallets = this.$store.state.wallets.items
- // name
- if (!this.wallet.name) {
- this.$notify({
- title: '😮',
- text: this.$t('wallets.form.name.error'),
- })
- return false
- }
-
- // currency
- if (!this.wallet.currency) {
- this.$notify({
- title: '😮',
- text: this.$t('wallets.form.currency.error'),
- })
- return false
- }
-
- for (const walletId in wallets) {
- if (wallets[walletId].name === this.wallet.name) {
- if (this.walletId) {
- if (this.walletId !== walletId) {
- this.$notify({
- title: '😮',
- text: this.$t('wallets.form.name.exist'),
- })
- return false
- }
- }
- else {
- this.$notify({
- title: '😮',
- text: this.$t('wallets.form.name.exist'),
- })
- return false
- }
- }
- }
-
- return true
- },
- },
-}
-</script>
-
<template lang="pug">
-.h-full.overflow.overflow-x-auto
- .relative(v-if="wallet")
- router-link(
- v-slot='{ href, navigate }'
- :to='`/wallets/${walletId}`'
- custom
- )
- a.grow.cursor-pointer.block.py-5.pb-5.mb-4.px-3.font-nunito.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
- :href='href'
- @click='navigate'
- )
- .pb-1.text-xs.font-medium(class="text-white/50") {{ $t('wallets.editTitle') }}
-
- .flex.items-center.gap-3
- .text-neutral-800.dark_text-white.text-2xl.font-semibold {{ wallet.name }}
-
- .form.px-3.py-5(class="max-w-[400px]")
- .mb-4
- .inputText
- .inputText__label {{ $t('wallets.form.name.label') }}
- input(
- type="text"
- :placeholder="$t('wallets.form.name.placeholder')"
- v-model="wallet.name"
- ).inputText__value
-
- //- Currensies
- .cursor-pointer.mb-4.p-2.px-3.flex.items-center.gap-4.text-sm.bg-dark4.rounded-md.hocus_bg-gray-100.dark_hocus_bg-neutral-800.shadow.hocus_shadow-lg(
- class="text-white/60"
- @click="showCurrencies = true"
- )
- .mdi.mdi-currency-sign.text-2xl
- .grow.leading-none {{ $t('wallets.form.currency.label') }}
- .leading-none {{ wallet.currency }}
- .mdi.mdi-dots-vertical.opacity-70.text-lg.leading-none
-
- //- Colors
- .cursor-pointer.mb-2.p-2.px-3.flex.items-center.gap-4.text-sm.bg-dark4.rounded-md.hocus_bg-gray-100.dark_hocus_bg-neutral-800.shadow.hocus_shadow-lg(
- class="text-white/60"
- @click="showColors = true"
- )
- .mdi.mdi-palette.text-2xl
- .grow.leading-none {{ $t('wallets.form.color.label') }}
- .w-5.h-5.rounded-full(:style="{ background: wallet.color }")
- .mdi.mdi-dots-vertical.opacity-70.text-lg.leading-none
-
- 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"
- )
-
- .pt-4
- SharedButton(
- :class="['_text-center _blue2', { _inline: $store.state.ui.pc }]"
- :title="$t('wallets.form.save')"
- @onClick="handleSubmit")
-
- //- colors
- Portal(
- v-if="showColors"
- to="modal"
- )
- ModalBottom(
- :center="true"
- :title="$t('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 {{ $t('wallets.form.color.custom') }}
- input.customColor__value(v-model="wallet.color" type="color")
-
- //- currencies
- Portal(
- v-if="showCurrencies"
- to="modal"
- )
- ModalBottom(
- :center="true"
- :title="$t('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 }}
+WalletsPagesIdEdit
</template>
-
-<style lang="stylus" scoped>
-.customColor
- margin (- $m7)
- margin-top 0
- padding $m7
- background var(--c-bg-1)
-
- @media $media-laptop
- margin (- $m9)
- margin-top 0
- padding $m9
-
- &__title
- padding-bottom $m6
- color var(--c-font-4)
-
- &__value
- width 100%
- height 40px
- margin 0
- padding 0
- border 0
-
-.form__actions
- @media $media-phone
- text-align center
-
-.form__btns
- display grid
- grid-template-columns repeat(2, 1fr)
- grid-column-gap $m9
- grid-row-gap $m9
- padding-bottom $m9
-
- +media-laptop()
- grid-column-gap $m10
- grid-row-gap $m10
-
- &__i._full
- grid-column 1 / -1
-
-.inputModal
- &._flex
- flex 1
- display flex
- align-items center
- justify-content space-between
-
- &__content
- display flex
-
- &__label
- margin 0
- padding 0
- font-size 10px
-
-.currencies
- display grid
- grid-template-columns repeat(auto-fill, minmax(120px, 1fr))
- grid-column-gap $m7
- grid-row-gap $m7
-
- &__item
- cursor pointer
- display flex
- align-items center
- justify-content center
- height 44px
- padding $m6
- text-align center
- border 1px solid var(--c-bg-6)
- border-radius $m4
-
- +media-hover()
- &:not(._active)
- background var(--c-bg-6)
-
- &._active
- cursor default
- color var(--c-font-1)
- background var(--c-blue-1)
- border none
-</style>
-
-<i18n lang="json5">
-{
- "en": {
- "isCredit": "Credit account"
- },
- "ru": {
- "isCredit": "Кредитный счёт"
- }
-}
-</i18n>
diff --git a/pages/wallets/_id/index.vue b/pages/wallets/_id/index.vue
index 1909034e..d8c80ded 100644
--- a/pages/wallets/_id/index.vue
+++ b/pages/wallets/_id/index.vue
@@ -1,154 +1,3 @@
-<script setup lang="ts">
-import { removeData } from '~/services/firebase/api'
-import useFilter from '~/modules/filter/useFilter'
-import { getTrnsIds } from '~/components/trns/functions/getTrns'
-
-const { $store } = useNuxtApp()
-const { setFilterWalletsId } = useFilter()
-
-const route = useRoute()
-const router = useRouter()
-
-const walletId = computed(() => route.params.id)
-const wallet = computed(() => $store.state.wallets.items[walletId.value])
-if (!wallet.value)
- router.replace('/wallets')
-
-const trnsItems = computed(() => $store.state.trns.items)
-const total = computed(() => $store.getters['wallets/walletsTotal'][walletId.value].base)
-
-const filter = reactive({ trnType: null })
-const trnsIds = computed(() =>
- getTrnsIds({
- walletsIds: [walletId.value],
- trnType: filter.trnType,
- trnsItems: trnsItems.value,
- }))
-
-const filteredTrnsIds = computed(() => $store.getters['trns/selectedTrnsIdsWithDate'].filter(trnId => $store.state.trns.items[trnId].walletId === walletId.value))
-
-const showModalConfirm = ref(false)
-const deleteInfo = computed(() => {
- if (trnsIds.value.length > 0)
- return `It's also will delete ${trnsIds.value.length} trns in this wallet`
- return false
-})
-
-function handleSetFilterWallet() {
- setFilterWalletsId(walletId.value)
- $store.commit('filter/setFilterDateNow')
- $store.dispatch('ui/setActiveTabStat', 'details')
-}
-
-function handleEditClick() {
- router.push(`/wallets/${walletId.value}/edit`)
-}
-
-function handleDeleteClick() {
- showModalConfirm.value = true
-}
-
-function handleDeleteConfirm() {
- const uid = $store.state.user.user.uid
- const id = JSON.parse(JSON.stringify(walletId.value))
- const trnsIdsForDelete = JSON.parse(JSON.stringify(trnsIds.value))
-
- showModalConfirm.value = false
- router.replace('/wallets')
-
- setTimeout(async() => {
- await $store.dispatch('trns/deleteTrnsByIds', trnsIdsForDelete)
- removeData(`users/${uid}/accounts/${id}`)
- .then(() => console.log('wallet deleted'))
- }, 200)
-}
-</script>
-
-<script lang="ts">
-export default defineComponent({
- head() {
- return {
- title: `${this.$t('wallets.title')}: ${this.wallet.name}`,
- }
- },
-})
-</script>
-
<template lang="pug">
-.relative.h-full.overflow-y-auto(v-if="wallet")
- router-link(
- v-slot='{ href, navigate }'
- to='/wallets'
- custom
- )
- .flex.items-start
- a.grow.cursor-pointer.block.py-5.mb-3.px-3.font-nunito.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
- :href='href'
- @click='navigate'
- )
- .pb-2.text-xs.font-medium(class="text-white/50") {{ $t('wallets.title') }}
-
- .pb-3.flex.items-center.gap-3
- .text-neutral-800.dark_text-white.text-2xl.leading-none.font-semibold {{ wallet.name }}
- .p-1.px-1.rounded.flex-center.text-2xs.text-neutral-50(
- :style="{ background: wallet.color }"
- ) {{ wallet.currency }}
-
- .flex
- Amount(
- :currency="wallet.currency"
- :value="total"
- showBase
- size="lg"
- vertical="right"
- )
-
- .mdi.mdi-pencil-outline.cursor-pointer.rounded-full.mt-3.mr-2.w-16.h-16.flex-center.text-2xl.p-4.hocus_bg-gray-100.dark_hocus_bg-neutral-800(
- @click="handleEditClick"
- )
-
- .pb-6
- .px-3.flex
- .cursor-pointer.p-1.px-3.flex.items-center.gap-3.bg-gray-50.dark_bg-dark4.rounded-md.hocus_bg-gray-100.dark_hocus_bg-neutral-800.shadow.hocus_shadow-lg(
- class="dark_text-white/60"
- @click="handleSetFilterWallet"
- )
- .mdi.mdi-poll.text-xl
- .text-xs.leading-none {{ $t('statBy') }}: {{ wallet.name }}
- .mdi.mdi-chevron-right.opacity-70.text-lg.leading-none
-
- //- Stat
- .overflow-hidden.relative.bg-white.dark_bg-custom4.mx-3.mb-12.p-3.rounded-md
- SharedDate.text-xs.font-medium(class="-mb-1 text-white/50")
- div(class="-mb-3")
- StatGroupSum2(
- :trnsIds="filteredTrnsIds"
- )
-
- //- History
- .px-3
- TrnsHistory(
- :trnsIds="trnsIds"
- :trnType="filter.trnType"
- @setFilterTrnType="value => filter.trnType = value"
- )
-
- //- Delete?
- ModalBottomConfirm(
- :show="showModalConfirm"
- :description="deleteInfo"
- @onClose="showModalConfirm = false"
- @onConfirm="handleDeleteConfirm"
- )
+WalletsPagesId
</template>
-
-<i18n lang="json5">
-{
- "en": {
- "statBy": "Statistics",
- },
- "ru": {
- "statBy": "Статистика",
- },
-}
-</i18n>
diff --git a/tailwind.config.js b/tailwind.config.js
index e2395a60..0d09e176 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -14,7 +14,7 @@ module.exports = {
theme: {
extend: {
colors: {
- '232323': '#232323',
+ 232323: '#232323',
blue1: '#58a6ff',
blue2: '#0366d6',
blue3: '#3a7dff',