From 80918765d3c34521d69ab264f4d27b1a279b6a96 Mon Sep 17 00:00:00 2001 From: Jagaima Date: Wed, 4 Sep 2024 20:57:05 -0300 Subject: [PATCH 1/5] [fix:35] Fixing dropdown of Tipo Documento --- .../FinancialUpdate/index.jsx | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.jsx b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.jsx index dd50586e..fe3c14c0 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.jsx +++ b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.jsx @@ -274,10 +274,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", + ]} /> Date: Wed, 4 Sep 2024 21:27:31 -0300 Subject: [PATCH 2/5] [fix:35] removing baixada --- .../FinancialCreate/index.jsx | 42 ++++++------------ .../FinancialUpdate/index.jsx | 44 +++++++------------ 2 files changed, 29 insertions(+), 57 deletions(-) diff --git a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.jsx b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.jsx index 6d468390..55a97341 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,16 @@ 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/FinancialUpdate/index.jsx b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.jsx index fe3c14c0..ba6026e1 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) { @@ -351,8 +342,18 @@ export default function FinancialUpdate() { value={desconto} onChange={(e) => setDesconto(handleCurrencyInput(e.target.value))} /> + setDataVencimento(newValue)} + /> + setDataPagamento(newValue)} + /> - setDataVencimento(newValue)} - /> - setDataPagamento(newValue)} - /> -
-
{descricao.length}/{maxDescricaoLength} caracteres From fb9bda3339d76f40cac01c72afbfa834c771def2 Mon Sep 17 00:00:00 2001 From: Jagaima Date: Wed, 4 Sep 2024 21:59:32 -0300 Subject: [PATCH 3/5] [fix:38] fixing data filter --- .../ContributionHistoric/index.jsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx b/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx index e7cb6584..e8cfac2f 100644 --- a/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx +++ b/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx @@ -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()} } From c8e7b3e7dbb08f9ebdab23e319ffc3f44c323587 Mon Sep 17 00:00:00 2001 From: Jagaima Date: Wed, 4 Sep 2024 22:00:30 -0300 Subject: [PATCH 4/5] [fix:35] fixing data filter --- .../FinancialCreate/index.test.jsx | 2 +- .../FinancialMovements/FinancialList/index.jsx | 14 +++++++++----- .../FinancialUpdate/index.test.jsx | 1 - 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.test.jsx b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.test.jsx index a5287337..c2f8110a 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.test.jsx +++ b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.test.jsx @@ -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.test.jsx b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.test.jsx index ce221414..8e63b220 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", }) ), From f4595a91f959613890df028262606c6f2af4efbb Mon Sep 17 00:00:00 2001 From: Jagaima Date: Wed, 4 Sep 2024 22:32:58 -0300 Subject: [PATCH 5/5] [fix:36] changing css and other minor stuffs --- .../ContributionHistoric/index.jsx | 2 +- .../ContributionHistoric/index.test.jsx | 2 +- .../FinancialCreate/index.css | 24 ++++++++++++------- .../FinancialCreate/index.jsx | 4 ++++ .../FinancialCreate/index.test.jsx | 2 +- .../FinancialUpdate/index.jsx | 6 ++++- .../FinancialUpdate/index.test.jsx | 2 +- 7 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx b/src/Pages/Protected/FinancialMovements/ContributionHistoric/index.jsx index e8cfac2f..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 || {}; 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 55a97341..5cd7f354 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialCreate/index.jsx +++ b/src/Pages/Protected/FinancialMovements/FinancialCreate/index.jsx @@ -338,6 +338,8 @@ export default function FinancialCreate() { value={dataVencimento} onChange={(newValue) => setDataVencimento(newValue)} /> +
+
+
+
setDataPagamento(newValue)} /> +
+
+
+
diff --git a/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.test.jsx b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.test.jsx index 8e63b220..1fbde34d 100644 --- a/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.test.jsx +++ b/src/Pages/Protected/FinancialMovements/FinancialUpdate/index.test.jsx @@ -145,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");