@hed-hog/finance 0.0.226 → 0.0.228
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dto/create-bank-account.dto.d.ts +9 -0
- package/dist/dto/create-bank-account.dto.d.ts.map +1 -0
- package/dist/dto/create-bank-account.dto.js +61 -0
- package/dist/dto/create-bank-account.dto.js.map +1 -0
- package/dist/dto/update-bank-account.dto.d.ts +9 -0
- package/dist/dto/update-bank-account.dto.d.ts.map +1 -0
- package/dist/dto/update-bank-account.dto.js +60 -0
- package/dist/dto/update-bank-account.dto.js.map +1 -0
- package/dist/finance-bank-accounts.controller.d.ts +47 -0
- package/dist/finance-bank-accounts.controller.d.ts.map +1 -0
- package/dist/finance-bank-accounts.controller.js +73 -0
- package/dist/finance-bank-accounts.controller.js.map +1 -0
- package/dist/finance-data.controller.d.ts +136 -0
- package/dist/finance-data.controller.d.ts.map +1 -0
- package/dist/finance-data.controller.js +36 -0
- package/dist/finance-data.controller.js.map +1 -0
- package/dist/finance-installments.controller.d.ts +149 -0
- package/dist/finance-installments.controller.d.ts.map +1 -0
- package/dist/finance-installments.controller.js +101 -0
- package/dist/finance-installments.controller.js.map +1 -0
- package/dist/finance-statements.controller.d.ts +15 -0
- package/dist/finance-statements.controller.d.ts.map +1 -0
- package/dist/finance-statements.controller.js +43 -0
- package/dist/finance-statements.controller.js.map +1 -0
- package/dist/finance.module.d.ts.map +1 -1
- package/dist/finance.module.js +10 -2
- package/dist/finance.module.js.map +1 -1
- package/dist/finance.service.d.ts +63 -5
- package/dist/finance.service.d.ts.map +1 -1
- package/dist/finance.service.js +198 -9
- package/dist/finance.service.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/hedhog/data/menu.yaml +5 -1
- package/hedhog/data/route.yaml +45 -0
- package/hedhog/frontend/app/accounts-payable/approvals/page.tsx.ejs +4 -1
- package/hedhog/frontend/app/accounts-payable/installments/page.tsx.ejs +307 -112
- package/hedhog/frontend/app/accounts-receivable/collections-default/page.tsx.ejs +25 -8
- package/hedhog/frontend/app/accounts-receivable/installments/page.tsx.ejs +301 -100
- package/hedhog/frontend/app/cash-and-banks/bank-accounts/page.tsx.ejs +378 -71
- package/hedhog/frontend/app/cash-and-banks/bank-reconciliation/page.tsx.ejs +6 -3
- package/hedhog/frontend/app/cash-and-banks/statements/page.tsx.ejs +4 -2
- package/hedhog/frontend/app/cash-and-banks/transfers/page.tsx.ejs +6 -7
- package/package.json +4 -4
- package/src/dto/create-bank-account.dto.ts +49 -0
- package/src/dto/update-bank-account.dto.ts +45 -0
- package/src/finance-bank-accounts.controller.ts +43 -0
- package/src/finance-data.controller.ts +14 -0
- package/src/{finance.controller.ts → finance-installments.controller.ts} +8 -13
- package/src/finance-statements.controller.ts +20 -0
- package/src/finance.module.ts +10 -2
- package/src/finance.service.ts +239 -9
- package/src/index.ts +4 -1
package/dist/index.js
CHANGED
|
@@ -15,7 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./dto/create-financial-title.dto"), exports);
|
|
18
|
-
__exportStar(require("./finance.controller"), exports);
|
|
18
|
+
__exportStar(require("./finance-bank-accounts.controller"), exports);
|
|
19
|
+
__exportStar(require("./finance-data.controller"), exports);
|
|
20
|
+
__exportStar(require("./finance-installments.controller"), exports);
|
|
21
|
+
__exportStar(require("./finance-statements.controller"), exports);
|
|
19
22
|
__exportStar(require("./finance.module"), exports);
|
|
20
23
|
__exportStar(require("./finance.service"), exports);
|
|
21
24
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mEAAiD;AACjD,qEAAmD;AACnD,4DAA0C;AAC1C,oEAAkD;AAClD,kEAAgD;AAChD,mDAAiC;AACjC,oDAAkC"}
|
package/hedhog/data/menu.yaml
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
where:
|
|
16
16
|
slug: /finance
|
|
17
17
|
icon: chart-no-axes-combined
|
|
18
|
-
url: /finance
|
|
18
|
+
url: /finance
|
|
19
19
|
name:
|
|
20
20
|
en: Overview
|
|
21
21
|
pt: Visão geral
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
where:
|
|
48
48
|
slug: /finance/accounts-payable
|
|
49
49
|
icon: wallet
|
|
50
|
+
order: 0
|
|
50
51
|
url: /finance/accounts-payable/installments
|
|
51
52
|
name:
|
|
52
53
|
en: Installments
|
|
@@ -67,6 +68,7 @@
|
|
|
67
68
|
en: Approvals
|
|
68
69
|
pt: Aprovações
|
|
69
70
|
slug: /finance/accounts-payable/approvals
|
|
71
|
+
order: 1
|
|
70
72
|
relations:
|
|
71
73
|
role:
|
|
72
74
|
- where:
|
|
@@ -98,6 +100,7 @@
|
|
|
98
100
|
en: Installments
|
|
99
101
|
pt: Títulos e Parcelas
|
|
100
102
|
slug: /finance/accounts-receivable/installments
|
|
103
|
+
order: 0
|
|
101
104
|
relations:
|
|
102
105
|
role:
|
|
103
106
|
- where:
|
|
@@ -113,6 +116,7 @@
|
|
|
113
116
|
en: Collection and Default
|
|
114
117
|
pt: Cobrança e Inadimplência
|
|
115
118
|
slug: /finance/accounts-receivable/collections-default
|
|
119
|
+
order: 1
|
|
116
120
|
relations:
|
|
117
121
|
role:
|
|
118
122
|
- where:
|
package/hedhog/data/route.yaml
CHANGED
|
@@ -54,6 +54,51 @@
|
|
|
54
54
|
|
|
55
55
|
- url: /finance/accounts-receivable/installments
|
|
56
56
|
method: POST
|
|
57
|
+
relations:
|
|
58
|
+
role:
|
|
59
|
+
- where:
|
|
60
|
+
slug: admin
|
|
61
|
+
- where:
|
|
62
|
+
slug: admin-finance
|
|
63
|
+
|
|
64
|
+
- url: /finance/bank-accounts
|
|
65
|
+
method: GET
|
|
66
|
+
relations:
|
|
67
|
+
role:
|
|
68
|
+
- where:
|
|
69
|
+
slug: admin
|
|
70
|
+
- where:
|
|
71
|
+
slug: admin-finance
|
|
72
|
+
|
|
73
|
+
- url: /finance/bank-accounts
|
|
74
|
+
method: POST
|
|
75
|
+
relations:
|
|
76
|
+
role:
|
|
77
|
+
- where:
|
|
78
|
+
slug: admin
|
|
79
|
+
- where:
|
|
80
|
+
slug: admin-finance
|
|
81
|
+
|
|
82
|
+
- url: /finance/bank-accounts/:id
|
|
83
|
+
method: PATCH
|
|
84
|
+
relations:
|
|
85
|
+
role:
|
|
86
|
+
- where:
|
|
87
|
+
slug: admin
|
|
88
|
+
- where:
|
|
89
|
+
slug: admin-finance
|
|
90
|
+
|
|
91
|
+
- url: /finance/bank-accounts/:id
|
|
92
|
+
method: DELETE
|
|
93
|
+
relations:
|
|
94
|
+
role:
|
|
95
|
+
- where:
|
|
96
|
+
slug: admin
|
|
97
|
+
- where:
|
|
98
|
+
slug: admin-finance
|
|
99
|
+
|
|
100
|
+
- url: /finance/statements
|
|
101
|
+
method: GET
|
|
57
102
|
relations:
|
|
58
103
|
role:
|
|
59
104
|
- where:
|
|
@@ -90,8 +90,11 @@ function AprovacaoDialog({
|
|
|
90
90
|
</div>
|
|
91
91
|
</div>
|
|
92
92
|
<DialogFooter>
|
|
93
|
-
<Button variant="outline">
|
|
93
|
+
<Button type="button" variant="outline">
|
|
94
|
+
{t('dialog.cancel')}
|
|
95
|
+
</Button>
|
|
94
96
|
<Button
|
|
97
|
+
type="button"
|
|
95
98
|
variant={isAprovar ? 'default' : 'destructive'}
|
|
96
99
|
onClick={onConfirm}
|
|
97
100
|
>
|
|
@@ -10,8 +10,16 @@ import {
|
|
|
10
10
|
DropdownMenuTrigger,
|
|
11
11
|
} from '@/components/ui/dropdown-menu';
|
|
12
12
|
import { FilterBar } from '@/components/ui/filter-bar';
|
|
13
|
+
import {
|
|
14
|
+
Form,
|
|
15
|
+
FormControl,
|
|
16
|
+
FormField,
|
|
17
|
+
FormItem,
|
|
18
|
+
FormLabel,
|
|
19
|
+
FormMessage,
|
|
20
|
+
} from '@/components/ui/form';
|
|
13
21
|
import { Input } from '@/components/ui/input';
|
|
14
|
-
import {
|
|
22
|
+
import { InputMoney } from '@/components/ui/input-money';
|
|
15
23
|
import { Money } from '@/components/ui/money';
|
|
16
24
|
import {
|
|
17
25
|
Select,
|
|
@@ -38,6 +46,8 @@ import {
|
|
|
38
46
|
TableRow,
|
|
39
47
|
} from '@/components/ui/table';
|
|
40
48
|
import { Textarea } from '@/components/ui/textarea';
|
|
49
|
+
import { useApp } from '@hed-hog/next-app-provider';
|
|
50
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
41
51
|
import {
|
|
42
52
|
CheckCircle,
|
|
43
53
|
Download,
|
|
@@ -52,22 +62,96 @@ import {
|
|
|
52
62
|
import { useTranslations } from 'next-intl';
|
|
53
63
|
import Link from 'next/link';
|
|
54
64
|
import { useState } from 'react';
|
|
65
|
+
import { useForm } from 'react-hook-form';
|
|
66
|
+
import { z } from 'zod';
|
|
55
67
|
import { formatarData } from '../../_lib/formatters';
|
|
56
68
|
import { useFinanceData } from '../../_lib/use-finance-data';
|
|
57
69
|
|
|
70
|
+
const newTitleFormSchema = z.object({
|
|
71
|
+
documento: z.string().trim().min(1, 'Documento é obrigatório'),
|
|
72
|
+
fornecedorId: z.string().min(1, 'Fornecedor é obrigatório'),
|
|
73
|
+
competencia: z.string().optional(),
|
|
74
|
+
vencimento: z.string().min(1, 'Vencimento é obrigatório'),
|
|
75
|
+
valor: z.number().min(0.01, 'Valor deve ser maior que zero'),
|
|
76
|
+
categoriaId: z.string().optional(),
|
|
77
|
+
centroCustoId: z.string().optional(),
|
|
78
|
+
metodo: z.string().optional(),
|
|
79
|
+
descricao: z.string().optional(),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
type NewTitleFormValues = z.infer<typeof newTitleFormSchema>;
|
|
83
|
+
|
|
58
84
|
function NovoTituloSheet({
|
|
59
85
|
pessoas,
|
|
60
86
|
categorias,
|
|
61
87
|
centrosCusto,
|
|
62
88
|
t,
|
|
89
|
+
onCreated,
|
|
63
90
|
}: {
|
|
64
91
|
pessoas: any[];
|
|
65
92
|
categorias: any[];
|
|
66
93
|
centrosCusto: any[];
|
|
67
94
|
t: ReturnType<typeof useTranslations>;
|
|
95
|
+
onCreated: () => Promise<any> | void;
|
|
68
96
|
}) {
|
|
97
|
+
const { request, showToastHandler } = useApp();
|
|
98
|
+
const [open, setOpen] = useState(false);
|
|
99
|
+
|
|
100
|
+
const form = useForm<NewTitleFormValues>({
|
|
101
|
+
resolver: zodResolver(newTitleFormSchema),
|
|
102
|
+
defaultValues: {
|
|
103
|
+
documento: '',
|
|
104
|
+
fornecedorId: '',
|
|
105
|
+
competencia: '',
|
|
106
|
+
vencimento: '',
|
|
107
|
+
valor: 0,
|
|
108
|
+
categoriaId: '',
|
|
109
|
+
centroCustoId: '',
|
|
110
|
+
metodo: '',
|
|
111
|
+
descricao: '',
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const handleSubmit = async (values: NewTitleFormValues) => {
|
|
116
|
+
try {
|
|
117
|
+
await request({
|
|
118
|
+
url: '/finance/accounts-payable/installments',
|
|
119
|
+
method: 'POST',
|
|
120
|
+
data: {
|
|
121
|
+
document_number: values.documento,
|
|
122
|
+
person_id: Number(values.fornecedorId),
|
|
123
|
+
competence_date: values.competencia
|
|
124
|
+
? `${values.competencia}-01`
|
|
125
|
+
: undefined,
|
|
126
|
+
due_date: values.vencimento,
|
|
127
|
+
total_amount: values.valor,
|
|
128
|
+
finance_category_id: values.categoriaId
|
|
129
|
+
? Number(values.categoriaId)
|
|
130
|
+
: undefined,
|
|
131
|
+
cost_center_id: values.centroCustoId
|
|
132
|
+
? Number(values.centroCustoId)
|
|
133
|
+
: undefined,
|
|
134
|
+
payment_channel: values.metodo || undefined,
|
|
135
|
+
description: values.descricao?.trim() || undefined,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
await onCreated();
|
|
140
|
+
form.reset();
|
|
141
|
+
setOpen(false);
|
|
142
|
+
showToastHandler?.('success', 'Título criado com sucesso');
|
|
143
|
+
} catch {
|
|
144
|
+
showToastHandler?.('error', 'Erro ao criar título');
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const handleCancel = () => {
|
|
149
|
+
form.reset();
|
|
150
|
+
setOpen(false);
|
|
151
|
+
};
|
|
152
|
+
|
|
69
153
|
return (
|
|
70
|
-
<Sheet>
|
|
154
|
+
<Sheet open={open} onOpenChange={setOpen}>
|
|
71
155
|
<SheetTrigger asChild>
|
|
72
156
|
<Button>
|
|
73
157
|
<Plus className="mr-2 h-4 w-4" />
|
|
@@ -79,118 +163,228 @@ function NovoTituloSheet({
|
|
|
79
163
|
<SheetTitle>{t('newTitle.title')}</SheetTitle>
|
|
80
164
|
<SheetDescription>{t('newTitle.description')}</SheetDescription>
|
|
81
165
|
</SheetHeader>
|
|
82
|
-
<form
|
|
83
|
-
<
|
|
84
|
-
<div className="
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
166
|
+
<Form {...form}>
|
|
167
|
+
<form className="px-4" onSubmit={form.handleSubmit(handleSubmit)}>
|
|
168
|
+
<div className="grid gap-4">
|
|
169
|
+
<FormField
|
|
170
|
+
control={form.control}
|
|
171
|
+
name="documento"
|
|
172
|
+
render={({ field }) => (
|
|
173
|
+
<FormItem>
|
|
174
|
+
<FormLabel>{t('fields.document')}</FormLabel>
|
|
175
|
+
<FormControl>
|
|
176
|
+
<Input placeholder="NF-00000" {...field} />
|
|
177
|
+
</FormControl>
|
|
178
|
+
<FormMessage />
|
|
179
|
+
</FormItem>
|
|
180
|
+
)}
|
|
181
|
+
/>
|
|
182
|
+
|
|
183
|
+
<FormField
|
|
184
|
+
control={form.control}
|
|
185
|
+
name="fornecedorId"
|
|
186
|
+
render={({ field }) => (
|
|
187
|
+
<FormItem>
|
|
188
|
+
<FormLabel>{t('fields.supplier')}</FormLabel>
|
|
189
|
+
<Select value={field.value} onValueChange={field.onChange}>
|
|
190
|
+
<FormControl>
|
|
191
|
+
<SelectTrigger>
|
|
192
|
+
<SelectValue placeholder={t('common.select')} />
|
|
193
|
+
</SelectTrigger>
|
|
194
|
+
</FormControl>
|
|
195
|
+
<SelectContent>
|
|
196
|
+
{pessoas
|
|
197
|
+
.filter(
|
|
198
|
+
(p) => p.tipo === 'fornecedor' || p.tipo === 'ambos'
|
|
199
|
+
)
|
|
200
|
+
.map((p) => (
|
|
201
|
+
<SelectItem key={p.id} value={String(p.id)}>
|
|
202
|
+
{p.nome}
|
|
203
|
+
</SelectItem>
|
|
204
|
+
))}
|
|
205
|
+
</SelectContent>
|
|
206
|
+
</Select>
|
|
207
|
+
<FormMessage />
|
|
208
|
+
</FormItem>
|
|
209
|
+
)}
|
|
210
|
+
/>
|
|
211
|
+
|
|
212
|
+
<div className="grid grid-cols-2 gap-4">
|
|
213
|
+
<FormField
|
|
214
|
+
control={form.control}
|
|
215
|
+
name="competencia"
|
|
216
|
+
render={({ field }) => (
|
|
217
|
+
<FormItem>
|
|
218
|
+
<FormLabel>{t('fields.competency')}</FormLabel>
|
|
219
|
+
<FormControl>
|
|
220
|
+
<Input
|
|
221
|
+
type="month"
|
|
222
|
+
{...field}
|
|
223
|
+
value={field.value || ''}
|
|
224
|
+
/>
|
|
225
|
+
</FormControl>
|
|
226
|
+
<FormMessage />
|
|
227
|
+
</FormItem>
|
|
228
|
+
)}
|
|
229
|
+
/>
|
|
230
|
+
|
|
231
|
+
<FormField
|
|
232
|
+
control={form.control}
|
|
233
|
+
name="vencimento"
|
|
234
|
+
render={({ field }) => (
|
|
235
|
+
<FormItem>
|
|
236
|
+
<FormLabel>{t('fields.dueDate')}</FormLabel>
|
|
237
|
+
<FormControl>
|
|
238
|
+
<Input
|
|
239
|
+
type="date"
|
|
240
|
+
{...field}
|
|
241
|
+
value={field.value || ''}
|
|
242
|
+
/>
|
|
243
|
+
</FormControl>
|
|
244
|
+
<FormMessage />
|
|
245
|
+
</FormItem>
|
|
246
|
+
)}
|
|
247
|
+
/>
|
|
115
248
|
</div>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<SelectItem value="pix">PIX</SelectItem>
|
|
164
|
-
<SelectItem value="transferencia">
|
|
165
|
-
{t('paymentMethods.transfer')}
|
|
166
|
-
</SelectItem>
|
|
167
|
-
<SelectItem value="cartao">
|
|
168
|
-
{t('paymentMethods.card')}
|
|
169
|
-
</SelectItem>
|
|
170
|
-
<SelectItem value="dinheiro">
|
|
171
|
-
{t('paymentMethods.cash')}
|
|
172
|
-
</SelectItem>
|
|
173
|
-
<SelectItem value="cheque">
|
|
174
|
-
{t('paymentMethods.check')}
|
|
175
|
-
</SelectItem>
|
|
176
|
-
</SelectContent>
|
|
177
|
-
</Select>
|
|
178
|
-
</div>
|
|
179
|
-
<div className="space-y-2">
|
|
180
|
-
<Label htmlFor="descricao">{t('fields.description')}</Label>
|
|
181
|
-
<Textarea
|
|
182
|
-
id="descricao"
|
|
183
|
-
placeholder={t('newTitle.descriptionPlaceholder')}
|
|
249
|
+
|
|
250
|
+
<FormField
|
|
251
|
+
control={form.control}
|
|
252
|
+
name="valor"
|
|
253
|
+
render={({ field }) => (
|
|
254
|
+
<FormItem>
|
|
255
|
+
<FormLabel>{t('fields.totalValue')}</FormLabel>
|
|
256
|
+
<FormControl>
|
|
257
|
+
<InputMoney
|
|
258
|
+
ref={field.ref}
|
|
259
|
+
name={field.name}
|
|
260
|
+
value={field.value}
|
|
261
|
+
onBlur={field.onBlur}
|
|
262
|
+
onValueChange={(value) => field.onChange(value ?? 0)}
|
|
263
|
+
placeholder="0,00"
|
|
264
|
+
/>
|
|
265
|
+
</FormControl>
|
|
266
|
+
<FormMessage />
|
|
267
|
+
</FormItem>
|
|
268
|
+
)}
|
|
269
|
+
/>
|
|
270
|
+
|
|
271
|
+
<FormField
|
|
272
|
+
control={form.control}
|
|
273
|
+
name="categoriaId"
|
|
274
|
+
render={({ field }) => (
|
|
275
|
+
<FormItem>
|
|
276
|
+
<FormLabel>{t('fields.category')}</FormLabel>
|
|
277
|
+
<Select value={field.value} onValueChange={field.onChange}>
|
|
278
|
+
<FormControl>
|
|
279
|
+
<SelectTrigger>
|
|
280
|
+
<SelectValue placeholder={t('common.select')} />
|
|
281
|
+
</SelectTrigger>
|
|
282
|
+
</FormControl>
|
|
283
|
+
<SelectContent>
|
|
284
|
+
{categorias
|
|
285
|
+
.filter((c) => c.natureza === 'despesa')
|
|
286
|
+
.map((c) => (
|
|
287
|
+
<SelectItem key={c.id} value={String(c.id)}>
|
|
288
|
+
{c.codigo} - {c.nome}
|
|
289
|
+
</SelectItem>
|
|
290
|
+
))}
|
|
291
|
+
</SelectContent>
|
|
292
|
+
</Select>
|
|
293
|
+
<FormMessage />
|
|
294
|
+
</FormItem>
|
|
295
|
+
)}
|
|
184
296
|
/>
|
|
297
|
+
|
|
298
|
+
<FormField
|
|
299
|
+
control={form.control}
|
|
300
|
+
name="centroCustoId"
|
|
301
|
+
render={({ field }) => (
|
|
302
|
+
<FormItem>
|
|
303
|
+
<FormLabel>{t('fields.costCenter')}</FormLabel>
|
|
304
|
+
<Select value={field.value} onValueChange={field.onChange}>
|
|
305
|
+
<FormControl>
|
|
306
|
+
<SelectTrigger>
|
|
307
|
+
<SelectValue placeholder={t('common.select')} />
|
|
308
|
+
</SelectTrigger>
|
|
309
|
+
</FormControl>
|
|
310
|
+
<SelectContent>
|
|
311
|
+
{centrosCusto.map((c) => (
|
|
312
|
+
<SelectItem key={c.id} value={String(c.id)}>
|
|
313
|
+
{c.codigo} - {c.nome}
|
|
314
|
+
</SelectItem>
|
|
315
|
+
))}
|
|
316
|
+
</SelectContent>
|
|
317
|
+
</Select>
|
|
318
|
+
<FormMessage />
|
|
319
|
+
</FormItem>
|
|
320
|
+
)}
|
|
321
|
+
/>
|
|
322
|
+
|
|
323
|
+
<FormField
|
|
324
|
+
control={form.control}
|
|
325
|
+
name="metodo"
|
|
326
|
+
render={({ field }) => (
|
|
327
|
+
<FormItem>
|
|
328
|
+
<FormLabel>{t('fields.paymentMethod')}</FormLabel>
|
|
329
|
+
<Select value={field.value} onValueChange={field.onChange}>
|
|
330
|
+
<FormControl>
|
|
331
|
+
<SelectTrigger>
|
|
332
|
+
<SelectValue placeholder={t('common.select')} />
|
|
333
|
+
</SelectTrigger>
|
|
334
|
+
</FormControl>
|
|
335
|
+
<SelectContent>
|
|
336
|
+
<SelectItem value="boleto">
|
|
337
|
+
{t('paymentMethods.boleto')}
|
|
338
|
+
</SelectItem>
|
|
339
|
+
<SelectItem value="pix">PIX</SelectItem>
|
|
340
|
+
<SelectItem value="transferencia">
|
|
341
|
+
{t('paymentMethods.transfer')}
|
|
342
|
+
</SelectItem>
|
|
343
|
+
<SelectItem value="cartao">
|
|
344
|
+
{t('paymentMethods.card')}
|
|
345
|
+
</SelectItem>
|
|
346
|
+
<SelectItem value="dinheiro">
|
|
347
|
+
{t('paymentMethods.cash')}
|
|
348
|
+
</SelectItem>
|
|
349
|
+
<SelectItem value="cheque">
|
|
350
|
+
{t('paymentMethods.check')}
|
|
351
|
+
</SelectItem>
|
|
352
|
+
</SelectContent>
|
|
353
|
+
</Select>
|
|
354
|
+
<FormMessage />
|
|
355
|
+
</FormItem>
|
|
356
|
+
)}
|
|
357
|
+
/>
|
|
358
|
+
|
|
359
|
+
<FormField
|
|
360
|
+
control={form.control}
|
|
361
|
+
name="descricao"
|
|
362
|
+
render={({ field }) => (
|
|
363
|
+
<FormItem>
|
|
364
|
+
<FormLabel>{t('fields.description')}</FormLabel>
|
|
365
|
+
<FormControl>
|
|
366
|
+
<Textarea
|
|
367
|
+
placeholder={t('newTitle.descriptionPlaceholder')}
|
|
368
|
+
{...field}
|
|
369
|
+
value={field.value || ''}
|
|
370
|
+
/>
|
|
371
|
+
</FormControl>
|
|
372
|
+
<FormMessage />
|
|
373
|
+
</FormItem>
|
|
374
|
+
)}
|
|
375
|
+
/>
|
|
376
|
+
</div>
|
|
377
|
+
|
|
378
|
+
<div className="flex justify-end gap-2 pt-4">
|
|
379
|
+
<Button type="button" variant="outline" onClick={handleCancel}>
|
|
380
|
+
{t('common.cancel')}
|
|
381
|
+
</Button>
|
|
382
|
+
<Button type="submit" disabled={form.formState.isSubmitting}>
|
|
383
|
+
{t('common.save')}
|
|
384
|
+
</Button>
|
|
185
385
|
</div>
|
|
186
|
-
</
|
|
187
|
-
|
|
188
|
-
<Button type="button" variant="outline">
|
|
189
|
-
{t('common.cancel')}
|
|
190
|
-
</Button>
|
|
191
|
-
<Button type="submit">{t('common.save')}</Button>
|
|
192
|
-
</div>
|
|
193
|
-
</form>
|
|
386
|
+
</form>
|
|
387
|
+
</Form>
|
|
194
388
|
</SheetContent>
|
|
195
389
|
</Sheet>
|
|
196
390
|
);
|
|
@@ -198,7 +392,7 @@ function NovoTituloSheet({
|
|
|
198
392
|
|
|
199
393
|
export default function TitulosPagarPage() {
|
|
200
394
|
const t = useTranslations('finance.PayableInstallmentsPage');
|
|
201
|
-
const { data } = useFinanceData();
|
|
395
|
+
const { data, refetch } = useFinanceData();
|
|
202
396
|
const { titulosPagar, pessoas, categorias, centrosCusto } = data;
|
|
203
397
|
|
|
204
398
|
const getPessoaById = (id?: string) => pessoas.find((p) => p.id === id);
|
|
@@ -235,6 +429,7 @@ export default function TitulosPagarPage() {
|
|
|
235
429
|
categorias={categorias}
|
|
236
430
|
centrosCusto={centrosCusto}
|
|
237
431
|
t={t}
|
|
432
|
+
onCreated={refetch}
|
|
238
433
|
/>
|
|
239
434
|
}
|
|
240
435
|
/>
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
DialogTrigger,
|
|
20
20
|
} from '@/components/ui/dialog';
|
|
21
21
|
import { Input } from '@/components/ui/input';
|
|
22
|
+
import { InputMoney } from '@/components/ui/input-money';
|
|
22
23
|
import { Label } from '@/components/ui/label';
|
|
23
24
|
import { Money } from '@/components/ui/money';
|
|
24
25
|
import {
|
|
@@ -122,13 +123,25 @@ function EnviarCobrancaDialog({
|
|
|
122
123
|
<div className="space-y-2">
|
|
123
124
|
<Label>{t('send.contactType')}</Label>
|
|
124
125
|
<div className="flex gap-2">
|
|
125
|
-
<Button
|
|
126
|
+
<Button
|
|
127
|
+
type="button"
|
|
128
|
+
variant="outline"
|
|
129
|
+
className="flex-1 bg-transparent"
|
|
130
|
+
>
|
|
126
131
|
{t('send.channels.email')}
|
|
127
132
|
</Button>
|
|
128
|
-
<Button
|
|
133
|
+
<Button
|
|
134
|
+
type="button"
|
|
135
|
+
variant="outline"
|
|
136
|
+
className="flex-1 bg-transparent"
|
|
137
|
+
>
|
|
129
138
|
WhatsApp
|
|
130
139
|
</Button>
|
|
131
|
-
<Button
|
|
140
|
+
<Button
|
|
141
|
+
type="button"
|
|
142
|
+
variant="outline"
|
|
143
|
+
className="flex-1 bg-transparent"
|
|
144
|
+
>
|
|
132
145
|
SMS
|
|
133
146
|
</Button>
|
|
134
147
|
</div>
|
|
@@ -143,8 +156,10 @@ function EnviarCobrancaDialog({
|
|
|
143
156
|
</div>
|
|
144
157
|
</div>
|
|
145
158
|
<DialogFooter>
|
|
146
|
-
<Button variant="outline">
|
|
147
|
-
|
|
159
|
+
<Button type="button" variant="outline">
|
|
160
|
+
{t('common.cancel')}
|
|
161
|
+
</Button>
|
|
162
|
+
<Button type="button">{t('send.submit')}</Button>
|
|
148
163
|
</DialogFooter>
|
|
149
164
|
</DialogContent>
|
|
150
165
|
</Dialog>
|
|
@@ -176,7 +191,7 @@ function RegistrarAcordoDialog({
|
|
|
176
191
|
<div className="grid grid-cols-2 gap-4">
|
|
177
192
|
<div className="space-y-2">
|
|
178
193
|
<Label htmlFor="valorAcordo">{t('agreement.value')}</Label>
|
|
179
|
-
<
|
|
194
|
+
<InputMoney id="valorAcordo" placeholder="0,00" />
|
|
180
195
|
</div>
|
|
181
196
|
<div className="space-y-2">
|
|
182
197
|
<Label htmlFor="parcelas">{t('agreement.installments')}</Label>
|
|
@@ -198,8 +213,10 @@ function RegistrarAcordoDialog({
|
|
|
198
213
|
</div>
|
|
199
214
|
</div>
|
|
200
215
|
<DialogFooter>
|
|
201
|
-
<Button variant="outline">
|
|
202
|
-
|
|
216
|
+
<Button type="button" variant="outline">
|
|
217
|
+
{t('common.cancel')}
|
|
218
|
+
</Button>
|
|
219
|
+
<Button type="button">{t('agreement.submit')}</Button>
|
|
203
220
|
</DialogFooter>
|
|
204
221
|
</DialogContent>
|
|
205
222
|
</Dialog>
|