Skip to content

Commit

Permalink
Merge pull request #27 from sombriks/develop
Browse files Browse the repository at this point in the history
test elease
  • Loading branch information
sombriks committed Jun 8, 2024
2 parents c892310 + e0def6b commit 0fcc07d
Show file tree
Hide file tree
Showing 9 changed files with 275 additions and 32 deletions.
18 changes: 10 additions & 8 deletions service-node-koa/app/config/db/knexfile.cjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
/**
* @type { import("knex").Knex.Config }
*/
* @type { import('knex').Knex.Config }
*/
const _cfg = {
client: 'sqlite3',
useNullAsDefault: true,
connection: {
filename: `${__dirname}/../../../redline.sqlite3`,
filename: `${__dirname}/../../../redline.sqlite3`
},
pool: {
min: 2,
max: 10
max: 10,
afterCreate: (conn, cb) =>
conn.run('PRAGMA foreign_keys = ON', cb)
},
migrations: {
directory: `${__dirname}/migrations`,
loadExtensions: [".mjs"],
},
loadExtensions: ['.mjs']
}
}

/**
* @type { Object.<string, import("knex").Knex.Config> }
*/
* @type { Object.<string, import('knex').Knex.Config> }
*/
module.exports = {
development: { ..._cfg },
test: {
Expand Down
18 changes: 9 additions & 9 deletions web-app-vue/src/pages/categoria/lista-categorias.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
<detalhe-categoria :categoria="novaCategoria" @onEdit="salvar"></detalhe-categoria>
<v-divider></v-divider>
<detalhe-categoria
@onEdit="salvar"
@onRemove="remover"
v-for="cat in cState.store.categorias"
:key="cat.id"
:categoria="cat"
@onEdit="salvar"
@onRemove="remover"
v-for="cat in cState.store.categorias"
:key="cat.id"
:categoria="cat"
></detalhe-categoria>
</v-row>
</v-container>
</template>
<script setup>
import {onMounted, reactive, ref} from 'vue'
import {useCategoriaStore} from '@/stores/categoriaStore'
import { onMounted, reactive } from 'vue'
import { useCategoriaStore } from '@/stores/categoriaStore'
import DetalheCategoria from '@/pages/categoria/detalhe-categoria.vue'
const cState = useCategoriaStore()
const novaCategoria = reactive({descricao: 'Nova Categoria'})
const novaCategoria = reactive({ descricao: 'Nova Categoria' })
const remover = async (categoria) => {
if (!confirm('deseja realmente excluir esta categoria?')) return
Expand All @@ -29,7 +29,7 @@ const remover = async (categoria) => {
}
const salvar = async (categoria) => {
await cState.salvarCategoria({...categoria})
await cState.salvarCategoria({ ...categoria })
await cState.sincronizarCategorias()
}
Expand Down
21 changes: 9 additions & 12 deletions web-app-vue/src/pages/dashboard/controles-dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,11 @@
<!-- receitas x despesas efetivadas (simple-bar) -->
<v-expansion-panel-title>Receitas x Despesas</v-expansion-panel-title>
<v-expansion-panel-text>
<VueUiSparkbar
:config="receitaDespesaBarConfig"
:dataset="receitaDespesaTotalPeriodo"
<VueUiSparkbar :config="receitaDespesaBarConfig"
:dataset="receitaDespesaTotalPeriodo"
></VueUiSparkbar>
<br />
<v-divider></v-divider>
<br />
<VueUiSparkbar
:config="receitaDespesaBarConfig"
:dataset="receitaDespesaEfetivadaPeriodo"
<VueUiSparkbar :config="receitaDespesaBarConfig"
:dataset="receitaDespesaEfetivadaPeriodo"
></VueUiSparkbar>
</v-expansion-panel-text>
</v-expansion-panel>
Expand All @@ -32,6 +27,7 @@
<v-expansion-panel-title>Limites</v-expansion-panel-title>
<v-expansion-panel-text>
<div v-for="(limite, i) in limites" :key="i">
<h3>{{limite[1].name}}</h3>
<VueUiXy :config="lineChartConfig" :dataset="limite" />
</div>
</v-expansion-panel-text>
Expand All @@ -57,6 +53,7 @@
<v-expansion-panel-title>Planejamentos</v-expansion-panel-title>
<v-expansion-panel-text>
<div v-for="(planejamento, i) in planejamentos" :key="i">
<h3>{{planejamento[1].name}}</h3>
<VueUiXy :config="lineChartConfig" :dataset="planejamento" />
</div>
</v-expansion-panel-text>
Expand Down Expand Up @@ -316,12 +313,12 @@ const limites = computed(() => {
const planejamentos = computed(() => {
const planejamentos = {}
dashboardState.store.dashboard?.planejamentos?.forEach((planejamento) => {
if(!planejamentos[planejamento.descricao]) {
if (!planejamentos[planejamento.descricao]) {
planejamentos[planejamento.descricao] = [
{
shape: 'square',
name: 'Limite',
color: planejamento.type === "ENTRADA" ? 'lightgreen' : 'red',
color: planejamento.type === 'ENTRADA' ? 'lightgreen' : 'red',
type: 'line',
series: dashboardState.store.dashboard?.planejamentos
?.filter((l) => l.descricao === planejamento.descricao)
Expand All @@ -339,7 +336,7 @@ const planejamentos = computed(() => {
type: 'line',
series: dashboardState.store.dashboard?.planejamentos
?.filter((l) => l.descricao === planejamento.descricao)
.map((l) => planejamento.type === "ENTRADA" ? l.acc : -l.acc)
.map((l) => planejamento.type === 'ENTRADA' ? l.acc : -l.acc)
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions web-app-vue/src/pages/movimentacao/editar-movimentacao.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
v-model="movForm.descricao"
label="Descrição"
/>
<!-- vencimento (dia do cartão se conta cartão) -->
<chip-date class="item" label="Vencimento" v-model="movForm.vencimento" />
<!-- efetivada? -->
<v-checkbox
v-if="!props?.movimentacao?.id"
class="item"
v-model="contaEfetivada"
label="Paga?"
/>
<!-- vencimento (dia do cartão se conta cartão) -->
<chip-date class="item" label="Vencimento" v-model="movForm.vencimento" />
<!-- efetivada (data) -->
<chip-date
v-if="contaEfetivada || props?.movimentacao?.id"
Expand Down
100 changes: 100 additions & 0 deletions web-app-vue/src/pages/pagamento/pagamento-form.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<template>
<v-container fluid>
<v-row align="center">
<v-form v-model="valid">
<div class="column">
<conta-autocomplete
class="item"
label="Conta de origem"
v-model="formPagamento.contaOrigem"
:rules="[requiredRule]"
/>
<conta-autocomplete
class="item"
label="Conta de destino"
v-model="formPagamento.contaDestino"
:rules="[requiredRule]"
/>
<chip-date
class="item"
label="Data pagamento"
v-model="formPagamento.vencimento"
/>
<chip-periodo
label="Período"
v-model:inicial="formPagamento.inicial"
v-model:final="formPagamento.final"
></chip-periodo>
<v-divider />
<p>valor total das movimentações do período</p>
<!-- movimentações do período -->
<v-divider />
<div class="item row">
<v-btn
variant="outlined"
class="ma-2"
color="green"
type="submit"
icon="mdi-check"
></v-btn>
<v-spacer></v-spacer>
<v-btn
variant="outlined"
color="orange"
class="ma-2"
type="button"
@click="router.push('/historico')"
icon="mdi-close"
></v-btn>
</div>
</div>
</v-form>
</v-row>
</v-container>
<div>
<h1>Pagamento</h1>
<ol>
<li>selecionar uma conta de origem</li>
<li>selecionar uma conta de destino</li>
<li>definir um período</li>
<li>marcar as movimentações do período para pagamento; calcular o valor</li>
<li>salvar o movimento de origem</li>
<li>salvar o movimento de destino</li>
<li>atualizar as movimentações- marcar como pagas</li>
</ol>
</div>
</template>
<script setup>
import { reactive, ref } from 'vue'
import { requiredRule } from '@/services/basic-rules'
import ContaAutocomplete from '@/shared/conta-autocomplete.vue'
import ChipPeriodo from '@/shared/chip-periodo.vue'
import { endOfMonth, startOfMonth } from 'date-fns'
import ChipDate from '@/shared/chip-date.vue'
import { router } from '@/services/router'
const valid = ref(false)
const formPagamento = reactive({
contaOrigem: 0,
contaDestino: 0,
valor: 0,
vencimento: new Date(),
inicial: startOfMonth(new Date()),
final: endOfMonth(new Date())
})
</script>
<style scoped>
.column {
display: flex;
flex-direction: column;
}
.item {
margin: 5px;
}
.row {
display: flex;
flex-direction: row;
}
</style>
53 changes: 53 additions & 0 deletions web-app-vue/src/pages/pagamento/pagamento-page.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<template>
<v-container fluid>
<v-card
elevation="24"
min-width="320"
>
<v-card-text>
<v-radio-group inline label="Operação" v-model="operacao">
<v-radio label="Pagamento" value="pagamento"></v-radio>
<v-radio label="Transferência" value="transferencia"></v-radio>
</v-radio-group>
<pagamento-form v-if="operacao === 'pagamento'"></pagamento-form>
<transferencia-form v-if="operacao === 'transferencia'"></transferencia-form>

</v-card-text>
</v-card>

</v-container>

<!-- <div>-->
<!-- <h1>Pagamento</h1>-->
<!-- <ol>-->
<!-- <li>selecionar uma conta de origem</li>-->
<!-- <li>selecionar uma conta de destino</li>-->
<!-- <li>definir um período</li>-->
<!-- <li>marcar as contas do período para pagamento</li>-->
<!-- </ol>-->
<!-- </div>-->
</template>
<script setup>
import { onMounted, ref } from 'vue'
import PagamentoForm from '@/pages/pagamento/pagamento-form.vue'
import TransferenciaForm from '@/pages/pagamento/transferencia-form.vue'
import { useMovimentacaoStore } from '@/stores/movimentacaoStore'
import { useCategoriaStore } from '@/stores/categoriaStore'
import { useContaStore } from '@/stores/contaStore'
const movimentacaoStore = useMovimentacaoStore()
const categoriaStore = useCategoriaStore()
const contaStore = useContaStore()
const operacao = ref("")
onMounted(async () => {
await Promise.all([
contaStore.sincronizarContas(),
categoriaStore.sincronizarCategorias(),
movimentacaoStore.sincronizarMovimentacoes()
])
})
</script>
<style scoped>
</style>
Loading

0 comments on commit 0fcc07d

Please sign in to comment.