Built motion from commit e02f907f.|2.6.14
[motion2.git] / server / api / dashboard / dashboard.controller.js
index a951dfb..6dad516 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc03=['zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','Dashboard','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','rows','catch','show','rawAttributes','keys','includeAll','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','params','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrVoiceQueues','multibar-chart','pie-chart','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','html-pdf','rimraf'];(function(_0x2e3646,_0x412055){var _0x2b1dc1=function(_0x4e723a){while(--_0x4e723a){_0x2e3646['push'](_0x2e3646['shift']());}};_0x2b1dc1(++_0x412055);}(_0xfc03,0x16f));var _0x3fc0=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xfc03[_0x5f309e];return _0x487b5e;};'use strict';var pdf=require(_0x3fc0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3fc0('0x1'));var zipdir=require(_0x3fc0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fc0('0x3'));var moment=require('moment');var BPromise=require(_0x3fc0('0x4'));var Mustache=require(_0x3fc0('0x5'));var util=require(_0x3fc0('0x6'));var path=require(_0x3fc0('0x7'));var sox=require(_0x3fc0('0x8'));var csv=require(_0x3fc0('0x9'));var ejs=require(_0x3fc0('0xa'));var fs=require('fs');var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x9'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var db=require(_0x3fc0('0x17'))['db'];config['redis']=_[_0x3fc0('0x18')](config['redis'],{'host':_0x3fc0('0x19'),'port':0x18eb});var socket=require(_0x3fc0('0x1a'))(new Redis(config['redis']));require(_0x3fc0('0x1b'))[_0x3fc0('0x1c')](socket);function respondWithStatusCode(_0x392c46,_0x4eb69a){_0x4eb69a=_0x4eb69a||0xcc;return function(_0x29ad7a){if(_0x29ad7a){return _0x392c46[_0x3fc0('0x1d')](_0x4eb69a);}return _0x392c46[_0x3fc0('0x1e')](_0x4eb69a)[_0x3fc0('0x1f')]();};}function respondWithResult(_0x562ecc,_0x277dbf){_0x277dbf=_0x277dbf||0xc8;return function(_0x3d869e){if(_0x3d869e){return _0x562ecc[_0x3fc0('0x1e')](_0x277dbf)['json'](_0x3d869e);}};}function respondWithFilteredResult(_0x52ba8c,_0x491446){return function(_0x121931){if(_0x121931){var _0x3c5026=_0x121931[_0x3fc0('0x20')],_0x4b947c=_0x491446[_0x3fc0('0x21')],_0x3bb388=_0x491446[_0x3fc0('0x21')]+_0x491446[_0x3fc0('0x22')],_0x33ffbc;if(_0x3bb388>=_0x3c5026){_0x3bb388=_0x3c5026;_0x33ffbc=0xc8;}else{_0x33ffbc=0xce;}_0x52ba8c[_0x3fc0('0x1e')](_0x33ffbc);return _0x52ba8c[_0x3fc0('0x23')](_0x3fc0('0x24'),_0x4b947c+'-'+_0x3bb388+'/'+_0x3c5026)['json'](_0x121931);}return null;};}function patchUpdates(_0xf13744){return function(_0x9ab2c5){try{jsonpatch[_0x3fc0('0x25')](_0x9ab2c5,_0xf13744,!![]);}catch(_0x3d6c0a){return BPromise[_0x3fc0('0x26')](_0x3d6c0a);}return _0x9ab2c5[_0x3fc0('0x27')]();};}function saveUpdates(_0x47c770,_0x477674){return function(_0x23d513){if(_0x23d513){return _0x23d513[_0x3fc0('0x28')](_0x47c770)[_0x3fc0('0x29')](function(_0x46c213){return _0x46c213;});}return null;};}function removeEntity(_0x303dd2,_0x2f423e){return function(_0x31743e){if(_0x31743e){return _0x31743e[_0x3fc0('0x2a')]()[_0x3fc0('0x29')](function(){var _0x294723=_0x31743e[_0x3fc0('0x2b')]({'plain':!![]});var _0x784765=_0x3fc0('0x2c');return db[_0x3fc0('0x2d')][_0x3fc0('0x2a')]({'where':{'type':_0x784765,'resourceId':_0x294723['id']}})['then'](function(){return _0x31743e;});})[_0x3fc0('0x29')](function(){_0x303dd2[_0x3fc0('0x1e')](0xcc)[_0x3fc0('0x1f')]();});}};}function handleEntityNotFound(_0x35c34c,_0x5a9179){return function(_0x134317){if(!_0x134317){_0x35c34c[_0x3fc0('0x1d')](0x194);}return _0x134317;};}function handleError(_0x126515,_0x2645b4){_0x2645b4=_0x2645b4||0x1f4;return function(_0x559fcc){logger[_0x3fc0('0x2e')](_0x559fcc[_0x3fc0('0x2f')]);if(_0x559fcc[_0x3fc0('0x30')]){delete _0x559fcc[_0x3fc0('0x30')];}_0x126515[_0x3fc0('0x1e')](_0x2645b4)[_0x3fc0('0x31')](_0x559fcc);};}exports['index']=function(_0xd9ecae,_0x2351c8){var _0x181948={},_0x21a074={},_0x3f1a75={'count':0x0,'rows':[]};var _0x48c8a8=_[_0x3fc0('0x32')](db[_0x3fc0('0x33')]['rawAttributes'],function(_0x54e9ca){return{'name':_0x54e9ca[_0x3fc0('0x34')],'type':_0x54e9ca['type'][_0x3fc0('0x35')]};});_0x21a074[_0x3fc0('0x36')]=_[_0x3fc0('0x32')](_0x48c8a8,_0x3fc0('0x30'));_0x21a074[_0x3fc0('0x37')]=_['keys'](_0xd9ecae['query']);_0x21a074[_0x3fc0('0x38')]=_[_0x3fc0('0x39')](_0x21a074[_0x3fc0('0x36')],_0x21a074[_0x3fc0('0x37')]);_0x181948[_0x3fc0('0x3a')]=_['intersection'](_0x21a074[_0x3fc0('0x36')],qs[_0x3fc0('0x3b')](_0xd9ecae[_0x3fc0('0x37')]['fields']));_0x181948[_0x3fc0('0x3a')]=_0x181948[_0x3fc0('0x3a')][_0x3fc0('0x3c')]?_0x181948[_0x3fc0('0x3a')]:_0x21a074['model'];if(!_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x3d')]('nolimit')){_0x181948[_0x3fc0('0x22')]=qs['limit'](_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x22')]);_0x181948[_0x3fc0('0x21')]=qs[_0x3fc0('0x21')](_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x21')]);}_0x181948[_0x3fc0('0x3e')]=qs[_0x3fc0('0x3f')](_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x3f')]);_0x181948[_0x3fc0('0x40')]=qs['filters'](_[_0x3fc0('0x41')](_0xd9ecae[_0x3fc0('0x37')],_0x21a074[_0x3fc0('0x38')]));if(_0xd9ecae[_0x3fc0('0x37')][_0x3fc0('0x42')]){_0x181948[_0x3fc0('0x40')]=_['merge'](_0x181948['where'],{'$or':_[_0x3fc0('0x32')](_0x48c8a8,function(_0x3386d2){if(_0x3386d2[_0x3fc0('0x43')]!==_0x3fc0('0x44')){var _0xf34450={};_0xf34450[_0x3386d2['name']]={'$like':'%'+_0xd9ecae['query']['filter']+'%'};return _0xf34450;}})});}_0x181948=_[_0x3fc0('0x45')]({},_0x181948,_0xd9ecae[_0x3fc0('0x46')]);var _0x40ead6={'where':_0x181948['where']};return db['Dashboard'][_0x3fc0('0x20')](_0x40ead6)[_0x3fc0('0x29')](function(_0x320878){_0x3f1a75[_0x3fc0('0x20')]=_0x320878;if(_0xd9ecae['query']['includeAll']){_0x181948[_0x3fc0('0x47')]=[{'all':!![]}];}return db[_0x3fc0('0x33')]['findAll'](_0x181948);})[_0x3fc0('0x29')](function(_0x5ad073){_0x3f1a75[_0x3fc0('0x48')]=_0x5ad073;return _0x3f1a75;})[_0x3fc0('0x29')](respondWithFilteredResult(_0x2351c8,_0x181948))[_0x3fc0('0x49')](handleError(_0x2351c8,null));};exports[_0x3fc0('0x4a')]=function(_0x2d01e9,_0x38e449){var _0x80dfee={'raw':![],'where':{'id':_0x2d01e9['params']['id']}},_0x1b3b70={};_0x1b3b70[_0x3fc0('0x36')]=_['keys'](db[_0x3fc0('0x33')][_0x3fc0('0x4b')]);_0x1b3b70[_0x3fc0('0x37')]=_[_0x3fc0('0x4c')](_0x2d01e9[_0x3fc0('0x37')]);_0x1b3b70['filters']=_[_0x3fc0('0x39')](_0x1b3b70[_0x3fc0('0x36')],_0x1b3b70[_0x3fc0('0x37')]);_0x80dfee[_0x3fc0('0x3a')]=_['intersection'](_0x1b3b70[_0x3fc0('0x36')],qs['fields'](_0x2d01e9[_0x3fc0('0x37')][_0x3fc0('0x3b')]));_0x80dfee[_0x3fc0('0x3a')]=_0x80dfee[_0x3fc0('0x3a')][_0x3fc0('0x3c')]?_0x80dfee['attributes']:_0x1b3b70[_0x3fc0('0x36')];if(_0x2d01e9[_0x3fc0('0x37')][_0x3fc0('0x4d')]){_0x80dfee['include']=[{'all':!![]}];}_0x80dfee=_[_0x3fc0('0x45')]({},_0x80dfee,_0x2d01e9[_0x3fc0('0x46')]);return db['Dashboard'][_0x3fc0('0x4e')](_0x80dfee)[_0x3fc0('0x29')](handleEntityNotFound(_0x38e449,null))[_0x3fc0('0x29')](respondWithResult(_0x38e449,null))['catch'](handleError(_0x38e449,null));};exports['create']=function(_0x3a35ac,_0xa3de5a){return db[_0x3fc0('0x33')]['create'](_0x3a35ac[_0x3fc0('0x4f')],{})['then'](function(_0x40dbf3){var _0x5443dc=_0x3a35ac['user']['get']({'plain':!![]});if(!_0x5443dc)throw new Error(_0x3fc0('0x50'));if(_0x5443dc[_0x3fc0('0x51')]===_0x3fc0('0x52')){var _0x3730f5=_0x40dbf3[_0x3fc0('0x2b')]({'plain':!![]});var _0x16023b='CustomDashboards';return db[_0x3fc0('0x53')][_0x3fc0('0x4e')]({'where':{'name':_0x16023b,'userProfileId':_0x5443dc['userProfileId']},'raw':!![]})['then'](function(_0x74ae6a){if(_0x74ae6a&&_0x74ae6a[_0x3fc0('0x54')]===0x0){return db[_0x3fc0('0x2d')][_0x3fc0('0x55')]({'name':_0x3730f5[_0x3fc0('0x30')],'resourceId':_0x3730f5['id'],'type':_0x74ae6a[_0x3fc0('0x30')],'sectionId':_0x74ae6a['id']},{})[_0x3fc0('0x29')](function(){return _0x40dbf3;});}else{return _0x40dbf3;}})[_0x3fc0('0x49')](function(_0x2e6725){logger[_0x3fc0('0x2e')](_0x3fc0('0x56'),_0x2e6725);throw _0x2e6725;});}return _0x40dbf3;})[_0x3fc0('0x29')](respondWithResult(_0xa3de5a,0xc9))['catch'](handleError(_0xa3de5a,null));};exports[_0x3fc0('0x57')]=function(_0xda5d3e,_0x24ee40){var _0x1dfd2c={'where':{'id':_0xda5d3e['params']['id']}},_0x42645c={};_0x42645c[_0x3fc0('0x36')]=_['keys'](db[_0x3fc0('0x33')][_0x3fc0('0x4b')]);_0x1dfd2c[_0x3fc0('0x3a')]=_[_0x3fc0('0x39')](_0x42645c['model'],qs[_0x3fc0('0x3b')](_0xda5d3e[_0x3fc0('0x37')][_0x3fc0('0x3b')]));_0x1dfd2c[_0x3fc0('0x3a')]=_0x1dfd2c[_0x3fc0('0x3a')][_0x3fc0('0x3c')]?_0x1dfd2c['attributes']:_0x42645c[_0x3fc0('0x36')];if(_0xda5d3e[_0x3fc0('0x37')][_0x3fc0('0x4d')]){_0x1dfd2c[_0x3fc0('0x47')]=[{'all':!![]}];}_0x1dfd2c=_[_0x3fc0('0x45')]({},_0x1dfd2c,_0xda5d3e[_0x3fc0('0x46')]);return db['Dashboard'][_0x3fc0('0x4e')](_0x1dfd2c)[_0x3fc0('0x29')](handleEntityNotFound(_0x24ee40,null))[_0x3fc0('0x29')](function(_0x5a3732){if(_0x5a3732){var _0x2cc735=_0x5a3732[_0x3fc0('0x2b')]({'plain':!![]});_0x2cc735=qs[_0x3fc0('0x58')](_0x2cc735,['id',_0x3fc0('0x59'),_0x3fc0('0x5a')]);_0xda5d3e[_0x3fc0('0x4f')]=_[_0x3fc0('0x58')](_0xda5d3e[_0x3fc0('0x4f')],['id',_0x3fc0('0x59'),_0x3fc0('0x5a')]);return db[_0x3fc0('0x33')][_0x3fc0('0x55')](_[_0x3fc0('0x45')](_0x2cc735,_0xda5d3e[_0x3fc0('0x4f')]),{'include':_0xda5d3e[_0x3fc0('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x3fc0('0x29')](function(_0x13be8e){var _0x374d81=_0xda5d3e[_0x3fc0('0x52')][_0x3fc0('0x2b')]({'plain':!![]});if(!_0x374d81)throw new Error(_0x3fc0('0x50'));if(_0x374d81[_0x3fc0('0x51')]===_0x3fc0('0x52')){var _0x1c7d11=_0x13be8e[_0x3fc0('0x2b')]({'plain':!![]});var _0x5a9ad5=_0x3fc0('0x2c');return db[_0x3fc0('0x53')][_0x3fc0('0x4e')]({'where':{'name':_0x5a9ad5,'userProfileId':_0x374d81[_0x3fc0('0x5b')]},'raw':!![]})[_0x3fc0('0x29')](function(_0x32b653){if(_0x32b653&&_0x32b653['autoAssociation']===0x0){return db[_0x3fc0('0x2d')][_0x3fc0('0x55')]({'name':_0x1c7d11[_0x3fc0('0x30')],'resourceId':_0x1c7d11['id'],'type':_0x32b653['name'],'sectionId':_0x32b653['id']},{})[_0x3fc0('0x29')](function(){return _0x13be8e;});}else{return _0x13be8e;}})[_0x3fc0('0x49')](function(_0x2f8b6b){logger[_0x3fc0('0x2e')](_0x3fc0('0x56'),_0x2f8b6b);throw _0x2f8b6b;});}return _0x13be8e;});}})[_0x3fc0('0x29')](respondWithResult(_0x24ee40,0xc9))[_0x3fc0('0x49')](handleError(_0x24ee40,null));};exports[_0x3fc0('0x28')]=function(_0x139971,_0x5ea7e7){if(_0x139971[_0x3fc0('0x4f')]['id']){delete _0x139971[_0x3fc0('0x4f')]['id'];}return db[_0x3fc0('0x33')][_0x3fc0('0x4e')]({'where':{'id':_0x139971[_0x3fc0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5ea7e7,null))[_0x3fc0('0x29')](saveUpdates(_0x139971[_0x3fc0('0x4f')],null))[_0x3fc0('0x29')](respondWithResult(_0x5ea7e7,null))[_0x3fc0('0x49')](handleError(_0x5ea7e7,null));};exports[_0x3fc0('0x2a')]=function(_0x20e372,_0x1da3dc){return db[_0x3fc0('0x33')][_0x3fc0('0x4e')]({'where':{'id':_0x20e372[_0x3fc0('0x5c')]['id']}})[_0x3fc0('0x29')](handleEntityNotFound(_0x1da3dc,null))['then'](removeEntity(_0x1da3dc,null))[_0x3fc0('0x49')](handleError(_0x1da3dc,null));};function widgetAttributes(_0x4f667b){try{switch(_0x4f667b[_0x3fc0('0x43')]){case _0x3fc0('0x5d'):return[{'name':_0x3fc0('0x5e'),'value':_0x4f667b[_0x3fc0('0x5e')]||(_0x4f667b['attrs']&&_0x4f667b['attrs'][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x60')]:undefined)||'https://'}];case _0x3fc0('0x61'):return[{'name':_0x3fc0('0x62'),'value':_0x4f667b['attrPath']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0]['value']:undefined)||''}];case _0x3fc0('0x63'):return[{'name':_0x3fc0('0x64'),'value':_0x4f667b[_0x3fc0('0x64')]||(_0x4f667b['attrs']&&_0x4f667b['attrs'][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x60')]:undefined)||_0x3fc0('0x65')},{'name':_0x3fc0('0x66'),'value':_0x4f667b[_0x3fc0('0x66')]||(_0x4f667b['attrs']&&_0x4f667b[_0x3fc0('0x5f')][0x1]?_0x4f667b[_0x3fc0('0x5f')][0x1][_0x3fc0('0x60')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x4f667b[_0x3fc0('0x67')]||(_0x4f667b['attrs']&&_0x4f667b[_0x3fc0('0x5f')][0x2]?_0x4f667b[_0x3fc0('0x5f')][0x2][_0x3fc0('0x60')]:undefined)||0xc}];case _0x3fc0('0x68'):return[{'name':'attrMetric','value':_0x4f667b['attrMetric']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x60')]:undefined)||'total'},{'name':_0x3fc0('0x69'),'value':_0x4f667b[_0x3fc0('0x69')]||(_0x4f667b['attrs']&&_0x4f667b[_0x3fc0('0x5f')][0x1]?_0x4f667b['attrs'][0x1][_0x3fc0('0x60')]:undefined)||[]},{'name':_0x3fc0('0x67'),'value':_0x4f667b['attrFontSize']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x2]?_0x4f667b[_0x3fc0('0x5f')][0x2]['value']:undefined)||0x14}];case _0x3fc0('0x6a'):case _0x3fc0('0x6b'):return[{'name':'attrSerie1','value':_0x4f667b['attrSerie1']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b['attrs'][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x60')]:undefined)||_0x3fc0('0x6c')},{'name':_0x3fc0('0x6d'),'value':_0x4f667b['attrSerie2']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x1]?_0x4f667b[_0x3fc0('0x5f')][0x1][_0x3fc0('0x60')]:undefined)||null},{'name':_0x3fc0('0x6e'),'value':_0x4f667b['attrSerie3']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b['attrs'][0x2]?_0x4f667b[_0x3fc0('0x5f')][0x2][_0x3fc0('0x60')]:undefined)||null},{'name':_0x3fc0('0x69'),'value':_0x4f667b[_0x3fc0('0x69')]||(_0x4f667b['attrs']&&_0x4f667b['attrs'][0x3]?_0x4f667b[_0x3fc0('0x5f')][0x3][_0x3fc0('0x60')]:undefined)||[]}];case _0x3fc0('0x6f'):return[{'name':_0x3fc0('0x70'),'type':_0x4f667b[_0x3fc0('0x71')]||(_0x4f667b['attrs']&&_0x4f667b[_0x3fc0('0x5f')][0x0]?_0x4f667b[_0x3fc0('0x5f')][0x0][_0x3fc0('0x43')]:undefined)||null,'value':_0x4f667b[_0x3fc0('0x70')]||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x0]?_0x4f667b['attrs'][0x0][_0x3fc0('0x60')]:undefined)||null},{'name':_0x3fc0('0x72'),'value':_0x4f667b['attrRefresh']||(_0x4f667b[_0x3fc0('0x5f')]&&_0x4f667b[_0x3fc0('0x5f')][0x1]?_0x4f667b['attrs'][0x1][_0x3fc0('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x418c85){logger[_0x3fc0('0x2e')](_0x3fc0('0x73'),JSON[_0x3fc0('0x74')](_0x418c85));return[];}}exports[_0x3fc0('0x75')]=function(_0x5a1373,_0x553789,_0x59f8c3){if(_0x5a1373['body']['id']){delete _0x5a1373[_0x3fc0('0x4f')]['id'];}return db[_0x3fc0('0x33')][_0x3fc0('0x4e')]({'where':{'id':_0x5a1373[_0x3fc0('0x5c')]['id']}})[_0x3fc0('0x29')](handleEntityNotFound(_0x553789,null))['then'](function(_0x423911){if(_0x423911){_0x5a1373[_0x3fc0('0x4f')][_0x3fc0('0x76')]=_0x423911['id'];_0x5a1373[_0x3fc0('0x4f')][_0x3fc0('0x5f')]=widgetAttributes(_0x5a1373[_0x3fc0('0x4f')]);return db[_0x3fc0('0x77')][_0x3fc0('0x55')](_0x5a1373[_0x3fc0('0x4f')]);}})[_0x3fc0('0x29')](respondWithResult(_0x553789,null))['catch'](handleError(_0x553789,null));};exports[_0x3fc0('0x78')]=function(_0x2bd1d3,_0x33d0ac,_0x309e7f){var _0x57f884={};var _0x38bdf7={};var _0x145913;var _0x287702;return db[_0x3fc0('0x33')][_0x3fc0('0x79')]({'where':{'id':_0x2bd1d3[_0x3fc0('0x5c')]['id']}})['then'](handleEntityNotFound(_0x33d0ac,null))[_0x3fc0('0x29')](function(_0x5a149d){if(_0x5a149d){_0x145913=_0x5a149d;_0x38bdf7[_0x3fc0('0x36')]=_[_0x3fc0('0x4c')](db[_0x3fc0('0x77')]['rawAttributes']);_0x38bdf7[_0x3fc0('0x37')]=_[_0x3fc0('0x4c')](_0x2bd1d3[_0x3fc0('0x37')]);_0x38bdf7['filters']=_['intersection'](_0x38bdf7[_0x3fc0('0x36')],_0x38bdf7[_0x3fc0('0x37')]);_0x57f884['attributes']=_[_0x3fc0('0x39')](_0x38bdf7[_0x3fc0('0x36')],qs[_0x3fc0('0x3b')](_0x2bd1d3['query'][_0x3fc0('0x3b')]));_0x57f884[_0x3fc0('0x3a')]=_0x57f884['attributes'][_0x3fc0('0x3c')]?_0x57f884['attributes']:_0x38bdf7[_0x3fc0('0x36')];_0x57f884[_0x3fc0('0x3e')]=qs[_0x3fc0('0x3f')](_0x2bd1d3[_0x3fc0('0x37')][_0x3fc0('0x3f')]);_0x57f884[_0x3fc0('0x40')]=qs[_0x3fc0('0x38')](_[_0x3fc0('0x41')](_0x2bd1d3['query'],_0x38bdf7['filters']));if(_0x2bd1d3[_0x3fc0('0x37')][_0x3fc0('0x42')]){_0x57f884['where']=_[_0x3fc0('0x45')](_0x57f884[_0x3fc0('0x40')],{'$or':_['map'](_0x57f884['attributes'],function(_0x42290a){var _0x3e6433={};_0x3e6433[_0x42290a]={'$like':'%'+_0x2bd1d3['query']['filter']+'%'};return _0x3e6433;})});}_0x57f884=_[_0x3fc0('0x45')]({},_0x57f884,_0x2bd1d3[_0x3fc0('0x46')]);return _0x145913[_0x3fc0('0x78')](_0x57f884);}})[_0x3fc0('0x29')](function(_0x278afe){if(_0x278afe){_0x287702=_0x278afe[_0x3fc0('0x3c')];if(!_0x2bd1d3[_0x3fc0('0x37')][_0x3fc0('0x3d')](_0x3fc0('0x7a'))){_0x57f884[_0x3fc0('0x22')]=qs[_0x3fc0('0x22')](_0x2bd1d3['query'][_0x3fc0('0x22')]);_0x57f884[_0x3fc0('0x21')]=qs[_0x3fc0('0x21')](_0x2bd1d3[_0x3fc0('0x37')]['offset']);}return _0x145913[_0x3fc0('0x78')](_0x57f884);}})[_0x3fc0('0x29')](function(_0x13244b){if(_0x13244b){return _0x13244b?{'count':_0x287702,'rows':_0x13244b}:null;}})[_0x3fc0('0x29')](respondWithResult(_0x33d0ac,null))[_0x3fc0('0x49')](handleError(_0x33d0ac,null));};
\ No newline at end of file
+var _0x786c=['destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','find','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','update','iframe','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrVoiceQueues','voice','web-report','attrReport','reportType','attrRefresh','DashboardItem','getItems','findOne','sort','pick','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x786c,0x158));var _0xc786=function(_0x59b3d5,_0x28d433){_0x59b3d5=_0x59b3d5-0x0;var _0x252253=_0x786c[_0x59b3d5];return _0x252253;};'use strict';var emlformat=require(_0xc786('0x0'));var rimraf=require(_0xc786('0x1'));var zipdir=require(_0xc786('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc786('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc786('0x4'));var util=require(_0xc786('0x5'));var path=require(_0xc786('0x6'));var sox=require(_0xc786('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc786('0x8'));var squel=require(_0xc786('0x9'));var crypto=require(_0xc786('0xa'));var jsforce=require(_0xc786('0xb'));var deskjs=require(_0xc786('0xc'));var toCsv=require(_0xc786('0xd'));var querystring=require('querystring');var Papa=require(_0xc786('0xe'));var Redis=require(_0xc786('0xf'));var authService=require(_0xc786('0x10'));var qs=require(_0xc786('0x11'));var as=require(_0xc786('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc786('0x13'))(_0xc786('0x14'));var utils=require(_0xc786('0x15'));var config=require(_0xc786('0x16'));var licenseUtil=require(_0xc786('0x17'));var db=require(_0xc786('0x18'))['db'];config['redis']=_[_0xc786('0x19')](config[_0xc786('0x1a')],{'host':_0xc786('0x1b'),'port':0x18eb});var socket=require(_0xc786('0x1c'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x10288b,_0x3530f1){_0x3530f1=_0x3530f1||0xcc;return function(_0x402628){if(_0x402628){return _0x10288b[_0xc786('0x1d')](_0x3530f1);}return _0x10288b['status'](_0x3530f1)[_0xc786('0x1e')]();};}function respondWithResult(_0x1959b3,_0x249a88){_0x249a88=_0x249a88||0xc8;return function(_0x1fbd22){if(_0x1fbd22){return _0x1959b3[_0xc786('0x1f')](_0x249a88)[_0xc786('0x20')](_0x1fbd22);}};}function respondWithFilteredResult(_0x384bd5,_0x148cb){return function(_0x4a2f2d){if(_0x4a2f2d){var _0x50cc85=typeof _0x148cb['offset']==='undefined'&&typeof _0x148cb[_0xc786('0x21')]===_0xc786('0x22');var _0x45c35e=_0x4a2f2d['count'];var _0x709122=_0x50cc85?0x0:_0x148cb[_0xc786('0x23')];var _0x13b6f9=_0x50cc85?_0x4a2f2d[_0xc786('0x24')]:_0x148cb['offset']+_0x148cb['limit'];var _0x3e91c2;if(_0x13b6f9>=_0x45c35e){_0x13b6f9=_0x45c35e;_0x3e91c2=0xc8;}else{_0x3e91c2=0xce;}_0x384bd5[_0xc786('0x1f')](_0x3e91c2);return _0x384bd5[_0xc786('0x25')](_0xc786('0x26'),_0x709122+'-'+_0x13b6f9+'/'+_0x45c35e)[_0xc786('0x20')](_0x4a2f2d);}return null;};}function patchUpdates(_0xe30aef){return function(_0x460398){try{jsonpatch[_0xc786('0x27')](_0x460398,_0xe30aef,!![]);}catch(_0x38c994){return BPromise[_0xc786('0x28')](_0x38c994);}return _0x460398[_0xc786('0x29')]();};}function saveUpdates(_0x9f9e1,_0x4bf7a2){return function(_0x48d7e9){if(_0x48d7e9){return _0x48d7e9['update'](_0x9f9e1)[_0xc786('0x2a')](function(_0xb24386){return _0xb24386;});}return null;};}function removeEntity(_0x2b1a1f,_0x15126b){return function(_0xc09e5d){if(_0xc09e5d){return _0xc09e5d[_0xc786('0x2b')]()[_0xc786('0x2a')](function(){var _0x24a072=_0xc09e5d[_0xc786('0x2c')]({'plain':!![]});var _0x416284=_0xc786('0x2d');return db[_0xc786('0x2e')][_0xc786('0x2b')]({'where':{'type':_0x416284,'resourceId':_0x24a072['id']}})[_0xc786('0x2a')](function(){return _0xc09e5d;});})['then'](function(){_0x2b1a1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb12211,_0x4427ee){return function(_0x17edbb){if(!_0x17edbb){_0xb12211[_0xc786('0x1d')](0x194);}return _0x17edbb;};}function handleError(_0x31a689,_0x67cae){_0x67cae=_0x67cae||0x1f4;return function(_0xde45f9){logger[_0xc786('0x2f')](_0xde45f9[_0xc786('0x30')]);if(_0xde45f9[_0xc786('0x31')]){delete _0xde45f9['name'];}_0x31a689[_0xc786('0x1f')](_0x67cae)[_0xc786('0x32')](_0xde45f9);};}exports[_0xc786('0x33')]=function(_0x3b9377,_0x19ea8d){var _0x5120ee={},_0x274e9b={},_0x5c8337={'count':0x0,'rows':[]};var _0x1418d9=_[_0xc786('0x34')](db[_0xc786('0x35')][_0xc786('0x36')],function(_0x4a8d67){return{'name':_0x4a8d67[_0xc786('0x37')],'type':_0x4a8d67[_0xc786('0x38')][_0xc786('0x39')]};});_0x274e9b['model']=_['map'](_0x1418d9,_0xc786('0x31'));_0x274e9b[_0xc786('0x3a')]=_[_0xc786('0x3b')](_0x3b9377[_0xc786('0x3a')]);_0x274e9b[_0xc786('0x3c')]=_[_0xc786('0x3d')](_0x274e9b[_0xc786('0x3e')],_0x274e9b[_0xc786('0x3a')]);_0x5120ee[_0xc786('0x3f')]=_[_0xc786('0x3d')](_0x274e9b[_0xc786('0x3e')],qs['fields'](_0x3b9377['query']['fields']));_0x5120ee[_0xc786('0x3f')]=_0x5120ee[_0xc786('0x3f')]['length']?_0x5120ee[_0xc786('0x3f')]:_0x274e9b[_0xc786('0x3e')];if(!_0x3b9377['query'][_0xc786('0x40')](_0xc786('0x41'))){_0x5120ee[_0xc786('0x21')]=qs['limit'](_0x3b9377['query']['limit']);_0x5120ee['offset']=qs['offset'](_0x3b9377['query'][_0xc786('0x23')]);}_0x5120ee[_0xc786('0x42')]=qs['sort'](_0x3b9377[_0xc786('0x3a')]['sort']);_0x5120ee['where']=qs[_0xc786('0x3c')](_['pick'](_0x3b9377[_0xc786('0x3a')],_0x274e9b[_0xc786('0x3c')]),_0x1418d9);if(_0x3b9377['query']['filter']){_0x5120ee[_0xc786('0x43')]=_[_0xc786('0x44')](_0x5120ee['where'],{'$or':_[_0xc786('0x34')](_0x1418d9,function(_0x3865e4){if(_0x3865e4[_0xc786('0x38')]!==_0xc786('0x45')){var _0x338176={};_0x338176[_0x3865e4[_0xc786('0x31')]]={'$like':'%'+_0x3b9377[_0xc786('0x3a')][_0xc786('0x46')]+'%'};return _0x338176;}})});}_0x5120ee=_['merge']({},_0x5120ee,_0x3b9377[_0xc786('0x47')]);var _0x400af6={'where':_0x5120ee['where']};return db['Dashboard'][_0xc786('0x24')](_0x400af6)[_0xc786('0x2a')](function(_0x327f06){_0x5c8337[_0xc786('0x24')]=_0x327f06;if(_0x3b9377['query'][_0xc786('0x48')]){_0x5120ee[_0xc786('0x49')]=[{'all':!![]}];}return db[_0xc786('0x35')]['findAll'](_0x5120ee);})[_0xc786('0x2a')](function(_0x34de63){_0x5c8337[_0xc786('0x4a')]=_0x34de63;return _0x5c8337;})[_0xc786('0x2a')](respondWithFilteredResult(_0x19ea8d,_0x5120ee))[_0xc786('0x4b')](handleError(_0x19ea8d,null));};exports[_0xc786('0x4c')]=function(_0x451df1,_0x1d42a5){var _0x5669b2={'raw':![],'where':{'id':_0x451df1[_0xc786('0x4d')]['id']}},_0x244d26={};_0x244d26['model']=_[_0xc786('0x3b')](db[_0xc786('0x35')][_0xc786('0x36')]);_0x244d26[_0xc786('0x3a')]=_[_0xc786('0x3b')](_0x451df1['query']);_0x244d26[_0xc786('0x3c')]=_[_0xc786('0x3d')](_0x244d26[_0xc786('0x3e')],_0x244d26[_0xc786('0x3a')]);_0x5669b2['attributes']=_[_0xc786('0x3d')](_0x244d26[_0xc786('0x3e')],qs[_0xc786('0x4e')](_0x451df1[_0xc786('0x3a')][_0xc786('0x4e')]));_0x5669b2[_0xc786('0x3f')]=_0x5669b2[_0xc786('0x3f')]['length']?_0x5669b2[_0xc786('0x3f')]:_0x244d26[_0xc786('0x3e')];if(_0x451df1[_0xc786('0x3a')][_0xc786('0x48')]){_0x5669b2[_0xc786('0x49')]=[{'all':!![]}];}_0x5669b2=_[_0xc786('0x44')]({},_0x5669b2,_0x451df1['options']);return db[_0xc786('0x35')]['find'](_0x5669b2)[_0xc786('0x2a')](handleEntityNotFound(_0x1d42a5,null))['then'](respondWithResult(_0x1d42a5,null))['catch'](handleError(_0x1d42a5,null));};exports[_0xc786('0x4f')]=function(_0x30be50,_0x56ab15){return db[_0xc786('0x35')][_0xc786('0x4f')](_0x30be50[_0xc786('0x50')],{})[_0xc786('0x2a')](function(_0x2fe100){var _0x6b85cb=_0x30be50[_0xc786('0x51')][_0xc786('0x2c')]({'plain':!![]});if(!_0x6b85cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6b85cb[_0xc786('0x52')]===_0xc786('0x51')){var _0x22c69b=_0x2fe100[_0xc786('0x2c')]({'plain':!![]});var _0x819e1c=_0xc786('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x819e1c,'userProfileId':_0x6b85cb['userProfileId']},'raw':!![]})['then'](function(_0x292ace){if(_0x292ace&&_0x292ace[_0xc786('0x53')]===0x0){return db[_0xc786('0x2e')]['create']({'name':_0x22c69b[_0xc786('0x31')],'resourceId':_0x22c69b['id'],'type':_0x292ace[_0xc786('0x31')],'sectionId':_0x292ace['id']},{})[_0xc786('0x2a')](function(){return _0x2fe100;});}else{return _0x2fe100;}})['catch'](function(_0x5becdb){logger[_0xc786('0x2f')](_0xc786('0x54'),_0x5becdb);throw _0x5becdb;});}return _0x2fe100;})['then'](respondWithResult(_0x56ab15,0xc9))[_0xc786('0x4b')](handleError(_0x56ab15,null));};exports['clone']=function(_0x55058d,_0x15571d){var _0x1d7f8b={'where':{'id':_0x55058d[_0xc786('0x4d')]['id']}},_0x510dc4={};_0x510dc4['model']=_[_0xc786('0x3b')](db['Dashboard']['rawAttributes']);_0x1d7f8b['attributes']=_['intersection'](_0x510dc4[_0xc786('0x3e')],qs[_0xc786('0x4e')](_0x55058d[_0xc786('0x3a')][_0xc786('0x4e')]));_0x1d7f8b[_0xc786('0x3f')]=_0x1d7f8b[_0xc786('0x3f')][_0xc786('0x55')]?_0x1d7f8b[_0xc786('0x3f')]:_0x510dc4['model'];if(_0x55058d[_0xc786('0x3a')][_0xc786('0x48')]){_0x1d7f8b[_0xc786('0x49')]=[{'all':!![]}];}_0x1d7f8b=_['merge']({},_0x1d7f8b,_0x55058d[_0xc786('0x47')]);return db[_0xc786('0x35')][_0xc786('0x56')](_0x1d7f8b)[_0xc786('0x2a')](handleEntityNotFound(_0x15571d,null))[_0xc786('0x2a')](function(_0x20b9e4){if(_0x20b9e4){var _0x4d1428=_0x20b9e4[_0xc786('0x2c')]({'plain':!![]});_0x4d1428=qs[_0xc786('0x57')](_0x4d1428,['id',_0xc786('0x58'),_0xc786('0x59')]);_0x55058d[_0xc786('0x50')]=_[_0xc786('0x57')](_0x55058d[_0xc786('0x50')],['id','createdAt',_0xc786('0x59')]);return db[_0xc786('0x35')][_0xc786('0x4f')](_[_0xc786('0x44')](_0x4d1428,_0x55058d[_0xc786('0x50')]),{'include':_0x55058d[_0xc786('0x3a')][_0xc786('0x48')]?[{'all':!![]}]:undefined})[_0xc786('0x2a')](function(_0x1a064b){var _0x49e8b6=_0x55058d['user']['get']({'plain':!![]});if(!_0x49e8b6)throw new Error(_0xc786('0x5a'));if(_0x49e8b6[_0xc786('0x52')]==='user'){var _0x3521d5=_0x1a064b[_0xc786('0x2c')]({'plain':!![]});var _0x14ae47=_0xc786('0x2d');return db[_0xc786('0x5b')][_0xc786('0x56')]({'where':{'name':_0x14ae47,'userProfileId':_0x49e8b6['userProfileId']},'raw':!![]})['then'](function(_0x4ffd01){if(_0x4ffd01&&_0x4ffd01[_0xc786('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x3521d5[_0xc786('0x31')],'resourceId':_0x3521d5['id'],'type':_0x4ffd01['name'],'sectionId':_0x4ffd01['id']},{})[_0xc786('0x2a')](function(){return _0x1a064b;});}else{return _0x1a064b;}})[_0xc786('0x4b')](function(_0x565c4c){logger['error'](_0xc786('0x54'),_0x565c4c);throw _0x565c4c;});}return _0x1a064b;});}})[_0xc786('0x2a')](respondWithResult(_0x15571d,0xc9))[_0xc786('0x4b')](handleError(_0x15571d,null));};exports[_0xc786('0x5c')]=function(_0x30c5f7,_0x5968e6){if(_0x30c5f7[_0xc786('0x50')]['id']){delete _0x30c5f7[_0xc786('0x50')]['id'];}return db[_0xc786('0x35')][_0xc786('0x56')]({'where':{'id':_0x30c5f7[_0xc786('0x4d')]['id']}})[_0xc786('0x2a')](handleEntityNotFound(_0x5968e6,null))[_0xc786('0x2a')](saveUpdates(_0x30c5f7['body'],null))[_0xc786('0x2a')](respondWithResult(_0x5968e6,null))[_0xc786('0x4b')](handleError(_0x5968e6,null));};exports[_0xc786('0x2b')]=function(_0x407d70,_0x1b0b57){return db['Dashboard']['find']({'where':{'id':_0x407d70[_0xc786('0x4d')]['id']}})[_0xc786('0x2a')](handleEntityNotFound(_0x1b0b57,null))[_0xc786('0x2a')](removeEntity(_0x1b0b57,null))[_0xc786('0x4b')](handleError(_0x1b0b57,null));};function widgetAttributes(_0x505573){try{switch(_0x505573['type']){case _0xc786('0x5d'):return[{'name':'attrUrl','value':_0x505573['attrUrl']||(_0x505573[_0xc786('0x5e')]&&_0x505573['attrs'][0x0]?_0x505573[_0xc786('0x5e')][0x0][_0xc786('0x5f')]:undefined)||_0xc786('0x60')}];case _0xc786('0x61'):return[{'name':_0xc786('0x62'),'value':_0x505573[_0xc786('0x62')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x0]?_0x505573['attrs'][0x0][_0xc786('0x5f')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x505573[_0xc786('0x63')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x0]?_0x505573['attrs'][0x0]['value']:undefined)||_0xc786('0x64')},{'name':_0xc786('0x65'),'value':_0x505573[_0xc786('0x65')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x1]?_0x505573['attrs'][0x1]['value']:undefined)||_0xc786('0x66')},{'name':_0xc786('0x67'),'value':_0x505573[_0xc786('0x67')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x2]?_0x505573[_0xc786('0x5e')][0x2][_0xc786('0x5f')]:undefined)||0xc}];case _0xc786('0x68'):return[{'name':_0xc786('0x69'),'value':_0x505573[_0xc786('0x69')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x0]?_0x505573[_0xc786('0x5e')][0x0][_0xc786('0x5f')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x505573['attrVoiceQueues']||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x1]?_0x505573[_0xc786('0x5e')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x505573[_0xc786('0x67')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x2]?_0x505573[_0xc786('0x5e')][0x2][_0xc786('0x5f')]:undefined)||0x14},{'name':_0xc786('0x6a'),'value':_0x505573['attrChannel']||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x3]?_0x505573[_0xc786('0x5e')][0x3]['value']:undefined)||'voice'},{'name':_0xc786('0x6b'),'value':_0x505573['attrEmailAccounts']||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x4]?_0x505573['attrs'][0x4][_0xc786('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x505573[_0xc786('0x6c')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x5]?_0x505573[_0xc786('0x5e')][0x5][_0xc786('0x5f')]:undefined)||''},{'name':_0xc786('0x6d'),'value':_0x505573[_0xc786('0x6d')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x6]?_0x505573[_0xc786('0x5e')][0x6]['value']:undefined)||''},{'name':_0xc786('0x6e'),'value':_0x505573[_0xc786('0x6e')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x7]?_0x505573[_0xc786('0x5e')][0x7][_0xc786('0x5f')]:undefined)||''},{'name':_0xc786('0x6f'),'value':_0x505573[_0xc786('0x6f')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x8]?_0x505573['attrs'][0x8]['value']:undefined)||''},{'name':_0xc786('0x70'),'value':_0x505573[_0xc786('0x70')]||(_0x505573[_0xc786('0x5e')]&&_0x505573['attrs'][0x9]?_0x505573['attrs'][0x9][_0xc786('0x5f')]:undefined)||''}];case _0xc786('0x71'):case'pie-chart':return[{'name':_0xc786('0x72'),'value':_0x505573['attrSerie1']||(_0x505573[_0xc786('0x5e')]&&_0x505573['attrs'][0x0]?_0x505573['attrs'][0x0][_0xc786('0x5f')]:undefined)||_0xc786('0x73')},{'name':_0xc786('0x74'),'value':_0x505573[_0xc786('0x74')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x1]?_0x505573[_0xc786('0x5e')][0x1]['value']:undefined)||null},{'name':_0xc786('0x75'),'value':_0x505573[_0xc786('0x75')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x2]?_0x505573[_0xc786('0x5e')][0x2][_0xc786('0x5f')]:undefined)||null},{'name':_0xc786('0x76'),'value':_0x505573[_0xc786('0x76')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x3]?_0x505573[_0xc786('0x5e')][0x3][_0xc786('0x5f')]:undefined)||[]},{'name':_0xc786('0x6a'),'value':_0x505573[_0xc786('0x6a')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x4]?_0x505573[_0xc786('0x5e')][0x4][_0xc786('0x5f')]:undefined)||_0xc786('0x77')},{'name':_0xc786('0x6b'),'value':_0x505573[_0xc786('0x6b')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x5]?_0x505573[_0xc786('0x5e')][0x5][_0xc786('0x5f')]:undefined)||''},{'name':_0xc786('0x6c'),'value':_0x505573[_0xc786('0x6c')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x6]?_0x505573['attrs'][0x6][_0xc786('0x5f')]:undefined)||''},{'name':_0xc786('0x6d'),'value':_0x505573[_0xc786('0x6d')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x7]?_0x505573['attrs'][0x7][_0xc786('0x5f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x505573[_0xc786('0x6e')]||(_0x505573[_0xc786('0x5e')]&&_0x505573[_0xc786('0x5e')][0x8]?_0x505573['attrs'][0x8]['value']:undefined)||''},{'name':_0xc786('0x6f'),'value':_0x505573[_0xc786('0x6f')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x9]?_0x505573[_0xc786('0x5e')][0x9]['value']:undefined)||''},{'name':_0xc786('0x70'),'value':_0x505573[_0xc786('0x70')]||(_0x505573[_0xc786('0x5e')]&&_0x505573['attrs'][0xa]?_0x505573[_0xc786('0x5e')][0xa]['value']:undefined)||''}];case _0xc786('0x78'):return[{'name':_0xc786('0x79'),'type':_0x505573[_0xc786('0x7a')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x0]?_0x505573[_0xc786('0x5e')][0x0][_0xc786('0x38')]:undefined)||null,'value':_0x505573[_0xc786('0x79')]||(_0x505573[_0xc786('0x5e')]&&_0x505573['attrs'][0x0]?_0x505573[_0xc786('0x5e')][0x0][_0xc786('0x5f')]:undefined)||null},{'name':_0xc786('0x7b'),'value':_0x505573[_0xc786('0x7b')]||(_0x505573['attrs']&&_0x505573[_0xc786('0x5e')][0x1]?_0x505573[_0xc786('0x5e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4408a9){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x4408a9));return[];}}exports['addItem']=function(_0x45c7da,_0x35d7d4,_0x273ea3){if(_0x45c7da[_0xc786('0x50')]['id']){delete _0x45c7da['body']['id'];}return db[_0xc786('0x35')][_0xc786('0x56')]({'where':{'id':_0x45c7da[_0xc786('0x4d')]['id']}})[_0xc786('0x2a')](handleEntityNotFound(_0x35d7d4,null))[_0xc786('0x2a')](function(_0x391a98){if(_0x391a98){_0x45c7da[_0xc786('0x50')]['DashboardId']=_0x391a98['id'];_0x45c7da[_0xc786('0x50')][_0xc786('0x5e')]=widgetAttributes(_0x45c7da[_0xc786('0x50')]);return db[_0xc786('0x7c')][_0xc786('0x4f')](_0x45c7da[_0xc786('0x50')]);}})[_0xc786('0x2a')](respondWithResult(_0x35d7d4,null))[_0xc786('0x4b')](handleError(_0x35d7d4,null));};exports[_0xc786('0x7d')]=function(_0x34f946,_0x10bddd,_0x335fc9){var _0x296012={};var _0x35742c={};var _0x27f709;var _0x4be181;return db['Dashboard'][_0xc786('0x7e')]({'where':{'id':_0x34f946[_0xc786('0x4d')]['id']}})[_0xc786('0x2a')](handleEntityNotFound(_0x10bddd,null))[_0xc786('0x2a')](function(_0x2b5b66){if(_0x2b5b66){_0x27f709=_0x2b5b66;_0x35742c[_0xc786('0x3e')]=_[_0xc786('0x3b')](db[_0xc786('0x7c')][_0xc786('0x36')]);_0x35742c['query']=_[_0xc786('0x3b')](_0x34f946[_0xc786('0x3a')]);_0x35742c['filters']=_[_0xc786('0x3d')](_0x35742c[_0xc786('0x3e')],_0x35742c[_0xc786('0x3a')]);_0x296012[_0xc786('0x3f')]=_['intersection'](_0x35742c[_0xc786('0x3e')],qs['fields'](_0x34f946[_0xc786('0x3a')][_0xc786('0x4e')]));_0x296012[_0xc786('0x3f')]=_0x296012['attributes']['length']?_0x296012['attributes']:_0x35742c['model'];_0x296012[_0xc786('0x42')]=qs[_0xc786('0x7f')](_0x34f946['query'][_0xc786('0x7f')]);_0x296012[_0xc786('0x43')]=qs[_0xc786('0x3c')](_[_0xc786('0x80')](_0x34f946['query'],_0x35742c[_0xc786('0x3c')]));if(_0x34f946[_0xc786('0x3a')][_0xc786('0x46')]){_0x296012[_0xc786('0x43')]=_[_0xc786('0x44')](_0x296012[_0xc786('0x43')],{'$or':_[_0xc786('0x34')](_0x296012[_0xc786('0x3f')],function(_0x56db10){var _0x1ada8b={};_0x1ada8b[_0x56db10]={'$like':'%'+_0x34f946[_0xc786('0x3a')][_0xc786('0x46')]+'%'};return _0x1ada8b;})});}_0x296012=_[_0xc786('0x44')]({},_0x296012,_0x34f946[_0xc786('0x47')]);return _0x27f709[_0xc786('0x7d')](_0x296012);}})['then'](function(_0x528154){if(_0x528154){_0x4be181=_0x528154[_0xc786('0x55')];if(!_0x34f946['query'][_0xc786('0x40')](_0xc786('0x41'))){_0x296012['limit']=qs['limit'](_0x34f946[_0xc786('0x3a')][_0xc786('0x21')]);_0x296012['offset']=qs[_0xc786('0x23')](_0x34f946[_0xc786('0x3a')][_0xc786('0x23')]);}return _0x27f709[_0xc786('0x7d')](_0x296012);}})[_0xc786('0x2a')](function(_0x1f61a0){if(_0x1f61a0){return _0x1f61a0?{'count':_0x4be181,'rows':_0x1f61a0}:null;}})[_0xc786('0x2a')](respondWithResult(_0x10bddd,null))[_0xc786('0x4b')](handleError(_0x10bddd,null));};
\ No newline at end of file