- Add PublicCampaignsController for public campaign analytics
- Add public routes for /public/analytics/{slug} and /api/campaigns/{slug}
- Add public campaign analytics view with charts and KPIs
- Support for campaign sharing via custom slugs
- Real-time analytics with ApexCharts integration
1 line
2.6 KiB
JavaScript
1 line
2.6 KiB
JavaScript
export default()=>({totalContacts:null,activeLeads:null,newThisMonth:null,conversionRate:null,async init(){try{const e=await fetch("/api/dashboard/crm/summary");if(e.ok){const t=await e.json();this.totalContacts=t.total_contactos,this.activeLeads=t.leads_ativos,this.newThisMonth=t.novos_mes,this.conversionRate=t.taxa_conversao}}catch(e){}this.initSalesForecastChart(),this.initDealTypeChart(),this.initRevenueExpensesChart()},initSalesForecastChart(){const e={series:[{name:"Goal",data:[37]},{name:"Pending Forecast",data:[12]},{name:"Revenue",data:[18]}],chart:{type:"bar",height:341,toolbar:{show:!1}},plotOptions:{bar:{horizontal:!1,columnWidth:"65%"}},stroke:{show:!0,width:5,colors:["transparent"]},xaxis:{categories:[""],axisTicks:{show:!1,borderType:"solid",color:"#78909C",height:6,offsetX:0,offsetY:0},title:{text:"Total Forecasted Value",offsetX:0,offsetY:-30,style:{color:"#78909C",fontSize:"12px",fontWeight:400}}},yaxis:{labels:{formatter:e=>`$${e}k`},tickAmount:4,min:0},fill:{opacity:1},legend:{show:!0,position:"bottom",horizontalAlign:"center",fontWeight:500,offsetX:0,offsetY:-14,itemMargin:{horizontal:8,vertical:0},markers:{width:10,height:10}}};this.$nextTick(()=>{window.ApexCharts&&document.getElementById("sales-forecast-chart")&&new ApexCharts(document.getElementById("sales-forecast-chart"),e).render()})},initDealTypeChart(){const e={series:[{name:"Pending",data:[80,50,30,40,100,20]},{name:"Loss",data:[20,30,40,80,20,80]},{name:"Won",data:[44,76,78,13,43,10]}],chart:{height:341,type:"radar",dropShadow:{enabled:!0,blur:1,left:1,top:1},toolbar:{show:!1}},stroke:{width:2},fill:{opacity:.2},legend:{show:!0,fontWeight:500,offsetX:0,offsetY:-8,markers:{width:8,height:8,radius:6},itemMargin:{horizontal:10,vertical:0}},markers:{size:0},xaxis:{categories:["2016","2017","2018","2019","2020","2021"]}};this.$nextTick(()=>{window.ApexCharts&&document.getElementById("deal-type-charts")&&new ApexCharts(document.getElementById("deal-type-charts"),e).render()})},initRevenueExpensesChart(){const e={series:[{name:"Revenue",data:[20,25,30,35,40,55,70,110,150,180,210,250]},{name:"Expenses",data:[12,17,45,42,24,35,42,75,102,108,156,199]}],chart:{height:290,type:"area",toolbar:{show:!1}},stroke:{curve:"smooth",width:2},fill:{type:"gradient",gradient:{shadeIntensity:1,opacityFrom:.7,opacityTo:.2,stops:[0,90,100]}},xaxis:{categories:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},yaxis:{labels:{formatter:e=>`$${e}k`}},legend:{position:"top",horizontalAlign:"right"}};this.$nextTick(()=>{window.ApexCharts&&document.getElementById("revenue-expenses-charts")&&new ApexCharts(document.getElementById("revenue-expenses-charts"),e).render()})}}); |