Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / dashboard / dashboard.controller.js
index a16b27f..16e6189 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd627=['attributes','intersection','model','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','findAll','catch','show','fields','length','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','params','omit','updatedAt','CustomDashboards','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrReport','attrRefresh','addItem','DashboardId','DashboardItem','getItems','findOne','pick','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','map','Dashboard','rawAttributes','type','key','query','keys'];(function(_0x48ab61,_0x325199){var _0x426d57=function(_0x1b37ed){while(--_0x1b37ed){_0x48ab61['push'](_0x48ab61['shift']());}};_0x426d57(++_0x325199);}(_0xd627,0x14b));var _0x7d62=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0xd627[_0x13f980];return _0x27153c;};'use strict';var emlformat=require(_0x7d62('0x0'));var rimraf=require(_0x7d62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d62('0x2'));var rp=require(_0x7d62('0x3'));var moment=require(_0x7d62('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d62('0x5'));var path=require(_0x7d62('0x6'));var sox=require(_0x7d62('0x7'));var csv=require(_0x7d62('0x8'));var ejs=require(_0x7d62('0x9'));var fs=require('fs');var fs_extra=require(_0x7d62('0xa'));var _=require('lodash');var squel=require(_0x7d62('0xb'));var crypto=require(_0x7d62('0xc'));var jsforce=require(_0x7d62('0xd'));var deskjs=require(_0x7d62('0xe'));var toCsv=require(_0x7d62('0x8'));var querystring=require(_0x7d62('0xf'));var Papa=require(_0x7d62('0x10'));var Redis=require(_0x7d62('0x11'));var authService=require(_0x7d62('0x12'));var qs=require(_0x7d62('0x13'));var as=require(_0x7d62('0x14'));var hardwareService=require(_0x7d62('0x15'));var logger=require(_0x7d62('0x16'))(_0x7d62('0x17'));var utils=require('../../config/utils');var config=require(_0x7d62('0x18'));var licenseUtil=require(_0x7d62('0x19'));var db=require(_0x7d62('0x1a'))['db'];config['redis']=_[_0x7d62('0x1b')](config[_0x7d62('0x1c')],{'host':_0x7d62('0x1d'),'port':0x18eb});var socket=require(_0x7d62('0x1e'))(new Redis(config[_0x7d62('0x1c')]));require('./dashboard.socket')[_0x7d62('0x1f')](socket);function respondWithStatusCode(_0x35b58a,_0xffe7bb){_0xffe7bb=_0xffe7bb||0xcc;return function(_0x5aed39){if(_0x5aed39){return _0x35b58a['sendStatus'](_0xffe7bb);}return _0x35b58a[_0x7d62('0x20')](_0xffe7bb)['end']();};}function respondWithResult(_0x11ce0a,_0x18b2b7){_0x18b2b7=_0x18b2b7||0xc8;return function(_0x5c1e27){if(_0x5c1e27){return _0x11ce0a[_0x7d62('0x20')](_0x18b2b7)[_0x7d62('0x21')](_0x5c1e27);}};}function respondWithFilteredResult(_0x5d367d,_0x532ec1){return function(_0x52f85d){if(_0x52f85d){var _0x2ce794=typeof _0x532ec1[_0x7d62('0x22')]==='undefined'&&typeof _0x532ec1['limit']===_0x7d62('0x23');var _0xb3f679=_0x52f85d[_0x7d62('0x24')];var _0x3b367b=_0x2ce794?0x0:_0x532ec1[_0x7d62('0x22')];var _0x2c97fa=_0x2ce794?_0x52f85d[_0x7d62('0x24')]:_0x532ec1[_0x7d62('0x22')]+_0x532ec1[_0x7d62('0x25')];var _0x2c6d5b;if(_0x2c97fa>=_0xb3f679){_0x2c97fa=_0xb3f679;_0x2c6d5b=0xc8;}else{_0x2c6d5b=0xce;}_0x5d367d[_0x7d62('0x20')](_0x2c6d5b);return _0x5d367d['set'](_0x7d62('0x26'),_0x3b367b+'-'+_0x2c97fa+'/'+_0xb3f679)[_0x7d62('0x21')](_0x52f85d);}return null;};}function patchUpdates(_0x5b255f){return function(_0x1ae4f8){try{jsonpatch['apply'](_0x1ae4f8,_0x5b255f,!![]);}catch(_0x63face){return BPromise[_0x7d62('0x27')](_0x63face);}return _0x1ae4f8[_0x7d62('0x28')]();};}function saveUpdates(_0x23b4b3,_0x4de006){return function(_0xbd457d){if(_0xbd457d){return _0xbd457d[_0x7d62('0x29')](_0x23b4b3)[_0x7d62('0x2a')](function(_0x2f6f40){return _0x2f6f40;});}return null;};}function removeEntity(_0x4ec330,_0x118f41){return function(_0x3e325d){if(_0x3e325d){return _0x3e325d[_0x7d62('0x2b')]()[_0x7d62('0x2a')](function(){var _0x4c6638=_0x3e325d[_0x7d62('0x2c')]({'plain':!![]});var _0x5cff74='CustomDashboards';return db[_0x7d62('0x2d')][_0x7d62('0x2b')]({'where':{'type':_0x5cff74,'resourceId':_0x4c6638['id']}})[_0x7d62('0x2a')](function(){return _0x3e325d;});})[_0x7d62('0x2a')](function(){_0x4ec330[_0x7d62('0x20')](0xcc)[_0x7d62('0x2e')]();});}};}function handleEntityNotFound(_0x10c5cb,_0x290c0c){return function(_0x45f68d){if(!_0x45f68d){_0x10c5cb[_0x7d62('0x2f')](0x194);}return _0x45f68d;};}function handleError(_0x1e937a,_0xd3d4ab){_0xd3d4ab=_0xd3d4ab||0x1f4;return function(_0x3be151){logger[_0x7d62('0x30')](_0x3be151[_0x7d62('0x31')]);if(_0x3be151[_0x7d62('0x32')]){delete _0x3be151[_0x7d62('0x32')];}_0x1e937a[_0x7d62('0x20')](_0xd3d4ab)[_0x7d62('0x33')](_0x3be151);};}exports['index']=function(_0x42709c,_0x2ddbfa){var _0x5274c8={},_0x21b54e={},_0x189f1f={'count':0x0,'rows':[]};var _0x1adcd7=_[_0x7d62('0x34')](db[_0x7d62('0x35')][_0x7d62('0x36')],function(_0x3e35cc){return{'name':_0x3e35cc['fieldName'],'type':_0x3e35cc[_0x7d62('0x37')][_0x7d62('0x38')]};});_0x21b54e['model']=_[_0x7d62('0x34')](_0x1adcd7,_0x7d62('0x32'));_0x21b54e[_0x7d62('0x39')]=_[_0x7d62('0x3a')](_0x42709c[_0x7d62('0x39')]);_0x21b54e['filters']=_['intersection'](_0x21b54e['model'],_0x21b54e['query']);_0x5274c8[_0x7d62('0x3b')]=_[_0x7d62('0x3c')](_0x21b54e[_0x7d62('0x3d')],qs['fields'](_0x42709c['query']['fields']));_0x5274c8[_0x7d62('0x3b')]=_0x5274c8['attributes']['length']?_0x5274c8[_0x7d62('0x3b')]:_0x21b54e['model'];if(!_0x42709c['query'][_0x7d62('0x3e')]('nolimit')){_0x5274c8['limit']=qs['limit'](_0x42709c[_0x7d62('0x39')][_0x7d62('0x25')]);_0x5274c8[_0x7d62('0x22')]=qs[_0x7d62('0x22')](_0x42709c[_0x7d62('0x39')][_0x7d62('0x22')]);}_0x5274c8[_0x7d62('0x3f')]=qs[_0x7d62('0x40')](_0x42709c['query']['sort']);_0x5274c8[_0x7d62('0x41')]=qs[_0x7d62('0x42')](_['pick'](_0x42709c['query'],_0x21b54e['filters']),_0x1adcd7);if(_0x42709c['query']['filter']){_0x5274c8[_0x7d62('0x41')]=_[_0x7d62('0x43')](_0x5274c8['where'],{'$or':_['map'](_0x1adcd7,function(_0x482d8d){if(_0x482d8d[_0x7d62('0x37')]!==_0x7d62('0x44')){var _0x5bfdfe={};_0x5bfdfe[_0x482d8d[_0x7d62('0x32')]]={'$like':'%'+_0x42709c[_0x7d62('0x39')][_0x7d62('0x45')]+'%'};return _0x5bfdfe;}})});}_0x5274c8=_[_0x7d62('0x43')]({},_0x5274c8,_0x42709c['options']);var _0x26f9a9={'where':_0x5274c8['where']};return db['Dashboard']['count'](_0x26f9a9)[_0x7d62('0x2a')](function(_0x410d4d){_0x189f1f[_0x7d62('0x24')]=_0x410d4d;if(_0x42709c[_0x7d62('0x39')][_0x7d62('0x46')]){_0x5274c8['include']=[{'all':!![]}];}return db[_0x7d62('0x35')][_0x7d62('0x47')](_0x5274c8);})['then'](function(_0x5c9a8b){_0x189f1f['rows']=_0x5c9a8b;return _0x189f1f;})[_0x7d62('0x2a')](respondWithFilteredResult(_0x2ddbfa,_0x5274c8))[_0x7d62('0x48')](handleError(_0x2ddbfa,null));};exports[_0x7d62('0x49')]=function(_0x2a598a,_0x36d402){var _0x3ff20d={'raw':![],'where':{'id':_0x2a598a['params']['id']}},_0x2393c5={};_0x2393c5[_0x7d62('0x3d')]=_[_0x7d62('0x3a')](db[_0x7d62('0x35')][_0x7d62('0x36')]);_0x2393c5[_0x7d62('0x39')]=_[_0x7d62('0x3a')](_0x2a598a[_0x7d62('0x39')]);_0x2393c5[_0x7d62('0x42')]=_[_0x7d62('0x3c')](_0x2393c5['model'],_0x2393c5[_0x7d62('0x39')]);_0x3ff20d['attributes']=_[_0x7d62('0x3c')](_0x2393c5[_0x7d62('0x3d')],qs[_0x7d62('0x4a')](_0x2a598a[_0x7d62('0x39')][_0x7d62('0x4a')]));_0x3ff20d[_0x7d62('0x3b')]=_0x3ff20d['attributes'][_0x7d62('0x4b')]?_0x3ff20d['attributes']:_0x2393c5['model'];if(_0x2a598a[_0x7d62('0x39')]['includeAll']){_0x3ff20d[_0x7d62('0x4c')]=[{'all':!![]}];}_0x3ff20d=_[_0x7d62('0x43')]({},_0x3ff20d,_0x2a598a[_0x7d62('0x4d')]);return db[_0x7d62('0x35')][_0x7d62('0x4e')](_0x3ff20d)['then'](handleEntityNotFound(_0x36d402,null))['then'](respondWithResult(_0x36d402,null))['catch'](handleError(_0x36d402,null));};exports[_0x7d62('0x4f')]=function(_0x48bc7f,_0x2fea58){return db[_0x7d62('0x35')]['create'](_0x48bc7f['body'],{})[_0x7d62('0x2a')](function(_0x5b8d58){var _0x5b9a6e=_0x48bc7f[_0x7d62('0x50')]['get']({'plain':!![]});if(!_0x5b9a6e)throw new Error(_0x7d62('0x51'));if(_0x5b9a6e[_0x7d62('0x52')]===_0x7d62('0x50')){var _0x45cd01=_0x5b8d58[_0x7d62('0x2c')]({'plain':!![]});var _0x35c089='CustomDashboards';return db[_0x7d62('0x53')][_0x7d62('0x4e')]({'where':{'name':_0x35c089,'userProfileId':_0x5b9a6e[_0x7d62('0x54')]},'raw':!![]})[_0x7d62('0x2a')](function(_0x142fe8){if(_0x142fe8&&_0x142fe8[_0x7d62('0x55')]===0x0){return db['UserProfileResource'][_0x7d62('0x4f')]({'name':_0x45cd01[_0x7d62('0x32')],'resourceId':_0x45cd01['id'],'type':_0x142fe8['name'],'sectionId':_0x142fe8['id']},{})[_0x7d62('0x2a')](function(){return _0x5b8d58;});}else{return _0x5b8d58;}})[_0x7d62('0x48')](function(_0x4e8e3e){logger[_0x7d62('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e8e3e);throw _0x4e8e3e;});}return _0x5b8d58;})[_0x7d62('0x2a')](respondWithResult(_0x2fea58,0xc9))[_0x7d62('0x48')](handleError(_0x2fea58,null));};exports[_0x7d62('0x56')]=function(_0x293fd8,_0x4fb8f0){var _0x26747a={'where':{'id':_0x293fd8[_0x7d62('0x57')]['id']}},_0x3d4f27={};_0x3d4f27['model']=_[_0x7d62('0x3a')](db['Dashboard'][_0x7d62('0x36')]);_0x26747a[_0x7d62('0x3b')]=_[_0x7d62('0x3c')](_0x3d4f27[_0x7d62('0x3d')],qs[_0x7d62('0x4a')](_0x293fd8[_0x7d62('0x39')][_0x7d62('0x4a')]));_0x26747a[_0x7d62('0x3b')]=_0x26747a[_0x7d62('0x3b')][_0x7d62('0x4b')]?_0x26747a[_0x7d62('0x3b')]:_0x3d4f27[_0x7d62('0x3d')];if(_0x293fd8[_0x7d62('0x39')][_0x7d62('0x46')]){_0x26747a[_0x7d62('0x4c')]=[{'all':!![]}];}_0x26747a=_[_0x7d62('0x43')]({},_0x26747a,_0x293fd8['options']);return db[_0x7d62('0x35')][_0x7d62('0x4e')](_0x26747a)[_0x7d62('0x2a')](handleEntityNotFound(_0x4fb8f0,null))[_0x7d62('0x2a')](function(_0xe5d8ea){if(_0xe5d8ea){var _0x3c0ea8=_0xe5d8ea[_0x7d62('0x2c')]({'plain':!![]});_0x3c0ea8=qs[_0x7d62('0x58')](_0x3c0ea8,['id','createdAt','updatedAt']);_0x293fd8['body']=_[_0x7d62('0x58')](_0x293fd8['body'],['id','createdAt',_0x7d62('0x59')]);return db[_0x7d62('0x35')][_0x7d62('0x4f')](_[_0x7d62('0x43')](_0x3c0ea8,_0x293fd8['body']),{'include':_0x293fd8[_0x7d62('0x39')]['includeAll']?[{'all':!![]}]:undefined})[_0x7d62('0x2a')](function(_0x2bd325){var _0x3d0b4a=_0x293fd8[_0x7d62('0x50')][_0x7d62('0x2c')]({'plain':!![]});if(!_0x3d0b4a)throw new Error(_0x7d62('0x51'));if(_0x3d0b4a[_0x7d62('0x52')]===_0x7d62('0x50')){var _0x3fb397=_0x2bd325[_0x7d62('0x2c')]({'plain':!![]});var _0x158583=_0x7d62('0x5a');return db['UserProfileSection']['find']({'where':{'name':_0x158583,'userProfileId':_0x3d0b4a[_0x7d62('0x54')]},'raw':!![]})[_0x7d62('0x2a')](function(_0x37a53c){if(_0x37a53c&&_0x37a53c['autoAssociation']===0x0){return db[_0x7d62('0x2d')]['create']({'name':_0x3fb397[_0x7d62('0x32')],'resourceId':_0x3fb397['id'],'type':_0x37a53c[_0x7d62('0x32')],'sectionId':_0x37a53c['id']},{})[_0x7d62('0x2a')](function(){return _0x2bd325;});}else{return _0x2bd325;}})[_0x7d62('0x48')](function(_0x1ace41){logger[_0x7d62('0x30')](_0x7d62('0x5b'),_0x1ace41);throw _0x1ace41;});}return _0x2bd325;});}})[_0x7d62('0x2a')](respondWithResult(_0x4fb8f0,0xc9))['catch'](handleError(_0x4fb8f0,null));};exports[_0x7d62('0x29')]=function(_0x5f318d,_0x4f7546){if(_0x5f318d[_0x7d62('0x5c')]['id']){delete _0x5f318d[_0x7d62('0x5c')]['id'];}return db[_0x7d62('0x35')]['find']({'where':{'id':_0x5f318d[_0x7d62('0x57')]['id']}})[_0x7d62('0x2a')](handleEntityNotFound(_0x4f7546,null))[_0x7d62('0x2a')](saveUpdates(_0x5f318d['body'],null))[_0x7d62('0x2a')](respondWithResult(_0x4f7546,null))['catch'](handleError(_0x4f7546,null));};exports[_0x7d62('0x2b')]=function(_0x55fba9,_0x5d1aee){return db['Dashboard'][_0x7d62('0x4e')]({'where':{'id':_0x55fba9[_0x7d62('0x57')]['id']}})[_0x7d62('0x2a')](handleEntityNotFound(_0x5d1aee,null))[_0x7d62('0x2a')](removeEntity(_0x5d1aee,null))['catch'](handleError(_0x5d1aee,null));};function widgetAttributes(_0x5331f1){try{switch(_0x5331f1[_0x7d62('0x37')]){case _0x7d62('0x5d'):return[{'name':_0x7d62('0x5e'),'value':_0x5331f1['attrUrl']||(_0x5331f1['attrs']&&_0x5331f1[_0x7d62('0x5f')][0x0]?_0x5331f1[_0x7d62('0x5f')][0x0][_0x7d62('0x60')]:undefined)||_0x7d62('0x61')}];case'custom':return[{'name':_0x7d62('0x62'),'value':_0x5331f1[_0x7d62('0x62')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x0]?_0x5331f1[_0x7d62('0x5f')][0x0][_0x7d62('0x60')]:undefined)||''}];case'clock':return[{'name':_0x7d62('0x63'),'value':_0x5331f1[_0x7d62('0x63')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x0]?_0x5331f1[_0x7d62('0x5f')][0x0][_0x7d62('0x60')]:undefined)||_0x7d62('0x64')},{'name':'attrTimezone','value':_0x5331f1[_0x7d62('0x65')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x1]?_0x5331f1[_0x7d62('0x5f')][0x1][_0x7d62('0x60')]:undefined)||_0x7d62('0x66')},{'name':_0x7d62('0x67'),'value':_0x5331f1[_0x7d62('0x67')]||(_0x5331f1['attrs']&&_0x5331f1[_0x7d62('0x5f')][0x2]?_0x5331f1[_0x7d62('0x5f')][0x2]['value']:undefined)||0xc}];case _0x7d62('0x68'):return[{'name':_0x7d62('0x69'),'value':_0x5331f1[_0x7d62('0x69')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x0]?_0x5331f1[_0x7d62('0x5f')][0x0][_0x7d62('0x60')]:undefined)||_0x7d62('0x6a')},{'name':_0x7d62('0x6b'),'value':_0x5331f1[_0x7d62('0x6b')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x1]?_0x5331f1['attrs'][0x1]['value']:undefined)||[]},{'name':_0x7d62('0x67'),'value':_0x5331f1[_0x7d62('0x67')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x2]?_0x5331f1[_0x7d62('0x5f')][0x2][_0x7d62('0x60')]:undefined)||0x14},{'name':'attrChannel','value':_0x5331f1[_0x7d62('0x6c')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x3]?_0x5331f1[_0x7d62('0x5f')][0x3]['value']:undefined)||'voice'},{'name':_0x7d62('0x6d'),'value':_0x5331f1[_0x7d62('0x6d')]||(_0x5331f1['attrs']&&_0x5331f1['attrs'][0x4]?_0x5331f1[_0x7d62('0x5f')][0x4]['value']:undefined)||''},{'name':_0x7d62('0x6e'),'value':_0x5331f1[_0x7d62('0x6e')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x5]?_0x5331f1['attrs'][0x5][_0x7d62('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5331f1[_0x7d62('0x6f')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x6]?_0x5331f1[_0x7d62('0x5f')][0x6]['value']:undefined)||''},{'name':_0x7d62('0x70'),'value':_0x5331f1[_0x7d62('0x70')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x7]?_0x5331f1[_0x7d62('0x5f')][0x7][_0x7d62('0x60')]:undefined)||''},{'name':_0x7d62('0x71'),'value':_0x5331f1[_0x7d62('0x71')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x8]?_0x5331f1[_0x7d62('0x5f')][0x8][_0x7d62('0x60')]:undefined)||''},{'name':_0x7d62('0x72'),'value':_0x5331f1[_0x7d62('0x72')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x9]?_0x5331f1[_0x7d62('0x5f')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x5331f1[_0x7d62('0x73')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1['attrs'][0x0]?_0x5331f1[_0x7d62('0x5f')][0x0][_0x7d62('0x60')]:undefined)||_0x7d62('0x6a')},{'name':_0x7d62('0x74'),'value':_0x5331f1[_0x7d62('0x74')]||(_0x5331f1['attrs']&&_0x5331f1[_0x7d62('0x5f')][0x1]?_0x5331f1['attrs'][0x1][_0x7d62('0x60')]:undefined)||null},{'name':_0x7d62('0x75'),'value':_0x5331f1['attrSerie3']||(_0x5331f1['attrs']&&_0x5331f1[_0x7d62('0x5f')][0x2]?_0x5331f1[_0x7d62('0x5f')][0x2][_0x7d62('0x60')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5331f1[_0x7d62('0x6b')]||(_0x5331f1['attrs']&&_0x5331f1['attrs'][0x3]?_0x5331f1[_0x7d62('0x5f')][0x3][_0x7d62('0x60')]:undefined)||[]},{'name':_0x7d62('0x6c'),'value':_0x5331f1['attrChannel']||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x4]?_0x5331f1[_0x7d62('0x5f')][0x4]['value']:undefined)||_0x7d62('0x76')},{'name':_0x7d62('0x6d'),'value':_0x5331f1[_0x7d62('0x6d')]||(_0x5331f1['attrs']&&_0x5331f1[_0x7d62('0x5f')][0x5]?_0x5331f1['attrs'][0x5][_0x7d62('0x60')]:undefined)||''},{'name':_0x7d62('0x6e'),'value':_0x5331f1['attrFaxAccounts']||(_0x5331f1['attrs']&&_0x5331f1[_0x7d62('0x5f')][0x6]?_0x5331f1[_0x7d62('0x5f')][0x6][_0x7d62('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5331f1[_0x7d62('0x6f')]||(_0x5331f1['attrs']&&_0x5331f1[_0x7d62('0x5f')][0x7]?_0x5331f1[_0x7d62('0x5f')][0x7][_0x7d62('0x60')]:undefined)||''},{'name':_0x7d62('0x70'),'value':_0x5331f1[_0x7d62('0x70')]||(_0x5331f1['attrs']&&_0x5331f1['attrs'][0x8]?_0x5331f1[_0x7d62('0x5f')][0x8][_0x7d62('0x60')]:undefined)||''},{'name':_0x7d62('0x71'),'value':_0x5331f1[_0x7d62('0x71')]||(_0x5331f1['attrs']&&_0x5331f1[_0x7d62('0x5f')][0x9]?_0x5331f1[_0x7d62('0x5f')][0x9][_0x7d62('0x60')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5331f1[_0x7d62('0x72')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0xa]?_0x5331f1[_0x7d62('0x5f')][0xa][_0x7d62('0x60')]:undefined)||''}];case _0x7d62('0x77'):return[{'name':'attrReport','type':_0x5331f1[_0x7d62('0x78')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x0]?_0x5331f1['attrs'][0x0]['type']:undefined)||null,'value':_0x5331f1[_0x7d62('0x79')]||(_0x5331f1[_0x7d62('0x5f')]&&_0x5331f1[_0x7d62('0x5f')][0x0]?_0x5331f1[_0x7d62('0x5f')][0x0][_0x7d62('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0x5331f1[_0x7d62('0x7a')]||(_0x5331f1['attrs']&&_0x5331f1[_0x7d62('0x5f')][0x1]?_0x5331f1[_0x7d62('0x5f')][0x1][_0x7d62('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x41ff4e){logger[_0x7d62('0x30')]('widgetAttributes:\x20%s',JSON['stringify'](_0x41ff4e));return[];}}exports[_0x7d62('0x7b')]=function(_0x5a64be,_0x2ee5e7,_0x4f0834){if(_0x5a64be[_0x7d62('0x5c')]['id']){delete _0x5a64be['body']['id'];}return db['Dashboard'][_0x7d62('0x4e')]({'where':{'id':_0x5a64be['params']['id']}})[_0x7d62('0x2a')](handleEntityNotFound(_0x2ee5e7,null))['then'](function(_0x2bca31){if(_0x2bca31){_0x5a64be[_0x7d62('0x5c')][_0x7d62('0x7c')]=_0x2bca31['id'];_0x5a64be[_0x7d62('0x5c')]['attrs']=widgetAttributes(_0x5a64be[_0x7d62('0x5c')]);return db[_0x7d62('0x7d')][_0x7d62('0x4f')](_0x5a64be[_0x7d62('0x5c')]);}})[_0x7d62('0x2a')](respondWithResult(_0x2ee5e7,null))['catch'](handleError(_0x2ee5e7,null));};exports[_0x7d62('0x7e')]=function(_0xe80730,_0x427100,_0x3ed597){var _0x21655b={};var _0xf469ad={};var _0x4c67fb;var _0x162aec;return db[_0x7d62('0x35')][_0x7d62('0x7f')]({'where':{'id':_0xe80730[_0x7d62('0x57')]['id']}})['then'](handleEntityNotFound(_0x427100,null))[_0x7d62('0x2a')](function(_0x2e9a83){if(_0x2e9a83){_0x4c67fb=_0x2e9a83;_0xf469ad[_0x7d62('0x3d')]=_[_0x7d62('0x3a')](db[_0x7d62('0x7d')][_0x7d62('0x36')]);_0xf469ad[_0x7d62('0x39')]=_['keys'](_0xe80730[_0x7d62('0x39')]);_0xf469ad['filters']=_[_0x7d62('0x3c')](_0xf469ad[_0x7d62('0x3d')],_0xf469ad[_0x7d62('0x39')]);_0x21655b[_0x7d62('0x3b')]=_[_0x7d62('0x3c')](_0xf469ad['model'],qs[_0x7d62('0x4a')](_0xe80730[_0x7d62('0x39')]['fields']));_0x21655b[_0x7d62('0x3b')]=_0x21655b[_0x7d62('0x3b')][_0x7d62('0x4b')]?_0x21655b[_0x7d62('0x3b')]:_0xf469ad[_0x7d62('0x3d')];_0x21655b[_0x7d62('0x3f')]=qs['sort'](_0xe80730[_0x7d62('0x39')][_0x7d62('0x40')]);_0x21655b['where']=qs[_0x7d62('0x42')](_[_0x7d62('0x80')](_0xe80730[_0x7d62('0x39')],_0xf469ad[_0x7d62('0x42')]));if(_0xe80730['query'][_0x7d62('0x45')]){_0x21655b[_0x7d62('0x41')]=_[_0x7d62('0x43')](_0x21655b[_0x7d62('0x41')],{'$or':_[_0x7d62('0x34')](_0x21655b['attributes'],function(_0xa70ad7){var _0x57a194={};_0x57a194[_0xa70ad7]={'$like':'%'+_0xe80730[_0x7d62('0x39')][_0x7d62('0x45')]+'%'};return _0x57a194;})});}_0x21655b=_[_0x7d62('0x43')]({},_0x21655b,_0xe80730[_0x7d62('0x4d')]);return _0x4c67fb['getItems'](_0x21655b);}})[_0x7d62('0x2a')](function(_0x51c85b){if(_0x51c85b){_0x162aec=_0x51c85b['length'];if(!_0xe80730[_0x7d62('0x39')][_0x7d62('0x3e')](_0x7d62('0x81'))){_0x21655b['limit']=qs[_0x7d62('0x25')](_0xe80730[_0x7d62('0x39')][_0x7d62('0x25')]);_0x21655b[_0x7d62('0x22')]=qs[_0x7d62('0x22')](_0xe80730[_0x7d62('0x39')]['offset']);}return _0x4c67fb[_0x7d62('0x7e')](_0x21655b);}})[_0x7d62('0x2a')](function(_0x29b429){if(_0x29b429){return _0x29b429?{'count':_0x162aec,'rows':_0x29b429}:null;}})[_0x7d62('0x2a')](respondWithResult(_0x427100,null))[_0x7d62('0x48')](handleError(_0x427100,null));};
\ No newline at end of file
+var _0x31de=['DashboardItem','getItems','findOne','nolimit','rimraf','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','get','destroy','error','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','catch','show','params','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','UserProfileResource','clone','omit','createdAt','updatedAt','body','CustomDashboards','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','reportType','attrRefresh','stringify','addItem','DashboardId'];(function(_0x5597aa,_0x2edbea){var _0x35a3ab=function(_0x4c0cbb){while(--_0x4c0cbb){_0x5597aa['push'](_0x5597aa['shift']());}};_0x35a3ab(++_0x2edbea);}(_0x31de,0x106));var _0xe31d=function(_0x317070,_0x3bdb0b){_0x317070=_0x317070-0x0;var _0x24f306=_0x31de[_0x317070];return _0x24f306;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe31d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe31d('0x1'));var moment=require(_0xe31d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe31d('0x3'));var util=require(_0xe31d('0x4'));var path=require(_0xe31d('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe31d('0x6'));var fs=require('fs');var fs_extra=require(_0xe31d('0x7'));var _=require(_0xe31d('0x8'));var squel=require(_0xe31d('0x9'));var crypto=require('crypto');var jsforce=require(_0xe31d('0xa'));var deskjs=require(_0xe31d('0xb'));var toCsv=require(_0xe31d('0xc'));var querystring=require(_0xe31d('0xd'));var Papa=require(_0xe31d('0xe'));var Redis=require(_0xe31d('0xf'));var authService=require(_0xe31d('0x10'));var qs=require(_0xe31d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe31d('0x12'));var logger=require(_0xe31d('0x13'))(_0xe31d('0x14'));var utils=require(_0xe31d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe31d('0x16'));var db=require(_0xe31d('0x17'))['db'];config[_0xe31d('0x18')]=_[_0xe31d('0x19')](config[_0xe31d('0x18')],{'host':_0xe31d('0x1a'),'port':0x18eb});var socket=require(_0xe31d('0x1b'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0xfe4847,_0x34f73e){_0x34f73e=_0x34f73e||0xcc;return function(_0x4de555){if(_0x4de555){return _0xfe4847[_0xe31d('0x1c')](_0x34f73e);}return _0xfe4847[_0xe31d('0x1d')](_0x34f73e)[_0xe31d('0x1e')]();};}function respondWithResult(_0x5275b8,_0xeeab8c){_0xeeab8c=_0xeeab8c||0xc8;return function(_0x287b22){if(_0x287b22){return _0x5275b8[_0xe31d('0x1d')](_0xeeab8c)[_0xe31d('0x1f')](_0x287b22);}};}function respondWithFilteredResult(_0x5b0fb6,_0x435b64){return function(_0x3343ee){if(_0x3343ee){var _0x50656a=typeof _0x435b64[_0xe31d('0x20')]===_0xe31d('0x21')&&typeof _0x435b64['limit']===_0xe31d('0x21');var _0x42c6ae=_0x3343ee[_0xe31d('0x22')];var _0x4b596a=_0x50656a?0x0:_0x435b64['offset'];var _0x4bd1ed=_0x50656a?_0x3343ee[_0xe31d('0x22')]:_0x435b64[_0xe31d('0x20')]+_0x435b64[_0xe31d('0x23')];var _0x168d75;if(_0x4bd1ed>=_0x42c6ae){_0x4bd1ed=_0x42c6ae;_0x168d75=0xc8;}else{_0x168d75=0xce;}_0x5b0fb6[_0xe31d('0x1d')](_0x168d75);return _0x5b0fb6[_0xe31d('0x24')](_0xe31d('0x25'),_0x4b596a+'-'+_0x4bd1ed+'/'+_0x42c6ae)[_0xe31d('0x1f')](_0x3343ee);}return null;};}function patchUpdates(_0x461e41){return function(_0x3aa281){try{jsonpatch[_0xe31d('0x26')](_0x3aa281,_0x461e41,!![]);}catch(_0x41b3c6){return BPromise['reject'](_0x41b3c6);}return _0x3aa281['save']();};}function saveUpdates(_0x558a67,_0x5b4428){return function(_0x2c2287){if(_0x2c2287){return _0x2c2287[_0xe31d('0x27')](_0x558a67)[_0xe31d('0x28')](function(_0x5ec27d){return _0x5ec27d;});}return null;};}function removeEntity(_0x14f03c,_0x5d9b83){return function(_0x420af2){if(_0x420af2){return _0x420af2['destroy']()[_0xe31d('0x28')](function(){var _0x373998=_0x420af2[_0xe31d('0x29')]({'plain':!![]});var _0x374b3b='CustomDashboards';return db['UserProfileResource'][_0xe31d('0x2a')]({'where':{'type':_0x374b3b,'resourceId':_0x373998['id']}})[_0xe31d('0x28')](function(){return _0x420af2;});})[_0xe31d('0x28')](function(){_0x14f03c['status'](0xcc)[_0xe31d('0x1e')]();});}};}function handleEntityNotFound(_0x14211e,_0x583f23){return function(_0x554e34){if(!_0x554e34){_0x14211e[_0xe31d('0x1c')](0x194);}return _0x554e34;};}function handleError(_0x9294e9,_0x3d5754){_0x3d5754=_0x3d5754||0x1f4;return function(_0x16ddca){logger[_0xe31d('0x2b')](_0x16ddca[_0xe31d('0x2c')]);if(_0x16ddca[_0xe31d('0x2d')]){delete _0x16ddca[_0xe31d('0x2d')];}_0x9294e9[_0xe31d('0x1d')](_0x3d5754)['send'](_0x16ddca);};}exports['index']=function(_0x4e6153,_0xc5b186){var _0x1b6971={},_0x505994={},_0x2c9334={'count':0x0,'rows':[]};var _0x58afa4=_[_0xe31d('0x2e')](db[_0xe31d('0x2f')][_0xe31d('0x30')],function(_0x3101ec){return{'name':_0x3101ec[_0xe31d('0x31')],'type':_0x3101ec[_0xe31d('0x32')][_0xe31d('0x33')]};});_0x505994[_0xe31d('0x34')]=_[_0xe31d('0x2e')](_0x58afa4,_0xe31d('0x2d'));_0x505994['query']=_[_0xe31d('0x35')](_0x4e6153[_0xe31d('0x36')]);_0x505994['filters']=_[_0xe31d('0x37')](_0x505994[_0xe31d('0x34')],_0x505994[_0xe31d('0x36')]);_0x1b6971[_0xe31d('0x38')]=_[_0xe31d('0x37')](_0x505994[_0xe31d('0x34')],qs['fields'](_0x4e6153['query'][_0xe31d('0x39')]));_0x1b6971[_0xe31d('0x38')]=_0x1b6971[_0xe31d('0x38')][_0xe31d('0x3a')]?_0x1b6971['attributes']:_0x505994[_0xe31d('0x34')];if(!_0x4e6153[_0xe31d('0x36')][_0xe31d('0x3b')]('nolimit')){_0x1b6971[_0xe31d('0x23')]=qs[_0xe31d('0x23')](_0x4e6153['query'][_0xe31d('0x23')]);_0x1b6971[_0xe31d('0x20')]=qs[_0xe31d('0x20')](_0x4e6153[_0xe31d('0x36')][_0xe31d('0x20')]);}_0x1b6971[_0xe31d('0x3c')]=qs['sort'](_0x4e6153[_0xe31d('0x36')][_0xe31d('0x3d')]);_0x1b6971[_0xe31d('0x3e')]=qs[_0xe31d('0x3f')](_[_0xe31d('0x40')](_0x4e6153[_0xe31d('0x36')],_0x505994[_0xe31d('0x3f')]),_0x58afa4);if(_0x4e6153['query']['filter']){_0x1b6971[_0xe31d('0x3e')]=_[_0xe31d('0x41')](_0x1b6971[_0xe31d('0x3e')],{'$or':_[_0xe31d('0x2e')](_0x58afa4,function(_0x2d26f4){if(_0x2d26f4[_0xe31d('0x32')]!==_0xe31d('0x42')){var _0x9cb95={};_0x9cb95[_0x2d26f4['name']]={'$like':'%'+_0x4e6153[_0xe31d('0x36')][_0xe31d('0x43')]+'%'};return _0x9cb95;}})});}_0x1b6971=_[_0xe31d('0x41')]({},_0x1b6971,_0x4e6153[_0xe31d('0x44')]);var _0x4a2196={'where':_0x1b6971[_0xe31d('0x3e')]};return db[_0xe31d('0x2f')][_0xe31d('0x22')](_0x4a2196)[_0xe31d('0x28')](function(_0x364b24){_0x2c9334['count']=_0x364b24;if(_0x4e6153[_0xe31d('0x36')]['includeAll']){_0x1b6971['include']=[{'all':!![]}];}return db['Dashboard'][_0xe31d('0x45')](_0x1b6971);})[_0xe31d('0x28')](function(_0x59c7dc){_0x2c9334['rows']=_0x59c7dc;return _0x2c9334;})['then'](respondWithFilteredResult(_0xc5b186,_0x1b6971))[_0xe31d('0x46')](handleError(_0xc5b186,null));};exports[_0xe31d('0x47')]=function(_0x41c7be,_0x563de4){var _0x40720d={'raw':![],'where':{'id':_0x41c7be[_0xe31d('0x48')]['id']}},_0x47fd88={};_0x47fd88[_0xe31d('0x34')]=_[_0xe31d('0x35')](db[_0xe31d('0x2f')][_0xe31d('0x30')]);_0x47fd88[_0xe31d('0x36')]=_['keys'](_0x41c7be[_0xe31d('0x36')]);_0x47fd88['filters']=_['intersection'](_0x47fd88[_0xe31d('0x34')],_0x47fd88[_0xe31d('0x36')]);_0x40720d[_0xe31d('0x38')]=_[_0xe31d('0x37')](_0x47fd88[_0xe31d('0x34')],qs[_0xe31d('0x39')](_0x41c7be['query']['fields']));_0x40720d[_0xe31d('0x38')]=_0x40720d['attributes']['length']?_0x40720d[_0xe31d('0x38')]:_0x47fd88[_0xe31d('0x34')];if(_0x41c7be[_0xe31d('0x36')][_0xe31d('0x49')]){_0x40720d[_0xe31d('0x4a')]=[{'all':!![]}];}_0x40720d=_[_0xe31d('0x41')]({},_0x40720d,_0x41c7be[_0xe31d('0x44')]);return db['Dashboard'][_0xe31d('0x4b')](_0x40720d)[_0xe31d('0x28')](handleEntityNotFound(_0x563de4,null))[_0xe31d('0x28')](respondWithResult(_0x563de4,null))['catch'](handleError(_0x563de4,null));};exports[_0xe31d('0x4c')]=function(_0x569829,_0x111eb7){return db[_0xe31d('0x2f')][_0xe31d('0x4c')](_0x569829['body'],{})[_0xe31d('0x28')](function(_0xb2ec8){var _0x2ded86=_0x569829['user']['get']({'plain':!![]});if(!_0x2ded86)throw new Error(_0xe31d('0x4d'));if(_0x2ded86['role']===_0xe31d('0x4e')){var _0x3a4a33=_0xb2ec8[_0xe31d('0x29')]({'plain':!![]});var _0x229605='CustomDashboards';return db[_0xe31d('0x4f')]['find']({'where':{'name':_0x229605,'userProfileId':_0x2ded86[_0xe31d('0x50')]},'raw':!![]})[_0xe31d('0x28')](function(_0x4aebfa){if(_0x4aebfa&&_0x4aebfa['autoAssociation']===0x0){return db[_0xe31d('0x51')][_0xe31d('0x4c')]({'name':_0x3a4a33['name'],'resourceId':_0x3a4a33['id'],'type':_0x4aebfa[_0xe31d('0x2d')],'sectionId':_0x4aebfa['id']},{})[_0xe31d('0x28')](function(){return _0xb2ec8;});}else{return _0xb2ec8;}})[_0xe31d('0x46')](function(_0xb68a88){logger[_0xe31d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb68a88);throw _0xb68a88;});}return _0xb2ec8;})[_0xe31d('0x28')](respondWithResult(_0x111eb7,0xc9))[_0xe31d('0x46')](handleError(_0x111eb7,null));};exports[_0xe31d('0x52')]=function(_0x385fd3,_0x512bc5){var _0x2b2fbe={'where':{'id':_0x385fd3[_0xe31d('0x48')]['id']}},_0x561880={};_0x561880[_0xe31d('0x34')]=_[_0xe31d('0x35')](db[_0xe31d('0x2f')][_0xe31d('0x30')]);_0x2b2fbe['attributes']=_[_0xe31d('0x37')](_0x561880[_0xe31d('0x34')],qs[_0xe31d('0x39')](_0x385fd3['query'][_0xe31d('0x39')]));_0x2b2fbe[_0xe31d('0x38')]=_0x2b2fbe['attributes']['length']?_0x2b2fbe[_0xe31d('0x38')]:_0x561880[_0xe31d('0x34')];if(_0x385fd3[_0xe31d('0x36')][_0xe31d('0x49')]){_0x2b2fbe[_0xe31d('0x4a')]=[{'all':!![]}];}_0x2b2fbe=_[_0xe31d('0x41')]({},_0x2b2fbe,_0x385fd3[_0xe31d('0x44')]);return db[_0xe31d('0x2f')]['find'](_0x2b2fbe)[_0xe31d('0x28')](handleEntityNotFound(_0x512bc5,null))[_0xe31d('0x28')](function(_0x50c60c){if(_0x50c60c){var _0x5e6e61=_0x50c60c[_0xe31d('0x29')]({'plain':!![]});_0x5e6e61=qs[_0xe31d('0x53')](_0x5e6e61,['id',_0xe31d('0x54'),_0xe31d('0x55')]);_0x385fd3['body']=_[_0xe31d('0x53')](_0x385fd3[_0xe31d('0x56')],['id',_0xe31d('0x54'),_0xe31d('0x55')]);return db[_0xe31d('0x2f')][_0xe31d('0x4c')](_['merge'](_0x5e6e61,_0x385fd3['body']),{'include':_0x385fd3[_0xe31d('0x36')][_0xe31d('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x29cb67){var _0x5ab628=_0x385fd3[_0xe31d('0x4e')][_0xe31d('0x29')]({'plain':!![]});if(!_0x5ab628)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ab628['role']==='user'){var _0x184cb2=_0x29cb67[_0xe31d('0x29')]({'plain':!![]});var _0x276a9b=_0xe31d('0x57');return db[_0xe31d('0x4f')][_0xe31d('0x4b')]({'where':{'name':_0x276a9b,'userProfileId':_0x5ab628[_0xe31d('0x50')]},'raw':!![]})['then'](function(_0x3e4ea1){if(_0x3e4ea1&&_0x3e4ea1[_0xe31d('0x58')]===0x0){return db[_0xe31d('0x51')][_0xe31d('0x4c')]({'name':_0x184cb2[_0xe31d('0x2d')],'resourceId':_0x184cb2['id'],'type':_0x3e4ea1[_0xe31d('0x2d')],'sectionId':_0x3e4ea1['id']},{})[_0xe31d('0x28')](function(){return _0x29cb67;});}else{return _0x29cb67;}})[_0xe31d('0x46')](function(_0x97beda){logger[_0xe31d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x97beda);throw _0x97beda;});}return _0x29cb67;});}})['then'](respondWithResult(_0x512bc5,0xc9))[_0xe31d('0x46')](handleError(_0x512bc5,null));};exports['update']=function(_0x250c43,_0x378366){if(_0x250c43['body']['id']){delete _0x250c43['body']['id'];}return db[_0xe31d('0x2f')]['find']({'where':{'id':_0x250c43[_0xe31d('0x48')]['id']}})[_0xe31d('0x28')](handleEntityNotFound(_0x378366,null))[_0xe31d('0x28')](saveUpdates(_0x250c43[_0xe31d('0x56')],null))[_0xe31d('0x28')](respondWithResult(_0x378366,null))[_0xe31d('0x46')](handleError(_0x378366,null));};exports['destroy']=function(_0x47f1d5,_0x1653a7){return db['Dashboard'][_0xe31d('0x4b')]({'where':{'id':_0x47f1d5['params']['id']}})[_0xe31d('0x28')](handleEntityNotFound(_0x1653a7,null))[_0xe31d('0x28')](removeEntity(_0x1653a7,null))[_0xe31d('0x46')](handleError(_0x1653a7,null));};function widgetAttributes(_0x3c44a2){try{switch(_0x3c44a2[_0xe31d('0x32')]){case _0xe31d('0x59'):return[{'name':_0xe31d('0x5a'),'value':_0x3c44a2[_0xe31d('0x5a')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x0]?_0x3c44a2[_0xe31d('0x5b')][0x0][_0xe31d('0x5c')]:undefined)||_0xe31d('0x5d')}];case _0xe31d('0x5e'):return[{'name':'attrPath','value':_0x3c44a2[_0xe31d('0x5f')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2['attrs'][0x0]['value']:undefined)||''}];case _0xe31d('0x60'):return[{'name':_0xe31d('0x61'),'value':_0x3c44a2[_0xe31d('0x61')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2['attrs'][0x0][_0xe31d('0x5c')]:undefined)||_0xe31d('0x62')},{'name':_0xe31d('0x63'),'value':_0x3c44a2[_0xe31d('0x63')]||(_0x3c44a2['attrs']&&_0x3c44a2['attrs'][0x1]?_0x3c44a2[_0xe31d('0x5b')][0x1][_0xe31d('0x5c')]:undefined)||_0xe31d('0x64')},{'name':'attrFontSize','value':_0x3c44a2[_0xe31d('0x65')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x2]?_0x3c44a2[_0xe31d('0x5b')][0x2][_0xe31d('0x5c')]:undefined)||0xc}];case _0xe31d('0x66'):return[{'name':_0xe31d('0x67'),'value':_0x3c44a2[_0xe31d('0x67')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2[_0xe31d('0x5b')][0x0][_0xe31d('0x5c')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x3c44a2[_0xe31d('0x68')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x1]?_0x3c44a2[_0xe31d('0x5b')][0x1][_0xe31d('0x5c')]:undefined)||[]},{'name':_0xe31d('0x65'),'value':_0x3c44a2[_0xe31d('0x65')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x2]?_0x3c44a2['attrs'][0x2][_0xe31d('0x5c')]:undefined)||0x14},{'name':_0xe31d('0x69'),'value':_0x3c44a2[_0xe31d('0x69')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x3]?_0x3c44a2['attrs'][0x3][_0xe31d('0x5c')]:undefined)||_0xe31d('0x6a')},{'name':_0xe31d('0x6b'),'value':_0x3c44a2[_0xe31d('0x6b')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x4]?_0x3c44a2[_0xe31d('0x5b')][0x4][_0xe31d('0x5c')]:undefined)||''},{'name':_0xe31d('0x6c'),'value':_0x3c44a2[_0xe31d('0x6c')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x5]?_0x3c44a2['attrs'][0x5]['value']:undefined)||''},{'name':_0xe31d('0x6d'),'value':_0x3c44a2[_0xe31d('0x6d')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x6]?_0x3c44a2[_0xe31d('0x5b')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c44a2['attrOpenchannelAccounts']||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x7]?_0x3c44a2[_0xe31d('0x5b')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3c44a2[_0xe31d('0x6e')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x8]?_0x3c44a2[_0xe31d('0x5b')][0x8][_0xe31d('0x5c')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3c44a2[_0xe31d('0x6f')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x9]?_0x3c44a2[_0xe31d('0x5b')][0x9][_0xe31d('0x5c')]:undefined)||''}];case _0xe31d('0x70'):case _0xe31d('0x71'):return[{'name':_0xe31d('0x72'),'value':_0x3c44a2[_0xe31d('0x72')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2[_0xe31d('0x5b')][0x0][_0xe31d('0x5c')]:undefined)||_0xe31d('0x73')},{'name':_0xe31d('0x74'),'value':_0x3c44a2['attrSerie2']||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x1]?_0x3c44a2[_0xe31d('0x5b')][0x1][_0xe31d('0x5c')]:undefined)||null},{'name':_0xe31d('0x75'),'value':_0x3c44a2[_0xe31d('0x75')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x2]?_0x3c44a2[_0xe31d('0x5b')][0x2][_0xe31d('0x5c')]:undefined)||null},{'name':_0xe31d('0x68'),'value':_0x3c44a2[_0xe31d('0x68')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x3]?_0x3c44a2[_0xe31d('0x5b')][0x3][_0xe31d('0x5c')]:undefined)||[]},{'name':_0xe31d('0x69'),'value':_0x3c44a2[_0xe31d('0x69')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x4]?_0x3c44a2[_0xe31d('0x5b')][0x4][_0xe31d('0x5c')]:undefined)||_0xe31d('0x6a')},{'name':_0xe31d('0x6b'),'value':_0x3c44a2['attrEmailAccounts']||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x5]?_0x3c44a2['attrs'][0x5][_0xe31d('0x5c')]:undefined)||''},{'name':_0xe31d('0x6c'),'value':_0x3c44a2[_0xe31d('0x6c')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x6]?_0x3c44a2['attrs'][0x6][_0xe31d('0x5c')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3c44a2[_0xe31d('0x6d')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x7]?_0x3c44a2[_0xe31d('0x5b')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3c44a2[_0xe31d('0x76')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x8]?_0x3c44a2[_0xe31d('0x5b')][0x8][_0xe31d('0x5c')]:undefined)||''},{'name':_0xe31d('0x6e'),'value':_0x3c44a2[_0xe31d('0x6e')]||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x9]?_0x3c44a2[_0xe31d('0x5b')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3c44a2[_0xe31d('0x6f')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0xa]?_0x3c44a2[_0xe31d('0x5b')][0xa][_0xe31d('0x5c')]:undefined)||''}];case _0xe31d('0x77'):return[{'name':'attrReport','type':_0x3c44a2[_0xe31d('0x78')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2['attrs'][0x0]?_0x3c44a2['attrs'][0x0][_0xe31d('0x32')]:undefined)||null,'value':_0x3c44a2['attrReport']||(_0x3c44a2['attrs']&&_0x3c44a2[_0xe31d('0x5b')][0x0]?_0x3c44a2['attrs'][0x0]['value']:undefined)||null},{'name':_0xe31d('0x79'),'value':_0x3c44a2[_0xe31d('0x79')]||(_0x3c44a2[_0xe31d('0x5b')]&&_0x3c44a2[_0xe31d('0x5b')][0x1]?_0x3c44a2[_0xe31d('0x5b')][0x1][_0xe31d('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x5a3959){logger[_0xe31d('0x2b')]('widgetAttributes:\x20%s',JSON[_0xe31d('0x7a')](_0x5a3959));return[];}}exports[_0xe31d('0x7b')]=function(_0x2f262b,_0x1d87b0,_0x176f45){if(_0x2f262b['body']['id']){delete _0x2f262b[_0xe31d('0x56')]['id'];}return db[_0xe31d('0x2f')][_0xe31d('0x4b')]({'where':{'id':_0x2f262b[_0xe31d('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d87b0,null))[_0xe31d('0x28')](function(_0x780d5c){if(_0x780d5c){_0x2f262b['body'][_0xe31d('0x7c')]=_0x780d5c['id'];_0x2f262b[_0xe31d('0x56')]['attrs']=widgetAttributes(_0x2f262b[_0xe31d('0x56')]);return db[_0xe31d('0x7d')]['create'](_0x2f262b[_0xe31d('0x56')]);}})[_0xe31d('0x28')](respondWithResult(_0x1d87b0,null))[_0xe31d('0x46')](handleError(_0x1d87b0,null));};exports[_0xe31d('0x7e')]=function(_0x50545b,_0x339042,_0x2ffd86){var _0x5495b9={};var _0x4f1f01={};var _0x2d7df0;var _0x53f1b0;return db[_0xe31d('0x2f')][_0xe31d('0x7f')]({'where':{'id':_0x50545b['params']['id']}})[_0xe31d('0x28')](handleEntityNotFound(_0x339042,null))[_0xe31d('0x28')](function(_0xcc26c9){if(_0xcc26c9){_0x2d7df0=_0xcc26c9;_0x4f1f01[_0xe31d('0x34')]=_[_0xe31d('0x35')](db['DashboardItem']['rawAttributes']);_0x4f1f01[_0xe31d('0x36')]=_[_0xe31d('0x35')](_0x50545b[_0xe31d('0x36')]);_0x4f1f01[_0xe31d('0x3f')]=_[_0xe31d('0x37')](_0x4f1f01['model'],_0x4f1f01[_0xe31d('0x36')]);_0x5495b9[_0xe31d('0x38')]=_[_0xe31d('0x37')](_0x4f1f01[_0xe31d('0x34')],qs[_0xe31d('0x39')](_0x50545b[_0xe31d('0x36')][_0xe31d('0x39')]));_0x5495b9['attributes']=_0x5495b9['attributes'][_0xe31d('0x3a')]?_0x5495b9[_0xe31d('0x38')]:_0x4f1f01[_0xe31d('0x34')];_0x5495b9['order']=qs['sort'](_0x50545b[_0xe31d('0x36')][_0xe31d('0x3d')]);_0x5495b9[_0xe31d('0x3e')]=qs[_0xe31d('0x3f')](_[_0xe31d('0x40')](_0x50545b[_0xe31d('0x36')],_0x4f1f01['filters']));if(_0x50545b['query']['filter']){_0x5495b9[_0xe31d('0x3e')]=_['merge'](_0x5495b9[_0xe31d('0x3e')],{'$or':_['map'](_0x5495b9[_0xe31d('0x38')],function(_0x2dd69f){var _0x466e3b={};_0x466e3b[_0x2dd69f]={'$like':'%'+_0x50545b[_0xe31d('0x36')][_0xe31d('0x43')]+'%'};return _0x466e3b;})});}_0x5495b9=_[_0xe31d('0x41')]({},_0x5495b9,_0x50545b[_0xe31d('0x44')]);return _0x2d7df0[_0xe31d('0x7e')](_0x5495b9);}})['then'](function(_0x10472a){if(_0x10472a){_0x53f1b0=_0x10472a['length'];if(!_0x50545b[_0xe31d('0x36')][_0xe31d('0x3b')](_0xe31d('0x80'))){_0x5495b9[_0xe31d('0x23')]=qs[_0xe31d('0x23')](_0x50545b[_0xe31d('0x36')][_0xe31d('0x23')]);_0x5495b9[_0xe31d('0x20')]=qs['offset'](_0x50545b[_0xe31d('0x36')]['offset']);}return _0x2d7df0[_0xe31d('0x7e')](_0x5495b9);}})['then'](function(_0x4fdd1a){if(_0x4fdd1a){return _0x4fdd1a?{'count':_0x53f1b0,'rows':_0x4fdd1a}:null;}})[_0xe31d('0x28')](respondWithResult(_0x339042,null))[_0xe31d('0x46')](handleError(_0x339042,null));};
\ No newline at end of file