diff --git a/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx b/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx index e7cb6584..7557cb7a 100644 --- a/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx +++ b/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx @@ -9,7 +9,7 @@ import DataSelect from "../../../../Components/DataSelect"; import FieldText from "../../../../Components/FieldText"; import { getFinancialMovements } from "../../../../Services/FinancialMovementsService"; import "./index.css"; - +//testes export default function UserHistoric() { const { state } = useLocation(); const { nomeCompleto } = state || {}; @@ -48,10 +48,15 @@ export default function UserHistoric() { .toLowerCase() .includes(search.toLowerCase()); - const movementDate = new Date(movement.datadePagamento); + const movementDate = new Date(movement.datadeVencimento); + const startDate = dataInicio ? new Date(dataInicio) : null; + const finalDate = dataFinal ? new Date(dataFinal) : null; + const isDateInRange = - (!dataInicio || movementDate >= new Date(dataInicio)) && - (!dataFinal || movementDate <= new Date(dataFinal)); + (!startDate || movementDate >= startDate) && + (!finalDate || movementDate <= finalDate); + + console.log(dataInicio, dataFinal, movementDate, isDateInRange); return isDocumentTypeMatch && isDateInRange; }); @@ -117,9 +122,9 @@ export default function UserHistoric() { className="pag-sind" secondary={ <> - Data de pagamento:
+ Data de vencimento:
{new Date( - movement.datadePagamento + movement.datadeVencimento ).toLocaleDateString()} } diff --git a/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.test.jsx b/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.test.jsx index 6f6a35a9..d76cb333 100644 --- a/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.test.jsx +++ b/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.test.jsx @@ -5,7 +5,7 @@ import UserHistoric from "./index"; import { getFinancialMovements } from "../../../../Services/FinancialMovementsService"; import "@testing-library/jest-dom"; - +//testes vi.mock("react-router-dom", async (importOriginal) => { const actual = await importOriginal(); return { diff --git a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.css b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.css index eec6aef0..f7a870c7 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.css +++ b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.css @@ -1,6 +1,6 @@ @media screen and (max-width: 1080px) { .container { - display: flex; + display: grid; flex-direction: row; } @@ -26,13 +26,13 @@ grid-template-columns: 0.5fr 0.3fr; } - h1 { + .forms-container h1 { font-weight: 800; margin-bottom: 3rem; color: #332117 !important; } - h3 { + .forms-container h3 { font-weight: 400; margin-left: 1rem; margin-top: 3rem; @@ -42,11 +42,11 @@ #addDependentBttn { cursor: pointer; } -} - -@media screen and (max-width: 500px) { - .container { + .descricao-fin { display: grid; + justify-content: start; + grid-template-columns: 2.5fr; + margin: 0; } } @@ -89,13 +89,13 @@ color: #332117 !important; } - h1 { + .forms-container h1 { font-weight: 800; margin-bottom: 3rem; color: #332117 !important; } - h3 { + .forms-container h3 { font-weight: 400; margin-left: 1rem; margin-top: 3rem; @@ -110,4 +110,10 @@ #addDependentBttn { cursor: pointer; } + .descricao-fin { + display: grid; + justify-content: start; + grid-template-columns: 2.5fr; + margin: 0; + } } diff --git a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.jsx b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.jsx index 6d468390..5cd7f354 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.jsx +++ b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.jsx @@ -6,7 +6,6 @@ import PrimaryButton from "../../../../Components/PrimaryButton"; import SecondaryButton from "../../../../Components/SecondaryButton"; import "./index.css"; import DataSelect from "../../../../Components/DataSelect"; -import CheckField from "../../../../Components/Checkfield"; import { createFinancialMovements } from "../../../../Services/FinancialMovementsService"; import { getUsers } from "../../../../Services/userService"; import { getSupplierForm } from "../../../../Services/supplierService"; @@ -26,7 +25,6 @@ export default function FinancialCreate() { const [pagamento, setPagamento] = useState(""); const [dataVencimento, setDataVencimento] = useState(null); const [dataPagamento, setDataPagamento] = useState(null); - const [baixada, setBaixada] = useState(false); const [descricao, setDescricao] = useState(""); const [showModal, setShowModal] = useState(false); const [nomesOrigem, setNomesOrigem] = useState([]); @@ -160,11 +158,6 @@ export default function FinancialCreate() { setPagamento(event.target.value); }; - const handleChangeBaixada = (newChecked) => { - console.log("Baixada:", newChecked); - setBaixada(newChecked); - }; - const handleChangeDescricao = (event) => { const { value } = event.target; if (value.length <= maxDescricaoLength) { @@ -194,7 +187,6 @@ export default function FinancialCreate() { formadePagamento: pagamento, datadeVencimento: dataVencimento, datadePagamento: dataPagamento, - baixada, descricao, }; @@ -336,7 +328,18 @@ export default function FinancialCreate() { value={desconto} onChange={(e) => setDesconto(handleCurrencyInput(e.target.value))} /> - + setDataPagamento(newValue)} + /> + setDataVencimento(newValue)} + /> + +
- setDataVencimento(newValue)} - /> - setDataPagamento(newValue)} - /> - +
+
-
{descricao.length}/{maxDescricaoLength} caracteres diff --git a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.test.jsx b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.test.jsx index a5287337..53eaadf5 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.test.jsx +++ b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.test.jsx @@ -6,7 +6,7 @@ import { createFinancialMovements } from "../../../../Services/FinancialMovement import "@testing-library/jest-dom"; import userEvent from "@testing-library/user-event"; -// Função auxiliar para preencher campos obrigatórios +// Função auxiliar para preencher campos obrigatórioss async function fillUpRequiredFields() { const selects = screen.getAllByRole("combobox"); @@ -27,7 +27,7 @@ async function fillUpRequiredFields() { (s) => s.id === "select-Forma de Pagamento *" ); const dataVencimentoInput = screen.getByLabelText("Data de vencimento *"); - const dataPagamentoInput = screen.getByLabelText("Data de pagamento *"); + const dataPagamentoInput = screen.getByLabelText("Data de pagamento"); await userEvent.click(contaOrigemSelect); await userEvent.click(screen.getByRole("option", { name: "Fornecedor" })); diff --git a/src/Pages/Protected/FinancialMovements/FinancialList/index.jsx b/src/Pages/Protected/FinancialMovements/FinancialList/index.jsx index 017589ca..d13c728f 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialList/index.jsx +++ b/src/Pages/Protected/FinancialMovements/FinancialList/index.jsx @@ -62,10 +62,14 @@ export default function FinancialList() { .toLowerCase() .includes(search.toLowerCase()); - const movementDate = new Date(movement.datadePagamento); + const movementDate = new Date(movement.datadeVencimento); + const startDate = dataInicio ? new Date(dataInicio) : null; + const finalDate = dataFinal ? new Date(dataFinal) : null; + const isDateInRange = - (!dataInicio || movementDate >= new Date(dataInicio)) && - (!dataInicio || movementDate <= new Date(dataFinal)); + (!startDate || movementDate >= startDate) && + (!finalDate || movementDate <= finalDate); + console.log(dataInicio, dataFinal, movementDate, isDateInRange); return isDocumentTypeMatch && isDateInRange; @@ -120,8 +124,8 @@ export default function FinancialList() { > diff --git a/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.jsx b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.jsx index dd50586e..6bc6ec13 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.jsx +++ b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.jsx @@ -7,7 +7,6 @@ import PrimaryButton from "../../../../Components/PrimaryButton"; import SecondaryButton from "../../../../Components/SecondaryButton"; import "./index.css"; import DataSelect from "../../../../Components/DataSelect"; -import CheckField from "../../../../Components/Checkfield"; import { getFinancialMovementsById, updateFinancialMovementsById, @@ -31,7 +30,6 @@ export default function FinancialUpdate() { const [pagamento, setPagamento] = useState(""); const [dataVencimento, setDataVencimento] = useState(null); const [dataPagamento, setDataPagamento] = useState(null); - const [baixada, setBaixada] = useState(false); const [descricao, setDescricao] = useState(""); const [showSaveModal, setShowSaveModal] = useState(false); const [showDeleteModal, setShowDeleteModal] = useState(false); @@ -62,7 +60,6 @@ export default function FinancialUpdate() { setPagamento(data.formadePagamento || ""); setDataVencimento(dayjs(data.datadeVencimento || null)); setDataPagamento(dayjs(data.datadePagamento || null)); - setBaixada(data.baixada || false); setDescricao(data.descricao || ""); } catch (error) { console.error("Erro ao buscar dados da movimentação:", error); @@ -164,7 +161,6 @@ export default function FinancialUpdate() { formadePagamento: pagamento, datadeVencimento: dataVencimento, datadePagamento: dataPagamento, - baixada, descricao, }; await updateFinancialMovementsById(movementId, updatedData); @@ -231,11 +227,6 @@ export default function FinancialUpdate() { setPagamento(event.target.value); }; - const handleChangeBaixada = (newChecked) => { - console.log("Baixada:", newChecked); - setBaixada(newChecked); - }; - const handleChangeDescricao = (event) => { const { value } = event.target; if (value.length <= maxDescricaoLength) { @@ -274,10 +265,55 @@ export default function FinancialUpdate() { onChange={handleChangeNomeDestino} options={nomesDestino} /> - setTipoDocumento(e.target.value)} + options={[ + "", + "AÇÃO JUDICIAL", + "ACORDO EXTRAJUDICIAL", + "ADVOGADO", + "ALUGUEL", + "APLICAÇÃO FINANCEIRA", + "ASSEMBLEIA", + "ASSESSORIA COMUNICAÇÃO", + "CARTÓRIO", + "CELULAR", + "COMBUSTÍVEL", + "CONDOMÍNO", + "CONTABILIDADE", + "CONVÊNIO", + "CUSTAS JUDICIAIS", + "DARF", + "DAR-GDF", + "DIVERSOS", + "DOAÇÕES", + "DPVAT", + "ENERGIA", + "ESTÁGIO", + "EVENTOS", + "EXPEDIENTE", + "FGTS", + "FIXO/INTERNET", + "FUNCIONÁRIO", + "GPS (INSS)", + "IMÓVEL - SEDE SINDPEN", + "INDENIZAÇÃO", + "IPTU", + "IPVA", + "LAZER", + "LICENCIAMENTO", + "MULTA", + "PAPELARIA", + "PATROCÍNIO", + "REEMBOLSO", + "RESCISÃO CONTRATO TRAB.", + "RESTAURANTE", + "SEGURO VIDA", + "TARIFAS BANCÁRIAS", + "PUBLICIDADE", + ]} /> setDesconto(handleCurrencyInput(e.target.value))} /> + setDataVencimento(newValue)} + /> + setDataPagamento(newValue)} + /> +
+
- setDataVencimento(newValue)} - /> - setDataPagamento(newValue)} - /> - +
+
-
{descricao.length}/{maxDescricaoLength} caracteres diff --git a/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.test.jsx b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.test.jsx index ce221414..1fbde34d 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.test.jsx +++ b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.test.jsx @@ -25,7 +25,6 @@ function mockServices() { formadePagamento: "PIX", datadeVencimento: dayjs("2024-01-01"), datadePagamento: dayjs("2024-02-01"), - baixada: false, descricao: "Descrição de exemplo", }) ), @@ -146,7 +145,7 @@ describe("FinancialUpdate", () => { ); - const descricaoInput = screen.getByLabelText("Descrição *"); + const descricaoInput = screen.getByLabelText("Descrição"); await userEvent.clear(descricaoInput); await userEvent.type(descricaoInput, "Descrição alterada");