Built motion from commit da24aabd.|2.6.20
[motion2.git] / server / api / dashboard / dashboard.controller.js
index 288bf0c..87ed67f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd782=['api','../../config/environment','../../config/license/util','redis','defaults','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd782,0x171));var _0x2d78=function(_0x157fdf,_0xbd5ade){_0x157fdf=_0x157fdf-0x0;var _0x152177=_0xd782[_0x157fdf];return _0x152177;};'use strict';var emlformat=require(_0x2d78('0x0'));var rimraf=require(_0x2d78('0x1'));var zipdir=require(_0x2d78('0x2'));var jsonpatch=require(_0x2d78('0x3'));var rp=require(_0x2d78('0x4'));var moment=require(_0x2d78('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2d78('0x6'));var util=require(_0x2d78('0x7'));var path=require(_0x2d78('0x8'));var sox=require(_0x2d78('0x9'));var csv=require(_0x2d78('0xa'));var ejs=require(_0x2d78('0xb'));var fs=require('fs');var fs_extra=require(_0x2d78('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2d78('0xd'));var deskjs=require(_0x2d78('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2d78('0xf'));var Papa=require(_0x2d78('0x10'));var Redis=require(_0x2d78('0x11'));var authService=require(_0x2d78('0x12'));var qs=require(_0x2d78('0x13'));var as=require(_0x2d78('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2d78('0x15'));var utils=require('../../config/utils');var config=require(_0x2d78('0x16'));var licenseUtil=require(_0x2d78('0x17'));var db=require('../../mysqldb')['db'];config[_0x2d78('0x18')]=_[_0x2d78('0x19')](config[_0x2d78('0x18')],{'host':_0x2d78('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x1e679d,_0x36101f){_0x36101f=_0x36101f||0xcc;return function(_0x1c840a){if(_0x1c840a){return _0x1e679d[_0x2d78('0x1b')](_0x36101f);}return _0x1e679d[_0x2d78('0x1c')](_0x36101f)[_0x2d78('0x1d')]();};}function respondWithResult(_0x50d35a,_0x5bf71e){_0x5bf71e=_0x5bf71e||0xc8;return function(_0x32bc47){if(_0x32bc47){return _0x50d35a[_0x2d78('0x1c')](_0x5bf71e)[_0x2d78('0x1e')](_0x32bc47);}};}function respondWithFilteredResult(_0x589521,_0x3bccf2){return function(_0x5df979){if(_0x5df979){var _0x5cd7a3=typeof _0x3bccf2[_0x2d78('0x1f')]===_0x2d78('0x20')&&typeof _0x3bccf2[_0x2d78('0x21')]===_0x2d78('0x20');var _0x537ade=_0x5df979['count'];var _0x48b60c=_0x5cd7a3?0x0:_0x3bccf2[_0x2d78('0x1f')];var _0x27b0a2=_0x5cd7a3?_0x5df979[_0x2d78('0x22')]:_0x3bccf2['offset']+_0x3bccf2[_0x2d78('0x21')];var _0x2dbb34;if(_0x27b0a2>=_0x537ade){_0x27b0a2=_0x537ade;_0x2dbb34=0xc8;}else{_0x2dbb34=0xce;}_0x589521[_0x2d78('0x1c')](_0x2dbb34);return _0x589521[_0x2d78('0x23')](_0x2d78('0x24'),_0x48b60c+'-'+_0x27b0a2+'/'+_0x537ade)[_0x2d78('0x1e')](_0x5df979);}return null;};}function patchUpdates(_0x793f7b){return function(_0x54a66c){try{jsonpatch[_0x2d78('0x25')](_0x54a66c,_0x793f7b,!![]);}catch(_0x228840){return BPromise[_0x2d78('0x26')](_0x228840);}return _0x54a66c['save']();};}function saveUpdates(_0x5b5bda,_0x270d48){return function(_0x731157){if(_0x731157){return _0x731157[_0x2d78('0x27')](_0x5b5bda)[_0x2d78('0x28')](function(_0x350ba1){return _0x350ba1;});}return null;};}function removeEntity(_0x594a66,_0x27f9dc){return function(_0x12d50a){if(_0x12d50a){return _0x12d50a[_0x2d78('0x29')]()[_0x2d78('0x28')](function(){var _0x557864=_0x12d50a[_0x2d78('0x2a')]({'plain':!![]});var _0x2becfe='CustomDashboards';return db[_0x2d78('0x2b')][_0x2d78('0x29')]({'where':{'type':_0x2becfe,'resourceId':_0x557864['id']}})[_0x2d78('0x28')](function(){return _0x12d50a;});})[_0x2d78('0x28')](function(){_0x594a66[_0x2d78('0x1c')](0xcc)[_0x2d78('0x1d')]();});}};}function handleEntityNotFound(_0xb377a0,_0x691774){return function(_0x4ee262){if(!_0x4ee262){_0xb377a0[_0x2d78('0x1b')](0x194);}return _0x4ee262;};}function handleError(_0x110c46,_0x47cea5){_0x47cea5=_0x47cea5||0x1f4;return function(_0x29315b){logger[_0x2d78('0x2c')](_0x29315b[_0x2d78('0x2d')]);if(_0x29315b[_0x2d78('0x2e')]){delete _0x29315b[_0x2d78('0x2e')];}_0x110c46[_0x2d78('0x1c')](_0x47cea5)[_0x2d78('0x2f')](_0x29315b);};}exports[_0x2d78('0x30')]=function(_0x2b9ac4,_0x220fec){var _0x3241cd={},_0x3faf60={},_0x1696b3={'count':0x0,'rows':[]};var _0x363cef=_[_0x2d78('0x31')](db[_0x2d78('0x32')][_0x2d78('0x33')],function(_0x28cfda){return{'name':_0x28cfda[_0x2d78('0x34')],'type':_0x28cfda[_0x2d78('0x35')]['key']};});_0x3faf60[_0x2d78('0x36')]=_['map'](_0x363cef,_0x2d78('0x2e'));_0x3faf60['query']=_[_0x2d78('0x37')](_0x2b9ac4[_0x2d78('0x38')]);_0x3faf60[_0x2d78('0x39')]=_[_0x2d78('0x3a')](_0x3faf60[_0x2d78('0x36')],_0x3faf60[_0x2d78('0x38')]);_0x3241cd[_0x2d78('0x3b')]=_[_0x2d78('0x3a')](_0x3faf60['model'],qs[_0x2d78('0x3c')](_0x2b9ac4['query'][_0x2d78('0x3c')]));_0x3241cd[_0x2d78('0x3b')]=_0x3241cd[_0x2d78('0x3b')][_0x2d78('0x3d')]?_0x3241cd[_0x2d78('0x3b')]:_0x3faf60['model'];if(!_0x2b9ac4[_0x2d78('0x38')][_0x2d78('0x3e')](_0x2d78('0x3f'))){_0x3241cd[_0x2d78('0x21')]=qs[_0x2d78('0x21')](_0x2b9ac4[_0x2d78('0x38')][_0x2d78('0x21')]);_0x3241cd[_0x2d78('0x1f')]=qs[_0x2d78('0x1f')](_0x2b9ac4[_0x2d78('0x38')][_0x2d78('0x1f')]);}_0x3241cd[_0x2d78('0x40')]=qs[_0x2d78('0x41')](_0x2b9ac4[_0x2d78('0x38')]['sort']);_0x3241cd['where']=qs[_0x2d78('0x39')](_[_0x2d78('0x42')](_0x2b9ac4[_0x2d78('0x38')],_0x3faf60[_0x2d78('0x39')]),_0x363cef);if(_0x2b9ac4[_0x2d78('0x38')][_0x2d78('0x43')]){_0x3241cd[_0x2d78('0x44')]=_[_0x2d78('0x45')](_0x3241cd[_0x2d78('0x44')],{'$or':_[_0x2d78('0x31')](_0x363cef,function(_0x5d7b5c){if(_0x5d7b5c[_0x2d78('0x35')]!==_0x2d78('0x46')){var _0x3d275a={};_0x3d275a[_0x5d7b5c[_0x2d78('0x2e')]]={'$like':'%'+_0x2b9ac4[_0x2d78('0x38')][_0x2d78('0x43')]+'%'};return _0x3d275a;}})});}_0x3241cd=_['merge']({},_0x3241cd,_0x2b9ac4['options']);var _0xbb1a3c={'where':_0x3241cd[_0x2d78('0x44')]};return db[_0x2d78('0x32')]['count'](_0xbb1a3c)[_0x2d78('0x28')](function(_0x3dd8ed){_0x1696b3[_0x2d78('0x22')]=_0x3dd8ed;if(_0x2b9ac4[_0x2d78('0x38')][_0x2d78('0x47')]){_0x3241cd[_0x2d78('0x48')]=[{'all':!![]}];}return db[_0x2d78('0x32')][_0x2d78('0x49')](_0x3241cd);})[_0x2d78('0x28')](function(_0x5817e5){_0x1696b3[_0x2d78('0x4a')]=_0x5817e5;return _0x1696b3;})[_0x2d78('0x28')](respondWithFilteredResult(_0x220fec,_0x3241cd))[_0x2d78('0x4b')](handleError(_0x220fec,null));};exports[_0x2d78('0x4c')]=function(_0x9f4232,_0x9e6ea4){var _0x5c2f1d={'raw':![],'where':{'id':_0x9f4232[_0x2d78('0x4d')]['id']}},_0x3db984={};_0x3db984['model']=_['keys'](db[_0x2d78('0x32')]['rawAttributes']);_0x3db984[_0x2d78('0x38')]=_['keys'](_0x9f4232[_0x2d78('0x38')]);_0x3db984[_0x2d78('0x39')]=_[_0x2d78('0x3a')](_0x3db984[_0x2d78('0x36')],_0x3db984['query']);_0x5c2f1d[_0x2d78('0x3b')]=_[_0x2d78('0x3a')](_0x3db984[_0x2d78('0x36')],qs[_0x2d78('0x3c')](_0x9f4232[_0x2d78('0x38')][_0x2d78('0x3c')]));_0x5c2f1d[_0x2d78('0x3b')]=_0x5c2f1d['attributes'][_0x2d78('0x3d')]?_0x5c2f1d[_0x2d78('0x3b')]:_0x3db984[_0x2d78('0x36')];if(_0x9f4232['query'][_0x2d78('0x47')]){_0x5c2f1d[_0x2d78('0x48')]=[{'all':!![]}];}_0x5c2f1d=_[_0x2d78('0x45')]({},_0x5c2f1d,_0x9f4232[_0x2d78('0x4e')]);return db[_0x2d78('0x32')][_0x2d78('0x4f')](_0x5c2f1d)[_0x2d78('0x28')](handleEntityNotFound(_0x9e6ea4,null))[_0x2d78('0x28')](respondWithResult(_0x9e6ea4,null))[_0x2d78('0x4b')](handleError(_0x9e6ea4,null));};exports[_0x2d78('0x50')]=function(_0x1e9c3f,_0x2c6e81){return db['Dashboard']['create'](_0x1e9c3f[_0x2d78('0x51')],{})[_0x2d78('0x28')](function(_0x447ab8){var _0x410ff3=_0x1e9c3f[_0x2d78('0x52')][_0x2d78('0x2a')]({'plain':!![]});if(!_0x410ff3)throw new Error(_0x2d78('0x53'));if(_0x410ff3[_0x2d78('0x54')]===_0x2d78('0x52')){var _0x29f362=_0x447ab8['get']({'plain':!![]});var _0x5aa317=_0x2d78('0x55');return db['UserProfileSection']['find']({'where':{'name':_0x5aa317,'userProfileId':_0x410ff3[_0x2d78('0x56')]},'raw':!![]})['then'](function(_0x4a650e){if(_0x4a650e&&_0x4a650e[_0x2d78('0x57')]===0x0){return db[_0x2d78('0x2b')][_0x2d78('0x50')]({'name':_0x29f362['name'],'resourceId':_0x29f362['id'],'type':_0x4a650e[_0x2d78('0x2e')],'sectionId':_0x4a650e['id']},{})[_0x2d78('0x28')](function(){return _0x447ab8;});}else{return _0x447ab8;}})['catch'](function(_0x7c7fb){logger[_0x2d78('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7c7fb);throw _0x7c7fb;});}return _0x447ab8;})[_0x2d78('0x28')](respondWithResult(_0x2c6e81,0xc9))[_0x2d78('0x4b')](handleError(_0x2c6e81,null));};exports[_0x2d78('0x58')]=function(_0x42f937,_0x4ce0b3){var _0x40afa6={'where':{'id':_0x42f937[_0x2d78('0x4d')]['id']}},_0x453b8f={};_0x453b8f['model']=_[_0x2d78('0x37')](db[_0x2d78('0x32')][_0x2d78('0x33')]);_0x40afa6['attributes']=_[_0x2d78('0x3a')](_0x453b8f['model'],qs[_0x2d78('0x3c')](_0x42f937[_0x2d78('0x38')][_0x2d78('0x3c')]));_0x40afa6[_0x2d78('0x3b')]=_0x40afa6[_0x2d78('0x3b')][_0x2d78('0x3d')]?_0x40afa6[_0x2d78('0x3b')]:_0x453b8f['model'];if(_0x42f937[_0x2d78('0x38')]['includeAll']){_0x40afa6[_0x2d78('0x48')]=[{'all':!![]}];}_0x40afa6=_[_0x2d78('0x45')]({},_0x40afa6,_0x42f937[_0x2d78('0x4e')]);return db[_0x2d78('0x32')]['find'](_0x40afa6)[_0x2d78('0x28')](handleEntityNotFound(_0x4ce0b3,null))[_0x2d78('0x28')](function(_0x3143fc){if(_0x3143fc){var _0xc97057=_0x3143fc[_0x2d78('0x2a')]({'plain':!![]});_0xc97057=qs[_0x2d78('0x59')](_0xc97057,['id',_0x2d78('0x5a'),_0x2d78('0x5b')]);_0x42f937[_0x2d78('0x51')]=_[_0x2d78('0x59')](_0x42f937[_0x2d78('0x51')],['id',_0x2d78('0x5a'),_0x2d78('0x5b')]);return db[_0x2d78('0x32')][_0x2d78('0x50')](_['merge'](_0xc97057,_0x42f937[_0x2d78('0x51')]),{'include':_0x42f937[_0x2d78('0x38')][_0x2d78('0x47')]?[{'all':!![]}]:undefined})[_0x2d78('0x28')](function(_0x589f41){var _0x25de47=_0x42f937[_0x2d78('0x52')][_0x2d78('0x2a')]({'plain':!![]});if(!_0x25de47)throw new Error(_0x2d78('0x53'));if(_0x25de47[_0x2d78('0x54')]===_0x2d78('0x52')){var _0x3cd297=_0x589f41[_0x2d78('0x2a')]({'plain':!![]});var _0x31768f=_0x2d78('0x55');return db[_0x2d78('0x5c')][_0x2d78('0x4f')]({'where':{'name':_0x31768f,'userProfileId':_0x25de47[_0x2d78('0x56')]},'raw':!![]})[_0x2d78('0x28')](function(_0x445a95){if(_0x445a95&&_0x445a95[_0x2d78('0x57')]===0x0){return db['UserProfileResource'][_0x2d78('0x50')]({'name':_0x3cd297[_0x2d78('0x2e')],'resourceId':_0x3cd297['id'],'type':_0x445a95[_0x2d78('0x2e')],'sectionId':_0x445a95['id']},{})['then'](function(){return _0x589f41;});}else{return _0x589f41;}})[_0x2d78('0x4b')](function(_0x3c43ca){logger[_0x2d78('0x2c')](_0x2d78('0x5d'),_0x3c43ca);throw _0x3c43ca;});}return _0x589f41;});}})[_0x2d78('0x28')](respondWithResult(_0x4ce0b3,0xc9))[_0x2d78('0x4b')](handleError(_0x4ce0b3,null));};exports[_0x2d78('0x27')]=function(_0x413dda,_0x127e40){if(_0x413dda[_0x2d78('0x51')]['id']){delete _0x413dda['body']['id'];}return db[_0x2d78('0x32')][_0x2d78('0x4f')]({'where':{'id':_0x413dda[_0x2d78('0x4d')]['id']}})[_0x2d78('0x28')](handleEntityNotFound(_0x127e40,null))['then'](saveUpdates(_0x413dda[_0x2d78('0x51')],null))[_0x2d78('0x28')](respondWithResult(_0x127e40,null))[_0x2d78('0x4b')](handleError(_0x127e40,null));};exports['destroy']=function(_0x2b7d87,_0x31d4b6){return db['Dashboard'][_0x2d78('0x4f')]({'where':{'id':_0x2b7d87[_0x2d78('0x4d')]['id']}})[_0x2d78('0x28')](handleEntityNotFound(_0x31d4b6,null))[_0x2d78('0x28')](removeEntity(_0x31d4b6,null))[_0x2d78('0x4b')](handleError(_0x31d4b6,null));};function widgetAttributes(_0x2ba0d2){try{switch(_0x2ba0d2[_0x2d78('0x35')]){case _0x2d78('0x5e'):return[{'name':'attrUrl','value':_0x2ba0d2['attrUrl']||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x0]?_0x2ba0d2[_0x2d78('0x5f')][0x0][_0x2d78('0x60')]:undefined)||'https://'}];case _0x2d78('0x61'):return[{'name':_0x2d78('0x62'),'value':_0x2ba0d2[_0x2d78('0x62')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x0]?_0x2ba0d2['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x2d78('0x63'),'value':_0x2ba0d2[_0x2d78('0x63')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2['attrs'][0x0]?_0x2ba0d2[_0x2d78('0x5f')][0x0]['value']:undefined)||_0x2d78('0x64')},{'name':_0x2d78('0x65'),'value':_0x2ba0d2[_0x2d78('0x65')]||(_0x2ba0d2['attrs']&&_0x2ba0d2[_0x2d78('0x5f')][0x1]?_0x2ba0d2[_0x2d78('0x5f')][0x1]['value']:undefined)||_0x2d78('0x66')},{'name':_0x2d78('0x67'),'value':_0x2ba0d2[_0x2d78('0x67')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x2]?_0x2ba0d2[_0x2d78('0x5f')][0x2][_0x2d78('0x60')]:undefined)||0xc}];case _0x2d78('0x68'):return[{'name':_0x2d78('0x69'),'value':_0x2ba0d2[_0x2d78('0x69')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x0]?_0x2ba0d2[_0x2d78('0x5f')][0x0][_0x2d78('0x60')]:undefined)||_0x2d78('0x6a')},{'name':_0x2d78('0x6b'),'value':_0x2ba0d2['attrVoiceQueues']||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x1]?_0x2ba0d2[_0x2d78('0x5f')][0x1][_0x2d78('0x60')]:undefined)||[]},{'name':_0x2d78('0x67'),'value':_0x2ba0d2['attrFontSize']||(_0x2ba0d2['attrs']&&_0x2ba0d2[_0x2d78('0x5f')][0x2]?_0x2ba0d2['attrs'][0x2][_0x2d78('0x60')]:undefined)||0x14},{'name':'attrChannel','value':_0x2ba0d2[_0x2d78('0x6c')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x3]?_0x2ba0d2[_0x2d78('0x5f')][0x3][_0x2d78('0x60')]:undefined)||_0x2d78('0x6d')},{'name':_0x2d78('0x6e'),'value':_0x2ba0d2['attrEmailAccounts']||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2['attrs'][0x4]?_0x2ba0d2['attrs'][0x4][_0x2d78('0x60')]:undefined)||''},{'name':_0x2d78('0x6f'),'value':_0x2ba0d2[_0x2d78('0x6f')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x5]?_0x2ba0d2[_0x2d78('0x5f')][0x5][_0x2d78('0x60')]:undefined)||''},{'name':_0x2d78('0x70'),'value':_0x2ba0d2[_0x2d78('0x70')]||(_0x2ba0d2['attrs']&&_0x2ba0d2[_0x2d78('0x5f')][0x6]?_0x2ba0d2[_0x2d78('0x5f')][0x6][_0x2d78('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2ba0d2[_0x2d78('0x71')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x7]?_0x2ba0d2['attrs'][0x7][_0x2d78('0x60')]:undefined)||''},{'name':_0x2d78('0x72'),'value':_0x2ba0d2[_0x2d78('0x72')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x8]?_0x2ba0d2['attrs'][0x8][_0x2d78('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2ba0d2[_0x2d78('0x73')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2['attrs'][0x9]?_0x2ba0d2[_0x2d78('0x5f')][0x9][_0x2d78('0x60')]:undefined)||''}];case _0x2d78('0x74'):case _0x2d78('0x75'):return[{'name':'attrSerie1','value':_0x2ba0d2[_0x2d78('0x76')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x0]?_0x2ba0d2[_0x2d78('0x5f')][0x0][_0x2d78('0x60')]:undefined)||_0x2d78('0x6a')},{'name':_0x2d78('0x77'),'value':_0x2ba0d2[_0x2d78('0x77')]||(_0x2ba0d2['attrs']&&_0x2ba0d2[_0x2d78('0x5f')][0x1]?_0x2ba0d2[_0x2d78('0x5f')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x2ba0d2[_0x2d78('0x78')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x2]?_0x2ba0d2[_0x2d78('0x5f')][0x2][_0x2d78('0x60')]:undefined)||null},{'name':_0x2d78('0x6b'),'value':_0x2ba0d2[_0x2d78('0x6b')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x3]?_0x2ba0d2[_0x2d78('0x5f')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x2ba0d2[_0x2d78('0x6c')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x4]?_0x2ba0d2['attrs'][0x4][_0x2d78('0x60')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x2ba0d2['attrEmailAccounts']||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2['attrs'][0x5]?_0x2ba0d2['attrs'][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x2ba0d2[_0x2d78('0x6f')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x6]?_0x2ba0d2[_0x2d78('0x5f')][0x6][_0x2d78('0x60')]:undefined)||''},{'name':_0x2d78('0x70'),'value':_0x2ba0d2[_0x2d78('0x70')]||(_0x2ba0d2['attrs']&&_0x2ba0d2[_0x2d78('0x5f')][0x7]?_0x2ba0d2[_0x2d78('0x5f')][0x7][_0x2d78('0x60')]:undefined)||''},{'name':_0x2d78('0x71'),'value':_0x2ba0d2[_0x2d78('0x71')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x8]?_0x2ba0d2['attrs'][0x8][_0x2d78('0x60')]:undefined)||''},{'name':_0x2d78('0x72'),'value':_0x2ba0d2[_0x2d78('0x72')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2['attrs'][0x9]?_0x2ba0d2['attrs'][0x9][_0x2d78('0x60')]:undefined)||''},{'name':_0x2d78('0x73'),'value':_0x2ba0d2[_0x2d78('0x73')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2['attrs'][0xa]?_0x2ba0d2['attrs'][0xa][_0x2d78('0x60')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x2ba0d2[_0x2d78('0x79')]||(_0x2ba0d2['attrs']&&_0x2ba0d2[_0x2d78('0x5f')][0x0]?_0x2ba0d2['attrs'][0x0][_0x2d78('0x35')]:undefined)||null,'value':_0x2ba0d2['attrReport']||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x0]?_0x2ba0d2[_0x2d78('0x5f')][0x0][_0x2d78('0x60')]:undefined)||null},{'name':_0x2d78('0x7a'),'value':_0x2ba0d2[_0x2d78('0x7a')]||(_0x2ba0d2[_0x2d78('0x5f')]&&_0x2ba0d2[_0x2d78('0x5f')][0x1]?_0x2ba0d2['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4dde90){logger['error'](_0x2d78('0x7b'),JSON[_0x2d78('0x7c')](_0x4dde90));return[];}}exports[_0x2d78('0x7d')]=function(_0x221692,_0x2eb0ea,_0x32162a){if(_0x221692['body']['id']){delete _0x221692['body']['id'];}return db[_0x2d78('0x32')][_0x2d78('0x4f')]({'where':{'id':_0x221692[_0x2d78('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2eb0ea,null))[_0x2d78('0x28')](function(_0x4b833c){if(_0x4b833c){_0x221692[_0x2d78('0x51')][_0x2d78('0x7e')]=_0x4b833c['id'];_0x221692[_0x2d78('0x51')][_0x2d78('0x5f')]=widgetAttributes(_0x221692[_0x2d78('0x51')]);return db[_0x2d78('0x7f')]['create'](_0x221692[_0x2d78('0x51')]);}})['then'](respondWithResult(_0x2eb0ea,null))[_0x2d78('0x4b')](handleError(_0x2eb0ea,null));};exports['getItems']=function(_0x109847,_0x2bca73,_0xa27f15){var _0x469335={};var _0x2c6459={};var _0x13e7cb;var _0x5bf4d2;return db[_0x2d78('0x32')][_0x2d78('0x80')]({'where':{'id':_0x109847[_0x2d78('0x4d')]['id']}})[_0x2d78('0x28')](handleEntityNotFound(_0x2bca73,null))[_0x2d78('0x28')](function(_0x386067){if(_0x386067){_0x13e7cb=_0x386067;_0x2c6459['model']=_[_0x2d78('0x37')](db[_0x2d78('0x7f')][_0x2d78('0x33')]);_0x2c6459[_0x2d78('0x38')]=_[_0x2d78('0x37')](_0x109847[_0x2d78('0x38')]);_0x2c6459[_0x2d78('0x39')]=_[_0x2d78('0x3a')](_0x2c6459[_0x2d78('0x36')],_0x2c6459['query']);_0x469335['attributes']=_[_0x2d78('0x3a')](_0x2c6459[_0x2d78('0x36')],qs['fields'](_0x109847[_0x2d78('0x38')][_0x2d78('0x3c')]));_0x469335['attributes']=_0x469335[_0x2d78('0x3b')][_0x2d78('0x3d')]?_0x469335[_0x2d78('0x3b')]:_0x2c6459[_0x2d78('0x36')];_0x469335[_0x2d78('0x40')]=qs[_0x2d78('0x41')](_0x109847[_0x2d78('0x38')][_0x2d78('0x41')]);_0x469335[_0x2d78('0x44')]=qs['filters'](_[_0x2d78('0x42')](_0x109847[_0x2d78('0x38')],_0x2c6459[_0x2d78('0x39')]));if(_0x109847[_0x2d78('0x38')][_0x2d78('0x43')]){_0x469335[_0x2d78('0x44')]=_[_0x2d78('0x45')](_0x469335['where'],{'$or':_[_0x2d78('0x31')](_0x469335['attributes'],function(_0x3c6b06){var _0x522fa2={};_0x522fa2[_0x3c6b06]={'$like':'%'+_0x109847['query'][_0x2d78('0x43')]+'%'};return _0x522fa2;})});}_0x469335=_[_0x2d78('0x45')]({},_0x469335,_0x109847['options']);return _0x13e7cb[_0x2d78('0x81')](_0x469335);}})['then'](function(_0xc6c1e2){if(_0xc6c1e2){_0x5bf4d2=_0xc6c1e2['length'];if(!_0x109847[_0x2d78('0x38')][_0x2d78('0x3e')](_0x2d78('0x3f'))){_0x469335['limit']=qs[_0x2d78('0x21')](_0x109847[_0x2d78('0x38')][_0x2d78('0x21')]);_0x469335[_0x2d78('0x1f')]=qs[_0x2d78('0x1f')](_0x109847[_0x2d78('0x38')]['offset']);}return _0x13e7cb[_0x2d78('0x81')](_0x469335);}})[_0x2d78('0x28')](function(_0x2fda23){if(_0x2fda23){return _0x2fda23?{'count':_0x5bf4d2,'rows':_0x2fda23}:null;}})[_0x2d78('0x28')](respondWithResult(_0x2bca73,null))[_0x2d78('0x4b')](handleError(_0x2bca73,null));};
\ No newline at end of file
+var _0x2894=['web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','map','getItems','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','end','error','name','index','Dashboard','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrFaxAccounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2894,0x10e));var _0x4289=function(_0x2731f0,_0x126b1b){_0x2731f0=_0x2731f0-0x0;var _0x36a180=_0x2894[_0x2731f0];return _0x36a180;};'use strict';var emlformat=require(_0x4289('0x0'));var rimraf=require(_0x4289('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4289('0x2'));var moment=require(_0x4289('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4289('0x4'));var util=require('util');var path=require(_0x4289('0x5'));var sox=require(_0x4289('0x6'));var csv=require(_0x4289('0x7'));var ejs=require(_0x4289('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4289('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4289('0xa'));var deskjs=require(_0x4289('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4289('0xc'));var authService=require(_0x4289('0xd'));var qs=require(_0x4289('0xe'));var as=require(_0x4289('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4289('0x10'))('api');var utils=require(_0x4289('0x11'));var config=require(_0x4289('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4289('0x13'))['db'];config[_0x4289('0x14')]=_[_0x4289('0x15')](config[_0x4289('0x14')],{'host':_0x4289('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4289('0x14')]));require(_0x4289('0x17'))[_0x4289('0x18')](socket);function respondWithStatusCode(_0x25c0de,_0xf008db){_0xf008db=_0xf008db||0xcc;return function(_0x4b0a41){if(_0x4b0a41){return _0x25c0de[_0x4289('0x19')](_0xf008db);}return _0x25c0de[_0x4289('0x1a')](_0xf008db)['end']();};}function respondWithResult(_0x13e6a4,_0x4e5322){_0x4e5322=_0x4e5322||0xc8;return function(_0x481c97){if(_0x481c97){return _0x13e6a4['status'](_0x4e5322)[_0x4289('0x1b')](_0x481c97);}};}function respondWithFilteredResult(_0x47e258,_0x12bd1e){return function(_0x5a685f){if(_0x5a685f){var _0x1da894=typeof _0x12bd1e[_0x4289('0x1c')]===_0x4289('0x1d')&&typeof _0x12bd1e['limit']===_0x4289('0x1d');var _0x40c127=_0x5a685f[_0x4289('0x1e')];var _0x520b87=_0x1da894?0x0:_0x12bd1e[_0x4289('0x1c')];var _0x2d7ff7=_0x1da894?_0x5a685f['count']:_0x12bd1e[_0x4289('0x1c')]+_0x12bd1e[_0x4289('0x1f')];var _0x3ce04a;if(_0x2d7ff7>=_0x40c127){_0x2d7ff7=_0x40c127;_0x3ce04a=0xc8;}else{_0x3ce04a=0xce;}_0x47e258['status'](_0x3ce04a);return _0x47e258[_0x4289('0x20')](_0x4289('0x21'),_0x520b87+'-'+_0x2d7ff7+'/'+_0x40c127)['json'](_0x5a685f);}return null;};}function patchUpdates(_0x4842e7){return function(_0x3d2078){try{jsonpatch['apply'](_0x3d2078,_0x4842e7,!![]);}catch(_0x331a65){return BPromise[_0x4289('0x22')](_0x331a65);}return _0x3d2078[_0x4289('0x23')]();};}function saveUpdates(_0x2604fa,_0x30bd5a){return function(_0x2fbcdf){if(_0x2fbcdf){return _0x2fbcdf[_0x4289('0x24')](_0x2604fa)[_0x4289('0x25')](function(_0x2ec9fa){return _0x2ec9fa;});}return null;};}function removeEntity(_0x460365,_0x1a82a2){return function(_0x5e0938){if(_0x5e0938){return _0x5e0938[_0x4289('0x26')]()[_0x4289('0x25')](function(){var _0x21ee9a=_0x5e0938['get']({'plain':!![]});var _0x54cc59=_0x4289('0x27');return db[_0x4289('0x28')][_0x4289('0x26')]({'where':{'type':_0x54cc59,'resourceId':_0x21ee9a['id']}})[_0x4289('0x25')](function(){return _0x5e0938;});})[_0x4289('0x25')](function(){_0x460365[_0x4289('0x1a')](0xcc)[_0x4289('0x29')]();});}};}function handleEntityNotFound(_0x2e506c,_0x5e765a){return function(_0x5b516d){if(!_0x5b516d){_0x2e506c[_0x4289('0x19')](0x194);}return _0x5b516d;};}function handleError(_0x3c5f91,_0x22e5e4){_0x22e5e4=_0x22e5e4||0x1f4;return function(_0x267e4d){logger[_0x4289('0x2a')](_0x267e4d['stack']);if(_0x267e4d[_0x4289('0x2b')]){delete _0x267e4d[_0x4289('0x2b')];}_0x3c5f91['status'](_0x22e5e4)['send'](_0x267e4d);};}exports[_0x4289('0x2c')]=function(_0x5bd834,_0x1fbc77){var _0x12a8b3={},_0x3c3484={},_0x4220ee={'count':0x0,'rows':[]};var _0x1ba1c6=_['map'](db[_0x4289('0x2d')][_0x4289('0x2e')],function(_0x35fa5c){return{'name':_0x35fa5c['fieldName'],'type':_0x35fa5c['type'][_0x4289('0x2f')]};});_0x3c3484[_0x4289('0x30')]=_['map'](_0x1ba1c6,_0x4289('0x2b'));_0x3c3484[_0x4289('0x31')]=_[_0x4289('0x32')](_0x5bd834[_0x4289('0x31')]);_0x3c3484['filters']=_['intersection'](_0x3c3484[_0x4289('0x30')],_0x3c3484[_0x4289('0x31')]);_0x12a8b3[_0x4289('0x33')]=_[_0x4289('0x34')](_0x3c3484[_0x4289('0x30')],qs[_0x4289('0x35')](_0x5bd834[_0x4289('0x31')][_0x4289('0x35')]));_0x12a8b3[_0x4289('0x33')]=_0x12a8b3['attributes'][_0x4289('0x36')]?_0x12a8b3[_0x4289('0x33')]:_0x3c3484[_0x4289('0x30')];if(!_0x5bd834['query'][_0x4289('0x37')](_0x4289('0x38'))){_0x12a8b3[_0x4289('0x1f')]=qs[_0x4289('0x1f')](_0x5bd834[_0x4289('0x31')][_0x4289('0x1f')]);_0x12a8b3['offset']=qs[_0x4289('0x1c')](_0x5bd834[_0x4289('0x31')][_0x4289('0x1c')]);}_0x12a8b3[_0x4289('0x39')]=qs[_0x4289('0x3a')](_0x5bd834[_0x4289('0x31')][_0x4289('0x3a')]);_0x12a8b3[_0x4289('0x3b')]=qs[_0x4289('0x3c')](_[_0x4289('0x3d')](_0x5bd834['query'],_0x3c3484['filters']),_0x1ba1c6);if(_0x5bd834[_0x4289('0x31')][_0x4289('0x3e')]){_0x12a8b3[_0x4289('0x3b')]=_[_0x4289('0x3f')](_0x12a8b3[_0x4289('0x3b')],{'$or':_['map'](_0x1ba1c6,function(_0x86b22e){if(_0x86b22e[_0x4289('0x40')]!==_0x4289('0x41')){var _0x4bf0f1={};_0x4bf0f1[_0x86b22e[_0x4289('0x2b')]]={'$like':'%'+_0x5bd834[_0x4289('0x31')][_0x4289('0x3e')]+'%'};return _0x4bf0f1;}})});}_0x12a8b3=_[_0x4289('0x3f')]({},_0x12a8b3,_0x5bd834['options']);var _0x5de38d={'where':_0x12a8b3[_0x4289('0x3b')]};return db[_0x4289('0x2d')][_0x4289('0x1e')](_0x5de38d)['then'](function(_0x3f1120){_0x4220ee[_0x4289('0x1e')]=_0x3f1120;if(_0x5bd834['query'][_0x4289('0x42')]){_0x12a8b3[_0x4289('0x43')]=[{'all':!![]}];}return db[_0x4289('0x2d')][_0x4289('0x44')](_0x12a8b3);})[_0x4289('0x25')](function(_0x34608f){_0x4220ee[_0x4289('0x45')]=_0x34608f;return _0x4220ee;})['then'](respondWithFilteredResult(_0x1fbc77,_0x12a8b3))[_0x4289('0x46')](handleError(_0x1fbc77,null));};exports[_0x4289('0x47')]=function(_0xe12fe0,_0x10b66d){var _0x173106={'raw':![],'where':{'id':_0xe12fe0[_0x4289('0x48')]['id']}},_0x569ba8={};_0x569ba8[_0x4289('0x30')]=_['keys'](db[_0x4289('0x2d')][_0x4289('0x2e')]);_0x569ba8[_0x4289('0x31')]=_[_0x4289('0x32')](_0xe12fe0['query']);_0x569ba8[_0x4289('0x3c')]=_['intersection'](_0x569ba8[_0x4289('0x30')],_0x569ba8[_0x4289('0x31')]);_0x173106[_0x4289('0x33')]=_[_0x4289('0x34')](_0x569ba8[_0x4289('0x30')],qs[_0x4289('0x35')](_0xe12fe0['query']['fields']));_0x173106[_0x4289('0x33')]=_0x173106[_0x4289('0x33')]['length']?_0x173106[_0x4289('0x33')]:_0x569ba8[_0x4289('0x30')];if(_0xe12fe0[_0x4289('0x31')]['includeAll']){_0x173106[_0x4289('0x43')]=[{'all':!![]}];}_0x173106=_[_0x4289('0x3f')]({},_0x173106,_0xe12fe0[_0x4289('0x49')]);return db[_0x4289('0x2d')][_0x4289('0x4a')](_0x173106)[_0x4289('0x25')](handleEntityNotFound(_0x10b66d,null))[_0x4289('0x25')](respondWithResult(_0x10b66d,null))[_0x4289('0x46')](handleError(_0x10b66d,null));};exports[_0x4289('0x4b')]=function(_0x2815da,_0x21ed77){return db[_0x4289('0x2d')][_0x4289('0x4b')](_0x2815da[_0x4289('0x4c')],{})[_0x4289('0x25')](function(_0x1cb47c){var _0x4d5bbb=_0x2815da['user'][_0x4289('0x4d')]({'plain':!![]});if(!_0x4d5bbb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d5bbb['role']==='user'){var _0xc47818=_0x1cb47c[_0x4289('0x4d')]({'plain':!![]});var _0x50a5c0=_0x4289('0x27');return db[_0x4289('0x4e')][_0x4289('0x4a')]({'where':{'name':_0x50a5c0,'userProfileId':_0x4d5bbb[_0x4289('0x4f')]},'raw':!![]})[_0x4289('0x25')](function(_0x57d02f){if(_0x57d02f&&_0x57d02f[_0x4289('0x50')]===0x0){return db['UserProfileResource'][_0x4289('0x4b')]({'name':_0xc47818['name'],'resourceId':_0xc47818['id'],'type':_0x57d02f[_0x4289('0x2b')],'sectionId':_0x57d02f['id']},{})['then'](function(){return _0x1cb47c;});}else{return _0x1cb47c;}})['catch'](function(_0x4716eb){logger[_0x4289('0x2a')](_0x4289('0x51'),_0x4716eb);throw _0x4716eb;});}return _0x1cb47c;})['then'](respondWithResult(_0x21ed77,0xc9))[_0x4289('0x46')](handleError(_0x21ed77,null));};exports[_0x4289('0x52')]=function(_0x39ca1f,_0x148a82){var _0x2ac953={'where':{'id':_0x39ca1f[_0x4289('0x48')]['id']}},_0x747564={};_0x747564[_0x4289('0x30')]=_[_0x4289('0x32')](db[_0x4289('0x2d')][_0x4289('0x2e')]);_0x2ac953[_0x4289('0x33')]=_[_0x4289('0x34')](_0x747564[_0x4289('0x30')],qs['fields'](_0x39ca1f[_0x4289('0x31')][_0x4289('0x35')]));_0x2ac953[_0x4289('0x33')]=_0x2ac953[_0x4289('0x33')]['length']?_0x2ac953['attributes']:_0x747564[_0x4289('0x30')];if(_0x39ca1f[_0x4289('0x31')][_0x4289('0x42')]){_0x2ac953[_0x4289('0x43')]=[{'all':!![]}];}_0x2ac953=_[_0x4289('0x3f')]({},_0x2ac953,_0x39ca1f['options']);return db['Dashboard'][_0x4289('0x4a')](_0x2ac953)['then'](handleEntityNotFound(_0x148a82,null))[_0x4289('0x25')](function(_0x19f253){if(_0x19f253){var _0x52bcea=_0x19f253[_0x4289('0x4d')]({'plain':!![]});_0x52bcea=qs[_0x4289('0x53')](_0x52bcea,['id','createdAt',_0x4289('0x54')]);_0x39ca1f[_0x4289('0x4c')]=_[_0x4289('0x53')](_0x39ca1f['body'],['id',_0x4289('0x55'),_0x4289('0x54')]);return db[_0x4289('0x2d')]['create'](_['merge'](_0x52bcea,_0x39ca1f[_0x4289('0x4c')]),{'include':_0x39ca1f[_0x4289('0x31')][_0x4289('0x42')]?[{'all':!![]}]:undefined})[_0x4289('0x25')](function(_0x2e2cd7){var _0xeb4987=_0x39ca1f[_0x4289('0x56')][_0x4289('0x4d')]({'plain':!![]});if(!_0xeb4987)throw new Error(_0x4289('0x57'));if(_0xeb4987[_0x4289('0x58')]===_0x4289('0x56')){var _0x1e6890=_0x2e2cd7['get']({'plain':!![]});var _0x5b4a92='CustomDashboards';return db[_0x4289('0x4e')]['find']({'where':{'name':_0x5b4a92,'userProfileId':_0xeb4987[_0x4289('0x4f')]},'raw':!![]})[_0x4289('0x25')](function(_0x59baf0){if(_0x59baf0&&_0x59baf0[_0x4289('0x50')]===0x0){return db['UserProfileResource'][_0x4289('0x4b')]({'name':_0x1e6890[_0x4289('0x2b')],'resourceId':_0x1e6890['id'],'type':_0x59baf0[_0x4289('0x2b')],'sectionId':_0x59baf0['id']},{})['then'](function(){return _0x2e2cd7;});}else{return _0x2e2cd7;}})['catch'](function(_0xa24ee6){logger['error'](_0x4289('0x51'),_0xa24ee6);throw _0xa24ee6;});}return _0x2e2cd7;});}})[_0x4289('0x25')](respondWithResult(_0x148a82,0xc9))[_0x4289('0x46')](handleError(_0x148a82,null));};exports[_0x4289('0x24')]=function(_0x1def61,_0x317e41){if(_0x1def61['body']['id']){delete _0x1def61[_0x4289('0x4c')]['id'];}return db[_0x4289('0x2d')][_0x4289('0x4a')]({'where':{'id':_0x1def61[_0x4289('0x48')]['id']}})[_0x4289('0x25')](handleEntityNotFound(_0x317e41,null))[_0x4289('0x25')](saveUpdates(_0x1def61[_0x4289('0x4c')],null))[_0x4289('0x25')](respondWithResult(_0x317e41,null))[_0x4289('0x46')](handleError(_0x317e41,null));};exports[_0x4289('0x26')]=function(_0x43bc7b,_0x571998){return db[_0x4289('0x2d')][_0x4289('0x4a')]({'where':{'id':_0x43bc7b[_0x4289('0x48')]['id']}})[_0x4289('0x25')](handleEntityNotFound(_0x571998,null))[_0x4289('0x25')](removeEntity(_0x571998,null))[_0x4289('0x46')](handleError(_0x571998,null));};function widgetAttributes(_0x19c535){try{switch(_0x19c535[_0x4289('0x40')]){case _0x4289('0x59'):return[{'name':_0x4289('0x5a'),'value':_0x19c535[_0x4289('0x5a')]||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535['attrs'][0x0]['value']:undefined)||_0x4289('0x5c')}];case _0x4289('0x5d'):return[{'name':_0x4289('0x5e'),'value':_0x19c535[_0x4289('0x5e')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||''}];case _0x4289('0x60'):return[{'name':'attrHourFormat','value':_0x19c535[_0x4289('0x61')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||_0x4289('0x62')},{'name':_0x4289('0x63'),'value':_0x19c535[_0x4289('0x63')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x1]?_0x19c535['attrs'][0x1]['value']:undefined)||_0x4289('0x64')},{'name':_0x4289('0x65'),'value':_0x19c535[_0x4289('0x65')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x2]?_0x19c535['attrs'][0x2][_0x4289('0x5f')]:undefined)||0xc}];case _0x4289('0x66'):return[{'name':'attrMetric','value':_0x19c535[_0x4289('0x67')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||_0x4289('0x68')},{'name':'attrVoiceQueues','value':_0x19c535[_0x4289('0x69')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x1]?_0x19c535['attrs'][0x1]['value']:undefined)||[]},{'name':_0x4289('0x65'),'value':_0x19c535[_0x4289('0x65')]||(_0x19c535['attrs']&&_0x19c535['attrs'][0x2]?_0x19c535[_0x4289('0x5b')][0x2][_0x4289('0x5f')]:undefined)||0x14},{'name':_0x4289('0x6a'),'value':_0x19c535[_0x4289('0x6a')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x3]?_0x19c535[_0x4289('0x5b')][0x3][_0x4289('0x5f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x19c535[_0x4289('0x6b')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x4]?_0x19c535[_0x4289('0x5b')][0x4][_0x4289('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x19c535['attrFaxAccounts']||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x5]?_0x19c535['attrs'][0x5][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6c'),'value':_0x19c535[_0x4289('0x6c')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x6]?_0x19c535['attrs'][0x6][_0x4289('0x5f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x19c535[_0x4289('0x6d')]||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x7]?_0x19c535[_0x4289('0x5b')][0x7][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6e'),'value':_0x19c535[_0x4289('0x6e')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x8]?_0x19c535['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x19c535[_0x4289('0x6f')]||(_0x19c535['attrs']&&_0x19c535['attrs'][0x9]?_0x19c535['attrs'][0x9][_0x4289('0x5f')]:undefined)||''}];case _0x4289('0x70'):case _0x4289('0x71'):return[{'name':_0x4289('0x72'),'value':_0x19c535[_0x4289('0x72')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535['attrs'][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||_0x4289('0x68')},{'name':_0x4289('0x73'),'value':_0x19c535[_0x4289('0x73')]||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x1]?_0x19c535[_0x4289('0x5b')][0x1][_0x4289('0x5f')]:undefined)||null},{'name':'attrSerie3','value':_0x19c535['attrSerie3']||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x2]?_0x19c535[_0x4289('0x5b')][0x2][_0x4289('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x19c535[_0x4289('0x69')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x3]?_0x19c535[_0x4289('0x5b')][0x3][_0x4289('0x5f')]:undefined)||[]},{'name':_0x4289('0x6a'),'value':_0x19c535[_0x4289('0x6a')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x4]?_0x19c535[_0x4289('0x5b')][0x4]['value']:undefined)||'voice'},{'name':_0x4289('0x6b'),'value':_0x19c535[_0x4289('0x6b')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x5]?_0x19c535['attrs'][0x5][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x74'),'value':_0x19c535[_0x4289('0x74')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x6]?_0x19c535[_0x4289('0x5b')][0x6][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6c'),'value':_0x19c535['attrSmsAccounts']||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x7]?_0x19c535[_0x4289('0x5b')][0x7][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6d'),'value':_0x19c535['attrOpenchannelAccounts']||(_0x19c535[_0x4289('0x5b')]&&_0x19c535['attrs'][0x8]?_0x19c535['attrs'][0x8]['value']:undefined)||''},{'name':_0x4289('0x6e'),'value':_0x19c535['attrWhatsappAccounts']||(_0x19c535[_0x4289('0x5b')]&&_0x19c535['attrs'][0x9]?_0x19c535[_0x4289('0x5b')][0x9][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6f'),'value':_0x19c535[_0x4289('0x6f')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0xa]?_0x19c535[_0x4289('0x5b')][0xa]['value']:undefined)||''}];case _0x4289('0x75'):return[{'name':'attrReport','type':_0x19c535[_0x4289('0x76')]||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535['attrs'][0x0][_0x4289('0x40')]:undefined)||null,'value':_0x19c535[_0x4289('0x77')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||null},{'name':_0x4289('0x78'),'value':_0x19c535[_0x4289('0x78')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x1]?_0x19c535[_0x4289('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2c9283){logger[_0x4289('0x2a')](_0x4289('0x79'),JSON[_0x4289('0x7a')](_0x2c9283));return[];}}exports[_0x4289('0x7b')]=function(_0x301696,_0x28fc5c,_0x43e139){if(_0x301696[_0x4289('0x4c')]['id']){delete _0x301696[_0x4289('0x4c')]['id'];}return db['Dashboard'][_0x4289('0x4a')]({'where':{'id':_0x301696[_0x4289('0x48')]['id']}})[_0x4289('0x25')](handleEntityNotFound(_0x28fc5c,null))[_0x4289('0x25')](function(_0x197c2b){if(_0x197c2b){_0x301696[_0x4289('0x4c')][_0x4289('0x7c')]=_0x197c2b['id'];_0x301696[_0x4289('0x4c')][_0x4289('0x5b')]=widgetAttributes(_0x301696['body']);return db[_0x4289('0x7d')][_0x4289('0x4b')](_0x301696['body']);}})['then'](respondWithResult(_0x28fc5c,null))[_0x4289('0x46')](handleError(_0x28fc5c,null));};exports['getItems']=function(_0x3632e1,_0x24cd88,_0x52a016){var _0x2eb954={};var _0x1852f4={};var _0x54defb;var _0x2d961a;return db[_0x4289('0x2d')][_0x4289('0x7e')]({'where':{'id':_0x3632e1[_0x4289('0x48')]['id']}})['then'](handleEntityNotFound(_0x24cd88,null))[_0x4289('0x25')](function(_0x104942){if(_0x104942){_0x54defb=_0x104942;_0x1852f4['model']=_[_0x4289('0x32')](db['DashboardItem'][_0x4289('0x2e')]);_0x1852f4[_0x4289('0x31')]=_[_0x4289('0x32')](_0x3632e1['query']);_0x1852f4[_0x4289('0x3c')]=_['intersection'](_0x1852f4['model'],_0x1852f4[_0x4289('0x31')]);_0x2eb954['attributes']=_[_0x4289('0x34')](_0x1852f4[_0x4289('0x30')],qs[_0x4289('0x35')](_0x3632e1[_0x4289('0x31')][_0x4289('0x35')]));_0x2eb954[_0x4289('0x33')]=_0x2eb954['attributes'][_0x4289('0x36')]?_0x2eb954['attributes']:_0x1852f4['model'];_0x2eb954['order']=qs[_0x4289('0x3a')](_0x3632e1[_0x4289('0x31')]['sort']);_0x2eb954[_0x4289('0x3b')]=qs[_0x4289('0x3c')](_['pick'](_0x3632e1[_0x4289('0x31')],_0x1852f4['filters']));if(_0x3632e1[_0x4289('0x31')][_0x4289('0x3e')]){_0x2eb954[_0x4289('0x3b')]=_[_0x4289('0x3f')](_0x2eb954[_0x4289('0x3b')],{'$or':_[_0x4289('0x7f')](_0x2eb954[_0x4289('0x33')],function(_0x3e3b7d){var _0x36b68d={};_0x36b68d[_0x3e3b7d]={'$like':'%'+_0x3632e1[_0x4289('0x31')][_0x4289('0x3e')]+'%'};return _0x36b68d;})});}_0x2eb954=_[_0x4289('0x3f')]({},_0x2eb954,_0x3632e1['options']);return _0x54defb[_0x4289('0x80')](_0x2eb954);}})[_0x4289('0x25')](function(_0x42cbe7){if(_0x42cbe7){_0x2d961a=_0x42cbe7[_0x4289('0x36')];if(!_0x3632e1['query'][_0x4289('0x37')](_0x4289('0x38'))){_0x2eb954[_0x4289('0x1f')]=qs[_0x4289('0x1f')](_0x3632e1[_0x4289('0x31')][_0x4289('0x1f')]);_0x2eb954[_0x4289('0x1c')]=qs[_0x4289('0x1c')](_0x3632e1[_0x4289('0x31')][_0x4289('0x1c')]);}return _0x54defb[_0x4289('0x80')](_0x2eb954);}})[_0x4289('0x25')](function(_0x3e0505){if(_0x3e0505){return _0x3e0505?{'count':_0x2d961a,'rows':_0x3e0505}:null;}})[_0x4289('0x25')](respondWithResult(_0x24cd88,null))[_0x4289('0x46')](handleError(_0x24cd88,null));};
\ No newline at end of file