text: (this.webpackJsonpgui=this.webpackJsonpgui||[]).push([[0],{68:function(e,t,c){"use strict";c.r(t);var s=c(1),a=c.n(s),l=c(33),n=c.n(l),i=c(9),o=c(4),r=c(2),d=c(0),j=a.a.createContext();var x=function(e){var t=Object(s.useState)(!1),c=Object(i.a)(t,2),a=c[0],l=c[1],n=Object(s.useState)(!1),o=Object(i.a)(n,2),r=o[0],x=o[1],b=Object(s.useState)(!0),h=Object(i.a)(b,2),m=h[0],u=h[1],O=Object(s.useState)([]),p=Object(i.a)(O,2),f=p[0],g=p[1],N=Object(s.useState)("sin llamar"),v=Object(i.a)(N,2),w=v[0],y=v[1],C=Object(s.useState)(!1),S=Object(i.a)(C,2),k=S[0],L=S[1],P=Object(s.useState)(0),A=Object(i.a)(P,2),F=A[0],z=A[1],R=Object(s.useState)(0),E=Object(i.a)(R,2),D=E[0],T=E[1],I=Object(s.useState)(0),_=Object(i.a)(I,2),M=_[0],H=_[1],J=Object(s.useState)("https://bavel.herokuapp.com"),U=Object(i.a)(J,1)[0];return Object(d.jsx)(j.Provider,{value:{stateMenu:a,setStateMenu:l,listaProspectos:f,setListaProspectos:g,APIDATA:U,stateFormulario:r,setStateFormulario:x,filterOpc:w,setFilter:y,showFilter:k,setShowFilter:L,stateLoading:m,setStateLoading:u,sinLlamar:F,setSinLlamar:z,llamados:D,setLlamados:T,rechazados:M,setRechazados:H},children:e.children})},b={Logotipo:c.p+"static/media/icono.9733382f.png"},h=c(34),m=c.n(h);var u=function(){return Object(d.jsxs)("div",{children:[Object(d.jsxs)("div",{className:"fixed xl:px-32 py-1 xl:pt-3 xl:shadow-lg w-screen bg-white border-b text-gray-500 px-4 py-1 text-center flex justify-between",children:[Object(d.jsxs)("div",{children:[Object(d.jsx)("h1",{className:"text-2xl text-red-500",children:"0"}),Object(d.jsx)("h1",{className:"text-sm",children:"Pendientes"})]}),Object(d.jsxs)("div",{children:[Object(d.jsx)("h1",{className:"text-2xl",children:"0"}),Object(d.jsx)("h1",{className:"text-sm",children:"completados"})]}),Object(d.jsx)("div",{children:Object(d.jsx)("i",{className:"fas fa-sort-amount-down-alt text-2xl p-2"})})]}),Object(d.jsxs)(o.b,{to:"/agregar",className:"border w-11/12 text-gray-500 m-auto mt-4 rounded-2xl px-2 py-1 flex justify-start",children:[Object(d.jsx)("i",{className:"fas fa-plus text-xl"}),Object(d.jsx)("h1",{className:"ml-4",children:"Agregar tarea"})]})]})},O=c(13),p=c.n(O),f=function(){var e=Object(s.useContext)(j),t=e.showFilter,c=e.setShowFilter,a=Object(s.useContext)(j).listaProspectos,l=Object(s.useContext)(j),n=l.filterOpc,i=l.setFilter,o=Object(s.useContext)(j),r=o.sinLlamar,x=o.setSinLlamar,b=Object(s.useContext)(j),h=b.llamados,m=b.setLlamados,u=Object(s.useContext)(j),O=u.rechazados,p=u.setRechazados,f=a.filter((function(e){return"sin llamar"===e.estado})),g=a.filter((function(e){return"Rechazado"===e.estado})),N=a.filter((function(e){return"No contesto"===e.estado}));x(f.length),p(g.length),m(N.length+g.length);var v=function(){return c((function(e){return!e}))};return Object(d.jsxs)("div",{className:"bg-white",children:[Object(d.jsxs)("div",{className:"fixed w-screen bg-white border-b text-gray-500 px-4 xl:px-32 py-1 xl:pt-3 xl:shadow-lg text-center flex justify-between",children:[Object(d.jsxs)("div",{children:[Object(d.jsx)("h1",{className:"text-2xl",children:r}),Object(d.jsx)("h1",{className:"text-sm",children:"Sin llamar"})]}),Object(d.jsxs)("div",{children:[Object(d.jsx)("h1",{className:"text-2xl",children:h}),Object(d.jsx)("h1",{className:"text-sm",children:"Llamados"})]}),Object(d.jsxs)("div",{children:[Object(d.jsx)("h1",{className:"text-2xl",children:O}),Object(d.jsx)("h1",{className:"text-sm",children:"Rechazados"})]}),Object(d.jsx)("div",{onClick:function(){return v()},children:Object(d.jsx)("i",{className:"fas fa-sort-amount-down-alt text-2xl p-2 xl:px-4 xl:mt-2 xl:hover:bg-yellow-500 xl:duration-500 xl:hover:text-white rounded-2xl xl:cursor-pointer "})})]}),t?Object(d.jsxs)("div",{"data-aos":"fade-right",className:"mt-14 xl:mt-16 w-screen fixed py-2 px-1 bg-white text-center text-sm border-b shadow-md xl:border-l-2 xl:border-b-2 xl:float-right xl:w-4/12",children:[Object(d.jsxs)("select",{className:"outline-none bg-white border-b text-black px-2 w-9/12 cursor-pointer",id:"selectFilter",value:n,onChange:function(e){i(e.target.value)},children:[Object(d.jsx)("option",{value:"sin llamar",children:"Sin llamar"}),Object(d.jsx)("option",{value:"Aceptado",children:"Aceptados"}),Object(d.jsx)("option",{value:"Rechazado",children:"Rechazados"}),Object(d.jsx)("option",{value:"No contesto",children:"No contesto"})]}),Object(d.jsx)("div",{onClick:v,className:"float-right cursor-pointer bg-red-500  rounded-xl w-1/12",children:Object(d.jsx)("i",{className:"text-white fas fa-times"})})]}):null]})},g=function(){var e=Object(s.useContext)(j).listaProspectos,t=Object(s.useContext)(j).filterOpc,c=e.filter((function(e){return e.estado===t}));return Object(d.jsx)("div",{className:"mt-14 xl:mt-24 h-screen",children:Object(d.jsx)("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4",children:c.map((function(e){var t="/detalles/?type=prospecto&id=".concat(e._id);return Object(d.jsx)(o.b,{exact:!0,to:t,children:Object(d.jsx)("div",{className:"bg-white shadow-md w-full p-2 rounded xl:rounded-xl border text-black duration-500 hover:shadow-2xl cursor-pointer",children:Object(d.jsxs)("div",{className:"flex justify-between",children:[Object(d.jsx)("h1",{children:e.nombreNegocio}),Object(d.jsx)("h1",{className:"xl:hidden",children:e.telefono})]})})},e._id)}))})})};var N=function(){var e=Object(s.useContext)(j),t=e.stateLoading,c=e.setStateLoading,a=Object(s.useContext)(j).APIDATA,l=Object(s.useContext)(j).setListaProspectos;return Object(s.useEffect)((function(){p.a.get("".concat(a,"/api/system")).then((function(e){c(!1),l(e.data)})).catch((function(e){console.log(e)}))}),[]),Object(d.jsx)("div",{className:"",children:t?Object(d.jsx)("div",{className:"mt-64 m-auto text-5xl text-center w-3/6",children:Object(d.jsx)("i",{className:" animate-spin fas fa-circle-notch"})}):Object(d.jsxs)("div",{children:[f(),Object(d.jsx)(o.b,{to:"/agregar",className:"z-50 fixed bottom-8 right-8 bg-gradient-to-r from-pink-500 to-yellow-500 text-white rounded-full px-3 py-2 ",children:Object(d.jsx)("i",{className:"fas fa-plus text-2xl"})}),Object(d.jsx)("div",{className:"px-4 pt-8",children:g()})]})})},v=c(12);function w(){var e=Object(s.useContext)(j).APIDATA,t=Object(s.useContext)(j).stateFormulario,c=Object(s.useContext)(j).setStateFormulario,a=Object(s.useContext)(j).listaProspectos,l=e,n="outline-none text-black bg-white border-b-2 border-yellow-500 rounded-lg w-full h-12 mt-2 px-4";return Object(d.jsx)("div",{children:Object(d.jsx)(v.d,{initialValues:{nombreNegocio:"",telefono:"",direccion:""},validate:function(e){var t={};return e.telefono?/^[+]?([0-9]+(?:[0-9]*)?|[0-9]+)$/.test(e.telefono)||(t.telefono="Favor de ingresar solo numeros del 0 al 9"):t.telefono="ingresa un numero de telefono",e.nombreNegocio||(t.nombreNegocio="ingresa un nombre"),e.direccion||(t.direccion="ingresa una direccion"),t},onSubmit:function(e){if(a.filter((function(t){return t.telefono===e.telefono})).length>0)alert("El numero ya esta registrado en otro negocio");else{var t=e;p.a.post("".concat(l,"/api/system"),t).then((function(){c(!0),window.location.assign("/")})).catch((function(e){console.log(e)}))}},children:function(e){var c=e.errors;return Object(d.jsx)("div",{className:"z-40 xl:mt-40",children:Object(d.jsx)("div",{"data-aos":"fade-right",className:"pt-8 mb-8",children:Object(d.jsxs)("div",{className:"w-5/6 border rounded-md text-black m-auto p-4 shadow-xl ",children:[Object(d.jsx)(o.b,{exact:!0,to:"/prospectos",children:Object(d.jsx)("span",{className:" relative xl:float-right text-white bg-red-500 px-4 pb-1 rounded-full cursor-pointer",children:Object(d.jsx)("b",{children:"x"})})}),Object(d.jsx)("div",{className:"text-center mb-4",children:Object(d.jsx)("b",{children:"Registrar prospecto"})}),Object(d.jsxs)(v.c,{className:"grid grid-cols-1 xl:grid-cols-3 gap-8 ",children:[Object(d.jsxs)("div",{className:" mb-5",children:[Object(d.jsx)("label",{htmlFor:"Negocio",children:"Negocio:"}),Object(d.jsx)(v.b,{name:"nombreNegocio",id:"nombreNegocio",type:"text",placeholder:"Nombre del negocio",className:n}),Object(d.jsx)(v.a,{name:"nombreNegocio",component:function(){return Object(d.jsx)("div",{className:"text-red-500",children:c.nombreNegocio})}})]}),Object(d.jsxs)("div",{className:" mb-5",children:[Object(d.jsx)("label",{htmlFor:"Telefono",children:"Telefono:"}),Object(d.jsx)(v.b,{name:"telefono",id:"telefono",type:"text",placeholder:"Numero de telefono",className:n}),Object(d.jsx)(v.a,{name:"telefono",component:function(){return Object(d.jsx)("div",{className:"text-red-500",children:c.telefono})}})]}),Object(d.jsxs)("div",{className:" mb-5",children:[Object(d.jsx)("label",{htmlFor:"Direccion",children:"Direccion:"}),Object(d.jsx)(v.b,{name:"direccion",id:"direccion",type:"text",placeholder:"Direccion del negocio",className:n}),Object(d.jsx)(v.a,{name:"direccion",component:function(){return Object(d.jsx)("div",{className:"text-red-500",children:c.direccion})}})]}),Object(d.jsx)("div",{className:"xl:col-start-2",children:t?Object(d.jsx)("button",{type:"submit",className:"py-1 w-full rounded-xl px-8 bg-yellow-500 hover:bg-yellow-400 duration-500 text-white xl:m-auto",children:Object(d.jsx)("i",{className:"animate-spin fas fa-circle-notch"})}):Object(d.jsx)("button",{type:"submit",className:"py-1 w-full rounded-xl px-8 bg-yellow-500 hover:bg-yellow-400 duration-500 text-white xl:m-auto",children:"Registrar"})})]})]})})})}})})}var y="text-black bg-white py-2 px-4 border-b-2";function C(e){var t,c=Object(s.useContext)(j).listaProspectos,a=Object(s.useContext)(j).APIDATA,l=new URLSearchParams(Object(r.f)().search),n=(t=l.get("id"),c.find((function(e){return e._id===t}))),i=function(){return window.open("tel:+52".concat(n.telefono))},x=function(e,t){var c=n;p.a.put("".concat(a,"/api/system/").concat(e,"/").concat(n._id,"/").concat(t),c).then(window.location.assign("/prospectos")).catch((function(e){return console.log("hubo un error "+e)}))};return Object(d.jsx)("div",{children:Object(d.jsx)("div",{"data-aos":"fade-right",children:Object(d.jsxs)("div",{className:"border-b shadow-xl bg-white mt-6 p-4 xl:w-8/12 xl:m-auto xl:rounded-2xl xl:border xl:bg-white xl:mt-14",children:[Object(d.jsxs)("div",{className:"text-center pb-4",children:[Object(d.jsx)("b",{children:"Prospecto"}),Object(d.jsx)(o.b,{exact:!0,to:"/prospectos",className:"bg-red-500 text-white px-2 rounded-full float-right",children:Object(d.jsx)("i",{className:" fas fa-times "})})]}),Object(d.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[Object(d.jsxs)("div",{children:[Object(d.jsx)("label",{htmlFor:"negocio",children:"Nombre del negocio:"}),Object(d.jsx)("div",{className:y,children:n.nombreNegocio})]}),Object(d.jsxs)("div",{children:[Object(d.jsx)("label",{htmlFor:"direccion",children:"Direcci\xf3n:"}),Object(d.jsx)("div",{className:y,children:n.direccion})]}),Object(d.jsxs)("div",{children:[Object(d.jsx)("label",{htmlFor:"telefono",children:"Numero de telefono:"}),Object(d.jsx)("div",{className:y,children:n.telefono})]}),Object(d.jsxs)("div",{children:[Object(d.jsx)("label",{htmlFor:"estado",children:"Estado:"}),Object(d.jsx)("div",{className:y,children:n.estado})]}),Object(d.jsxs)("div",{children:[Object(d.jsx)("label",{htmlFor:"llamada",children:"Ultima llamada:"}),Object(d.jsx)("div",{className:y,children:n.primeraLlamada})]}),Object(d.jsxs)("div",{className:"flex justify-between gap-x-4 mb-6 xl:px-24 xl:mt-8",children:[Object(d.jsxs)("button",{onClick:function(){x("updateEstado","Rechazado")},className:"bg-red-500 px-2 rounded-2xl text-white ",children:["Rechazado ",Object(d.jsx)("i",{className:"fas fa-times"})]}),Object(d.jsx)("button",{onClick:function(){x("updateEstado","No contesto")},className:"bg-gray-500 px-2 rounded-2xl text-white ",children:"No contesto "}),Object(d.jsxs)("button",{onClick:function(){x("updateEstado","Aceptado")},className:"bg-green-500 px-2 rounded-2xl text-white ",children:["Aceptado ",Object(d.jsx)("i",{className:"fas fa-check"})]})]}),Object(d.jsx)("div",{onClick:i,className:"xl:hidden bg-green-600 text-white p-2 w-1/2 rounded-2xl m-auto text-center",children:Object(d.jsx)("i",{className:"fas fa-phone"})})]})]})})})}var S=function(){return Object(d.jsx)("div",{children:C()})};var k=function(){var e=Object(s.useContext)(j).listaProspectos,t=Object(s.useContext)(j),c=t.sinLlamar,a=t.setSinLlamar,l=Object(s.useContext)(j),n=l.stateLoading,i=l.setStateLoading,r=Object(s.useContext)(j).APIDATA,x=Object(s.useContext)(j).setListaProspectos;a(e.filter((function(e){return"sin llamar"===e.estado})).length),Object(s.useEffect)((function(){p.a.get("".concat(r,"/api/system")).then((function(e){i(!1),x(e.data)})).catch((function(e){console.log(e)}))}),[]);var b="border shadow-lg xl:hover:shadow-2xl duration-500 px-2 py-6 rounded-2xl text-center";return Object(d.jsx)("div",{className:"",children:n?Object(d.jsx)("div",{className:"mt-64 m-auto text-5xl text-center w-3/6",children:Object(d.jsx)("i",{className:" animate-spin fas fa-circle-notch"})}):Object(d.jsx)("div",{className:"mt-36 xl:mt-56",children:Object(d.jsxs)("div",{className:"m-auto w-8/12 p-2 grid grid-cols-1 xl:grid-cols-2 gap-12",children:[Object(d.jsxs)(o.b,{to:"/prospectos",className:b,children:[Object(d.jsx)("b",{children:c}),Object(d.jsx)("br",{}),Object(d.jsx)("b",{children:"Prospectos sin llamar"})]}),Object(d.jsxs)(o.b,{to:"/pendientes",className:b,children:[Object(d.jsx)("b",{children:"0"}),Object(d.jsx)("br",{}),Object(d.jsx)("b",{children:"Pendientes"})]})]})})})},L=function(){var e=Object(s.useState)(!1),t=Object(i.a)(e,2),c=t[0],a=t[1],l=function(){return a((function(e){return!e}))};return Object(d.jsxs)("div",{"data-aos":"fade-down",className:"z-50 fixed w-screen ",children:[Object(d.jsxs)("div",{className:" bg-black px-4 py-1 text-white flex justify-between",children:[Object(d.jsx)("img",{onClick:function(){return window.location.assign("/")},src:b.Logotipo,alt:"logo",className:"w-4 cursor-pointer"}),Object(d.jsx)("i",{onClick:l,className:"fas fa-bars text-2xl xl:hidden"}),Object(d.jsxs)("div",{className:"hidden xl:flex pr-8",children:[Object(d.jsx)(o.b,{exact:!0,to:"/",activeClassName:"text-yellow-600",className:"px-8 py-2 flex justify-between",children:Object(d.jsx)("h1",{children:"Home"})}),Object(d.jsx)(o.b,{className:"px-8 py-2 flex justify-between",activeClassName:"text-yellow-600",to:"/pendientes",children:Object(d.jsx)("h1",{children:"Pendientes"})}),Object(d.jsx)(o.b,{to:"/prospectos",activeClassName:"text-yellow-600",className:"px-8 py-2 flex justify-between",children:Object(d.jsx)("h1",{children:"Prospectos"})})]})]}),c?Object(d.jsxs)("div",{"data-aos":"fade-left","data-aos-duration":"400",className:"z-50 xl:hidden text-white float-right py-4 w-5/12 bg-black grid grid-rows gap-y-2",children:[Object(d.jsxs)(o.b,{exact:!0,to:"/",activeClassName:"text-yellow-600",onClick:l,className:"px-4 py-2 flex justify-between",children:[Object(d.jsx)("i",{className:"fas fa-home text-lg"}),Object(d.jsx)("h1",{children:"Home"})]}),Object(d.jsxs)(o.b,{onClick:l,className:"px-4 py-2 flex justify-between",activeClassName:"text-yellow-600",to:"/pendientes",children:[Object(d.jsx)("i",{className:"far fa-clock text-lg"}),Object(d.jsx)("h1",{children:"Pendientes"})]}),Object(d.jsxs)(o.b,{to:"/prospectos",activeClassName:"text-yellow-600",onClick:l,className:"px-4 py-2 flex justify-between",children:[Object(d.jsx)("i",{className:"fas fa-users text-lg"}),Object(d.jsx)("h1",{children:"Prospectos"})]})]}):null]})},P=function(){return Object(d.jsx)("div",{className:"bg-gray-900 h-screen pt-32 text-white",children:Object(d.jsxs)("div",{className:"m-auto text-center w-10/12 ",children:[Object(d.jsx)("h1",{className:"text-3xl my-8",children:"Error 404"}),Object(d.jsx)("img",{src:b.Logotipo,alt:"logo",className:"w-24 m-auto"}),Object(d.jsx)("h1",{className:"text-2xl my-4",children:"Lo sentimos no encontramos esta pagina"})]})})};var A=function(){return Object(s.useEffect)((function(){m.a.init({duration:650})}),[]),Object(d.jsx)("div",{className:"",children:Object(d.jsx)(x,{children:Object(d.jsxs)(o.a,{children:[L(),Object(d.jsxs)(r.c,{children:[Object(d.jsx)(r.a,{exact:!0,path:"/pendientes",children:Object(d.jsx)("div",{className:"pt-9",children:Object(d.jsx)(u,{})})}),Object(d.jsx)(r.a,{exact:!0,path:"/agregar",children:Object(d.jsxs)("div",{className:"pt-9",children:[Object(d.jsx)(w,{})," "]})}),Object(d.jsx)(r.a,{exact:!0,path:"/prospectos",children:Object(d.jsxs)("div",{className:"pt-9",children:[Object(d.jsx)(N,{})," "]})}),Object(d.jsx)(r.a,{exact:!0,path:"/detalles/",children:Object(d.jsxs)("div",{className:"pt-9",children:[Object(d.jsx)(S,{})," "]})}),Object(d.jsx)(r.a,{exact:!0,path:"/",children:Object(d.jsxs)("div",{className:"pt-9 xl:pt-12",children:[Object(d.jsx)(k,{})," "]})}),Object(d.jsx)(r.a,{path:"*",component:P})]})]})})})};n.a.render(Object(d.jsx)(a.a.StrictMode,{children:Object(d.jsx)(A,{})}),document.getElementById("root"))}},[[68,1,2]]]);
  //# sourceMappingURL=main.a5e7de75.chunk.js.map