Skip to content

Commit

Permalink
ajustes finais dessa versao
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorBelotto committed May 28, 2024
1 parent a484372 commit 3c18c8b
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import BotaoPadrao from '../../../Botoes/BotaoPadrao.jsx';
import { useOrcamentosStore } from '../../../../context/OrcamentosStore.js';
import Acessorios from '../Acessorios/Acessorios.jsx';
import formataValor from '../../../../scripts/formataValor.js';
import { usePopup } from '../../../../context/PopupContext.jsx';

const TabelaAcessorios = () => {
const [quantidadesAcessorios, setQuantidadesAcessorios] = React.useState(Array(ValoresAcessorios.length).fill(0));
const [valoresUnitariosAcessorios, setValoresUnitariosAcessorios] = React.useState(ValoresAcessorios.map(item => item.valor));
const { showPopup } = usePopup();

const adicionarOrcamentoAcessorios = useOrcamentosStore(state => state.adicionarOrcamentoAcessorios);

Expand All @@ -25,7 +27,7 @@ const TabelaAcessorios = () => {

const adicionarOrcamento = () => {
const itensPreenchidosAcessorios = [];

showPopup('Orçamento adicionado', 'blue')
quantidadesAcessorios.forEach((qtd, index) => {
if (qtd > 0) {
const item = ValoresAcessorios[index];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import BotaoPadrao from '../../../Botoes/BotaoPadrao.jsx';
import { useOrcamentosStore } from '../../../../context/OrcamentosStore.js';
import formataValor from '../../../../scripts/formataValor.js';
import Estruturas from '../Estruturas/Estruturas.jsx';
import { usePopup } from '../../../../context/PopupContext.jsx'

const TabelaEstruturas = () => {
const [quantidadesEstrutura, setQuantidadesEstrutura] = React.useState(Array(ValoresDaEstrutura.length).fill(0));
const [valoresUnitariosEstrutura, setValoresUnitariosEstrutura] = React.useState(ValoresDaEstrutura.map(item => item.valor));
const [metragensEstrutura, setMetragensEstrutura] = React.useState(Array(ValoresDaEstrutura.length).fill(0));
const adicionarOrcamentoEstruturas = useOrcamentosStore(state => state.adicionarOrcamentoEstruturas);
const { showPopup } = usePopup();

const handleChangeQuantidadeEstrutura = (index, value) => {
const newQuantidades = [...quantidadesEstrutura];
Expand All @@ -31,7 +33,7 @@ const TabelaEstruturas = () => {

const adicionarOrcamento = () => {
const itensPreenchidosEstrutura = [];

showPopup('Orçamento adicionado', 'blue')
quantidadesEstrutura.forEach((qtd, index) => {
if (qtd > 0) {
const item = ValoresDaEstrutura[index];
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { usePopup } from '../../context/PopupContext.jsx';
import { usePopup } from '../../../context/PopupContext.jsx';
import { X } from 'lucide-react';
import formataValor from '../../scripts/formataValor.js';
import { useOrcamentosStore } from '../../context/OrcamentosStore.js';
import LinhaPadrao from '../CardsOrcamento/components/LinhaPadrao.jsx';
import formataValor from '../../../scripts/formataValor.js';
import { useOrcamentosStore } from '../../../context/OrcamentosStore.js';
import LinhaPadrao from '../components/LinhaPadrao.jsx';

const CardOrcamentoLona = ({ orcamento, index }) => {
const CardOrcamentoLona = ({ orcamento, index, tipo }) => {
const removerOrcamentoLona = useOrcamentosStore(state => state.removerOrcamentoLona)
const { showPopup } = usePopup();
const [infoCompleta, setInfoCompleta] = React.useState(false)
Expand Down Expand Up @@ -35,7 +35,7 @@ const CardOrcamentoLona = ({ orcamento, index }) => {
shadow-card outline-none hover:outline-indigo-600'
>
<div className='flex justify-between items-center' >
<h2 className='text-xl text-purple-400 font-semibold' >Informações da Lona</h2>
<h2 className='text-xl text-purple-400 font-semibold' >Lona - {tipo}</h2>
<button className='rounded-full flex justify-center items-center w-10 h-10 p-0 bg-fundo-verde hover:bg-fundo-verdeH'
onClick={handleClickRemover}
>
Expand Down
3 changes: 3 additions & 0 deletions src/components/CardsOrcamento/components/CardHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import React from 'react'
import { X } from 'lucide-react';
import { useOrcamentosStore } from '../../../context/OrcamentosStore';
import { usePopup } from '../../../context/PopupContext';


const CardHeader = ({title, type}) => {
const [removerOrcamentoEstrutura, removerOrcamentoAcessorio] = useOrcamentosStore(state =>
[state.removerOrcamentoEstrutura, state.removerOrcamentoAcessorio]
)

const { showPopup } = usePopup()
const handleClickRemover = () =>{
showPopup('Orçamento removido da lista', 'red')
if(type === 'estrutura'){
removerOrcamentoEstrutura()
}else if(type === 'acessorio'){
Expand Down
5 changes: 3 additions & 2 deletions src/components/ExibeOrcamentos/ExibeOrcamentos.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import React from 'react'
import CardOrcamentoLona from '../CardOrcamentoLona/CardOrcamentoLona';
import CardOrcamentoLona from '../CardsOrcamento/CardOrcamentoLona/CardOrcamentoLona.jsx';
import { useOrcamentosStore } from '../../context/OrcamentosStore.js';
import CardOrcamentoEstruturas from '../CardsOrcamento/CardOrcamentoEstruturas/CardOrcamentoEstruturas.jsx';
import CardOrcamentoAcessorios from '../CardsOrcamento/CardOrcamentoAcessorios/CardOrcamentoAcessorios.jsx';


const ExibeOrcamentos = () => {
const [orcamentosLona, orcamentosEstruturas, orcamentoAcessorios] = useOrcamentosStore(state => [state.orcamentosLona, state.orcamentosEstruturas, state.orcamentoAcessorios])

return (
<div className='flex w-fit flex-wrap gap-4'>
{orcamentosLona.map((orcamento, index) => (
<CardOrcamentoLona key={index} orcamento={orcamento} index={index}/>
<CardOrcamentoLona key={index} orcamento={orcamento} index={index} tipo={orcamento.modelo.label}/>
))}
{orcamentosEstruturas.length > 0 &&(
<>
Expand Down
4 changes: 4 additions & 0 deletions src/pages/Impressao/Impressao.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@

.btnImprimir{
font-size: 16px;
background-color: purple;
border-radius: 8px;
padding: 4px 12px;
color: white;
}

0 comments on commit 3c18c8b

Please sign in to comment.