(this["webpackJsonpco-front"]=this["webpackJsonpco-front"]||[]).push([[0],{108:function(e,t,c){"use strict";c.r(t);var a=c(1),n=c.n(a),o=c(24),r=c.n(o),s=(c(76),c(77),c(25)),l=c(0);var d=function(){return Object(l.jsxs)("div",{className:"sidebar","data-color":"black","data-active-color":"react",children:[Object(l.jsxs)("div",{className:"logo",children:[Object(l.jsx)("a",{href:"/",className:"simple-text logo-mini",children:Object(l.jsx)("div",{className:"logo-image-small",children:Object(l.jsx)("i",{className:"fab fa-react fa-2x"})})}),Object(l.jsx)("a",{href:"/",className:"simple-text logo-normal",children:"CO200 electronics"})]}),Object(l.jsx)("div",{className:"sidebar-wrapper",children:Object(l.jsxs)("ul",{className:"nav",children:[Object(l.jsx)("li",{className:"active ",children:Object(l.jsxs)(s.b,{to:"/",children:[Object(l.jsx)("i",{className:"fas fa-home"}),Object(l.jsx)("p",{children:"Home"})]})}),Object(l.jsx)("li",{children:Object(l.jsxs)(s.b,{to:"/ventas",children:[Object(l.jsx)("i",{className:"fab fa-accessible-icon"}),Object(l.jsx)("p",{children:"Gestion Ventas"})]})}),Object(l.jsx)("li",{children:Object(l.jsxs)(s.b,{to:"/productos",children:[Object(l.jsx)("i",{className:"fas fa-boxes"}),Object(l.jsx)("p",{children:"Gestion Productos"})]})}),Object(l.jsx)("li",{children:Object(l.jsxs)(s.b,{to:"./usuarios",children:[Object(l.jsx)("i",{className:"fas fa-user-cog"}),Object(l.jsx)("p",{children:"Gestion Usuarios"})]})})]})})]})},i=c(110),j=c(111);var u=function(e){return Object(l.jsx)("footer",{className:"footer"+(e.default?" footer-default":""),children:Object(l.jsx)(i.a,{fluid:!!e.fluid,children:Object(l.jsxs)(j.a,{children:[Object(l.jsx)("nav",{className:"footer-nav",children:Object(l.jsxs)("ul",{children:[Object(l.jsx)("li",{children:Object(l.jsx)("a",{href:"https://github.com/ciroac3188/co200",rel:"noreferrer",target:"_blank",children:"Equipo 13 MisionTic 2022"})}),Object(l.jsx)("li",{children:Object(l.jsx)("a",{href:"https://lms.misiontic2022udea.com/login/index.php",rel:"noreferrer",target:"_blank",children:"UDEA."})})]})}),Object(l.jsx)("div",{className:"credits ml-auto",children:Object(l.jsxs)("div",{className:"copyright",children:["\xa9 ",1900+(new Date).getYear(),", Elaborador por CO200 ","",Object(l.jsx)("i",{className:"fab fa-react"})," Equipo 13 CO200"]})})]})})})},b=c(11),x=c(9),O=c.n(x),h=c(14),p=c(5),f=c.p+"static/media/altumcode-Ui3zMjpMrmM-unsplash.f5576a9c.jpg",m=c.p+"static/media/christina-wocintechchat-com-R_W_9D-53lw-unsplash.952a8e87.jpg",v=c.p+"static/media/screen-post-wcoXr9o83o8-unsplash.a48da258.jpg",g=c(29),y=c(113),C=c(114),E=c(115),I=c(116),T=c(117),N=c(112),S=function(e){var t=e.typebuttom,c=e.text,a=e.onClick;return 1===t?Object(l.jsx)(N.a,{variant:"primary",onClick:a,children:c}):2===t?Object(l.jsx)(N.a,{variant:"danger",onClick:a,children:c}):Object(l.jsx)("h1",{children:" TYPEBUTTOM NOT FOUND "})},w=c(69),U=c.n(w),k=c(32),B=c(119),F=c(120),P=function(e){var t=e.text,c=e.type,a=e.onChange;return Object(l.jsxs)(F.a.Group,{className:"mb-3",controlId:t,children:[Object(l.jsx)(F.a.Label,{children:t}),Object(l.jsx)(F.a.Control,{type:c,placeholder:"Ingrese ".concat(t),onChange:a})]})},_=function(e){var t=e.show,c=e.handleClose,n=e.onSend,o=Object(a.useState)(""),r=Object(p.a)(o,2),s=r[0],d=r[1],i=Object(a.useState)(""),j=Object(p.a)(i,2),u=j[0],b=j[1],x=Object(a.useState)(""),O=Object(p.a)(x,2),h=O[0],f=O[1];return Object(l.jsx)(l.Fragment,{children:Object(l.jsx)(B.a,{show:t,children:Object(l.jsxs)(F.a,{method:"post",children:[Object(l.jsx)(B.a.Header,{children:Object(l.jsx)(B.a.Title,{children:"Registro"})}),Object(l.jsxs)(B.a.Body,{children:[Object(l.jsx)(P,{text:"Nombre Completo:",value:s,defaultText:"Nombre",type:1,onChange:function(e){return d(e.target.value)}}),Object(l.jsx)(P,{text:"Tel\xe9fono:",value:u,defaultText:"Telefono",type:1,onChange:function(e){return b(e.target.value)}}),Object(l.jsx)(P,{text:"Email:",value:h,defaultText:"Email",type:1,onChange:function(e){return f(e.target.value)}})]}),Object(l.jsxs)(B.a.Footer,{children:[Object(l.jsx)(S,{typebuttom:1,text:"Enviar registro",onClick:function(){var e={nombre:s,telefono:u,rol:"vendedor",email:h,estado:"pendiente"};console.log(s+u),n(e),d(""),b(""),f("")}}),Object(l.jsx)(S,{typebuttom:2,text:"Cerrar",onClick:c})]})]})})})},D=c(16),R=c.n(D),A=function(){var e=Object(a.useState)(!1),t=Object(p.a)(e,2),c=t[0],n=t[1],o=function(){return n(!1)};function r(){return(r=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log(t),R.a.post("http://localhost:3010/api/v1/user/add",t),o();case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return Object(l.jsxs)(l.Fragment,{children:[Object(l.jsxs)(k.a,{className:"justify-content-end",activeKey:"/home",children:[Object(l.jsx)(k.a.Item,{children:Object(l.jsx)(k.a.Link,{children:Object(l.jsx)(U.a,{clientId:"429513669075-ht7ane4fnotjik9nsb4slp01h0qhegbv.apps.googleusercontent.com",buttonText:"Login",onSuccess:function(e){console.log(e),console.log(e.profileObj)},onFailure:function(e){console.log(e)},cookiePolicy:"single_host_origin"})})}),Object(l.jsx)(k.a.Item,{children:Object(l.jsx)(k.a.Link,{eventKey:"link-3",children:Object(l.jsx)(S,{typebuttom:1,text:"Sign Up",onClick:function(){return n(!0)}})})})]}),Object(l.jsx)("div",{children:Object(l.jsx)(j.a,{children:Object(l.jsx)(y.a,{md:"12",children:Object(l.jsxs)(C.a,{children:[Object(l.jsx)(E.a,{children:Object(l.jsx)("div",{align:"left",children:Object(l.jsx)(I.a,{children:"The best components... for the best ideas"})})}),Object(l.jsxs)(T.a,{children:[Object(l.jsxs)(g.a,{children:[Object(l.jsxs)(g.a.Item,{interval:1e3,children:[Object(l.jsx)("img",{className:"d-block w-100",src:f,alt:"Setup your best office at home"}),Object(l.jsx)(g.a.Caption,{children:Object(l.jsx)("h3",{children:"Setup your best office at home"})})]}),Object(l.jsxs)(g.a.Item,{interval:1e3,children:[Object(l.jsx)("img",{className:"d-block w-100",src:m,alt:"Setup your best office at home"}),Object(l.jsx)(g.a.Caption,{children:Object(l.jsx)("h3",{children:"Setup your best office at home"})})]}),Object(l.jsxs)(g.a.Item,{interval:1e3,children:[Object(l.jsx)("img",{className:"d-block w-100",src:v,alt:"Setup your best office at home"}),Object(l.jsx)(g.a.Caption,{children:Object(l.jsx)("h3",{children:"Setup your best office at home"})})]})]}),Object(l.jsx)(_,{show:c,handleClose:o,onSend:function(e){return r.apply(this,arguments)}})]})]})})})})]})},V=c(118),L=function(e){var t=e.data,c=e.dataMenus,a=e.option,n=e.onDeletebuttom,o=e.onUpdateButton,r=function(e){console.log("id para borrar"+e),n(e)};return 1===a?Object(l.jsx)("div",{className:"DefaultTable",children:Object(l.jsxs)(V.a,{striped:!0,bordered:!0,hover:!0,children:[Object(l.jsx)("thead",{children:Object(l.jsx)("tr",{children:c.map((function(e){return Object(l.jsx)("th",{children:e.col},e.id)}))})}),Object(l.jsx)("tbody",{children:t.map((function(e,t){return Object(l.jsxs)("tr",{children:[Object(l.jsx)("td",{children:t+1}),Object(l.jsx)("td",{children:e.nombre}),Object(l.jsx)("td",{children:e.telefono}),Object(l.jsx)("td",{children:e.email}),Object(l.jsx)("td",{children:e.rol}),Object(l.jsx)("td",{children:e.estado}),Object(l.jsxs)("td",{children:[Object(l.jsx)(S,{typebuttom:1,text:"EDITAR",onClick:function(){return o(e)}}),"  ",Object(l.jsx)("br",{}),Object(l.jsx)(S,{typebuttom:2,text:"ELIMINAR",onClick:function(){return r(e._id)}})]})]},e._id)}))})]})}):2===a?Object(l.jsx)("div",{className:"DefaultTable",children:Object(l.jsxs)(V.a,{striped:!0,bordered:!0,hover:!0,children:[Object(l.jsx)("thead",{children:Object(l.jsx)("tr",{children:c.map((function(e){return Object(l.jsx)("th",{children:e.col},e.id)}))})}),Object(l.jsx)("tbody",{children:t.map((function(e,t){return Object(l.jsxs)("tr",{children:[Object(l.jsx)("td",{children:t+1}),Object(l.jsx)("td",{children:e.producto}),Object(l.jsx)("td",{children:e.valor}),Object(l.jsx)("td",{children:e.estado}),Object(l.jsxs)("td",{children:[Object(l.jsx)(S,{typebuttom:1,text:"EDITAR",onClick:function(){return o(e)}}),"  ",Object(l.jsx)("br",{}),Object(l.jsx)(S,{typebuttom:2,text:"ELIMINAR",onClick:function(){return r(e._id)}})]})]},e._id)}))})]})}):3===a?Object(l.jsx)("div",{className:"DefaultTable",children:Object(l.jsxs)(V.a,{striped:!0,bordered:!0,hover:!0,children:[Object(l.jsx)("thead",{children:Object(l.jsx)("tr",{children:c.map((function(e){return Object(l.jsx)("th",{children:e.col},e.id)}))})}),Object(l.jsx)("tbody",{children:t.map((function(e,t){return Object(l.jsxs)("tr",{children:[Object(l.jsx)("td",{children:t+1}),Object(l.jsx)("td",{children:e.clienteId}),Object(l.jsx)("td",{children:e.clienteNombre}),Object(l.jsx)("td",{children:e.ventaFecha}),Object(l.jsx)("td",{children:e.ventaEstado}),Object(l.jsx)("td",{children:e.productoId}),Object(l.jsx)("td",{children:e.productoCantidad*e.productoPrecio}),Object(l.jsxs)("td",{children:[Object(l.jsx)(S,{typebuttom:1,text:"EDITAR",onClick:function(){return o(e)}}),"  ",Object(l.jsx)("br",{}),Object(l.jsx)(S,{typebuttom:2,text:"ELIMINAR",onClick:function(){return r(e._id)}})]})]},e._id)}))})]})}):void 0},M=function(e){var t=e.show,c=e.handleClose,n=e.onSend,o=Object(a.useState)(""),r=Object(p.a)(o,2),s=r[0],d=r[1],i=Object(a.useState)(""),j=Object(p.a)(i,2),u=j[0],b=j[1],x=Object(a.useState)(""),O=Object(p.a)(x,2),h=O[0],f=O[1],m=Object(a.useState)(""),v=Object(p.a)(m,2),g=v[0],y=v[1],C=Object(a.useState)(""),E=Object(p.a)(C,2),I=E[0],T=E[1],N=Object(a.useState)(""),w=Object(p.a)(N,2),U=w[0],k=w[1],_=Object(a.useState)(0),D=Object(p.a)(_,2),R=D[0],A=D[1],V=Object(a.useState)(0),L=Object(p.a)(V,2),M=L[0],G=L[1],H=Object(a.useState)(0),K=Object(p.a)(H,2),q=K[0],z=K[1];return Object(l.jsx)(l.Fragment,{children:Object(l.jsx)(B.a,{show:t,children:Object(l.jsxs)(F.a,{method:"post",children:[Object(l.jsx)(B.a.Header,{children:Object(l.jsx)(B.a.Title,{children:"Registrar Venta"})}),Object(l.jsxs)(B.a.Body,{children:[Object(l.jsx)(P,{text:"Id Cliente:",value:s,defaultText:"Id Cliente",type:"text",onChange:function(e){return d(e.target.value)}}),Object(l.jsx)(P,{text:"Nombre Cliente:",value:u,defaultText:"Nombre Cliente",type:"text",onChange:function(e){return b(e.target.value)}}),Object(l.jsx)(P,{text:"Fecha venta:",value:h,defaultText:"Fecha venta",type:"date",onChange:function(e){return f(e.target.value)}}),Object(l.jsx)(P,{text:"Id Vendedor:",value:g,defaultText:"Id Vendedor",type:"text",onChange:function(e){return y(e.target.value)}}),Object(l.jsx)(P,{text:"Estado:",value:I,defaultText:"Estado",type:"text",onChange:function(e){return T(e.target.value)}}),Object(l.jsx)(P,{text:"Id Producto:",value:U,defaultText:"Id Producto",type:"text",onChange:function(e){return k(e.target.value)}}),Object(l.jsx)(P,{text:"Cantidad:",value:R,defaultText:"Cantidad",type:"number",onChange:function(e){return A(e.target.value)}}),Object(l.jsx)(P,{text:"Precio Unidad:",value:M,defaultText:"Precio unidad",type:"number",onChange:function(e){return G(e.target.value)}}),Object(l.jsx)(P,{text:"Valor Total:",value:R*M,defaultText:"Valor Total",type:"number"})]}),Object(l.jsxs)(B.a.Footer,{children:[Object(l.jsx)(S,{typebuttom:1,text:"Guardar Venta",onClick:function(){var e={clienteId:s,clienteNombre:u,ventaFecha:h,idVendedor:g,ventaEstado:I,productoId:U,productoCantidad:R,productoPrecio:M,valorTotal:q};console.log(s+u),n(e),d(""),b(""),f(""),y(""),T(""),k(""),A(0),G(0),z(0)}}),Object(l.jsx)(S,{typebuttom:2,text:"Cerrar",onClick:c})]})]})})})},G=function(e){var t=e.id,c=e.text,a=e.value,n=e.type,o=e.onChange;return Object(l.jsxs)(F.a.Group,{className:"mb-3",controlId:t,children:[Object(l.jsx)(F.a.Label,{children:c}),Object(l.jsx)(F.a.Control,{type:n,defaultValue:a,placeholder:"Ingrese ".concat(c),onChange:o,disable:"false"})]})},H=function(e){var t=e.data,c=e.show,a=e.handleClose,n=e.onSend;return Object(l.jsx)(l.Fragment,{children:Object(l.jsx)(B.a,{show:c,children:Object(l.jsxs)(F.a,{method:"post",children:[Object(l.jsx)(B.a.Header,{children:Object(l.jsx)(B.a.Title,{children:"Editar Venta"})}),Object(l.jsxs)(B.a.Body,{children:[Object(l.jsx)(G,{id:"clienteIdUpdate",text:"Id Cliente:",value:t.clienteId,type:"text"}),Object(l.jsx)(G,{id:"clienteNombreUpdate",text:"Nombre Cliente:",value:t.clienteNombre,type:"text"}),Object(l.jsx)(G,{id:"ventaFacturaUpdate",text:"Fecha venta:",value:t.ventaFecha,type:"date"}),Object(l.jsx)(G,{id:"idVendedorUpdate",text:"Id Vendedor:",value:t.idVendedor,type:"text"}),Object(l.jsx)(G,{id:"estadoVentaUpdate",text:"Estado:",value:t.ventaEstado,type:"text"}),Object(l.jsx)(G,{id:"productoIdUpdate",text:"Id Producto:",value:t.productoId,type:"text"}),Object(l.jsx)(G,{id:"productoCantidadUpdate",text:"Cantidad:",value:t.productoCantidad,type:"number"}),Object(l.jsx)(G,{id:"productoPrecioUpdate",text:"Precio Unidad:",value:t.productoPrecio,type:"number"}),Object(l.jsx)(G,{id:"valorTotalUpdate",text:"Valor Total:",value:t.productoCantidad*t.productoPrecio,type:"number"})]}),Object(l.jsxs)(B.a.Footer,{children:[Object(l.jsx)(S,{typebuttom:1,text:"Guardar Venta",onClick:function(){var e={_id:t._id,clienteId:document.getElementById("clienteIdUpdate").value,clienteNombre:document.getElementById("clienteNombreUpdate").value,ventaFecha:document.getElementById("ventaFacturaUpdate").value,idVendedor:document.getElementById("idVendedorUpdate").value,ventaEstado:document.getElementById("estadoVentaUpdate").value,productoId:document.getElementById("productoIdUpdate").value,productoCantidad:document.getElementById("productoCantidadUpdate").value,productoPrecio:document.getElementById("productoPrecioUpdate").value};console.log("sendData..."),console.log(e),n(e)}}),Object(l.jsx)(S,{typebuttom:2,text:"Cerrar",onClick:a})]})]})})})},K=[{id:1,col:"ID"},{id:2,col:"ID CLIENTE"},{id:3,col:"NOMBRE CLIENTE"},{id:4,col:"FECHA-FAC"},{id:5,col:"ESTADO"},{id:6,col:"ID PRODUCTO"},{id:7,col:"VALOR TOTAL"},{id:8,col:"ACTIONS"}],q=function(){var e=Object(a.useState)(!1),t=Object(p.a)(e,2),c=t[0],n=t[1],o=function(){return n(!1)},r=Object(a.useState)(!1),s=Object(p.a)(r,2),d=s[0],i=s[1],u=function(){return i(!1)},b=Object(a.useState)([]),x=Object(p.a)(b,2),f=x[0],m=x[1],v=Object(a.useState)({clienteNombre:""}),g=Object(p.a)(v,2),N=g[0],w=g[1];function U(){return(U=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("record a cargar..."),console.log(t.saleo),w(t),i(!0);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log(t),R.a.post("http://localhost:3010/api/v1/sale/add",t),o(),B();case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return F.apply(this,arguments)}function F(){return(F=Object(h.a)(O.a.mark((function e(){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{console.log("a buscar la lista.."),R.a.get("http://localhost:3010/api/v1/sale/list").then((function(e){m(e.data.sales),console.log(e.data.sales)}))}catch(t){console.log(t)}case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(){return(P=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("preparando el borrado..."+t),R.a.delete("http://localhost:3010/api/v1/sale/delete/"+t),B();case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(){return(_=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("preparando para actualizar..."),console.log(t),R.a.put("http://localhost:3010/api/v1/sale/update",t),u(),B();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return Object(a.useEffect)((function(){B()}),[]),Object(l.jsx)(l.Fragment,{children:Object(l.jsx)("div",{className:"content",children:Object(l.jsx)(j.a,{children:Object(l.jsx)(y.a,{md:"12",children:Object(l.jsxs)(C.a,{children:[Object(l.jsxs)(E.a,{children:[Object(l.jsx)(I.a,{tag:"h5",children:"Gestion de Ventas"}),Object(l.jsx)("p",{className:"card-category",children:"Listado de Ventas "})]}),Object(l.jsx)(T.a,{children:Object(l.jsx)(j.a,{children:Object(l.jsx)(y.a,{md:"12",children:Object(l.jsxs)(C.a,{className:"card-plain",children:[Object(l.jsxs)(E.a,{children:[Object(l.jsx)(I.a,{tag:"h6",children:"Fomulario de ventas"}),Object(l.jsxs)("div",{children:[Object(l.jsx)(S,{typebuttom:1,text:"Registrar Venta",onClick:function(){return n(!0)}}),Object(l.jsx)(S,{typebuttom:2,text:"Buscar",onClick:B}),Object(l.jsx)(M,{show:c,handleClose:o,onSend:function(e){return k.apply(this,arguments)}})]})]}),Object(l.jsxs)(T.a,{children:[Object(l.jsx)(L,{data:f,dataMenus:K,option:3,onDeletebuttom:function(e){return P.apply(this,arguments)},onUpdateButton:function(e){return U.apply(this,arguments)}}),Object(l.jsx)(H,{data:N,show:d,handleClose:u,onSend:function(e){return _.apply(this,arguments)}})]})]})})})})]})})})})})},z=function(e){var t=e.show,c=e.handleClose,n=e.onSend,o=Object(a.useState)(""),r=Object(p.a)(o,2),s=r[0],d=r[1],i=Object(a.useState)(""),j=Object(p.a)(i,2),u=j[0],b=j[1],x=Object(a.useState)(""),O=Object(p.a)(x,2),h=O[0],f=O[1];return Object(l.jsx)(l.Fragment,{children:Object(l.jsx)(B.a,{show:t,children:Object(l.jsxs)(F.a,{method:"post",children:[Object(l.jsx)(B.a.Header,{children:Object(l.jsx)(B.a.Title,{children:"Registrar Producto"})}),Object(l.jsxs)(B.a.Body,{children:[Object(l.jsx)(P,{text:"Producto:",value:s,defaultText:"Producto",type:"text",onChange:function(e){return d(e.target.value)}}),Object(l.jsx)(P,{text:"Valor Unitario:",value:u,defaultText:"Valor Unitario",type:"number",onChange:function(e){return b(e.target.value)}}),Object(l.jsx)(P,{text:"Estado:",value:h,defaultText:"Estado",type:"text",onChange:function(e){return f(e.target.value)}})]}),Object(l.jsxs)(B.a.Footer,{children:[Object(l.jsx)(S,{typebuttom:1,text:"Guardar Producto",onClick:function(){var e={producto:s,valor:u,estado:h};console.log(s+h),n(e),d(""),b(""),f("")}}),Object(l.jsx)(S,{typebuttom:2,text:"Cerrar",onClick:c})]})]})})})},W=function(e){var t=e.data,c=e.show,a=e.handleClose,n=e.onSend;return Object(l.jsx)(l.Fragment,{children:Object(l.jsx)(B.a,{show:c,children:Object(l.jsxs)(F.a,{method:"post",children:[Object(l.jsx)(B.a.Header,{children:Object(l.jsx)(B.a.Title,{children:"Editar Producto"})}),Object(l.jsxs)(B.a.Body,{children:[Object(l.jsx)(G,{id:"productoUpdate",text:"Producto:",value:t.producto,type:1}),Object(l.jsx)(G,{id:"valorUpdate",text:"Valor:",value:t.valor,type:1}),Object(l.jsx)(G,{id:"estadoUpdate",text:"Estado:",value:t.estado,type:1})]}),Object(l.jsxs)(B.a.Footer,{children:[Object(l.jsx)(S,{typebuttom:1,text:"Guardar Producto",onClick:function(){var e={_id:t._id,producto:document.getElementById("productoUpdate").value,valor:document.getElementById("valorUpdate").value,estado:document.getElementById("estadoUpdate").value};console.log("sendData..."),console.log(e),n(e)}}),Object(l.jsx)(S,{typebuttom:2,text:"Cerrar",onClick:a})]})]})})})},J=[{id:1,col:"ID"},{id:2,col:"DESCRIPCION"},{id:3,col:"VALOR U"},{id:4,col:"ESTADO"},{id:4,col:"ACTIONS"}],Y=function(){var e=Object(a.useState)(!1),t=Object(p.a)(e,2),c=t[0],n=t[1],o=function(){return n(!1)},r=Object(a.useState)(!1),s=Object(p.a)(r,2),d=s[0],i=s[1],u=function(){return i(!1)},b=Object(a.useState)([]),x=Object(p.a)(b,2),f=x[0],m=x[1],v=Object(a.useState)({producto:""}),g=Object(p.a)(v,2),N=g[0],w=g[1];function U(){return(U=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("record a cargar..."),console.log(t.producto),w(t),i(!0);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log(t),R.a.post("http://localhost:3010/api/v1/product/add",t),o(),B();case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return F.apply(this,arguments)}function F(){return(F=Object(h.a)(O.a.mark((function e(){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{console.log("a buscar la lista.."),R.a.get("http://localhost:3010/api/v1/product/list").then((function(e){m(e.data.products),console.log(e.data.products)}))}catch(t){console.log(t)}case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(){return(P=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("preparando el borrado..."+t),R.a.delete("http://localhost:3010/api/v1/product/delete/"+t),B();case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(){return(_=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("preparando para actualizar..."),console.log(t),R.a.put("http://localhost:3010/api/v1/product/update",t),u(),B();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return Object(a.useEffect)((function(){B()}),[]),Object(l.jsx)(l.Fragment,{children:Object(l.jsx)("div",{className:"content",children:Object(l.jsx)(j.a,{children:Object(l.jsx)(y.a,{md:"12",children:Object(l.jsxs)(C.a,{children:[Object(l.jsxs)(E.a,{children:[Object(l.jsx)(I.a,{tag:"h5",children:"Gestion de Productos"}),Object(l.jsxs)("p",{className:"card-category",children:["Aqui podras crear tus productos"," "]})]}),Object(l.jsx)(T.a,{children:Object(l.jsx)(j.a,{children:Object(l.jsx)(y.a,{md:"12",children:Object(l.jsxs)(C.a,{className:"card-plain",children:[Object(l.jsxs)(E.a,{children:[Object(l.jsx)(I.a,{tag:"h6",children:"Fomulario de productos"}),Object(l.jsxs)("div",{children:[Object(l.jsx)(S,{typebuttom:1,text:"Registrar Producto",onClick:function(){return n(!0)}}),Object(l.jsx)(S,{typebuttom:2,text:"Buscar",onClick:B}),Object(l.jsx)(z,{show:c,handleClose:o,onSend:function(e){return k.apply(this,arguments)}})]})]}),Object(l.jsxs)(T.a,{children:[Object(l.jsx)(L,{data:f,dataMenus:J,option:2,onDeletebuttom:function(e){return P.apply(this,arguments)},onUpdateButton:function(e){return U.apply(this,arguments)}}),Object(l.jsx)(W,{data:N,show:d,handleClose:u,onSend:function(e){return _.apply(this,arguments)}})]})]})})})})]})})})})})},Q=function(e){var t=e.show,c=e.handleClose,n=e.onSend,o=Object(a.useState)(""),r=Object(p.a)(o,2),s=r[0],d=r[1],i=Object(a.useState)(""),j=Object(p.a)(i,2),u=j[0],b=j[1],x=Object(a.useState)(""),O=Object(p.a)(x,2),h=O[0],f=O[1],m=Object(a.useState)(""),v=Object(p.a)(m,2),g=v[0],y=v[1],C=Object(a.useState)(""),E=Object(p.a)(C,2),I=E[0],T=E[1];return Object(l.jsx)(l.Fragment,{children:Object(l.jsx)(B.a,{show:t,children:Object(l.jsxs)(F.a,{method:"post",children:[Object(l.jsx)(B.a.Header,{children:Object(l.jsx)(B.a.Title,{children:"Registrar Usuario"})}),Object(l.jsxs)(B.a.Body,{children:[Object(l.jsx)(P,{text:"Nombre Completo:",value:s,defaultText:"Nombre",type:1,onChange:function(e){return d(e.target.value)}}),Object(l.jsx)(P,{text:"Tel\xe9fono:",value:u,defaultText:"Telefono",type:1,onChange:function(e){return b(e.target.value)}}),Object(l.jsx)(P,{text:"Email:",value:h,defaultText:"Email",type:1,onChange:function(e){return f(e.target.value)}}),Object(l.jsx)(P,{text:"Rol:",value:g,defaultText:"Rol",type:1,onChange:function(e){return y(e.target.value)}}),Object(l.jsx)(P,{text:"Estado:",value:I,defaultText:"Estado",type:1,onChange:function(e){return T(e.target.value)}})]}),Object(l.jsxs)(B.a.Footer,{children:[Object(l.jsx)(S,{typebuttom:1,text:"Guardar Usuario",onClick:function(){var e={nombre:s,telefono:u,rol:g,email:h,estado:I};console.log(s+u),n(e),d(""),b(""),f(""),y(""),T("")}}),Object(l.jsx)(S,{typebuttom:2,text:"Cerrar",onClick:c})]})]})})})},X=function(e){var t=e.data,c=e.show,a=e.handleClose,n=e.onSend;return Object(l.jsx)(l.Fragment,{children:Object(l.jsx)(B.a,{show:c,children:Object(l.jsxs)(F.a,{method:"post",children:[Object(l.jsx)(B.a.Header,{children:Object(l.jsx)(B.a.Title,{children:"Editar Usuario"})}),Object(l.jsxs)(B.a.Body,{children:[Object(l.jsx)(G,{id:"nombreUpdate",text:"Nombre Completo:",value:t.nombre,type:1}),Object(l.jsx)(G,{id:"telefonoUpdate",text:"Tel\xe9fono:",value:t.telefono,type:1}),Object(l.jsx)(G,{id:"emailUpdate",text:"Email:",value:t.email,type:1}),Object(l.jsx)(G,{id:"rolUpdate",text:"Rol:",value:t.rol,type:1}),Object(l.jsx)(G,{id:"estadoUpdate",text:"Estado:",value:t.estado,type:1})]}),Object(l.jsxs)(B.a.Footer,{children:[Object(l.jsx)(S,{typebuttom:1,text:"Guardar Usuario",onClick:function(){var e={_id:t._id,nombre:document.getElementById("nombreUpdate").value,telefono:document.getElementById("telefonoUpdate").value,rol:document.getElementById("rolUpdate").value,email:document.getElementById("emailUpdate").value,estado:document.getElementById("estadoUpdate").value};console.log("sendData..."),console.log(e),n(e)}}),Object(l.jsx)(S,{typebuttom:2,text:"Cerrar",onClick:a})]})]})})})},Z=[{id:1,col:"ID"},{id:2,col:"NOMBRE"},{id:3,col:"TELEFONO"},{id:4,col:"EMAIL"},{id:5,col:"ROL"},{id:6,col:"ESTADO"},{id:7,col:"ACTIONS"}],$=function(){var e=Object(a.useState)(!1),t=Object(p.a)(e,2),c=t[0],n=t[1],o=function(){return n(!1)},r=Object(a.useState)(!1),s=Object(p.a)(r,2),d=s[0],i=s[1],u=function(){return i(!1)},b=Object(a.useState)([]),x=Object(p.a)(b,2),f=x[0],m=x[1],v=Object(a.useState)({nombre:""}),g=Object(p.a)(v,2),N=g[0],w=g[1];function U(){return(U=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("record a cargar..."),console.log(t.nombre),w(t),i(!0);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log(t),R.a.post("http://localhost:3010/api/v1/user/add",t),o(),B();case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return F.apply(this,arguments)}function F(){return(F=Object(h.a)(O.a.mark((function e(){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:try{console.log("a buscar la lista.."),R.a.get(Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_AUTH0_DOMAIN:"dev-otytfd2t.us.auth0.com",REACT_APP_AUTH0_CLIENT_ID:"Vr7W2qRE7Ap53aKpvRcpjiPl8zBvunQt"}).BACKEND_URI+"/api/v1/user/list").then((function(e){m(e.data.users),console.log(e.data.users)}))}catch(t){console.log(t)}case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(){return(P=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("preparando el borrado..."+t),R.a.delete("http://localhost:3010/api/v1/user/delete/"+t),B();case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _(){return(_=Object(h.a)(O.a.mark((function e(t){return O.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("preparando para actualizar..."),console.log(t),R.a.put("http://localhost:3010/api/v1/user/update",t),u(),B();case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return Object(a.useEffect)((function(){B()}),[]),Object(l.jsx)(l.Fragment,{children:Object(l.jsx)("div",{className:"content",children:Object(l.jsx)(j.a,{children:Object(l.jsx)(y.a,{md:"12",children:Object(l.jsxs)(C.a,{children:[Object(l.jsxs)(E.a,{children:[Object(l.jsx)(I.a,{tag:"h5",children:"Gestion de Usuarios"}),Object(l.jsx)("p",{className:"card-category",children:"Listado de usuarios"})]}),Object(l.jsx)(T.a,{children:Object(l.jsx)(j.a,{children:Object(l.jsx)(y.a,{md:"12",children:Object(l.jsxs)(C.a,{className:"card-plain",children:[Object(l.jsx)(E.a,{children:Object(l.jsx)(I.a,{children:Object(l.jsxs)("div",{children:[Object(l.jsx)(S,{typebuttom:1,text:"Registrar Usuario",onClick:function(){return n(!0)}}),Object(l.jsx)(S,{typebuttom:2,text:"Buscar",onClick:B}),Object(l.jsx)(Q,{show:c,handleClose:o,onSend:function(e){return k.apply(this,arguments)}})]})})}),Object(l.jsxs)(T.a,{children:[Object(l.jsx)(L,{data:f,dataMenus:Z,option:1,onDeletebuttom:function(e){return P.apply(this,arguments)},onUpdateButton:function(e){return U.apply(this,arguments)}}),Object(l.jsx)(X,{data:N,show:d,handleClose:u,onSend:function(e){return _.apply(this,arguments)}})]})]})})})})]})})})})})};var ee=function(){return Object(l.jsxs)(b.d,{children:[Object(l.jsxs)(b.b,{exact:!0,path:"/",children:[Object(l.jsx)(b.a,{to:""}),Object(l.jsx)(A,{})]}),Object(l.jsx)(b.b,{path:"/ventas",children:Object(l.jsx)(q,{})}),Object(l.jsx)(b.b,{path:"/productos",children:Object(l.jsx)(Y,{})}),Object(l.jsx)(b.b,{path:"/usuarios",children:Object(l.jsx)($,{})})]})};var te=function(){return Object(l.jsx)("div",{className:"wrapper",children:Object(l.jsxs)(s.a,{children:[Object(l.jsx)(d,{}),Object(l.jsxs)("div",{className:"main-panel",children:[Object(l.jsx)("div",{children:Object(l.jsx)(ee,{})}),Object(l.jsx)(u,{})]})]})})};c(107);r.a.render(Object(l.jsx)(s.a,{children:Object(l.jsx)(n.a.StrictMode,{children:Object(l.jsx)(te,{})})}),document.getElementById("root"))},76:function(e,t,c){},77:function(e,t,c){}},[[108,1,2]]]);
//# sourceMappingURL=main.ac31f683.chunk.js.map