Adicionado aba de estabelecimentos e feita ajuste de interface. Detalhes adicionados no CHANGELOG.md

This commit is contained in:
Guilherme Bano
2026-02-20 00:39:50 -03:00
committed by Felipe Coutinho
parent ffde55f589
commit 9b78f839bf
23 changed files with 695 additions and 55 deletions

View File

@@ -386,6 +386,7 @@ export function LancamentosPage({
pagadorFilterOptions={pagadorFilterOptions}
categoriaFilterOptions={categoriaFilterOptions}
contaCartaoFilterOptions={contaCartaoFilterOptions}
estabelecimentosOptions={estabelecimentos}
selectedPeriod={selectedPeriod}
onCreate={allowCreate ? handleCreate : undefined}
onMassAdd={allowCreate ? handleMassAdd : undefined}

View File

@@ -33,7 +33,7 @@ export function EstabelecimentoInput({
value,
onChange,
estabelecimentos = [],
placeholder = "Ex.: Padaria",
placeholder = "Ex.: Padaria, Transferência, Saldo inicial",
required = false,
maxLength = 20,
}: EstabelecimentoInputProps) {

View File

@@ -122,6 +122,7 @@ interface LancamentosFiltersProps {
pagadorOptions: LancamentoFilterOption[];
categoriaOptions: LancamentoFilterOption[];
contaCartaoOptions: ContaCartaoFilterOption[];
estabelecimentosOptions?: string[];
className?: string;
exportButton?: ReactNode;
hideAdvancedFilters?: boolean;
@@ -131,6 +132,7 @@ export function LancamentosFilters({
pagadorOptions,
categoriaOptions,
contaCartaoOptions,
estabelecimentosOptions = [],
className,
exportButton,
hideAdvancedFilters = false,
@@ -235,6 +237,16 @@ export function LancamentosFilters({
? contaCartaoOptions.find((option) => option.slug === contaCartaoValue)
: null;
const estabelecimentoParam = searchParams.get("estabelecimento");
const estabelecimentoOptionsForSelect = [
...(estabelecimentoParam &&
estabelecimentoParam.trim() &&
!estabelecimentosOptions.includes(estabelecimentoParam.trim())
? [estabelecimentoParam.trim()]
: []),
...estabelecimentosOptions,
];
const [categoriaOpen, setCategoriaOpen] = useState(false);
const [drawerOpen, setDrawerOpen] = useState(false);
@@ -244,7 +256,8 @@ export function LancamentosFilters({
searchParams.get("pagamento") ||
searchParams.get("pagador") ||
searchParams.get("categoria") ||
searchParams.get("contaCartao");
searchParams.get("contaCartao") ||
searchParams.get("estabelecimento");
const handleResetFilters = () => {
handleReset();
@@ -518,6 +531,45 @@ export function LancamentosFilters({
</SelectContent>
</Select>
</div>
{estabelecimentoOptionsForSelect.length > 0 ||
estabelecimentoParam?.trim() ? (
<div className="space-y-2">
<label className="text-sm font-medium">Estabelecimento</label>
<Select
value={
getParamValue("estabelecimento") || FILTER_EMPTY_VALUE
}
onValueChange={(value) =>
handleFilterChange(
"estabelecimento",
value === FILTER_EMPTY_VALUE ? null : value,
)
}
disabled={isPending}
>
<SelectTrigger
className="w-full text-sm border-dashed"
disabled={isPending}
>
<span className="truncate">
{getParamValue("estabelecimento") !== FILTER_EMPTY_VALUE &&
searchParams.get("estabelecimento")
? searchParams.get("estabelecimento")
: "Todos"}
</span>
</SelectTrigger>
<SelectContent>
<SelectItem value={FILTER_EMPTY_VALUE}>Todos</SelectItem>
{estabelecimentoOptionsForSelect.map((name) => (
<SelectItem key={name} value={name}>
{name}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
) : null}
</div>
<DrawerFooter>

View File

@@ -715,6 +715,7 @@ type LancamentosTableProps = {
pagadorFilterOptions?: LancamentoFilterOption[];
categoriaFilterOptions?: LancamentoFilterOption[];
contaCartaoFilterOptions?: ContaCartaoFilterOption[];
estabelecimentosOptions?: string[];
selectedPeriod?: string;
onCreate?: (type: "Despesa" | "Receita") => void;
onMassAdd?: () => void;
@@ -741,6 +742,7 @@ export function LancamentosTable({
pagadorFilterOptions = [],
categoriaFilterOptions = [],
contaCartaoFilterOptions = [],
estabelecimentosOptions = [],
selectedPeriod,
onCreate,
onMassAdd,
@@ -921,6 +923,7 @@ export function LancamentosTable({
pagadorOptions={pagadorFilterOptions}
categoriaOptions={categoriaFilterOptions}
contaCartaoOptions={contaCartaoFilterOptions}
estabelecimentosOptions={estabelecimentosOptions}
className="w-full lg:flex-1 lg:justify-end"
hideAdvancedFilters={hasOtherUserData}
exportButton={