Skip to content

Commit

Permalink
chore(RED-13): ajustes menores
Browse files Browse the repository at this point in the history
  • Loading branch information
sombriks committed Sep 10, 2023
1 parent f92e850 commit 3a379e9
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 22 deletions.
2 changes: 0 additions & 2 deletions service-node-koa/app/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import {
removeMovimentacaoRequest,
updateMovimentacaoRequest,
insertMovimentacaoRequest,
novaSaidaRequest,
novaEntradaRequest,
findMovimentacaoRequest,
listMovimentacaoRequest,
listPlanejamentoRequest,
Expand Down
2 changes: 1 addition & 1 deletion service-node-koa/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import { dbMigrate } from "./app/config/db/index.mjs";
console.log(`starting service in [${process.env.NODE_ENV}] mode`)
dbMigrate().then(() => app.listen(process.env.PORT || 3000))

console.log("http://localhost:3000")
console.log(`Listening on ${process.env.PORT || 3000}`)
// open to business
5 changes: 3 additions & 2 deletions web-app-vue/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<script setup>
import { useUserStore } from "@/stores/userStore";
import { ref } from "vue";
import { router } from "@/routes/router";
const userStore = useUserStore()
const menu = [
{ label: 'Nova movimentação', icon: 'mdi-currency-usd', path: '/nova-movimentacao' },
{ label: 'Contas', icon: 'mdi-card-account-details', path: '/contas' },
{ label: 'Categorias', icon: 'mdi-playlist-check', path: '/categorias' },
{ label: 'Histórico', icon: 'mdi-clipboard-text-search-outline', path: '/movimentacoes' },
{ label: 'Histórico', icon: 'mdi-clipboard-text-search-outline', path: '/historico' },
{ label: 'Planejamento', icon: 'mdi-clipboard-edit-outline', path: '/planejamento' },
{ label: 'Recorrências', icon: 'mdi-history', path: '/recorrencias' },
{ label: 'Configurações', icon: 'mdi-cog-outline', path: '/config' },
Expand All @@ -25,7 +26,7 @@ const show = ref(false)
</v-app-bar>
<v-navigation-drawer v-if="userStore.store.token" v-model="show">
<v-list>
<v-list-item v-for="m in menu" :key="m.label">
<v-list-item v-for="m in menu" :key="m.label" :active="m.path == $route.path">
<template v-slot:prepend>
<v-icon color="red-lighten-3" :icon="m.icon"></v-icon>
</template>
Expand Down
33 changes: 20 additions & 13 deletions web-app-vue/src/components/movimentacao/nova-movimentacao.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@
item-title="descricao"
item-value="id"
label="Conta"
@change="verificaConta"
chips
>
<template v-slot:chip="{ props, item }">
<chip-conta v-bind="props" :conta="item.raw" :color="item.raw.cor"></chip-conta>
</template>
<template v-slot:item="{props, item}">
<v-list-item>
<chip-conta class="ma-2" v-bind="props" :conta="item.raw" :color="item.raw.cor"></chip-conta>
</v-list-item>
</template>
</v-autocomplete>
</v-row>
<v-row align="center">
Expand All @@ -49,7 +53,12 @@
label="Categoria"
chips>
<template v-slot:chip="{ props, item }">
<v-chip v-bind="props" variant="outlined" rounded :color="item.raw.cor"></v-chip>
<v-chip v-bind="props" variant="outlined" rounded :color="item.raw.cor">{{item.raw.descricao}}</v-chip>
</template>
<template v-slot:item="{props, item}">
<v-list-item>
<v-chip class="ma-2" v-bind="props" variant="outlined" rounded :color="item.raw.cor">{{item.raw.descricao}}</v-chip>
</v-list-item>
</template>
</v-autocomplete>
</v-row>
Expand Down Expand Up @@ -93,7 +102,7 @@
</template>
<script setup>
import { useMovimentacaoStore } from '@/stores/movimentacaoStore'
import { onMounted, reactive, ref } from 'vue'
import { onMounted, reactive, ref, watch } from "vue";
import { useContaStore } from '@/stores/contaStore'
import { useCategoriaStore } from '@/stores/categoriaStore'
import { numberRule, requiredRule } from '@/form-rules/basic-rules'
Expand Down Expand Up @@ -127,17 +136,15 @@ const sync = async () => {
await movimentacaoState.sincronizarMovimentacoes()
}
const verificaConta = () => {
if(novaMovimentacao.conta_id) {
const conta = contaState.store.contas
.find(c => c.id == novaMovimentacao.conta_id);
if (conta.tipo_conta_id == 3) { // cartão de crédito
const date = new Date()
date.setDate(conta.dia_vencimento)
novaMovimentacao.vencimento = date
}
watch(() => novaMovimentacao.conta_id, () => {
const conta = contaState.store.contas
.find(c => c.id == novaMovimentacao?.conta_id);
if (conta?.tipo_conta_id == 3) { // cartão de crédito
const date = new Date()
date.setDate(conta.dia_vencimento)
novaMovimentacao.vencimento = date
}
}
})
const salvarMovimentacao = async () => {
if(!valid.value) return
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<script setup>
import ListaMovimentacoes from "@/components/movimentacao/lista-movimentacoes.vue";
</script>

<template>
<lista-movimentacoes></lista-movimentacoes>
<h1>Histórico</h1>

<!--<lista-movimentacoes></lista-movimentacoes>-->
</template>
<style scoped>
Expand Down
4 changes: 2 additions & 2 deletions web-app-vue/src/routes/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import ConfigPage from '@/pages/config-page.vue'
import PlanejamentoPage from '@/pages/planejamento-page.vue'
import RecorrenciasPage from '@/pages/recorrencias-page.vue'
import ContasPage from '@/pages/contas-page.vue'
import MovimentacoesPage from '@/pages/movimentacoes-page.vue'
import HistoricoPage from '@/pages/historico-page.vue'

const routes = [
{ path: '/', redirect: '/nova-movimentacao' },
{ component: AuthPage, path: '/auth' },
{ component: CategoriasPage, path: '/categorias' },
{ component: ConfigPage, path: '/config' },
{ component: ContasPage, path: '/contas' },
{ component: MovimentacoesPage, path: '/movimentacoes' },
{ component: HistoricoPage, path: '/historico' },
{ component: NovaMovimentacaoPage, path: '/nova-movimentacao' },
{ component: PlanejamentoPage, path: '/planejamento' },
{ component: RecorrenciasPage, path: '/recorrencias' }
Expand Down

0 comments on commit 3a379e9

Please sign in to comment.