File: /disk001/machen/public_html/sonne/static/js/3.49fb4d93.chunk.js
(this.webpackJsonpmachen=this.webpackJsonpmachen||[]).push([[3],{1893:function(e,t,a){"use strict";a.r(t);var l=a(7),n=a(2),o=a(21),i=a(5),c=a(0),r=a.n(c),d=a(134),s=a(185),u=a(80),b=(a(149),a(3)),f=a(9),v=a.n(f),O=a(1),h=a(482);t.default=function(e){var t=b.a.getState().db,a=Object(c.useState)({index:0,showQuantity:12,number:12,finalIndex:12,dataStructure:"month"}),f=Object(i.a)(a,2),g=f[0],j=f[1],m=Object(c.useState)({total:{value:0,label:"Concluidas",color:"#5A7F71",id:"Concluidas"}}),y=Object(i.a)(m,2),p=y[0],x=y[1],E=Object(c.useState)({}),w=Object(i.a)(E,2),C=w[0],S=w[1],M=Object(c.useRef)([{label:"Concluidas",color:"#5A7F71"}]),_=Object(c.useRef)([]),k=window.location.hash.split("/");k[0]=k[0].replace("#","");var B=function(e){for(var t=0,a=0;a<e.length;a++)t+=e.charCodeAt(a);return"#"+(t%16777215+16777216).toString(16).slice(1,7)};Object(c.useEffect)((function(){Object.keys(e.filter).length>0&&j(e.filter)}),[e.filter]),Object(c.useEffect)((function(){var e;((null===g||void 0===g||null===(e=g.tags)||void 0===e?void 0:e.length)>0||g.tagsByText)&&(_.current=[],t.tag.filter((function(e){return!!(g.tags&&g.tags.length>0&&e.label&&g.tags.filter((function(t){return t.value===e.value})).length>0||g.tagsByText&&e.label&&e.label.toLowerCase().indexOf(g.tagsByText.toLowerCase())>-1)})).forEach((function(e){_.current=[].concat(Object(o.a)(_.current),[e.label])})))}),[g]),Object(c.useEffect)((function(){var a,o,i={},c={},r=[],d=g.startDate?v()(1e3*g.startDate):v()().startOf("year"),s=g.endDate?v()(1e3*g.endDate):v()().endOf("year"),u=(a=d.format("MMMM"),o=s.format("MMMM"),a===o);e.planCards&&(Object.keys(e.planCards).filter((function(e){return!t.cards[e].deleted})).forEach((function(e){var a,o,b,f=!((null===g||void 0===g||null===(a=g.users)||void 0===a?void 0:a.length)>0);g.users&&Object.keys(null===(o=t.cards[e])||void 0===o?void 0:o._users).length>0&&Object.values(null===(b=t.cards[e])||void 0===b?void 0:b._users).forEach((function(e){g.users.forEach((function(t){e._id===t&&(f=!0)}))}));if(f){var h,j={date:v()(1e3*(null===(h=t.cards[e].completed_at)||void 0===h?void 0:h.low)),tags:t.cards[e]._tags};if(j.date.isBetween(d,s,null,"[]")){var m,y,p=j.date.format("MMMM");if((null===g||void 0===g||null===(m=g.tags)||void 0===m?void 0:m.length)>0||g.tagsByText)console.log(null===g||void 0===g?void 0:g.tags,g.tagsByText,j),j.tags.filter((function(e){return g.tags&&g.tags.length>0&&e.label&&_.current.includes(e.label)||g.tagsByText&&e.label&&e.label.toLowerCase().indexOf(g.tagsByText.toLowerCase())>-1})).forEach((function(e){console.log("XXXX",e),function(e,t){var a,o,d,s=t.label,b=e.date.format("MMMM"),f=v()(e.date).startOf("month"),h=v()(e.date).diff(f,"days"),g=Math.floor(h/7)+1;i=Object(n.a)(Object(n.a)({},i),{},Object(l.a)({},s,Object(n.a)(Object(n.a)({},i[s]||{}),{},{id:s,color:(null===t||void 0===t?void 0:t.color)||B(s),label:s,value:((null===(a=i[s])||void 0===a?void 0:a.value)||0)+1}))),c=Object(n.a)(Object(n.a)({},c),{},Object(l.a)({},s,Object(n.a)(Object(n.a)({},c[s]||{}),{},Object(l.a)({value:((null===(o=c[s])||void 0===o?void 0:o.value)||0)+1,label:s},u?Object(O.u)("$__Semana ")+g:Object(O.u)("$__".concat(b)),((null===(d=c[s])||void 0===d?void 0:d[u?Object(O.u)("$__Semana ")+g:Object(O.u)("$__".concat(b))])||0)+1)))),r=Object(n.a)(Object(n.a)({},r),{},Object(l.a)({},s,{label:s,color:(null===t||void 0===t?void 0:t.color)||B(s)}))}(j,e)})),M.current=Object.values(r);else i=Object(n.a)(Object(n.a)({},i),{},{total:Object(n.a)(Object(n.a)({},i.total||{}),{},{value:i&&i.total&&i.total.value?i.total.value+1:1,label:"Concluidas",color:"#5A7F71",id:"Concluidas"})}),c=Object(n.a)(Object(n.a)({},c),{},Object(l.a)({},Object(O.u)("$__monthKey"),Object(n.a)(Object(n.a)({},c.total||{}),{},{value:((null===(y=c[p])||void 0===y?void 0:y.value)||0)+1,label:"Concluidas"}))),M.current=[{label:"Concluidas",color:"#5A7F71"}]}}})),console.log(i,c),p!==i&&(x(Object.values(i)),S(c)))}),[e.planCards,e.load,g]);return r.a.createElement("div",{className:"box",style:{width:"100%",height:"100%",alignSelf:"center",borderRadius:"5px",backgroundColor:"transparent",display:"flex",flexFlow:"column",overflow:"visible"}},r.a.createElement(u.a,{handleSetSelected:function(t){j(Object(n.a)(Object(n.a)({},g),t)),e.handleSetFilters(Object(n.a)(Object(n.a)(Object(n.a)({},g),t),{},{id:e.id}))},filtersConfig:{filtersItems:["date","users","tags","tagsByText"]},tittle:Object(O.u)("$__"+e.tittle),icon:e.icon,styles:e.styles,datafilters:!0,indicators:g||null,handleModal:function(){e.handleDatagridTable()},table:!0,handleRemoveObject:function(){return e.handleRemoveObject(e.id)},edit:e.edit,handleSetoption:function(t){j(Object(n.a)({},t)),e.handleSetFilters(Object(n.a)(Object(n.a)(Object(n.a)({},g),t),{},{id:e.id}))}}),r.a.createElement("div",{style:{borderBottom:"1px solid #D3D3D3",width:"100%"}}),r.a.createElement("div",{style:{}}),r.a.createElement("div",{style:{position:"relative",flex:"1 1 auto",fontSize:"16px"}},r.a.createElement("div",{style:{width:"100%",height:"100%",position:"absolute",fontWeight:"lighter",backgroundColor:"#f5f5f5"}},e.load?r.a.createElement("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"center"}},r.a.createElement("div",{style:{alignSelf:"center"}}," ",r.a.createElement("div",{className:"loader"}))):r.a.createElement("div",{className:"component",style:{width:"100%",height:"100%",display:"flex",flexDirection:"column"}},r.a.createElement("div",{style:{width:"100%",flex:1,position:"relative"}},r.a.createElement("div",{style:{width:"100%",height:"100%",position:"absolute"}},r.a.createElement(s.a,{data:p,colors:{datum:"data.color"},margin:{top:35,right:40,bottom:35,left:40},innerRadius:0,padAngle:1.7,cornerRadius:3,activeOuterRadiusOffset:8,borderWidth:1,padding:1===p.length?.35:.1,axisLeft:{tickSize:5,tickPadding:5,tickRotation:0,format:function(e){return e%1===0?e:""}},theme:{fontSize:"16px",fontWeight:"bold",legend:!1,background:"transparent",axis:{ticks:{text:{fill:"rgba(0, 0, 0, 0.50)",fontSize:14}}}}}))),e.filter.table&&r.a.createElement("div",{style:{maxHeight:"50%",overflow:"scroll"}},r.a.createElement(h.default,{data:Object.values(C)}))))),r.a.createElement("div",{style:{height:"15%",maxHeight:"60px",display:"flex",backgroundColor:"white"}},r.a.createElement(d.a,{legend:Object(o.a)(M.current.map((function(e,t){return{key:t,color:e.color,label:e.label}})))})))}}}]);
//# sourceMappingURL=3.49fb4d93.chunk.js.map