Spaces:
Sleeping
Sleeping
| import SecaoHeader from "../components/SecaoHeader.jsx"; | |
| import StatGrid from "../components/StatGrid.jsx"; | |
| import HighlightsCards from "../components/HighlightsCards.jsx"; | |
| import { moeda, num, pct, pipelineVal } from "../format.js"; | |
| export default function Opportunities({ dia }) { | |
| const O = dia.metrics?.opportunities || {}; | |
| const porVendedor = O.pipeline_by_owner || {}; | |
| const vendedores = Object.keys(porVendedor); | |
| const total = O.open_pipeline_product_value || O.open_pipeline_amount || 0; | |
| return ( | |
| <> | |
| <div className="card"> | |
| <SecaoHeader icone="πΌ" titulo={"Oportunidades β " + dia.date} cor="#2563eb" /> | |
| <StatGrid | |
| itens={[ | |
| ["π", "Novas", num(O.new_opportunities), "blue"], | |
| ["π", "Abertas", num(O.open_opportunities), "blue"], | |
| ["π", "Ganhas", num(O.won_opportunities), "green"], | |
| ["π", "Perdidas", num(O.lost_opportunities), "red"], | |
| ["π°", "Pipeline aberto", moeda(pipelineVal(O)), "violet"], | |
| ["π΅", "Valor ganho", moeda(O.won_amount), "green"], | |
| ["π―", "Win rate", pct(O.win_rate), "blue"], | |
| ["π", "Loss rate", pct(O.loss_rate), "amber"], | |
| ["π§", "Paradas", num(O.stalled_opportunities), "amber"], | |
| ["π΄", "Alto valor paradas", num(O.high_value_stalled_opportunities), "red"], | |
| ["π", "Sem prΓ³xima tarefa", num(O.opportunities_without_next_task), "amber"], | |
| ["π ", "Fecham no mΓͺs", num(O.opportunities_closing_this_month), "violet"], | |
| ]} | |
| /> | |
| </div> | |
| {vendedores.length > 0 && ( | |
| <div className="card"> | |
| <SecaoHeader | |
| icone="π°" | |
| titulo="Pipeline por vendedor" | |
| cor="#2563eb" | |
| extra={<span className="chip">Total: {moeda(total)}</span>} | |
| /> | |
| <table className="owners"> | |
| <thead> | |
| <tr> | |
| <th>Vendedor</th> | |
| <th style={{ textAlign: "right" }}>Pipeline</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| {vendedores.map((k) => ( | |
| <tr key={k}> | |
| <td>{k}</td> | |
| <td style={{ textAlign: "right" }}>{moeda(porVendedor[k])}</td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| )} | |
| <HighlightsCards highlights={dia.highlights} chaves={["oportunidades_travadas", "oportunidades_ganhas"]} /> | |
| </> | |
| ); | |
| } | |