Built motion from commit b983a9c.|0.0.141
authorDaniele Cinti <daniele.cinti@xcally.com>
Mon, 12 Sep 2016 09:38:54 +0000 (11:38 +0200)
committerDaniele Cinti <daniele.cinti@xcally.com>
Mon, 12 Sep 2016 09:38:54 +0000 (11:38 +0200)
public/app/b742896d.app.js [moved from public/app/9815d674.app.js with 94% similarity]
public/index.html

similarity index 94%
rename from public/app/9815d674.app.js
rename to public/app/b742896d.app.js
index 6577205..cf51052 100644 (file)
@@ -13,12 +13,12 @@ return k.get().$promise.then(function(b){a.voiceMohs=b.rows,e.syncUpdates("voice
 g.get({controller:"waiting",controller2:"calls"}).$promise.then(function(b){a.gridOptions.data=b.rows})["catch"](function(a){f.error(a)})["finally"](function(){p(),j.stop("spinner-grid")})}function p(){e.socket.on("report_queue:save",function(b){a.gridOptions.data.unshift(b)}),e.socket.on("report_queue:update",function(b){var c=_.find(a.gridOptions.data,{id:b.id});if(c){var d={queuecallerabandon:b.queuecallerabandon,queuecallerleave:b.queuecallerleave};delete b.queuecallerabandon,delete b.queuecallerleave,_.merge(c,b),d.queuecallerabandon&&(c.queuecallerabandon=d.queuecallerabandon),d.queuecallerleave&&(c.queuecallerleave=d.queuecallerleave),(c.queuecallerabandon||c.queuecallercomplete)&&m(function(){_.remove(a.gridOptions.data,{id:b.id})},3e3)}})}a.moment=moment,a.initQueues=function(){a.gridOptions={headerCellFilter:"translate",paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,columnDefs:[{name:"queue",displayName:"APPLICATION_QUEUE",headerCellFilter:"translate"},{name:"status",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span data-ng-if="!row.entity.queuecallerleaveAt">{{\'APPLICATION_QUEUESTATUS_WAITING\' | translate}}</span><span data-ng-if="row.entity.queuecallerleaveAt && !row.entity.queuecallerabandon && !row.entity.queuecallercomplete">{{\'APPLICATION_ACTIVE\' | translate}}</span><span data-ng-if="row.entity.queuecallerleaveAt && row.entity.queuecallerabandon">{{\'APPLICATION_QUEUESTATUS_ABANDON\' | translate}}</span><span data-ng-if="row.entity.queuecallerleaveAt && row.entity.queuecallercomplete">{{\'APPLICATION_QUEUESTATUS_COMPLETE\' | translate}}</span><span data-ng-if="!row.entity.queuecallercomplete && !row.entity.queuecallerabandon"> [<timer start-time="grid.appScope.moment(row.entity.updatedAt).unix()*1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>]</div>',enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"caller",displayName:"APPLICATION_CALLER",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.calleridnum || ''}} {{row.entity.calleridname || ''}}</div>",enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"position",displayName:"APPLICATION_POSITION",headerCellFilter:"translate"},{name:"agent",displayName:"APPLICATION_AGENT",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.connectedlinenum || ''}} {{row.entity.connectedlinename || ''}}</div>",enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1}],data:[],gridMenuTitleFilter:function(a){var b=k.defer();return b.resolve(d.instant(a)),b.promise},onRegisterApi:function(b){a.gridApi=b,a.gridApi.grid.registerDataChangeCallback(function(){q(a.gridOptions.data.length)})}},o()};var q=function(a){var b=a?30*a+60:270;angular.element(document.getElementsByClassName("ui-grid")[0]).css("height",b+"px"),angular.element(document.getElementsByClassName("ui-grid-viewport")).css("height",30*a+"px")};a.$on("$destroy",function(){e.unsyncUpdates("report_queue")})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.realtime.view.queuecalls",{url:"/queuecalls",templateUrl:"app/channels/voice/realtime/view/queuecalls/queuecalls.html",controller:"VoiceRealtimeViewQueueCallsCtrl"})}]),angular.module("xCallyShuttleApp").controller("VoiceRealtimeViewTelephoneCtrl",["$scope","$log","$uibModal","$translate","socket","xAlert","Telephone","Pause","Action","usSpinnerService","$q","uiGridConstants",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(){return j.spin("spinner-grid"),g.get(o).$promise.then(function(b){a.gridOptions.totalItems=b.count,a.gridOptions.data=b.rows})["catch"](function(a){f.error(a)})["finally"](function(){j.stop("spinner-grid")})}function n(){e.socket.on("telephone:save",function(b){var c=_.find(a.gridOptions.data,{id:b.id});c&&(c.status=b.status,c.statusAt=b.statusAt,c.ipaddr=b.ipaddr,c.port=b.port,c.fullcontact=b.fullcontact,c.useragent=b.useragent,c.lastms=b.lastms,c.internal=b.internal)}),e.socket.on("telephone:remove",function(b){_.remove(a.gridOptions.data,{id:b.id})})}var o={offset:0,limit:10};a.moment=moment,a.initTelephones=function(){a.gridOptions={enableGridMenu:!0,headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,showGridFooter:!0,paginationPageSizes:[10,25,50,75],paginationPageSize:10,useExternalPagination:!0,useExternalSorting:!0,useExternalFiltering:!0,multiSelect:!0,showTreeExpandNoChildren:!0,columnDefs:[{name:"name",displayName:"APPLICATION_TELEPHONE",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.name}} &lt;{{row.entity.internal}}&gt;</div>"},{name:"status",displayName:"APPLICATION_PHONE_STATUS",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{'APPLICATION_'+row.entity.status | translate}} <span data-ng-if=\"row.entity.statusAt && (row.entity.status === 'BUSY' || row.entity.status === 'ONHOLD' || row.entity.status === 'INUSE')\">(<timer start-time=\"grid.appScope.moment(row.entity.statusAt).unix()*1000\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>)</span></span></div>",filter:{type:l.filter.SELECT,selectOptions:[{value:"UNKNOWN",label:d.instant("APPLICATION_UNKNOWN")},{value:"NOT_INUSE",label:d.instant("APPLICATION_NOT_INUSE")},{value:"INUSE",label:d.instant("APPLICATION_INUSE")},{value:"BUSY",label:d.instant("APPLICATION_BUSY")},{value:"INVALID",label:d.instant("APPLICATION_INVALID")},{value:"UNAVAILABLE",label:d.instant("APPLICATION_UNAVAILABLE")},{value:"RINGING",label:d.instant("APPLICATION_RINGING")},{value:"RINGINUSE",label:d.instant("APPLICATION_RINGINUSE")},{value:"ONHOLD",label:d.instant("APPLICATION_ONHOLD")}]}},{name:"action",displayName:"",width:170,cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><button class="btn btn-xs blue-madison" data-ng-click="grid.appScope.showInfo(row.entity)"><i class="icon-info"></i></button><div>',enableSorting:!1,enableFiltering:!1,enableColumnMenu:!1}],data:[],gridMenuTitleFilter:function(a){var b=k.defer();return b.resolve(d.instant(a)),b.promise},onRegisterApi:function(b){a.gridApi=b,a.gridApi.grid.registerDataChangeCallback(function(){p(a.gridOptions.data.length)}),a.gridApi.core.on.sortChanged(a,function(a,b){0===b.length?o.order=null:o.order=b[0].name+" "+b[0].sort.direction.toUpperCase(),m()}),a.gridApi.pagination.on.paginationChanged(a,function(a,b){o.offset=(a-1)*b,o.limit=b,m()}),a.gridApi.core.on.filterChanged(a,function(){var a=this.grid;a.columns.forEach(function(a){a.filters[0].term?o[a.name]=a.filters[0].term:delete o[a.name]}),m()})}},m(),n()};var p=function(a){var b=a?30*a+130:270;angular.element(document.getElementsByClassName("ui-grid")[0]).css("height",b+"px"),angular.element(document.getElementsByClassName("ui-grid-viewport")).css("height",30*a+"px")};a.$on("$destroy",function(){e.unsyncUpdates("telephone")}),a.showInfo=function(a){c.open({animation:!0,templateUrl:"app/channels/voice/realtime/view/telephone/telephone.modal.info.html",controller:"VoiceRealtimeViewTelephoneInfoModalCtrl",resolve:{telephone:a}})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.realtime.view.telephones",{url:"/telephones",templateUrl:"app/channels/voice/realtime/view/telephone/telephone.html",controller:"VoiceRealtimeViewTelephoneCtrl",data:{permissions:{only:["admin","user"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").controller("VoiceRealtimeViewTelephoneInfoModalCtrl",["$scope","$uibModalInstance","$http","telephone",function(a,b,c,d){a.telephone=d,a.close=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("VoiceRealtimeViewCtrl",["$scope","Auth",function(a,b){a.Auth=b}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.realtime.view",{url:"/view",templateUrl:"app/channels/voice/realtime/view/view.html",controller:"VoiceRealtimeViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("VoiceRecordingListCtrl",["$scope","$translate","$sce","Recording","gridOptions","xAlert","uiGridConstants","Auth",function(a,b,c,d,e,f,g,h){a.Recording=d,a.updateRating=function(a,c){return d.update({id:a,rating:c}).$promise.then(function(){f.show(b.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){f.error(a)})},a.initView=function(){var b={exporterCsvFilename:"recordings.csv",rowHeight:30,primaryKey:"id",columnDefs:[{name:"uniqueid"},{name:"customerPhone",displayName:"APPLICATION_CUSTOMER_PHONE",cellClass:"text-center ui-grid-vcenter"},{name:"membername"},{name:"type",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div><i data-ng-class=\"{'icon-call-in font-green':row.entity.type === 'inbound','icon-call-out font-red':row.entity.type === 'outbound','icon-question':row.entity.type === 'unknown','icon-earphones font-purple':row.entity.type === 'internal'}\"></i></div>",filter:{type:g.filter.SELECT,selectOptions:[{value:"inbound",label:"Inbound"},{value:"internal",label:"Internal"},{value:"outbound",label:"Outbound"},{value:"unknown",label:"Unknown"}]}},{name:"queue"},{name:"createdAt",displayName:"APPLICATION_DATE",headerCellFilter:"translate",filterHeaderTemplate:'<div class="ui-grid-filter-container row"><div ng-repeat="colFilter in col.filters" class="col-md-6 col-md-offset-0 col-sm-5 col-sm-offset-0 col-xs-5 col-xs-offset-0"><div custom-grid-date-filter-header></div></div></div>',filters:[{name:"From",condition:g.filter.GREATER_THAN_OR_EQUAL},{name:"To",condition:g.filter.LESS_THAN_OR_EQUAL}],sort:{direction:g.DESC,priority:0}},{name:"rating",filter:{type:g.filter.SELECT,selectOptions:[{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"},{value:4,label:"4"},{value:5,label:"5"}]},cellClass:"ui-grid-vcenter",width:"100",cellTemplate:'<div><uib-rating data-ng-model="row.entity.rating" data-ng-click="grid.appScope.updateRating(row.entity.id, row.entity.rating)" aria-labelledby="default-rating"></uib-rating></div>'},{name:"audio",displayName:"",width:100,enableSorting:!1,enableFiltering:!1,cellClass:"ui-grid-vcenter",cellTemplate:"<div><audio-file-download data-ng-if=\"row.entity.value.split('.').pop() == 'wav'\" params=\"{id:row.entity.id,controller:'stream'}\" resource=\"grid.appScope.Recording\"></audio-file-download><span data-ng-if=\"row.entity.value.split('.').pop() == 'gsm'\" title=\"{{'MESSAGE_GSM_PREVIEW_NOT_SUPPORTED' | translate}}\">{{'MESSAGE_GSM_PREVIEW_NOT_SUPPORTED' | translate}}</span></div>"},{name:"action",width:80,buttons:[{directive:"<motion-file-download params=\"{id:row.entity.id,controller:'stream'}\" resource=\"grid.appScope.Recording\" mimetype=\"'audio/'+row.entity.value.split('.').pop()\" btnclass=\"btn btn-xs blue-hoki\" filename=\"row.entity.uniqueid+'.'+row.entity.value.split('.').pop()\"></motion-file-download>"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.uniqueid, row.entity.id)",hide:!h.isAdmin()}]}]};a.gridOptions=e.gridOptions(d,b,a)}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.recordings.list",{url:"/list",templateUrl:"app/channels/voice/recording/list/list.html",controller:"VoiceRecordingListCtrl"})}]),angular.module("xCallyShuttleApp").factory("Recording",["$resource",function(a){return a("/api/voice/recordings/:id/:controller",{id:"@id"},{update:{method:"PUT"},patch:{method:"PATCH"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.recordings",{url:"/recordings",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes.inbound",{url:"/inbound",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("VoiceRouteInboundListCreateCtrl",["$scope","$uibModalInstance","Route","application","xAlert","$location","$translate",function(a,b,c,d,e,f,g){a.$application=d.application,a.forms={route:void 0},a.item={type:"inbound",appdata:"Inbound Call",context:"from-voip-provider"},a.ok=function(){return a.item.exten=a.$application.checkUnderscore(a.item.exten),c.save(a.item).$promise.then(function(a){b.close(a),f.path("/channels/voice/routes/inbound/view/"+a.id+"/applications")})["catch"](function(a){console.log(a),e.error(a)})},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("VoiceRouteInboundListCtrl",["$scope","$http","socket","$translate","$rootScope","xAlert","Modal","stResource","gridOptions","Route","$uibModal","$location","$log",function(a,b,c,d,e,f,g,h,i,j,k,l,m){a.initView=function(){var b={exporterCsvFilename:"InboundRoutes.csv",columnDefs:[{name:"exten",displayName:"APPLICATION_PHONE_NUMBER"},{name:"description"},{name:"applications",cellClass:"ui-grid-vcenter",cellTemplate:'<div data-ng-if="row.entity.Applications.length"><span data-ng-repeat="app in row.entity.Applications | limitTo:2">{{app.app}}({{app.appdata[0]}}), </span>...</div><div data-ng-if="!row.entity.Applications.length">{{\'MESSAGE_NO_AVAILABLE_APPLICATIONS\' | translate}}</div>',enableSorting:!1,enableFiltering:!1,enableColumnMenu:!1},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/channels/voice/routes/inbound/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.exten, row.entity.id)"}]}]};a.gridOptions=i.gridOptions(j,b,a,{type:"inbound"})},a.create=function(){k.open({animation:!0,templateUrl:"app/channels/voice/route/inbound/list/create.modal.html",controller:"VoiceRouteInboundListCreateCtrl"})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes.inbound.list",{url:"/list",templateUrl:"app/channels/voice/route/inbound/list/list.html",controller:"VoiceRouteInboundListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("VoiceRouteInboundViewCtrl",["$scope","$translate","$stateParams","socket","$location","WizardHandler","Modal","xAlert","application","interval","Route","VoiceQueue","Sound","SquareProject","VoiceContext","Interval","VoiceMail","User","Agent","Telephone","Trunk","Team",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v){function w(b){var c,d;if("always"===b.intType)c=null,d="*,*,*,*";else if("list"===b.intType)d=b.IntervalId?_.find(a.Intervals,{id:b.IntervalId}).name:"*,*,*,*",c=b.IntervalId||null;else if("custom"===b.intType){c=null;var e,f,g,h;e=b.t_from&&b.t_to&&!b.alwaysTime?moment(b.t_from).format("HH:mm")+"-"+moment(b.t_to).format("HH:mm"):"*",b.wd_from&&"always"!==b.wd_from?(f=b.wd_from,b.wd_to&&"always"!==b.wd_to&&(f+="-"+b.wd_to)):f="*",b.md_from&&"always"!==b.md_from?(g=b.md_from,b.md_to&&"always"!==b.md_to&&(g+="-"+b.md_to)):g="*",b.m_from&&"always"!==b.m_from?(h=b.m_from,b.m_to&&"always"!==b.m_to&&(h+="-"+b.m_to)):h="*",d=e+","+f+","+g+","+h}void 0===a.selectedApp?(a.application.interval=d,a.application.IntervalId=c):(a.route.Applications[a.selectedApp].interval=d,a.route.Applications[a.selectedApp].IntervalId=c)}function x(){if(a.interval.intType=a.route.Applications[a.selectedApp].IntervalId?"list":"*,*,*,*"===a.route.Applications[a.selectedApp].interval?"always":"custom",a.interval.IntervalId=a.route.Applications[a.selectedApp].IntervalId,!a.route.Applications[a.selectedApp].IntervalId){var b,c=a.route.Applications[a.selectedApp].interval?a.route.Applications[a.selectedApp].interval.split(","):["*","*","*","*"];c.forEach(function(c,d){switch(d){case 0:"*"!==c?(b=c.split("-"),a.interval.t_from=moment(b[0],"HH:mm"),a.interval.t_to=moment(b[1],"HH:mm"),a.interval.alwaysTime=!1):(a.interval.t_from=moment(new Date),a.interval.t_to=moment(new Date),a.interval.alwaysTime=!0);break;case 1:"*"!==c?(b=c.split("-"),a.interval.wd_from=b[0],a.interval.wd_to=b[1]?b[1]:"always"):(a.interval.wd_from="always",a.interval.wd_to="always");break;case 2:"*"!==c?(b=c.split("-"),a.interval.md_from=b[0],a.interval.md_to=b[1]?b[1]:"always"):(a.interval.md_from="always",a.interval.md_to="always");break;case 3:"*"!==c?(b=c.split("-"),a.interval.m_from=b[0],a.interval.m_to=b[1]?b[1]:"always"):(a.interval.m_from="always",a.interval.m_to="always")}})}}a.alwaysSwitch={isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.$translate=b,a.selectedApp=void 0,a.showGrid=!0,a.$application=i.application,a.$interval=j.interval,a.selectedRows=[],a._=_,a.gridOptions={enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableSorting:!1,rowTemplate:'<div grid="grid" class="ui-grid-draggable-row" draggable="true"><div ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ng-class="{ \'ui-grid-row-header-cell\': col.isRowHeader, \'custom\': true }" ui-grid-cell></div></div>',columnDefs:[{name:"app",headerCellFilter:"translate",displayName:"APPLICATION_APPLICATION",enableColumnMenu:!1},{name:"appType",headerCellFilter:"translate",displayName:"APPLICATION_INFO",cellClass:"ui-grid-vcenter",cellTemplate:"<div>{{'APPLICATION_APPS_'+(row.entity.appType || (grid.appScope._.find(grid.appScope.$application.applications,{value:row.entity.app}) ? row.entity.app : 'custom')).toUpperCase() | translate}}</div>",enableColumnMenu:!1},{name:"appdata",headerCellFilter:"translate",displayName:"APPLICATION_ARGUMENTS",cellClass:"ui-grid-vcenter",cellTemplate:"<div>{{row.entity.appdata.join(',')}}</div>",enableColumnMenu:!1},{name:"interval",headerCellFilter:"translate",displayName:"APPLICATION_TIME_INTERVAL",enableColumnMenu:!1},{name:"action",enableColumnMenu:!1,headerCellFilter:"translate",displayName:"APPLICATION_ACTION",width:125,cellClass:"ui-grid-vcenter",cellTemplate:'<div><a class="btn btn-xs blue-hoki" data-ng-click="grid.appScope.openApplication(grid.appScope.gridOptions.data.indexOf(row.entity))"><i class="icon-settings"></i></a><a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteApp(row.entity.app+\' application\', grid.appScope.gridOptions.data.indexOf(row.entity))"><i class="fa fa-trash"></i></a></div>'}],onRegisterApi:function(b){b.selection.on.rowSelectionChanged(a,function(b){b.isSelected?a.selectedRows.push(b.entity):_.pull(a.selectedRows,b.entity)}),b.selection.on.rowSelectionChangedBatch(a,function(b){b[0].isSelected?a.selectedRows=_.map(b,"entity"):a.selectedRows=[]}),b.draggableRows.on.rowDropped(a,function(b,c){a.updateRoute()}),b.grid.registerDataChangeCallback(function(){y(a.gridOptions.data.length)})}};var y=function(a){var b=a?30*a+120:177;angular.element(document.getElementsByClassName("ui-grid")[0]).css("height",b+"px")};a.initApplication=function(b){b&&(a.selectedApp=void 0),a.forms={settings:void 0,interval:void 0},a.application={},a.interval={intType:"always",t_from:moment(new Date),t_to:moment(new Date),wd_from:"always",wd_to:"always",md_from:"always",md_to:"always",m_from:"always",m_to:"always",alwaysTime:!0},a.main={app:""}},a.$watch("interval",function(a){a&&w(a)},!0),a.updateSetAppdata=function(){a.application.variable&&a.application.value&&"Set"===a.main.app.value?a.application.appdata[0]=a.application.variable+"="+a.application.value:a.application.appdata[0]=null},a.updateSetAppdataSettings=function(){a.application.variable&&a.application.value&&"Set"===a.main.app.value?a.route.Applications[a.selectedApp].appdata[0]=a.application.variable+"="+a.application.value:a.route.Applications[a.selectedApp].appdata[0]=null},a.$watch("main.app",function(b){if(b){var c,d,e={},f={};switch(void 0===a.selectedApp&&(a.application={appType:b.type,app:b.value,interval:a.application.interval||"*,*,*,*",appdata:[]}),b.value){case"Queue":c=l,d=m;break;case"Playback":c=m;break;case"AGI":c=n;break;case"Goto":c=o;break;case"Voicemail":c=q;break;case"Dial":switch(b.type){case"internalDial":c=r,e={controller:"all"};break;case"externalDial":c=u}}if(c)return c.get(e).$promise.then(function(b){a.items=b.rows}).then(function(){return d?d.get(f).$promise:void 0}).then(function(b){b&&(a.items2=b.rows)})["catch"](function(a){h.error(a)})}},!0),a.deselectAndRedirect=function(b){a.selectedApp=void 0,e.path(b)},a.initRingGroup=function(){var b,c,d;return void 0===a.selectedApp?a.usersArray=[]:a.usersArray=_.map(a.route.Applications[a.selectedApp].appdata[0].split("&"),function(a){return a.split("/")[1]}),r.get().$promise.then(function(a){return b=a,s.get().$promise}).then(function(a){return c=a,t.get().$promise}).then(function(e){d=e,ComponentsDropdowns.bindUserByRole(b,c,d,function(b){a.usersArray=_.union(b,a.usersArray),void 0===a.selectedApp?(a.application.appdata[0]=null,a.application.appdata[0]=_.map(a.usersArray,function(a){return"SIP/"+a}).join("&")):(a.route.Applications[a.selectedApp].appdata[0]=null,a.route.Applications[a.selectedApp].appdata[0]=_.map(a.usersArray,function(a){return"SIP/"+a}).join("&"))},function(b){a.usersArray=_.difference(a.usersArray,b),void 0===a.selectedApp?(a.application.appdata[0]=null,a.application.appdata[0]=_.map(a.usersArray,function(a){return"SIP/"+a}).join("&")):(a.route.Applications[a.selectedApp].appdata[0]=null,a.route.Applications[a.selectedApp].appdata[0]=_.map(a.usersArray,function(a){return"SIP/"+a}).join("&"))},a.route.Applications[a.selectedApp]?a.route.Applications[a.selectedApp].appdata:null)})["catch"](function(a){console.error(a)})},a.getIntervals=function(){return p.get().$promise.then(function(b){a.Intervals=b.rows,d.syncUpdates("interval",a.Intervals)})["catch"](function(a){h.error(a)})},a.getRoute=function(){return k.get({id:c.id}).$promise.then(function(b){a.route=b,a.gridOptions.data=b.Applications,y(a.gridOptions.data.length)})["catch"](function(a){e.path("/channels/voice/routes/inbound/list")})},a.getApplication=function(){if(void 0===a.selectedApp)e.path("/channels/voice/routes/inbound/list");else{if(a.showGrid=!0,a.route.Applications[a.selectedApp].appType)a.main.app=_.find(a.$application.applications,{type:a.route.Applications[a.selectedApp].appType});else{var b=_.find(a.$application.applications,{value:a.route.Applications[a.selectedApp].app});if(b)a.main.app=b;else{a.main.app=_.find(a.$application.applications,{type:"custom"});var c=a.route.Applications[a.selectedApp].appdata.join(",");a.route.Applications[a.selectedApp].appdata=[c],a.route.Applications[a.selectedApp].appType="custom"}}if("Set"===a.main.app.value){var d=a.route.Applications[a.selectedApp].appdata[0].split("=");a.application.variable=d[0],a.application.value=d[1]}x()}},a.openApplication=function(b){a.selectedApp=b,a.showGrid=!1,e.path("/channels/voice/routes/inbound/view/"+c.id+"/applications/settings")},a.updateRoute=function(d){return a.route.exten=a.$application.checkUnderscore(a.route.exten),_.forEach(a.route.Applications,function(a){if("custom"!==a.appType)switch(a.app){case"Dial":var b;switch(a.appType){case"externalDial":b=3;break;case"internalDial":b=2;break;default:b=2}a.appdata[b]=a.appdata[b]||"",a.appdata[b]+=(_.includes(a.appdata[b],"x")?"":"x")+(_.includes(a.appdata[b],"X")?"":"X");break;case"Queue":a.appdata[1]=a.appdata[1]||"",a.appdata[1]+=(_.includes(a.appdata[1],"x")?"":"x")+(_.includes(a.appdata[1],"X")?"":"X")}}),k.update({id:a.route.id},a.route).$promise.then(function(f){a.selectedApp=void 0,h.show(b.instant("MESSAGE_WELL_DONE")+"!","success"),d&&e.path("/channels/voice/routes/inbound/view/"+c.id+"/"+d)})["catch"](function(a){console.log(a),h.error(a)})},a.getContexts=function(){return o.get().$promise.then(function(b){a.voiceContexts=b.rows,d.syncUpdates("voice_context",a.voiceContexts)})["catch"](function(a){h.error(a)})},a.deleteApp=g.confirm["delete"](function(b){a.route.Applications.splice(b,1),a.updateRoute()}),a.deleteItems=g.confirm["delete"](function(){_.remove(a.route.Applications,function(b){return _.includes(a.selectedRows,b)}),a.selectedRows=[],a.updateRoute()}),a.addApplication=function(){a.route.Applications.push(a.application),a.updateRoute("applications")},a.goNext=function(){f.wizard().next()},a.previous=function(){f.wizard().previous()},a.formValidation=function(a){return a},a.$on("destroy",function(){d.unsyncUpdates("voice_extension")})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes.inbound.view",{url:"/view/:id",templateUrl:"app/channels/voice/route/inbound/view/view.html",controller:"VoiceRouteInboundViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.channels.voice.routes.inbound.view.settings",{url:"/settings",templateUrl:"app/channels/voice/route/inbound/view/view.settings.html"}).state("main.channels.voice.routes.inbound.view.applications",{url:"/applications",templateUrl:"app/channels/voice/route/inbound/view/view.applications.html"}).state("main.channels.voice.routes.inbound.view.application",{url:"/application",templateUrl:"app/channels/voice/route/view.application.html",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/jquery-multi-select/css/multi-select.css","assets/plugins/jquery-multi-select/js/jquery.multi-select.js","assets/plugins/jquery-quicksearch/jquery.quicksearch.js","assets/scripts/components-dropdowns.js"]})}]}}).state("main.channels.voice.routes.inbound.view.applications.settings",{url:"/settings",templateUrl:"app/channels/voice/route/view.applicationSettings.html",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/jquery-multi-select/css/multi-select.css","assets/plugins/jquery-multi-select/js/jquery.multi-select.js","assets/plugins/jquery-quicksearch/jquery.quicksearch.js","assets/scripts/components-dropdowns.js"]})}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes.internal",{url:"/internal",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("VoiceRouteInternalListCreateCtrl",["$scope","$uibModalInstance","Route","application","$location","$translate","xAlert",function(a,b,c,d,e,f,g){a.$application=d.application,a.forms={route:void 0},a.item={type:"internal",appdata:"Internal Call",context:"from-sip"},a.ok=function(){return a.item.exten=a.$application.checkUnderscore(a.item.exten),c.save(a.item).$promise.then(function(a){b.close(a),e.path("/channels/voice/routes/internal/view/"+a.id+"/applications")})["catch"](function(a){g.error(a)})},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("VoiceRouteInternalListCtrl",["$scope","$http","socket","$translate","$rootScope","xAlert","Modal","stResource","gridOptions","Route","$uibModal","$location","$log",function(a,b,c,d,e,f,g,h,i,j,k,l,m){a.initView=function(){var b={exporterCsvFilename:"InternalRoutes.csv",columnDefs:[{name:"exten",displayName:"APPLICATION_PHONE_NUMBER"},{name:"description"},{name:"applications",cellClass:"ui-grid-vcenter",cellTemplate:'<div data-ng-if="row.entity.Applications.length"><span data-ng-repeat="app in row.entity.Applications | limitTo:2">{{app.app}}({{app.appdata[0]}}),</span>...</div><div data-ng-if="!row.entity.Applications.length">{{\'MESSAGE_NO_AVAILABLE_APPLICATIONS\' | translate}}</div>',enableSorting:!1,enableFiltering:!1,enableColumnMenu:!1},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/channels/voice/routes/internal/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.exten, row.entity.id)"}]}]};a.gridOptions=i.gridOptions(j,b,a,{type:"internal"})},a.create=function(){k.open({animation:!0,templateUrl:"app/channels/voice/route/internal/list/create.modal.html",controller:"VoiceRouteInternalListCreateCtrl"})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes.internal.list",{url:"/list",templateUrl:"app/channels/voice/route/internal/list/list.html",controller:"VoiceRouteInternalListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("VoiceRouteInternalViewCtrl",["$scope","$translate","$stateParams","socket","$location","WizardHandler","Modal","xAlert","application","interval","Route","VoiceQueue","Sound","SquareProject","VoiceContext","Interval","VoiceMail","User","Agent","Telephone","Trunk",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u){function v(b){var c,d;if("always"===b.intType)c=null,d="*,*,*,*";else if("list"===b.intType)d=b.IntervalId?_.find(a.Intervals,{id:b.IntervalId}).name:"*,*,*,*",c=b.IntervalId||null;else if("custom"===b.intType){c=null;var e,f,g,h;e=b.t_from&&b.t_to&&!b.alwaysTime?moment(b.t_from).format("HH:mm")+"-"+moment(b.t_to).format("HH:mm"):"*",b.wd_from&&"always"!==b.wd_from?(f=b.wd_from,b.wd_to&&"always"!==b.wd_to&&(f+="-"+b.wd_to)):f="*",b.md_from&&"always"!==b.md_from?(g=b.md_from,b.md_to&&"always"!==b.md_to&&(g+="-"+b.md_to)):g="*",b.m_from&&"always"!==b.m_from?(h=b.m_from,b.m_to&&"always"!==b.m_to&&(h+="-"+b.m_to)):h="*",d=e+","+f+","+g+","+h}void 0===a.selectedApp?(a.application.interval=d,a.application.IntervalId=c):(a.route.Applications[a.selectedApp].interval=d,a.route.Applications[a.selectedApp].IntervalId=c)}function w(){if(a.interval.intType=a.route.Applications[a.selectedApp].IntervalId?"list":"*,*,*,*"===a.route.Applications[a.selectedApp].interval?"always":"custom",a.interval.IntervalId=a.route.Applications[a.selectedApp].IntervalId,!a.route.Applications[a.selectedApp].IntervalId){var b,c=a.route.Applications[a.selectedApp].interval?a.route.Applications[a.selectedApp].interval.split(","):["*","*","*","*"];c.forEach(function(c,d){switch(d){case 0:"*"!==c?(b=c.split("-"),a.interval.t_from=moment(b[0],"HH:mm"),a.interval.t_to=moment(b[1],"HH:mm"),a.interval.alwaysTime=!1):(a.interval.t_from=moment(new Date),a.interval.t_to=moment(new Date),a.interval.alwaysTime=!0);break;case 1:"*"!==c?(b=c.split("-"),a.interval.wd_from=b[0],a.interval.wd_to=b[1]?b[1]:"always"):(a.interval.wd_from="always",a.interval.wd_to="always");break;case 2:"*"!==c?(b=c.split("-"),a.interval.md_from=b[0],a.interval.md_to=b[1]?b[1]:"always"):(a.interval.md_from="always",a.interval.md_to="always");break;case 3:"*"!==c?(b=c.split("-"),a.interval.m_from=b[0],a.interval.m_to=b[1]?b[1]:"always"):(a.interval.m_from="always",a.interval.m_to="always")}})}}a.alwaysSwitch={isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.$translate=b,a.selectedApp=void 0,a.showGrid=!0,a.$application=i.application,a.$interval=j.interval,a._=_,a.selectedRows=[],a.gridOptions={enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableSorting:!1,rowTemplate:'<div grid="grid" class="ui-grid-draggable-row" draggable="true"><div ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ng-class="{ \'ui-grid-row-header-cell\': col.isRowHeader, \'custom\': true }" ui-grid-cell></div></div>',columnDefs:[{name:"app",headerCellFilter:"translate",displayName:"APPLICATION_APPLICATION",enableColumnMenu:!1},{name:"appType",headerCellFilter:"translate",displayName:"APPLICATION_INFO",
 cellClass:"ui-grid-vcenter",cellTemplate:"<div>{{'APPLICATION_APPS_'+(row.entity.appType || (grid.appScope._.find(grid.appScope.$application.applications,{value:row.entity.app}) ? row.entity.app : 'custom')).toUpperCase() | translate}}</div>",enableColumnMenu:!1},{name:"appdata",headerCellFilter:"translate",displayName:"APPLICATION_ARGUMENTS",cellClass:"ui-grid-vcenter",cellTemplate:"<div>{{row.entity.appdata.join(',')}}</div>",enableColumnMenu:!1},{name:"interval",headerCellFilter:"translate",displayName:"APPLICATION_TIME_INTERVAL",enableColumnMenu:!1},{name:"action",enableColumnMenu:!1,headerCellFilter:"translate",displayName:"APPLICATION_ACTION",width:125,cellClass:"ui-grid-vcenter",cellTemplate:'<div><a class="btn btn-xs blue-hoki" data-ng-click="grid.appScope.openApplication(grid.appScope.gridOptions.data.indexOf(row.entity))"><i class="icon-settings"></i></a><a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteApp(row.entity.app+\' application\', grid.appScope.gridOptions.data.indexOf(row.entity))"><i class="fa fa-trash"></i></a></div>'}],onRegisterApi:function(b){b.selection.on.rowSelectionChanged(a,function(b){b.isSelected?a.selectedRows.push(b.entity):_.pull(a.selectedRows,b.entity)}),b.selection.on.rowSelectionChangedBatch(a,function(b){b[0].isSelected?a.selectedRows=_.map(b,"entity"):a.selectedRows=[]}),b.draggableRows.on.rowDropped(a,function(b,c){a.updateRoute()}),b.grid.registerDataChangeCallback(function(){x(a.gridOptions.data.length)})}},a.deleteItems=g.confirm["delete"](function(){_.remove(a.route.Applications,function(b){return _.includes(a.selectedRows,b)}),a.selectedRows=[],a.updateRoute()}),a.initRingGroup=function(){var b,c,d;return void 0===a.selectedApp?a.usersArray=[]:a.usersArray=_.map(a.route.Applications[a.selectedApp].appdata[0].split("&"),function(a){return a.split("/")[1]}),r.get().$promise.then(function(a){return b=a,s.get().$promise}).then(function(a){return c=a,t.get().$promise}).then(function(e){d=e,ComponentsDropdowns.bindUserByRole(b,c,d,function(b){a.usersArray=_.union(b,a.usersArray),void 0===a.selectedApp?(a.application.appdata[0]=null,a.application.appdata[0]=_.map(a.usersArray,function(a){return"SIP/"+a}).join("&")):(a.route.Applications[a.selectedApp].appdata[0]=null,a.route.Applications[a.selectedApp].appdata[0]=_.map(a.usersArray,function(a){return"SIP/"+a}).join("&"))},function(b){a.usersArray=_.difference(a.usersArray,b),void 0===a.selectedApp?(a.application.appdata[0]=null,a.application.appdata[0]=_.map(a.usersArray,function(a){return"SIP/"+a}).join("&")):(a.route.Applications[a.selectedApp].appdata[0]=null,a.route.Applications[a.selectedApp].appdata[0]=_.map(a.usersArray,function(a){return"SIP/"+a}).join("&"))},a.route.Applications[a.selectedApp]?a.route.Applications[a.selectedApp].appdata:null)})["catch"](function(a){console.error(a)})};var x=function(a){var b=a?30*a+120:177;angular.element(document.getElementsByClassName("ui-grid")[0]).css("height",b+"px")};a.initApplication=function(b){b&&(a.selectedApp=void 0),a.forms={settings:void 0,interval:void 0},a.application={},a.interval={intType:"always",t_from:moment(new Date),t_to:moment(new Date),wd_from:"always",wd_to:"always",md_from:"always",md_to:"always",m_from:"always",m_to:"always",alwaysTime:!0},a.main={app:""}},a.$watch("interval",function(a){a&&v(a)},!0),a.updateSetAppdata=function(){a.application.variable&&a.application.value&&"Set"===a.main.app.value?a.application.appdata[0]=a.application.variable+"="+a.application.value:a.application.appdata[0]=null},a.updateSetAppdataSettings=function(){a.application.variable&&a.application.value&&"Set"===a.main.app.value?a.route.Applications[a.selectedApp].appdata[0]=a.application.variable+"="+a.application.value:a.application.appdata[0]=null},a.$watch("main.app",function(b){if(b){var c,d,e={},f={};switch(void 0===a.selectedApp&&(a.application={appType:b.type,app:b.value,interval:a.application.interval||"*,*,*,*",appdata:[]}),b.value){case"Queue":c=l,d=m;break;case"Playback":c=m;break;case"AGI":c=n;break;case"Goto":c=o;break;case"Voicemail":c=q;break;case"Dial":switch(b.type){case"internalDial":c=r,e={controller:"all"};break;case"externalDial":c=u}}if(c)return c.get(e).$promise.then(function(b){a.items=b.rows}).then(function(){return d?d.get(f).$promise:void 0}).then(function(b){b&&(a.items2=b.rows)})["catch"](function(a){h.error(a)})}},!0),a.deselectAndRedirect=function(b){a.selectedApp=void 0,e.path(b)},a.getIntervals=function(){return p.get().$promise.then(function(b){a.Intervals=b.rows,d.syncUpdates("interval",a.Intervals)})["catch"](function(a){h.error(a)})},a.getRoute=function(){return k.get({id:c.id}).$promise.then(function(b){a.route=b,a.gridOptions.data=b.Applications,x(a.gridOptions.data.length)})["catch"](function(a){e.path("/channels/voice/routes/internal/list")})},a.getApplication=function(){if(void 0===a.selectedApp)e.path("/channels/voice/routes/inbound/list");else{if(a.showGrid=!0,a.route.Applications[a.selectedApp].appType)a.main.app=_.find(a.$application.applications,{type:a.route.Applications[a.selectedApp].appType});else{var b=_.find(a.$application.applications,{value:a.route.Applications[a.selectedApp].app});if(b)a.main.app=b;else{a.main.app=_.find(a.$application.applications,{type:"custom"});var c=a.route.Applications[a.selectedApp].appdata.join(",");a.route.Applications[a.selectedApp].appdata=[c],a.route.Applications[a.selectedApp].appType="custom"}}if("Set"===a.main.app.value){var d=a.route.Applications[a.selectedApp].appdata[0].split("=");a.application.variable=d[0],a.application.value=d[1]}w()}},a.openApplication=function(b){a.selectedApp=b,a.showGrid=!1,e.path("/channels/voice/routes/internal/view/"+c.id+"/applications/settings")},a.updateRoute=function(d){return a.route.exten=a.$application.checkUnderscore(a.route.exten),_.forEach(a.route.Applications,function(a){if("custom"!==a.appType)switch(a.app){case"Dial":var b;switch(a.appType){case"externalDial":b=3;break;case"internalDial":b=2;break;default:b=2}a.appdata[b]=a.appdata[b]||"",a.appdata[b]+=(_.includes(a.appdata[b],"x")?"":"x")+(_.includes(a.appdata[b],"X")?"":"X");break;case"Queue":a.appdata[1]=a.appdata[1]||"",a.appdata[1]+=(_.includes(a.appdata[1],"x")?"":"x")+(_.includes(a.appdata[1],"X")?"":"X")}}),k.update({id:a.route.id},a.route).$promise.then(function(f){a.selectedApp=void 0,h.show(b.instant("MESSAGE_WELL_DONE")+"!","success"),d&&e.path("/channels/voice/routes/internal/view/"+c.id+"/"+d)})["catch"](function(a){h.error(a)})},a.getContexts=function(){return o.get().$promise.then(function(b){a.voiceContexts=b.rows,d.syncUpdates("voice_context",a.voiceContexts)})["catch"](function(a){h.error(a)})},a.deleteApp=g.confirm["delete"](function(b){a.route.Applications.splice(b,1),a.updateRoute()}),a.addApplication=function(){a.route.Applications.push(a.application),a.updateRoute("applications")},a.goNext=function(){f.wizard().next()},a.previous=function(){f.wizard().previous()},a.formValidation=function(a){return a},a.$on("destroy",function(){d.unsyncUpdates("voice_extension")})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes.internal.view",{url:"/view/:id",templateUrl:"app/channels/voice/route/internal/view/view.html",controller:"VoiceRouteInternalViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.channels.voice.routes.internal.view.settings",{url:"/settings",templateUrl:"app/channels/voice/route/internal/view/view.settings.html"}).state("main.channels.voice.routes.internal.view.applications",{url:"/applications",templateUrl:"app/channels/voice/route/internal/view/view.applications.html"}).state("main.channels.voice.routes.internal.view.application",{url:"/application",templateUrl:"app/channels/voice/route/view.application.html",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/jquery-multi-select/css/multi-select.css","assets/plugins/jquery-multi-select/js/jquery.multi-select.js","assets/plugins/jquery-quicksearch/jquery.quicksearch.js","assets/scripts/components-dropdowns.js"]})}]}}).state("main.channels.voice.routes.internal.view.applications.settings",{url:"/settings",templateUrl:"app/channels/voice/route/view.applicationSettings.html",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/jquery-multi-select/css/multi-select.css","assets/plugins/jquery-multi-select/js/jquery.multi-select.js","assets/plugins/jquery-quicksearch/jquery.quicksearch.js","assets/scripts/components-dropdowns.js"]})}]}})}]),angular.module("xCallyShuttleApp").controller("VoiceRouteOutboundListCreateCtrl",["$scope","$uibModalInstance","Route","application","xAlert","$translate","$location","Tag",function(a,b,c,d,e,f,g,h){a.$application=d.application,a.forms={route:void 0},a.item={type:"outbound",appdata:"Outbound Call",context:"from-sip"},a.getTags=function(){return h.get().$promise.then(function(b){b.rows.unshift({name:"--"}),a.tags=b.rows})["catch"](function(a){e.error(a)})},a.ok=function(){return a.item.exten=a.$application.checkUnderscore(a.item.exten),c.save(a.item).$promise.then(function(a){b.close(a),g.path("/channels/voice/routes/outbound/view/"+a.id+"/routes")})["catch"](function(a){e.error(a)})},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("VoiceRouteOutboundListCtrl",["$scope","$http","socket","$translate","$rootScope","xAlert","Modal","stResource","gridOptions","Route","$uibModal","$location","$log",function(a,b,c,d,e,f,g,h,i,j,k,l,m){a.initView=function(){var b={exporterCsvFilename:"OutboundRoutes.csv",columnDefs:[{name:"exten",displayName:"APPLICATION_DESTINATION_PATTERN"},{name:"description"},{name:"applications",cellClass:"ui-grid-vcenter",cellTemplate:'<div data-ng-if="row.entity.Applications.length"><span data-ng-repeat="app in row.entity.Applications | limitTo:2">{{app.app}}({{app.appdata[0]}}),</span>...</div><div data-ng-if="!row.entity.Applications.length">{{\'MESSAGE_NO_AVAILABLE_APPLICATIONS\' | translate}}</div>',enableSorting:!1,enableFiltering:!1,enableColumnMenu:!1},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/channels/voice/routes/outbound/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.exten, row.entity.id)"}]}]};a.gridOptions=i.gridOptions(j,b,a,{type:"outbound"})},a.create=function(){k.open({animation:!0,templateUrl:"app/channels/voice/route/outbound/list/create.modal.html",controller:"VoiceRouteOutboundListCreateCtrl"})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes.outbound.list",{url:"/list",templateUrl:"app/channels/voice/route/outbound/list/list.html",controller:"VoiceRouteOutboundListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes.outbound",{url:"/outbound",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("VoiceRouteOutboundViewCtrl",["$scope","xAlert","$translate","$stateParams","socket","$location","WizardHandler","Modal","application","interval","Route","Trunk","VoiceContext","Interval","Tag",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){function p(b){var c,d;if("always"===b.intType)c=null,d="*,*,*,*";else if("list"===b.intType)d=b.IntervalId?_.find(a.Intervals,{id:b.IntervalId}).name:"*,*,*,*",c=b.IntervalId||null;else if("custom"===b.intType){c=null;var e,f,g,h;e=b.t_from&&b.t_to&&!b.alwaysTime?moment(b.t_from).format("HH:mm")+"-"+moment(b.t_to).format("HH:mm"):"*",b.wd_from&&"always"!==b.wd_from?(f=b.wd_from,b.wd_to&&"always"!==b.wd_to&&(f+="-"+b.wd_to)):f="*",b.md_from&&"always"!==b.md_from?(g=b.md_from,b.md_to&&"always"!==b.md_to&&(g+="-"+b.md_to)):g="*",b.m_from&&"always"!==b.m_from?(h=b.m_from,b.m_to&&"always"!==b.m_to&&(h+="-"+b.m_to)):h="*",d=e+","+f+","+g+","+h}void 0===a.selectedApp?(a.application.interval=d,a.application.IntervalId=c):(a.route.Applications[a.selectedApp].interval=d,a.route.Applications[a.selectedApp].IntervalId=c)}function q(){if(a.interval.intType=a.route.Applications[a.selectedApp].IntervalId?"list":"*,*,*,*"===a.route.Applications[a.selectedApp].interval?"always":"custom",a.interval.IntervalId=a.route.Applications[a.selectedApp].IntervalId,!a.route.Applications[a.selectedApp].IntervalId){var b,c=a.route.Applications[a.selectedApp].interval?a.route.Applications[a.selectedApp].interval.split(","):["*","*","*","*"];c.forEach(function(c,d){switch(d){case 0:"*"!==c?(b=c.split("-"),a.interval.t_from=moment(b[0],"HH:mm"),a.interval.t_to=moment(b[1],"HH:mm"),a.interval.alwaysTime=!1):(a.interval.t_from=moment(new Date),a.interval.t_to=moment(new Date),a.interval.alwaysTime=!0);break;case 1:"*"!==c?(b=c.split("-"),a.interval.wd_from=b[0],a.interval.wd_to=b[1]?b[1]:"always"):(a.interval.wd_from="always",a.interval.wd_to="always");break;case 2:"*"!==c?(b=c.split("-"),a.interval.md_from=b[0],a.interval.md_to=b[1]?b[1]:"always"):(a.interval.md_from="always",a.interval.md_to="always");break;case 3:"*"!==c?(b=c.split("-"),a.interval.m_from=b[0],a.interval.m_to=b[1]?b[1]:"always"):(a.interval.m_from="always",a.interval.m_to="always")}})}}a.$translate=c,a.selectedApp=void 0,a.showGrid=!0,a.$application=i.application,a.$interval=j.interval,a._=_,a.recordSwitch={onText:"On",offText:"Off",isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.alwaysSwitch={isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.selectedRows=[],a.gridOptions={enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableSorting:!1,rowTemplate:'<div grid="grid" class="ui-grid-draggable-row" draggable="true"><div ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ng-class="{ \'ui-grid-row-header-cell\': col.isRowHeader, \'custom\': true }" ui-grid-cell></div></div>',columnDefs:[{name:"app",displayName:"APPLICATION_APPLICATION",cellClass:"ui-grid-vcenter",cellTemplate:"<div><span data-ng-if=\"row.entity.appType === 'externalDial'\">Default</span><span data-ng-if=\"row.entity.appType !== 'externalDial'\">{{row.entity.app}}</span></div>",headerCellFilter:"translate",enableColumnMenu:!1},{name:"appType",headerCellFilter:"translate",displayName:"APPLICATION_INFO",cellClass:"ui-grid-vcenter",cellTemplate:"<div>{{'APPLICATION_APPS_'+(row.entity.appType || (grid.appScope._.find(grid.appScope.$application.applications,{value:row.entity.app}) ? row.entity.app : 'custom')).toUpperCase() | translate}}</div>",enableColumnMenu:!1},{name:"appdata",displayName:"APPLICATION_ARGUMENTS",headerCellFilter:"translate",cellClass:"ui-grid-vcenter",cellTemplate:"<div>{{row.entity.appdata.join(',')}}</div>",enableColumnMenu:!1},{name:"interval",displayName:"APPLICATION_TIME_INTERVAL",headerCellFilter:"translate",enableColumnMenu:!1},{name:"action",displayName:"APPLICATION_ACTION",headerCellFilter:"translate",width:125,enableColumnMenu:!1,cellClass:"ui-grid-vcenter",cellTemplate:'<div><a class="btn btn-xs blue-hoki" data-ng-click="grid.appScope.openApplication(grid.appScope.gridOptions.data.indexOf(row.entity))"><i class="icon-settings"></i></a><a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteApp(row.entity.app+\' application\', grid.appScope.gridOptions.data.indexOf(row.entity))"><i class="fa fa-trash"></i></a></div>'}],onRegisterApi:function(b){b.selection.on.rowSelectionChanged(a,function(b){b.isSelected?a.selectedRows.push(b.entity):_.pull(a.selectedRows,b.entity)}),b.selection.on.rowSelectionChangedBatch(a,function(b){b[0].isSelected?a.selectedRows=_.map(b,"entity"):a.selectedRows=[]}),b.draggableRows.on.rowDropped(a,function(b,c){a.updateRoute()}),b.grid.registerDataChangeCallback(function(){r(a.gridOptions.data.length)})}},a.deleteItems=h.confirm["delete"](function(){_.remove(a.route.Applications,function(b){return _.includes(a.selectedRows,b)}),a.selectedRows=[],a.updateRoute()});var r=function(a){var b=a?30*a+120:177;angular.element(document.getElementsByClassName("ui-grid")[0]).css("height",b+"px")};a.initApplication=function(b){b&&(a.selectedApp=void 0),a.forms={info:void 0,interval:void 0},a.application={},a.interval={intType:"always",t_from:moment(new Date),t_to:moment(new Date),wd_from:"always",wd_to:"always",md_from:"always",md_to:"always",m_from:"always",m_to:"always",alwaysTime:!0},a.main={app:""},a.applications=[{name:"Default",value:"Dial",type:"outboundDial"},{name:"Custom",value:"custom",type:"custom"}]},a.$watch("interval",function(a){a&&p(a)},!0),a.$watch("main.app",function(c){if(c){var d,e;switch(void 0===a.selectedApp&&(a.application={appType:c.type,app:c.value,interval:a.application.interval||"*,*,*,*",appdata:[]}),c.value){case"Dial":d=l;break;default:d=null,e=null}if(d)return d.get().$promise.then(function(b){a.items=b.rows}).then(function(){return e?e.get().$promise:void 0}).then(function(b){b&&(a.items2=b.rows)})["catch"](function(a){b.error(a)})}},!0),a.deselectAndRedirect=function(b){a.selectedApp=void 0,f.path(b)},a.getIntervals=function(){return n.get().$promise.then(function(b){a.Intervals=b.rows,e.syncUpdates("interval",a.Intervals)})["catch"](function(a){b.error(a)})},a.getRoute=function(){return k.get({id:d.id}).$promise.then(function(b){a.route=b,a.gridOptions.data=b.Applications,r(a.gridOptions.data.length)})["catch"](function(a){f.path("/channels/voice/routes/outbound/list")})},a.getApplication=function(){if(void 0===a.selectedApp)f.path("/channels/voice/routes/outbound/list");else{if(a.showGrid=!0,a.route.Applications[a.selectedApp].appType)a.main.app=_.find(a.applications,{type:a.route.Applications[a.selectedApp].appType});else{a.main.app=_.find(a.applications,{type:"custom"});var b=a.route.Applications[a.selectedApp].appdata.join(",");a.route.Applications[a.selectedApp].appdata=[b],a.route.Applications[a.selectedApp].appType="custom"}q()}},a.openApplication=function(b){a.selectedApp=b,a.showGrid=!1,f.path("/channels/voice/routes/outbound/view/"+d.id+"/routes/settings")},a.updateRoute=function(e){return a.route.exten=a.$application.checkUnderscore(a.route.exten),_.forEach(a.route.Applications,function(a){"outboundDial"===a.appType&&(a.appdata[4]=a.appdata[4]||"",a.appdata[4]+=(_.includes(a.appdata[4],"x")?"":"x")+(_.includes(a.appdata[4],"X")?"":"X"))}),k.update({id:a.route.id},a.route).$promise.then(function(g){a.selectedApp=void 0,b.show(c.instant("MESSAGE_WELL_DONE")+"!","success"),e&&f.path("/channels/voice/routes/outbound/view/"+d.id+"/"+e)})["catch"](function(a){b.error(a)})},a.getContexts=function(){return m.get().$promise.then(function(b){a.voiceContexts=b.rows,e.syncUpdates("voice_context",a.voiceContexts)})["catch"](function(a){b.error(a)})},a.getTags=function(){return o.get().$promise.then(function(b){b.rows.unshift({name:"--"}),a.tags=b.rows})["catch"](function(a){b.error(a)})},a.deleteApp=h.confirm["delete"](function(b){a.route.Applications.splice(b,1),a.updateRoute()}),a.addApplication=function(){a.route.Applications.push(a.application),a.updateRoute("routes")},a.goNext=function(){g.wizard().next()},a.previous=function(){g.wizard().previous()},a.formValidation=function(a){return a},a.$on("destroy",function(){e.unsyncUpdates("voice_extension")})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes.outbound.view",{url:"/view/:id",templateUrl:"app/channels/voice/route/outbound/view/view.html",controller:"VoiceRouteOutboundViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.channels.voice.routes.outbound.view.settings",{url:"/settings",templateUrl:"app/channels/voice/route/outbound/view/view.settings.html"}).state("main.channels.voice.routes.outbound.view.routes",{url:"/routes",templateUrl:"app/channels/voice/route/outbound/view/view.routes.html"}).state("main.channels.voice.routes.outbound.view.route",{url:"/route",templateUrl:"app/channels/voice/route/outbound/view/view.route.html"}).state("main.channels.voice.routes.outbound.view.routes.settings",{url:"/settings",templateUrl:"app/channels/voice/route/outbound/view/view.routeSettings.html"})}]),angular.module("xCallyShuttleApp").factory("Route",["$resource",function(a){return a("/api/voice/extensions/:id",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.routes",{url:"/routes",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:7}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice",{url:"/voice",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user","agent"],redirectTo:"landing",id:7}}})}]),angular.module("xCallyShuttleApp").controller("VoiceVoicemailListCtrl",["$scope","VoiceMail","gridOptions",function(a,b,c){a.initView=function(){var d={exporterCsvFilename:"voice_mails.csv",primaryKey:"uniqueid",columnDefs:[{name:"mailbox"},{name:"fullname"},{name:"email"},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/channels/voice/voicemails/view/{{row.entity.uniqueid}}/settings",name:"profile"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.mailbox, row.entity.uniqueid)"}]}]};a.gridOptions=c.gridOptions(b,d,a)}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.voicemails.list",{url:"/list",templateUrl:"app/channels/voice/voicemail/list/list.html",controller:"VoiceVoicemailListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("VoiceVoicemailViewCtrl",["$scope","VoiceMail","VoiceMailMessage","VoiceContext","$http","xAlert","$translate","$stateParams","socket","$sce","Modal","$location","gridOptions",function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){var b={exporterCsvFilename:"voice_mail_messages.csv",primaryKey:"id",columnDefs:[{name:"callerid"},{name:"stamp",displayName:"APPLICATION_DATE",cellClass:"ui-grid-vcenter",cellTemplate:"<div>{{grid.appScope.moment(row.entity.stamp).format('YYYY-MM-DD HH:mm:ss')}}</div>"},{name:"duration",cellClass:"ui-grid-vcenter",cellTemplate:"<div>{{row.entity.duration*1000 | date:'mm:ss'}}</div>"},{name:"audio",displayName:"",width:225,enableSorting:!1,enableFiltering:!1,buttons:[{directive:'<audio-file-download params="{id:row.entity.id,controller:\'download\'}" resource="grid.appScope.VoiceMailMessage"></audio-file-download>'}]},{name:"action",width:150,buttons:[{directive:'<motion-file-download params="{id:row.entity.id,controller:\'download\'}" resource="grid.appScope.VoiceMailMessage" mimetype="audio/wav" btnclass="btn btn-xs blue-hoki" filename="row.entity.msg_id+\'.wav\'"></motion-file-download>'},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.id, row.entity.id)"}]}]};a.gridOptions=m.gridOptions(c,b,a,{mailbox:a.voicemail.mailbox,context:a.voicemail.context})}a.moment=moment,a["switch"]={isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.VoiceMailMessage=c,a.getVoicemail=function(){return b.get({id:h.uniqueid}).$promise.then(function(b){delete b.password,delete b.stamp,a.voicemail=b})["catch"](function(a){l.path("/voice/voicemails/list")})},a.updateVoiceVoicemail=function(){return b.update({id:h.uniqueid},a.voicemail).$promise.then(function(){f.show(g.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){f.error(a)})},a.getContexts=function(){return d.get().$promise.then(function(b){a.voiceContexts=b.rows})["catch"](function(a){f.error(a)})},a.getMessages=function(){return a.voicemail?void n():b.get({id:h.uniqueid}).$promise.then(function(b){delete b.password,delete b.stamp,a.voicemail=b,n()})["catch"](function(a){l.path("/voice/voicemails/view/"+h.uniqueid+"/settings")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.voicemails.view",{url:"/view/:uniqueid",templateUrl:"app/channels/voice/voicemail/view/view.html",controller:"VoiceVoicemailViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.channels.voice.voicemails.view.settings",{url:"/settings",templateUrl:"app/channels/voice/voicemail/view/view.settings.html"}).state("main.channels.voice.voicemails.view.messages",{url:"/messages",templateUrl:"app/channels/voice/voicemail/view/view.messages.html"})}]),angular.module("xCallyShuttleApp").factory("VoiceMail",["$resource",function(a){return a("/api/voice/voicemails/:id/:controller",{uniqueid:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.voicemails",{url:"/voicemails",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:7}}})}]),angular.module("xCallyShuttleApp").factory("VoiceMailMessage",["$resource",function(a){return a("/api/voice/voicemails/messages/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("VoiceVoicemailWizardCtrl",["$scope","VoiceMail","xAlert","WizardHandler","$location","Setting",function(a,b,c,d,e,f){a.initWizard=function(){a.form={},a.item={context:"from-voicemail"}},a.next=function(){d.wizard().next()},a.previous=function(){d.wizard().previous()},a.exitValidation=function(a){return a},a.getFirstFreeMailbox=function(){f.get({controller:"mailbox"}).$promise.then(function(b){a.item.mailbox=b.value})["catch"](function(a){c.error(a)})},a.createItem=function(){return a.item.customer_id=a.item.mailbox,b.save(a.item).$promise.then(function(){e.path("/channels/voice/voicemails/list")})["catch"](function(a){c.error(data)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.channels.voice.voicemails.wizard",{url:"/wizard",templateUrl:"app/channels/voice/voicemail/wizard/wizard.html",controller:"VoiceVoicemailWizardCtrl"})}]),angular.module("xCallyShuttleApp").factory("VoiceQueue",["$resource",function(a){return a("/api/voice/queues/:id/:controller/:controller2",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("Company",["$resource",function(a){return a("/api/contactmanager/companies/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.contactmanager.companies",{url:"/companies",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:5}}})}]),angular.module("xCallyShuttleApp").controller("CompanyListCreateModalCtrl",["$scope","$uibModalInstance",function(a,b){a.forms={dashboard:void 0},a.item={},a.ok=function(){a.item.model=JSON.stringify({title:a.item.name}),b.close(a.item)},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("ContactManagerCompanyListCtrl",["$scope","$translate","xAlert","Modal","$uibModal","$log","Company","gridOptions","$location",function(a,b,c,d,e,f,g,h,i){a.initView=function(){var b={exporterCsvFilename:"Companies.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:100,buttons:[{"class":"blue-hoki",name:"profile",href:"/contactmanager/companies/view/{{row.entity.id}}/settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"},{"class":"green-turquoise",name:"contacts",uisref:"main.contactmanager.contacts.list({companyId:{{row.entity.id}}})"}]}]};a.gridOptions=h.gridOptions(g,b,a)},a.create=function(){var a=e.open({animation:!0,size:"lg",templateUrl:"app/contactmanager/company/list/create.modal.html",controller:"CompanyListCreateModalCtrl"});a.result.then(function(a){return g.save(a).$promise.then(function(a){i.path("/contactmanager/companies/view/"+a.id+"/settings")})["catch"](function(a){c.error(a)})},function(){f.info("Modal dismissed at: "+new Date)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.contactmanager.companies.list",{url:"/list",templateUrl:"app/contactmanager/company/list/list.html",controller:"ContactManagerCompanyListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("ContactManagerCompanyViewCtrl",["$scope","xAlert","$translate","$stateParams","$location","Company",function(a,b,c,d,e,f){a.getCompany=function(){return f.get({id:d.id}).$promise.then(function(b){a.company=b})["catch"](function(a){e.path("/contactmanager/companies/list")})},a.updateCompany=function(){return f.update({id:d.id},a.company).$promise.then(function(){b.show(c.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){b.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.contactmanager.companies.view",{url:"/view/:id",templateUrl:"app/contactmanager/company/view/view.html",controller:"ContactManagerCompanyViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.contactmanager.companies.view.settings",{url:"/settings",templateUrl:"app/contactmanager/company/view/view.settings.html"})}]),angular.module("xCallyShuttleApp").factory("Contact",["$resource",function(a){return a("/api/contactmanager/contacts/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.contactmanager.contacts",{url:"/contacts",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("ContactManagerListCopyModalCtrl",["$scope","$uibModalInstance","xAlert","List","Contact","$translate",function(a,b,c,d,e,f){a.item={},a.getLists=function(){return d.get().$promise.then(function(b){a.lists=b.rows})["catch"](function(a){c.error(a)})},a.ok=function(){b.close(a.item)},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("ContactManagerListImportModalCtrl",["$scope","$uibModalInstance","indexes","csv","xAlert","socket","List","Contact","$translate",function(a,b,c,d,e,f,g,h,i){function j(b){if(b>=a.csvLength||a.stopped)return void(a.importing=!1);for(var c,f=[],g=b;b+200>g&&g<a.csvLength;g++)c={},_.forOwn(a.item,function(b,e){switch(e){case"tags":c.tags=[],a.item.tags.forEach(function(a){""!==d[g][a]&&c.tags.push(d[g][a])});break;default:c[e]=d[g][b]}}),c.tags=c.tags?c.tags.join(","):void 0,c.ListId=a.item.ListId,c.CompanyId=a.item.CompanyId||null,f.push(c);return h.save({controller:"bulk"},{contacts:f}).$promise.then(function(b){a["import"].success+=b.ok*a.addingQuote,a["import"].succeeded+=b.ok,a["import"].fail+=b.ko*a.addingQuote,a["import"].failed+=b.ko,
 j(g)})["catch"](function(b){a.stopped=!0,e.error(b),j(g)})}a.indexes=c,a.importing=!1,a.submitted=!1,a.stopped=!1,a["import"]={success:0,fail:0,succeeded:0,failed:0},a.csvLength=d.length,a.addingQuote=100/a.csvLength,a.forms={csv:void 0},a.item={},a.start=function(){a.importing=!0,a.submitted=!0,j(0)},a.getLists=function(){return g.get().$promise.then(function(b){a.lists=b.rows,a.item.ListId=1,a.getCustomFields()})["catch"](function(a){e.error(a)})},a.getCustomFields=function(){return g.get({listId:a.item.ListId,controller:"customfields"}).$promise.then(function(b){b.rows.forEach(function(a){a.values=JSON.parse(a.values)}),a.customFields=b.rows,f.socket.on("custom_field:remove",function(b){_.remove(a.customFields,function(a){return b.id==a.id})}),f.socket.on("custom_field:save",function(b){if(b.ListId===a.item.ListId){var c=_.find(a.customFields,{id:b.id});c||("string"==typeof b.values&&(b.values=JSON.parse(b.values)),a.customFields.push(b))}})})["catch"](function(a){console.error(a),e.error(a)})},a.close=function(){b.close()},a.stop=function(){a.stopped=!0}}]),angular.module("xCallyShuttleApp").controller("ContactManagerContactListCtrl",["$scope","$translate","Modal","FileUploader","Papa","$uibModal","$log","Contact","gridOptions","List","uiGridConstants","xAlert","socket","$stateParams","Auth","Company",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){a.Auth=o,a.initView=function(){var c;return j.get().$promise.then(function(b){return a.lists=[],a.customFields=[],b.rows.forEach(function(b,c){_.forEach(b.CustomFields,function(b){a.customFields.push({name:b.name,alias:b.alias})}),a.lists.push({value:b.id,label:b.name})}),p.get().$promise}).then(function(b){a.companies=[],b.rows.forEach(function(b,c){a.companies.push({value:b.id,label:b.name})})}).then(function(){var d=[{"class":"blue-hoki",name:"profile",onClick:"grid.appScope.openContactTab(row.entity)"}];o.isAgent()||(d.push({"class":"green",title:b.instant("APPLICATION_COPY"),name:"copy",onClick:"grid.appScope.copy(row.entity.id)"}),d.push({"class":"red-sunglo",name:"delete",title:b.instant("APPLICATION_DELETE"),onClick:"grid.appScope.deleteItem(row.entity.fullname, row.entity.id)"})),c={exporterCsvFilename:"Contacts.csv",columnDefs:[{name:"firstName"},{name:"lastName"},{name:"phone"},{name:"email"},{name:"ListId",displayName:"APPLICATION_LIST",field:"List.name",filter:{type:k.filter.SELECT,term:n.listId||null,selectOptions:a.lists},cellTemplate:'<div class="centered-uigrid-td"><a href="/contactmanager/lists/view/{{row.entity.ListId}}/settings">{{row.entity.List.name}}</a></div>'},{name:"CompanyId",displayName:"APPLICATION_COMPANY",field:"Company.name",filter:{type:k.filter.SELECT,term:n.companyId||null,selectOptions:a.companies},cellTemplate:'<div class="centered-uigrid-td"><a href="/contactmanager/companies/view/{{row.entity.CompanyId}}/settings">{{row.entity.Company.name}}</a></div>'},{name:"tags",filterHeaderTemplate:'<div class="ui-grid-filter-container row"><div ng-repeat="colFilter in col.filters" class="col-md-12 col-md-offset-0 col-sm-12 col-sm-offset-0 col-xs-12 col-xs-offset-0"><div custom-grid-tags-filter-header></div></div></div>',filters:[{name:"tags"}],cellTemplate:"<div class=\"centered-uigrid-td\">{{row.entity.tags.join(',')}}</div>"}]},_.forEach(a.customFields,function(a){c.columnDefs.push({name:a.name,displayName:a.alias,visible:!1})}),c.columnDefs.push({name:"action",width:100,buttons:d}),a.gridOptions=i.gridOptions(h,c,a),m.socket.on("contact_manager:remove",function(b){a.gridOptions.getPage()})})["catch"](function(a){l.error(a)})},d.FileSelect.prototype.isEmptyAfterSelection=function(){return!0};var q=a.uploader=new d({queueLimit:1,clearInputAfterAddedToQueue:!0});q.onAfterAddingFile=function(b){console.log("fileadded"),e.parse(b._file,{header:!0,complete:function(b){a.uploader.clearQueue(),a["import"](b.data)},error:function(a){console.log(a)}})},a["import"]=function(b){var c=f.open({animation:!0,size:"lg",backdrop:"static",keyboard:!1,templateUrl:"app/contactmanager/contact/list/import.modal.html",controller:"ContactManagerListImportModalCtrl",resolve:{indexes:function(){return _.keys(b[0])},csv:function(){return b}}});c.result.then(function(b){a.gridOptions.getPage()},function(){g.info("Modal dismissed at: "+new Date)})},a.copy=function(b){var c=f.open({animation:!0,size:"small",templateUrl:"app/contactmanager/contact/list/copy.modal.html",controller:"ContactManagerListCopyModalCtrl"});c.result.then(function(c){return h.save({id:b,controller:"copy"},c).$promise.then(function(b){a.openContactTab({firstName:b.firstName,lastName:b.lastName,id:b.id})})["catch"](function(a){l.error(a)})},function(){g.info("Modal dismissed at: "+new Date)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.contactmanager.contacts.list",{url:"/list",templateUrl:"app/contactmanager/contact/list/list.html",params:{listId:null,companyId:null},controller:"ContactManagerContactListCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.contactmanager",{url:"/contactmanager",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user","agent"],redirectTo:"landing",id:5}}})}]),angular.module("xCallyShuttleApp").factory("List",["$resource",function(a){return a("/api/contactmanager/lists/:listId/:controller/:id",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.contactmanager.lists",{url:"/lists",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:5}}})}]),angular.module("xCallyShuttleApp").controller("ContactManagerListListCreateModalCtrl",["$scope","$uibModalInstance",function(a,b){a.forms={dashboard:void 0},a.item={},a.ok=function(){b.close(a.item)},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("ContactManagerListListCtrl",["$scope","$http","$translate","Modal","xAlert","$uibModal","$log","List","gridOptions",function(a,b,c,d,e,f,g,h,i){a.initView=function(){var b={exporterCsvFilename:"Lists.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:100,buttons:[{"class":"blue-hoki",name:"settings",href:"/contactmanager/lists/view/{{row.entity.id}}/settings"},{"class":"{{row.entity.defaultEntry ? 'red-sunglo disabled' : 'red-sunglo'}}",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"},{"class":"green-turquoise",name:"contacts",uisref:"main.contactmanager.contacts.list({listId:{{row.entity.id}}})"}]}]};a.gridOptions=i.gridOptions(h,b,a)},a.create=function(){var d=f.open({animation:!0,templateUrl:"app/contactmanager/list/list/create.modal.html",controller:"ContactManagerListListCreateModalCtrl"});d.result.then(function(d){b.post("/api/contactmanager/lists/",d).then(function(b){a.gridOptions.getPage(),e.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){e.error(a)})},function(){g.info("Modal dismissed at: "+new Date)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.contactmanager.lists.list",{url:"/list",templateUrl:"app/contactmanager/list/list/list.html",controller:"ContactManagerListListCtrl"})}]),angular.module("xCallyShuttleApp").controller("ContactManagerListCustomFieldViewCreateModalCtrl",["$scope","$uibModalInstance","$translate",function(a,b,c){a.$translate=c,a.forms={dashboard:void 0},a.item={},a.choices=[{value:""}],a.addField=function(){a.choices.push({})},a.removeField=function(b){a.choices.splice(b,1)},a.types=[{name:"APPLICATION_TEXT",value:"text"},{name:"APPLICATION_SELECT",value:"select"}],a.ok=function(){"select"===a.item.type&&(a.item.values=angular.toJson(a.choices)),b.close(a.item)},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("ContactManagerListViewCtrl",["$scope","xAlert","$translate","$stateParams","socket","$location","$uibModal","$log","Modal","List","Team","gridOptions",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(a){var b=a.split(""),c=0,d=0;return b.shift(),b.forEach(function(a,b){"{"===a?c++:"}"===a&&(c--,c||(d=b+1))}),d?JSON.parse("["+a.substr(1,d)+"]"):[]}var n=function(){return{select:function(b){return j.save({listId:a.list.id,controller:"agents"},{agents:b}).$promise.then(function(){a.getTeams()})["catch"](function(a){console.log(a)})},deselect:function(b){return j["delete"]({listId:a.list.id,controller:"agents",agents:b}).$promise.then(function(){a.getTeams()})["catch"](function(a){console.log(a)})}}};a.getList=function(){return j.get({listId:d.id}).$promise.then(function(b){a.list=b})["catch"](function(a){f.path("/contactmanager/lists/list")})},a.updateList=function(){return j.update({id:d.id},a.list).$promise.then(function(){b.show(c.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){b.error(a)})},a.getTeams=function(){return k.get({controller:"associations"}).$promise.then(function(b){return a.teams=b.rows,a.list?void 0:a.getList()}).then(function(){return a.list.defaultEntry&&f.path("/contactmanager/lists/list"),j.get({listId:d.id,controller:"agents"}).$promise}).then(function(b){ComponentsDropdowns.bindQueue(a.teams,_.map(b.rows,function(a){return{id:a.id}}),n)})["catch"](function(a){console.error(a)})},a.initCustomFields=function(){var b={exporterCsvFilename:"customfields.csv",primaryKey:"id",columnDefs:[{name:"alias",displayName:"APPLICATION_NAME"},{name:"name",displayName:"APPLICATION_FIELD"},{name:"type"},{name:"description"},{name:"action",width:200,buttons:[{"class":"blue-hoki",href:"/contactmanager/lists/view/{{grid.appScope.$stateParams.id}}/customfields/settings/{{row.entity.id}}",name:"settings"},{"class":"red-sunglo",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)",name:"delete"}]}]};a.gridOptions=l.gridOptions(j,b,a,{listId:d.id,controller:"customfields"})},a.create=function(){var e=g.open({animation:!0,templateUrl:"app/contactmanager/list/view/create.modal.html",controller:"ContactManagerListCustomFieldViewCreateModalCtrl"});e.result.then(function(e){return j.save({listId:d.id,controller:"customfields"},e).$promise.then(function(){a.gridOptions.getPage(),b.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){b.error(a)})},function(){h.info("Modal dismissed at: "+new Date)})},a.getCustomField=function(){return j.get({listId:d.id,controller:"customfields",id:d.cfId}).$promise.then(function(b){if(a.customField=b,"select"===a.customField.type)try{a.choices=JSON.parse(a.customField.values)}catch(c){a.choices=m(a.customField.values)}})["catch"](function(a){console.error(a)})},a.updateCustomField=function(){var e=angular.copy(a.customField);return"select"===e.type&&(e.values=angular.toJson(a.choices)),j.update({listId:d.id,controller:"customfields",id:d.cfId},e).$promise.then(function(){b.show(c.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){b.error(a)})},a.addField=function(){a.choices.push({})},a.removeField=function(b){a.choices.splice(b,1)}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.contactmanager.lists.view",{url:"/view/:id",templateUrl:"app/contactmanager/list/view/view.html",controller:"ContactManagerListViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.contactmanager.lists.view.settings",{url:"/settings",templateUrl:"app/contactmanager/list/view/view.settings.html"}).state("main.contactmanager.lists.view.agents",{url:"/agents",templateUrl:"app/contactmanager/list/view/view.agents.html",cache:!1,serie:!0,resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/jquery-multi-select/css/multi-select.css","assets/plugins/jquery-multi-select/js/jquery.multi-select.js","assets/plugins/jquery-quicksearch/jquery.quicksearch.js","assets/scripts/components-dropdowns.js"]})}]}}).state("main.contactmanager.lists.view.customfields",{url:"/customfields",templateUrl:"app/contactmanager/list/view/view.customFields.html"}).state("main.contactmanager.lists.view.customfields.settings",{url:"/settings/:cfId",templateUrl:"app/contactmanager/list/view/view.customFieldSettings.html",controller:"ContactManagerListViewCtrl"})}]),angular.module("xCallyShuttleApp").controller("DashboardChatCtrl",["$scope","Auth","ChatRoom","socket","Agent","$q","$translate","ReportChatSession","$timeout",function(a,b,c,d,e,f,g,h,i){a.Auth=b,a.moment=moment,a["new"]=0,a.open=0,a.unmanaged=0,a.closed=0;var j=function(a){var b=a?30*a+130:270;angular.element(document.getElementsByClassName("ui-grid")[0]).css("height",b+"px"),angular.element(document.getElementsByClassName("ui-grid-viewport")).css("height",30*a+"px")};a.initAgent=function(){a.table1={enableGridMenu:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,multiSelect:!0,columnDefs:[{name:"UserHasChatQueue.queue",headerCellFilter:"translate",displayName:"APPLICATION_QUEUE",cellClass:"text-center ui-grid-vcenter"}],data:[],onRegisterApi:function(b){a.gridApi=b,a.gridApi.grid.registerDataChangeCallback(function(){j(a.gridApi.core.getVisibleRows(a.gridApi.grid).length)})}},a.table2={headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,columnDefs:[{name:"roomid",displayName:"APPLICATION_INTERACTION_ID",headerCellFilter:"translate"},{name:"websitename",displayName:"APPLICATION_WEBSITE",headerCellFilter:"translate"},{name:"application",displayName:"APPLICATION_APPLICATION",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.application}} <span data-ng-if=\"row.entity.application == 'queue' && row.entity.queuename\">({{row.entity.queuename}})</span></div>"},{name:"status",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span data-ng-if="!row.entity.leaveAt">{{\'APPLICATION_QUEUESTATUS_WAITING\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.abandon">{{\'APPLICATION_QUEUESTATUS_ABANDON\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.complete">{{\'APPLICATION_QUEUESTATUS_COMPLETE\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.timeout">{{\'APPLICATION_TIMEOUT\' | translate}}</span><span data-ng-if="!row.entity.leaveAt"> [<timer start-time="grid.appScope.moment(row.entity.updatedAt).unix()*1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>]</span></div>',enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"membername",displayName:"APPLICATION_AGENT",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.membername || ''}}</div>"}],data:[],gridMenuTitleFilter:function(a){var b=f.defer();return b.resolve(g.instant(a)),b.promise},onRegisterApi:function(b){a.gridApi=b,a.gridApi.grid.registerDataChangeCallback(function(){j(a.table2.data.length)})}},e.get({id:b.getCurrentUser().id,controller:"chat",controller1:"queues"}).$promise.then(function(b){a.table1.data=b.rows})["finally"](function(){d.socket.on("user_has_chat_queue:save",function(c){c.UserId!=b.getCurrentUser().id||_.find(a.table1.data,{id:c.ChatQueueId})||a.table1.data.push({id:c.ChatQueueId,UserHasChatQueue:c})}),d.socket.on("user_has_chat_queue:remove",function(c){c.UserId===b.getCurrentUser().id&&_.remove(a.table1.data,{id:c.ChatQueueId})})})["catch"](function(a){console.error(a)}),h.get({controller:"waiting",controller2:"applications"}).$promise.then(function(b){a.table2.data=b.rows})["finally"](function(){d.socket.on("report_chat_session:save",function(b){var c=_.find(a.table2.data,{id:b.id});c?(_.merge(c,b),b.leaveAt&&i(function(){_.remove(a.table2.data,{id:b.id})},1e4)):b.leaveAt||a.table2.data.push(b)}),d.socket.on("report_chat_session:remove",function(b){_.remove(a.table2.data,{id:b.id})})})["catch"](function(a){console.log(a)})},a.initWidget=function(b){var e;switch(b){case"unmanaged":e=c;break;default:e=h}return e.get({id:b}).$promise.then(function(c){a[b]=c.value,a.charts={interactions:{labels:[g.instant("APPLICATION_DASHBOARD_NEW"),g.instant("APPLICATION_DASHBOARD_OPEN"),g.instant("APPLICATION_UNMANAGED"),g.instant("APPLICATION_DASHBOARD_CLOSED"),g.instant("APPLICATION_DASHBOARD_ABANDONED")],values:[a["new"],a.open,a.unmanaged,a.closed,a.abandoned],colours:["#44B6AE","#578EBE","#35AA47","#8775A7","#f3c200"]}},d.socket.on("report_chat_dashboard:"+b,function(c){a[b]=c.value,a.charts.interactions.values=[a["new"],a.open,a.unmanaged,a.closed]})})["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").controller("DashboardCtrl",["$scope","$translate","Auth",function(a,b,c){}]),angular.module("xCallyShuttleApp").factory("Dashboard",["$resource",function(a){return a("/api/dashboards/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.dashboard",{"abstract":!0,url:"/dashboard",templateUrl:"app/dashboard/dashboard.html",controller:"DashboardCtrl",data:{permissions:{only:["admin","user","agent"],redirectTo:"landing",id:1}}}).state("main.dashboard.voice",{url:"/voice",controller:"DashboardVoiceCtrl",templateUrl:"app/dashboard/voice/voice.html"}).state("main.dashboard.chat",{url:"/chat",controller:"DashboardChatCtrl",templateUrl:"app/dashboard/chat/chat.html",data:{permissions:{redirectTo:"landing",id:8}}}).state("main.dashboard.mail",{url:"/mail",controller:"DashboardMailCtrl",templateUrl:"app/dashboard/mail/mail.html",data:{permissions:{redirectTo:"landing",id:9}}}).state("main.dashboard.fax",{url:"/fax",controller:"DashboardFaxCtrl",templateUrl:"app/dashboard/fax/fax.html",data:{permissions:{redirectTo:"landing",id:10}}}).state("main.dashboard.sms",{url:"/sms",controller:"DashboardSmsCtrl",templateUrl:"app/dashboard/sms/sms.html",data:{permissions:{redirectTo:"landing",id:11}}}).state("main.dashboard.openchannel",{url:"/openchannel",controller:"DashboardOpenChannelCtrl",templateUrl:"app/dashboard/openchannel/openchannel.html",data:{permissions:{redirectTo:"landing",id:20}}})}]),angular.module("xCallyShuttleApp").controller("DashboardFaxCtrl",["$scope","Auth","FaxRoom","socket","Agent","$translate","$q","ReportFaxSession","$timeout",function(a,b,c,d,e,f,g,h,i){a.Auth=b,a.moment=moment,a["new"]=0,a.open=0,a.pending=0,a.closed=0,a.initAgent=function(){a.table1={enableGridMenu:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,multiSelect:!0,columnDefs:[{name:"UserHasFaxQueue.queue",headerCellFilter:"translate",displayName:"APPLICATION_QUEUE",cellClass:"text-center ui-grid-vcenter"}],data:[],onRegisterApi:function(b){a.gridApi=b}},a.table2={headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,columnDefs:[{name:"roomid",displayName:"APPLICATION_INTERACTION_ID",headerCellFilter:"translate"},{name:"accountname",displayName:"APPLICATION_ACCOUNT_NAME",headerCellFilter:"translate"},{name:"application",displayName:"APPLICATION_APPLICATION",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.application}} <span data-ng-if=\"row.entity.application == 'queue' && row.entity.queuename\">({{row.entity.queuename}})</span></div>"},{name:"status",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span data-ng-if="!row.entity.leaveAt">{{\'APPLICATION_QUEUESTATUS_WAITING\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.complete">{{\'APPLICATION_QUEUESTATUS_COMPLETE\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.timeout">{{\'APPLICATION_TIMEOUT\' | translate}}</span><span data-ng-if="!row.entity.leaveAt"> [<timer start-time="grid.appScope.moment(row.entity.updatedAt).unix()*1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>]</span></div>',enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"membername",displayName:"APPLICATION_AGENT",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.membername || ''}}</span></div>"}],data:[],gridMenuTitleFilter:function(a){var b=g.defer();return b.resolve(f.instant(a)),b.promise},onRegisterApi:function(b){a.gridApi=b}},e.get({id:b.getCurrentUser().id,controller:"fax",controller1:"queues"}).$promise.then(function(b){a.table1.data=b.rows})["finally"](function(){d.socket.on("user_has_fax_queue:save",function(c){c.UserId!=b.getCurrentUser().id||_.find(a.table1.data,{id:c.FaxQueueId})||a.table1.data.push({id:c.FaxQueueId,UserHasFaxQueue:c})}),d.socket.on("user_has_fax_queue:remove",function(c){c.UserId===b.getCurrentUser().id&&_.remove(a.table1.data,{id:c.FaxQueueId})})})["catch"](function(a){console.error(a)}),h.get({controller:"waiting",controller2:"applications"}).$promise.then(function(b){a.table2.data=b.rows})["finally"](function(){d.socket.on("report_fax_session:save",function(b){var c=_.find(a.table2.data,{id:b.id});c?(_.merge(c,b),b.leaveAt&&i(function(){_.remove(a.table2.data,{id:b.id})},1e4)):b.leaveAt||a.table2.data.push(b)}),d.socket.on("report_fax_session:remove",function(b){_.remove(a.table2.data,{id:b.id})})})["catch"](function(a){console.log(a)})},a.initWidget=function(b){var e;switch(b){case"timeout":case"waiting":e=h;break;default:e=c}return e.get({id:b}).$promise.then(function(c){a[b]=c.value,a.charts={interactions:{labels:[f.instant("APPLICATION_DASHBOARD_NEW"),f.instant("APPLICATION_DASHBOARD_OPEN"),f.instant("APPLICATION_DASHBOARD_PENDING"),f.instant("APPLICATION_DASHBOARD_CLOSED")],values:[a["new"],a.open,a.pending,a.closed],colours:["#44B6AE","#578EBE","#35AA47","#8775A7"]}},d.socket.on("report_fax_dashboard:"+b,function(c){a[b]=c.value,a.charts.interactions.values=[a["new"],a.open,a.pending,a.closed]})})["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").controller("DashboardMailCtrl",["$scope","Auth","MailRoom","socket","Agent","$translate","$q","ReportMailSession","$timeout",function(a,b,c,d,e,f,g,h,i){a.Auth=b,a.moment=moment,a["new"]=0,a.open=0,a.pending=0,a.closed=0,a.charts={interactions:{labels:[f.instant("APPLICATION_DASHBOARD_NEW"),f.instant("APPLICATION_DASHBOARD_OPEN"),f.instant("APPLICATION_DASHBOARD_PENDING"),f.instant("APPLICATION_DASHBOARD_CLOSED")],values:[a["new"],a.open,a.pending,a.closed],colours:["#44B6AE","#578EBE","#35AA47","#8775A7"]}},a.initAgent=function(){a.table1={enableGridMenu:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,multiSelect:!0,columnDefs:[{name:"UserHasMailQueue.queue",headerCellFilter:"translate",displayName:"APPLICATION_QUEUE",cellClass:"text-center ui-grid-vcenter"}],data:[],onRegisterApi:function(b){a.gridApi=b}},a.table2={headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,columnDefs:[{name:"roomid",displayName:"APPLICATION_INTERACTION_ID",headerCellFilter:"translate"},{name:"accountname",displayName:"APPLICATION_ACCOUNT_NAME",headerCellFilter:"translate"},{name:"application",displayName:"APPLICATION_APPLICATION",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.application}} <span data-ng-if=\"row.entity.application == 'queue' && row.entity.queuename\">({{row.entity.queuename}})</span></div>"},{name:"status",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span data-ng-if="!row.entity.leaveAt">{{\'APPLICATION_QUEUESTATUS_WAITING\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.complete">{{\'APPLICATION_QUEUESTATUS_COMPLETE\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.timeout">{{\'APPLICATION_TIMEOUT\' | translate}}</span><span data-ng-if="!row.entity.leaveAt"> [<timer start-time="grid.appScope.moment(row.entity.updatedAt).unix()*1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>]</span></div>',enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"membername",displayName:"APPLICATION_AGENT",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.membername || ''}}</span></div>"}],data:[],gridMenuTitleFilter:function(a){var b=g.defer();return b.resolve(f.instant(a)),b.promise},onRegisterApi:function(b){a.gridApi=b,a.gridApi.grid.registerDataChangeCallback(function(){})}},e.get({id:b.getCurrentUser().id,controller:"mail",controller1:"queues"}).$promise.then(function(b){a.table1.data=b.rows})["finally"](function(){d.socket.on("user_has_mail_queue:save",function(c){c.UserId!=b.getCurrentUser().id||_.find(a.table1.data,{id:c.MailQueueId})||a.table1.data.push({id:c.MailQueueId,UserHasMailQueue:c})}),d.socket.on("user_has_mail_queue:remove",function(c){c.UserId===b.getCurrentUser().id&&_.remove(a.table1.data,{id:c.MailQueueId})})})["catch"](function(a){console.error(a)}),h.get({controller:"waiting",controller2:"applications"}).$promise.then(function(b){a.table2.data=b.rows})["finally"](function(){d.socket.on("report_mail_session:save",function(b){var c=_.find(a.table2.data,{id:b.id});c?(_.merge(c,b),b.leaveAt&&i(function(){_.remove(a.table2.data,{id:b.id})},1e4)):b.leaveAt||a.table2.data.push(b)}),d.socket.on("report_mail_session:remove",function(b){_.remove(a.table2.data,{id:b.id})})})["catch"](function(a){console.log(a)})},a.initWidget=function(b){var e;switch(b){case"timeout":case"waiting":e=h;break;default:e=c}return e.get({id:b}).$promise.then(function(c){a[b]=c.value,a.charts={interactions:{labels:[f.instant("APPLICATION_DASHBOARD_NEW"),f.instant("APPLICATION_DASHBOARD_OPEN"),f.instant("APPLICATION_DASHBOARD_PENDING"),f.instant("APPLICATION_DASHBOARD_CLOSED")],values:[a["new"],a.open,a.pending,a.closed],colours:["#44B6AE","#578EBE","#35AA47","#8775A7"]}},d.socket.on("report_mail_dashboard:"+b,function(c){a[b]=c.value,a.charts.interactions.values=[a["new"],a.open,a.pending,a.closed]})})["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").controller("DashboardOpenChannelCtrl",["$scope","Auth","OpenChannelRoom","socket","Agent","$translate","$q","ReportOpenChannelSession","$timeout",function(a,b,c,d,e,f,g,h,i){a.Auth=b,a.moment=moment,a["new"]=0,a.open=0,a.pending=0,a.closed=0,a.initAgent=function(){a.table1={enableGridMenu:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,multiSelect:!0,columnDefs:[{name:"UserHasOpenchannelQueue.queue",headerCellFilter:"translate",displayName:"APPLICATION_QUEUE",cellClass:"text-center ui-grid-vcenter"}],data:[],onRegisterApi:function(b){a.gridApi=b}},a.table2={headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,columnDefs:[{name:"roomid",displayName:"APPLICATION_INTERACTION_ID",headerCellFilter:"translate"},{name:"accountname",displayName:"APPLICATION_ACCOUNT_NAME",headerCellFilter:"translate"},{name:"application",displayName:"APPLICATION_APPLICATION",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.application}} <span data-ng-if=\"row.entity.application == 'queue' && row.entity.queuename\">({{row.entity.queuename}})</span></div>"},{name:"status",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span data-ng-if="!row.entity.leaveAt">{{\'APPLICATION_QUEUESTATUS_WAITING\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.complete">{{\'APPLICATION_QUEUESTATUS_COMPLETE\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.timeout">{{\'APPLICATION_TIMEOUT\' | translate}}</span><span data-ng-if="!row.entity.leaveAt"> [<timer start-time="grid.appScope.moment(row.entity.updatedAt).unix()*1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>]</span></div>',enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"membername",displayName:"APPLICATION_AGENT",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.membername || ''}}</span></div>"}],data:[],gridMenuTitleFilter:function(a){var b=g.defer();return b.resolve(f.instant(a)),b.promise},onRegisterApi:function(b){a.gridApi=b}},e.get({id:b.getCurrentUser().id,controller:"openchannel",controller1:"queues"}).$promise.then(function(b){a.table1.data=b.rows})["finally"](function(){d.socket.on("user_has_openchannel_queue:save",function(c){c.UserId!=b.getCurrentUser().id||_.find(a.table1.data,{id:c.OpenChannelQueueId})||a.table1.data.push({id:c.OpenChannelQueueId,UserHasOpenChannelQueue:c})}),d.socket.on("user_has_openchannel_queue:remove",function(c){c.UserId===b.getCurrentUser().id&&_.remove(a.table1.data,{id:c.OpenChannelQueueId})})})["catch"](function(a){console.error(a)}),h.get({controller:"waiting",controller2:"applications"}).$promise.then(function(b){a.table2.data=b.rows})["finally"](function(){d.socket.on("report_openchannel_session:save",function(b){var c=_.find(a.table2.data,{id:b.id});c?(_.merge(c,b),b.leaveAt&&i(function(){_.remove(a.table2.data,{id:b.id})},1e4)):b.leaveAt||a.table2.data.push(b)}),d.socket.on("report_openchannel_session:remove",function(b){_.remove(a.table2.data,{id:b.id})})})["catch"](function(a){console.log(a)})},a.initWidget=function(b){var e;switch(b){case"timeout":case"waiting":e=h;break;default:e=c}return e.get({id:b}).$promise.then(function(c){a[b]=c.value,a.charts={interactions:{labels:[f.instant("APPLICATION_DASHBOARD_NEW"),f.instant("APPLICATION_DASHBOARD_OPEN"),f.instant("APPLICATION_DASHBOARD_PENDING"),f.instant("APPLICATION_DASHBOARD_CLOSED")],values:[a["new"],a.open,a.pending,a.closed],colours:["#44B6AE","#578EBE","#35AA47","#8775A7"]}},d.socket.on("report_openchannel_dashboard:"+b,function(c){a[b]=c.value,a.charts.interactions.values=[a["new"],a.open,a.pending,a.closed]})})["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").controller("DashboardSmsCtrl",["$scope","Auth","SmsRoom","socket","Agent","$translate","$q","ReportSmsSession","$timeout",function(a,b,c,d,e,f,g,h,i){a.Auth=b,a.moment=moment,a["new"]=0,a.open=0,a.pending=0,a.closed=0,a.initAgent=function(){a.table1={enableGridMenu:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,multiSelect:!0,columnDefs:[{name:"UserHasSmsQueue.queue",headerCellFilter:"translate",displayName:"APPLICATION_QUEUE",cellClass:"text-center ui-grid-vcenter"}],data:[],onRegisterApi:function(b){a.gridApi=b}},a.table2={headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,columnDefs:[{name:"roomid",displayName:"APPLICATION_INTERACTION_ID",headerCellFilter:"translate"},{name:"accountname",displayName:"APPLICATION_ACCOUNT_NAME",headerCellFilter:"translate"},{name:"application",displayName:"APPLICATION_APPLICATION",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.application}} <span data-ng-if=\"row.entity.application == 'queue' && row.entity.queuename\">({{row.entity.queuename}})</span></div>"},{name:"status",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span data-ng-if="!row.entity.leaveAt">{{\'APPLICATION_QUEUESTATUS_WAITING\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.complete">{{\'APPLICATION_QUEUESTATUS_COMPLETE\' | translate}}</span><span data-ng-if="row.entity.leaveAt && row.entity.timeout">{{\'APPLICATION_TIMEOUT\' | translate}}</span><span data-ng-if="!row.entity.leaveAt"> [<timer start-time="grid.appScope.moment(row.entity.updatedAt).unix()*1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>]</span></div>',enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"membername",displayName:"APPLICATION_AGENT",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.membername || ''}}</span></div>"
-}],data:[],gridMenuTitleFilter:function(a){var b=g.defer();return b.resolve(f.instant(a)),b.promise},onRegisterApi:function(b){a.gridApi=b}},e.get({id:b.getCurrentUser().id,controller:"sms",controller1:"queues"}).$promise.then(function(b){a.table1.data=b.rows})["finally"](function(){d.socket.on("user_has_sms_queue:save",function(c){c.UserId!=b.getCurrentUser().id||_.find(a.table1.data,{id:c.SmsQueueId})||a.table1.data.push({id:c.SmsQueueId,UserHasSmsQueue:c})}),d.socket.on("user_has_sms_queue:remove",function(c){c.UserId===b.getCurrentUser().id&&_.remove(a.table1.data,{id:c.SmsQueueId})})})["catch"](function(a){console.error(a)}),h.get({controller:"waiting",controller2:"applications"}).$promise.then(function(b){a.table2.data=b.rows})["finally"](function(){d.socket.on("report_sms_session:save",function(b){var c=_.find(a.table2.data,{id:b.id});c?(_.merge(c,b),b.leaveAt&&i(function(){_.remove(a.table2.data,{id:b.id})},1e4)):b.leaveAt||a.table2.data.push(b)}),d.socket.on("report_sms_session:remove",function(b){_.remove(a.table2.data,{id:b.id})})})["catch"](function(a){console.log(a)})},a.initWidget=function(b){var e;switch(b){case"timeout":case"waiting":e=h;break;default:e=c}return e.get({id:b}).$promise.then(function(c){a[b]=c.value,a.charts={interactions:{labels:[f.instant("APPLICATION_DASHBOARD_NEW"),f.instant("APPLICATION_DASHBOARD_OPEN"),f.instant("APPLICATION_DASHBOARD_PENDING"),f.instant("APPLICATION_DASHBOARD_CLOSED")],values:[a["new"],a.open,a.pending,a.closed],colours:["#44B6AE","#578EBE","#35AA47","#8775A7"]}},d.socket.on("report_sms_dashboard:"+b,function(c){a[b]=c.value,a.charts.interactions.values=[a["new"],a.open,a.pending,a.closed]})})["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").controller("DashboardVoiceCtrl",["$scope","$rootScope","$timeout","Auth","ReportQueue","ReportCall","Agent","VoiceQueue","Dashboard","socket",function(a,b,c,d,e,f,g,h,i,j){a.radioSwitch={size:"mini",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"success",onColor:"danger"};var k=function(a,b){var c=a?30*a+120:177;angular.element(document.getElementsByName(b)[0]).css("height",c+"px")};a.initUser=function(){var b;if(a.user=d.getCurrentUser(),a.voice={},a.$on("$destroy",function(){b&&(b.terminate(),j.socket.removeAllListeners("dashboard:voice:waiting"),j.socket.removeAllListeners("dashboard:voice:active"),j.socket.removeAllListeners("dashboard:voice:complete"),j.socket.removeAllListeners("dashboard:voice:abandon"),j.socket.removeAllListeners("dashboard:voice:unmanaged"),j.socket.removeAllListeners("dashboard:voice:holdtime"),j.socket.removeAllListeners("dashboard:voice:talktime"))}),a.onmessage=function(b){a.voice=b.data,a.$apply()},window.Worker){switch(b=new Worker("assets/workers/dashboard/voice/worker.js"),a.user.role){case"admin":h.get().$promise.then(function(a){b.postMessage({evt:"myQueues",queues:a.rows})})["catch"](function(a){console.error(a)});break;case"user":b.postMessage({evt:"myQueues",queues:a.user.PVoiceQueues})}b.onmessage=a.onmessage}i.get({id:"voice",controller:"init"}).$promise.then(function(a){a.evt="dashboard:voice:init",b.postMessage(a)})["catch"](function(a){console.error(a)}),j.socket.on("dashboard:voice:waiting",function(a){a.evt="dashboard:voice:waiting",b.postMessage(a)}),j.socket.on("dashboard:voice:active",function(a){a.evt="dashboard:voice:active",b.postMessage(a)}),j.socket.on("dashboard:voice:complete",function(a){a.evt="dashboard:voice:complete",b.postMessage(a)}),j.socket.on("dashboard:voice:abandon",function(a){a.evt="dashboard:voice:abandon",b.postMessage(a)}),j.socket.on("dashboard:voice:unmanaged",function(a){a.evt="dashboard:voice:unmanaged",b.postMessage(a)}),j.socket.on("dashboard:voice:talktime",function(a){a.evt="dashboard:voice:talktime",b.postMessage(a)}),j.socket.on("dashboard:voice:holdtime",function(a){a.evt="dashboard:voice:holdtime",b.postMessage(a)}),j.socket.on("dashboard:voice:outbound",function(a){a.evt="dashboard:voice:outbound",b.postMessage(a)})},a.initAgent=function(){return a.agent=d.getCurrentUser(),j.socket.on("voice:queue:agent:join",function(b){b.loggedAt=moment().format("YYYY-MM-DD HH:mm:ss"),b.callstaken=0,a.table1.data.push(b)}),j.socket.on("voice:queue:agent:leave",function(b){_.remove(a.table1.data,{queue:b.queue})}),a.table1={enableGridMenu:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,multiSelect:!0,columnDefs:[{name:"queue",headerCellFilter:"translate",displayName:"APPLICATION_QUEUE",cellClass:"text-center ui-grid-vcenter"},{name:"loggedAt",displayName:"logged At",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span am-time-ago="row.entity.loggedAt"></span></div>'},{name:"lastcall",headerCellFilter:"translate",displayName:"APPLICATION_LAST_CALL",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span am-time-ago="row.entity.lastcall"></span></div>'},{name:"callstaken",headerCellFilter:"translate",displayName:"APPLICATION_CALLS_TAKEN",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div><span>{{row.entity.callstaken || 0}}</span></div>"}],data:[],onRegisterApi:function(b){a.gridApi=b,a.gridApi.grid.registerDataChangeCallback(function(){k(a.gridApi.core.getVisibleRows(a.gridApi.grid).length,"table1")})}},a.table2={enableGridMenu:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,multiSelect:!1,columnDefs:[{name:"queue",displayName:"APPLICATION_QUEUE",headerCellFilter:"translate"},{name:"status",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div><span>{{'APPLICATION_QUEUESTATUS_WAITING' | translate}}</span>[<timer start-time=\"grid.appScope.moment(row.entity.updatedAt).unix()*1000\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>]</div>",enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"caller",displayName:"APPLICATION_CALLER",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.calleridnum || ''}} {{row.entity.calleridname || ''}}</span></div>",enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"position",displayName:"APPLICATION_POSITION",headerCellFilter:"translate"},{name:"agent",displayName:"APPLICATION_AGENT",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.connectedlinenum || ''}} {{row.entity.connectedlinename || ''}}</span></div>",enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1}],data:[],onRegisterApi:function(b){a.gridApi1=b,a.gridApi1.grid.registerDataChangeCallback(function(){k(a.gridApi1.core.getVisibleRows(a.gridApi1.grid).length,"table2")})}},a.table3={exporterCsvFilename:"abandoned_calls.csv",enableRowHeaderSelection:!0,paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!1,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,enableSelectAll:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:1,columnDefs:[{name:"queue",displayName:"APPLICATION_QUEUE",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter"},{name:"caller",displayName:"APPLICATION_CALLER",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.calleridnum || ''}} {{row.entity.calleridname || ''}}</div>"},{name:"createdAt",displayName:"APPLICATION_DATE",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.updatedAt | date:'yyyy-MM-dd HH:mm:ss'}}</div>"},{name:"lastAssignedTo",cellClass:"text-center ui-grid-vcenter",displayName:"APPLICATION_LAST_ASSIGNED_TO",headerCellFilter:"translate"},{name:"assigned",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellTemplate:'<div class="centered-uigrid-td"><input data-ng-change="grid.appScope.updateItem(row.entity)", bs-switch ng-model="row.entity.assigned" type="checkbox" switch-active="{{ !row.entity.assigned || grid.appScope.agent.name === row.entity.lastAssignedTo }}" switch-on-text="{{ \'APPLICATION_ASSIGNED\' | translate }}" switch-off-text="{{ \'APPLICATION_FREE\' | translate }}" switch-on-color="{{ grid.appScope.radioSwitch.onColor }}" switch-off-color="{{ grid.appScope.radioSwitch.offColor }}" switch-animate="{{ grid.appScope.radioSwitch.animate }}" switch-size="{{ grid.appScope.radioSwitch.size }}" switch-label="{{ grid.appScope.radioSwitch.label }}" switch-icon="{{ grid.appScope.radioSwitch.icon }}" switch-radio-off="{{ grid.appScope.radioSwitch.radioOff }}" switch-label-width="{{ grid.appScope.radioSwitch.labelWidth }}" switch-handle-width="{{ grid.appScope.radioSwitch.handleWidth }}"></div>',enableFiltering:!1}],data:[],onRegisterApi:function(b){a.gridApi2=b,a.gridApi2.grid.registerDataChangeCallback(function(){k(a.gridApi2.core.getVisibleRows(a.gridApi2.grid).length,"table3")})}},g.get({id:d.getCurrentUser().id,controller:"voice",controller1:"queues"}).$promise.then(function(b){a.table1.data=_.map(b.rows,function(a){return{queue:a.UserHasVoiceQueue.queue,loggedAt:a.UserHasVoiceQueue.loggedAt,callstaken:a.UserHasVoiceQueue.callstaken,lastcall:a.UserHasVoiceQueue.lastcall}})})["finally"](function(){j.socket.on("voice:queue:update",function(b){var c=_.find(a.table1.data,{queue:b.queue});c?_.merge(c,b):a.table1.data.push(b)}),j.socket.on("user_has_voice_queue:remove",function(b){b.UserId===d.getCurrentUser().id&&_.remove(a.table1.data,{name:b.queue})})})["catch"](function(a){console.error(a)}),e.get({id:"waiting",controller:"calls"}).$promise.then(function(b){a.table2.data=b.rows})["finally"](function(){j.socket.on("report_queue:save",function(b){a.table2.data.push(b)}),j.socket.on("report_queue:update",function(b){var c=_.find(a.table2.data,{id:b.id});c&&b.queuecallerleaveAt&&_.remove(a.table2.data,{id:b.id})})})["catch"](function(a){console.error(a)}),e.get({controller:"abandoned",controller2:"all"}).$promise.then(function(b){a.table3.data=b.rows})["catch"](function(a){console.error(a)})["finally"](function(){j.socket.on("report_queue:save",function(b){a.table3.data.unshift(b)}),j.socket.on("report_queue:update",function(b){var c=_.find(a.table3.data,{id:b.id});c&&_.merge(c,b)})})},a.updateItem=function(b){return e.update({id:b.id},{assigned:b.assigned,lastAssignedTo:b.assigned?a.agent.name:void 0}).$promise["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.desk",{url:"/desk",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").factory("DeskAccount",["$resource",function(a){return a("/api/desk/accounts/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("DeskListCtrl",["$scope","$http","$rootScope","xAlert","$translate","socket","Modal","stResource",function(a,b,c,d,e,f,g,h){a.conf={accountsByPage:{name:"10",value:10}},a.accountsByPage=[{name:"10",value:10},{name:"25",value:25},{name:"50",value:50},{name:"All",value:0}],a.accounts={checked:[]},a.check=function(b,c){c?a.accounts.checked=angular.copy(_.map(a.displayedDeskAccounts,"id")):a.accounts.checked=[]},a.getAccounts=function(b){return _.map(a.displayedDeskAccounts,function(a){var c={};return b.forEach(function(b){c[b]=a[b]}),c})},a.initList=function(b){f.unsyncUpdates("desk_account"),b.url="/api/desk/accounts",h.getPage(b).then(function(d){a.displayedDeskAccounts=d.rows,b.pagination.numberOfPages=d.total_pages,c.updateTableConfig(a.accountsByPage,a.displayedDeskAccounts.length),c.updateTableConfig(a.conf.accountsByPage,a.displayedDeskAccounts.length)}),f.socket.on("desk_account:save",function(){a.initList(b)}),f.socket.on("desk_account:remove",function(c){a.accounts.checked=_.without(a.accounts.checked,c.id),a.initList(b)})},a.deleteItem=g.confirm["delete"](function(a){b["delete"]("/api/desk/accounts/"+a).success(function(){d.show(e.instant("MESSAGE_WELL_DONE")+"!","success")}).error(function(a){d.error(a)})}),a.deleteItems=g.confirm["delete"](function(){b["delete"]("/api/desk/accounts",{params:{id:a.accounts.checked}}).success(function(){d.show(e.instant("MESSAGE_WELL_DONE"),"success")}).error(function(a){d.error(a)})}),a.checkAccount=function(a){b.get("/api/desk/accounts/"+a+"/check").then(function(){d.show(e.instant("MESSAGE_ACCOUNT_VERIFIED"),"success")})["catch"](function(){d.show(e.instant("MESSAGE_ACCOUNT_INVALID"),"danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.desk.list",{url:"/list",templateUrl:"app/desk/list/list.html",controller:"DeskListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("DeskViewCtrl",["$scope","$http","$stateParams","$translate","$location","WizardHandler","socket","xAlert","Modal","desk_com",function(a,b,c,d,e,f,g,h,i,j){a.$stateParams=c,a.config={autoHideScrollbar:!1,theme:"dark",advanced:{updateOnContentResize:!0},setHeight:500,scrollInertia:0},a.initConfiguration=function(){a.formsConfiguration={},a.configuration={}},a.goNext=function(){f.wizard().next()},a.formValidation=function(a){return a},a.$on("$destroy",function(){g.unsyncUpdates("desk_configuration"),g.unsyncUpdates("desk_field")}),a.initView=function(){b.get("/api/desk/accounts/"+c.id).success(function(b){a.account=b}).error(function(a){h.error(a)})},a.updateItem=function(){b.put("/api/desk/accounts/"+c.id,a.account).success(function(){h.show(d.instant("MESSAGE_WELL_DONE")+".","success")}).error(function(){h.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.getConfigurations=function(){b.get("/api/desk/configurations",{params:{AccountId:c.id}}).success(function(b){a.configurations=b,g.socket.on("desk_configuration:remove",function(b){_.remove(a.configurations,{id:b.id})})}).error(function(a){h.error(a)})},a.deleteConfiguration=i.confirm["delete"](function(a){b["delete"]("api/desk/configurations/"+a).success(function(){h.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){h.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})}),a.createConfiguration=function(){a.configuration.AccountId=c.id,b.post("api/desk/configurations",a.configuration).success(function(a){e.path("desk/view/"+c.id+"/configurations/settings/"+a.id)}).error(function(){h.show("Something went wrong!","danger")})},a.fieldType=["string","variable"],a.descFieldType=["string","key_value"],a.getFields=function(){b.get("/api/desk/accounts/"+c.id+"/fields").success(function(b){a.accountFields=j.fields.concat(b)}).error(function(a){h.error(a)})},a.getConfiguration=function(){b.get("/api/desk/configurations/"+c.configurationId).success(function(b){a.configurationName=b.name,a.subjectConfig=b.Subject,a.descriptionConfig=b.Description,a.fieldConfig=b.Field,g.socket.on("desk_field:remove",function(b){_.remove(a.subjectConfig,{id:b.id}),_.remove(a.descriptionConfig,{id:b.id}),_.remove(a.fieldConfig,{id:b.id})})}).error(function(a){h.error(a)})},a.getVariables=function(){b.get("/api/variables").success(function(b){a.variables=b.rows}).error(function(a){h.error(a)})},a.removeItem=function(a){b["delete"]("api/desk/fields/"+a.id).success(function(){h.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){h.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})},a.addItemSubject=function(){var d={type:"string",content:""};b.post("/api/desk/configurations/"+c.configurationId+"/subject",d).success(function(b){a.subjectConfig.push(b)}).error(function(){h.show("Something went wrong!","danger")})},a.addItemDescription=function(){var d={type:"string",content:""};b.post("/api/desk/configurations/"+c.configurationId+"/description",d).success(function(b){a.descriptionConfig.push(b)}).error(function(){h.show("Something went wrong!","danger")})},a.addItemField=function(){var d={content:""};b.post("/api/desk/configurations/"+c.configurationId+"/field",d).success(function(b){a.fieldConfig.push(b)}).error(function(){h.show("Something went wrong!","danger")})},a.updateField=function(a){b.put("/api/desk/fields/"+a.id,a).success(function(){}).error(function(){h.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.changeType=function(b){"variable"===b.type?b.content="":"string"===b.type&&(b.VariableId=null),a.updateField(b)},a.changeDescType=function(b){"key_value"===b.type?(b.content="","string"===b.keyType?b.VariableId=null:"variable"===b.keyType&&(b.keyContent="")):"string"===b.type&&(b.VariableId=null,b.key="",b.keyContent=""),a.updateField(b)},a.changeFieldType=function(b){if(b.content="",b.idField){var c=_.find(a.accountFields,"id",b.idField);c&&(b.customField=_.result(c,"custom",!0))}a.updateField(b)},a.getSystemFieldOptions=function(b){if(b){var c=_.find(a.accountFields,"id",b);return c?c.data.choices?c.data.choices:null:void 0}}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.desk.view",{url:"/view/:id",templateUrl:"app/desk/view/view.html",controller:"DeskViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.desk.view.account",{url:"/account",templateUrl:"app/desk/view/view.account.html"}).state("main.desk.view.configurations",{url:"/configurations",templateUrl:"app/desk/view/view.configurations.html"}).state("main.desk.view.configurations.settings",{url:"/settings/:configurationId",templateUrl:"app/desk/view/view.configurationSettings.html",controller:"DeskViewCtrl"}).state("main.desk.view.configuration",{url:"/configuration",templateUrl:"app/desk/view/view.configuration.html"})}]),angular.module("xCallyShuttleApp").controller("DeskWizardCtrl",["$scope","$http","$location","$translate","xAlert","WizardHandler",function(a,b,c,d,e,f){a.translate=d,a.initWizard=function(){a.$translate=d,a.forms={},a.item={}},a.next=function(){f.wizard().next()},a.exitValidation=function(a){return a},a.createItem=function(){console.log(a.item),b.post("api/desk/accounts",a.item).success(function(){e.show(d.instant("MESSAGE_WELL_DONE")+".","success"),c.path("/desk/list")}).error(function(){e.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.desk.wizard",{url:"/wizard",templateUrl:"app/desk/wizard/wizard.html",controller:"DeskWizardCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.freshdesk",{url:"/freshdesk",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").factory("FreshdeskAccount",["$resource",function(a){return a("/api/freshdesk/accounts/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("FreshdeskListCtrl",["$scope","$http","$rootScope","xAlert","$translate","socket","Modal","stResource",function(a,b,c,d,e,f,g,h){a.conf={accountsByPage:{name:"10",value:10}},a.accountsByPage=[{name:"10",value:10},{name:"25",value:25},{name:"50",value:50},{name:"All",value:0}],a.accounts={checked:[]},a.check=function(b,c){c?a.accounts.checked=angular.copy(_.map(a.displayedFreshdeskAccounts,"id")):a.accounts.checked=[]},a.getAccounts=function(b){return _.map(a.displayedFreshdeskAccounts,function(a){var c={};return b.forEach(function(b){c[b]=a[b]}),c})},a.initList=function(b){f.unsyncUpdates("freshdesk_account"),b.url="/api/freshdesk/accounts",h.getPage(b).then(function(d){a.displayedFreshdeskAccounts=d.rows,b.pagination.numberOfPages=d.total_pages,c.updateTableConfig(a.accountsByPage,a.displayedFreshdeskAccounts.length),c.updateTableConfig(a.conf.accountsByPage,a.displayedFreshdeskAccounts.length)}),f.socket.on("freshdesk_account:save",function(){a.initList(b)}),f.socket.on("freshdesk_account:remove",function(c){a.accounts.checked=_.without(a.accounts.checked,c.id),a.initList(b)})},a.deleteItem=g.confirm["delete"](function(a){b["delete"]("/api/freshdesk/accounts/"+a).success(function(){d.show(e.instant("MESSAGE_WELL_DONE")+"!","success")}).error(function(a){d.error(a)})}),a.deleteItems=g.confirm["delete"](function(){b["delete"]("/api/freshdesk/accounts",{params:{id:a.accounts.checked}}).success(function(){d.show(e.instant("MESSAGE_WELL_DONE"),"success")}).error(function(a){d.error(a)})}),a.checkAccount=function(a){b.get("/api/freshdesk/accounts/"+a+"/check").then(function(){d.show(e.instant("MESSAGE_ACCOUNT_VERIFIED"),"success")})["catch"](function(){d.show(e.instant("MESSAGE_ACCOUNT_INVALID"),"danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.freshdesk.list",{url:"/list",templateUrl:"app/freshdesk/list/list.html",controller:"FreshdeskListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("FreshdeskViewCtrl",["$scope","$http","$stateParams","$translate","$location","$filter","WizardHandler","socket","xAlert","Modal",function(a,b,c,d,e,f,g,h,i,j){a.$stateParams=c,a.config={autoHideScrollbar:!1,theme:"dark",advanced:{updateOnContentResize:!0},setHeight:500,scrollInertia:0},a.initConfiguration=function(){a.formsConfiguration={},a.configuration={}},a.goNext=function(){g.wizard().next()},a.formValidation=function(a){return a},a.$on("$destroy",function(){h.unsyncUpdates("freshdesk_configuration"),h.unsyncUpdates("freshdesk_field")}),a.initView=function(){b.get("/api/freshdesk/accounts/"+c.id).success(function(b){a.account=b}).error(function(a){i.error(a)})},a.updateItem=function(){b.put("/api/freshdesk/accounts/"+c.id,a.account).success(function(){i.show(d.instant("MESSAGE_WELL_DONE")+".","success")}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.getConfigurations=function(){b.get("/api/freshdesk/configurations",{params:{AccountId:c.id}}).success(function(b){a.configurations=b,h.socket.on("freshdesk_configuration:remove",function(b){_.remove(a.configurations,{id:b.id})})}).error(function(a){i.error(a)})},a.deleteConfiguration=j.confirm["delete"](function(a){b["delete"]("api/freshdesk/configurations/"+a).success(function(){i.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})}),a.createConfiguration=function(){a.configuration.AccountId=c.id,b.post("api/freshdesk/configurations",a.configuration).success(function(a){e.path("freshdesk/view/"+c.id+"/configurations/settings/"+a.id)}).error(function(){i.show("Something went wrong!","danger")})},a.fieldType=["string","variable"],a.descFieldType=["string","key_value"],a.getFields=function(){b.get("/api/freshdesk/accounts/"+c.id+"/fields").success(function(b){a.accountFields=[],b=f("freshdesk")(b),_.forEach(b,function(b){a.accountFields.push(b.ticket_field)})}).error(function(a){i.error(a)})},a.getConfiguration=function(){b.get("/api/freshdesk/configurations/"+c.configurationId).success(function(b){a.configurationName=b.name,a.subjectConfig=b.Subject,a.descriptionConfig=b.Description,a.fieldConfig=b.Field,h.socket.on("freshdesk_field:remove",function(b){_.remove(a.subjectConfig,{id:b.id}),_.remove(a.descriptionConfig,{id:b.id}),_.remove(a.fieldConfig,{id:b.id})})}).error(function(a){i.error(a)})},a.getVariables=function(){b.get("/api/variables").success(function(b){a.variables=b.rows}).error(function(a){i.error(a)})},a.removeItem=function(a){b["delete"]("api/freshdesk/fields/"+a.id).success(function(){i.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})},a.addItemSubject=function(){var d={type:"string",content:""};b.post("/api/freshdesk/configurations/"+c.configurationId+"/subject",d).success(function(b){a.subjectConfig.push(b)}).error(function(){i.show("Something went wrong!","danger")})},a.addItemDescription=function(){var d={type:"string",content:""};b.post("/api/freshdesk/configurations/"+c.configurationId+"/description",d).success(function(b){a.descriptionConfig.push(b)}).error(function(){i.show("Something went wrong!","danger")})},a.addItemField=function(){var d={content:""};b.post("/api/freshdesk/configurations/"+c.configurationId+"/field",d).success(function(b){a.fieldConfig.push(b)}).error(function(){i.show("Something went wrong!","danger")})},a.updateField=function(a){b.put("/api/freshdesk/fields/"+a.id,a).success(function(){}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.changeType=function(b){"variable"===b.type?b.content="":"string"===b.type&&(b.VariableId=null),a.updateField(b)},a.changeDescType=function(b){"key_value"===b.type?(b.content="","string"===b.keyType?b.VariableId=null:"variable"===b.keyType&&(b.keyContent="")):"string"===b.type&&(b.VariableId=null,b.key="",b.keyContent=""),a.updateField(b)},a.changeFieldType=function(b){if(b.content="",b.idField){var c=_.find(a.accountFields,"name",b.idField);c&&(b.customField=!_.result(c,"default",!0))}a.updateField(b)},a.getSystemFieldOptions=function(b){if(b){var c=_.find(a.accountFields,"name",b);return c?c.choices.length>0?c.choices:null:void 0}}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.freshdesk.view",{url:"/view/:id",templateUrl:"app/freshdesk/view/view.html",controller:"FreshdeskViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.freshdesk.view.account",{url:"/account",templateUrl:"app/freshdesk/view/view.account.html"}).state("main.freshdesk.view.configurations",{url:"/configurations",templateUrl:"app/freshdesk/view/view.configurations.html"}).state("main.freshdesk.view.configurations.settings",{url:"/settings/:configurationId",templateUrl:"app/freshdesk/view/view.configurationSettings.html",controller:"FreshdeskViewCtrl"}).state("main.freshdesk.view.configuration",{url:"/configuration",templateUrl:"app/freshdesk/view/view.configuration.html"})}]),angular.module("xCallyShuttleApp").controller("FreshdeskWizardCtrl",["$scope","$http","$location","$translate","xAlert","WizardHandler",function(a,b,c,d,e,f){a.translate=d,a.initWizard=function(){a.$translate=d,a.forms={},a.item={}},a.next=function(){f.wizard().next()},a.exitValidation=function(a){return a},a.createItem=function(){console.log(a.item),b.post("api/freshdesk/accounts",a.item).success(function(){e.show(d.instant("MESSAGE_WELL_DONE")+".","success"),c.path("/freshdesk/list")}).error(function(){e.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.freshdesk.wizard",{url:"/wizard",templateUrl:"app/freshdesk/wizard/wizard.html",controller:"FreshdeskWizardCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.iframe",{url:"/iframe",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("IframeViewCtrl",["$scope","Auth","Integration","xAlert","$translate","$sce",function(a,b,c,d,e,f){a.Auth=b,a.initView=function(){return c.get({state:"iframe"}).$promise.then(function(c){a.iframe=_.first(c.rows),a.iframe.remoteUri?a.url=f.trustAsResourceUrl(a.iframe.remoteUri):b.isAgent()&&d.show(e.instant("MESSAGE_NO_IFRAME_CONFIGURED")+".","danger")})["catch"](function(a){d.error(a)})},a.updateItem=function(){return b.isAgent()?void 0:c.update({id:a.iframe.id},a.iframe).$promise.then(function(){d.show(e.instant("MESSAGE_WELL_DONE")+".","success")})["catch"](function(a){d.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.iframe.view",{url:"/view",templateUrl:"app/iframe/view/view.html",controller:"IframeViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("Integration",["$resource",function(a){return a("/api/integrations/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.integrations",{url:"/integrations",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:19}}})}]),angular.module("xCallyShuttleApp").controller("IntegrationListCtrl",["$scope","Modal","socket","FileUploader","Integration","xAlert",function(a,b,c,d,e,f){a.integrationsByPage=10;var g=a.uploader=new d({url:"api/integrations",autoUpload:!0,removeAfterUpload:!0});g.filters.push({name:"zipFilter",fn:function(a){var b="|"+a.type.slice(a.type.lastIndexOf("/")+1)+"|";return-1!=="|zip|".indexOf(b)}}),g.onSuccessItem=function(a,b,c,d){console.info("onSuccessItem",a,b,c,d),f.show(b.name,"success")},g.onErrorItem=function(a,b,c,d){console.info("onErrorItem",a,b,c,d),b.errors.forEach(function(a){f.error(err)})},a.deleteItem=b.confirm["delete"](function(a){e["delete"]({id:a},function(){f.show("Integration Removed","success")},function(a){f.error(a)})}),a.initList=function(){a.integrations=e.query({},function(a){c.syncUpdates("integration",a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.integrations.list",{url:"/list",templateUrl:"app/integration/list/list.html",controller:"IntegrationListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"]})}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.jscripty",{url:"/jscripty",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").factory("JscriptyProject",["$resource",function(a){return a("/api/jscripty/projects/:id/:controller/:action/:action2",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("JscriptyProjectListCtrl",["$scope","$uibModal","JscriptyProject","gridOptions","Auth",function(a,b,c,d,e){a.isAdmin=e.isAdmin(),a.initView=function(){var b={exporterCsvFilename:"jscriptyProjects.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:300,buttons:[{"class":"blue-hoki",icon:"icon-settings",href:"/jscripty/projects/view/{{row.entity.id}}",hide:!e.isAdmin()},{"class":" green-turquoise",icon:"fa fa-play",onClick:"grid.appScope.openJscriptyTab(row.entity)"},{"class":"purple",icon:"icon-book-open",href:"/jscripty/projects/report/{{row.entity.id}}/sessions",hide:!e.isAdmin()},{"class":"red-sunglo",icon:"fa fa-trash",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)",hide:!e.isAdmin()}]}]};a.gridOptions=d.gridOptions(c,b,a)},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/jscripty/project/list/list.create.modal.html",controller:"JscriptyProjectListCreateCtrl"});c.result.then(function(b){console.log(b),a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("JscriptyProjectListCreateCtrl",["$scope","$translate","$uibModalInstance","JscriptyProject","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){console.log(a),e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.jscripty.projects.list",{url:"/list",templateUrl:"app/jscripty/project/list/list.html",controller:"JscriptyProjectListCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.jscripty.projects",{url:"/projects",
-template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("JscriptyProjectReportCtrl",["$scope","uiGridConstants","$http","$state","$stateParams","socket","Auth","Modal","xAlert","$translate","$rootScope","gridOptions","JscriptyProject","$location",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){a.projectStats={started:0,incomplete:0,completed:0},a.projectId=e.id,a.initView=function(){m.get({id:e.id}).$promise.then(function(b){a.project=b})["catch"](function(a){i.error(a)}),m.get({id:e.id,controller:"sessions"}).$promise.then(function(b){var c=_.groupBy(b.rows,"status");a.projectStats.started=c.started?c.started.length:0,a.projectStats.completed=c.completed?c.completed.length:0,a.projectStats.incomplete=c.incomplete?c.incomplete.length:0})["catch"](function(a){i.error(a)})},a.pdf=function(a,b){var c=[];if(a){var d=html2canvas(document.getElementById(a)),e=d.parse(),f=d.render(e),g=f.toDataURL("image/png");c.push({image:g,width:500,style:"img"})}b.length&&_.forEach(b,function(a){var b=html2canvas(document.getElementById(a.question_id)),d=b.parse(),e=b.render(d),f=e.toDataURL("image/png");c.push({image:f,width:500,style:"img"})});var h={content:c};pdfMake.createPdf(h).download("Project_summary.pdf")},a.getProjectSessions=function(){var c={exporterCsvFilename:"jscriptyProjects.csv",columnDefs:[{name:"session_id",displayName:"APPLICATION_SESSIONID"},{name:"queue",displayName:"APPLICATION_QUEUE"},{name:"membername",displayName:"APPLICATION_AGENT"},{name:"calleridnum",displayName:"APPLICATION_CALLERIDNUM"},{name:"createdAt",displayName:"APPLICATION_STARTEDAT",filterHeaderTemplate:'<div class="ui-grid-filter-container row"><div ng-repeat="colFilter in col.filters" class="col-md-6 col-md-offset-0 col-sm-5 col-sm-offset-0 col-xs-5 col-xs-offset-0"><div custom-grid-date-filter-header></div></div></div>',filters:[{name:"From",condition:b.filter.GREATER_THAN_OR_EQUAL},{name:"To",condition:b.filter.LESS_THAN_OR_EQUAL}]},{name:"completedAt",displayName:"APPLICATION_COMPLETEDAT",filterHeaderTemplate:'<div class="ui-grid-filter-container row"><div ng-repeat="colFilter in col.filters" class="col-md-6 col-md-offset-0 col-sm-5 col-sm-offset-0 col-xs-5 col-xs-offset-0"><div custom-grid-date-filter-header></div></div></div>',filters:[{name:"From",condition:b.filter.GREATER_THAN_OR_EQUAL},{name:"To",condition:b.filter.LESS_THAN_OR_EQUAL}]},{name:"status",displayName:"APPLICATION_STATUS"},{name:"last_question_id",displayName:"APPLICATION_LASTQUESTIONID"},{name:"action",width:100,buttons:[{"class":"blue-hoki",href:"/jscripty/projects/report/{{row.entity.projectId}}/session/{{row.entity.session_id}}",name:"Detail"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteSession(row.entity.session_id)"}]}]};a.gridOptions=l.gridOptions(m,c,a,{id:e.id,controller:"sessions"})},a.deleteSession=function(b){m["delete"]({id:e.id,controller:"sessions",action:b}).$promise.then(function(b){a.gridOptions.getPage(),a.initView(),i.show(j.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){i.error(a)})},a.getSessionDetails=function(){m.get({id:e.id,controller:"sessions",action:e.sessionId}).$promise.then(function(b){a.session=b,a.sessionQuestions=b.ReportJscriptyQuestions})["catch"](function(a){i.error(a)})},a.getQuestionSummary=function(){var b={exporterCsvFilename:"jscriptyProjects.csv",columnDefs:[{name:"question_id",displayName:"APPLICATION_QUESTIONID"},{name:"question_type",displayName:"APPLICATION_QUESTIONTYPE"},{name:"question_label",displayName:"APPLICATION_QUESTIONLABEL"},{name:"question_text",displayName:"APPLICATION_QUESTION"},{name:"count",displayName:"APPLICATION_COUNT",enableFiltering:!1},{name:"action",width:100,buttons:[{"class":"blue-hoki",href:"/jscripty/projects/report/"+e.id+"/detail/{{row.entity.question_id}}",name:"Detail"}]}]};a.gridOptions=l.gridOptions(m,b,a,{id:e.id,controller:"questions",action:"summary"})},a.getQuestionInputs=function(){var b={exporterCsvFilename:"jscriptyProjects.csv",columnDefs:[{name:"session_id",displayName:"APPLICATION_SESSIONID"},{name:"question_id",displayName:"APPLICATION_QUESTIONID",enableFiltering:!1},{name:"question_label",displayName:"APPLICATION_QUESTIONLABEL",enableFiltering:!1},{name:"question_text",displayName:"APPLICATION_QUESTION",enableFiltering:!1},{name:"input_label",displayName:"APPLICATION_INPUTLABEL",enableFiltering:!1},{name:"input_value",cellTemplate:'<div uib-tooltip="{{row.entity.input_value}}">{{row.entity.input_value}}</div>',displayName:"APPLICATION_INPUTVALUE",enableFiltering:!1}]};a.gridOptions=l.gridOptions(m,b,a,{id:e.id,controller:"inputs"})},a.getProjectDetail=function(){a.projectDetail=[],m.query({id:e.id,controller:"questions",action:"detail"}).$promise.then(function(b){console.log(e.questionId),e.questionId?a.projectDetail.push(_.find(b,function(a){return a.question_id==parseInt(e.questionId)})):a.projectDetail=b,console.log(a.projectDetail)})["catch"](function(a){i.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.jscripty.projects.report",{url:"/report/:id",templateUrl:"app/jscripty/project/report/report.html",controller:"JscriptyProjectReportCtrl"}).state("main.jscripty.projects.report.sessions",{url:"/sessions",templateUrl:"app/jscripty/project/report/report.sessions.html"}).state("main.jscripty.projects.report.summary",{url:"/summary",templateUrl:"app/jscripty/project/report/report.summary.html"}).state("main.jscripty.projects.report.inputs",{url:"/inputs",templateUrl:"app/jscripty/project/report/report.inputs.html"}).state("main.jscripty.projects.report.detail",{url:"/detail",templateUrl:"app/jscripty/project/report/report.detail.html"}).state("main.jscripty.projects.report.questionDetail",{url:"/detail/:questionId",controller:"JscriptyProjectReportCtrl",templateUrl:"app/jscripty/project/report/report.detail.html"}).state("main.jscripty.projects.report.sessionDetail",{url:"/session/:sessionId",controller:"JscriptyProjectReportCtrl",templateUrl:"app/jscripty/project/report/report.session.detail.html"})}]),angular.module("xCallyShuttleApp").controller("JscriptyProjectViewCtrl",["$scope","$http","$state","$stateParams","socket","Auth","Modal","xAlert","$translate","$rootScope",function(a,b,c,d,e,f,g,h,i,j){a.jscriptyProject={},a.getProject=function(){b.get("/api/jscripty/projects/"+d.id).success(function(b){a.jscriptyProject=b,angular.element(document).ready(function(){window.onerror=function(a,b,c){try{if(null!=a&&-1!=a.indexOf("Script error."));else{var d=new Image;d.src="assets/plugins/mxgraph/images/1x1.png?msg="+encodeURIComponent(a)+"&url="+encodeURIComponent(b)+"&lnum="+encodeURIComponent(c)}}catch(e){}},b.token=f.getToken();var a=new EditorUi(new Editor);a.openString(b.draft,b.name,b),a.editor.graphChangeListener=function(a,b){var c=b.properties.rtChange||!1;c||(this.modified=!0)}}),e.syncUpdates("jscripty_project",[b],function(a,c,d){c.id===b.id})})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.jscripty.projects.view",{url:"/view/:id",templateUrl:"app/jscripty/project/view/view.html",controller:"JscriptyProjectViewCtrl",authenticate:!0,resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",serie:!0,cache:!1,files:["assets/plugins/mxgraph/css/common.css","assets/plugins/mxgraph/css/explorer.css","assets/plugins/mxgraph/styles/grapheditor.css","assets/plugins/mxgraph/styles/custom.css","assets/plugins/jscripty/js/custom.js","assets/plugins/mxgraph/js/mxClient.js","assets/plugins/jscripty/js/Editor.js","assets/plugins/jscripty/js/Graph.js","assets/plugins/jscripty/js/EditorUi.js","assets/plugins/jscripty/js/Actions.js","assets/plugins/jscripty/js/Menus.js","assets/plugins/jscripty/js/Sidebar.js","assets/plugins/jscripty/js/Toolbar.js","assets/plugins/jscripty/js/Dialogs.js"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("LandingCtrl",["$scope","$location","$window","$timeout","Auth","Setting",function(a,b,c,d,e,f){a.initLanding=function(){a.year=moment().year(),f.get({controller:"info"}).$promise.then(function(b){a.info=b})["catch"](function(a){console.error(a)});var c,g,h;return(h=e.getCurrentUser().$promise)?h.then(function(e){switch(g=e,g.role){case"user":for(var f=0;f<g.Modules.length&&!(c=g.Modules[f].path);f++);break;case"admin":case"agent":c="/dashboard/voice"}c||(a.message="MESSAGE_NO_AVAILABLE_MODULES"),d(function(){b.path(c)},500)})["catch"](function(a){console.error(a),b.path("/login")}):void b.path("/login")}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("landing",{url:"/landing",templateUrl:"app/landing/landing.html",controller:"LandingCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/error.css","assets/css/login.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("LoginCtrl",["$scope","Auth","$location","$window","$rootScope","Setting","xAlert","$stateParams",function(a,b,c,d,e,f,g,h){a.year=moment().year(),a.recovered=h.reset,a.userLogin={},a.userSignUp={},a.loginSubmitted=!1,a.signupSubmitted=!1,a.errorLogin=!1,a.errorSignup=!1,a.errorLog="",a.forgotPassword=!1,a.showRecoverMessage=!1,a.flagLogin1=!1,a.getInfo=function(){return f.get({controller:"info"}).$promise.then(function(b){a.info=b})["catch"](function(a){console.error(a)})},a.toggleLogin=function(){a.flagLogin1=!a.flagLogin1},a.toggleForgotPassword=function(b){a.showRecoverMessage=!1,a.userLogin.email="",a.forgotPassword=b},e.bodyLayout="login",a.$on("$viewContentLoaded",function(){Metronic.init(),Layout.init()}),a.recover=function(){b.recover({email:a.userLogin.email}).then(function(){a.showRecoverMessage=!0})["catch"](function(b){console.log(b),a.showRecoverMessage=!1,g.error(b)})},a.login=function(d){a.loginSubmitted=!0,d.$valid?b.login({name:a.userLogin.name,password:a.userLogin.password,remember:a.userLogin.remember}).then(function(){c.path("/landing")})["catch"](function(b){a.errorLog=b.message||"error",a.errorLogin=!0}):a.errorLogin=!0},a.signup=function(c){a.signupSubmitted=!0,c.$valid?b.createUser({email:a.userSignUp.email,fullname:a.userSignUp.fullname,name:a.userSignUp.name,password:a.userSignUp.password,role:a.userSignUp.role,online:!0})["catch"](function(b){a.errorLog=b.message||"error",a.errorSignup=!0}):a.errorSignup=!0},a.loginOauth=function(a){d.location.href="/auth/"+a}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("login",{url:"/login",templateUrl:"app/login/login.html",params:{reset:null},controller:"LoginCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/login.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("Action",["$resource",function(a){return a("/api/actions/:name/:controller",{name:"@name"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("Ami",["$resource",function(a){return a("/api/ami/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("ChooseContactModalCtrl",["$scope","$uibModalInstance","data","xAlert","$translate","Contact",function(a,b,c,d,e,f){function g(){return f.get({id:c.eventId,controller:"checkevent"}).$promise.then(function(b){a.contacts=b.rows})["catch"](function(a){d.error(a)})}function h(){return delete c.type,f.get(c).$promise.then(function(b){a.contacts=b.rows})["catch"](function(a){d.error(a)})}a.open=function(a){b.close(a)},a.getContacts=function(){switch(c.type){case"event":g();break;case"detail":h();break;default:b.dismiss("cancel")}},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("CloseEditedTabModalCtrl",["$scope","$uibModalInstance",function(a,b){a.close=function(){b.close()},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("CloseEditedTabModalJscriptyCtrl",["$scope","$uibModalInstance","project","JscriptyProject","xAlert",function(a,b,c,d,e){a.init=function(){a.project=c},a.close=function(){d.update({id:a.project.projectId,controller:"sessions",action:a.project.sessionId},{status:"incomplete",completedAt:Date(),last_question_id:a.project.lastQuestionId}).$promise.then(function(a){e.show("Project Ended","success")}),b.close()},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("ContactManagerSetDisposition",["$scope","$uibModalInstance","VoiceDisposition",function(a,b,c){a.initDisposition=function(){return c.get().$promise.then(function(b){a.dispositions=b.rows})["catch"](function(a){console.error(a)})},a.item={},a.ok=function(){b.close(a.item)},a.cancel=function(){b.dismiss()}}]),angular.module("xCallyShuttleApp").controller("customGridDateFilterModalCtrl",["$scope","$rootScope","$log","$uibModalInstance","term","hasTime",function(a,b,c,d,e,f){if(a.hasTime=f,a.dateTime={},e)if(f){var g=e.split(" ");a.dateTime.filterDate=moment(g[0]),a.dateTime.time=e[1]?moment(g[1],"HH:mm"):moment()}else a.dateTime.filterDate=moment(e);else f&&(a.dateTime.time=moment());a.setFilterDate=function(b){d.close({date:moment(b).format("YYYY-MM-DD").toString(),time:f?a.dateTime.time?moment(a.dateTime.time).format("HH:mm").toString():moment().format("HH:mm").toString():null})},a.cancelDateFilter=function(){d.dismiss()}}]),angular.module("xCallyShuttleApp").controller("customGridTagsModalCtrl",["$scope","$rootScope","$log","$uibModalInstance","term","Tag","xAlert",function(a,b,c,d,e,f,g){a.initModal=function(){return a.item={},f.get().$promise.then(function(b){a.tags=_.map(b.rows,"name"),a.item.myTags=e})["catch"](function(a){console.log("error retrieving tags"),g.error(a),d.dismiss()})},a.setFilterTags=function(){d.close(a.item.myTags)},a.cancelTagsFilter=function(){d.dismiss()}}]),angular.module("xCallyShuttleApp").factory("templateVariable",["$translate",function(a){return[{id:"voice",label:a.instant("APPLICATION_VOICE"),title:a.instant("APPLICATION_VOICE"),groups:[{label:a.instant("APPLICATION_QUEUE"),values:[{value:"{{uniqueid}}",label:a.instant("APPLICATION_UNIQUEID"),description:a.instant("APPLICATION_UNIQUEID")},{value:"{{calleridnum}}",label:a.instant("APPLICATION_CALLERIDNUM"),description:a.instant("APPLICATION_CALLERIDNUM")},{value:"{{calleridname}}",label:a.instant("APPLICATION_CALLERIDNAME"),description:a.instant("APPLICATION_CALLERIDNAME")},{value:"{{queue}}",label:a.instant("APPLICATION_QUEUE"),description:a.instant("APPLICATION_QUEUE")},{value:"{{interface}}",label:a.instant("APPLICATION_INTERFACE"),description:a.instant("APPLICATION_INTERFACE")},{value:"{{membername}}",label:a.instant("APPLICATION_MEMBERNAME"),description:a.instant("APPLICATION_MEMBERNAME")},{value:"{{holdtime}}",label:a.instant("APPLICATION_HOLDTIME"),description:a.instant("APPLICATION_HOLDTIME")},{value:"{{talktime}}",label:a.instant("APPLICATION_TALKTIME"),description:a.instant("APPLICATION_TALKTIME")},{value:"{{connectedlinenum}}",label:a.instant("APPLICATION_CONNECTEDLINENUM"),description:a.instant("APPLICATION_CONNECTEDLINENUM")},{value:"{{connectedlinename}}",label:a.instant("APPLICATION_CONNECTEDLINENAME"),description:a.instant("APPLICATION_CONNECTEDLINENAME")},{value:"{{agentconnectAt}}",label:a.instant("APPLICATION_CONNECTED_AT"),description:a.instant("APPLICATION_CONNECTED_AT")},{value:"{{agentcalledAt}}",label:a.instant("APPLICATION_CALLED_AT"),description:a.instant("APPLICATION_CALLED_AT")},{value:"{{agentcompleteAt}}",label:a.instant("APPLICATION_COMPLETED_AT"),description:a.instant("APPLICATION_AGENT_CALLED_AT")},{value:"{{reason}}",label:a.instant("APPLICATION_REASON"),description:a.instant("APPLICATION_REASON")},{value:"{{lastevent}}",label:a.instant("APPLICATION_LAST_EVENT"),description:a.instant("APPLICATION_LAST_EVENT")},{value:"{{channel}}",label:a.instant("APPLICATION_CHANNEL"),description:a.instant("APPLICATION_CHANNEL")}]}]},{id:"chat",label:a.instant("APPLICATION_CHAT"),title:a.instant("APPLICATION_CHAT"),groups:[{label:a.instant("APPLICATION_VARIABLES"),values:[{value:"{{username}}",label:a.instant("APPLICATION_USERNAME"),description:a.instant("APPLICATION_USERNAME")},{value:"{{email}}",label:a.instant("APPLICATION_MAIL"),description:a.instant("APPLICATION_MAIL")},{value:"{{text}}",label:a.instant("APPLICATION_TEXT"),description:a.instant("APPLICATION_TEXT")},{value:"{{chatWebsite}}",label:a.instant("APPLICATION_WEBSITE"),description:a.instant("APPLICATION_WEBSITE")}]}]},{id:"mail",label:a.instant("APPLICATION_MAIL"),title:a.instant("APPLICATION_MAIL"),groups:[{label:a.instant("APPLICATION_INTERACTION"),values:[{value:"{{interactionId}}",label:a.instant("APPLICATION_INTERACTION_ID"),description:a.instant("APPLICATION_INTERACTION_ID")},{value:"{{subject}}",label:a.instant("APPLICATION_SUBJECT"),description:a.instant("APPLICATION_SUBJECT")},{value:"{{{body}}}",label:a.instant("APPLICATION_MESSAGE"),description:a.instant("APPLICATION_MESSAGE")},{value:"{{accountName}}",label:a.instant("APPLICATION_ACCOUNT"),description:a.instant("APPLICATION_ACCOUNT")},{value:"{{from}}",label:"From",description:"From"},{value:"{{to}}",label:"To",description:"To"},{value:"{{cc}}",label:"Cc",description:"Cc"},{value:"{{agentName}}",label:a.instant("APPLICATION_AGENT_NAME"),description:a.instant("APPLICATION_AGENT_NAME")},{value:"{{agentEmail}}",label:a.instant("APPLICATION_AGENT_EMAIL"),description:a.instant("APPLICATION_AGENT_EMAIL")},{value:"{{createdAt}}",label:a.instant("APPLICATION_CREATED_AT"),description:a.instant("APPLICATION_CREATED_AT")}]}]}]}]),angular.module("xCallyShuttleApp").controller("gridDatePickerFilterCtrl",["$scope","$timeout","$uibModal","uiGridConstants",function(a,b,c,d){b(function(){a.col.colDef.name;a.openDatePicker=function(b){var d=c.open({templateUrl:"app/main/customDateFilter.modal.html",controller:"customGridDateFilterModalCtrl",size:"md",windowClass:"custom-date-filter-modal",resolve:{term:[function(){return b.term||null}],hasTime:b.hasTime||!1}});d.result.then(function(c){a.colFilter.listTerm=[],a.colFilter.term=c.date,b.hasTime&&(a.colFilter.term+=" "+c.time)})}})}]),angular.module("xCallyShuttleApp").factory("gridOptions",["Modal","xAlert","$translate","$interval","$q","usSpinnerService",function(a,b,c,d,e,f){return{gridOptions:function(d,g,h,i,j,k,l){function m(a,b){a.filter&&a.filter.term&&b&&(o[a.name]=a.filter.term),a.filters&&(a.filters.length>1?a.filters.forEach(function(b){b.term?64===b.condition?o[a.name+"_uiFrom"]=b.term:256===b.condition&&(o[a.name+"_uiTo"]=b.term):64===b.condition?delete o[a.name+"_uiFrom"]:256===b.condition&&delete o[a.name+"_uiTo"]}):a.filters.length&&a.filters[0].term?o[a.name]=a.filters[0].term:delete o[a.name])}h.id=[];var n=k?"gridOptions"+k:"gridOptions",o={offset:0,limit:10},p={offset:0,limit:10};g.draggable&&(g.rowTemplate='<div grid="grid" class="ui-grid-draggable-row" draggable="true"><div ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ng-class="{ \'ui-grid-row-header-cell\': col.isRowHeader, \'custom\': true }" ui-grid-cell></div></div>',g.useExternalPagination=!1,g.enablePaginationControls=!1,g.showGridFooter=!1);var q=function(a){var b=a&&a>h[n].paginationPageSize?h[n].paginationPageSize:a,c=b?30*b+120:177,d=angular.element(document.getElementsByName(n)).length?angular.element(document.getElementsByName(n)[0]):angular.element(document.getElementsByClassName("ui-grid")[0]);d.css("height",c+"px")},r=function(a,b){return h[n].enablePaginationControls||(delete o.offset,delete o.limit),f.spin("spinner-grid"),i=a||i,d=b||d,d.get(i?_.merge(o,i):o).$promise.then(function(a){h[n].totalItems=a.count,h[n].data=a.rows,q(a.rows.length),l&&l()})["catch"](function(a){console.error(a)})["finally"](function(){f.stop("spinner-grid")})};return h.deleteItem=a.confirm["delete"](function(a){var e=i?angular.copy(i):{};return _.merge(e,{id:a}),d.remove(e).$promise.then(function(){r(),b.show(c.instant("MESSAGE_WELL_DONE")+"!","success"),h.gridApi.selection.clearSelectedRows(),h.id=[]})["catch"](function(a){b.error(a)})}),h.deleteItems=a.confirm["delete"](function(){var a=i?angular.copy(i):{};return _.merge(a,{ids:h.id}),d["delete"](a).$promise.then(function(){r(),b.show(c.instant("MESSAGE_WELL_DONE")+"!","success"),h.gridApi.selection.clearSelectedRows(),h.id=[]})["catch"](function(a){b.error(a)})}),g.columnDefs.forEach(function(a){m(a,!0),a.hasOwnProperty("displayName")||(a.displayName="APPLICATION_"+a.name.toUpperCase()),a.headerCellFilter="translate",a.hasOwnProperty("buttons")&&(a.displayName="",a.cellClass="ui-grid-vcenter",a.enableSorting=!1,a.enableFiltering=!1,a.enableColumnMenu=!1,a.cellTemplate="<div>",a.buttons.forEach(function(b){if(b.directive)a.cellTemplate+=b.directive;else{if(a.cellTemplate+="<a",a.cellTemplate+=b.hide?' data-ng-hide="'+b.hide+'" ':" ",a.cellTemplate+=b["class"]?' class="btn btn-xs '+b["class"]+'" ':" ",a.cellTemplate+=b.href?' data-ng-href="'+b.href+'" ':" ",a.cellTemplate+=b.uisref?' ui-sref="'+b.uisref+'" ':" ",a.cellTemplate+=b.onClick?' data-ng-click="'+b.onClick+'" ':" ",a.cellTemplate+=b.title?' title="'+b.title+'"':"",a.cellTemplate+=">",a.cellTemplate+=b.icon?'<i class="'+b.icon+'"></i>':"",b.name)switch(b.name){case"delete":a.cellTemplate+='<i class="icon-trash"></i>';break;case"profile":case"settings":case"detail":case"embedding":a.cellTemplate+='<i class="icon-settings"></i>';break;case"view":a.cellTemplate+='<i class="icon-doc"></i>';break;case"clone":a.cellTemplate+='<i class="icon-docs"></i>';break;case"permits":a.cellTemplate+='<i class="icon-key"></i>';break;case"copy":a.cellTemplate+='<i class="fa fa-files-o"></i>';break;case"select":a.cellTemplate+='<i class="icon-check"></i>';break;case"preview":a.cellTemplate+='<i class="icon-magnifier"></i>';break;case"contacts":a.cellTemplate+='<i class="fa fa-users"></i>';break;case"download":case"export":a.cellTemplate+='<i class="fa fa-download"></i>';break;case"agents":a.cellTemplate+='<i class="icon-people"></i>';break;case"run":a.cellTemplate+='<i class="fa fa-cogs"></i>';break;case"mailRoom":a.cellTemplate+='<i class="fa fa-envelope"></i>';break;case"chatRoom":a.cellTemplate+='<i class="fa fa-users"></i>';break;case"faxRoom":a.cellTemplate+='<i class="icon-paper-plane"></i>';break;case"smsRoom":a.cellTemplate+='<i class="glyphicon glyphicon-comment"></i>';break;case"check":a.cellTemplate+='<i class="fa fa-check"></i>';break;case"queues":a.cellTemplate+='<i class="icon-docs"></i>';break;default:a.cellTemplate+="{{'APPLICATION_"+b.name.toUpperCase()+"' | translate}}"}else a.cellTemplate+=b.displayName?"{{'"+b.displayName+"' | translate}}":"";a.cellTemplate+="</a> "}}),a.cellTemplate+="<div>",delete a.buttons)}),_.merge({enableGridMenu:!0,headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableRowSelection:!0,enableSelectAll:!0,enableFiltering:!0,showGridFooter:!0,paginationPageSizes:[10,25,50,75],paginationPageSize:10,useExternalPagination:!0,useExternalSorting:!0,useExternalFiltering:!0,multiSelect:!0,getPage:r,gridMenuTitleFilter:function(a){var b=e.defer();return b.resolve(c.instant(a)),b.promise},exporterAllDataFn:function(){return p.offset=o.offset,p.limit=o.limit,o={offset:0,limit:null},r().then(function(){o.offset=p.offset,o.limit=p.limit,r()})},exporterFieldCallback:function(a,b,c,d){if("applications"===c.field&&b.entity.Applications){var e="";return _.forEach(b.entity.Applications,function(a){e+=a.app+"("+a.appdata.join(",")+")"}),e}return d},exporterHeaderFilter:c.instant,onRegisterApi:function(a){h.gridApi=a,h.gridApi.selection&&(h.gridApi.selection.on.rowSelectionChanged(h,function(a){a.isSelected?h.id.push(h.gridApi.grid.options.primaryKey?a.entity[h.gridApi.grid.options.primaryKey]:a.entity.id):_.pull(h.id,h.gridApi.grid.options.primaryKey?a.entity[h.gridApi.grid.options.primaryKey]:a.entity.id)}),h.gridApi.selection.on.rowSelectionChangedBatch(h,function(a){a[0].isSelected?h.id=_.union(h.id,_.map(a,h.gridApi.grid.options.primaryKey?"entity."+h.gridApi.grid.options.primaryKey:"entity.id")):_.map(a,h.gridApi.grid.options.primaryKey?"entity."+h.gridApi.grid.options.primaryKey:"entity.id").forEach(function(a){_.pull(h.id,a)})})),h.gridApi.core.on.sortChanged(h,function(a,b){0===b.length?o.order=null:o.order=b[0].name+" "+b[0].sort.direction.toUpperCase(),r()});for(var e=0;e<h.gridOptions.columnDefs.length;e++)if(h.gridOptions.columnDefs[e].hasOwnProperty("sort")){o.order=h.gridOptions.columnDefs[e].name+" "+h.gridOptions.columnDefs[e].sort.direction.toUpperCase();break}h.gridApi.pagination.on.paginationChanged(h,function(a,b){o.offset=(a-1)*b,o.limit=b,r()}),h.gridApi.core.on.filterChanged(h,function(){var a=this.grid;a.columns.forEach(function(a){m(a)}),r()}),h.gridApi.draggableRows&&h.gridApi.draggableRows.on.rowDropped(h,function(a){a.fromIndex!==a.toIndex&&d.update(i,h[n].data).$promise.then(function(){b.show(c.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){b.error(a)})}),j||r()}},g)}}}]),angular.module("xCallyShuttleApp").controller("gridTagsFilterCtrl",["$scope","$timeout","$uibModal","uiGridConstants",function(a,b,c,d){b(function(){a.col.colDef.name;a.openTags=function(b){var d=c.open({templateUrl:"app/main/customTagsFilter.modal.html",controller:"customGridTagsModalCtrl",size:"md",resolve:{term:[function(){if(b.term){var a=b.term.split(";");return a.pop(),a}return[]}]}});d.result.then(function(b){a.colFilter.listTerm=[],b.length&&(a.colFilter.term=b.join(";")+";")})}})}]),angular.module("xCallyShuttleApp").controller("MainCtrl",["$scope","$rootScope","$translate","$timeout","socket","Auth","xAlert","$uibModal","$log","$state","Contact","$window","$location","localStorageService",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){a.awesomeThings=[],b.workspaces=[],a.Auth=f,b.userModules={},f.getCurrentUser().$promise.then(function(a){a.Modules.forEach(function(a){b.userModules[a.id]=!0})})["catch"](function(a){g.error(a)}),b.initTours=function(){b.activeTour={main:!1},b.tourConfig={main:[{type:"function",fn:function(){b.tempTourPath=m.path()}},{type:"title",heading:c.instant("TOUR_MAIN_WELCOME"),text:'<div class="row"><div id="title-text" class="col-md-12"><span class="main-text">'+c.instant("TOUR_MAIN_DISCOVER_MOTION")+"</span><br/></div></div>",curtainClass:"myCurtainClass"},{type:"location_change",path:"/dashboard/voice"},{type:"title",heading:c.instant("TOUR_MAIN_DASHBOARD"),text:c.instant("TOUR_MAIN_DASHBOARD_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/tools/yourdashboards/show/1"},{type:"title",heading:c.instant("TOUR_MAIN_YOURDASHBOARD"),text:c.instant("TOUR_MAIN_YOURDASHBOARD_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/staff/agents/list"},{type:"title",heading:c.instant("TOUR_MAIN_AGENTS"),text:c.instant("TOUR_MAIN_AGENTS_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/channels/voice/queues/list"},{type:"title",heading:c.instant("TOUR_MAIN_VOICE_QUEUE"),text:c.instant("TOUR_MAIN_VOICE_QUEUE_ADD_MESSAGE"),curtainClass:"myCurtainClass"}]},b.license.chat&&(b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/channels/chat/queues/list"},{type:"title",heading:c.instant("TOUR_MAIN_CHAT_QUEUE"),text:c.instant("TOUR_MAIN_CHAT_QUEUE_MESSAGE"),curtainClass:"myCurtainClass"}])),b.license.openchannel&&(b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/channels/openchannel/accounts/list"},{type:"title",heading:c.instant("TOUR_MAIN_OPENCHANNEL"),text:c.instant("TOUR_MAIN_OPENCHANNEL_MESSAGE"),curtainClass:"myCurtainClass"}])),b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/square/projects/list"},{type:"title",heading:c.instant("TOUR_MAIN_SQUARE_PROJECT"),text:c.instant("TOUR_MAIN_SQUARE_PROJECT_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/tools/trunks/list"},{type:"title",heading:c.instant("TOUR_MAIN_TRUNKS"),text:c.instant("TOUR_MAIN_TRUNKS_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/tools/triggers/list"},{type:"title",heading:c.instant("TOUR_MAIN_TRIGGERS"),text:c.instant("TOUR_MAIN__MESSAGE"),curtainClass:"myCurtainClass"}]),b.license.jscripty&&(b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/jscripty/projects/list"},{type:"title",heading:c.instant("TOUR_MAIN_JSCRIPTY"),text:c.instant("TOUR_MAIN_JSCRIPTY_MESSAGE"),curtainClass:"myCurtainClass"}])),b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/analytics/reports/list"},{type:"title",heading:c.instant("TOUR_MAIN_REPORTS"),text:c.instant("TOUR_MAIN_REPORTS_MESSAGE"),curtainClass:"myCurtainClass"},{type:"title",heading:c.instant("TOUR_MAIN_END"),text:c.instant("TOUR_MAIN_END_MESSAGE"),curtainClass:"myCurtainClass"}])},b.onTourFinish=function(){n.set("skipTour",!0),b.tempTourPath&&m.path(b.tempTourPath)},b.onTourSkip=function(){n.set("skipTour",!0)},d(function(){n.get("skipTour")||(b.activeTour.main=!0)}),a.select=function(a){switch(a.type){case"chatRoom":case"mailRoom":case"faxRoom":a.unread=0}},e.socket.on("report_integration:tdDisposal",function(b){a.openTdTab(b)}),a.openTdTab=function(a){b.workspaces.push({type:"tdDisposal",name:"Motion Dialer Disposition","class":"icon-control-forward",active:!0,spooler:a})},a.deselect=function(){},a.isAdmin=f.isAdmin,a.isLoggedIn=f.isLoggedIn,a.getCurrentUser=f.getCurrentUser,a.CurrentUser=f.getCurrentUser(),e.socket.on("user_has_voice_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),e.socket.on("user_has_chat_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),e.socket.on("user_has_mail_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),e.socket.on("user_has_fax_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),e.socket.on("user_has_sms_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),a.mainTab={active:!0},a.closeJscriptyTab=function(a){if(b.workspaces[a].edited){var c=h.open({animation:!0,templateUrl:"app/main/closeEditedTab.modal.jscripty.html",controller:"CloseEditedTabModalJscriptyCtrl",resolve:{project:b.workspaces[a]}});c.result.then(function(){b.workspaces.splice(a,1)})}else b.workspaces.splice(a,1)},b.closeTab=function(a){var c;b.workspaces[a].edited?"jscripty"===b.workspaces[a].type?b.workspaces[a].end():(c=h.open({animation:!0,templateUrl:"app/main/closeEditedTab.modal.html",controller:"CloseEditedTabModalCtrl"}),c.result.then(function(){b.workspaces.splice(a,1)},function(){i.info("Modal dismissed at: "+new Date)})):b.workspaces.splice(a,1)},a.createContact=function(d,e){return e.CompanyId||delete e.CompanyId,k.save(e).$promise.then(function(e){b.workspaces.splice(d,1);var f=e.firstName;e.lastName&&(f+=" "+e.lastName),a.openContactTab({firstName:e.firstName,lastName:e.lastName,id:e.id}),g.show(c.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){g.error(a)})};var o=function(b){var c=h.open({animation:!0,templateUrl:"app/main/chooseContact.modal.html",controller:"ChooseContactModalCtrl",resolve:{data:function(){return{type:"event",eventId:b.id}}}});c.result.then(function(c){c?a.openContactTab(c,b):a.newContact(b)},function(){i.info("Modal dismissed at: "+new Date)})};a.updateContact=function(a,d){var e=angular.copy(d);return e.CompanyId||(e.CompanyId=null),k.update({id:e.id},e).$promise.then(function(){b.workspaces[a].edited=!1,g.show(c.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){g.error(a)})},e.socket.on("report_integration:contactmanager",function(a){o(a)}),e.socket.on("report_integration:jscripty",function(b){a.openJscriptyTab({name:"Jscripty",id:b.projectId,calleridnum:b.calleridnum,calleridname:b.calleridname,queue:b.queue,membername:b.membername})}),e.socket.on("report_integration:salesforce",function(a){l.open(a.url,"_blank")}),b.openContactTab=function(a,c){var d=_.find(b.workspaces,{contactID:a.id});if(d)d.active=!0;else{var e=a.firstName;a.lastName&&(e+=" "+a.lastName),b.workspaces.push({
-name:e,type:"contact",contactID:a.id,"class":"icon-user",active:!0,data:c||null})}},a.openJscriptyTab=function(a){b.workspaces.push({name:a.name,type:"jscripty",active:!0,data:a})},a.newContact=function(a){b.workspaces.push({name:"New Contact",type:"newContact","class":"icon-user",active:!0,data:a||null})},a.$on("$viewContentLoaded",function(){Metronic.init()}),b.language=c.use(),a.changeLanguage=function(a){return c.use(a).then(function(a){b.language=a,-1!==["main.jscripty.projects.view","main.square.projects.view"].indexOf(j.current.name)&&l.location.reload()})["catch"](function(a){console.error(a)})},a.$on("$destroy",function(){console.log("main $destroy"),e.unsyncUpdates("user_has_voice_queue_permit"),e.unsyncUpdates("user_has_chat_queue_permit"),e.unsyncUpdates("user_has_mail_queue_permit"),e.unsyncUpdates("user_has_fax_queue_permit"),e.unsyncUpdates("user_has_sms_queue_permit")})}]),angular.module("xCallyShuttleApp").directive("ngSpinnerBar",["$rootScope",function(a){return{link:function(b,c){c.addClass("hide"),a.$on("$stateChangeStart",function(){"spinner-page"===c[0].id&&c.removeClass("hide")}),a.$on("$stateChangeSuccess",function(){"spinner-page"===c[0].id&&(c.addClass("hide"),$("body").removeClass("page-on-load"),Layout.setSidebarMenuActiveLink("match"),setTimeout(function(){Metronic.scrollTop()},1e3))}),a.$on("$spinnerStart",function(){"spinner-request"===c[0].id&&c.removeClass("hide")}),a.$on("$spinnerStop",function(){"spinner-request"===c[0].id&&c.addClass("hide")}),a.$on("$stateNotFound",function(){"spinner-page"===c[0].id&&c.addClass("hide")}),a.$on("$stateChangeError",function(){"spinner-page"===c[0].id&&c.addClass("hide")})}}}]).directive("a",function(){return{restrict:"E",link:function(a,b,c){(c.ngClick||""===c.href||"#"===c.href)&&b.on("click",function(a){a.preventDefault()})}}}).directive("nxEqual",function(){return{require:"ngModel",link:function(a,b,c,d){return c.nxEqual?(a.$watch(c.nxEqual,function(a){d.$setValidity("nxEqual",a===d.$viewValue)}),void d.$parsers.push(function(b){var e=b===a.$eval(c.nxEqual);return d.$setValidity("nxEqual",e),e?b:void 0})):void console.error("nxEqual expects a model as an argument!")}}}).directive("ngEnter",function(){return function(a,b,c){b.bind("keydown keypress",function(b){13===b.which&&(a.$apply(function(){a.$eval(c.ngEnter)}),b.preventDefault())})}}).directive("dropdownMenuHover",function(){return{link:function(a,b){b.dropdownHover()}}}).directive("uiSelectRequired",function(){return{require:"ngModel",link:function(a,b,c,d){d.$validators.uiSelectRequired=function(a){return a&&a.length}}}}).directive("rpattern",function(){return{restrict:"A",require:"ngModel",link:function(a,b,c,d){function e(a,b){return null==b||""===b||!h||a.test(b)?(d.$setValidity("pattern",!0),b):void d.$setValidity("pattern",!1)}var f,g=c.rpattern,h=!0;g&&(g.match(/^\/(.*)\/$/)?(g=new RegExp(g.substr(1,g.length-2)),f=function(a){return e(g,a)}):f=function(b){var c=a.$eval(g);if(!c||!c.test)throw new Error("Expected "+g+" to be a RegExp but was "+c);return e(c,b)}),d.$formatters.push(f),d.$parsers.push(f),c.$observe("required",function(a){h=a,f(d.$viewValue)})}}}).directive("newContact",["$compile","xAlert","socket","$translate","$timeout","List","Tag","Company","ReportCall","$uibModal","$rootScope","Auth",function(a,b,c,d,e,f,g,h,i,j,k,l){return{restrict:"E",scope:{workspace:"=",index:"=",submit:"&onSubmit"},templateUrl:"app/main/template/template.contactTab.html",compile:function(a,m){return function(a,m,n){function o(){a.$watch("contact",function(b,c){angular.equals(b,c)||(a.workspace.edited=!0)},!0)}a.license=k.license,a.Auth=l,a.forms={general:{}},a.firstLoad=!0,a.detail={tab:"main"},a.contact={CompanyId:"",disposed:!1},a.submitButtonLabel=d.instant("APPLICATION_CONFIRM"),a.getAgent=function(){return l.getCurrentUser().$promise.then(function(b){a.agent=b})["catch"](function(a){b.error(a)})},a.callPhoneBar=function(c,e){var f;switch(e){case"call":f="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/originate/"+c;break;case"transfer":f="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/transfer?number="+c;break;default:f="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/originate/"+c}return $http.get(f).success(function(){b.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(a){b.error(a)})},a.dispose=function(){return j.open({animation:!0,templateUrl:"app/main/cm.disposition.html",controller:"ContactManagerSetDisposition"}).result.then(function(c){return i.update({id:a.workspace.data.uniqueid},c).$promise.then(function(){a.contact.disposed=!0,b.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){b.error(a)})})},a.init=function(){a.workspace.data&&(a.contact.firstName=a.workspace.data.calleridname?a.workspace.data.calleridname:a.workspace.data.messageId?a.workspace.data.messageId:a.workspace.data.uniqueid?a.workspace.data.uniqueid:"",a.workspace.data.calleridnum&&(a.contact.phone=a.workspace.data.calleridnum),a.workspace.data.from&&(a.contact.email=a.workspace.data.from)),a.getTags(),a.getCompanies(),a.getLists(),a.getAgent()},a.getLists=function(){return f.get().$promise.then(function(b){a.lists=b.rows,c.syncUpdates("list",a.lists),a.contact.ListId=a.lists[0]?a.lists[0].id:null,a.getCustomFields()})["catch"](function(a){b.error(a)})},a.getCustomFields=function(){return f.get({listId:a.contact.ListId,controller:"customfields"}).$promise.then(function(b){a.customFields=b.rows,a.customFields.forEach(function(a){a.values=JSON.parse(a.values)}),c.socket.on("custom_field:remove",function(b){_.remove(a.customFields,function(a){return b.id==a.id})}),c.socket.on("custom_field:save",function(b){if(b.ListId===a.contact.ListId){var c=_.find(a.customFields,{id:b.id});c||("string"==typeof b.values&&(b.values=JSON.parse(b.values)),a.customFields.push(b))}}),!a.firstLoad||a.workspace.data?(a.workspace.edited=!0,a.firstLoad=!1):(a.firstLoad=!1,o())})["catch"](function(a){console.error(a),b.error(a)})},a.getTags=function(){return g.get().$promise.then(function(b){a.tags=_.map(b.rows,"name")})["catch"](function(a){console.error(a),b.error(a)})},a.getCompanies=function(){return h.get().$promise.then(function(b){a.companies=b.rows,a.companies.unshift({id:"",name:"-- None --"}),c.syncUpdates("company",a.companies)})["catch"](function(a){console.error(a),b.error(a)})},e(function(){a.init()})}}}}]).directive("contact",["$compile","xAlert","socket","$timeout","List","Tag","Company","Contact","$translate","gridOptions","$uibModal","ReportCall","$rootScope","usSpinnerService","uiGridConstants","$log","Auth","$http",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){return{restrict:"E",scope:{workspace:"=",index:"=",submit:"&onSubmit"},templateUrl:"app/main/template/template.contactTab.html",compile:function(a,j){return function(a,j,s){function t(b){var c=[],d={};_.forEach(a.columns[a.log[b].show][a.log[b].detail].indexes,function(e,f){d={name:e,displayName:a.columns[a.log[b].show][a.log[b].detail].header[f],headerCellFilter:"translate",enableSorting:!1,enableColumnMenu:!1},"createdAt"===e&&(d.cellTemplate="<div class=\"centered-uigrid-td\">{{row.entity.createdAt | date:'dd/MM/yyyy HH:mm:ss'}}</div>",d.filterHeaderTemplate='<div class="ui-grid-filter-container row"><div ng-repeat="colFilter in col.filters" class="col-md-6 col-md-offset-0 col-sm-5 col-sm-offset-0 col-xs-5 col-xs-offset-0"><div custom-grid-date-filter-header></div></div></div>',d.filters=[{name:"From",condition:o.filter.GREATER_THAN_OR_EQUAL},{name:"To",condition:o.filter.LESS_THAN_OR_EQUAL}]),c.push(d)}),a.columns[a.log[b].show][a.log[b].detail].actions&&c.push(a.columns[a.log[b].show][a.log[b].detail].actions),c.forEach(function(a){u(a,b,!0),a.hasOwnProperty("displayName")||(a.displayName="APPLICATION_"+a.name.toUpperCase()),a.headerCellFilter="translate",a.hasOwnProperty("buttons")&&(a.displayName="",a.cellClass="ui-grid-vcenter",a.enableSorting=!1,a.enableFiltering=!1,a.enableColumnMenu=!1,a.cellTemplate="<div>",a.buttons.forEach(function(b){if(b.directive)a.cellTemplate+=b.directive;else{if(a.cellTemplate+="<a",a.cellTemplate+=b.hide?' data-ng-hide="'+b.hide+'" ':" ",a.cellTemplate+=b["class"]?' class="btn btn-xs '+b["class"]+'" ':" ",a.cellTemplate+=b.href?' data-ng-href="'+b.href+'" ':" ",a.cellTemplate+=b.uisref?' ui-sref="'+b.uisref+'" ':" ",a.cellTemplate+=b.onClick?' data-ng-click="'+b.onClick+'" ':" ",a.cellTemplate+=b.title?' title="'+b.title+'"':"",a.cellTemplate+=">",a.cellTemplate+=b.icon?'<i class="'+b.icon+'"></i>':"",b.name)switch(b.name){case"delete":a.cellTemplate+='<i class="fa fa-trash"></i>';break;case"profile":case"settings":case"detail":case"embedding":a.cellTemplate+='<i class="icon-settings"></i>';break;case"agents":a.cellTemplate+='<i class="icon-people"></i>';break;case"run":a.cellTemplate+='<i class="fa fa-cogs"></i>';break;case"mailRoom":a.cellTemplate+='<i class="fa fa-envelope"></i>';break;case"chatRoom":a.cellTemplate+='<i class="fa fa-users"></i>';break;case"faxRoom":a.cellTemplate+='<i class="icon-paper-plane"></i>';break;case"smsRoom":a.cellTemplate+='<i class="glyphicon glyphicon-comment"></i>';break;default:a.cellTemplate+="{{'APPLICATION_"+b.name.toUpperCase()+"' | translate}}"}else a.cellTemplate+=b.displayName?"{{'"+b.displayName+"' | translate}}":"";a.cellTemplate+="</a> "}}),a.cellTemplate+="<div>",delete a.buttons)});var e={enablePaginationControls:!0,exporterCsvFilename:b+".csv",columnDefs:c,enableGridMenu:!0,headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,showGridFooter:!0,paginationPageSizes:[10,25,50,75],paginationPageSize:10,useExternalPagination:!0,useExternalSorting:!0,useExternalFiltering:!0,showTreeExpandNoChildren:!0,data:[],gridMenuTitleFilter:function(a){var b=$q.defer();return b.resolve(i.instant(a)),b.promise},onRegisterApi:function(c){a.gridApi=c,a.gridApi.grid.registerDataChangeCallback(function(){}),a.gridApi.core.on.sortChanged(a,function(a,c){0===c.length?v.order=null:v.order=c[0].name+" "+c[0].sort.direction.toUpperCase(),w(b)}),a.gridApi.pagination.on.paginationChanged(a,function(a,c){v.offset=(a-1)*c,v.limit=c,w(b)}),a.gridApi.core.on.filterChanged(a,function(){var a=this.grid;a.columns.forEach(function(a){u(a,b)}),w(b)})}};w(b,e)}function u(a,b,c){a.filter&&a.filter.term&&c&&(v[b][a.name]=a.filter.term),a.filters&&(a.filters.length>1?a.filters.forEach(function(c){c.term?64===c.condition?v[b][a.name+"_uiFrom"]=c.term:256===c.condition&&(v[b][a.name+"_uiTo"]=c.term):64===c.condition?delete v[b][a.name+"_uiFrom"]:256===c.condition&&delete v[b][a.name+"_uiTo"]}):a.filters.length&&a.filters[0].term?v[b][a.name]=a.filters[0].term:delete v[b][a.name])}a.moment=moment,a.license=m.license,a.forms={general:{}},a.detail={tab:"main"},a.log={daily:{show:"phone",type:"inbound",detail:"general"},history:{show:"phone",type:"inbound",detail:"general"}},a.columns={phone:{general:{header:["APPLICATION_SOURCE","APPLICATION_DESTINATION","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["source","destination","disposition","createdAt"]},queue:{header:["APPLICATION_CALLERID","APPLICATION_QUEUE","APPLICATION_DATE"],indexes:["calleridnum","queue","createdAt"]}},email:{general:{header:["APPLICATION_FROM","APPLICATION_TO","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["from","account","disposition","createdAt"],actions:{name:"action",displayName:"",width:40,buttons:[{"class":"green",name:"mailRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'mailRoom')"}]}}},chat:{general:{header:["APPLICATION_WEBSITE","APPLICATION_VISITOR","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["website","contact","disposition","createdAt"],actions:{name:"action",displayName:"",width:40,buttons:[{"class":"green",name:"chatRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'chatRoom')"}]}}},fax:{general:{header:["APPLICATION_FROM","APPLICATION_TO","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["contact","account","disposition","createdAt"],actions:{name:"action",displayName:"",width:40,buttons:[{"class":"green",name:"faxRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'faxRoom')"}]}}},sms:{general:{header:["APPLICATION_FROM","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["contact","disposition","createdAt"],actions:{name:"action",displayName:"",width:40,buttons:[{"class":"green",name:"smsRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'smsRoom')"}]}}}},a.Auth=q,a.getAgent=function(){return q.getCurrentUser().$promise.then(function(b){a.agent=b})["catch"](function(a){b.error(a)})},a.callPhoneBar=function(c,d){var e;switch(d){case"call":e="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/originate/"+c;break;case"transfer":e="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/transfer?number="+c;break;default:e="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/originate/"+c}return r.get(e).success(function(){b.show(i.instant("MESSAGE_WELL_DONE"),"success")}).error(function(a){b.error(a)})},a.copy=function(a){var c=k.open({animation:!0,size:"small",templateUrl:"app/contactmanager/contact/list/copy.modal.html",controller:"ContactManagerListCopyModalCtrl"});c.result.then(function(c){return h.save({id:a,controller:"copy"},c).$promise.then(function(a){m.openContactTab({firstName:a.firstName,lastName:a.lastName,id:a.id})})["catch"](function(a){b.error(a)})},function(){p.info("Modal dismissed at: "+new Date)})},a.merge=function(c){var d=k.open({animation:!0,size:"lg",templateUrl:"app/main/mergeContact.choose.modal.html",controller:"ContactManagerMergeContactChoose",resolve:{listId:c.ListId}});d.result.then(function(d){var e=k.open({animation:!0,size:"lg",templateUrl:"app/main/mergeContact.merge.modal.html",controller:"ContactManagerMergeContactMerge",resolve:{contactId:d,mergeContact:c}});e.result.then(function(e){return e.oldContact=c.id,h.save({id:d,controller:"merge"},e).$promise.then(function(b){m.workspaces.splice(a.index,1),_.remove(m.workspaces,{contactID:b.id}),m.openContactTab({firstName:b.firstName,lastName:b.lastName,id:b.id})})["catch"](function(a){b.error(a)})},function(){p.info("Modal dismissed at: "+new Date)})},function(){p.info("Modal dismissed at: "+new Date)})},a.dispose=function(){return k.open({animation:!0,templateUrl:"app/main/cm.disposition.modal.html",controller:"ContactManagerSetDisposition"}).result.then(function(c){return l.update({id:a.workspace.data.uniqueid},c).$promise.then(function(){a.contact.disposed=!0,b.show(i.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){b.error(a)})})},a.companyInfo=function(b){k.open({animation:!0,size:"lg",templateUrl:"app/main/company.info.modal.html",controller:["$scope","$uibModalInstance","company",function(a,b,c){a.company=c,a.close=function(){b.dismiss("cancel")}}],resolve:{company:_.find(a.companies,{id:b})}})},a.updateLog=function(b,c,d,e){c&&(a.log[b].show=c),d&&(a.log[b].detail=d),e&&(a.log[b].type=e),t(b)},a.openRoom=function(a,b,c){var d=_.find(m.workspaces,{id:a,type:b});if(d)d.active=!0;else{var e;switch(b){case"mailRoom":e="icon-envelope";break;case"chatRoom":e="fa fa-users";break;case"faxRoom":e="icon-paper-plane";break;case"smsRoom":e="glyphicon glyphicon-comment"}m.workspaces.push({id:a,type:b,"class":e,active:!0,data:c})}};var v={daily:{offset:0,limit:10},history:{offset:0,limit:10}},w=function(b,c){return n.spin("spinner-grid"),h.get(_.merge(_.merge({id:a.workspace.contactID,controller:"log",logType:b,order:"createdAt DESC"},a.log[b]),v[b])).$promise.then(function(d){c&&(a["gridOptions"+b]=c),a["gridOptions"+b].totalItems=d.count,a["gridOptions"+b].data=d.rows,x("gridOptions"+b,d.rows.length)})["catch"](function(a){console.error(a)})["finally"](function(){n.stop("spinner-grid")})},x=function(a,b){var c=b?30*b+120:177;angular.element(document.getElementsByName(a)[0]).css("height",c+"px")};a.getContact=function(){return h.get({id:a.workspace.contactID}).$promise.then(function(b){a.contact=b,a.contact.CompanyId||(a.contact.CompanyId=""),a.getCustomFields(b.ListId),a.updateLog("daily"),a.updateLog("history")})["catch"](function(a){console.error(a),b.error(a)})},a.getTags=function(){return f.get().$promise.then(function(b){a.tags=_.map(b.rows,"name")})["catch"](function(a){console.error(a),b.error(a)})},a.getCompanies=function(){return g.get().$promise.then(function(b){a.companies=b.rows,a.companies.unshift({id:"",name:"-- None --"}),c.syncUpdates("company",a.companies)})["catch"](function(a){console.error(a),b.error(a)})},a.getCustomFields=function(d){return a.customFields=[],e.get({listId:d,controller:"customfields"}).$promise.then(function(b){b.rows.forEach(function(b){try{"select"===b.type&&(b.values=JSON.parse(b.values)),a.customFields.push(b)}catch(c){console.log("Cf not valid:",b.alias)}}),c.socket.on("custom_field:remove",function(b){_.remove(a.customFields,function(a){return b.id==a.id})}),c.socket.on("custom_field:save",function(b){if(b.ListId===d){var c=_.find(a.customFields,{id:b.id});c||("string"==typeof b.values&&(b.values=JSON.parse(b.values)),a.customFields.push(b))}})})["catch"](function(a){console.error(a),b.error(a)})},d(function(){a.getTags(),a.getCompanies(),a.getContact(),a.getAgent()})}}}}]).directive("jscripty",["$compile","xAlert","$http","socket","JscriptyProject",function(a,b,c,d,e){return{restrict:"E",scope:{workspace:"=",index:"=",submit:"&onSubmit"},templateUrl:"app/main/template/template.jscriptyTab.html",compile:function(a,d){return function(a,d,f){a.count=0,a.questions=[];var g,h=a.workspace.data.id;c.get("/api/jscripty/projects/"+h+"/download").success(function(b){b?c.post("/api/jscripty/projects/"+h+"/sessions",{projectId:h,status:"started",queue:a.workspace.data.queue,calleridnum:a.workspace.data.calleridnum,callername:a.workspace.data.callername,membername:a.workspace.data.membername}).success(function(c){g=c.session_id,a.workspace.edited=!0,a.workspace.sessionId=g,a.workspace.projectId=h;var d=mxUtils.parseXml(b),e=new mxCodec(d);a.decObj=e.decode(d.documentElement);var f=_.find(a.decObj.cells,function(a){return a.vertex&&"start"==a.value.nodeName});if("OFF"==f.getAttribute("state")){var j=_.find(f.edges,function(a){return a.source.id==f.id}).target;a.questions[a.count]=a.currentQuestion=i(j)}else a.questions[a.count]=a.currentQuestion=f;a.saveQuestions()}):(console.log("No project published!"),alert("No project published!"),a.submit({index:a.index}))}),a.next=function(b,c){switch(a.currentQuestion.answer&&a.currentQuestion.answer!=c&&(a.questions=_.take(a.questions,a.count+1)),a.currentQuestion.answer=c,b.value.nodeName){case"question":b=i(b)}a.questions[a.count]=a.currentQuestion,a.currentQuestion=b,a.count++,a.questions[a.count]=b,a.saveQuestions()};var i=function(a){var b=[];return a.options=[],_.forEach(a.edges,function(c,d){if(c.source.id==a.id&&c.value){var e=String(c.value).split(",");e.length>1?(_.forEach(e,function(b,d){var e=Object.create(c);e.setValue(b),a.edges.push(e),a.options.push(b)}),b.push(c)):a.options.push(e[0])}}),_.forEach(b,function(b){_.remove(a.edges,function(a){return a.value==b.value&&a.id==b.id})}),a};a.end=function(){a.saveQuestions(),a.workspace.lastQuestionId=a.questions[a.questions.length-1].id,"end"==a.questions[a.questions.length-1].value.nodeName&&(a.workspace.edited=!1,e.update({id:h,controller:"sessions",action:g},{status:"completed",completedAt:Date(),last_question_id:a.questions[a.questions.length-1].id}).$promise.then(function(a){b.show("Project Ended","success")})),a.submit({index:a.index})},a.workspace.end=a.end,a.back=function(){a.count--,a.currentQuestion=a.questions[a.count]},a.setCurrentQuestion=function(b){a.count=b,a.currentQuestion=a.questions[a.count]},a.saveQuestions=function(){for(var c=[],d=[],f=0;f<a.questions.length;f++){if(a.questions[f].children)for(var i=a.questions[f].children,j=0;j<i.length;j++)d[j]={input_id:i[j].id,input_type:i[j].getAttribute("type"),input_label:i[j].getAttribute("label"),input_value:"checkbox"!=i[j].getAttribute("type")||i[j].answer?i[j].answer:!1};c[f]={sessionId:g,projectId:h,question_id:a.questions[f].id,question_type:a.questions[f].value.nodeName,question_label:a.questions[f].getAttribute("label"),question_text:a.questions[f].getAttribute("question")||a.questions[f].getAttribute("text"),question_other_label:a.questions[f].getAttribute("other"),question_other_answer:a.questions[f].otheranswer,question_answer:a.questions[f].answer,question_options:a.questions[f].options?JSON.stringify({options:a.questions[f].options}):null,index:f,ReportJscriptyInputs:d},d=[]}e.save({id:h,controller:"sessions",action:g,action2:"questions"},c).$promise.then(function(a){})["catch"](function(a){b.error(a)})}}}}}]).directive("reportBuilder",["$compile",function(a){return{restrict:"E",scope:{group:"=",fields:"=",forms:"=",firstCall:"="},templateUrl:"app/main/template/template.reportBuilderView.html",compile:function(b,c){var d,e;return d=b.contents().remove(),function(b,c,f){b.operators=[{name:"AND"},{name:"OR"}],b.conditions=[{name:"="},{name:"!="},{name:"<"},{name:"<="},{name:">"},{name:">="},{name:"LIKE"},{name:"NOT LIKE"},{name:"IS NULL"},{name:"IS NOT NULL"},{name:"IS EMPTY"},{name:"IS NOT EMPTY"}],b.inputIsRequired=function(a){if(a.condition)switch(a.condition){case"IS NULL":case"IS NOT NULL":case"IS EMPTY":case"IS NOT EMPTY":a.required=!1;break;default:a.required=!0}},b.addCondition=function(){b.group.rules.push({condition:"=",field:"",value:""})},b.removeCondition=function(a){b.group.rules.splice(a,1)},b.addGroup=function(){b.group.rules.push({group:{operator:"AND",rules:[{condition:"=",field:"",value:""}]}})},b.randomName=function(a,b){var c=[];for(a=a||5,b=b||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";--a;)c.push(b.charAt(Math.floor(Math.random()*b.length)));return c.join("")},b.removeGroup=function(){b.$parent.group&&b.$parent.group.rules.splice(b.$parent.$index,1)},e||(e=a(d)),c.append(e(b,function(a){return a}))}}}}]).directive("dynamicName",["$compile",function(a){return{restrict:"A",terminal:!0,priority:1e3,link:function(b,c,d){c.attr("name",b.$eval(d.dynamicName)),c.removeAttr("dynamic-name"),a(c)(b)}}}]).directive("onReadFile",["$parse",function(a){return{restrict:"A",scope:!1,link:function(b,c,d){var e=a(d.onReadFile);c.on("change",function(a){var c=new FileReader;c.onload=function(a){b.$apply(function(){e(b,{$fileContent:a.target.result})})},c.readAsText((a.srcElement||a.target).files[0])})}}}]).directive("motionFileDownload",["xAlert","$translate","$timeout","$location","FileSaver","$compile",function(a,b,c,d,e,f){return{restrict:"E",template:'<a uib-tooltip=\'{{tooltiptext}}\' class="{{btnclass || \'btn default btn-xs blue-hoki\'}}" href="" data-ng-click="download()" ><i class="icon-cloud-download"></i>{{btncontent || \'\'}}</a>',scope:{mimetype:"=",filename:"=",resource:"=",params:"=",btnclass:"@",btncontent:"@",tooltiptext:"@"},link:function(b,c,d){var f=c.children()[0];b.$on("download-start",function(){$(f).attr("disabled","disabled")}),b.$on("downloaded",function(a,c){var d=base64ToBlob(c,b.mimetype);e.saveAs(d,b.filename),$(f).attr("disabled",!1)}),b.download=function(){return b.$emit("download-start"),b.resource.get(b.params).$promise.then(function(a){b.$emit("downloaded",a.downloadString)})["catch"](function(b){a.error(b),$(f).attr("disabled",!1)})}}}}]).directive("audioFileDownload",["xAlert","$translate","$uibModal",function(a,b,c){return{restrict:"E",template:'<button type="button" class="btn default btn-xs blue-hoki" data-ng-click="download()"><i class="fa fa-play"></i> {{ \'APPLICATION_PREVIEW\' | translate}}</button>',scope:{resource:"=",params:"="},link:function(b,d,e){var f=d.children()[0];b.$on("download-start",function(a,c){b.tempHtml=$(f).html(),$(f).attr("disabled","disabled").html('<i class="icon-refresh"></i> Loading...')}),b.$on("downloaded",function(a,d){c.open({animation:!0,size:"small",templateUrl:"app/main/audioFileDownload.play.modal.html",controller:["$scope","$uibModalInstance","$sce","audio",function(a,b,c,d){a.audio=c.trustAsResourceUrl("data:audio/wav;base64,"+d.data),a.close=function(){b.dismiss("cancel")}}],resolve:{audio:function(){return{data:d}}}});$(f).html(b.tempHtml).attr("disabled",!1)}),b.$on("error",function(a,c){$(f).html(b.tempHtml).attr("disabled",!1)}),b.download=function(){return b.$emit("download-start"),b.resource.get(b.params).$promise.then(function(a){b.$emit("downloaded",a.downloadString)})["catch"](function(c){a.error(c),b.$emit("error")})}}}}]).directive("uiRequired",function(){return{require:"ngModel",link:function(a,b,c,d){d.$validators.required=function(a,b){return!(b&&0===b.length&&"true"===c.uiRequired)},c.$observe("uiRequired",function(){d.$setValidity("required",!("true"===c.uiRequired&&d.$viewValue&&0===d.$viewValue.length))})}}}).directive("schrollBottom",function(){return{scope:{schrollBottom:"="},link:function(a,b){a.$watchCollection("schrollBottom",function(a){a&&$(b).scrollTop($(b)[0].scrollHeight)})}}}).directive("customGridDateFilterHeader",function(){return{templateUrl:"app/main/customDateFilterHeader.html",controller:"gridDatePickerFilterCtrl"}}).directive("customGridTagsFilterHeader",function(){return{templateUrl:"app/main/customTagsFilterHeader.html",controller:"gridTagsFilterCtrl"}}).directive("infiniteScroll",["$window",function(a){return{link:function(a,b,c){var d=parseInt(c.threshold)||0,e=b[0];b.bind("scroll",function(){a.$eval(c.canLoad)&&e.scrollTop+e.offsetHeight>=e.scrollHeight-d&&a.$apply(c.infiniteScroll)})}}}]).directive("tigerDialDisposal",["$compile","xAlert","socket","$translate","$timeout","$rootScope","MotionDialerSpooler","Agent",function(a,b,c,d,e,f,g,h){return{restrict:"E",scope:{workspace:"=",index:"="},templateUrl:"app/main/template/template.tigerDialDisposal.html",compile:function(a,c){return function(a,c,i){a.moment=moment,a.entitySpooler={},a.forms={td:{}},a.init=function(){return h.get().$promise.then(function(b){a.agents=[],b&&b.rows.forEach(function(b){a.agents.push("SIP/"+b.name)})})["catch"](function(a){b.error(a)})},a.save=function(){var c;switch(a.entitySpooler.retrieve){case"CLOSED":c=g.close({id:parseInt(a.workspace.ticketId.id)});break;case"OPEN":c=g.open({id:parseInt(a.workspace.ticketId.id)});break;case"BLACK_LIST":c=g.blacklist({id:parseInt(a.workspace.ticketId.id)});break;case"PLANNED":c=g.planning({id:parseInt(a.workspace.ticketId.id),date:moment(a.entitySpooler.planningtime).format("YYYY-MM-DD HH:mm")});break;case"PLANNED_PEER":c=g.planningpeer({id:parseInt(a.workspace.ticketId.id),date:moment(a.entitySpooler.planningtime).format("YYYY-MM-DD HH:mm"),peer:a.entitySpooler.planningpeer})}c?c.$promise.then(function(c){console.log(c),c.status>0?(b.show(d.instant("MESSAGE_WELL_DONE"),"success"),$uibModalInstance.close()):c.response.RMI.errors.forEach(function(c){c?(b.show(c.field+": "+c.error,"danger"),f.workspaces.splice(a.index,1)):b.show("Please, check your connection!","danger")})})["catch"](function(a){b.error(a)}):b.show("RETRIEVE NOT FOUND","danger")},e(function(){a.init()})}}}}]),angular.module("xCallyShuttleApp").filter("propsFilter",function(){return function(a,b){var c=[];return angular.isArray(a)?a.forEach(function(a){for(var d=!1,e=Object.keys(b),f=0;f<e.length;f++){var g=e[f],h=b[g].toLowerCase();if(-1!==a[g].toString().toLowerCase().indexOf(h)){d=!0;break}}d&&c.push(a)}):c=a,c}}).filter("capitalize",function(){return function(a){return a?a.replace(/([^\W_]+[^\s-]*) */g,function(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()}):""}}).filter("salesforce",function(){var a=["CallDisposition","CallDurationInSeconds","CallObject","CallType","IsArchived","Priority","Status","Type"];return function(b){return _.remove(b,function(b){return b.custom===!1&&a.indexOf(b.name)<0}),b}}).filter("sugarcrm",function(){var a=["account_id","account_name","account_name1","assigned_user_name","assigned_user_id","case_number","created_by","created_by_name","date_entered","date_modified","deleted","description","id","modified_by_name","modified_user_id","name"];return function(b){return _.remove(b,function(b){return a.indexOf(b.name)>=0}),b}}).filter("freshdesk",function(){var a=["requester","subject","agent","description"];return function(b){return _.remove(b,function(b){return a.indexOf(b.ticket_field.name)>=0}),b}}).filter("zendesk",function(){var a=["subject","assignee","description"];return function(b){return _.remove(b,function(b){return a.indexOf(b.type)>=0}),b}}).filter("slice",function(){return function(a,b,c){return a?a.slice(b,c):void 0}}),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main",{"abstract":!0,templateUrl:"app/main/main.html",controller:"MainCtrl",resolve:{authorization:["$q","Auth","$state","$timeout","$location",function(a,b,c,d,e){return b.getToken()?a.when():(d(function(){e.path("/login")}),a.reject())}],deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/plugins/mxgraph/js/mxClient.js","assets/plugins/ckeditor/ckeditor.js","assets/css/login.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("xAlert",["$translate","Notification","$state",function(a,b,c){return{show:function(c,d){switch(d){case"success":b.success({message:c,title:'<i class="glyphicon glyphicon-ok"></i> <strong>'+a.instant("MESSAGE_SUCCESS")+"!</strong>",delay:5e3});break;case"info":b.info({message:c,title:'<i class="glyphicon glyphicon-info-sign"></i> <strong>'+a.instant("MESSAGE_INFO")+"!</strong>",delay:5e3});break;case"danger":b.error({message:c,title:'<i class="glyphicon glyphicon-exclamation-sign"></i> <strong>'+a.instant("MESSAGE_ERROR")+"!</strong>",delay:1e4});break;case"warning":b.warning({message:c,title:'<i class="glyphicon glyphicon-warning-sign"></i> <strong>'+a.instant("MESSAGE_WARNING")+"!</strong>",delay:1e4});break;default:b.info(c)}},error:function(d){var e,f;d?d.status&&401===d.status?(e="Unauthorized!",f=!0):e=d.data?d.data.translatedMessage||d.data.message||"Generic Error":d.translatedMessage||d.message||"Generic Error":e="Generic Error",b.error({message:a.instant(e),title:'<i class="glyphicon glyphicon-exclamation-sign"></i> <strong>'+a.instant("MESSAGE_ERROR")+"!</strong>",delay:1e4}),f&&c.go("landing")}}}]).factory("stResource",["$q","$filter","$timeout","$rootScope","$http","$translate","xAlert",function(a,b,c,d,e,f,g){return{getPage:function(b){var c={page:Math.ceil(b.pagination.start/b.pagination.number),per_page:b.pagination.number};b.sort.predicate&&(c.sort_by=b.sort.predicate,c.sort_order=b.sort.reverse?"DESC":"ASC"),_.forIn(b.search.predicateObject,function(a,b){c[b]=a}),b.search.params&&(c.clientQuery={},_.forIn(b.search.params,function(a,b){c.clientQuery[b]=a})),d.$broadcast("$spinnerStart"),e.get(b.url,{params:c}).success(function(a){f.resolve(a),d.$broadcast("$spinnerStop")}).error(function(a){g.error(a),d.$broadcast("$spinnerStop")});var f=a.defer();return f.promise}}}]).factory("xNotification",["$translate","Notification","$rootScope",function(a,b,c){return{show:function(d,e,f,g,h,i){var j=c.$new(),k={message:e,title:d,templateUrl:"app/main/template/template.notification.html",delay:g,scope:j};switch(j.acceptBtn=a.instant("APPLICATION_ACCEPT"),j.rejectBtn=a.instant("APPLICATION_REJECT"),j.nAccept=h,j.nReject=i,f){case"chat":j["class"]="alert-info",j.icon="icon-bubble";break;case"mail":j["class"]="alert-success",j.icon="icon-envelope";break;case"fax":j["class"]="alert-warning",j.icon="icon-paper-plane";break;case"sms":j["class"]="alert-danger",j.icon="glyphicon glyphicon-comment";break;case"openchannel":j["class"]="alert-danger",j.icon="icon-globe";break;default:j["class"]="alert-info"}return new b(k)}}}]),angular.module("xCallyShuttleApp").controller("ContactManagerMergeContactChoose",["$scope","$translate","Contact","gridOptions","List","uiGridConstants","xAlert","$stateParams","Company","$uibModalInstance","listId",function(a,b,c,d,e,f,g,h,i,j,k){a.initView=function(){
-var b;return e.get().$promise.then(function(b){return a.lists=[],a.customFields=[],b.rows.forEach(function(b,c){_.forEach(b.CustomFields,function(b){a.customFields.push({name:b.name,alias:b.alias})}),a.lists.push({value:b.id,label:b.name})}),i.get().$promise}).then(function(b){a.companies=[],b.rows.forEach(function(b,c){a.companies.push({value:b.id,label:b.name})})}).then(function(){var e=[{"class":"blue-hoki",name:"select",onClick:"grid.appScope.choose(row.entity.id)"}];b={exporterCsvFilename:"Contacts.csv",columnDefs:[{name:"firstName"},{name:"lastName"},{name:"phone"},{name:"email"},{name:"ListId",displayName:"APPLICATION_LIST",field:"List.name",enableFiltering:!1},{name:"CompanyId",displayName:"APPLICATION_COMPANY",field:"Company.name",filter:{type:f.filter.SELECT,term:h.companyId||null,selectOptions:a.companies}}]},_.forEach(a.customFields,function(a){b.columnDefs.push({name:a.name,displayName:a.alias,visible:!1})}),b.columnDefs.push({name:"action",width:30,buttons:e}),a.gridOptions=d.gridOptions(c,b,a,{ListId:k})})["catch"](function(a){g.error(a)})},a.choose=function(a){j.close(a)},a.cancel=function(){j.dismiss()}}]),angular.module("xCallyShuttleApp").controller("ContactManagerMergeContactMerge",["$scope","$translate","Contact","xAlert","Company","$uibModalInstance","contactId","List","mergeContact","Tag",function(a,b,c,d,e,f,g,h,i,j){a.initView=function(){return e.get().$promise.then(function(b){return a.companies=b.rows,a.companies.unshift({id:"",name:"-- None --"}),j.get().$promise}).then(function(b){return a.tags=_.map(b.rows,"name"),c.get({id:g}).$promise}).then(function(b){a.fields={},a.contact={};var c=_.merge(_.keys(b),_.keys(i));return _.forEach(c,function(c){switch(c){case"tags":a.contact.tags=_.union(b.tags||[],i.tags||[]);break;case"$promise":case"$resolved":break;default:a.fields[c]=[],b[c]&&a.fields[c].push(b[c]),i[c]&&a.fields[c].push(i[c]),a.contact[c]=a.fields[c][0]||null}}),h.get({listId:b.ListId,controller:"customfields"}).$promise}).then(function(b){a.customFields=b.rows,a.customFields.forEach(function(a){a.values=JSON.parse(a.values)})})["catch"](function(a){d.error(a)})},a.merge=function(){a.contact.CompanyId||(a.contact.CompanyId=null),f.close(a.contact)},a.cancel=function(){f.dismiss()}}]),angular.module("xCallyShuttleApp").factory("Widget",["$resource",function(a){return a("/api/widgets/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("MarketCtrl",["$scope","$http","$translate","socket","xAlert","Modal","$timeout","Integration",function(a,b,c,d,e,f,g,h){function i(a,b){return Math.floor(Math.random()*(b-a+1))+a}a.initView=function(){return h.get().$promise.then(function(b){a.integrations=b.rows,a.groupedIntegration=_.chunk(a.integrations,4),d.syncUpdates("integration",a.integrations,function(){a.groupedIntegration=_.chunk(a.integrations,4)})})["catch"](function(a){e.error(a,"danger")})},a.isProgressing=!1,a.$on("$destroy",function(){d.unsyncUpdates("integration")}),a.installIntegration=function(b){return navigator.onLine?(a.status="Downloading",a.percentage=i(1,50),a.isProgressing=!0,b.downloading=!0,h.update({id:b.id},{active:!0}).$promise.then(function(){g(function(){a.percentage=i(51,99),a.status="Installing"},2500),g(function(){a.percentage=100,a.isProgressing=!1,a.status="Completed!",b.downloading=!1,e.show(c.instant("MESSAGE_WELL_DONE")+".","success")},5e3)})["catch"](function(){b.downloading=!1,a.percentage=0,a.isProgressing=!1,e.show(c.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})):void e.show(c.instant("MESSAGE_NO_INTERNET_CONNECTION")+".","danger")},a.uninstallIntegration=function(b){return navigator.onLine?(a.status="Uninstalling",a.percentage=i(1,99),a.isProgressing=!0,b.downloading=!0,h.update({id:b.id},{active:!1}).$promise.then(function(){g(function(){a.percentage=100,a.isProgressing=!1,a.status="Completed!",b.downloading=!1,e.show(c.instant("MESSAGE_WELL_DONE")+".","success")},5e3)})["catch"](function(){b.downloading=!1,a.percentage=0,a.isProgressing=!1,e.show(c.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})):void e.show(c.instant("MESSAGE_NO_INTERNET_CONNECTION")+".","danger")}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.market",{url:"/market",templateUrl:"app/market/market.html",controller:"MarketCtrl",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").controller("MotionbarCtrl",["$scope","$stateParams","$cookieStore","$window","$location","Auth",function(a,b,c,d,e,f){console.log(b),b.token&&b.userId&&b.role&&b.redirectTo?(f.loginWithToken(b.token,b.userId,b.role),d.location.href=decodeURIComponent(b.redirectTo)):e.path("/login")}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("motionbar",{url:"/motionbar?redirectTo&token&userId&role",template:"<div ui-view></div>",controller:"MotionbarCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.blacklist",{url:"/blacklist",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("MotionDialerBlackListListCtrl",["$scope","$uibModal","$translate","xAlert","Modal","MotionDialerBlackList","uiGridConstants",function(a,b,c,d,e,f,g){a.initView=function(){a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,columnDefs:[{name:"id",width:60},{name:"phone"},{name:"description",enableSorting:!1},{name:"updatedtime",sort:{direction:g.DESC},enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteItem(row.entity.phone, row.entity.id)"><i class="icon-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},f.list({page:1,size:6e5}).$promise.then(function(b){b.status>0?a.gridOptions.data=b.response.RMI.rows:d.show("Please, check your connection!","danger")})["catch"](function(a){d.error(a)})},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/motiondialer/blacklist/list/list.create.modal.html",controller:"MotionDialerBlackListListCreateCtrl"});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.deleteItem=e.confirm["delete"](function(b){return f["delete"]({id:b}).$promise.then(function(e){e.status>0?(_.remove(a.gridOptions.data,{id:b}),d.show(c.instant("MESSAGE_WELL_DONE"),"success")):d.show(e.message||"Please, check your connection!","danger")})["catch"](function(a){d.error(a)})})}]),angular.module("xCallyShuttleApp").controller("MotionDialerBlackListListCreateCtrl",["$scope","$translate","$uibModalInstance","MotionDialerBlackList","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.insert(a.item).$promise.then(function(a){a.status>0?(e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):e.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.blacklist.list",{url:"/list",templateUrl:"app/motiondialer/blacklist/list/list.html",controller:"MotionDialerBlackListListCtrl",authenticate:!0})}]),angular.module("xCallyShuttleApp").factory("MotionDialerBlackList",["$resource",function(a){return a("/api/rest/blacklist/:controller",null,{list:{method:"POST",params:{controller:"list"}},insert:{method:"POST",params:{controller:"insert"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},update:{method:"POST",params:{controller:"update"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.info",{url:"/info",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").factory("MotionDialerSystem",["$resource",function(a){return a("/api/rest/system/:controller",null,{properties:{method:"POST",params:{controller:"properties"}}})}]),angular.module("xCallyShuttleApp").controller("MotionDialerInfoViewCtrl",["$scope","xAlert","MotionDialerSystem",function(a,b,c){a.getProperties=function(){return c.properties().$promise.then(function(c){console.log(c),c.status>0?a.properties=c.response.RMI:b.show(c.message||"Please, check your connection!","danger")})["catch"](function(a){b.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.info.view",{url:"/view",templateUrl:"app/motiondialer/info/view/view.html",controller:"MotionDialerInfoViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.motiondialer.info.view.about",{url:"/about",templateUrl:"app/motiondialer/info/view/view.about.html"}).state("main.motiondialer.info.view.details",{url:"/details",templateUrl:"app/motiondialer/info/view/view.details.html"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.lists",{url:"/lists",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("MotionDialerListListCtrl",["$scope","$uibModal","$translate","xAlert","Modal","MotionDialerList","uiGridConstants","usSpinnerService",function(a,b,c,d,e,f,g,h){a.initView=function(){return a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,columnDefs:[{name:"id",width:60},{name:"name"},{name:"description",enableSorting:!1},{name:"updatedtime",sort:{direction:g.DESC},enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs blue-hoki" href="/motiondialer/lists/view/{{row.entity.id}}/settings"><i class="icon-settings"></i></a> <a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteItem(row.entity.name, row.entity.id)"><i class="icon-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},f.list({page:1,size:6e5}).$promise.then(function(b){b.status>0?a.gridOptions.data=b.response.RMI.rows:d.show("Please, check your connection!","danger")})["catch"](function(a){d.error(a)})["finally"](function(){h.stop("spinner-grid")})},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/motiondialer/list/list/list.create.modal.html",controller:"MotionDialerListListCreateCtrl"});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.deleteItem=e.confirm["delete"](function(b){return f["delete"]({id:b}).$promise.then(function(e){e.status>0?(_.remove(a.gridOptions.data,{id:b}),d.show(c.instant("MESSAGE_WELL_DONE"),"success")):d.show(e.message||"Please, check your connection!","danger")})["catch"](function(a){d.error(a)})})}]),angular.module("xCallyShuttleApp").controller("MotionDialerListListCreateCtrl",["$scope","$translate","$uibModalInstance","MotionDialerList","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.insert(a.item).$promise.then(function(a){a.status>0?(e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):e.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.lists.list",{url:"/list",templateUrl:"app/motiondialer/list/list/list.html",controller:"MotionDialerListListCtrl",authenticate:!0})}]),angular.module("xCallyShuttleApp").factory("MotionDialerContact",["$resource",function(a){return a("/api/rest/contact/:controller",null,{list:{method:"POST",params:{controller:"list"}},insert:{method:"POST",params:{controller:"insert"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},update:{method:"POST",params:{controller:"update"}}})}]),angular.module("xCallyShuttleApp").factory("MotionDialerList",["$resource",function(a){return a("/api/rest/list/:controller",null,{list:{method:"POST",params:{controller:"list"}},insert:{method:"POST",params:{controller:"insert"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},update:{method:"POST",params:{controller:"update"}}})}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewContactCreateCtrl",["$scope","$translate","$uibModalInstance","$stateParams","MotionDialerContact","xAlert","MotionDialerTimezone",function(a,b,c,d,e,f,g){a.form={},a.item={},a.timezones=g.list(),a.save=function(){return console.log(a.item),e.insert({id_list:parseInt(d.id),name:a.item.name,phones:a.item.phones.trim().split(","),description:a.item.description||""}).$promise.then(function(a){console.log(a),a.status>0?(f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):f.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){f.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("MotionDialerListContactImportModalCtrl",["$scope","$uibModalInstance","$stateParams","indexes","csv","xAlert","MotionDialerContact","MotionDialerTimezone",function(a,b,c,d,e,f,g,h){function i(b){if(b>=a.csvLength||a.stopped)return void(a.importing=!1);var d={id_list:parseInt(c.id),name:"",phones:[],description:""};return _.forOwn(a.item,function(a,c){"phones"===c?d[c].push(e[b][a]):d[c]=e[b][a]}),g.insert(d).$promise.then(function(b){b.status>0?(a["import"].success+=j,a["import"].succeeded++,k.push(b.response.RMI)):(console.log(b),a["import"].fail+=j,a["import"].failed++)})["catch"](function(b){console.log(b),a["import"].fail+=j,a["import"].failed++})["finally"](function(){i(b+1)})}a.form={},a.item={},a.timezones=h.list(),console.log(d),console.log(e),a.indexes=d,a.importing=!1,a.submitted=!1,a.stopped=!1,a["import"]={success:0,fail:0,succeeded:0,failed:0},a.csvLength=e.length;var j=100/a.csvLength,k=[];a.start=function(){a.importing=!0,a.submitted=!0,i(0)},a.close=function(){b.close(k)},a.stop=function(){a.stopped=!0}}]),angular.module("xCallyShuttleApp").controller("MotionDialerListViewCtrl",["$scope","$translate","$stateParams","$uibModal","xAlert","uiGridConstants","usSpinnerService","MotionDialerList","MotionDialerContact","Modal","FileUploader","Papa",function(a,b,c,d,e,f,g,h,i,j,k,l){a.getList=function(){return h.find({id:parseInt(c.id)}).$promise.then(function(b){b.status>0?a.list=b.response.RMI:e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.updateList=function(){return h.update({id:a.list.id,name:a.list.name,description:a.list.description}).$promise.then(function(a){a.status>0?e.show(b.instant("MESSAGE_WELL_DONE"),"success"):e.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.getContacts=function(){return a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,columnDefs:[{name:"name"},{name:"phones",cellTemplate:"<div>{{row.entity.phones.join(',')}}</div>",cellClass:"ui-grid-vcenter"},{name:"description",enableSorting:!1},{name:"updatedtime",sort:{direction:f.DESC},enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteContact(row.entity.name, row.entity.id)"><i class="icon-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},i.list({id_list:parseInt(c.id),page:1,size:6e5}).$promise.then(function(b){b.status>0?a.gridOptions.data=b.response.RMI.rows:e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})["finally"](function(){g.stop("spinner-grid")})},a.deleteContact=j.confirm["delete"](function(c){return i["delete"]({id:c}).$promise.then(function(d){d.status>0?(_.remove(a.gridOptions.data,{id:c}),e.show(b.instant("MESSAGE_WELL_DONE"),"success")):e.show(d.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})}),a.createContact=function(){var b=d.open({animation:!0,templateUrl:"app/motiondialer/list/view/view.contact.create.modal.html",controller:"MotionDialerViewContactCreateCtrl"});b.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})};var m=a.uploader=new k({queueLimit:1,clearInputAfterAddedToQueue:!0});m.onAfterAddingFile=function(b){l.parse(b._file,{header:!0,complete:function(b){a.uploader.clearQueue(),a["import"](b.data)},error:function(a){e.error(a)}})},a["import"]=function(b){var c=d.open({animation:!0,backdrop:"static",keyboard:!1,templateUrl:"app/motiondialer/list/view/view.contact.import.modal.html",controller:"MotionDialerListContactImportModalCtrl",resolve:{indexes:function(){return _.keys(b[0])},csv:function(){return b}}});c.result.then(function(b){console.log(b),a.gridOptions.data=a.gridOptions.data.concat(b)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.lists.view",{url:"/view/:id",templateUrl:"app/motiondialer/list/view/view.html",controller:"MotionDialerListViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.motiondialer.lists.view.settings",{url:"/settings",templateUrl:"app/motiondialer/list/view/view.settings.html"}).state("main.motiondialer.lists.view.contacts",{url:"/contacts",templateUrl:"app/motiondialer/list/view/view.contacts.html"})}]),angular.module("xCallyShuttleApp").factory("MotionDialerTimezone",function(){return{list:function(){return[{group:"US (Common)",zones:[{value:"America/Puerto_Rico",name:"Puerto Rico (Atlantic)"},{value:"America/New_York",name:"New York (Eastern)"},{value:"America/Chicago",name:"Chicago (Central)"},{value:"America/Denver",name:"Denver (Mountain)"},{value:"America/Phoenix",name:"Phoenix (MST)"},{value:"America/Los_Angeles",name:"Los Angeles (Pacific)"},{value:"America/Anchorage",name:"Anchorage (Alaska)"},{value:"Pacific/Honolulu",name:"Honolulu (Hawaii)"}]},{group:"America",zones:[{value:"America/Adak",name:"Adak"},{value:"America/Anchorage",name:"Anchorage"},{value:"America/Anguilla",name:"Anguilla"},{value:"America/Antigua",name:"Antigua"},{value:"America/Araguaina",name:"Araguaina"},{value:"America/Argentina/Buenos_Aires",name:"Argentina - Buenos Aires"},{value:"America/Argentina/Catamarca",name:"Argentina - Catamarca"},{value:"America/Argentina/ComodRivadavia",name:"Argentina - ComodRivadavia"},{value:"America/Argentina/Cordoba",name:"Argentina - Cordoba"},{value:"America/Argentina/Jujuy",name:"Argentina - Jujuy"},{value:"America/Argentina/La_Rioja",name:"Argentina - La Rioja"},{value:"America/Argentina/Mendoza",name:"Argentina - Mendoza"},{value:"America/Argentina/Rio_Gallegos",name:"Argentina - Rio Gallegos"},{value:"America/Argentina/Salta",name:"Argentina - Salta"},{value:"America/Argentina/San_Juan",name:"Argentina - San Juan"},{value:"America/Argentina/San_Luis",name:"Argentina - San Luis"},{value:"America/Argentina/Tucuman",name:"Argentina - Tucuman"},{value:"America/Argentina/Ushuaia",name:"Argentina - Ushuaia"},{value:"America/Aruba",name:"Aruba"},{value:"America/Asuncion",name:"Asuncion"},{value:"America/Atikokan",name:"Atikokan"},{value:"America/Atka",name:"Atka"},{value:"America/Bahia",name:"Bahia"},{value:"America/Barbados",name:"Barbados"},{value:"America/Belem",name:"Belem"},{value:"America/Belize",name:"Belize"},{value:"America/Blanc-Sablon",name:"Blanc-Sablon"},{value:"America/Boa_Vista",name:"Boa Vista"},{value:"America/Bogota",name:"Bogota"},{value:"America/Boise",name:"Boise"},{value:"America/Buenos_Aires",name:"Buenos Aires"},{value:"America/Cambridge_Bay",name:"Cambridge Bay"},{value:"America/Campo_Grande",name:"Campo Grande"},{value:"America/Cancun",name:"Cancun"},{value:"America/Caracas",name:"Caracas"},{value:"America/Catamarca",name:"Catamarca"},{value:"America/Cayenne",name:"Cayenne"},{value:"America/Cayman",name:"Cayman"},{value:"America/Chicago",name:"Chicago"},{value:"America/Chihuahua",name:"Chihuahua"},{value:"America/Coral_Harbour",name:"Coral Harbour"},{value:"America/Cordoba",name:"Cordoba"},{value:"America/Costa_Rica",name:"Costa Rica"},{value:"America/Cuiaba",name:"Cuiaba"},{value:"America/Curacao",name:"Curacao"},{value:"America/Danmarkshavn",name:"Danmarkshavn"},{value:"America/Dawson",name:"Dawson"},{value:"America/Dawson_Creek",name:"Dawson Creek"},{value:"America/Denver",name:"Denver"},{value:"America/Detroit",name:"Detroit"},{value:"America/Dominica",name:"Dominica"},{value:"America/Edmonton",name:"Edmonton"},{value:"America/Eirunepe",name:"Eirunepe"},{value:"America/El_Salvador",name:"El Salvador"},{value:"America/Ensenada",name:"Ensenada"},{value:"America/Fortaleza",name:"Fortaleza"},{value:"America/Fort_Wayne",name:"Fort Wayne"},{value:"America/Glace_Bay",name:"Glace Bay"},{value:"America/Godthab",name:"Godthab"},{value:"America/Goose_Bay",name:"Goose Bay"},{value:"America/Grand_Turk",name:"Grand Turk"},{value:"America/Grenada",name:"Grenada"},{value:"America/Guadeloupe",name:"Guadeloupe"},{value:"America/Guatemala",name:"Guatemala"},{value:"America/Guayaquil",name:"Guayaquil"},{value:"America/Guyana",name:"Guyana"},{value:"America/Halifax",name:"Halifax"},{value:"America/Havana",name:"Havana"},{value:"America/Hermosillo",name:"Hermosillo"},{value:"America/Indiana/Indianapolis",name:"Indiana - Indianapolis"},{value:"America/Indiana/Knox",name:"Indiana - Knox"},{value:"America/Indiana/Marengo",name:"Indiana - Marengo"},{value:"America/Indiana/Petersburg",name:"Indiana - Petersburg"},{value:"America/Indiana/Tell_City",name:"Indiana - Tell City"},{value:"America/Indiana/Vevay",name:"Indiana - Vevay"},{value:"America/Indiana/Vincennes",name:"Indiana - Vincennes"},{value:"America/Indiana/Winamac",name:"Indiana - Winamac"},{value:"America/Indianapolis",name:"Indianapolis"},{value:"America/Inuvik",name:"Inuvik"},{value:"America/Iqaluit",name:"Iqaluit"},{value:"America/Jamaica",name:"Jamaica"},{value:"America/Jujuy",name:"Jujuy"},{value:"America/Juneau",name:"Juneau"},{value:"America/Kentucky/Louisville",name:"Kentucky - Louisville"},{value:"America/Kentucky/Monticello",name:"Kentucky - Monticello"},{value:"America/Knox_IN",name:"Knox IN"},{value:"America/La_Paz",name:"La Paz"},{value:"America/Lima",name:"Lima"},{value:"America/Los_Angeles",name:"Los Angeles"},{value:"America/Louisville",name:"Louisville"},{value:"America/Maceio",name:"Maceio"},{value:"America/Managua",name:"Managua"},{value:"America/Manaus",name:"Manaus"},{value:"America/Marigot",name:"Marigot"},{value:"America/Martinique",name:"Martinique"},{value:"America/Matamoros",name:"Matamoros"},{value:"America/Mazatlan",name:"Mazatlan"},{value:"America/Mendoza",name:"Mendoza"},{value:"America/Menominee",name:"Menominee"},{value:"America/Merida",name:"Merida"},{value:"America/Mexico_City",name:"Mexico City"},{value:"America/Miquelon",name:"Miquelon"},{value:"America/Moncton",name:"Moncton"},{value:"America/Monterrey",name:"Monterrey"},{value:"America/Montevideo",name:"Montevideo"},{value:"America/Montreal",name:"Montreal"},{value:"America/Montserrat",name:"Montserrat"},{value:"America/Nassau",name:"Nassau"},{value:"America/New_York",name:"New York"},{value:"America/Nipigon",name:"Nipigon"},{value:"America/Nome",name:"Nome"},{value:"America/Noronha",name:"Noronha"},{value:"America/North_Dakota/Center",name:"North Dakota - Center"},{value:"America/North_Dakota/New_Salem",name:"North Dakota - New Salem"},{value:"America/Ojinaga",name:"Ojinaga"},{value:"America/Panama",name:"Panama"},{value:"America/Pangnirtung",name:"Pangnirtung"},{value:"America/Paramaribo",name:"Paramaribo"},{value:"America/Phoenix",name:"Phoenix"},{value:"America/Port-au-Prince",name:"Port-au-Prince"},{value:"America/Porto_Acre",name:"Porto Acre"},{value:"America/Port_of_Spain",name:"Port of Spain"},{value:"America/Porto_Velho",name:"Porto Velho"},{value:"America/Puerto_Rico",name:"Puerto Rico"},{value:"America/Rainy_River",name:"Rainy River"},{value:"America/Rankin_Inlet",name:"Rankin Inlet"},{value:"America/Recife",name:"Recife"},{value:"America/Regina",name:"Regina"},{value:"America/Resolute",name:"Resolute"},{value:"America/Rio_Branco",name:"Rio Branco"},{value:"America/Rosario",name:"Rosario"},{value:"America/Santa_Isabel",name:"Santa Isabel"},{value:"America/Santarem",name:"Santarem"},{value:"America/Santiago",name:"Santiago"},{value:"America/Santo_Domingo",name:"Santo Domingo"},{value:"America/Sao_Paulo",name:"Sao Paulo"},{value:"America/Scoresbysund",name:"Scoresbysund"},{value:"America/Shiprock",name:"Shiprock"},{value:"America/St_Barthelemy",name:"St Barthelemy"},{value:"America/St_Johns",name:"St Johns"},{value:"America/St_Kitts",name:"St Kitts"},{value:"America/St_Lucia",name:"St Lucia"},{value:"America/St_Thomas",name:"St Thomas"},{value:"America/St_Vincent",name:"St Vincent"},{value:"America/Swift_Current",name:"Swift Current"},{value:"America/Tegucigalpa",name:"Tegucigalpa"},{value:"America/Thule",name:"Thule"},{value:"America/Thunder_Bay",name:"Thunder Bay"},{value:"America/Tijuana",name:"Tijuana"},{value:"America/Toronto",name:"Toronto"},{value:"America/Tortola",name:"Tortola"},{value:"America/Vancouver",name:"Vancouver"},{value:"America/Virgin",name:"Virgin"},{value:"America/Whitehorse",name:"Whitehorse"},{value:"America/Winnipeg",name:"Winnipeg"},{value:"America/Yakutat",name:"Yakutat"},{value:"America/Yellowknife",name:"Yellowknife"}]},{group:"Europe",zones:[{value:"Europe/Amsterdam",name:"Amsterdam"},{value:"Europe/Andorra",name:"Andorra"},{value:"Europe/Athens",name:"Athens"},{value:"Europe/Belfast",name:"Belfast"},{value:"Europe/Belgrade",name:"Belgrade"},{value:"Europe/Berlin",name:"Berlin"},{value:"Europe/Bratislava",name:"Bratislava"},{value:"Europe/Brussels",name:"Brussels"},{value:"Europe/Bucharest",name:"Bucharest"},{value:"Europe/Budapest",name:"Budapest"},{value:"Europe/Chisinau",name:"Chisinau"},{value:"Europe/Copenhagen",name:"Copenhagen"},{value:"Europe/Dublin",name:"Dublin"},{value:"Europe/Gibraltar",name:"Gibraltar"},{value:"Europe/Guernsey",name:"Guernsey"},{value:"Europe/Helsinki",name:"Helsinki"},{value:"Europe/Isle_of_Man",name:"Isle of Man"},{value:"Europe/Istanbul",name:"Istanbul"},{value:"Europe/Jersey",name:"Jersey"},{value:"Europe/Kaliningrad",name:"Kaliningrad"},{value:"Europe/Kiev",name:"Kiev"},{value:"Europe/Lisbon",name:"Lisbon"},{value:"Europe/Ljubljana",name:"Ljubljana"},{value:"Europe/London",name:"London"},{value:"Europe/Luxembourg",name:"Luxembourg"},{value:"Europe/Madrid",name:"Madrid"},{value:"Europe/Malta",name:"Malta"},{value:"Europe/Mariehamn",name:"Mariehamn"},{value:"Europe/Minsk",name:"Minsk"},{value:"Europe/Monaco",name:"Monaco"},{value:"Europe/Moscow",name:"Moscow"},{value:"Europe/Nicosia",name:"Nicosia"},{value:"Europe/Oslo",name:"Oslo"},{value:"Europe/Paris",name:"Paris"},{value:"Europe/Podgorica",name:"Podgorica"},{value:"Europe/Prague",name:"Prague"},{value:"Europe/Riga",name:"Riga"},{value:"Europe/Rome",name:"Rome"},{value:"Europe/Samara",name:"Samara"},{value:"Europe/San_Marino",name:"San Marino"},{value:"Europe/Sarajevo",name:"Sarajevo"},{value:"Europe/Simferopol",name:"Simferopol"},{value:"Europe/Skopje",name:"Skopje"},{value:"Europe/Sofia",name:"Sofia"},{value:"Europe/Stockholm",name:"Stockholm"},{value:"Europe/Tallinn",name:"Tallinn"},{value:"Europe/Tirane",name:"Tirane"},{value:"Europe/Tiraspol",name:"Tiraspol"},{value:"Europe/Uzhgorod",name:"Uzhgorod"},{value:"Europe/Vaduz",name:"Vaduz"},{value:"Europe/Vatican",name:"Vatican"},{value:"Europe/Vienna",name:"Vienna"},{value:"Europe/Vilnius",name:"Vilnius"},{value:"Europe/Volgograd",name:"Volgograd"},{value:"Europe/Warsaw",name:"Warsaw"},{value:"Europe/Zagreb",name:"Zagreb"},{value:"Europe/Zaporozhye",name:"Zaporozhye"},{value:"Europe/Zurich",name:"Zurich"}]},{group:"Asia",zones:[{value:"Asia/Aden",name:"Aden"},{value:"Asia/Almaty",name:"Almaty"},{value:"Asia/Amman",name:"Amman"},{value:"Asia/Anadyr",name:"Anadyr"},{value:"Asia/Aqtau",name:"Aqtau"},{value:"Asia/Aqtobe",name:"Aqtobe"},{value:"Asia/Ashgabat",name:"Ashgabat"},{value:"Asia/Ashkhabad",name:"Ashkhabad"},{value:"Asia/Baghdad",name:"Baghdad"},{value:"Asia/Bahrain",name:"Bahrain"},{value:"Asia/Baku",name:"Baku"},{value:"Asia/Bangkok",name:"Bangkok"},{value:"Asia/Beirut",name:"Beirut"},{value:"Asia/Bishkek",name:"Bishkek"},{value:"Asia/Brunei",name:"Brunei"},{value:"Asia/Calcutta",name:"Calcutta"},{value:"Asia/Choibalsan",name:"Choibalsan"},{value:"Asia/Chongqing",name:"Chongqing"},{value:"Asia/Chungking",name:"Chungking"},{value:"Asia/Colombo",name:"Colombo"},{value:"Asia/Dacca",name:"Dacca"},{value:"Asia/Damascus",name:"Damascus"},{value:"Asia/Dhaka",name:"Dhaka"},{value:"Asia/Dili",name:"Dili"},{value:"Asia/Dubai",name:"Dubai"},{value:"Asia/Dushanbe",name:"Dushanbe"},{value:"Asia/Gaza",name:"Gaza"},{value:"Asia/Harbin",name:"Harbin"},{value:"Asia/Ho_Chi_Minh",name:"Ho Chi Minh"},{value:"Asia/Hong_Kong",name:"Hong Kong"},{value:"Asia/Hovd",name:"Hovd"},{value:"Asia/Irkutsk",name:"Irkutsk"},{value:"Asia/Istanbul",name:"Istanbul"},{value:"Asia/Jakarta",name:"Jakarta"},{value:"Asia/Jayapura",name:"Jayapura"},{value:"Asia/Jerusalem",name:"Jerusalem"},{value:"Asia/Kabul",name:"Kabul"},{value:"Asia/Kamchatka",name:"Kamchatka"},{value:"Asia/Karachi",name:"Karachi"},{value:"Asia/Kashgar",name:"Kashgar"},{value:"Asia/Kathmandu",name:"Kathmandu"},{value:"Asia/Katmandu",name:"Katmandu"},{value:"Asia/Kolkata",name:"Kolkata"},{value:"Asia/Krasnoyarsk",name:"Krasnoyarsk"},{value:"Asia/Kuala_Lumpur",name:"Kuala Lumpur"},{value:"Asia/Kuching",name:"Kuching"},{value:"Asia/Kuwait",name:"Kuwait"},{value:"Asia/Macao",name:"Macao"},{value:"Asia/Macau",name:"Macau"},{value:"Asia/Magadan",name:"Magadan"},{value:"Asia/Makassar",name:"Makassar"},{value:"Asia/Manila",name:"Manila"},{value:"Asia/Muscat",name:"Muscat"},{value:"Asia/Nicosia",name:"Nicosia"},{value:"Asia/Novokuznetsk",name:"Novokuznetsk"},{value:"Asia/Novosibirsk",name:"Novosibirsk"},{value:"Asia/Omsk",name:"Omsk"},{value:"Asia/Oral",name:"Oral"},{value:"Asia/Phnom_Penh",name:"Phnom Penh"},{value:"Asia/Pontianak",name:"Pontianak"},{value:"Asia/Pyongyang",name:"Pyongyang"},{value:"Asia/Qatar",name:"Qatar"},{value:"Asia/Qyzylorda",name:"Qyzylorda"},{value:"Asia/Rangoon",name:"Rangoon"},{value:"Asia/Riyadh",name:"Riyadh"},{value:"Asia/Saigon",name:"Saigon"},{value:"Asia/Sakhalin",name:"Sakhalin"},{value:"Asia/Samarkand",name:"Samarkand"},{value:"Asia/Seoul",name:"Seoul"},{value:"Asia/Shanghai",name:"Shanghai"},{value:"Asia/Singapore",name:"Singapore"},{value:"Asia/Taipei",name:"Taipei"},{value:"Asia/Tashkent",name:"Tashkent"},{value:"Asia/Tbilisi",name:"Tbilisi"},{value:"Asia/Tehran",name:"Tehran"},{value:"Asia/Tel_Aviv",name:"Tel Aviv"},{value:"Asia/Thimbu",name:"Thimbu"},{value:"Asia/Thimphu",name:"Thimphu"},{value:"Asia/Tokyo",name:"Tokyo"},{value:"Asia/Ujung_Pandang",name:"Ujung Pandang"},{value:"Asia/Ulaanbaatar",name:"Ulaanbaatar"},{value:"Asia/Ulan_Bator",name:"Ulan Bator"},{value:"Asia/Urumqi",name:"Urumqi"},{value:"Asia/Vientiane",name:"Vientiane"},{value:"Asia/Vladivostok",name:"Vladivostok"},{value:"Asia/Yakutsk",name:"Yakutsk"},{value:"Asia/Yekaterinburg",name:"Yekaterinburg"},{value:"Asia/Yerevan",name:"Yerevan"}]},{group:"Africa",zones:[{value:"Africa/Abidjan",name:"Abidjan"},{value:"Africa/Accra",name:"Accra"},{value:"Africa/Addis_Ababa",name:"Addis Ababa"},{value:"Africa/Algiers",name:"Algiers"},{value:"Africa/Asmara",name:"Asmara"},{value:"Africa/Asmera",name:"Asmera"},{value:"Africa/Bamako",name:"Bamako"},{value:"Africa/Bangui",name:"Bangui"},{value:"Africa/Banjul",name:"Banjul"},{value:"Africa/Bissau",name:"Bissau"},{value:"Africa/Blantyre",name:"Blantyre"},{value:"Africa/Brazzaville",name:"Brazzaville"},{value:"Africa/Bujumbura",
-name:"Bujumbura"},{value:"Africa/Cairo",name:"Cairo"},{value:"Africa/Casablanca",name:"Casablanca"},{value:"Africa/Ceuta",name:"Ceuta"},{value:"Africa/Conakry",name:"Conakry"},{value:"Africa/Dakar",name:"Dakar"},{value:"Africa/Dar_es_Salaam",name:"Dar es Salaam"},{value:"Africa/Djibouti",name:"Djibouti"},{value:"Africa/Douala",name:"Douala"},{value:"Africa/El_Aaiun",name:"El Aaiun"},{value:"Africa/Freetown",name:"Freetown"},{value:"Africa/Gaborone",name:"Gaborone"},{value:"Africa/Harare",name:"Harare"},{value:"Africa/Johannesburg",name:"Johannesburg"},{value:"Africa/Kampala",name:"Kampala"},{value:"Africa/Khartoum",name:"Khartoum"},{value:"Africa/Kigali",name:"Kigali"},{value:"Africa/Kinshasa",name:"Kinshasa"},{value:"Africa/Lagos",name:"Lagos"},{value:"Africa/Libreville",name:"Libreville"},{value:"Africa/Lome",name:"Lome"},{value:"Africa/Luanda",name:"Luanda"},{value:"Africa/Lubumbashi",name:"Lubumbashi"},{value:"Africa/Lusaka",name:"Lusaka"},{value:"Africa/Malabo",name:"Malabo"},{value:"Africa/Maputo",name:"Maputo"},{value:"Africa/Maseru",name:"Maseru"},{value:"Africa/Mbabane",name:"Mbabane"},{value:"Africa/Mogadishu",name:"Mogadishu"},{value:"Africa/Monrovia",name:"Monrovia"},{value:"Africa/Nairobi",name:"Nairobi"},{value:"Africa/Ndjamena",name:"Ndjamena"},{value:"Africa/Niamey",name:"Niamey"},{value:"Africa/Nouakchott",name:"Nouakchott"},{value:"Africa/Ouagadougou",name:"Ouagadougou"},{value:"Africa/Porto-Novo",name:"Porto-Novo"},{value:"Africa/Sao_Tome",name:"Sao Tome"},{value:"Africa/Timbuktu",name:"Timbuktu"},{value:"Africa/Tripoli",name:"Tripoli"},{value:"Africa/Tunis",name:"Tunis"},{value:"Africa/Windhoek",name:"Windhoek"}]},{group:"Australia",zones:[{value:"Australia/ACT",name:"ACT"},{value:"Australia/Adelaide",name:"Adelaide"},{value:"Australia/Brisbane",name:"Brisbane"},{value:"Australia/Broken_Hill",name:"Broken Hill"},{value:"Australia/Canberra",name:"Canberra"},{value:"Australia/Currie",name:"Currie"},{value:"Australia/Darwin",name:"Darwin"},{value:"Australia/Eucla",name:"Eucla"},{value:"Australia/Hobart",name:"Hobart"},{value:"Australia/LHI",name:"LHI"},{value:"Australia/Lindeman",name:"Lindeman"},{value:"Australia/Lord_Howe",name:"Lord Howe"},{value:"Australia/Melbourne",name:"Melbourne"},{value:"Australia/North",name:"North"},{value:"Australia/NSW",name:"NSW"},{value:"Australia/Perth",name:"Perth"},{value:"Australia/Queensland",name:"Queensland"},{value:"Australia/South",name:"South"},{value:"Australia/Sydney",name:"Sydney"},{value:"Australia/Tasmania",name:"Tasmania"},{value:"Australia/Victoria",name:"Victoria"},{value:"Australia/West",name:"West"},{value:"Australia/Yancowinna",name:"Yancowinna"}]},{group:"Indian",zones:[{value:"Indian/Antananarivo",name:"Antananarivo"},{value:"Indian/Chagos",name:"Chagos"},{value:"Indian/Christmas",name:"Christmas"},{value:"Indian/Cocos",name:"Cocos"},{value:"Indian/Comoro",name:"Comoro"},{value:"Indian/Kerguelen",name:"Kerguelen"},{value:"Indian/Mahe",name:"Mahe"},{value:"Indian/Maldives",name:"Maldives"},{value:"Indian/Mauritius",name:"Mauritius"},{value:"Indian/Mayotte",name:"Mayotte"},{value:"Indian/Reunion",name:"Reunion"}]},{group:"Atlantic",zones:[{value:"Atlantic/Azores",name:"Azores"},{value:"Atlantic/Bermuda",name:"Bermuda"},{value:"Atlantic/Canary",name:"Canary"},{value:"Atlantic/Cape_Verde",name:"Cape Verde"},{value:"Atlantic/Faeroe",name:"Faeroe"},{value:"Atlantic/Faroe",name:"Faroe"},{value:"Atlantic/Jan_Mayen",name:"Jan Mayen"},{value:"Atlantic/Madeira",name:"Madeira"},{value:"Atlantic/Reykjavik",name:"Reykjavik"},{value:"Atlantic/South_Georgia",name:"South Georgia"},{value:"Atlantic/Stanley",name:"Stanley"},{value:"Atlantic/St_Helena",name:"St Helena"}]},{group:"Pacific",zones:[{value:"Pacific/Apia",name:"Apia"},{value:"Pacific/Auckland",name:"Auckland"},{value:"Pacific/Chatham",name:"Chatham"},{value:"Pacific/Easter",name:"Easter"},{value:"Pacific/Efate",name:"Efate"},{value:"Pacific/Enderbury",name:"Enderbury"},{value:"Pacific/Fakaofo",name:"Fakaofo"},{value:"Pacific/Fiji",name:"Fiji"},{value:"Pacific/Funafuti",name:"Funafuti"},{value:"Pacific/Galapagos",name:"Galapagos"},{value:"Pacific/Gambier",name:"Gambier"},{value:"Pacific/Guadalcanal",name:"Guadalcanal"},{value:"Pacific/Guam",name:"Guam"},{value:"Pacific/Honolulu",name:"Honolulu"},{value:"Pacific/Johnston",name:"Johnston"},{value:"Pacific/Kiritimati",name:"Kiritimati"},{value:"Pacific/Kosrae",name:"Kosrae"},{value:"Pacific/Kwajalein",name:"Kwajalein"},{value:"Pacific/Majuro",name:"Majuro"},{value:"Pacific/Marquesas",name:"Marquesas"},{value:"Pacific/Midway",name:"Midway"},{value:"Pacific/Nauru",name:"Nauru"},{value:"Pacific/Niue",name:"Niue"},{value:"Pacific/Norfolk",name:"Norfolk"},{value:"Pacific/Noumea",name:"Noumea"},{value:"Pacific/Pago_Pago",name:"Pago Pago"},{value:"Pacific/Palau",name:"Palau"},{value:"Pacific/Pitcairn",name:"Pitcairn"},{value:"Pacific/Ponape",name:"Ponape"},{value:"Pacific/Port_Moresby",name:"Port Moresby"},{value:"Pacific/Rarotonga",name:"Rarotonga"},{value:"Pacific/Saipan",name:"Saipan"},{value:"Pacific/Samoa",name:"Samoa"},{value:"Pacific/Tahiti",name:"Tahiti"},{value:"Pacific/Tarawa",name:"Tarawa"},{value:"Pacific/Tongatapu",name:"Tongatapu"},{value:"Pacific/Truk",name:"Truk"},{value:"Pacific/Wake",name:"Wake"},{value:"Pacific/Wallis",name:"Wallis"},{value:"Pacific/Yap",name:"Yap"}]},{group:"Antarctica",zones:[{value:"Antarctica/Casey",name:"Casey"},{value:"Antarctica/Davis",name:"Davis"},{value:"Antarctica/DumontDUrville",name:"DumontDUrville"},{value:"Antarctica/Macquarie",name:"Macquarie"},{value:"Antarctica/Mawson",name:"Mawson"},{value:"Antarctica/McMurdo",name:"McMurdo"},{value:"Antarctica/Palmer",name:"Palmer"},{value:"Antarctica/Rothera",name:"Rothera"},{value:"Antarctica/South_Pole",name:"South Pole"},{value:"Antarctica/Syowa",name:"Syowa"},{value:"Antarctica/Vostok",name:"Vostok"}]},{group:"Arctic",zones:[{value:"Arctic/Longyearbyen",name:"Longyearbyen"}]},{group:"UTC",zones:[{value:"UTC",name:"UTC"}]},{group:"Manual Offsets",zones:[{value:"UTC-12",name:"UTC-12"},{value:"UTC-11",name:"UTC-11"},{value:"UTC-10",name:"UTC-10"},{value:"UTC-9",name:"UTC-9"},{value:"UTC-8",name:"UTC-8"},{value:"UTC-7",name:"UTC-7"},{value:"UTC-6",name:"UTC-6"},{value:"UTC-5",name:"UTC-5"},{value:"UTC-4",name:"UTC-4"},{value:"UTC-3",name:"UTC-3"},{value:"UTC-2",name:"UTC-2"},{value:"UTC-1",name:"UTC-1"},{value:"UTC+0",name:"UTC+0"},{value:"UTC+1",name:"UTC+1"},{value:"UTC+2",name:"UTC+2"},{value:"UTC+3",name:"UTC+3"},{value:"UTC+4",name:"UTC+4"},{value:"UTC+5",name:"UTC+5"},{value:"UTC+6",name:"UTC+6"},{value:"UTC+7",name:"UTC+7"},{value:"UTC+8",name:"UTC+8"},{value:"UTC+9",name:"UTC+9"},{value:"UTC+10",name:"UTC+10"},{value:"UTC+11",name:"UTC+11"},{value:"UTC+12",name:"UTC+12"},{value:"UTC+13",name:"UTC+13"},{value:"UTC+14",name:"UTC+14"}]}]}}}),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer",{url:"/motiondialer",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:16}}})}]),angular.module("xCallyShuttleApp").controller("MotionDialerProcessListCtrl",["$scope","$uibModal","$translate","xAlert","Modal","MotionDialerProcess","uiGridConstants","usSpinnerService",function(a,b,c,d,e,f,g,h){a.initView=function(){return a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,columnDefs:[{name:"id",width:60},{name:"name"},{name:"queue",enableSorting:!1},{name:"extension",enableSorting:!1},{name:"id_list",enableSorting:!1,cellTemplate:'<div><a class="btn btn-xs grey-cascade" href="/motiondialer/lists/view/{{row.entity.id_list}}/settings">{{row.entity.id_list}}</a></div>',cellClass:"ui-grid-vcenter"},{name:"status",cellTemplate:"<div><a class=\"btn btn-xs\" data-ng-class=\"row.entity.status == 'STOP' ? 'red-sunglo' : 'green-meadow'\" data-ng-href=\"#\">{{ (row.entity.status === 'RUN') ? 'RUNNING' : 'STOPPED'}}</a></div>",cellClass:"ui-grid-vcenter",filter:{type:g.filter.SELECT,selectOptions:[{value:"RUN",label:"RUNNING"},{value:"STOP",label:"STOPPED"}]}},{name:"updatedtime",sort:{direction:g.DESC},enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs blue-hoki" href="/motiondialer/processes/view/{{row.entity.id}}/overview"><i class="icon-settings"></a> <a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteItem(row.entity.name, row.entity.id)"><i class="icon-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},f.list({page:1,size:6e5}).$promise.then(function(b){console.log(b),b.status>0?a.gridOptions.data=b.response.RMI.rows:d.show("Please, check your connection!","danger")})["catch"](function(a){d.error(a)})["finally"](function(){h.stop("spinner-grid")})},a.createProcessQueue=function(){var c=b.open({animation:!0,templateUrl:"app/motiondialer/process/list/list.create.queue.modal.html",controller:"MotionDialerProcessListCreateQueueCtrl"});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.createProcessSquare=function(){var c=b.open({animation:!0,templateUrl:"app/motiondialer/process/list/list.create.square.modal.html",controller:"MotionDialerProcessListCreateSquareCtrl"});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.deleteItem=e.confirm["delete"](function(b){return f["delete"]({id:b}).$promise.then(function(e){e.status>0?(_.remove(a.gridOptions.data,{id:b}),d.show(c.instant("MESSAGE_WELL_DONE"),"success")):d.show(e.message||"Please, check your connection!","danger")})["catch"](function(a){d.error(a)})})}]),angular.module("xCallyShuttleApp").controller("MotionDialerProcessListCreateQueueCtrl",["$scope","$translate","$uibModalInstance","MotionDialerProcess","MotionDialerList","Trunk","VoiceQueue","Route","xAlert",function(a,b,c,d,e,f,g,h,i){a.form={},a.item={fetch_sort:"ASC",timeout:3},a.initModal=function(){return g.get().$promise.then(function(b){return a.queues={},b&&(a.queues=b.rows),f.get().$promise}).then(function(b){return a.trunks={},b&&(a.trunks=b.rows),a.trunks.push({name:"fake"}),e.list({page:1,size:6e5}).$promise}).then(function(b){a.lists={},b.status>0?a.lists=b.response.RMI.rows:i.show("Please, check your connection!","danger")})["catch"](function(a){i.error(a)})},a.save=function(){console.log(a.item);var e="process_"+a.item.name+"_queue_"+a.item.queue.name+"_"+Math.round(1e5*Math.random()),f="Generated by Motion Dialer, Process Queue"+(a.item.description?", "+a.item.description:"");return h.save({appdata:"Internal Call",context:"from-sip",exten:e.replace(/\s/g,"_"),type:"internal",description:f,Applications:[{appdata:["CDR(type)=tigerdial"],app:"Set",interval:"*,*,*,*",type:"internal"},{appdata:["QUEUE_PRIO=99"],app:"Set",interval:"*,*,*,*",type:"internal"},{appdata:[a.item.queue.name,"","","",a.item.timeout],app:"Queue",interval:"*,*,*,*",type:"internal"}]}).$promise.then(function(b){return console.log(b),d.insert({name:a.item.name,id_list:a.item.list.id,queue:a.item.queue.name,device:a.item.device.name,context:"from-sip",extension:e.replace(/\s/g,"_"),description:a.item.description,auto_closed:!0,fetch_sort:a.item.fetch_sort}).$promise}).then(function(a){a.status>0?(i.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):i.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){i.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("MotionDialerProcessListCreateSquareCtrl",["$scope","$translate","$uibModalInstance","MotionDialerProcess","MotionDialerList","SquareProject","Trunk","Route","xAlert",function(a,b,c,d,e,f,g,h,i){a.form={},a.item={fetch_sort:"ASC"},a.initModal=function(){return f.get().$promise.then(function(b){return a.projects={},b&&(a.projects=b.rows),g.get().$promise}).then(function(b){return a.trunks={},b&&(a.trunks=b.rows),a.trunks.push({name:"fake"}),e.list({page:1,size:6e5}).$promise}).then(function(b){a.lists={},b.status>0?a.lists=b.response.RMI.rows:i.show("Please, check your connection!","danger")})["catch"](function(a){i.error(a)})},a.save=function(){console.log(a.item);var e="process_"+a.item.name+"_square_"+a.item.project.name+"_"+Math.round(1e5*Math.random()),f="Generated by Motion Dialer, Process Square"+(a.item.description?", "+a.item.description:"");return h.save({appdata:"Internal Call",context:"from-sip",exten:e.replace(/\s/g,"_"),type:"internal",description:f,Applications:[{appdata:["CDR(type)=tigerdial"],app:"Set",interval:"*,*,*,*",type:"internal"},{appdata:["agi://127.0.0.1/square",a.item.project.name],app:"AGI",interval:"*,*,*,*",type:"internal"}]}).$promise.then(function(b){return console.log(b),d.insert({name:a.item.name,id_list:a.item.list.id,queue:"none",device:a.item.device.name,context:"from-sip",extension:e.replace(/\s/g,"_"),description:a.item.description,auto_closed:!0,channel_limit:15,fetch_sort:a.item.fetch_sort}).$promise}).then(function(a){a.status>0?(i.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):i.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){i.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.processes.list",{url:"/list",templateUrl:"app/motiondialer/process/list/list.html",controller:"MotionDialerProcessListCtrl",authenticate:!0})}]),angular.module("xCallyShuttleApp").factory("MotionDialerProcess",["$resource",function(a){return a("/api/rest/process/:controller",null,{list:{method:"POST",params:{controller:"list"}},insert:{method:"POST",params:{controller:"insert"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},update:{method:"POST",params:{controller:"update"}}})}]),angular.module("xCallyShuttleApp").factory("MotionDialerSpooler",["$resource",function(a){return a("/api/rest/spooler/:controller/:retrieve/:peer",null,{list:{method:"POST",params:{controller:"list"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},summary:{method:"POST",params:{controller:"summary"}},close:{method:"POST",params:{controller:"retrieve",retrieve:"close"}},open:{method:"POST",params:{controller:"retrieve",retrieve:"open"}},blacklist:{method:"POST",params:{controller:"retrieve",retrieve:"blacklist"}},planning:{method:"POST",params:{controller:"retrieve",retrieve:"planning"}},planningpeer:{method:"POST",params:{controller:"retrieve",retrieve:"planning",peer:"peer"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.processes",{url:"/processes",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("MotionDialerProcessViewCtrl",["$scope","$translate","$stateParams","$uibModal","xAlert","uiGridConstants","usSpinnerService","MotionDialerProcess","MotionDialerSpooler","Modal","VoiceQueue",function(a,b,c,d,e,f,g,h,i,j,k){a.process={},a.techs=["SIP","IAX","LOCAL","KHOMP"],a.dialFormats=["tech/device/number","tech/number@device"],a.checkDuplicates=["ALWAYS","IFOPEN","NO"],a.codecs=["g729","ilbc","gsm","ulaw","alaw"],a.getProcess=function(){return h.find({id:parseInt(c.id)}).$promise.then(function(b){console.log(b),b.status>0?(b.response.RMI.codecs=b.response.RMI.codecs.split(","),a.process=b.response.RMI):e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.getSummary=function(){return i.summary({id_process:parseInt(c.id)}).$promise.then(function(b){if(b.status>0){a.summary=b.response.RMI.totals,a.total=0;for(var c=0;c<a.summary.length;c++)a.total+=a.summary[c][1]}else e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})["finally"](function(){g.stop("spinner-grid")})},a.updateProcess=function(){var c=_.clone(a.process);return delete c.updatedtime,delete c.id_list,delete c.createdtime,delete c.runtime,delete c.fetch_sort,c.codecs=c.codecs.join(","),""===c.timezone&&delete c.timezone,h.update(c).$promise.then(function(c){c.status>0?(c.response.RMI.codecs=c.response.RMI.codecs.split(","),a.process=c.response.RMI,e.show(b.instant("MESSAGE_WELL_DONE"),"success")):c.response.RMI.errors.forEach(function(a){a?e.show(a.field+": "+a.error,"danger"):e.show("Please, check your connection!","danger")})})["catch"](function(a){e.error(a)})},a.getSpooler=function(){return a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,headerCellFilter:"translate",columnDefs:[{name:"name"},{name:"phones",cellTemplate:"<div>{{row.entity.phones.join(',')}}</div>",cellClass:"ui-grid-vcenter"},{name:"retrieve",filter:{type:f.filter.SELECT,selectOptions:[{value:"PLANNED_PEER",label:"PLANNED PEER"},{value:"PLANNED",label:"PLANNED"},{value:"BLACK_LIST",label:"BLACKLIST"},{value:"OPEN",label:"OPEN"},{value:"CLOSED",label:"CLOSED"},{value:"MAX_ATTEMPTS",label:"MAX ATTEMPTS"},{value:"COUNTER_BLOCK",label:"COUNTER BLOCK"},{value:"PLANNED_REQUEST",label:"PLANNED REQUEST"},{value:"DELETE",label:"DELETE"}]}},{name:"counter",enableFiltering:!1},{name:"planningtime",cellTemplate:"<div>{{row.entity.planningtime | date:'yyyy-MM-dd HH:mm'}}</div>",cellClass:"ui-grid-vcenter",enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs green" data-ng-click="grid.appScope.historySpooler(row.entity.history)"><i class="icon-info"></i></a> <a class="btn btn-xs blue-hoki" data-ng-click="grid.appScope.editSpooler(row.entity)"><i class="icon-settings"></i></a> <a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteSpooler(row.entity.phones.join(), row.entity.id)"><i class="fa fa-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},i.list({id_process:parseInt(c.id),page:1,size:6e5}).$promise.then(function(b){b.status>0?a.gridOptions.data=b.response.RMI.rows:e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})["finally"](function(){g.stop("spinner-grid")})},a.deleteSpooler=j.confirm["delete"](function(c){return i["delete"]({id:c}).$promise.then(function(d){d.status>0?(_.remove(a.gridOptions.data,{id:c}),e.show(b.instant("MESSAGE_WELL_DONE"),"success")):e.show(d.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})}),a.historySpooler=function(b){var c=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.spooler.history.modal.html",controller:"MotionDialerViewSpoolerHistoryCtrl",resolve:{historySpooler:function(){return b}}});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.editSpooler=function(a){var b=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.spooler.edit.modal.html",controller:"MotionDialerViewSpoolerEditCtrl",resolve:{entitySpooler:function(){return a}}});b.result.then(function(){})},a.initSettings=function(){return a.queues=null,k.get().$promise.then(function(b){b&&(a.queues=b.rows,a.process.queue&&"none"!==a.process.queue&&(a.queue=_.find(b.rows,{name:a.process.queue})))})["catch"](function(a){e.error(a)})},a.createInterval=function(b){var c=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.create.interval.modal.html",controller:"MotionDialerViewCreateIntervalCtrl",resolve:{objectProcess:function(){return a.process},intervalType:function(){return b},intervalValue:function(){return b?"8:00-20:00|MON-FRI|*|*":"00:01-07:59|SAT-SUN|*|*"}}});c.result.then(function(b){a.process=b})},a.editInterval=function(b,c){var e=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.create.interval.modal.html",controller:"MotionDialerViewCreateIntervalCtrl",resolve:{objectProcess:function(){return a.process},intervalType:function(){return b},intervalValue:function(){return c}}});e.result.then(function(b){a.process=b})},a.deleteInterval=j.confirm["delete"](function(c,d){var f={id:a.process.id};return d?(f.intervals=[],f.intervals=f.intervals.concat(a.process.intervals),f.intervals.splice(c,1)):(f.not_intervals=[],f.not_intervals=f.not_intervals.concat(a.process.not_intervals),f.not_intervals.splice(c,1)),h.update(f).$promise.then(function(c){c.status>0?(c.response.RMI.codecs=c.response.RMI.codecs.split(","),a.process=c.response.RMI,e.show(b.instant("MESSAGE_WELL_DONE"),"success")):c.response.RMI.errors.forEach(function(a){a?e.show(a.field+": "+a.error,"danger"):e.show("Please, check your connection!","danger")})})["catch"](function(a){e.error(a)})}),a.runOrStop=function(){var b=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.run.process.modal.html",controller:"MotionDialerViewRunProcessCtrl",resolve:{statusProcess:function(){return a.process.status}}});b.result.then(function(b){a.process.status=b.status})}}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewCreateIntervalCtrl",["$scope","$translate","$uibModalInstance","$stateParams","MotionDialerProcess","xAlert","objectProcess","intervalType","intervalValue","interval",function(a,b,c,d,e,f,g,h,i,j){function k(a){var b,c=a.split("|"),d={};return c.forEach(function(a,c){switch(c){case 0:"*"!==a?(b=a.split("-"),d.t_from=moment(b[0],"HH:mm"),d.t_to=moment(b[1],"HH:mm"),d.alwaysTime=!1):(d.t_from=moment(new Date),d.t_to=moment(new Date),d.alwaysTime=!0);break;case 1:"*"!==a?(b=a.split("-"),d.wd_from=b[0].toLowerCase(),d.wd_to=b[1]?b[1].toLowerCase():"always"):(d.wd_from="always",d.wd_to="always");break;case 2:"*"!==a?(b=a.split("-"),d.md_from=b[0],d.md_to=b[1]?b[1]:"always"):(d.md_from="always",d.md_to="always");break;case 3:"*"!==a?(b=a.split("-"),d.m_from=b[0],d.m_to=b[1]?b[1]:"always"):(d.m_from="always",d.m_to="always")}}),d}function l(a){var b,c,d,e;return b=a.t_from&&a.t_to&&!a.alwaysTime?moment(a.t_from).format("HH:mm")+"-"+moment(a.t_to).format("HH:mm"):"*",a.wd_from&&"always"!==a.wd_from?(c=a.wd_from.toUpperCase(),a.wd_to&&"always"!==a.wd_to&&(c+="-"+a.wd_to.toUpperCase())):c="*",a.md_from&&"always"!==a.md_from?(d=a.md_from,a.md_to&&"always"!==a.md_to&&(d+="-"+a.md_to)):d="*",a.m_from&&"always"!==a.m_from?(e=a.m_from,a.m_to&&"always"!==a.m_to&&(e+="-"+a.m_to)):e="*",b+"|"+c+"|"+d+"|"+e}a.form={},a.$interval=j.interval,a.splittedInterval=k(i),a.save=function(){var d=l(a.splittedInterval);console.log(d);var i={id:g.id};return h?(i.intervals=[],i.intervals=i.intervals.concat(g.intervals),i.intervals.push(d)):(i.not_intervals=[],i.not_intervals=i.not_intervals.concat(g.not_intervals),i.not_intervals.push(d)),console.log(i),e.update(i).$promise.then(function(a){a.status>0?(a.response.RMI.codecs=a.response.RMI.codecs.split(","),f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a.response.RMI)):a.response.RMI.errors.forEach(function(a){a?f.show(a.field+": "+a.error,"danger"):f.show("Please, check your connection!","danger")})})["catch"](function(a){f.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.processes.view",{url:"/view/:id",templateUrl:"app/motiondialer/process/view/view.html",controller:"MotionDialerProcessViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.motiondialer.processes.view.overview",{url:"/overview",templateUrl:"app/motiondialer/process/view/view.overview.html"}).state("main.motiondialer.processes.view.settings",{url:"/settings",templateUrl:"app/motiondialer/process/view/view.settings.html"}).state("main.motiondialer.processes.view.intervals",{url:"/intervals",templateUrl:"app/motiondialer/process/view/view.intervals.html"}).state("main.motiondialer.processes.view.spooler",{url:"/spooler",templateUrl:"app/motiondialer/process/view/view.spooler.html"})}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewRunProcessCtrl",["$scope","$stateParams","$uibModalInstance","$translate","statusProcess","MotionDialerProcess","xAlert",function(a,b,c,d,e,f,g){a.status="RUN"===e?"STOP":"RUN",a.yes=function(){f.update({id:parseInt(b.id),status:a.status}).$promise.then(function(a){a.status>0?(g.show(d.instant("MESSAGE_WELL_DONE"),"success"),c.close(a.response.RMI)):g.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){g.error(a)})},a.no=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewSpoolerEditCtrl",["$scope","$translate","$uibModalInstance","$stateParams","MotionDialerSpooler","xAlert","entitySpooler","Agent",function(a,b,c,d,e,f,g,h){a.moment=moment,a.initModal=function(){return h.get().$promise.then(function(b){a.agents=[],b&&b.rows.forEach(function(b){a.agents.push("SIP/"+b.name)})})["catch"](function(a){f.error(a)})},a.entitySpooler=g,a.save=function(){var d;switch(a.entitySpooler.retrieve){case"CLOSED":d=e.close({id:parseInt(a.entitySpooler.id)});break;case"OPEN":d=e.open({id:parseInt(a.entitySpooler.id)});break;case"BLACK_LIST":d=e.blacklist({id:parseInt(a.entitySpooler.id)});break;case"PLANNED":d=e.planning({id:parseInt(a.entitySpooler.id),date:moment(a.entitySpooler.planningtime).format("YYYY-MM-DD HH:mm")});break;case"PLANNED_PEER":d=e.planningpeer({id:parseInt(a.entitySpooler.id),date:moment(a.entitySpooler.planningtime).format("YYYY-MM-DD HH:mm"),peer:a.entitySpooler.planningpeer})}d?d.$promise.then(function(a){console.log(a),a.status>0?(f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close()):a.response.RMI.errors.forEach(function(a){a?f.show(a.field+": "+a.error,"danger"):f.show("Please, check your connection!","danger")})})["catch"](function(a){f.error(a)}):f.show("RETRIEVE NOT FOUND","danger")},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewSpoolerHistoryCtrl",["$scope","$translate","$uibModalInstance","$stateParams","MotionDialerSpooler","xAlert","historySpooler",function(a,b,c,d,e,f,g){a.historySpooler=g,a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("ResetCtrl",["$scope","Auth","$location","$window","$rootScope","Setting","xAlert","$stateParams","$state",function(a,b,c,d,e,f,g,h,i){a.userReset={},a.getInfo=function(){return f.get({controller:"info"}).$promise.then(function(b){a.info=b})["catch"](function(a){console.error(a)})},e.bodyLayout="login",a.$on("$viewContentLoaded",function(){Metronic.init(),Layout.init()}),a.reset=function(){b.reset({token:h.token,password:a.userReset.password}).then(function(){i.go("login",{reset:!0})})["catch"](function(a){g.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("reset",{url:"/reset/:token",templateUrl:"app/reset/reset.html",controller:"ResetCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/login.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("SalesforceListCtrl",["$scope","SalesforceAccount","gridOptions","xAlert","$translate",function(a,b,c,d,e){a.initView=function(){var d={exporterCsvFilename:"salesforce_account.csv",columnDefs:[{name:"name",displayName:"APPLICATION_NAME"},{name:"username"},{name:"remoteUri",displayName:"APPLICATION_URI"},{name:"action",buttons:[{"class":"blue-hoki",href:"/salesforce/view/{{row.entity.id}}/account",name:"profile"},{"class":"green-jungle",name:"check",onClick:"grid.appScope.checkAccount(row.entity.id)"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=c.gridOptions(b,d,a)},a.checkAccount=function(a){return b.check({id:a}).$promise.then(function(){d.show(e.instant("MESSAGE_ACCOUNT_VERIFIED"),"success")})["catch"](function(){d.show(e.instant("MESSAGE_ACCOUNT_INVALID"),"danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.list",{url:"/list",templateUrl:"app/salesforce/list/list.html",controller:"SalesforceListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("SalesforceAccount",["$resource",function(a){return a("/api/salesforce/accounts/:id/:controller",{id:"@id"},{update:{method:"PUT"},fields:{params:{controller:"fields"},isArray:!0},check:{params:{controller:"check"}}})}]).factory("SalesforceConfiguration",["$resource",function(a){return a("/api/salesforce/accounts/:accountId/configurations/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]).factory("SalesforceField",["$resource",function(a){return a("/api/salesforce/accounts/:accountId/configurations/:configurationId/fields/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce",{url:"/salesforce",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.view.configurations",{url:"/configurations",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("SalesforceViewConfigurationListCtrl",["$scope","$stateParams","$translate","gridOptions","SalesforceConfiguration","$uibModal",function(a,b,c,d,e,f){a.initView=function(){var c={exporterCsvFilename:"salesforce_configurations.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:125,buttons:[{"class":"blue-hoki",href:"/salesforce/view/{{row.entity.AccountId}}/configurations/view/{{row.entity.id}}",name:"profile"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=d.gridOptions(e,c,a,{accountId:b.id})},a.createItem=function(){var b=f.open({animation:!0,templateUrl:"app/salesforce/view/configuration/list/create.modal.html",controller:"SalesforceCreateConfigurationCtrl"});b.result.then(function(){a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("SalesforceCreateConfigurationCtrl",["$scope","$translate","$uibModalInstance","SalesforceConfiguration","xAlert","$stateParams","channel",function(a,b,c,d,e,f,g){a.form={},a.item={},a.channels=g,a.item.channel="voice",a.item.type="Queue",a.save=function(){return d.save({accountId:f.id},a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.view.configurations.list",{url:"/list",templateUrl:"app/salesforce/view/configuration/list/list.html",controller:"SalesforceViewConfigurationListCtrl"})}]),angular.module("xCallyShuttleApp").controller("SalesforceViewConfigurationViewCtrl",["$scope","$filter","$stateParams","$translate","socket","variable","xAlert","SalesforceAccount","SalesforceConfiguration","SalesforceField","Variable",function(a,b,c,d,e,f,g,h,i,j,k){a.$on("$destroy",function(){e.unsyncUpdates("salesforce_field")}),a.config={autoHideScrollbar:!1,theme:"dark",advanced:{updateOnContentResize:!0},setHeight:300,scrollInertia:0},a.fieldType=[{type:"string",title:"String"},{type:"variable",title:"Variable"},{type:"customVariable",title:"Custom Variable"}],a.descFieldType=[{type:"string",title:"String"},{type:"keyValue",title:"Key Value"}],a.groupVariableByGroup=function(a){switch(a.group){case"voice_queue":return"Voice: Queue";default:return"Other"}},a.initView=function(){a.configurationName="",a.subjectConfig=[],a.descriptionConfig=[],a.fieldConfig=[],a.variables=f},a.getConfiguration=function(){return i.get({accountId:c.id,id:c.configurationId}).$promise.then(function(b){a.configurationName=b.name,a.subjectConfig=b.Subject,a.descriptionConfig=b.Description,
-a.fieldConfig=b.Field,e.socket.on("salesforce_field:remove",function(b){_.remove(a.subjectConfig,{id:b.id}),_.remove(a.descriptionConfig,{id:b.id}),_.remove(a.fieldConfig,{id:b.id})})})["catch"](function(a){g.error(a)})},a.getCustomVariables=function(){return k.get().$promise.then(function(b){a.customVariables=b.rows})["catch"](function(a){g.error(a)})},a.getFields=function(){return h.fields({id:c.id}).$promise.then(function(c){a.accountFields=_.sortByOrder(b("salesforce")(c),"name","asc"),console.log(a.accountFields)})["catch"](function(a){g.error(a)})},a.addItem=function(b){var d={};switch(b){case"subject":case"description":d={type:"string",content:""};break;case"field":d={content:""}}return i.save({accountId:c.id,id:c.configurationId,controller:b},d).$promise.then(function(c){switch(b){case"subject":a.subjectConfig.push(c);break;case"description":a.descriptionConfig.push(c);break;case"field":a.fieldConfig.push(c)}})["catch"](function(a){g.error(a)})},a.changeType=function(b){"variable"===b.type?(b.content="",b.variableName=""):"string"===b.type?(b.VariableId=null,b.variableName=""):"customVariable"===b.type&&(b.VariableId=null,b.content=""),a.updateField(b)},a.updateField=function(a){return j.update({accountId:c.id,configurationId:c.configurationId,id:a.id},a).$promise.then(function(){})["catch"](function(a){g.error(a)})},a.removeItem=function(a){return j["delete"]({accountId:c.id,configurationId:c.configurationId,id:a.id}).$promise.then(function(){g.show(d.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){g.error(a)})},a.changeDescType=function(b){"keyValue"===b.type?(b.content="","string"===b.keyType?(b.VariableId=null,b.variableName=""):"variable"===b.keyType?(b.keyContent="",b.VariableId=null):"customVariable"===b.keyType&&(b.keyContent="",b.variableName="")):"string"===b.type&&(b.VariableId=null,b.variableName="",b.key="",b.keyContent=""),a.updateField(b)},a.getSystemFieldOptions=function(b){if(b){var c=_.find(a.accountFields,"name",b);if(c)switch(c.type){case"picklist":return c.picklistValues;default:return}}}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.view.configurations.view",{url:"/view/:configurationId",templateUrl:"app/salesforce/view/configuration/view/view.html",controller:"SalesforceViewConfigurationViewCtrl"})}]),angular.module("xCallyShuttleApp").controller("SalesforceViewCtrl",["$scope","$http","$stateParams","$translate","$location","WizardHandler","socket","xAlert","Modal","$filter","SalesforceAccount",function(a,b,c,d,e,f,g,h,i,j,k){a.initView=function(){return k.get({id:c.id}).$promise.then(function(b){a.account=b})["catch"](function(a){h.error(a)})},a.updateItem=function(){return k.update({id:c.id},a.account).$promise.then(function(){h.show(d.instant("MESSAGE_WELL_DONE")+".","success")})["catch"](function(a){h.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.view",{url:"/view/:id",templateUrl:"app/salesforce/view/view.html",controller:"SalesforceViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.salesforce.view.account",{url:"/account",templateUrl:"app/salesforce/view/view.account.html"})}]),angular.module("xCallyShuttleApp").controller("SalesforceWizardCtrl",["$scope","$http","$location","$translate","xAlert","WizardHandler",function(a,b,c,d,e,f){a.translate=d,a.initWizard=function(){a.$translate=d,a.forms={},a.item={},a.item.serverUrl=c.protocol()+"://"+location.host},a.next=function(){f.wizard().next()},a.exitValidation=function(a){return a},a.createItem=function(){console.log(a.item),b.post("api/salesforce/accounts",a.item).success(function(){e.show(d.instant("MESSAGE_WELL_DONE")+".","success"),c.path("/salesforce/list")}).error(function(a){e.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.wizard",{url:"/wizard",templateUrl:"app/salesforce/wizard/wizard.html",controller:"SalesforceWizardCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.customization",{url:"/customization",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("CustomizationGeneralViewCtrl",["$scope","gridOptions","$uibModal","FileUploader","$cookieStore","xAlert","$translate","Setting","$rootScope",function(a,b,c,d,e,f,g,h,i){a.radioSwitch={isActive:i.license.custom?!0:!1,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"};var j=a.uploader=new d({url:"api/settings/logo/main",queueLimit:1,withCredentials:!0,headers:{Authorization:"Bearer "+e.get("token")}});j.filters.push({name:"imageFilter",fn:function(a){var b="|"+a.type.slice(a.type.lastIndexOf("/")+1)+"|";return-1!=="|jpg|png|jpeg|".indexOf(b)}}),j.onSuccessItem=function(a,b){i.settings.logo=b.logo,f.show(g.instant("MESSAGE_WELL_DONE"),"success")},j.onErrorItem=function(){f.show(g.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")},j.onCompleteAll=function(){j.clearQueue()};var k=a.uploader2=new d({url:"api/settings/logo/login",queueLimit:1,withCredentials:!0,headers:{Authorization:"Bearer "+e.get("token")}});k.filters.push({name:"imageFilter",fn:function(a){var b="|"+a.type.slice(a.type.lastIndexOf("/")+1)+"|";return-1!=="|jpg|png|jpeg|".indexOf(b)}}),k.onSuccessItem=function(a,b){f.show(g.instant("MESSAGE_WELL_DONE"),"success")},k.onErrorItem=function(){f.show(g.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")},k.onCompleteAll=function(){k.clearQueue()},a.initView=function(){return h.get({id:1}).$promise.then(function(b){a.settings={defaultLogo:b.defaultLogo,defaultLoginLogo:b.defaultLoginLogo,footerWhiteLabel:b.footerWhiteLabel,defaultFooterWhiteLabel:b.defaultFooterWhiteLabel}})["catch"](function(a){f.error(a)})},a.update=function(){return h.update({id:1},a.settings).$promise.then(function(b){_.merge(i.settings,a.settings),f.show(g.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){f.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.customization.view.general",{url:"/general",templateUrl:"app/setting/customization/view/general/general.html",controller:"CustomizationGeneralViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/scripts/jquery.sparkline.min.js","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js","assets/scripts/profile.js"]})}]}})}]),angular.module("xCallyShuttleApp").controller("CustomizationViewCtrl",["$scope",function(a){}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.customization.view",{url:"/view",templateUrl:"app/setting/customization/view/view.html",controller:"CustomizationViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.general",{url:"/general",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("GeneralMainViewCtrl",["$scope","xAlert","$translate","Setting",function(a,b,c,d){a.initView=function(){return d.get({id:1}).$promise.then(function(b){a.settings={agi_port:b.agi_port,min_internal:b.min_internal,min_mailbox:b.min_mailbox,securePassword:b.securePassword}})["catch"](function(a){b.error(a)})},a.update=function(){return d.update({id:1},a.settings).$promise.then(function(a){b.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){b.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.general.view.main",{url:"/main",templateUrl:"app/setting/general/view/main/main.html",controller:"GeneralMainViewCtrl"})}]),angular.module("xCallyShuttleApp").controller("GeneralViewCtrl",["$scope",function(a){}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.general.view",{url:"/view",templateUrl:"app/setting/general/view/view.html",controller:"GeneralViewCtrl"})}]),angular.module("xCallyShuttleApp").factory("License",["$resource",function(a){return a("/api/licenses/:id/:controller",{id:"@id"},{request:{method:"POST",params:{id:"request"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.license",{url:"/license",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("LicenseUpdateCtrl",["$scope","$translate","$uibModalInstance","xAlert","Setting",function(a,b,c,d,e){a.form={},a.item={},a.getLicense=function(){return e.get({id:1}).$promise.then(function(b){a.item.license=b.license})["catch"](function(a){d.error(a)})},a.update=function(){return e.update({id:1},a.item).$promise.then(function(a){d.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){d.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("LicenseViewCtrl",["$scope","$rootScope","$translate","License","xAlert","$window","$uibModal",function(a,b,c,d,e,f,g){a.radioSwitch={isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.initView=function(){return d.get(function(b){a.item=b.license})},a.submitRequest=function(){return d.request(a.item,function(){e.show(c.instant("MESSAGE_WELL_DONE"),"success")},function(a){switch(a.status){case 304:e.show(a.statusText,"info");break;default:e.error(a)}})},a.updateLicense=function(){var a=g.open({animation:!0,templateUrl:"app/setting/license/view/update.modal.html",controller:"LicenseUpdateCtrl"});a.result.then(function(){f.location.reload()})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.license.view",{url:"/view",templateUrl:"app/setting/license/view/view.html",controller:"LicenseViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/pricing-tables.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("Externip",["$resource",function(a){return a("/api/network/externips/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("Localnet",["$resource",function(a){return a("/api/network/localnets/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.network",{url:"/network",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("ExternipCtrl",["$scope","$uibModal","gridOptions","Externip",function(a,b,c,d){a.initView=function(){var b={exporterCsvFilename:"network_externip.csv",columnDefs:[{name:"value"},{name:"action",buttons:[{"class":"blue-hoki",onClick:"grid.appScope.createItem(row.entity)",name:"profile"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=c.gridOptions(d,b,a)},a.createItem=function(c){var d=b.open({animation:!0,templateUrl:"app/setting/network/view/externip/externip.create.modal.html",controller:"ExternipCreateCtrl",resolve:{item:c}});d.result.then(function(){a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("ExternipCreateCtrl",["$scope","$translate","$uibModalInstance","$stateParams","Externip","xAlert","item",function(a,b,c,d,e,f,g){a.initModal=function(){a.form={},a.item=g||{},a.title=g?b.instant("APPLICATION_EDIT_EXTERNIP"):b.instant("APPLICATION_NEW_EXTERNIP")},a.save=function(){return g?e.update({id:a.item.id},a.item).$promise.then(function(a){f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){f.error(a)}):e.save({},a.item).$promise.then(function(a){f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){f.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.network.view.externip",{url:"/externip",templateUrl:"app/setting/network/view/externip/externip.html",controller:"ExternipCtrl"})}]),angular.module("xCallyShuttleApp").controller("LocalnetCtrl",["$scope","gridOptions","Localnet","$uibModal",function(a,b,c,d){a.initView=function(){var d={exporterCsvFilename:"network_localnet.csv",columnDefs:[{name:"value"},{name:"action",buttons:[{"class":"blue-hoki",onClick:"grid.appScope.createItem(row.entity)",name:"profile"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=b.gridOptions(c,d,a)},a.createItem=function(b){var c=d.open({animation:!0,templateUrl:"app/setting/network/view/localnet/localnet.create.modal.html",controller:"LocalnetCreateCtrl",resolve:{item:b}});c.result.then(function(){a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("LocalnetCreateCtrl",["$scope","$translate","$uibModalInstance","$stateParams","Localnet","xAlert","item",function(a,b,c,d,e,f,g){a.initModal=function(){if(a.form={},a.item=g||{},a.title=g?b.instant("APPLICATION_EDIT_LOCALNET"):b.instant("APPLICATION_NEW_LOCALNET"),g&&g.value){var c=a.item.value.split("/");c.length>1&&(a.item.address=c[0],a.item.mask=c[1])}},a.save=function(){var d=a.item.address+"/"+a.item.mask;return g?e.update({id:a.item.id},{value:d}).$promise.then(function(a){f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){f.error(a)}):e.save({},{value:d}).$promise.then(function(a){f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){f.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.network.view.localnet",{url:"/localnet",templateUrl:"app/setting/network/view/localnet/localnet.html",controller:"LocalnetCtrl"})}]),angular.module("xCallyShuttleApp").controller("NetworkViewCtrl",function(){}),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.network.view",{url:"/view",templateUrl:"app/setting/network/view/view.html",controller:"NetworkViewCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting",{url:"/setting",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:18}}})}]),angular.module("xCallyShuttleApp").factory("Setting",["$resource",function(a){return a("/api/settings/:id/:controller/:param",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("Smtp",["$resource",function(a){return a("/api/mail/servers/out/:id/:controller/:controller2",{id:"@id"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.smtp",{url:"/smtp",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("SmtpViewCtrl",["$scope","$stateParams","$translate","socket","MailServerOut","Setting","MailAccount","xAlert",function(a,b,c,d,e,f,g,h){a.initView=function(){return a.smtpDisabled=!1,a.isActive=!0,a.size="small",a.animate=!0,a.radioOff=!0,a.handleWidth="auto",a.labelWidth="auto",a.inverse=!0,a.offColor="danger",a.onColor="success",a.CONST_TIMEOUT=3e4,a.item={account:{service:!0,MailServerOut:{ssl:!1}}},f.get({id:"smtp"}).$promise.then(function(b){a.item.account=b,d.socket.on("mail_server_out:state",function(b){Number(b.id)===a.item.account.MailServerOut.id&&(a.item.account.MailServerOut.state=b.state,a.item.account.MailServerOut.source=JSON.parse(b.source))})})["catch"](function(b){switch(console.log(b),b.status){case 404:a.item.account.name=null,a.item.account.address=null,a.item.account.MailServerOut={ssl:!1},h.show("Service SMTP server not configured.","info");break;default:h.error(b)}})},a.updateItem=function(){return a.item.account.id?(delete a.item.account.MailServerOut.state,delete a.item.account.MailServerOut.source,f.update({id:"smtp",controller:a.item.account.id},a.item.account).$promise.then(function(){h.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){h.error(a)})):f.save({id:"smtp"},{description:"Custom Account",name:a.item.account.name,address:a.item.account.address,service:a.item.account.service,custom:!0,MailServerOut:a.item.account.MailServerOut}).$promise.then(function(){h.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){h.error(a)})},a.test=function(){return e.get({id:a.item.account.MailServerOut.id,controller:"test"}).$promise["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.smtp.view",{url:"/view",templateUrl:"app/setting/smtp/view/view.html",controller:"SmtpViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system",{url:"/system",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("SystemViewConsoleCtrl",["$scope","Setting","xAlert","usSpinnerService","$timeout","$translate",function(a,b,c,d,e,f){function g(b){var c=_.findIndex(a.commandHistory.commands,function(a){return a===b});-1!==c&&a.commandHistory.commands.splice(c,1),a.commandHistory.commands.unshift(b)}a.output="<b>"+f.instant("APPLICATION_CONSOLE_WELCOME")+"</b><br/>",a.item={command:""},a.commandHistory={commands:[],index:-1},a.busy=!1,a.cmdFocus=function(){e(function(){angular.element("#command").trigger("focus")})},a.sendCmd=function(){return a.commandHistory.index=-1,a.tmp=a.item.command,a.item.command="",a.output+="<b>motion*CLI> "+a.tmp+"</b><br>",a.tmp?(g(a.tmp.trim()),a.busy=!0,d.spin("console-spinner"),b.save({controller:"asterisk"},{command:a.tmp}).$promise.then(function(b){a.output+=b.content.replace(/(?:\r\n|\r|\n)/g,"<br />").replace("Response: Follows<br />Privilege: Command<br />","").replace(/ActionID: .[0-9]*<br \/>/,"").replace(/ActionID: .[0-9]*/,"")+"<br>",d.stop("console-spinner"),a.busy=!1,a.cmdFocus()})["catch"](function(b){d.stop("console-spinner"),a.output+="command error:"+b.data.message+"<br>",a.busy=!1,a.cmdFocus()})):void 0},a.keyUp=function(b){switch(b.keyCode){case 40:a.commandHistory.commands[a.commandHistory.index-1]?a.item.command=a.commandHistory.commands[--a.commandHistory.index]:(a.item.command="",a.commandHistory.index=-1);break;case 38:a.commandHistory.commands[a.commandHistory.index+1]&&(a.item.command=a.commandHistory.commands[++a.commandHistory.index]);break;case 37:break;case 39:break;default:a.commandHistory.index=-1}},e(function(){angular.element("#command").trigger("focus"),d.stop("console-spinner")})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system.view.console",{url:"/console",templateUrl:"app/setting/system/view/console/console.html",controller:"SystemViewConsoleCtrl"})}]),angular.module("xCallyShuttleApp").controller("SystemViewGeneralCtrl",["$scope","$stateParams","$translate","socket","Setting","xAlert","usSpinnerService",function(a,b,c,d,e,f,g){function h(b){a.system.memory={labels:_.keys(b.memory.details),values:_.values(_.map(b.memory.details,function(a){return Math.round(a/1024)})),Total:Math.round(b.memory.Total/1024)},g.stop("memory-spinner"),a.system.disks=[],_.forEach(b.disks,function(b){a.system.disks.push({mount:b.mount,size:Number((b.size/1048576).toFixed(2)),values:_.values(_.map(b.details,function(a){return Number((a/1048576).toFixed(2))})),labels:_.keys(b.details)})}),a.system.mount=a.system.disks[0],g.stop("disk-spinner"),a.system.cpu={motion:Math.round(b.cpu.motion),cores:[]},_.forEach(b.cpu.cores,function(b){delete b.nice,delete b.irq,a.system.cpu.cores.push({labels:_.keys(b),values:_.values(b),colours:["#803690","#DCDCDC","#00ADF9"]})}),g.stop("cpu-spinner")}a.system={mount:void 0},a.initView=function(){return g.spin("memory-spinner"),g.spin("disk-spinner"),g.spin("cpu-spinner"),e.get({controller:"system"}).$promise.then(function(a){h(a)})["catch"](function(a){f.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system.view.general",{url:"/general",templateUrl:"app/setting/system/view/general/general.html",controller:"SystemViewGeneralCtrl"})}]),angular.module("xCallyShuttleApp").controller("SystemViewLogsCtrl",["$scope","$stateParams","$translate","socket","Setting","xAlert","usSpinnerService",function(a,b,c,d,e,f,g){a.initView=function(){return a.logs={errors:"",output:""},g.spin("logs-spinner"),e.get({controller:"logs"}).$promise.then(function(b){a.logs=b,g.stop("logs-spinner")})["catch"](function(a){f.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system.view.logs",{url:"/logs",templateUrl:"app/setting/system/view/logs/logs.html",controller:"SystemViewLogsCtrl"})}]),angular.module("xCallyShuttleApp").controller("SystemViewCtrl",["$scope",function(a){}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system.view",{url:"/view",templateUrl:"app/setting/system/view/view.html",controller:"SystemViewCtrl"})}]),angular.module("xCallyShuttleApp").controller("UpdateListCtrl",["$scope","gridOptions","$uibModal","$location","Update",function(a,b,c,d,e){a.initCounter=function(){a.$on("timer-stopped",function(a,b){console.log("Timer Stopped - data = ",b),d.path("/dashboard/voice")})},a.initView=function(){var c={exporterCsvFilename:"updates.csv",enableFiltering:!1,enableSorting:!1,enablePaginationControls:!1,enableSelectAll:!1,columnDefs:[{name:"message"},{width:125,name:"version",cellClass:"text-center ui-grid-vcenter"},{width:125,name:"createdAt",displayName:"APPLICATION_UPDATED_AT",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span am-time-ago="row.entity.createdAt"></span></div>'}]};a.gridOptions=b.gridOptions(e,c,a)},a.pull=function(){c.open({animation:!0,templateUrl:"app/setting/update/list/list.pull.html",controller:"UpdateListPullCtrl"})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.updates.list",{url:"/list",templateUrl:"app/setting/update/list/list.html",controller:"UpdateListCtrl"}).state("main.setting.updates.landing",{url:"/landing",templateUrl:"app/setting/update/list/landing.html",controller:"UpdateListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/error.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("UpdateListPullCtrl",["$scope","$uibModalInstance","$translate","$location","Update",function(a,b,c,d,e){a.modal={dismissable:!0,title:"Confirm Checkout",html:"Are you sure you want to checkout?",buttons:[{classes:"btn btn-success",text:"Checkout",click:function(){return e.pull().$promise["finally"](function(){b.dismiss("close"),d.path("/setting/updates/landing")})}},{classes:"btn default",text:"Cancel",click:function(){b.dismiss("cancel")}}]}}]),angular.module("xCallyShuttleApp").factory("Update",["$resource",function(a){return a("/api/updates/:id/:controller",{id:"@id"},{pull:{method:"GET",params:{id:"pull"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.updates",{url:"/updates",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["hasUpdate"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").controller("SquareOdbcListCtrl",["$scope","$uibModal","$translate","SquareOdbc","gridOptions","xAlert",function(a,b,c,d,e,f){a.initView=function(){var b={exporterCsvFilename:"odbc.csv",columnDefs:[{name:"name"},{name:"dsn",displayName:"APPLICATION_ODBC"},{name:"description"},{name:"action",width:250,buttons:[{"class":"blue-hoki",href:"/square/odbc/view/{{row.entity.id}}/settings",name:"settings"},{"class":"green-jungle",name:"check",onClick:"grid.appScope.checkConnection(row.entity.id)"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=e.gridOptions(d,b,a)},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/square/odbc/list/list.create.modal.html",controller:"SquareOdbcListCreateCtrl"});c.result.then(function(){a.gridOptions.getPage()})},a.checkConnection=function(a){return d.get({id:a,controller:"check"}).$promise.then(function(){f.show(c.instant("MESSAGE_CONNECTION_VERIFIED"),"success")})["catch"](function(){f.show(c.instant("MESSAGE_CONNECTION_INVALID"),"danger")})}}]),angular.module("xCallyShuttleApp").controller("SquareOdbcListCreateCtrl",["$scope","$translate","$uibModalInstance","SquareOdbc","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.item.dsn||(a.item.dsn="DRIVER=MySQL;SERVER=127.0.0.1;UID=xcall;PWD=password;DATABASE=motion"),a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.odbc.list",{url:"/list",templateUrl:"app/square/odbc/list/list.html",controller:"SquareOdbcListCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.odbc",{url:"/odbc",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").factory("SquareOdbc",["$resource",function(a){return a("/api/square/odbc/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("SquareOdbcViewCtrl",["$scope","$translate","$stateParams","SquareOdbc","xAlert",function(a,b,c,d,e){a.odbc={},a.getOdbc=function(){return d.get({id:c.id}).$promise.then(function(b){a.odbc=b})["catch"](function(a){e.error(a)})},a.updateOdbc=function(){var f=angular.copy(a.odbc);return d.update({id:c.id},f).$promise.then(function(){e.show(b.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){e.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.odbc.view",{url:"/view/:id",templateUrl:"app/square/odbc/view/view.html",controller:"SquareOdbcViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.square.odbc.view.settings",{url:"/settings",templateUrl:"app/square/odbc/view/view.settings.html"})}]),angular.module("xCallyShuttleApp").controller("SquareProjectListCtrl",["$scope","$uibModal","SquareProject","gridOptions",function(a,b,c,d){a.initView=function(){var b={exporterCsvFilename:"projects.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:160,buttons:[{"class":"blue-hoki",href:"/square/projects/view/{{row.entity.id}}",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=d.gridOptions(c,b,a)},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/square/project/list/list.create.modal.html",controller:"SquareProjectListCreateCtrl"});c.result.then(function(b){console.log(b),a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("SquareProjectListCreateCtrl",["$scope","$translate","$uibModalInstance","SquareProject","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.projects.list",{url:"/list",templateUrl:"app/square/project/list/list.html",controller:"SquareProjectListCtrl",authenticate:!0})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.projects",{url:"/projects",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").factory("SquareProject",["$resource",function(a){return a("/api/square/projects/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("SquareProjectViewCtrl",["$scope","$stateParams","Auth","xAlert","SquareProject","socket","$translate","$log","$uibModal",function(a,b,c,d,e,f,g,h,i){a.squareProject={},a.$on("$destroy",function(){f.unsyncUpdates("square_project")}),a.getProject=function(){return e.get({id:b.id}).$promise.then(function(b){a.squareProject=b,angular.element(document).ready(function(){window.onerror=function(a,b,c){try{if(null!==a&&-1!==a.indexOf("Script error."));else{var e=new Image;e.src="assets/plugins/mxgraph/images/1x1.png?msg="+encodeURIComponent(a)+"&url="+encodeURIComponent(b)+"&lnum="+encodeURIComponent(c)}}catch(f){d.error(f)}},b.token=c.getToken();var a=new EditorUi(new Editor);a.openString(b.preproduction,b.name,b),a.editor.graphChangeListener=function(a,b){var c=b.properties.rtChange||!1;c||(this.modified=!0)}}),f.socket.on("square_project:save",function(c){c.id===b.id&&(a.squareProject=_.merge(a.squareProject,c))})})["catch"](function(a){d.error(a)})},a.editNotes=function(){var c=i.open({animation:!0,templateUrl:"app/square/project/view/projectNotes.modal.html",controller:["$scope","$uibModalInstance","notes",function(a,b,c){a.notes=c,a.close=function(){b.close(a.notes)},a.cancel=function(){b.dismiss("cancel")}}],resolve:{notes:{value:a.squareProject.notes}}});c.result.then(function(a){return e.update({id:b.id},{notes:a.value}).$promise.then(function(){d.show(g.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){d.error(a)})},function(){h.info("Modal dismissed at: "+new Date)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.projects.view",{url:"/view/:id",templateUrl:"app/square/project/view/view.html",controller:"SquareProjectViewCtrl",authenticate:!0,resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",serie:!0,cache:!1,files:["assets/plugins/mxgraph/css/common.css","assets/plugins/mxgraph/css/explorer.css","assets/plugins/mxgraph/styles/grapheditor.css","assets/plugins/mxgraph/styles/custom.css","assets/plugins/square/js/custom.js","assets/plugins/mxgraph/js/mxClient.js","assets/plugins/square/js/Editor.js","assets/plugins/square/js/Graph.js","assets/plugins/square/js/EditorUi.js","assets/plugins/square/js/Actions.js","assets/plugins/square/js/Menus.js","assets/plugins/square/js/Sidebar.js","assets/plugins/square/js/Toolbar.js","assets/plugins/square/js/Dialogs.js"]}])}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.realtime",{url:"/realtime",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:14}}})}]),angular.module("xCallyShuttleApp").factory("ReportSquare",["$resource",function(a){return a("/api/report/square/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("ReportSquareDetail",["$resource",function(a){return a("/api/report/square/details/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("SquareRealtimeViewGeneralCtrl",["$scope","$log","$uibModal","$translate","socket","xAlert","ReportSquare","usSpinnerService","$q","uiGridConstants",function(a,b,c,d,e,f,g,h,i,j){
+}],data:[],gridMenuTitleFilter:function(a){var b=g.defer();return b.resolve(f.instant(a)),b.promise},onRegisterApi:function(b){a.gridApi=b}},e.get({id:b.getCurrentUser().id,controller:"sms",controller1:"queues"}).$promise.then(function(b){a.table1.data=b.rows})["finally"](function(){d.socket.on("user_has_sms_queue:save",function(c){c.UserId!=b.getCurrentUser().id||_.find(a.table1.data,{id:c.SmsQueueId})||a.table1.data.push({id:c.SmsQueueId,UserHasSmsQueue:c})}),d.socket.on("user_has_sms_queue:remove",function(c){c.UserId===b.getCurrentUser().id&&_.remove(a.table1.data,{id:c.SmsQueueId})})})["catch"](function(a){console.error(a)}),h.get({controller:"waiting",controller2:"applications"}).$promise.then(function(b){a.table2.data=b.rows})["finally"](function(){d.socket.on("report_sms_session:save",function(b){var c=_.find(a.table2.data,{id:b.id});c?(_.merge(c,b),b.leaveAt&&i(function(){_.remove(a.table2.data,{id:b.id})},1e4)):b.leaveAt||a.table2.data.push(b)}),d.socket.on("report_sms_session:remove",function(b){_.remove(a.table2.data,{id:b.id})})})["catch"](function(a){console.log(a)})},a.initWidget=function(b){var e;switch(b){case"timeout":case"waiting":e=h;break;default:e=c}return e.get({id:b}).$promise.then(function(c){a[b]=c.value,a.charts={interactions:{labels:[f.instant("APPLICATION_DASHBOARD_NEW"),f.instant("APPLICATION_DASHBOARD_OPEN"),f.instant("APPLICATION_DASHBOARD_PENDING"),f.instant("APPLICATION_DASHBOARD_CLOSED")],values:[a["new"],a.open,a.pending,a.closed],colours:["#44B6AE","#578EBE","#35AA47","#8775A7"]}},d.socket.on("report_sms_dashboard:"+b,function(c){a[b]=c.value,a.charts.interactions.values=[a["new"],a.open,a.pending,a.closed]})})["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").controller("DashboardVoiceCtrl",["$scope","$rootScope","$timeout","Auth","ReportQueue","ReportCall","Agent","VoiceQueue","Dashboard","socket",function(a,b,c,d,e,f,g,h,i,j){a.radioSwitch={size:"mini",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"success",onColor:"danger"};var k=function(a,b){var c=a?30*a+120:177;angular.element(document.getElementsByName(b)[0]).css("height",c+"px")};a.initUser=function(){var b;if(a.user=d.getCurrentUser(),a.voice={},a.$on("$destroy",function(){b&&(b.terminate(),j.socket.removeAllListeners("dashboard:voice:waiting"),j.socket.removeAllListeners("dashboard:voice:active"),j.socket.removeAllListeners("dashboard:voice:complete"),j.socket.removeAllListeners("dashboard:voice:abandon"),j.socket.removeAllListeners("dashboard:voice:unmanaged"),j.socket.removeAllListeners("dashboard:voice:holdtime"),j.socket.removeAllListeners("dashboard:voice:talktime"))}),a.onmessage=function(b){a.voice=b.data,a.$apply()},window.Worker){switch(b=new Worker("assets/workers/dashboard/voice/worker.js"),a.user.role){case"admin":h.get().$promise.then(function(a){return b.postMessage({evt:"myQueues",queues:a.rows}),i.get({id:"voice",controller:"init"}).$promise}).then(function(a){a.evt="dashboard:voice:init",b.postMessage(a)})["catch"](function(a){console.error(a)});break;case"user":b.postMessage({evt:"myQueues",queues:a.user.PVoiceQueues}),i.get({id:"voice",controller:"init"}).$promise.then(function(a){a.evt="dashboard:voice:init",b.postMessage(a)})}b.onmessage=a.onmessage}j.socket.on("dashboard:voice:waiting",function(a){a.evt="dashboard:voice:waiting",b.postMessage(a)}),j.socket.on("dashboard:voice:active",function(a){a.evt="dashboard:voice:active",b.postMessage(a)}),j.socket.on("dashboard:voice:complete",function(a){a.evt="dashboard:voice:complete",b.postMessage(a)}),j.socket.on("dashboard:voice:abandon",function(a){a.evt="dashboard:voice:abandon",b.postMessage(a)}),j.socket.on("dashboard:voice:unmanaged",function(a){a.evt="dashboard:voice:unmanaged",b.postMessage(a)}),j.socket.on("dashboard:voice:talktime",function(a){a.evt="dashboard:voice:talktime",b.postMessage(a)}),j.socket.on("dashboard:voice:holdtime",function(a){a.evt="dashboard:voice:holdtime",b.postMessage(a)}),j.socket.on("dashboard:voice:outbound",function(a){a.evt="dashboard:voice:outbound",b.postMessage(a)})},a.initAgent=function(){return a.agent=d.getCurrentUser(),j.socket.on("voice:queue:agent:join",function(b){b.loggedAt=moment().format("YYYY-MM-DD HH:mm:ss"),b.callstaken=0,a.table1.data.push(b)}),j.socket.on("voice:queue:agent:leave",function(b){_.remove(a.table1.data,{queue:b.queue})}),a.table1={enableGridMenu:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,multiSelect:!0,columnDefs:[{name:"queue",headerCellFilter:"translate",displayName:"APPLICATION_QUEUE",cellClass:"text-center ui-grid-vcenter"},{name:"loggedAt",displayName:"logged At",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span am-time-ago="row.entity.loggedAt"></span></div>'},{name:"lastcall",headerCellFilter:"translate",displayName:"APPLICATION_LAST_CALL",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span am-time-ago="row.entity.lastcall"></span></div>'},{name:"callstaken",headerCellFilter:"translate",displayName:"APPLICATION_CALLS_TAKEN",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div><span>{{row.entity.callstaken || 0}}</span></div>"}],data:[],onRegisterApi:function(b){a.gridApi=b,a.gridApi.grid.registerDataChangeCallback(function(){k(a.gridApi.core.getVisibleRows(a.gridApi.grid).length,"table1")})}},a.table2={enableGridMenu:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:0,multiSelect:!1,columnDefs:[{name:"queue",displayName:"APPLICATION_QUEUE",headerCellFilter:"translate"},{name:"status",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div><span>{{'APPLICATION_QUEUESTATUS_WAITING' | translate}}</span>[<timer start-time=\"grid.appScope.moment(row.entity.updatedAt).unix()*1000\">{{hhours}}:{{mminutes}}:{{sseconds}}</timer>]</div>",enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"caller",displayName:"APPLICATION_CALLER",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.calleridnum || ''}} {{row.entity.calleridname || ''}}</span></div>",enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1},{name:"position",displayName:"APPLICATION_POSITION",headerCellFilter:"translate"},{name:"agent",displayName:"APPLICATION_AGENT",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.connectedlinenum || ''}} {{row.entity.connectedlinename || ''}}</span></div>",enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1}],data:[],onRegisterApi:function(b){a.gridApi1=b,a.gridApi1.grid.registerDataChangeCallback(function(){k(a.gridApi1.core.getVisibleRows(a.gridApi1.grid).length,"table2")})}},a.table3={exporterCsvFilename:"abandoned_calls.csv",enableRowHeaderSelection:!0,paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!1,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,enableSelectAll:!1,enableHorizontalScrollbar:0,enableVerticalScrollbar:1,columnDefs:[{name:"queue",displayName:"APPLICATION_QUEUE",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter"},{name:"caller",displayName:"APPLICATION_CALLER",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.calleridnum || ''}} {{row.entity.calleridname || ''}}</div>"},{name:"createdAt",displayName:"APPLICATION_DATE",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:"<div>{{row.entity.updatedAt | date:'yyyy-MM-dd HH:mm:ss'}}</div>"},{name:"lastAssignedTo",cellClass:"text-center ui-grid-vcenter",displayName:"APPLICATION_LAST_ASSIGNED_TO",headerCellFilter:"translate"},{name:"assigned",displayName:"APPLICATION_STATUS",headerCellFilter:"translate",cellTemplate:'<div class="centered-uigrid-td"><input data-ng-change="grid.appScope.updateItem(row.entity)", bs-switch ng-model="row.entity.assigned" type="checkbox" switch-active="{{ !row.entity.assigned || grid.appScope.agent.name === row.entity.lastAssignedTo }}" switch-on-text="{{ \'APPLICATION_ASSIGNED\' | translate }}" switch-off-text="{{ \'APPLICATION_FREE\' | translate }}" switch-on-color="{{ grid.appScope.radioSwitch.onColor }}" switch-off-color="{{ grid.appScope.radioSwitch.offColor }}" switch-animate="{{ grid.appScope.radioSwitch.animate }}" switch-size="{{ grid.appScope.radioSwitch.size }}" switch-label="{{ grid.appScope.radioSwitch.label }}" switch-icon="{{ grid.appScope.radioSwitch.icon }}" switch-radio-off="{{ grid.appScope.radioSwitch.radioOff }}" switch-label-width="{{ grid.appScope.radioSwitch.labelWidth }}" switch-handle-width="{{ grid.appScope.radioSwitch.handleWidth }}"></div>',enableFiltering:!1}],data:[],onRegisterApi:function(b){a.gridApi2=b,a.gridApi2.grid.registerDataChangeCallback(function(){k(a.gridApi2.core.getVisibleRows(a.gridApi2.grid).length,"table3")})}},g.get({id:d.getCurrentUser().id,controller:"voice",controller1:"queues"}).$promise.then(function(b){a.table1.data=_.map(b.rows,function(a){return{queue:a.UserHasVoiceQueue.queue,loggedAt:a.UserHasVoiceQueue.loggedAt,callstaken:a.UserHasVoiceQueue.callstaken,lastcall:a.UserHasVoiceQueue.lastcall}})})["finally"](function(){j.socket.on("voice:queue:update",function(b){var c=_.find(a.table1.data,{queue:b.queue});c?_.merge(c,b):a.table1.data.push(b)}),j.socket.on("user_has_voice_queue:remove",function(b){b.UserId===d.getCurrentUser().id&&_.remove(a.table1.data,{name:b.queue})})})["catch"](function(a){console.error(a)}),e.get({id:"waiting",controller:"calls"}).$promise.then(function(b){a.table2.data=b.rows})["finally"](function(){j.socket.on("report_queue:save",function(b){a.table2.data.push(b)}),j.socket.on("report_queue:update",function(b){var c=_.find(a.table2.data,{id:b.id});c&&b.queuecallerleaveAt&&_.remove(a.table2.data,{id:b.id})})})["catch"](function(a){console.error(a)}),e.get({controller:"abandoned",controller2:"all"}).$promise.then(function(b){a.table3.data=b.rows})["catch"](function(a){console.error(a)})["finally"](function(){j.socket.on("report_queue:save",function(b){a.table3.data.unshift(b)}),j.socket.on("report_queue:update",function(b){var c=_.find(a.table3.data,{id:b.id});c&&_.merge(c,b)})})},a.updateItem=function(b){return e.update({id:b.id},{assigned:b.assigned,lastAssignedTo:b.assigned?a.agent.name:void 0}).$promise["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.desk",{url:"/desk",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").factory("DeskAccount",["$resource",function(a){return a("/api/desk/accounts/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("DeskListCtrl",["$scope","$http","$rootScope","xAlert","$translate","socket","Modal","stResource",function(a,b,c,d,e,f,g,h){a.conf={accountsByPage:{name:"10",value:10}},a.accountsByPage=[{name:"10",value:10},{name:"25",value:25},{name:"50",value:50},{name:"All",value:0}],a.accounts={checked:[]},a.check=function(b,c){c?a.accounts.checked=angular.copy(_.map(a.displayedDeskAccounts,"id")):a.accounts.checked=[]},a.getAccounts=function(b){return _.map(a.displayedDeskAccounts,function(a){var c={};return b.forEach(function(b){c[b]=a[b]}),c})},a.initList=function(b){f.unsyncUpdates("desk_account"),b.url="/api/desk/accounts",h.getPage(b).then(function(d){a.displayedDeskAccounts=d.rows,b.pagination.numberOfPages=d.total_pages,c.updateTableConfig(a.accountsByPage,a.displayedDeskAccounts.length),c.updateTableConfig(a.conf.accountsByPage,a.displayedDeskAccounts.length)}),f.socket.on("desk_account:save",function(){a.initList(b)}),f.socket.on("desk_account:remove",function(c){a.accounts.checked=_.without(a.accounts.checked,c.id),a.initList(b)})},a.deleteItem=g.confirm["delete"](function(a){b["delete"]("/api/desk/accounts/"+a).success(function(){d.show(e.instant("MESSAGE_WELL_DONE")+"!","success")}).error(function(a){d.error(a)})}),a.deleteItems=g.confirm["delete"](function(){b["delete"]("/api/desk/accounts",{params:{id:a.accounts.checked}}).success(function(){d.show(e.instant("MESSAGE_WELL_DONE"),"success")}).error(function(a){d.error(a)})}),a.checkAccount=function(a){b.get("/api/desk/accounts/"+a+"/check").then(function(){d.show(e.instant("MESSAGE_ACCOUNT_VERIFIED"),"success")})["catch"](function(){d.show(e.instant("MESSAGE_ACCOUNT_INVALID"),"danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.desk.list",{url:"/list",templateUrl:"app/desk/list/list.html",controller:"DeskListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("DeskViewCtrl",["$scope","$http","$stateParams","$translate","$location","WizardHandler","socket","xAlert","Modal","desk_com",function(a,b,c,d,e,f,g,h,i,j){a.$stateParams=c,a.config={autoHideScrollbar:!1,theme:"dark",advanced:{updateOnContentResize:!0},setHeight:500,scrollInertia:0},a.initConfiguration=function(){a.formsConfiguration={},a.configuration={}},a.goNext=function(){f.wizard().next()},a.formValidation=function(a){return a},a.$on("$destroy",function(){g.unsyncUpdates("desk_configuration"),g.unsyncUpdates("desk_field")}),a.initView=function(){b.get("/api/desk/accounts/"+c.id).success(function(b){a.account=b}).error(function(a){h.error(a)})},a.updateItem=function(){b.put("/api/desk/accounts/"+c.id,a.account).success(function(){h.show(d.instant("MESSAGE_WELL_DONE")+".","success")}).error(function(){h.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.getConfigurations=function(){b.get("/api/desk/configurations",{params:{AccountId:c.id}}).success(function(b){a.configurations=b,g.socket.on("desk_configuration:remove",function(b){_.remove(a.configurations,{id:b.id})})}).error(function(a){h.error(a)})},a.deleteConfiguration=i.confirm["delete"](function(a){b["delete"]("api/desk/configurations/"+a).success(function(){h.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){h.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})}),a.createConfiguration=function(){a.configuration.AccountId=c.id,b.post("api/desk/configurations",a.configuration).success(function(a){e.path("desk/view/"+c.id+"/configurations/settings/"+a.id)}).error(function(){h.show("Something went wrong!","danger")})},a.fieldType=["string","variable"],a.descFieldType=["string","key_value"],a.getFields=function(){b.get("/api/desk/accounts/"+c.id+"/fields").success(function(b){a.accountFields=j.fields.concat(b)}).error(function(a){h.error(a)})},a.getConfiguration=function(){b.get("/api/desk/configurations/"+c.configurationId).success(function(b){a.configurationName=b.name,a.subjectConfig=b.Subject,a.descriptionConfig=b.Description,a.fieldConfig=b.Field,g.socket.on("desk_field:remove",function(b){_.remove(a.subjectConfig,{id:b.id}),_.remove(a.descriptionConfig,{id:b.id}),_.remove(a.fieldConfig,{id:b.id})})}).error(function(a){h.error(a)})},a.getVariables=function(){b.get("/api/variables").success(function(b){a.variables=b.rows}).error(function(a){h.error(a)})},a.removeItem=function(a){b["delete"]("api/desk/fields/"+a.id).success(function(){h.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){h.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})},a.addItemSubject=function(){var d={type:"string",content:""};b.post("/api/desk/configurations/"+c.configurationId+"/subject",d).success(function(b){a.subjectConfig.push(b)}).error(function(){h.show("Something went wrong!","danger")})},a.addItemDescription=function(){var d={type:"string",content:""};b.post("/api/desk/configurations/"+c.configurationId+"/description",d).success(function(b){a.descriptionConfig.push(b)}).error(function(){h.show("Something went wrong!","danger")})},a.addItemField=function(){var d={content:""};b.post("/api/desk/configurations/"+c.configurationId+"/field",d).success(function(b){a.fieldConfig.push(b)}).error(function(){h.show("Something went wrong!","danger")})},a.updateField=function(a){b.put("/api/desk/fields/"+a.id,a).success(function(){}).error(function(){h.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.changeType=function(b){"variable"===b.type?b.content="":"string"===b.type&&(b.VariableId=null),a.updateField(b)},a.changeDescType=function(b){"key_value"===b.type?(b.content="","string"===b.keyType?b.VariableId=null:"variable"===b.keyType&&(b.keyContent="")):"string"===b.type&&(b.VariableId=null,b.key="",b.keyContent=""),a.updateField(b)},a.changeFieldType=function(b){if(b.content="",b.idField){var c=_.find(a.accountFields,"id",b.idField);c&&(b.customField=_.result(c,"custom",!0))}a.updateField(b)},a.getSystemFieldOptions=function(b){if(b){var c=_.find(a.accountFields,"id",b);return c?c.data.choices?c.data.choices:null:void 0}}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.desk.view",{url:"/view/:id",templateUrl:"app/desk/view/view.html",controller:"DeskViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.desk.view.account",{url:"/account",templateUrl:"app/desk/view/view.account.html"}).state("main.desk.view.configurations",{url:"/configurations",templateUrl:"app/desk/view/view.configurations.html"}).state("main.desk.view.configurations.settings",{url:"/settings/:configurationId",templateUrl:"app/desk/view/view.configurationSettings.html",controller:"DeskViewCtrl"}).state("main.desk.view.configuration",{url:"/configuration",templateUrl:"app/desk/view/view.configuration.html"})}]),angular.module("xCallyShuttleApp").controller("DeskWizardCtrl",["$scope","$http","$location","$translate","xAlert","WizardHandler",function(a,b,c,d,e,f){a.translate=d,a.initWizard=function(){a.$translate=d,a.forms={},a.item={}},a.next=function(){f.wizard().next()},a.exitValidation=function(a){return a},a.createItem=function(){console.log(a.item),b.post("api/desk/accounts",a.item).success(function(){e.show(d.instant("MESSAGE_WELL_DONE")+".","success"),c.path("/desk/list")}).error(function(){e.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.desk.wizard",{url:"/wizard",templateUrl:"app/desk/wizard/wizard.html",controller:"DeskWizardCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.freshdesk",{url:"/freshdesk",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").factory("FreshdeskAccount",["$resource",function(a){return a("/api/freshdesk/accounts/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("FreshdeskListCtrl",["$scope","$http","$rootScope","xAlert","$translate","socket","Modal","stResource",function(a,b,c,d,e,f,g,h){a.conf={accountsByPage:{name:"10",value:10}},a.accountsByPage=[{name:"10",value:10},{name:"25",value:25},{name:"50",value:50},{name:"All",value:0}],a.accounts={checked:[]},a.check=function(b,c){c?a.accounts.checked=angular.copy(_.map(a.displayedFreshdeskAccounts,"id")):a.accounts.checked=[]},a.getAccounts=function(b){return _.map(a.displayedFreshdeskAccounts,function(a){var c={};return b.forEach(function(b){c[b]=a[b]}),c})},a.initList=function(b){f.unsyncUpdates("freshdesk_account"),b.url="/api/freshdesk/accounts",h.getPage(b).then(function(d){a.displayedFreshdeskAccounts=d.rows,b.pagination.numberOfPages=d.total_pages,c.updateTableConfig(a.accountsByPage,a.displayedFreshdeskAccounts.length),c.updateTableConfig(a.conf.accountsByPage,a.displayedFreshdeskAccounts.length)}),f.socket.on("freshdesk_account:save",function(){a.initList(b)}),f.socket.on("freshdesk_account:remove",function(c){a.accounts.checked=_.without(a.accounts.checked,c.id),a.initList(b)})},a.deleteItem=g.confirm["delete"](function(a){b["delete"]("/api/freshdesk/accounts/"+a).success(function(){d.show(e.instant("MESSAGE_WELL_DONE")+"!","success")}).error(function(a){d.error(a)})}),a.deleteItems=g.confirm["delete"](function(){b["delete"]("/api/freshdesk/accounts",{params:{id:a.accounts.checked}}).success(function(){d.show(e.instant("MESSAGE_WELL_DONE"),"success")}).error(function(a){d.error(a)})}),a.checkAccount=function(a){b.get("/api/freshdesk/accounts/"+a+"/check").then(function(){d.show(e.instant("MESSAGE_ACCOUNT_VERIFIED"),"success")})["catch"](function(){d.show(e.instant("MESSAGE_ACCOUNT_INVALID"),"danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.freshdesk.list",{url:"/list",templateUrl:"app/freshdesk/list/list.html",controller:"FreshdeskListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("FreshdeskViewCtrl",["$scope","$http","$stateParams","$translate","$location","$filter","WizardHandler","socket","xAlert","Modal",function(a,b,c,d,e,f,g,h,i,j){a.$stateParams=c,a.config={autoHideScrollbar:!1,theme:"dark",advanced:{updateOnContentResize:!0},setHeight:500,scrollInertia:0},a.initConfiguration=function(){a.formsConfiguration={},a.configuration={}},a.goNext=function(){g.wizard().next()},a.formValidation=function(a){return a},a.$on("$destroy",function(){h.unsyncUpdates("freshdesk_configuration"),h.unsyncUpdates("freshdesk_field")}),a.initView=function(){b.get("/api/freshdesk/accounts/"+c.id).success(function(b){a.account=b}).error(function(a){i.error(a)})},a.updateItem=function(){b.put("/api/freshdesk/accounts/"+c.id,a.account).success(function(){i.show(d.instant("MESSAGE_WELL_DONE")+".","success")}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.getConfigurations=function(){b.get("/api/freshdesk/configurations",{params:{AccountId:c.id}}).success(function(b){a.configurations=b,h.socket.on("freshdesk_configuration:remove",function(b){_.remove(a.configurations,{id:b.id})})}).error(function(a){i.error(a)})},a.deleteConfiguration=j.confirm["delete"](function(a){b["delete"]("api/freshdesk/configurations/"+a).success(function(){i.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})}),a.createConfiguration=function(){a.configuration.AccountId=c.id,b.post("api/freshdesk/configurations",a.configuration).success(function(a){e.path("freshdesk/view/"+c.id+"/configurations/settings/"+a.id)}).error(function(){i.show("Something went wrong!","danger")})},a.fieldType=["string","variable"],a.descFieldType=["string","key_value"],a.getFields=function(){b.get("/api/freshdesk/accounts/"+c.id+"/fields").success(function(b){a.accountFields=[],b=f("freshdesk")(b),_.forEach(b,function(b){a.accountFields.push(b.ticket_field)})}).error(function(a){i.error(a)})},a.getConfiguration=function(){b.get("/api/freshdesk/configurations/"+c.configurationId).success(function(b){a.configurationName=b.name,a.subjectConfig=b.Subject,a.descriptionConfig=b.Description,a.fieldConfig=b.Field,h.socket.on("freshdesk_field:remove",function(b){_.remove(a.subjectConfig,{id:b.id}),_.remove(a.descriptionConfig,{id:b.id}),_.remove(a.fieldConfig,{id:b.id})})}).error(function(a){i.error(a)})},a.getVariables=function(){b.get("/api/variables").success(function(b){a.variables=b.rows}).error(function(a){i.error(a)})},a.removeItem=function(a){b["delete"]("api/freshdesk/fields/"+a.id).success(function(){i.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})},a.addItemSubject=function(){var d={type:"string",content:""};b.post("/api/freshdesk/configurations/"+c.configurationId+"/subject",d).success(function(b){a.subjectConfig.push(b)}).error(function(){i.show("Something went wrong!","danger")})},a.addItemDescription=function(){var d={type:"string",content:""};b.post("/api/freshdesk/configurations/"+c.configurationId+"/description",d).success(function(b){a.descriptionConfig.push(b)}).error(function(){i.show("Something went wrong!","danger")})},a.addItemField=function(){var d={content:""};b.post("/api/freshdesk/configurations/"+c.configurationId+"/field",d).success(function(b){a.fieldConfig.push(b)}).error(function(){i.show("Something went wrong!","danger")})},a.updateField=function(a){b.put("/api/freshdesk/fields/"+a.id,a).success(function(){}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.changeType=function(b){"variable"===b.type?b.content="":"string"===b.type&&(b.VariableId=null),a.updateField(b)},a.changeDescType=function(b){"key_value"===b.type?(b.content="","string"===b.keyType?b.VariableId=null:"variable"===b.keyType&&(b.keyContent="")):"string"===b.type&&(b.VariableId=null,b.key="",b.keyContent=""),a.updateField(b)},a.changeFieldType=function(b){if(b.content="",b.idField){var c=_.find(a.accountFields,"name",b.idField);c&&(b.customField=!_.result(c,"default",!0))}a.updateField(b)},a.getSystemFieldOptions=function(b){if(b){var c=_.find(a.accountFields,"name",b);return c?c.choices.length>0?c.choices:null:void 0}}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.freshdesk.view",{url:"/view/:id",templateUrl:"app/freshdesk/view/view.html",controller:"FreshdeskViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.freshdesk.view.account",{url:"/account",templateUrl:"app/freshdesk/view/view.account.html"}).state("main.freshdesk.view.configurations",{url:"/configurations",templateUrl:"app/freshdesk/view/view.configurations.html"}).state("main.freshdesk.view.configurations.settings",{url:"/settings/:configurationId",templateUrl:"app/freshdesk/view/view.configurationSettings.html",controller:"FreshdeskViewCtrl"}).state("main.freshdesk.view.configuration",{url:"/configuration",templateUrl:"app/freshdesk/view/view.configuration.html"})}]),angular.module("xCallyShuttleApp").controller("FreshdeskWizardCtrl",["$scope","$http","$location","$translate","xAlert","WizardHandler",function(a,b,c,d,e,f){a.translate=d,a.initWizard=function(){a.$translate=d,a.forms={},a.item={}},a.next=function(){f.wizard().next()},a.exitValidation=function(a){return a},a.createItem=function(){console.log(a.item),b.post("api/freshdesk/accounts",a.item).success(function(){e.show(d.instant("MESSAGE_WELL_DONE")+".","success"),c.path("/freshdesk/list")}).error(function(){e.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.freshdesk.wizard",{url:"/wizard",templateUrl:"app/freshdesk/wizard/wizard.html",controller:"FreshdeskWizardCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.iframe",{url:"/iframe",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("IframeViewCtrl",["$scope","Auth","Integration","xAlert","$translate","$sce",function(a,b,c,d,e,f){a.Auth=b,a.initView=function(){return c.get({state:"iframe"}).$promise.then(function(c){a.iframe=_.first(c.rows),a.iframe.remoteUri?a.url=f.trustAsResourceUrl(a.iframe.remoteUri):b.isAgent()&&d.show(e.instant("MESSAGE_NO_IFRAME_CONFIGURED")+".","danger")})["catch"](function(a){d.error(a)})},a.updateItem=function(){return b.isAgent()?void 0:c.update({id:a.iframe.id},a.iframe).$promise.then(function(){d.show(e.instant("MESSAGE_WELL_DONE")+".","success")})["catch"](function(a){d.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.iframe.view",{url:"/view",templateUrl:"app/iframe/view/view.html",controller:"IframeViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("Integration",["$resource",function(a){return a("/api/integrations/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.integrations",{url:"/integrations",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:19}}})}]),angular.module("xCallyShuttleApp").controller("IntegrationListCtrl",["$scope","Modal","socket","FileUploader","Integration","xAlert",function(a,b,c,d,e,f){a.integrationsByPage=10;var g=a.uploader=new d({url:"api/integrations",autoUpload:!0,removeAfterUpload:!0});g.filters.push({name:"zipFilter",fn:function(a){var b="|"+a.type.slice(a.type.lastIndexOf("/")+1)+"|";return-1!=="|zip|".indexOf(b)}}),g.onSuccessItem=function(a,b,c,d){console.info("onSuccessItem",a,b,c,d),f.show(b.name,"success")},g.onErrorItem=function(a,b,c,d){console.info("onErrorItem",a,b,c,d),b.errors.forEach(function(a){f.error(err)})},a.deleteItem=b.confirm["delete"](function(a){e["delete"]({id:a},function(){f.show("Integration Removed","success")},function(a){f.error(a)})}),a.initList=function(){a.integrations=e.query({},function(a){c.syncUpdates("integration",a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.integrations.list",{url:"/list",templateUrl:"app/integration/list/list.html",controller:"IntegrationListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"]})}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.jscripty",{url:"/jscripty",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").factory("JscriptyProject",["$resource",function(a){return a("/api/jscripty/projects/:id/:controller/:action/:action2",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("JscriptyProjectListCtrl",["$scope","$uibModal","JscriptyProject","gridOptions","Auth",function(a,b,c,d,e){a.isAdmin=e.isAdmin(),a.initView=function(){var b={exporterCsvFilename:"jscriptyProjects.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:300,buttons:[{"class":"blue-hoki",icon:"icon-settings",href:"/jscripty/projects/view/{{row.entity.id}}",hide:!e.isAdmin()},{"class":" green-turquoise",icon:"fa fa-play",onClick:"grid.appScope.openJscriptyTab(row.entity)"},{"class":"purple",icon:"icon-book-open",href:"/jscripty/projects/report/{{row.entity.id}}/sessions",hide:!e.isAdmin()},{"class":"red-sunglo",icon:"fa fa-trash",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)",hide:!e.isAdmin()}]}]};a.gridOptions=d.gridOptions(c,b,a)},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/jscripty/project/list/list.create.modal.html",controller:"JscriptyProjectListCreateCtrl"});c.result.then(function(b){console.log(b),a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("JscriptyProjectListCreateCtrl",["$scope","$translate","$uibModalInstance","JscriptyProject","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){console.log(a),e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.jscripty.projects.list",{url:"/list",templateUrl:"app/jscripty/project/list/list.html",controller:"JscriptyProjectListCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){
+a.state("main.jscripty.projects",{url:"/projects",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("JscriptyProjectReportCtrl",["$scope","uiGridConstants","$http","$state","$stateParams","socket","Auth","Modal","xAlert","$translate","$rootScope","gridOptions","JscriptyProject","$location",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){a.projectStats={started:0,incomplete:0,completed:0},a.projectId=e.id,a.initView=function(){m.get({id:e.id}).$promise.then(function(b){a.project=b})["catch"](function(a){i.error(a)}),m.get({id:e.id,controller:"sessions"}).$promise.then(function(b){var c=_.groupBy(b.rows,"status");a.projectStats.started=c.started?c.started.length:0,a.projectStats.completed=c.completed?c.completed.length:0,a.projectStats.incomplete=c.incomplete?c.incomplete.length:0})["catch"](function(a){i.error(a)})},a.pdf=function(a,b){var c=[];if(a){var d=html2canvas(document.getElementById(a)),e=d.parse(),f=d.render(e),g=f.toDataURL("image/png");c.push({image:g,width:500,style:"img"})}b.length&&_.forEach(b,function(a){var b=html2canvas(document.getElementById(a.question_id)),d=b.parse(),e=b.render(d),f=e.toDataURL("image/png");c.push({image:f,width:500,style:"img"})});var h={content:c};pdfMake.createPdf(h).download("Project_summary.pdf")},a.getProjectSessions=function(){var c={exporterCsvFilename:"jscriptyProjects.csv",columnDefs:[{name:"session_id",displayName:"APPLICATION_SESSIONID"},{name:"queue",displayName:"APPLICATION_QUEUE"},{name:"membername",displayName:"APPLICATION_AGENT"},{name:"calleridnum",displayName:"APPLICATION_CALLERIDNUM"},{name:"createdAt",displayName:"APPLICATION_STARTEDAT",filterHeaderTemplate:'<div class="ui-grid-filter-container row"><div ng-repeat="colFilter in col.filters" class="col-md-6 col-md-offset-0 col-sm-5 col-sm-offset-0 col-xs-5 col-xs-offset-0"><div custom-grid-date-filter-header></div></div></div>',filters:[{name:"From",condition:b.filter.GREATER_THAN_OR_EQUAL},{name:"To",condition:b.filter.LESS_THAN_OR_EQUAL}]},{name:"completedAt",displayName:"APPLICATION_COMPLETEDAT",filterHeaderTemplate:'<div class="ui-grid-filter-container row"><div ng-repeat="colFilter in col.filters" class="col-md-6 col-md-offset-0 col-sm-5 col-sm-offset-0 col-xs-5 col-xs-offset-0"><div custom-grid-date-filter-header></div></div></div>',filters:[{name:"From",condition:b.filter.GREATER_THAN_OR_EQUAL},{name:"To",condition:b.filter.LESS_THAN_OR_EQUAL}]},{name:"status",displayName:"APPLICATION_STATUS"},{name:"last_question_id",displayName:"APPLICATION_LASTQUESTIONID"},{name:"action",width:100,buttons:[{"class":"blue-hoki",href:"/jscripty/projects/report/{{row.entity.projectId}}/session/{{row.entity.session_id}}",name:"Detail"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteSession(row.entity.session_id)"}]}]};a.gridOptions=l.gridOptions(m,c,a,{id:e.id,controller:"sessions"})},a.deleteSession=function(b){m["delete"]({id:e.id,controller:"sessions",action:b}).$promise.then(function(b){a.gridOptions.getPage(),a.initView(),i.show(j.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){i.error(a)})},a.getSessionDetails=function(){m.get({id:e.id,controller:"sessions",action:e.sessionId}).$promise.then(function(b){a.session=b,a.sessionQuestions=b.ReportJscriptyQuestions})["catch"](function(a){i.error(a)})},a.getQuestionSummary=function(){var b={exporterCsvFilename:"jscriptyProjects.csv",columnDefs:[{name:"question_id",displayName:"APPLICATION_QUESTIONID"},{name:"question_type",displayName:"APPLICATION_QUESTIONTYPE"},{name:"question_label",displayName:"APPLICATION_QUESTIONLABEL"},{name:"question_text",displayName:"APPLICATION_QUESTION"},{name:"count",displayName:"APPLICATION_COUNT",enableFiltering:!1},{name:"action",width:100,buttons:[{"class":"blue-hoki",href:"/jscripty/projects/report/"+e.id+"/detail/{{row.entity.question_id}}",name:"Detail"}]}]};a.gridOptions=l.gridOptions(m,b,a,{id:e.id,controller:"questions",action:"summary"})},a.getQuestionInputs=function(){var b={exporterCsvFilename:"jscriptyProjects.csv",columnDefs:[{name:"session_id",displayName:"APPLICATION_SESSIONID"},{name:"question_id",displayName:"APPLICATION_QUESTIONID",enableFiltering:!1},{name:"question_label",displayName:"APPLICATION_QUESTIONLABEL",enableFiltering:!1},{name:"question_text",displayName:"APPLICATION_QUESTION",enableFiltering:!1},{name:"input_label",displayName:"APPLICATION_INPUTLABEL",enableFiltering:!1},{name:"input_value",cellTemplate:'<div uib-tooltip="{{row.entity.input_value}}">{{row.entity.input_value}}</div>',displayName:"APPLICATION_INPUTVALUE",enableFiltering:!1}]};a.gridOptions=l.gridOptions(m,b,a,{id:e.id,controller:"inputs"})},a.getProjectDetail=function(){a.projectDetail=[],m.query({id:e.id,controller:"questions",action:"detail"}).$promise.then(function(b){console.log(e.questionId),e.questionId?a.projectDetail.push(_.find(b,function(a){return a.question_id==parseInt(e.questionId)})):a.projectDetail=b,console.log(a.projectDetail)})["catch"](function(a){i.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.jscripty.projects.report",{url:"/report/:id",templateUrl:"app/jscripty/project/report/report.html",controller:"JscriptyProjectReportCtrl"}).state("main.jscripty.projects.report.sessions",{url:"/sessions",templateUrl:"app/jscripty/project/report/report.sessions.html"}).state("main.jscripty.projects.report.summary",{url:"/summary",templateUrl:"app/jscripty/project/report/report.summary.html"}).state("main.jscripty.projects.report.inputs",{url:"/inputs",templateUrl:"app/jscripty/project/report/report.inputs.html"}).state("main.jscripty.projects.report.detail",{url:"/detail",templateUrl:"app/jscripty/project/report/report.detail.html"}).state("main.jscripty.projects.report.questionDetail",{url:"/detail/:questionId",controller:"JscriptyProjectReportCtrl",templateUrl:"app/jscripty/project/report/report.detail.html"}).state("main.jscripty.projects.report.sessionDetail",{url:"/session/:sessionId",controller:"JscriptyProjectReportCtrl",templateUrl:"app/jscripty/project/report/report.session.detail.html"})}]),angular.module("xCallyShuttleApp").controller("JscriptyProjectViewCtrl",["$scope","$http","$state","$stateParams","socket","Auth","Modal","xAlert","$translate","$rootScope",function(a,b,c,d,e,f,g,h,i,j){a.jscriptyProject={},a.getProject=function(){b.get("/api/jscripty/projects/"+d.id).success(function(b){a.jscriptyProject=b,angular.element(document).ready(function(){window.onerror=function(a,b,c){try{if(null!=a&&-1!=a.indexOf("Script error."));else{var d=new Image;d.src="assets/plugins/mxgraph/images/1x1.png?msg="+encodeURIComponent(a)+"&url="+encodeURIComponent(b)+"&lnum="+encodeURIComponent(c)}}catch(e){}},b.token=f.getToken();var a=new EditorUi(new Editor);a.openString(b.draft,b.name,b),a.editor.graphChangeListener=function(a,b){var c=b.properties.rtChange||!1;c||(this.modified=!0)}}),e.syncUpdates("jscripty_project",[b],function(a,c,d){c.id===b.id})})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.jscripty.projects.view",{url:"/view/:id",templateUrl:"app/jscripty/project/view/view.html",controller:"JscriptyProjectViewCtrl",authenticate:!0,resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",serie:!0,cache:!1,files:["assets/plugins/mxgraph/css/common.css","assets/plugins/mxgraph/css/explorer.css","assets/plugins/mxgraph/styles/grapheditor.css","assets/plugins/mxgraph/styles/custom.css","assets/plugins/jscripty/js/custom.js","assets/plugins/mxgraph/js/mxClient.js","assets/plugins/jscripty/js/Editor.js","assets/plugins/jscripty/js/Graph.js","assets/plugins/jscripty/js/EditorUi.js","assets/plugins/jscripty/js/Actions.js","assets/plugins/jscripty/js/Menus.js","assets/plugins/jscripty/js/Sidebar.js","assets/plugins/jscripty/js/Toolbar.js","assets/plugins/jscripty/js/Dialogs.js"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("LandingCtrl",["$scope","$location","$window","$timeout","Auth","Setting",function(a,b,c,d,e,f){a.initLanding=function(){a.year=moment().year(),f.get({controller:"info"}).$promise.then(function(b){a.info=b})["catch"](function(a){console.error(a)});var c,g,h;return(h=e.getCurrentUser().$promise)?h.then(function(e){switch(g=e,g.role){case"user":for(var f=0;f<g.Modules.length&&!(c=g.Modules[f].path);f++);break;case"admin":case"agent":c="/dashboard/voice"}c||(a.message="MESSAGE_NO_AVAILABLE_MODULES"),d(function(){b.path(c)},500)})["catch"](function(a){console.error(a),b.path("/login")}):void b.path("/login")}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("landing",{url:"/landing",templateUrl:"app/landing/landing.html",controller:"LandingCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/error.css","assets/css/login.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("LoginCtrl",["$scope","Auth","$location","$window","$rootScope","Setting","xAlert","$stateParams",function(a,b,c,d,e,f,g,h){a.year=moment().year(),a.recovered=h.reset,a.userLogin={},a.userSignUp={},a.loginSubmitted=!1,a.signupSubmitted=!1,a.errorLogin=!1,a.errorSignup=!1,a.errorLog="",a.forgotPassword=!1,a.showRecoverMessage=!1,a.flagLogin1=!1,a.getInfo=function(){return f.get({controller:"info"}).$promise.then(function(b){a.info=b})["catch"](function(a){console.error(a)})},a.toggleLogin=function(){a.flagLogin1=!a.flagLogin1},a.toggleForgotPassword=function(b){a.showRecoverMessage=!1,a.userLogin.email="",a.forgotPassword=b},e.bodyLayout="login",a.$on("$viewContentLoaded",function(){Metronic.init(),Layout.init()}),a.recover=function(){b.recover({email:a.userLogin.email}).then(function(){a.showRecoverMessage=!0})["catch"](function(b){console.log(b),a.showRecoverMessage=!1,g.error(b)})},a.login=function(d){a.loginSubmitted=!0,d.$valid?b.login({name:a.userLogin.name,password:a.userLogin.password,remember:a.userLogin.remember}).then(function(){c.path("/landing")})["catch"](function(b){a.errorLog=b.message||"error",a.errorLogin=!0}):a.errorLogin=!0},a.signup=function(c){a.signupSubmitted=!0,c.$valid?b.createUser({email:a.userSignUp.email,fullname:a.userSignUp.fullname,name:a.userSignUp.name,password:a.userSignUp.password,role:a.userSignUp.role,online:!0})["catch"](function(b){a.errorLog=b.message||"error",a.errorSignup=!0}):a.errorSignup=!0},a.loginOauth=function(a){d.location.href="/auth/"+a}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("login",{url:"/login",templateUrl:"app/login/login.html",params:{reset:null},controller:"LoginCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/login.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("Action",["$resource",function(a){return a("/api/actions/:name/:controller",{name:"@name"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("Ami",["$resource",function(a){return a("/api/ami/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("ChooseContactModalCtrl",["$scope","$uibModalInstance","data","xAlert","$translate","Contact",function(a,b,c,d,e,f){function g(){return f.get({id:c.eventId,controller:"checkevent"}).$promise.then(function(b){a.contacts=b.rows})["catch"](function(a){d.error(a)})}function h(){return delete c.type,f.get(c).$promise.then(function(b){a.contacts=b.rows})["catch"](function(a){d.error(a)})}a.open=function(a){b.close(a)},a.getContacts=function(){switch(c.type){case"event":g();break;case"detail":h();break;default:b.dismiss("cancel")}},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("CloseEditedTabModalCtrl",["$scope","$uibModalInstance",function(a,b){a.close=function(){b.close()},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("CloseEditedTabModalJscriptyCtrl",["$scope","$uibModalInstance","project","JscriptyProject","xAlert",function(a,b,c,d,e){a.init=function(){a.project=c},a.close=function(){d.update({id:a.project.projectId,controller:"sessions",action:a.project.sessionId},{status:"incomplete",completedAt:Date(),last_question_id:a.project.lastQuestionId}).$promise.then(function(a){e.show("Project Ended","success")}),b.close()},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("ContactManagerSetDisposition",["$scope","$uibModalInstance","VoiceDisposition",function(a,b,c){a.initDisposition=function(){return c.get().$promise.then(function(b){a.dispositions=b.rows})["catch"](function(a){console.error(a)})},a.item={},a.ok=function(){b.close(a.item)},a.cancel=function(){b.dismiss()}}]),angular.module("xCallyShuttleApp").controller("customGridDateFilterModalCtrl",["$scope","$rootScope","$log","$uibModalInstance","term","hasTime",function(a,b,c,d,e,f){if(a.hasTime=f,a.dateTime={},e)if(f){var g=e.split(" ");a.dateTime.filterDate=moment(g[0]),a.dateTime.time=e[1]?moment(g[1],"HH:mm"):moment()}else a.dateTime.filterDate=moment(e);else f&&(a.dateTime.time=moment());a.setFilterDate=function(b){d.close({date:moment(b).format("YYYY-MM-DD").toString(),time:f?a.dateTime.time?moment(a.dateTime.time).format("HH:mm").toString():moment().format("HH:mm").toString():null})},a.cancelDateFilter=function(){d.dismiss()}}]),angular.module("xCallyShuttleApp").controller("customGridTagsModalCtrl",["$scope","$rootScope","$log","$uibModalInstance","term","Tag","xAlert",function(a,b,c,d,e,f,g){a.initModal=function(){return a.item={},f.get().$promise.then(function(b){a.tags=_.map(b.rows,"name"),a.item.myTags=e})["catch"](function(a){console.log("error retrieving tags"),g.error(a),d.dismiss()})},a.setFilterTags=function(){d.close(a.item.myTags)},a.cancelTagsFilter=function(){d.dismiss()}}]),angular.module("xCallyShuttleApp").factory("templateVariable",["$translate",function(a){return[{id:"voice",label:a.instant("APPLICATION_VOICE"),title:a.instant("APPLICATION_VOICE"),groups:[{label:a.instant("APPLICATION_QUEUE"),values:[{value:"{{uniqueid}}",label:a.instant("APPLICATION_UNIQUEID"),description:a.instant("APPLICATION_UNIQUEID")},{value:"{{calleridnum}}",label:a.instant("APPLICATION_CALLERIDNUM"),description:a.instant("APPLICATION_CALLERIDNUM")},{value:"{{calleridname}}",label:a.instant("APPLICATION_CALLERIDNAME"),description:a.instant("APPLICATION_CALLERIDNAME")},{value:"{{queue}}",label:a.instant("APPLICATION_QUEUE"),description:a.instant("APPLICATION_QUEUE")},{value:"{{interface}}",label:a.instant("APPLICATION_INTERFACE"),description:a.instant("APPLICATION_INTERFACE")},{value:"{{membername}}",label:a.instant("APPLICATION_MEMBERNAME"),description:a.instant("APPLICATION_MEMBERNAME")},{value:"{{holdtime}}",label:a.instant("APPLICATION_HOLDTIME"),description:a.instant("APPLICATION_HOLDTIME")},{value:"{{talktime}}",label:a.instant("APPLICATION_TALKTIME"),description:a.instant("APPLICATION_TALKTIME")},{value:"{{connectedlinenum}}",label:a.instant("APPLICATION_CONNECTEDLINENUM"),description:a.instant("APPLICATION_CONNECTEDLINENUM")},{value:"{{connectedlinename}}",label:a.instant("APPLICATION_CONNECTEDLINENAME"),description:a.instant("APPLICATION_CONNECTEDLINENAME")},{value:"{{agentconnectAt}}",label:a.instant("APPLICATION_CONNECTED_AT"),description:a.instant("APPLICATION_CONNECTED_AT")},{value:"{{agentcalledAt}}",label:a.instant("APPLICATION_CALLED_AT"),description:a.instant("APPLICATION_CALLED_AT")},{value:"{{agentcompleteAt}}",label:a.instant("APPLICATION_COMPLETED_AT"),description:a.instant("APPLICATION_AGENT_CALLED_AT")},{value:"{{reason}}",label:a.instant("APPLICATION_REASON"),description:a.instant("APPLICATION_REASON")},{value:"{{lastevent}}",label:a.instant("APPLICATION_LAST_EVENT"),description:a.instant("APPLICATION_LAST_EVENT")},{value:"{{channel}}",label:a.instant("APPLICATION_CHANNEL"),description:a.instant("APPLICATION_CHANNEL")}]}]},{id:"chat",label:a.instant("APPLICATION_CHAT"),title:a.instant("APPLICATION_CHAT"),groups:[{label:a.instant("APPLICATION_VARIABLES"),values:[{value:"{{username}}",label:a.instant("APPLICATION_USERNAME"),description:a.instant("APPLICATION_USERNAME")},{value:"{{email}}",label:a.instant("APPLICATION_MAIL"),description:a.instant("APPLICATION_MAIL")},{value:"{{text}}",label:a.instant("APPLICATION_TEXT"),description:a.instant("APPLICATION_TEXT")},{value:"{{chatWebsite}}",label:a.instant("APPLICATION_WEBSITE"),description:a.instant("APPLICATION_WEBSITE")}]}]},{id:"mail",label:a.instant("APPLICATION_MAIL"),title:a.instant("APPLICATION_MAIL"),groups:[{label:a.instant("APPLICATION_INTERACTION"),values:[{value:"{{interactionId}}",label:a.instant("APPLICATION_INTERACTION_ID"),description:a.instant("APPLICATION_INTERACTION_ID")},{value:"{{subject}}",label:a.instant("APPLICATION_SUBJECT"),description:a.instant("APPLICATION_SUBJECT")},{value:"{{{body}}}",label:a.instant("APPLICATION_MESSAGE"),description:a.instant("APPLICATION_MESSAGE")},{value:"{{accountName}}",label:a.instant("APPLICATION_ACCOUNT"),description:a.instant("APPLICATION_ACCOUNT")},{value:"{{from}}",label:"From",description:"From"},{value:"{{to}}",label:"To",description:"To"},{value:"{{cc}}",label:"Cc",description:"Cc"},{value:"{{agentName}}",label:a.instant("APPLICATION_AGENT_NAME"),description:a.instant("APPLICATION_AGENT_NAME")},{value:"{{agentEmail}}",label:a.instant("APPLICATION_AGENT_EMAIL"),description:a.instant("APPLICATION_AGENT_EMAIL")},{value:"{{createdAt}}",label:a.instant("APPLICATION_CREATED_AT"),description:a.instant("APPLICATION_CREATED_AT")}]}]}]}]),angular.module("xCallyShuttleApp").controller("gridDatePickerFilterCtrl",["$scope","$timeout","$uibModal","uiGridConstants",function(a,b,c,d){b(function(){a.col.colDef.name;a.openDatePicker=function(b){var d=c.open({templateUrl:"app/main/customDateFilter.modal.html",controller:"customGridDateFilterModalCtrl",size:"md",windowClass:"custom-date-filter-modal",resolve:{term:[function(){return b.term||null}],hasTime:b.hasTime||!1}});d.result.then(function(c){a.colFilter.listTerm=[],a.colFilter.term=c.date,b.hasTime&&(a.colFilter.term+=" "+c.time)})}})}]),angular.module("xCallyShuttleApp").factory("gridOptions",["Modal","xAlert","$translate","$interval","$q","usSpinnerService",function(a,b,c,d,e,f){return{gridOptions:function(d,g,h,i,j,k,l){function m(a,b){a.filter&&a.filter.term&&b&&(o[a.name]=a.filter.term),a.filters&&(a.filters.length>1?a.filters.forEach(function(b){b.term?64===b.condition?o[a.name+"_uiFrom"]=b.term:256===b.condition&&(o[a.name+"_uiTo"]=b.term):64===b.condition?delete o[a.name+"_uiFrom"]:256===b.condition&&delete o[a.name+"_uiTo"]}):a.filters.length&&a.filters[0].term?o[a.name]=a.filters[0].term:delete o[a.name])}h.id=[];var n=k?"gridOptions"+k:"gridOptions",o={offset:0,limit:10},p={offset:0,limit:10};g.draggable&&(g.rowTemplate='<div grid="grid" class="ui-grid-draggable-row" draggable="true"><div ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell" ng-class="{ \'ui-grid-row-header-cell\': col.isRowHeader, \'custom\': true }" ui-grid-cell></div></div>',g.useExternalPagination=!1,g.enablePaginationControls=!1,g.showGridFooter=!1);var q=function(a){var b=a&&a>h[n].paginationPageSize?h[n].paginationPageSize:a,c=b?30*b+120:177,d=angular.element(document.getElementsByName(n)).length?angular.element(document.getElementsByName(n)[0]):angular.element(document.getElementsByClassName("ui-grid")[0]);d.css("height",c+"px")},r=function(a,b){return h[n].enablePaginationControls||(delete o.offset,delete o.limit),f.spin("spinner-grid"),i=a||i,d=b||d,d.get(i?_.merge(o,i):o).$promise.then(function(a){h[n].totalItems=a.count,h[n].data=a.rows,q(a.rows.length),l&&l()})["catch"](function(a){console.error(a)})["finally"](function(){f.stop("spinner-grid")})};return h.deleteItem=a.confirm["delete"](function(a){var e=i?angular.copy(i):{};return _.merge(e,{id:a}),d.remove(e).$promise.then(function(){r(),b.show(c.instant("MESSAGE_WELL_DONE")+"!","success"),h.gridApi.selection.clearSelectedRows(),h.id=[]})["catch"](function(a){b.error(a)})}),h.deleteItems=a.confirm["delete"](function(){var a=i?angular.copy(i):{};return _.merge(a,{ids:h.id}),d["delete"](a).$promise.then(function(){r(),b.show(c.instant("MESSAGE_WELL_DONE")+"!","success"),h.gridApi.selection.clearSelectedRows(),h.id=[]})["catch"](function(a){b.error(a)})}),g.columnDefs.forEach(function(a){m(a,!0),a.hasOwnProperty("displayName")||(a.displayName="APPLICATION_"+a.name.toUpperCase()),a.headerCellFilter="translate",a.hasOwnProperty("buttons")&&(a.displayName="",a.cellClass="ui-grid-vcenter",a.enableSorting=!1,a.enableFiltering=!1,a.enableColumnMenu=!1,a.cellTemplate="<div>",a.buttons.forEach(function(b){if(b.directive)a.cellTemplate+=b.directive;else{if(a.cellTemplate+="<a",a.cellTemplate+=b.hide?' data-ng-hide="'+b.hide+'" ':" ",a.cellTemplate+=b["class"]?' class="btn btn-xs '+b["class"]+'" ':" ",a.cellTemplate+=b.href?' data-ng-href="'+b.href+'" ':" ",a.cellTemplate+=b.uisref?' ui-sref="'+b.uisref+'" ':" ",a.cellTemplate+=b.onClick?' data-ng-click="'+b.onClick+'" ':" ",a.cellTemplate+=b.title?' title="'+b.title+'"':"",a.cellTemplate+=">",a.cellTemplate+=b.icon?'<i class="'+b.icon+'"></i>':"",b.name)switch(b.name){case"delete":a.cellTemplate+='<i class="icon-trash"></i>';break;case"profile":case"settings":case"detail":case"embedding":a.cellTemplate+='<i class="icon-settings"></i>';break;case"view":a.cellTemplate+='<i class="icon-doc"></i>';break;case"clone":a.cellTemplate+='<i class="icon-docs"></i>';break;case"permits":a.cellTemplate+='<i class="icon-key"></i>';break;case"copy":a.cellTemplate+='<i class="fa fa-files-o"></i>';break;case"select":a.cellTemplate+='<i class="icon-check"></i>';break;case"preview":a.cellTemplate+='<i class="icon-magnifier"></i>';break;case"contacts":a.cellTemplate+='<i class="fa fa-users"></i>';break;case"download":case"export":a.cellTemplate+='<i class="fa fa-download"></i>';break;case"agents":a.cellTemplate+='<i class="icon-people"></i>';break;case"run":a.cellTemplate+='<i class="fa fa-cogs"></i>';break;case"mailRoom":a.cellTemplate+='<i class="fa fa-envelope"></i>';break;case"chatRoom":a.cellTemplate+='<i class="fa fa-users"></i>';break;case"faxRoom":a.cellTemplate+='<i class="icon-paper-plane"></i>';break;case"smsRoom":a.cellTemplate+='<i class="glyphicon glyphicon-comment"></i>';break;case"check":a.cellTemplate+='<i class="fa fa-check"></i>';break;case"queues":a.cellTemplate+='<i class="icon-docs"></i>';break;default:a.cellTemplate+="{{'APPLICATION_"+b.name.toUpperCase()+"' | translate}}"}else a.cellTemplate+=b.displayName?"{{'"+b.displayName+"' | translate}}":"";a.cellTemplate+="</a> "}}),a.cellTemplate+="<div>",delete a.buttons)}),_.merge({enableGridMenu:!0,headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableRowSelection:!0,enableSelectAll:!0,enableFiltering:!0,showGridFooter:!0,paginationPageSizes:[10,25,50,75],paginationPageSize:10,useExternalPagination:!0,useExternalSorting:!0,useExternalFiltering:!0,multiSelect:!0,getPage:r,gridMenuTitleFilter:function(a){var b=e.defer();return b.resolve(c.instant(a)),b.promise},exporterAllDataFn:function(){return p.offset=o.offset,p.limit=o.limit,o={offset:0,limit:null},r().then(function(){o.offset=p.offset,o.limit=p.limit,r()})},exporterFieldCallback:function(a,b,c,d){if("applications"===c.field&&b.entity.Applications){var e="";return _.forEach(b.entity.Applications,function(a){e+=a.app+"("+a.appdata.join(",")+")"}),e}return d},exporterHeaderFilter:c.instant,onRegisterApi:function(a){h.gridApi=a,h.gridApi.selection&&(h.gridApi.selection.on.rowSelectionChanged(h,function(a){a.isSelected?h.id.push(h.gridApi.grid.options.primaryKey?a.entity[h.gridApi.grid.options.primaryKey]:a.entity.id):_.pull(h.id,h.gridApi.grid.options.primaryKey?a.entity[h.gridApi.grid.options.primaryKey]:a.entity.id)}),h.gridApi.selection.on.rowSelectionChangedBatch(h,function(a){a[0].isSelected?h.id=_.union(h.id,_.map(a,h.gridApi.grid.options.primaryKey?"entity."+h.gridApi.grid.options.primaryKey:"entity.id")):_.map(a,h.gridApi.grid.options.primaryKey?"entity."+h.gridApi.grid.options.primaryKey:"entity.id").forEach(function(a){_.pull(h.id,a)})})),h.gridApi.core.on.sortChanged(h,function(a,b){0===b.length?o.order=null:o.order=b[0].name+" "+b[0].sort.direction.toUpperCase(),r()});for(var e=0;e<h.gridOptions.columnDefs.length;e++)if(h.gridOptions.columnDefs[e].hasOwnProperty("sort")){o.order=h.gridOptions.columnDefs[e].name+" "+h.gridOptions.columnDefs[e].sort.direction.toUpperCase();break}h.gridApi.pagination.on.paginationChanged(h,function(a,b){o.offset=(a-1)*b,o.limit=b,r()}),h.gridApi.core.on.filterChanged(h,function(){var a=this.grid;a.columns.forEach(function(a){m(a)}),r()}),h.gridApi.draggableRows&&h.gridApi.draggableRows.on.rowDropped(h,function(a){a.fromIndex!==a.toIndex&&d.update(i,h[n].data).$promise.then(function(){b.show(c.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){b.error(a)})}),j||r()}},g)}}}]),angular.module("xCallyShuttleApp").controller("gridTagsFilterCtrl",["$scope","$timeout","$uibModal","uiGridConstants",function(a,b,c,d){b(function(){a.col.colDef.name;a.openTags=function(b){var d=c.open({templateUrl:"app/main/customTagsFilter.modal.html",controller:"customGridTagsModalCtrl",size:"md",resolve:{term:[function(){if(b.term){var a=b.term.split(";");return a.pop(),a}return[]}]}});d.result.then(function(b){a.colFilter.listTerm=[],b.length&&(a.colFilter.term=b.join(";")+";")})}})}]),angular.module("xCallyShuttleApp").controller("MainCtrl",["$scope","$rootScope","$translate","$timeout","socket","Auth","xAlert","$uibModal","$log","$state","Contact","$window","$location","localStorageService",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){a.awesomeThings=[],b.workspaces=[],a.Auth=f,b.userModules={},f.getCurrentUser().$promise.then(function(a){a.Modules.forEach(function(a){b.userModules[a.id]=!0})})["catch"](function(a){g.error(a)}),b.initTours=function(){b.activeTour={main:!1},b.tourConfig={main:[{type:"function",fn:function(){b.tempTourPath=m.path()}},{type:"title",heading:c.instant("TOUR_MAIN_WELCOME"),text:'<div class="row"><div id="title-text" class="col-md-12"><span class="main-text">'+c.instant("TOUR_MAIN_DISCOVER_MOTION")+"</span><br/></div></div>",curtainClass:"myCurtainClass"},{type:"location_change",path:"/dashboard/voice"},{type:"title",heading:c.instant("TOUR_MAIN_DASHBOARD"),text:c.instant("TOUR_MAIN_DASHBOARD_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/tools/yourdashboards/show/1"},{type:"title",heading:c.instant("TOUR_MAIN_YOURDASHBOARD"),text:c.instant("TOUR_MAIN_YOURDASHBOARD_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/staff/agents/list"},{type:"title",heading:c.instant("TOUR_MAIN_AGENTS"),text:c.instant("TOUR_MAIN_AGENTS_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/channels/voice/queues/list"},{type:"title",heading:c.instant("TOUR_MAIN_VOICE_QUEUE"),text:c.instant("TOUR_MAIN_VOICE_QUEUE_ADD_MESSAGE"),curtainClass:"myCurtainClass"}]},b.license.chat&&(b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/channels/chat/queues/list"},{type:"title",heading:c.instant("TOUR_MAIN_CHAT_QUEUE"),text:c.instant("TOUR_MAIN_CHAT_QUEUE_MESSAGE"),curtainClass:"myCurtainClass"}])),b.license.openchannel&&(b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/channels/openchannel/accounts/list"},{type:"title",heading:c.instant("TOUR_MAIN_OPENCHANNEL"),text:c.instant("TOUR_MAIN_OPENCHANNEL_MESSAGE"),curtainClass:"myCurtainClass"}])),b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/square/projects/list"},{type:"title",heading:c.instant("TOUR_MAIN_SQUARE_PROJECT"),text:c.instant("TOUR_MAIN_SQUARE_PROJECT_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/tools/trunks/list"},{type:"title",heading:c.instant("TOUR_MAIN_TRUNKS"),text:c.instant("TOUR_MAIN_TRUNKS_MESSAGE"),curtainClass:"myCurtainClass"},{type:"location_change",path:"/tools/triggers/list"},{type:"title",heading:c.instant("TOUR_MAIN_TRIGGERS"),text:c.instant("TOUR_MAIN__MESSAGE"),curtainClass:"myCurtainClass"}]),b.license.jscripty&&(b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/jscripty/projects/list"},{type:"title",heading:c.instant("TOUR_MAIN_JSCRIPTY"),text:c.instant("TOUR_MAIN_JSCRIPTY_MESSAGE"),curtainClass:"myCurtainClass"}])),b.tourConfig.main=b.tourConfig.main.concat([{type:"location_change",path:"/analytics/reports/list"},{type:"title",heading:c.instant("TOUR_MAIN_REPORTS"),text:c.instant("TOUR_MAIN_REPORTS_MESSAGE"),curtainClass:"myCurtainClass"},{type:"title",heading:c.instant("TOUR_MAIN_END"),text:c.instant("TOUR_MAIN_END_MESSAGE"),curtainClass:"myCurtainClass"}])},b.onTourFinish=function(){n.set("skipTour",!0),b.tempTourPath&&m.path(b.tempTourPath)},b.onTourSkip=function(){n.set("skipTour",!0)},d(function(){n.get("skipTour")||(b.activeTour.main=!0)}),a.select=function(a){switch(a.type){case"chatRoom":case"mailRoom":case"faxRoom":a.unread=0}},e.socket.on("report_integration:tdDisposal",function(b){a.openTdTab(b)}),a.openTdTab=function(a){b.workspaces.push({type:"tdDisposal",name:"Motion Dialer Disposition","class":"icon-control-forward",active:!0,spooler:a})},a.deselect=function(){},a.isAdmin=f.isAdmin,a.isLoggedIn=f.isLoggedIn,a.getCurrentUser=f.getCurrentUser,a.CurrentUser=f.getCurrentUser(),e.socket.on("user_has_voice_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),e.socket.on("user_has_chat_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),e.socket.on("user_has_mail_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),e.socket.on("user_has_fax_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),e.socket.on("user_has_sms_queue_permit:change",function(){a.CurrentUser=f.getCurrentUser()}),a.mainTab={active:!0},a.closeJscriptyTab=function(a){if(b.workspaces[a].edited){var c=h.open({animation:!0,templateUrl:"app/main/closeEditedTab.modal.jscripty.html",controller:"CloseEditedTabModalJscriptyCtrl",resolve:{project:b.workspaces[a]}});c.result.then(function(){b.workspaces.splice(a,1)})}else b.workspaces.splice(a,1)},b.closeTab=function(a){var c;b.workspaces[a].edited?"jscripty"===b.workspaces[a].type?b.workspaces[a].end():(c=h.open({animation:!0,templateUrl:"app/main/closeEditedTab.modal.html",controller:"CloseEditedTabModalCtrl"}),c.result.then(function(){b.workspaces.splice(a,1)},function(){i.info("Modal dismissed at: "+new Date)})):b.workspaces.splice(a,1)},a.createContact=function(d,e){return e.CompanyId||delete e.CompanyId,k.save(e).$promise.then(function(e){b.workspaces.splice(d,1);var f=e.firstName;e.lastName&&(f+=" "+e.lastName),a.openContactTab({firstName:e.firstName,lastName:e.lastName,id:e.id}),g.show(c.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){g.error(a)})};var o=function(b){var c=h.open({animation:!0,templateUrl:"app/main/chooseContact.modal.html",controller:"ChooseContactModalCtrl",resolve:{data:function(){return{type:"event",eventId:b.id}}}});c.result.then(function(c){c?a.openContactTab(c,b):a.newContact(b)},function(){i.info("Modal dismissed at: "+new Date)})};a.updateContact=function(a,d){var e=angular.copy(d);return e.CompanyId||(e.CompanyId=null),k.update({id:e.id},e).$promise.then(function(){b.workspaces[a].edited=!1,g.show(c.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){g.error(a)})},e.socket.on("report_integration:contactmanager",function(a){o(a)}),e.socket.on("report_integration:jscripty",function(b){a.openJscriptyTab({name:"Jscripty",id:b.projectId,calleridnum:b.calleridnum,calleridname:b.calleridname,queue:b.queue,membername:b.membername})}),e.socket.on("report_integration:salesforce",function(a){l.open(a.url,"_blank")}),b.openContactTab=function(a,c){var d=_.find(b.workspaces,{contactID:a.id});if(d)d.active=!0;else{var e=a.firstName;
+a.lastName&&(e+=" "+a.lastName),b.workspaces.push({name:e,type:"contact",contactID:a.id,"class":"icon-user",active:!0,data:c||null})}},a.openJscriptyTab=function(a){b.workspaces.push({name:a.name,type:"jscripty",active:!0,data:a})},a.newContact=function(a){b.workspaces.push({name:"New Contact",type:"newContact","class":"icon-user",active:!0,data:a||null})},a.$on("$viewContentLoaded",function(){Metronic.init()}),b.language=c.use(),a.changeLanguage=function(a){return c.use(a).then(function(a){b.language=a,-1!==["main.jscripty.projects.view","main.square.projects.view"].indexOf(j.current.name)&&l.location.reload()})["catch"](function(a){console.error(a)})},a.$on("$destroy",function(){console.log("main $destroy"),e.unsyncUpdates("user_has_voice_queue_permit"),e.unsyncUpdates("user_has_chat_queue_permit"),e.unsyncUpdates("user_has_mail_queue_permit"),e.unsyncUpdates("user_has_fax_queue_permit"),e.unsyncUpdates("user_has_sms_queue_permit")})}]),angular.module("xCallyShuttleApp").directive("ngSpinnerBar",["$rootScope",function(a){return{link:function(b,c){c.addClass("hide"),a.$on("$stateChangeStart",function(){"spinner-page"===c[0].id&&c.removeClass("hide")}),a.$on("$stateChangeSuccess",function(){"spinner-page"===c[0].id&&(c.addClass("hide"),$("body").removeClass("page-on-load"),Layout.setSidebarMenuActiveLink("match"),setTimeout(function(){Metronic.scrollTop()},1e3))}),a.$on("$spinnerStart",function(){"spinner-request"===c[0].id&&c.removeClass("hide")}),a.$on("$spinnerStop",function(){"spinner-request"===c[0].id&&c.addClass("hide")}),a.$on("$stateNotFound",function(){"spinner-page"===c[0].id&&c.addClass("hide")}),a.$on("$stateChangeError",function(){"spinner-page"===c[0].id&&c.addClass("hide")})}}}]).directive("a",function(){return{restrict:"E",link:function(a,b,c){(c.ngClick||""===c.href||"#"===c.href)&&b.on("click",function(a){a.preventDefault()})}}}).directive("nxEqual",function(){return{require:"ngModel",link:function(a,b,c,d){return c.nxEqual?(a.$watch(c.nxEqual,function(a){d.$setValidity("nxEqual",a===d.$viewValue)}),void d.$parsers.push(function(b){var e=b===a.$eval(c.nxEqual);return d.$setValidity("nxEqual",e),e?b:void 0})):void console.error("nxEqual expects a model as an argument!")}}}).directive("ngEnter",function(){return function(a,b,c){b.bind("keydown keypress",function(b){13===b.which&&(a.$apply(function(){a.$eval(c.ngEnter)}),b.preventDefault())})}}).directive("dropdownMenuHover",function(){return{link:function(a,b){b.dropdownHover()}}}).directive("uiSelectRequired",function(){return{require:"ngModel",link:function(a,b,c,d){d.$validators.uiSelectRequired=function(a){return a&&a.length}}}}).directive("rpattern",function(){return{restrict:"A",require:"ngModel",link:function(a,b,c,d){function e(a,b){return null==b||""===b||!h||a.test(b)?(d.$setValidity("pattern",!0),b):void d.$setValidity("pattern",!1)}var f,g=c.rpattern,h=!0;g&&(g.match(/^\/(.*)\/$/)?(g=new RegExp(g.substr(1,g.length-2)),f=function(a){return e(g,a)}):f=function(b){var c=a.$eval(g);if(!c||!c.test)throw new Error("Expected "+g+" to be a RegExp but was "+c);return e(c,b)}),d.$formatters.push(f),d.$parsers.push(f),c.$observe("required",function(a){h=a,f(d.$viewValue)})}}}).directive("newContact",["$compile","xAlert","socket","$translate","$timeout","List","Tag","Company","ReportCall","$uibModal","$rootScope","Auth",function(a,b,c,d,e,f,g,h,i,j,k,l){return{restrict:"E",scope:{workspace:"=",index:"=",submit:"&onSubmit"},templateUrl:"app/main/template/template.contactTab.html",compile:function(a,m){return function(a,m,n){function o(){a.$watch("contact",function(b,c){angular.equals(b,c)||(a.workspace.edited=!0)},!0)}a.license=k.license,a.Auth=l,a.forms={general:{}},a.firstLoad=!0,a.detail={tab:"main"},a.contact={CompanyId:"",disposed:!1},a.submitButtonLabel=d.instant("APPLICATION_CONFIRM"),a.getAgent=function(){return l.getCurrentUser().$promise.then(function(b){a.agent=b})["catch"](function(a){b.error(a)})},a.callPhoneBar=function(c,e){var f;switch(e){case"call":f="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/originate/"+c;break;case"transfer":f="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/transfer?number="+c;break;default:f="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/originate/"+c}return $http.get(f).success(function(){b.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(a){b.error(a)})},a.dispose=function(){return j.open({animation:!0,templateUrl:"app/main/cm.disposition.html",controller:"ContactManagerSetDisposition"}).result.then(function(c){return i.update({id:a.workspace.data.uniqueid},c).$promise.then(function(){a.contact.disposed=!0,b.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){b.error(a)})})},a.init=function(){a.workspace.data&&(a.contact.firstName=a.workspace.data.calleridname?a.workspace.data.calleridname:a.workspace.data.messageId?a.workspace.data.messageId:a.workspace.data.uniqueid?a.workspace.data.uniqueid:"",a.workspace.data.calleridnum&&(a.contact.phone=a.workspace.data.calleridnum),a.workspace.data.from&&(a.contact.email=a.workspace.data.from)),a.getTags(),a.getCompanies(),a.getLists(),a.getAgent()},a.getLists=function(){return f.get().$promise.then(function(b){a.lists=b.rows,c.syncUpdates("list",a.lists),a.contact.ListId=a.lists[0]?a.lists[0].id:null,a.getCustomFields()})["catch"](function(a){b.error(a)})},a.getCustomFields=function(){return f.get({listId:a.contact.ListId,controller:"customfields"}).$promise.then(function(b){a.customFields=b.rows,a.customFields.forEach(function(a){a.values=JSON.parse(a.values)}),c.socket.on("custom_field:remove",function(b){_.remove(a.customFields,function(a){return b.id==a.id})}),c.socket.on("custom_field:save",function(b){if(b.ListId===a.contact.ListId){var c=_.find(a.customFields,{id:b.id});c||("string"==typeof b.values&&(b.values=JSON.parse(b.values)),a.customFields.push(b))}}),!a.firstLoad||a.workspace.data?(a.workspace.edited=!0,a.firstLoad=!1):(a.firstLoad=!1,o())})["catch"](function(a){console.error(a),b.error(a)})},a.getTags=function(){return g.get().$promise.then(function(b){a.tags=_.map(b.rows,"name")})["catch"](function(a){console.error(a),b.error(a)})},a.getCompanies=function(){return h.get().$promise.then(function(b){a.companies=b.rows,a.companies.unshift({id:"",name:"-- None --"}),c.syncUpdates("company",a.companies)})["catch"](function(a){console.error(a),b.error(a)})},e(function(){a.init()})}}}}]).directive("contact",["$compile","xAlert","socket","$timeout","List","Tag","Company","Contact","$translate","gridOptions","$uibModal","ReportCall","$rootScope","usSpinnerService","uiGridConstants","$log","Auth","$http",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){return{restrict:"E",scope:{workspace:"=",index:"=",submit:"&onSubmit"},templateUrl:"app/main/template/template.contactTab.html",compile:function(a,j){return function(a,j,s){function t(b){var c=[],d={};_.forEach(a.columns[a.log[b].show][a.log[b].detail].indexes,function(e,f){d={name:e,displayName:a.columns[a.log[b].show][a.log[b].detail].header[f],headerCellFilter:"translate",enableSorting:!1,enableColumnMenu:!1},"createdAt"===e&&(d.cellTemplate="<div class=\"centered-uigrid-td\">{{row.entity.createdAt | date:'dd/MM/yyyy HH:mm:ss'}}</div>",d.filterHeaderTemplate='<div class="ui-grid-filter-container row"><div ng-repeat="colFilter in col.filters" class="col-md-6 col-md-offset-0 col-sm-5 col-sm-offset-0 col-xs-5 col-xs-offset-0"><div custom-grid-date-filter-header></div></div></div>',d.filters=[{name:"From",condition:o.filter.GREATER_THAN_OR_EQUAL},{name:"To",condition:o.filter.LESS_THAN_OR_EQUAL}]),c.push(d)}),a.columns[a.log[b].show][a.log[b].detail].actions&&c.push(a.columns[a.log[b].show][a.log[b].detail].actions),c.forEach(function(a){u(a,b,!0),a.hasOwnProperty("displayName")||(a.displayName="APPLICATION_"+a.name.toUpperCase()),a.headerCellFilter="translate",a.hasOwnProperty("buttons")&&(a.displayName="",a.cellClass="ui-grid-vcenter",a.enableSorting=!1,a.enableFiltering=!1,a.enableColumnMenu=!1,a.cellTemplate="<div>",a.buttons.forEach(function(b){if(b.directive)a.cellTemplate+=b.directive;else{if(a.cellTemplate+="<a",a.cellTemplate+=b.hide?' data-ng-hide="'+b.hide+'" ':" ",a.cellTemplate+=b["class"]?' class="btn btn-xs '+b["class"]+'" ':" ",a.cellTemplate+=b.href?' data-ng-href="'+b.href+'" ':" ",a.cellTemplate+=b.uisref?' ui-sref="'+b.uisref+'" ':" ",a.cellTemplate+=b.onClick?' data-ng-click="'+b.onClick+'" ':" ",a.cellTemplate+=b.title?' title="'+b.title+'"':"",a.cellTemplate+=">",a.cellTemplate+=b.icon?'<i class="'+b.icon+'"></i>':"",b.name)switch(b.name){case"delete":a.cellTemplate+='<i class="fa fa-trash"></i>';break;case"profile":case"settings":case"detail":case"embedding":a.cellTemplate+='<i class="icon-settings"></i>';break;case"agents":a.cellTemplate+='<i class="icon-people"></i>';break;case"run":a.cellTemplate+='<i class="fa fa-cogs"></i>';break;case"mailRoom":a.cellTemplate+='<i class="fa fa-envelope"></i>';break;case"chatRoom":a.cellTemplate+='<i class="fa fa-users"></i>';break;case"faxRoom":a.cellTemplate+='<i class="icon-paper-plane"></i>';break;case"smsRoom":a.cellTemplate+='<i class="glyphicon glyphicon-comment"></i>';break;default:a.cellTemplate+="{{'APPLICATION_"+b.name.toUpperCase()+"' | translate}}"}else a.cellTemplate+=b.displayName?"{{'"+b.displayName+"' | translate}}":"";a.cellTemplate+="</a> "}}),a.cellTemplate+="<div>",delete a.buttons)});var e={enablePaginationControls:!0,exporterCsvFilename:b+".csv",columnDefs:c,enableGridMenu:!0,headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,showGridFooter:!0,paginationPageSizes:[10,25,50,75],paginationPageSize:10,useExternalPagination:!0,useExternalSorting:!0,useExternalFiltering:!0,showTreeExpandNoChildren:!0,data:[],gridMenuTitleFilter:function(a){var b=$q.defer();return b.resolve(i.instant(a)),b.promise},onRegisterApi:function(c){a.gridApi=c,a.gridApi.grid.registerDataChangeCallback(function(){}),a.gridApi.core.on.sortChanged(a,function(a,c){0===c.length?v.order=null:v.order=c[0].name+" "+c[0].sort.direction.toUpperCase(),w(b)}),a.gridApi.pagination.on.paginationChanged(a,function(a,c){v.offset=(a-1)*c,v.limit=c,w(b)}),a.gridApi.core.on.filterChanged(a,function(){var a=this.grid;a.columns.forEach(function(a){u(a,b)}),w(b)})}};w(b,e)}function u(a,b,c){a.filter&&a.filter.term&&c&&(v[b][a.name]=a.filter.term),a.filters&&(a.filters.length>1?a.filters.forEach(function(c){c.term?64===c.condition?v[b][a.name+"_uiFrom"]=c.term:256===c.condition&&(v[b][a.name+"_uiTo"]=c.term):64===c.condition?delete v[b][a.name+"_uiFrom"]:256===c.condition&&delete v[b][a.name+"_uiTo"]}):a.filters.length&&a.filters[0].term?v[b][a.name]=a.filters[0].term:delete v[b][a.name])}a.moment=moment,a.license=m.license,a.forms={general:{}},a.detail={tab:"main"},a.log={daily:{show:"phone",type:"inbound",detail:"general"},history:{show:"phone",type:"inbound",detail:"general"}},a.columns={phone:{general:{header:["APPLICATION_SOURCE","APPLICATION_DESTINATION","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["source","destination","disposition","createdAt"]},queue:{header:["APPLICATION_CALLERID","APPLICATION_QUEUE","APPLICATION_DATE"],indexes:["calleridnum","queue","createdAt"]}},email:{general:{header:["APPLICATION_FROM","APPLICATION_TO","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["from","account","disposition","createdAt"],actions:{name:"action",displayName:"",width:40,buttons:[{"class":"green",name:"mailRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'mailRoom')"}]}}},chat:{general:{header:["APPLICATION_WEBSITE","APPLICATION_VISITOR","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["website","contact","disposition","createdAt"],actions:{name:"action",displayName:"",width:40,buttons:[{"class":"green",name:"chatRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'chatRoom')"}]}}},fax:{general:{header:["APPLICATION_FROM","APPLICATION_TO","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["contact","account","disposition","createdAt"],actions:{name:"action",displayName:"",width:40,buttons:[{"class":"green",name:"faxRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'faxRoom')"}]}}},sms:{general:{header:["APPLICATION_FROM","APPLICATION_DISPOSITION","APPLICATION_DATE"],indexes:["contact","disposition","createdAt"],actions:{name:"action",displayName:"",width:40,buttons:[{"class":"green",name:"smsRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'smsRoom')"}]}}}},a.Auth=q,a.getAgent=function(){return q.getCurrentUser().$promise.then(function(b){a.agent=b})["catch"](function(a){b.error(a)})},a.callPhoneBar=function(c,d){var e;switch(d){case"call":e="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/originate/"+c;break;case"transfer":e="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/transfer?number="+c;break;default:e="http://127.0.0.1:"+a.agent.phoneBarRemoteControlPort+"/api/originate/"+c}return r.get(e).success(function(){b.show(i.instant("MESSAGE_WELL_DONE"),"success")}).error(function(a){b.error(a)})},a.copy=function(a){var c=k.open({animation:!0,size:"small",templateUrl:"app/contactmanager/contact/list/copy.modal.html",controller:"ContactManagerListCopyModalCtrl"});c.result.then(function(c){return h.save({id:a,controller:"copy"},c).$promise.then(function(a){m.openContactTab({firstName:a.firstName,lastName:a.lastName,id:a.id})})["catch"](function(a){b.error(a)})},function(){p.info("Modal dismissed at: "+new Date)})},a.merge=function(c){var d=k.open({animation:!0,size:"lg",templateUrl:"app/main/mergeContact.choose.modal.html",controller:"ContactManagerMergeContactChoose",resolve:{listId:c.ListId}});d.result.then(function(d){var e=k.open({animation:!0,size:"lg",templateUrl:"app/main/mergeContact.merge.modal.html",controller:"ContactManagerMergeContactMerge",resolve:{contactId:d,mergeContact:c}});e.result.then(function(e){return e.oldContact=c.id,h.save({id:d,controller:"merge"},e).$promise.then(function(b){m.workspaces.splice(a.index,1),_.remove(m.workspaces,{contactID:b.id}),m.openContactTab({firstName:b.firstName,lastName:b.lastName,id:b.id})})["catch"](function(a){b.error(a)})},function(){p.info("Modal dismissed at: "+new Date)})},function(){p.info("Modal dismissed at: "+new Date)})},a.dispose=function(){return k.open({animation:!0,templateUrl:"app/main/cm.disposition.modal.html",controller:"ContactManagerSetDisposition"}).result.then(function(c){return l.update({id:a.workspace.data.uniqueid},c).$promise.then(function(){a.contact.disposed=!0,b.show(i.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){b.error(a)})})},a.companyInfo=function(b){k.open({animation:!0,size:"lg",templateUrl:"app/main/company.info.modal.html",controller:["$scope","$uibModalInstance","company",function(a,b,c){a.company=c,a.close=function(){b.dismiss("cancel")}}],resolve:{company:_.find(a.companies,{id:b})}})},a.updateLog=function(b,c,d,e){c&&(a.log[b].show=c),d&&(a.log[b].detail=d),e&&(a.log[b].type=e),t(b)},a.openRoom=function(a,b,c){var d=_.find(m.workspaces,{id:a,type:b});if(d)d.active=!0;else{var e;switch(b){case"mailRoom":e="icon-envelope";break;case"chatRoom":e="fa fa-users";break;case"faxRoom":e="icon-paper-plane";break;case"smsRoom":e="glyphicon glyphicon-comment"}m.workspaces.push({id:a,type:b,"class":e,active:!0,data:c})}};var v={daily:{offset:0,limit:10},history:{offset:0,limit:10}},w=function(b,c){return n.spin("spinner-grid"),h.get(_.merge(_.merge({id:a.workspace.contactID,controller:"log",logType:b,order:"createdAt DESC"},a.log[b]),v[b])).$promise.then(function(d){c&&(a["gridOptions"+b]=c),a["gridOptions"+b].totalItems=d.count,a["gridOptions"+b].data=d.rows,x("gridOptions"+b,d.rows.length)})["catch"](function(a){console.error(a)})["finally"](function(){n.stop("spinner-grid")})},x=function(a,b){var c=b?30*b+120:177;angular.element(document.getElementsByName(a)[0]).css("height",c+"px")};a.getContact=function(){return h.get({id:a.workspace.contactID}).$promise.then(function(b){a.contact=b,a.contact.CompanyId||(a.contact.CompanyId=""),a.getCustomFields(b.ListId),a.updateLog("daily"),a.updateLog("history")})["catch"](function(a){console.error(a),b.error(a)})},a.getTags=function(){return f.get().$promise.then(function(b){a.tags=_.map(b.rows,"name")})["catch"](function(a){console.error(a),b.error(a)})},a.getCompanies=function(){return g.get().$promise.then(function(b){a.companies=b.rows,a.companies.unshift({id:"",name:"-- None --"}),c.syncUpdates("company",a.companies)})["catch"](function(a){console.error(a),b.error(a)})},a.getCustomFields=function(d){return a.customFields=[],e.get({listId:d,controller:"customfields"}).$promise.then(function(b){b.rows.forEach(function(b){try{"select"===b.type&&(b.values=JSON.parse(b.values)),a.customFields.push(b)}catch(c){console.log("Cf not valid:",b.alias)}}),c.socket.on("custom_field:remove",function(b){_.remove(a.customFields,function(a){return b.id==a.id})}),c.socket.on("custom_field:save",function(b){if(b.ListId===d){var c=_.find(a.customFields,{id:b.id});c||("string"==typeof b.values&&(b.values=JSON.parse(b.values)),a.customFields.push(b))}})})["catch"](function(a){console.error(a),b.error(a)})},d(function(){a.getTags(),a.getCompanies(),a.getContact(),a.getAgent()})}}}}]).directive("jscripty",["$compile","xAlert","$http","socket","JscriptyProject",function(a,b,c,d,e){return{restrict:"E",scope:{workspace:"=",index:"=",submit:"&onSubmit"},templateUrl:"app/main/template/template.jscriptyTab.html",compile:function(a,d){return function(a,d,f){a.count=0,a.questions=[];var g,h=a.workspace.data.id;c.get("/api/jscripty/projects/"+h+"/download").success(function(b){b?c.post("/api/jscripty/projects/"+h+"/sessions",{projectId:h,status:"started",queue:a.workspace.data.queue,calleridnum:a.workspace.data.calleridnum,callername:a.workspace.data.callername,membername:a.workspace.data.membername}).success(function(c){g=c.session_id,a.workspace.edited=!0,a.workspace.sessionId=g,a.workspace.projectId=h;var d=mxUtils.parseXml(b),e=new mxCodec(d);a.decObj=e.decode(d.documentElement);var f=_.find(a.decObj.cells,function(a){return a.vertex&&"start"==a.value.nodeName});if("OFF"==f.getAttribute("state")){var j=_.find(f.edges,function(a){return a.source.id==f.id}).target;a.questions[a.count]=a.currentQuestion=i(j)}else a.questions[a.count]=a.currentQuestion=f;a.saveQuestions()}):(console.log("No project published!"),alert("No project published!"),a.submit({index:a.index}))}),a.next=function(b,c){switch(a.currentQuestion.answer&&a.currentQuestion.answer!=c&&(a.questions=_.take(a.questions,a.count+1)),a.currentQuestion.answer=c,b.value.nodeName){case"question":b=i(b)}a.questions[a.count]=a.currentQuestion,a.currentQuestion=b,a.count++,a.questions[a.count]=b,a.saveQuestions()};var i=function(a){var b=[];return a.options=[],_.forEach(a.edges,function(c,d){if(c.source.id==a.id&&c.value){var e=String(c.value).split(",");e.length>1?(_.forEach(e,function(b,d){var e=Object.create(c);e.setValue(b),a.edges.push(e),a.options.push(b)}),b.push(c)):a.options.push(e[0])}}),_.forEach(b,function(b){_.remove(a.edges,function(a){return a.value==b.value&&a.id==b.id})}),a};a.end=function(){a.saveQuestions(),a.workspace.lastQuestionId=a.questions[a.questions.length-1].id,"end"==a.questions[a.questions.length-1].value.nodeName&&(a.workspace.edited=!1,e.update({id:h,controller:"sessions",action:g},{status:"completed",completedAt:Date(),last_question_id:a.questions[a.questions.length-1].id}).$promise.then(function(a){b.show("Project Ended","success")})),a.submit({index:a.index})},a.workspace.end=a.end,a.back=function(){a.count--,a.currentQuestion=a.questions[a.count]},a.setCurrentQuestion=function(b){a.count=b,a.currentQuestion=a.questions[a.count]},a.saveQuestions=function(){for(var c=[],d=[],f=0;f<a.questions.length;f++){if(a.questions[f].children)for(var i=a.questions[f].children,j=0;j<i.length;j++)d[j]={input_id:i[j].id,input_type:i[j].getAttribute("type"),input_label:i[j].getAttribute("label"),input_value:"checkbox"!=i[j].getAttribute("type")||i[j].answer?i[j].answer:!1};c[f]={sessionId:g,projectId:h,question_id:a.questions[f].id,question_type:a.questions[f].value.nodeName,question_label:a.questions[f].getAttribute("label"),question_text:a.questions[f].getAttribute("question")||a.questions[f].getAttribute("text"),question_other_label:a.questions[f].getAttribute("other"),question_other_answer:a.questions[f].otheranswer,question_answer:a.questions[f].answer,question_options:a.questions[f].options?JSON.stringify({options:a.questions[f].options}):null,index:f,ReportJscriptyInputs:d},d=[]}e.save({id:h,controller:"sessions",action:g,action2:"questions"},c).$promise.then(function(a){})["catch"](function(a){b.error(a)})}}}}}]).directive("reportBuilder",["$compile",function(a){return{restrict:"E",scope:{group:"=",fields:"=",forms:"=",firstCall:"="},templateUrl:"app/main/template/template.reportBuilderView.html",compile:function(b,c){var d,e;return d=b.contents().remove(),function(b,c,f){b.operators=[{name:"AND"},{name:"OR"}],b.conditions=[{name:"="},{name:"!="},{name:"<"},{name:"<="},{name:">"},{name:">="},{name:"LIKE"},{name:"NOT LIKE"},{name:"IS NULL"},{name:"IS NOT NULL"},{name:"IS EMPTY"},{name:"IS NOT EMPTY"}],b.inputIsRequired=function(a){if(a.condition)switch(a.condition){case"IS NULL":case"IS NOT NULL":case"IS EMPTY":case"IS NOT EMPTY":a.required=!1;break;default:a.required=!0}},b.addCondition=function(){b.group.rules.push({condition:"=",field:"",value:""})},b.removeCondition=function(a){b.group.rules.splice(a,1)},b.addGroup=function(){b.group.rules.push({group:{operator:"AND",rules:[{condition:"=",field:"",value:""}]}})},b.randomName=function(a,b){var c=[];for(a=a||5,b=b||"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";--a;)c.push(b.charAt(Math.floor(Math.random()*b.length)));return c.join("")},b.removeGroup=function(){b.$parent.group&&b.$parent.group.rules.splice(b.$parent.$index,1)},e||(e=a(d)),c.append(e(b,function(a){return a}))}}}}]).directive("dynamicName",["$compile",function(a){return{restrict:"A",terminal:!0,priority:1e3,link:function(b,c,d){c.attr("name",b.$eval(d.dynamicName)),c.removeAttr("dynamic-name"),a(c)(b)}}}]).directive("onReadFile",["$parse",function(a){return{restrict:"A",scope:!1,link:function(b,c,d){var e=a(d.onReadFile);c.on("change",function(a){var c=new FileReader;c.onload=function(a){b.$apply(function(){e(b,{$fileContent:a.target.result})})},c.readAsText((a.srcElement||a.target).files[0])})}}}]).directive("motionFileDownload",["xAlert","$translate","$timeout","$location","FileSaver","$compile",function(a,b,c,d,e,f){return{restrict:"E",template:'<a uib-tooltip=\'{{tooltiptext}}\' class="{{btnclass || \'btn default btn-xs blue-hoki\'}}" href="" data-ng-click="download()" ><i class="icon-cloud-download"></i>{{btncontent || \'\'}}</a>',scope:{mimetype:"=",filename:"=",resource:"=",params:"=",btnclass:"@",btncontent:"@",tooltiptext:"@"},link:function(b,c,d){var f=c.children()[0];b.$on("download-start",function(){$(f).attr("disabled","disabled")}),b.$on("downloaded",function(a,c){var d=base64ToBlob(c,b.mimetype);e.saveAs(d,b.filename),$(f).attr("disabled",!1)}),b.download=function(){return b.$emit("download-start"),b.resource.get(b.params).$promise.then(function(a){b.$emit("downloaded",a.downloadString)})["catch"](function(b){a.error(b),$(f).attr("disabled",!1)})}}}}]).directive("audioFileDownload",["xAlert","$translate","$uibModal",function(a,b,c){return{restrict:"E",template:'<button type="button" class="btn default btn-xs blue-hoki" data-ng-click="download()"><i class="fa fa-play"></i> {{ \'APPLICATION_PREVIEW\' | translate}}</button>',scope:{resource:"=",params:"="},link:function(b,d,e){var f=d.children()[0];b.$on("download-start",function(a,c){b.tempHtml=$(f).html(),$(f).attr("disabled","disabled").html('<i class="icon-refresh"></i> Loading...')}),b.$on("downloaded",function(a,d){c.open({animation:!0,size:"small",templateUrl:"app/main/audioFileDownload.play.modal.html",controller:["$scope","$uibModalInstance","$sce","audio",function(a,b,c,d){a.audio=c.trustAsResourceUrl("data:audio/wav;base64,"+d.data),a.close=function(){b.dismiss("cancel")}}],resolve:{audio:function(){return{data:d}}}});$(f).html(b.tempHtml).attr("disabled",!1)}),b.$on("error",function(a,c){$(f).html(b.tempHtml).attr("disabled",!1)}),b.download=function(){return b.$emit("download-start"),b.resource.get(b.params).$promise.then(function(a){b.$emit("downloaded",a.downloadString)})["catch"](function(c){a.error(c),b.$emit("error")})}}}}]).directive("uiRequired",function(){return{require:"ngModel",link:function(a,b,c,d){d.$validators.required=function(a,b){return!(b&&0===b.length&&"true"===c.uiRequired)},c.$observe("uiRequired",function(){d.$setValidity("required",!("true"===c.uiRequired&&d.$viewValue&&0===d.$viewValue.length))})}}}).directive("schrollBottom",function(){return{scope:{schrollBottom:"="},link:function(a,b){a.$watchCollection("schrollBottom",function(a){a&&$(b).scrollTop($(b)[0].scrollHeight)})}}}).directive("customGridDateFilterHeader",function(){return{templateUrl:"app/main/customDateFilterHeader.html",controller:"gridDatePickerFilterCtrl"}}).directive("customGridTagsFilterHeader",function(){return{templateUrl:"app/main/customTagsFilterHeader.html",controller:"gridTagsFilterCtrl"}}).directive("infiniteScroll",["$window",function(a){return{link:function(a,b,c){var d=parseInt(c.threshold)||0,e=b[0];b.bind("scroll",function(){a.$eval(c.canLoad)&&e.scrollTop+e.offsetHeight>=e.scrollHeight-d&&a.$apply(c.infiniteScroll)})}}}]).directive("tigerDialDisposal",["$compile","xAlert","socket","$translate","$timeout","$rootScope","MotionDialerSpooler","Agent",function(a,b,c,d,e,f,g,h){return{restrict:"E",scope:{workspace:"=",index:"="},templateUrl:"app/main/template/template.tigerDialDisposal.html",compile:function(a,c){return function(a,c,i){a.moment=moment,a.entitySpooler={},a.forms={td:{}},a.init=function(){return h.get().$promise.then(function(b){a.agents=[],b&&b.rows.forEach(function(b){a.agents.push("SIP/"+b.name)})})["catch"](function(a){b.error(a)})},a.save=function(){var c;switch(a.entitySpooler.retrieve){case"CLOSED":c=g.close({id:parseInt(a.workspace.ticketId.id)});break;case"OPEN":c=g.open({id:parseInt(a.workspace.ticketId.id)});break;case"BLACK_LIST":c=g.blacklist({id:parseInt(a.workspace.ticketId.id)});break;case"PLANNED":c=g.planning({id:parseInt(a.workspace.ticketId.id),date:moment(a.entitySpooler.planningtime).format("YYYY-MM-DD HH:mm")});break;case"PLANNED_PEER":c=g.planningpeer({id:parseInt(a.workspace.ticketId.id),date:moment(a.entitySpooler.planningtime).format("YYYY-MM-DD HH:mm"),peer:a.entitySpooler.planningpeer})}c?c.$promise.then(function(c){console.log(c),c.status>0?(b.show(d.instant("MESSAGE_WELL_DONE"),"success"),$uibModalInstance.close()):c.response.RMI.errors.forEach(function(c){c?(b.show(c.field+": "+c.error,"danger"),f.workspaces.splice(a.index,1)):b.show("Please, check your connection!","danger")})})["catch"](function(a){b.error(a)}):b.show("RETRIEVE NOT FOUND","danger")},e(function(){a.init()})}}}}]),angular.module("xCallyShuttleApp").filter("propsFilter",function(){return function(a,b){var c=[];return angular.isArray(a)?a.forEach(function(a){for(var d=!1,e=Object.keys(b),f=0;f<e.length;f++){var g=e[f],h=b[g].toLowerCase();if(-1!==a[g].toString().toLowerCase().indexOf(h)){d=!0;break}}d&&c.push(a)}):c=a,c}}).filter("capitalize",function(){return function(a){return a?a.replace(/([^\W_]+[^\s-]*) */g,function(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()}):""}}).filter("salesforce",function(){var a=["CallDisposition","CallDurationInSeconds","CallObject","CallType","IsArchived","Priority","Status","Type"];return function(b){return _.remove(b,function(b){return b.custom===!1&&a.indexOf(b.name)<0}),b}}).filter("sugarcrm",function(){var a=["account_id","account_name","account_name1","assigned_user_name","assigned_user_id","case_number","created_by","created_by_name","date_entered","date_modified","deleted","description","id","modified_by_name","modified_user_id","name"];return function(b){return _.remove(b,function(b){return a.indexOf(b.name)>=0}),b}}).filter("freshdesk",function(){var a=["requester","subject","agent","description"];return function(b){return _.remove(b,function(b){return a.indexOf(b.ticket_field.name)>=0}),b}}).filter("zendesk",function(){var a=["subject","assignee","description"];return function(b){return _.remove(b,function(b){return a.indexOf(b.type)>=0}),b}}).filter("slice",function(){return function(a,b,c){return a?a.slice(b,c):void 0}}),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main",{"abstract":!0,templateUrl:"app/main/main.html",controller:"MainCtrl",resolve:{authorization:["$q","Auth","$state","$timeout","$location",function(a,b,c,d,e){return b.getToken()?a.when():(d(function(){e.path("/login")}),a.reject())}],deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/plugins/mxgraph/js/mxClient.js","assets/plugins/ckeditor/ckeditor.js","assets/css/login.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("xAlert",["$translate","Notification","$state",function(a,b,c){return{show:function(c,d){switch(d){case"success":b.success({message:c,title:'<i class="glyphicon glyphicon-ok"></i> <strong>'+a.instant("MESSAGE_SUCCESS")+"!</strong>",delay:5e3});break;case"info":b.info({message:c,title:'<i class="glyphicon glyphicon-info-sign"></i> <strong>'+a.instant("MESSAGE_INFO")+"!</strong>",delay:5e3});break;case"danger":b.error({message:c,title:'<i class="glyphicon glyphicon-exclamation-sign"></i> <strong>'+a.instant("MESSAGE_ERROR")+"!</strong>",delay:1e4});break;case"warning":b.warning({message:c,title:'<i class="glyphicon glyphicon-warning-sign"></i> <strong>'+a.instant("MESSAGE_WARNING")+"!</strong>",delay:1e4});break;default:b.info(c)}},error:function(d){var e,f;d?d.status&&401===d.status?(e="Unauthorized!",f=!0):e=d.data?d.data.translatedMessage||d.data.message||"Generic Error":d.translatedMessage||d.message||"Generic Error":e="Generic Error",b.error({message:a.instant(e),title:'<i class="glyphicon glyphicon-exclamation-sign"></i> <strong>'+a.instant("MESSAGE_ERROR")+"!</strong>",delay:1e4}),f&&c.go("landing")}}}]).factory("stResource",["$q","$filter","$timeout","$rootScope","$http","$translate","xAlert",function(a,b,c,d,e,f,g){return{getPage:function(b){var c={page:Math.ceil(b.pagination.start/b.pagination.number),per_page:b.pagination.number};b.sort.predicate&&(c.sort_by=b.sort.predicate,c.sort_order=b.sort.reverse?"DESC":"ASC"),_.forIn(b.search.predicateObject,function(a,b){c[b]=a}),b.search.params&&(c.clientQuery={},_.forIn(b.search.params,function(a,b){c.clientQuery[b]=a})),d.$broadcast("$spinnerStart"),e.get(b.url,{params:c}).success(function(a){f.resolve(a),d.$broadcast("$spinnerStop")}).error(function(a){g.error(a),d.$broadcast("$spinnerStop")});var f=a.defer();return f.promise}}}]).factory("xNotification",["$translate","Notification","$rootScope",function(a,b,c){return{show:function(d,e,f,g,h,i){var j=c.$new(),k={message:e,title:d,templateUrl:"app/main/template/template.notification.html",delay:g,scope:j};switch(j.acceptBtn=a.instant("APPLICATION_ACCEPT"),j.rejectBtn=a.instant("APPLICATION_REJECT"),j.nAccept=h,j.nReject=i,f){case"chat":j["class"]="alert-info",j.icon="icon-bubble";break;case"mail":j["class"]="alert-success",j.icon="icon-envelope";break;case"fax":j["class"]="alert-warning",j.icon="icon-paper-plane";break;case"sms":j["class"]="alert-danger",j.icon="glyphicon glyphicon-comment";break;case"openchannel":j["class"]="alert-danger",j.icon="icon-globe";break;default:j["class"]="alert-info"}return new b(k)}}}]),angular.module("xCallyShuttleApp").controller("ContactManagerMergeContactChoose",["$scope","$translate","Contact","gridOptions","List","uiGridConstants","xAlert","$stateParams","Company","$uibModalInstance","listId",function(a,b,c,d,e,f,g,h,i,j,k){
+a.initView=function(){var b;return e.get().$promise.then(function(b){return a.lists=[],a.customFields=[],b.rows.forEach(function(b,c){_.forEach(b.CustomFields,function(b){a.customFields.push({name:b.name,alias:b.alias})}),a.lists.push({value:b.id,label:b.name})}),i.get().$promise}).then(function(b){a.companies=[],b.rows.forEach(function(b,c){a.companies.push({value:b.id,label:b.name})})}).then(function(){var e=[{"class":"blue-hoki",name:"select",onClick:"grid.appScope.choose(row.entity.id)"}];b={exporterCsvFilename:"Contacts.csv",columnDefs:[{name:"firstName"},{name:"lastName"},{name:"phone"},{name:"email"},{name:"ListId",displayName:"APPLICATION_LIST",field:"List.name",enableFiltering:!1},{name:"CompanyId",displayName:"APPLICATION_COMPANY",field:"Company.name",filter:{type:f.filter.SELECT,term:h.companyId||null,selectOptions:a.companies}}]},_.forEach(a.customFields,function(a){b.columnDefs.push({name:a.name,displayName:a.alias,visible:!1})}),b.columnDefs.push({name:"action",width:30,buttons:e}),a.gridOptions=d.gridOptions(c,b,a,{ListId:k})})["catch"](function(a){g.error(a)})},a.choose=function(a){j.close(a)},a.cancel=function(){j.dismiss()}}]),angular.module("xCallyShuttleApp").controller("ContactManagerMergeContactMerge",["$scope","$translate","Contact","xAlert","Company","$uibModalInstance","contactId","List","mergeContact","Tag",function(a,b,c,d,e,f,g,h,i,j){a.initView=function(){return e.get().$promise.then(function(b){return a.companies=b.rows,a.companies.unshift({id:"",name:"-- None --"}),j.get().$promise}).then(function(b){return a.tags=_.map(b.rows,"name"),c.get({id:g}).$promise}).then(function(b){a.fields={},a.contact={};var c=_.merge(_.keys(b),_.keys(i));return _.forEach(c,function(c){switch(c){case"tags":a.contact.tags=_.union(b.tags||[],i.tags||[]);break;case"$promise":case"$resolved":break;default:a.fields[c]=[],b[c]&&a.fields[c].push(b[c]),i[c]&&a.fields[c].push(i[c]),a.contact[c]=a.fields[c][0]||null}}),h.get({listId:b.ListId,controller:"customfields"}).$promise}).then(function(b){a.customFields=b.rows,a.customFields.forEach(function(a){a.values=JSON.parse(a.values)})})["catch"](function(a){d.error(a)})},a.merge=function(){a.contact.CompanyId||(a.contact.CompanyId=null),f.close(a.contact)},a.cancel=function(){f.dismiss()}}]),angular.module("xCallyShuttleApp").factory("Widget",["$resource",function(a){return a("/api/widgets/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("MarketCtrl",["$scope","$http","$translate","socket","xAlert","Modal","$timeout","Integration",function(a,b,c,d,e,f,g,h){function i(a,b){return Math.floor(Math.random()*(b-a+1))+a}a.initView=function(){return h.get().$promise.then(function(b){a.integrations=b.rows,a.groupedIntegration=_.chunk(a.integrations,4),d.syncUpdates("integration",a.integrations,function(){a.groupedIntegration=_.chunk(a.integrations,4)})})["catch"](function(a){e.error(a,"danger")})},a.isProgressing=!1,a.$on("$destroy",function(){d.unsyncUpdates("integration")}),a.installIntegration=function(b){return navigator.onLine?(a.status="Downloading",a.percentage=i(1,50),a.isProgressing=!0,b.downloading=!0,h.update({id:b.id},{active:!0}).$promise.then(function(){g(function(){a.percentage=i(51,99),a.status="Installing"},2500),g(function(){a.percentage=100,a.isProgressing=!1,a.status="Completed!",b.downloading=!1,e.show(c.instant("MESSAGE_WELL_DONE")+".","success")},5e3)})["catch"](function(){b.downloading=!1,a.percentage=0,a.isProgressing=!1,e.show(c.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})):void e.show(c.instant("MESSAGE_NO_INTERNET_CONNECTION")+".","danger")},a.uninstallIntegration=function(b){return navigator.onLine?(a.status="Uninstalling",a.percentage=i(1,99),a.isProgressing=!0,b.downloading=!0,h.update({id:b.id},{active:!1}).$promise.then(function(){g(function(){a.percentage=100,a.isProgressing=!1,a.status="Completed!",b.downloading=!1,e.show(c.instant("MESSAGE_WELL_DONE")+".","success")},5e3)})["catch"](function(){b.downloading=!1,a.percentage=0,a.isProgressing=!1,e.show(c.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})):void e.show(c.instant("MESSAGE_NO_INTERNET_CONNECTION")+".","danger")}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.market",{url:"/market",templateUrl:"app/market/market.html",controller:"MarketCtrl",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").controller("MotionbarCtrl",["$scope","$stateParams","$cookieStore","$window","$location","Auth",function(a,b,c,d,e,f){console.log(b),b.token&&b.userId&&b.role&&b.redirectTo?(f.loginWithToken(b.token,b.userId,b.role),d.location.href=decodeURIComponent(b.redirectTo)):e.path("/login")}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("motionbar",{url:"/motionbar?redirectTo&token&userId&role",template:"<div ui-view></div>",controller:"MotionbarCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.blacklist",{url:"/blacklist",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("MotionDialerBlackListListCtrl",["$scope","$uibModal","$translate","xAlert","Modal","MotionDialerBlackList","uiGridConstants",function(a,b,c,d,e,f,g){a.initView=function(){a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,columnDefs:[{name:"id",width:60},{name:"phone"},{name:"description",enableSorting:!1},{name:"updatedtime",sort:{direction:g.DESC},enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteItem(row.entity.phone, row.entity.id)"><i class="icon-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},f.list({page:1,size:6e5}).$promise.then(function(b){b.status>0?a.gridOptions.data=b.response.RMI.rows:d.show("Please, check your connection!","danger")})["catch"](function(a){d.error(a)})},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/motiondialer/blacklist/list/list.create.modal.html",controller:"MotionDialerBlackListListCreateCtrl"});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.deleteItem=e.confirm["delete"](function(b){return f["delete"]({id:b}).$promise.then(function(e){e.status>0?(_.remove(a.gridOptions.data,{id:b}),d.show(c.instant("MESSAGE_WELL_DONE"),"success")):d.show(e.message||"Please, check your connection!","danger")})["catch"](function(a){d.error(a)})})}]),angular.module("xCallyShuttleApp").controller("MotionDialerBlackListListCreateCtrl",["$scope","$translate","$uibModalInstance","MotionDialerBlackList","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.insert(a.item).$promise.then(function(a){a.status>0?(e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):e.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.blacklist.list",{url:"/list",templateUrl:"app/motiondialer/blacklist/list/list.html",controller:"MotionDialerBlackListListCtrl",authenticate:!0})}]),angular.module("xCallyShuttleApp").factory("MotionDialerBlackList",["$resource",function(a){return a("/api/rest/blacklist/:controller",null,{list:{method:"POST",params:{controller:"list"}},insert:{method:"POST",params:{controller:"insert"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},update:{method:"POST",params:{controller:"update"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.info",{url:"/info",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").factory("MotionDialerSystem",["$resource",function(a){return a("/api/rest/system/:controller",null,{properties:{method:"POST",params:{controller:"properties"}}})}]),angular.module("xCallyShuttleApp").controller("MotionDialerInfoViewCtrl",["$scope","xAlert","MotionDialerSystem",function(a,b,c){a.getProperties=function(){return c.properties().$promise.then(function(c){console.log(c),c.status>0?a.properties=c.response.RMI:b.show(c.message||"Please, check your connection!","danger")})["catch"](function(a){b.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.info.view",{url:"/view",templateUrl:"app/motiondialer/info/view/view.html",controller:"MotionDialerInfoViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.motiondialer.info.view.about",{url:"/about",templateUrl:"app/motiondialer/info/view/view.about.html"}).state("main.motiondialer.info.view.details",{url:"/details",templateUrl:"app/motiondialer/info/view/view.details.html"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.lists",{url:"/lists",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("MotionDialerListListCtrl",["$scope","$uibModal","$translate","xAlert","Modal","MotionDialerList","uiGridConstants","usSpinnerService",function(a,b,c,d,e,f,g,h){a.initView=function(){return a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,columnDefs:[{name:"id",width:60},{name:"name"},{name:"description",enableSorting:!1},{name:"updatedtime",sort:{direction:g.DESC},enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs blue-hoki" href="/motiondialer/lists/view/{{row.entity.id}}/settings"><i class="icon-settings"></i></a> <a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteItem(row.entity.name, row.entity.id)"><i class="icon-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},f.list({page:1,size:6e5}).$promise.then(function(b){b.status>0?a.gridOptions.data=b.response.RMI.rows:d.show("Please, check your connection!","danger")})["catch"](function(a){d.error(a)})["finally"](function(){h.stop("spinner-grid")})},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/motiondialer/list/list/list.create.modal.html",controller:"MotionDialerListListCreateCtrl"});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.deleteItem=e.confirm["delete"](function(b){return f["delete"]({id:b}).$promise.then(function(e){e.status>0?(_.remove(a.gridOptions.data,{id:b}),d.show(c.instant("MESSAGE_WELL_DONE"),"success")):d.show(e.message||"Please, check your connection!","danger")})["catch"](function(a){d.error(a)})})}]),angular.module("xCallyShuttleApp").controller("MotionDialerListListCreateCtrl",["$scope","$translate","$uibModalInstance","MotionDialerList","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.insert(a.item).$promise.then(function(a){a.status>0?(e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):e.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.lists.list",{url:"/list",templateUrl:"app/motiondialer/list/list/list.html",controller:"MotionDialerListListCtrl",authenticate:!0})}]),angular.module("xCallyShuttleApp").factory("MotionDialerContact",["$resource",function(a){return a("/api/rest/contact/:controller",null,{list:{method:"POST",params:{controller:"list"}},insert:{method:"POST",params:{controller:"insert"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},update:{method:"POST",params:{controller:"update"}}})}]),angular.module("xCallyShuttleApp").factory("MotionDialerList",["$resource",function(a){return a("/api/rest/list/:controller",null,{list:{method:"POST",params:{controller:"list"}},insert:{method:"POST",params:{controller:"insert"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},update:{method:"POST",params:{controller:"update"}}})}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewContactCreateCtrl",["$scope","$translate","$uibModalInstance","$stateParams","MotionDialerContact","xAlert","MotionDialerTimezone",function(a,b,c,d,e,f,g){a.form={},a.item={},a.timezones=g.list(),a.save=function(){return console.log(a.item),e.insert({id_list:parseInt(d.id),name:a.item.name,phones:a.item.phones.trim().split(","),description:a.item.description||""}).$promise.then(function(a){console.log(a),a.status>0?(f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):f.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){f.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("MotionDialerListContactImportModalCtrl",["$scope","$uibModalInstance","$stateParams","indexes","csv","xAlert","MotionDialerContact","MotionDialerTimezone",function(a,b,c,d,e,f,g,h){function i(b){if(b>=a.csvLength||a.stopped)return void(a.importing=!1);var d={id_list:parseInt(c.id),name:"",phones:[],description:""};return _.forOwn(a.item,function(a,c){"phones"===c?d[c].push(e[b][a]):d[c]=e[b][a]}),g.insert(d).$promise.then(function(b){b.status>0?(a["import"].success+=j,a["import"].succeeded++,k.push(b.response.RMI)):(console.log(b),a["import"].fail+=j,a["import"].failed++)})["catch"](function(b){console.log(b),a["import"].fail+=j,a["import"].failed++})["finally"](function(){i(b+1)})}a.form={},a.item={},a.timezones=h.list(),console.log(d),console.log(e),a.indexes=d,a.importing=!1,a.submitted=!1,a.stopped=!1,a["import"]={success:0,fail:0,succeeded:0,failed:0},a.csvLength=e.length;var j=100/a.csvLength,k=[];a.start=function(){a.importing=!0,a.submitted=!0,i(0)},a.close=function(){b.close(k)},a.stop=function(){a.stopped=!0}}]),angular.module("xCallyShuttleApp").controller("MotionDialerListViewCtrl",["$scope","$translate","$stateParams","$uibModal","xAlert","uiGridConstants","usSpinnerService","MotionDialerList","MotionDialerContact","Modal","FileUploader","Papa",function(a,b,c,d,e,f,g,h,i,j,k,l){a.getList=function(){return h.find({id:parseInt(c.id)}).$promise.then(function(b){b.status>0?a.list=b.response.RMI:e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.updateList=function(){return h.update({id:a.list.id,name:a.list.name,description:a.list.description}).$promise.then(function(a){a.status>0?e.show(b.instant("MESSAGE_WELL_DONE"),"success"):e.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.getContacts=function(){return a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,columnDefs:[{name:"name"},{name:"phones",cellTemplate:"<div>{{row.entity.phones.join(',')}}</div>",cellClass:"ui-grid-vcenter"},{name:"description",enableSorting:!1},{name:"updatedtime",sort:{direction:f.DESC},enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteContact(row.entity.name, row.entity.id)"><i class="icon-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},i.list({id_list:parseInt(c.id),page:1,size:6e5}).$promise.then(function(b){b.status>0?a.gridOptions.data=b.response.RMI.rows:e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})["finally"](function(){g.stop("spinner-grid")})},a.deleteContact=j.confirm["delete"](function(c){return i["delete"]({id:c}).$promise.then(function(d){d.status>0?(_.remove(a.gridOptions.data,{id:c}),e.show(b.instant("MESSAGE_WELL_DONE"),"success")):e.show(d.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})}),a.createContact=function(){var b=d.open({animation:!0,templateUrl:"app/motiondialer/list/view/view.contact.create.modal.html",controller:"MotionDialerViewContactCreateCtrl"});b.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})};var m=a.uploader=new k({queueLimit:1,clearInputAfterAddedToQueue:!0});m.onAfterAddingFile=function(b){l.parse(b._file,{header:!0,complete:function(b){a.uploader.clearQueue(),a["import"](b.data)},error:function(a){e.error(a)}})},a["import"]=function(b){var c=d.open({animation:!0,backdrop:"static",keyboard:!1,templateUrl:"app/motiondialer/list/view/view.contact.import.modal.html",controller:"MotionDialerListContactImportModalCtrl",resolve:{indexes:function(){return _.keys(b[0])},csv:function(){return b}}});c.result.then(function(b){console.log(b),a.gridOptions.data=a.gridOptions.data.concat(b)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.lists.view",{url:"/view/:id",templateUrl:"app/motiondialer/list/view/view.html",controller:"MotionDialerListViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.motiondialer.lists.view.settings",{url:"/settings",templateUrl:"app/motiondialer/list/view/view.settings.html"}).state("main.motiondialer.lists.view.contacts",{url:"/contacts",templateUrl:"app/motiondialer/list/view/view.contacts.html"})}]),angular.module("xCallyShuttleApp").factory("MotionDialerTimezone",function(){return{list:function(){return[{group:"US (Common)",zones:[{value:"America/Puerto_Rico",name:"Puerto Rico (Atlantic)"},{value:"America/New_York",name:"New York (Eastern)"},{value:"America/Chicago",name:"Chicago (Central)"},{value:"America/Denver",name:"Denver (Mountain)"},{value:"America/Phoenix",name:"Phoenix (MST)"},{value:"America/Los_Angeles",name:"Los Angeles (Pacific)"},{value:"America/Anchorage",name:"Anchorage (Alaska)"},{value:"Pacific/Honolulu",name:"Honolulu (Hawaii)"}]},{group:"America",zones:[{value:"America/Adak",name:"Adak"},{value:"America/Anchorage",name:"Anchorage"},{value:"America/Anguilla",name:"Anguilla"},{value:"America/Antigua",name:"Antigua"},{value:"America/Araguaina",name:"Araguaina"},{value:"America/Argentina/Buenos_Aires",name:"Argentina - Buenos Aires"},{value:"America/Argentina/Catamarca",name:"Argentina - Catamarca"},{value:"America/Argentina/ComodRivadavia",name:"Argentina - ComodRivadavia"},{value:"America/Argentina/Cordoba",name:"Argentina - Cordoba"},{value:"America/Argentina/Jujuy",name:"Argentina - Jujuy"},{value:"America/Argentina/La_Rioja",name:"Argentina - La Rioja"},{value:"America/Argentina/Mendoza",name:"Argentina - Mendoza"},{value:"America/Argentina/Rio_Gallegos",name:"Argentina - Rio Gallegos"},{value:"America/Argentina/Salta",name:"Argentina - Salta"},{value:"America/Argentina/San_Juan",name:"Argentina - San Juan"},{value:"America/Argentina/San_Luis",name:"Argentina - San Luis"},{value:"America/Argentina/Tucuman",name:"Argentina - Tucuman"},{value:"America/Argentina/Ushuaia",name:"Argentina - Ushuaia"},{value:"America/Aruba",name:"Aruba"},{value:"America/Asuncion",name:"Asuncion"},{value:"America/Atikokan",name:"Atikokan"},{value:"America/Atka",name:"Atka"},{value:"America/Bahia",name:"Bahia"},{value:"America/Barbados",name:"Barbados"},{value:"America/Belem",name:"Belem"},{value:"America/Belize",name:"Belize"},{value:"America/Blanc-Sablon",name:"Blanc-Sablon"},{value:"America/Boa_Vista",name:"Boa Vista"},{value:"America/Bogota",name:"Bogota"},{value:"America/Boise",name:"Boise"},{value:"America/Buenos_Aires",name:"Buenos Aires"},{value:"America/Cambridge_Bay",name:"Cambridge Bay"},{value:"America/Campo_Grande",name:"Campo Grande"},{value:"America/Cancun",name:"Cancun"},{value:"America/Caracas",name:"Caracas"},{value:"America/Catamarca",name:"Catamarca"},{value:"America/Cayenne",name:"Cayenne"},{value:"America/Cayman",name:"Cayman"},{value:"America/Chicago",name:"Chicago"},{value:"America/Chihuahua",name:"Chihuahua"},{value:"America/Coral_Harbour",name:"Coral Harbour"},{value:"America/Cordoba",name:"Cordoba"},{value:"America/Costa_Rica",name:"Costa Rica"},{value:"America/Cuiaba",name:"Cuiaba"},{value:"America/Curacao",name:"Curacao"},{value:"America/Danmarkshavn",name:"Danmarkshavn"},{value:"America/Dawson",name:"Dawson"},{value:"America/Dawson_Creek",name:"Dawson Creek"},{value:"America/Denver",name:"Denver"},{value:"America/Detroit",name:"Detroit"},{value:"America/Dominica",name:"Dominica"},{value:"America/Edmonton",name:"Edmonton"},{value:"America/Eirunepe",name:"Eirunepe"},{value:"America/El_Salvador",name:"El Salvador"},{value:"America/Ensenada",name:"Ensenada"},{value:"America/Fortaleza",name:"Fortaleza"},{value:"America/Fort_Wayne",name:"Fort Wayne"},{value:"America/Glace_Bay",name:"Glace Bay"},{value:"America/Godthab",name:"Godthab"},{value:"America/Goose_Bay",name:"Goose Bay"},{value:"America/Grand_Turk",name:"Grand Turk"},{value:"America/Grenada",name:"Grenada"},{value:"America/Guadeloupe",name:"Guadeloupe"},{value:"America/Guatemala",name:"Guatemala"},{value:"America/Guayaquil",name:"Guayaquil"},{value:"America/Guyana",name:"Guyana"},{value:"America/Halifax",name:"Halifax"},{value:"America/Havana",name:"Havana"},{value:"America/Hermosillo",name:"Hermosillo"},{value:"America/Indiana/Indianapolis",name:"Indiana - Indianapolis"},{value:"America/Indiana/Knox",name:"Indiana - Knox"},{value:"America/Indiana/Marengo",name:"Indiana - Marengo"},{value:"America/Indiana/Petersburg",name:"Indiana - Petersburg"},{value:"America/Indiana/Tell_City",name:"Indiana - Tell City"},{value:"America/Indiana/Vevay",name:"Indiana - Vevay"},{value:"America/Indiana/Vincennes",name:"Indiana - Vincennes"},{value:"America/Indiana/Winamac",name:"Indiana - Winamac"},{value:"America/Indianapolis",name:"Indianapolis"},{value:"America/Inuvik",name:"Inuvik"},{value:"America/Iqaluit",name:"Iqaluit"},{value:"America/Jamaica",name:"Jamaica"},{value:"America/Jujuy",name:"Jujuy"},{value:"America/Juneau",name:"Juneau"},{value:"America/Kentucky/Louisville",name:"Kentucky - Louisville"},{value:"America/Kentucky/Monticello",name:"Kentucky - Monticello"},{value:"America/Knox_IN",name:"Knox IN"},{value:"America/La_Paz",name:"La Paz"},{value:"America/Lima",name:"Lima"},{value:"America/Los_Angeles",name:"Los Angeles"},{value:"America/Louisville",name:"Louisville"},{value:"America/Maceio",name:"Maceio"},{value:"America/Managua",name:"Managua"},{value:"America/Manaus",name:"Manaus"},{value:"America/Marigot",name:"Marigot"},{value:"America/Martinique",name:"Martinique"},{value:"America/Matamoros",name:"Matamoros"},{value:"America/Mazatlan",name:"Mazatlan"},{value:"America/Mendoza",name:"Mendoza"},{value:"America/Menominee",name:"Menominee"},{value:"America/Merida",name:"Merida"},{value:"America/Mexico_City",name:"Mexico City"},{value:"America/Miquelon",name:"Miquelon"},{value:"America/Moncton",name:"Moncton"},{value:"America/Monterrey",name:"Monterrey"},{value:"America/Montevideo",name:"Montevideo"},{value:"America/Montreal",name:"Montreal"},{value:"America/Montserrat",name:"Montserrat"},{value:"America/Nassau",name:"Nassau"},{value:"America/New_York",name:"New York"},{value:"America/Nipigon",name:"Nipigon"},{value:"America/Nome",name:"Nome"},{value:"America/Noronha",name:"Noronha"},{value:"America/North_Dakota/Center",name:"North Dakota - Center"},{value:"America/North_Dakota/New_Salem",name:"North Dakota - New Salem"},{value:"America/Ojinaga",name:"Ojinaga"},{value:"America/Panama",name:"Panama"},{value:"America/Pangnirtung",name:"Pangnirtung"},{value:"America/Paramaribo",name:"Paramaribo"},{value:"America/Phoenix",name:"Phoenix"},{value:"America/Port-au-Prince",name:"Port-au-Prince"},{value:"America/Porto_Acre",name:"Porto Acre"},{value:"America/Port_of_Spain",name:"Port of Spain"},{value:"America/Porto_Velho",name:"Porto Velho"},{value:"America/Puerto_Rico",name:"Puerto Rico"},{value:"America/Rainy_River",name:"Rainy River"},{value:"America/Rankin_Inlet",name:"Rankin Inlet"},{value:"America/Recife",name:"Recife"},{value:"America/Regina",name:"Regina"},{value:"America/Resolute",name:"Resolute"},{value:"America/Rio_Branco",name:"Rio Branco"},{value:"America/Rosario",name:"Rosario"},{value:"America/Santa_Isabel",name:"Santa Isabel"},{value:"America/Santarem",name:"Santarem"},{value:"America/Santiago",name:"Santiago"},{value:"America/Santo_Domingo",name:"Santo Domingo"},{value:"America/Sao_Paulo",name:"Sao Paulo"},{value:"America/Scoresbysund",name:"Scoresbysund"},{value:"America/Shiprock",name:"Shiprock"},{value:"America/St_Barthelemy",name:"St Barthelemy"},{value:"America/St_Johns",name:"St Johns"},{value:"America/St_Kitts",name:"St Kitts"},{value:"America/St_Lucia",name:"St Lucia"},{value:"America/St_Thomas",name:"St Thomas"},{value:"America/St_Vincent",name:"St Vincent"},{value:"America/Swift_Current",name:"Swift Current"},{value:"America/Tegucigalpa",name:"Tegucigalpa"},{value:"America/Thule",name:"Thule"},{value:"America/Thunder_Bay",name:"Thunder Bay"},{value:"America/Tijuana",name:"Tijuana"},{value:"America/Toronto",name:"Toronto"},{value:"America/Tortola",name:"Tortola"},{value:"America/Vancouver",name:"Vancouver"},{value:"America/Virgin",name:"Virgin"},{value:"America/Whitehorse",name:"Whitehorse"},{value:"America/Winnipeg",name:"Winnipeg"},{value:"America/Yakutat",name:"Yakutat"},{value:"America/Yellowknife",name:"Yellowknife"}]},{group:"Europe",zones:[{value:"Europe/Amsterdam",name:"Amsterdam"},{value:"Europe/Andorra",name:"Andorra"},{value:"Europe/Athens",name:"Athens"},{value:"Europe/Belfast",name:"Belfast"},{value:"Europe/Belgrade",name:"Belgrade"},{value:"Europe/Berlin",name:"Berlin"},{value:"Europe/Bratislava",name:"Bratislava"},{value:"Europe/Brussels",name:"Brussels"},{value:"Europe/Bucharest",name:"Bucharest"},{value:"Europe/Budapest",name:"Budapest"},{value:"Europe/Chisinau",name:"Chisinau"},{value:"Europe/Copenhagen",name:"Copenhagen"},{value:"Europe/Dublin",name:"Dublin"},{value:"Europe/Gibraltar",name:"Gibraltar"},{value:"Europe/Guernsey",name:"Guernsey"},{value:"Europe/Helsinki",name:"Helsinki"},{value:"Europe/Isle_of_Man",name:"Isle of Man"},{value:"Europe/Istanbul",name:"Istanbul"},{value:"Europe/Jersey",name:"Jersey"},{value:"Europe/Kaliningrad",name:"Kaliningrad"},{value:"Europe/Kiev",name:"Kiev"},{value:"Europe/Lisbon",name:"Lisbon"},{value:"Europe/Ljubljana",name:"Ljubljana"},{value:"Europe/London",name:"London"},{value:"Europe/Luxembourg",name:"Luxembourg"},{value:"Europe/Madrid",name:"Madrid"},{value:"Europe/Malta",name:"Malta"},{value:"Europe/Mariehamn",name:"Mariehamn"},{value:"Europe/Minsk",name:"Minsk"},{value:"Europe/Monaco",name:"Monaco"},{value:"Europe/Moscow",name:"Moscow"},{value:"Europe/Nicosia",name:"Nicosia"},{value:"Europe/Oslo",name:"Oslo"},{value:"Europe/Paris",name:"Paris"},{value:"Europe/Podgorica",name:"Podgorica"},{value:"Europe/Prague",name:"Prague"},{value:"Europe/Riga",name:"Riga"},{value:"Europe/Rome",name:"Rome"},{value:"Europe/Samara",name:"Samara"},{value:"Europe/San_Marino",name:"San Marino"},{value:"Europe/Sarajevo",name:"Sarajevo"},{value:"Europe/Simferopol",name:"Simferopol"},{value:"Europe/Skopje",name:"Skopje"},{value:"Europe/Sofia",name:"Sofia"},{value:"Europe/Stockholm",name:"Stockholm"},{value:"Europe/Tallinn",name:"Tallinn"},{value:"Europe/Tirane",name:"Tirane"},{value:"Europe/Tiraspol",name:"Tiraspol"},{value:"Europe/Uzhgorod",name:"Uzhgorod"},{value:"Europe/Vaduz",name:"Vaduz"},{value:"Europe/Vatican",name:"Vatican"},{value:"Europe/Vienna",name:"Vienna"},{value:"Europe/Vilnius",name:"Vilnius"},{value:"Europe/Volgograd",name:"Volgograd"},{value:"Europe/Warsaw",name:"Warsaw"},{value:"Europe/Zagreb",name:"Zagreb"},{value:"Europe/Zaporozhye",name:"Zaporozhye"},{value:"Europe/Zurich",name:"Zurich"}]},{group:"Asia",zones:[{value:"Asia/Aden",name:"Aden"},{value:"Asia/Almaty",name:"Almaty"},{value:"Asia/Amman",name:"Amman"},{value:"Asia/Anadyr",name:"Anadyr"},{value:"Asia/Aqtau",name:"Aqtau"},{value:"Asia/Aqtobe",name:"Aqtobe"},{value:"Asia/Ashgabat",name:"Ashgabat"},{value:"Asia/Ashkhabad",name:"Ashkhabad"},{value:"Asia/Baghdad",name:"Baghdad"},{value:"Asia/Bahrain",name:"Bahrain"},{value:"Asia/Baku",name:"Baku"},{value:"Asia/Bangkok",name:"Bangkok"},{value:"Asia/Beirut",name:"Beirut"},{value:"Asia/Bishkek",name:"Bishkek"},{value:"Asia/Brunei",name:"Brunei"},{value:"Asia/Calcutta",name:"Calcutta"},{value:"Asia/Choibalsan",name:"Choibalsan"},{value:"Asia/Chongqing",name:"Chongqing"},{value:"Asia/Chungking",name:"Chungking"},{value:"Asia/Colombo",name:"Colombo"},{value:"Asia/Dacca",name:"Dacca"},{value:"Asia/Damascus",name:"Damascus"},{value:"Asia/Dhaka",name:"Dhaka"},{value:"Asia/Dili",name:"Dili"},{value:"Asia/Dubai",name:"Dubai"},{value:"Asia/Dushanbe",name:"Dushanbe"},{value:"Asia/Gaza",name:"Gaza"},{value:"Asia/Harbin",name:"Harbin"},{value:"Asia/Ho_Chi_Minh",name:"Ho Chi Minh"},{value:"Asia/Hong_Kong",name:"Hong Kong"},{value:"Asia/Hovd",name:"Hovd"},{value:"Asia/Irkutsk",name:"Irkutsk"},{value:"Asia/Istanbul",name:"Istanbul"},{value:"Asia/Jakarta",name:"Jakarta"},{value:"Asia/Jayapura",name:"Jayapura"},{value:"Asia/Jerusalem",name:"Jerusalem"},{value:"Asia/Kabul",name:"Kabul"},{value:"Asia/Kamchatka",name:"Kamchatka"},{value:"Asia/Karachi",name:"Karachi"},{value:"Asia/Kashgar",name:"Kashgar"},{value:"Asia/Kathmandu",name:"Kathmandu"},{value:"Asia/Katmandu",name:"Katmandu"},{value:"Asia/Kolkata",name:"Kolkata"},{value:"Asia/Krasnoyarsk",name:"Krasnoyarsk"},{value:"Asia/Kuala_Lumpur",name:"Kuala Lumpur"},{value:"Asia/Kuching",name:"Kuching"},{value:"Asia/Kuwait",name:"Kuwait"},{value:"Asia/Macao",name:"Macao"},{value:"Asia/Macau",name:"Macau"},{value:"Asia/Magadan",name:"Magadan"},{value:"Asia/Makassar",name:"Makassar"},{value:"Asia/Manila",name:"Manila"},{value:"Asia/Muscat",name:"Muscat"},{value:"Asia/Nicosia",name:"Nicosia"},{value:"Asia/Novokuznetsk",name:"Novokuznetsk"},{value:"Asia/Novosibirsk",name:"Novosibirsk"},{value:"Asia/Omsk",name:"Omsk"},{value:"Asia/Oral",name:"Oral"},{value:"Asia/Phnom_Penh",name:"Phnom Penh"},{value:"Asia/Pontianak",name:"Pontianak"},{value:"Asia/Pyongyang",name:"Pyongyang"},{value:"Asia/Qatar",name:"Qatar"},{value:"Asia/Qyzylorda",name:"Qyzylorda"},{value:"Asia/Rangoon",name:"Rangoon"},{value:"Asia/Riyadh",name:"Riyadh"},{value:"Asia/Saigon",name:"Saigon"},{value:"Asia/Sakhalin",name:"Sakhalin"},{value:"Asia/Samarkand",name:"Samarkand"},{value:"Asia/Seoul",name:"Seoul"},{value:"Asia/Shanghai",name:"Shanghai"},{value:"Asia/Singapore",name:"Singapore"},{value:"Asia/Taipei",name:"Taipei"},{value:"Asia/Tashkent",name:"Tashkent"},{value:"Asia/Tbilisi",name:"Tbilisi"},{value:"Asia/Tehran",name:"Tehran"},{value:"Asia/Tel_Aviv",name:"Tel Aviv"},{value:"Asia/Thimbu",name:"Thimbu"},{value:"Asia/Thimphu",name:"Thimphu"},{value:"Asia/Tokyo",name:"Tokyo"},{value:"Asia/Ujung_Pandang",name:"Ujung Pandang"},{value:"Asia/Ulaanbaatar",name:"Ulaanbaatar"},{value:"Asia/Ulan_Bator",name:"Ulan Bator"},{value:"Asia/Urumqi",name:"Urumqi"},{value:"Asia/Vientiane",name:"Vientiane"},{value:"Asia/Vladivostok",name:"Vladivostok"},{value:"Asia/Yakutsk",name:"Yakutsk"},{value:"Asia/Yekaterinburg",name:"Yekaterinburg"},{value:"Asia/Yerevan",name:"Yerevan"}]},{group:"Africa",zones:[{value:"Africa/Abidjan",name:"Abidjan"},{value:"Africa/Accra",name:"Accra"},{value:"Africa/Addis_Ababa",name:"Addis Ababa"},{value:"Africa/Algiers",name:"Algiers"},{value:"Africa/Asmara",name:"Asmara"},{value:"Africa/Asmera",name:"Asmera"},{value:"Africa/Bamako",name:"Bamako"},{value:"Africa/Bangui",name:"Bangui"},{value:"Africa/Banjul",name:"Banjul"},{value:"Africa/Bissau",name:"Bissau"},{value:"Africa/Blantyre",name:"Blantyre"},{value:"Africa/Brazzaville",name:"Brazzaville"
+},{value:"Africa/Bujumbura",name:"Bujumbura"},{value:"Africa/Cairo",name:"Cairo"},{value:"Africa/Casablanca",name:"Casablanca"},{value:"Africa/Ceuta",name:"Ceuta"},{value:"Africa/Conakry",name:"Conakry"},{value:"Africa/Dakar",name:"Dakar"},{value:"Africa/Dar_es_Salaam",name:"Dar es Salaam"},{value:"Africa/Djibouti",name:"Djibouti"},{value:"Africa/Douala",name:"Douala"},{value:"Africa/El_Aaiun",name:"El Aaiun"},{value:"Africa/Freetown",name:"Freetown"},{value:"Africa/Gaborone",name:"Gaborone"},{value:"Africa/Harare",name:"Harare"},{value:"Africa/Johannesburg",name:"Johannesburg"},{value:"Africa/Kampala",name:"Kampala"},{value:"Africa/Khartoum",name:"Khartoum"},{value:"Africa/Kigali",name:"Kigali"},{value:"Africa/Kinshasa",name:"Kinshasa"},{value:"Africa/Lagos",name:"Lagos"},{value:"Africa/Libreville",name:"Libreville"},{value:"Africa/Lome",name:"Lome"},{value:"Africa/Luanda",name:"Luanda"},{value:"Africa/Lubumbashi",name:"Lubumbashi"},{value:"Africa/Lusaka",name:"Lusaka"},{value:"Africa/Malabo",name:"Malabo"},{value:"Africa/Maputo",name:"Maputo"},{value:"Africa/Maseru",name:"Maseru"},{value:"Africa/Mbabane",name:"Mbabane"},{value:"Africa/Mogadishu",name:"Mogadishu"},{value:"Africa/Monrovia",name:"Monrovia"},{value:"Africa/Nairobi",name:"Nairobi"},{value:"Africa/Ndjamena",name:"Ndjamena"},{value:"Africa/Niamey",name:"Niamey"},{value:"Africa/Nouakchott",name:"Nouakchott"},{value:"Africa/Ouagadougou",name:"Ouagadougou"},{value:"Africa/Porto-Novo",name:"Porto-Novo"},{value:"Africa/Sao_Tome",name:"Sao Tome"},{value:"Africa/Timbuktu",name:"Timbuktu"},{value:"Africa/Tripoli",name:"Tripoli"},{value:"Africa/Tunis",name:"Tunis"},{value:"Africa/Windhoek",name:"Windhoek"}]},{group:"Australia",zones:[{value:"Australia/ACT",name:"ACT"},{value:"Australia/Adelaide",name:"Adelaide"},{value:"Australia/Brisbane",name:"Brisbane"},{value:"Australia/Broken_Hill",name:"Broken Hill"},{value:"Australia/Canberra",name:"Canberra"},{value:"Australia/Currie",name:"Currie"},{value:"Australia/Darwin",name:"Darwin"},{value:"Australia/Eucla",name:"Eucla"},{value:"Australia/Hobart",name:"Hobart"},{value:"Australia/LHI",name:"LHI"},{value:"Australia/Lindeman",name:"Lindeman"},{value:"Australia/Lord_Howe",name:"Lord Howe"},{value:"Australia/Melbourne",name:"Melbourne"},{value:"Australia/North",name:"North"},{value:"Australia/NSW",name:"NSW"},{value:"Australia/Perth",name:"Perth"},{value:"Australia/Queensland",name:"Queensland"},{value:"Australia/South",name:"South"},{value:"Australia/Sydney",name:"Sydney"},{value:"Australia/Tasmania",name:"Tasmania"},{value:"Australia/Victoria",name:"Victoria"},{value:"Australia/West",name:"West"},{value:"Australia/Yancowinna",name:"Yancowinna"}]},{group:"Indian",zones:[{value:"Indian/Antananarivo",name:"Antananarivo"},{value:"Indian/Chagos",name:"Chagos"},{value:"Indian/Christmas",name:"Christmas"},{value:"Indian/Cocos",name:"Cocos"},{value:"Indian/Comoro",name:"Comoro"},{value:"Indian/Kerguelen",name:"Kerguelen"},{value:"Indian/Mahe",name:"Mahe"},{value:"Indian/Maldives",name:"Maldives"},{value:"Indian/Mauritius",name:"Mauritius"},{value:"Indian/Mayotte",name:"Mayotte"},{value:"Indian/Reunion",name:"Reunion"}]},{group:"Atlantic",zones:[{value:"Atlantic/Azores",name:"Azores"},{value:"Atlantic/Bermuda",name:"Bermuda"},{value:"Atlantic/Canary",name:"Canary"},{value:"Atlantic/Cape_Verde",name:"Cape Verde"},{value:"Atlantic/Faeroe",name:"Faeroe"},{value:"Atlantic/Faroe",name:"Faroe"},{value:"Atlantic/Jan_Mayen",name:"Jan Mayen"},{value:"Atlantic/Madeira",name:"Madeira"},{value:"Atlantic/Reykjavik",name:"Reykjavik"},{value:"Atlantic/South_Georgia",name:"South Georgia"},{value:"Atlantic/Stanley",name:"Stanley"},{value:"Atlantic/St_Helena",name:"St Helena"}]},{group:"Pacific",zones:[{value:"Pacific/Apia",name:"Apia"},{value:"Pacific/Auckland",name:"Auckland"},{value:"Pacific/Chatham",name:"Chatham"},{value:"Pacific/Easter",name:"Easter"},{value:"Pacific/Efate",name:"Efate"},{value:"Pacific/Enderbury",name:"Enderbury"},{value:"Pacific/Fakaofo",name:"Fakaofo"},{value:"Pacific/Fiji",name:"Fiji"},{value:"Pacific/Funafuti",name:"Funafuti"},{value:"Pacific/Galapagos",name:"Galapagos"},{value:"Pacific/Gambier",name:"Gambier"},{value:"Pacific/Guadalcanal",name:"Guadalcanal"},{value:"Pacific/Guam",name:"Guam"},{value:"Pacific/Honolulu",name:"Honolulu"},{value:"Pacific/Johnston",name:"Johnston"},{value:"Pacific/Kiritimati",name:"Kiritimati"},{value:"Pacific/Kosrae",name:"Kosrae"},{value:"Pacific/Kwajalein",name:"Kwajalein"},{value:"Pacific/Majuro",name:"Majuro"},{value:"Pacific/Marquesas",name:"Marquesas"},{value:"Pacific/Midway",name:"Midway"},{value:"Pacific/Nauru",name:"Nauru"},{value:"Pacific/Niue",name:"Niue"},{value:"Pacific/Norfolk",name:"Norfolk"},{value:"Pacific/Noumea",name:"Noumea"},{value:"Pacific/Pago_Pago",name:"Pago Pago"},{value:"Pacific/Palau",name:"Palau"},{value:"Pacific/Pitcairn",name:"Pitcairn"},{value:"Pacific/Ponape",name:"Ponape"},{value:"Pacific/Port_Moresby",name:"Port Moresby"},{value:"Pacific/Rarotonga",name:"Rarotonga"},{value:"Pacific/Saipan",name:"Saipan"},{value:"Pacific/Samoa",name:"Samoa"},{value:"Pacific/Tahiti",name:"Tahiti"},{value:"Pacific/Tarawa",name:"Tarawa"},{value:"Pacific/Tongatapu",name:"Tongatapu"},{value:"Pacific/Truk",name:"Truk"},{value:"Pacific/Wake",name:"Wake"},{value:"Pacific/Wallis",name:"Wallis"},{value:"Pacific/Yap",name:"Yap"}]},{group:"Antarctica",zones:[{value:"Antarctica/Casey",name:"Casey"},{value:"Antarctica/Davis",name:"Davis"},{value:"Antarctica/DumontDUrville",name:"DumontDUrville"},{value:"Antarctica/Macquarie",name:"Macquarie"},{value:"Antarctica/Mawson",name:"Mawson"},{value:"Antarctica/McMurdo",name:"McMurdo"},{value:"Antarctica/Palmer",name:"Palmer"},{value:"Antarctica/Rothera",name:"Rothera"},{value:"Antarctica/South_Pole",name:"South Pole"},{value:"Antarctica/Syowa",name:"Syowa"},{value:"Antarctica/Vostok",name:"Vostok"}]},{group:"Arctic",zones:[{value:"Arctic/Longyearbyen",name:"Longyearbyen"}]},{group:"UTC",zones:[{value:"UTC",name:"UTC"}]},{group:"Manual Offsets",zones:[{value:"UTC-12",name:"UTC-12"},{value:"UTC-11",name:"UTC-11"},{value:"UTC-10",name:"UTC-10"},{value:"UTC-9",name:"UTC-9"},{value:"UTC-8",name:"UTC-8"},{value:"UTC-7",name:"UTC-7"},{value:"UTC-6",name:"UTC-6"},{value:"UTC-5",name:"UTC-5"},{value:"UTC-4",name:"UTC-4"},{value:"UTC-3",name:"UTC-3"},{value:"UTC-2",name:"UTC-2"},{value:"UTC-1",name:"UTC-1"},{value:"UTC+0",name:"UTC+0"},{value:"UTC+1",name:"UTC+1"},{value:"UTC+2",name:"UTC+2"},{value:"UTC+3",name:"UTC+3"},{value:"UTC+4",name:"UTC+4"},{value:"UTC+5",name:"UTC+5"},{value:"UTC+6",name:"UTC+6"},{value:"UTC+7",name:"UTC+7"},{value:"UTC+8",name:"UTC+8"},{value:"UTC+9",name:"UTC+9"},{value:"UTC+10",name:"UTC+10"},{value:"UTC+11",name:"UTC+11"},{value:"UTC+12",name:"UTC+12"},{value:"UTC+13",name:"UTC+13"},{value:"UTC+14",name:"UTC+14"}]}]}}}),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer",{url:"/motiondialer",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:16}}})}]),angular.module("xCallyShuttleApp").controller("MotionDialerProcessListCtrl",["$scope","$uibModal","$translate","xAlert","Modal","MotionDialerProcess","uiGridConstants","usSpinnerService",function(a,b,c,d,e,f,g,h){a.initView=function(){return a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,columnDefs:[{name:"id",width:60},{name:"name"},{name:"queue",enableSorting:!1},{name:"extension",enableSorting:!1},{name:"id_list",enableSorting:!1,cellTemplate:'<div><a class="btn btn-xs grey-cascade" href="/motiondialer/lists/view/{{row.entity.id_list}}/settings">{{row.entity.id_list}}</a></div>',cellClass:"ui-grid-vcenter"},{name:"status",cellTemplate:"<div><a class=\"btn btn-xs\" data-ng-class=\"row.entity.status == 'STOP' ? 'red-sunglo' : 'green-meadow'\" data-ng-href=\"#\">{{ (row.entity.status === 'RUN') ? 'RUNNING' : 'STOPPED'}}</a></div>",cellClass:"ui-grid-vcenter",filter:{type:g.filter.SELECT,selectOptions:[{value:"RUN",label:"RUNNING"},{value:"STOP",label:"STOPPED"}]}},{name:"updatedtime",sort:{direction:g.DESC},enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs blue-hoki" href="/motiondialer/processes/view/{{row.entity.id}}/overview"><i class="icon-settings"></a> <a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteItem(row.entity.name, row.entity.id)"><i class="icon-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},f.list({page:1,size:6e5}).$promise.then(function(b){console.log(b),b.status>0?a.gridOptions.data=b.response.RMI.rows:d.show("Please, check your connection!","danger")})["catch"](function(a){d.error(a)})["finally"](function(){h.stop("spinner-grid")})},a.createProcessQueue=function(){var c=b.open({animation:!0,templateUrl:"app/motiondialer/process/list/list.create.queue.modal.html",controller:"MotionDialerProcessListCreateQueueCtrl"});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.createProcessSquare=function(){var c=b.open({animation:!0,templateUrl:"app/motiondialer/process/list/list.create.square.modal.html",controller:"MotionDialerProcessListCreateSquareCtrl"});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.deleteItem=e.confirm["delete"](function(b){return f["delete"]({id:b}).$promise.then(function(e){e.status>0?(_.remove(a.gridOptions.data,{id:b}),d.show(c.instant("MESSAGE_WELL_DONE"),"success")):d.show(e.message||"Please, check your connection!","danger")})["catch"](function(a){d.error(a)})})}]),angular.module("xCallyShuttleApp").controller("MotionDialerProcessListCreateQueueCtrl",["$scope","$translate","$uibModalInstance","MotionDialerProcess","MotionDialerList","Trunk","VoiceQueue","Route","xAlert",function(a,b,c,d,e,f,g,h,i){a.form={},a.item={fetch_sort:"ASC",timeout:3},a.initModal=function(){return g.get().$promise.then(function(b){return a.queues={},b&&(a.queues=b.rows),f.get().$promise}).then(function(b){return a.trunks={},b&&(a.trunks=b.rows),a.trunks.push({name:"fake"}),e.list({page:1,size:6e5}).$promise}).then(function(b){a.lists={},b.status>0?a.lists=b.response.RMI.rows:i.show("Please, check your connection!","danger")})["catch"](function(a){i.error(a)})},a.save=function(){console.log(a.item);var e="process_"+a.item.name+"_queue_"+a.item.queue.name+"_"+Math.round(1e5*Math.random()),f="Generated by Motion Dialer, Process Queue"+(a.item.description?", "+a.item.description:"");return h.save({appdata:"Internal Call",context:"from-sip",exten:e.replace(/\s/g,"_"),type:"internal",description:f,Applications:[{appdata:["CDR(type)=tigerdial"],app:"Set",interval:"*,*,*,*",type:"internal"},{appdata:["QUEUE_PRIO=99"],app:"Set",interval:"*,*,*,*",type:"internal"},{appdata:[a.item.queue.name,"","","",a.item.timeout],app:"Queue",interval:"*,*,*,*",type:"internal"}]}).$promise.then(function(b){return console.log(b),d.insert({name:a.item.name,id_list:a.item.list.id,queue:a.item.queue.name,device:a.item.device.name,context:"from-sip",extension:e.replace(/\s/g,"_"),description:a.item.description,auto_closed:!0,fetch_sort:a.item.fetch_sort}).$promise}).then(function(a){a.status>0?(i.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):i.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){i.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("MotionDialerProcessListCreateSquareCtrl",["$scope","$translate","$uibModalInstance","MotionDialerProcess","MotionDialerList","SquareProject","Trunk","Route","xAlert",function(a,b,c,d,e,f,g,h,i){a.form={},a.item={fetch_sort:"ASC"},a.initModal=function(){return f.get().$promise.then(function(b){return a.projects={},b&&(a.projects=b.rows),g.get().$promise}).then(function(b){return a.trunks={},b&&(a.trunks=b.rows),a.trunks.push({name:"fake"}),e.list({page:1,size:6e5}).$promise}).then(function(b){a.lists={},b.status>0?a.lists=b.response.RMI.rows:i.show("Please, check your connection!","danger")})["catch"](function(a){i.error(a)})},a.save=function(){console.log(a.item);var e="process_"+a.item.name+"_square_"+a.item.project.name+"_"+Math.round(1e5*Math.random()),f="Generated by Motion Dialer, Process Square"+(a.item.description?", "+a.item.description:"");return h.save({appdata:"Internal Call",context:"from-sip",exten:e.replace(/\s/g,"_"),type:"internal",description:f,Applications:[{appdata:["CDR(type)=tigerdial"],app:"Set",interval:"*,*,*,*",type:"internal"},{appdata:["agi://127.0.0.1/square",a.item.project.name],app:"AGI",interval:"*,*,*,*",type:"internal"}]}).$promise.then(function(b){return console.log(b),d.insert({name:a.item.name,id_list:a.item.list.id,queue:"none",device:a.item.device.name,context:"from-sip",extension:e.replace(/\s/g,"_"),description:a.item.description,auto_closed:!0,channel_limit:15,fetch_sort:a.item.fetch_sort}).$promise}).then(function(a){a.status>0?(i.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)):i.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){i.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.processes.list",{url:"/list",templateUrl:"app/motiondialer/process/list/list.html",controller:"MotionDialerProcessListCtrl",authenticate:!0})}]),angular.module("xCallyShuttleApp").factory("MotionDialerProcess",["$resource",function(a){return a("/api/rest/process/:controller",null,{list:{method:"POST",params:{controller:"list"}},insert:{method:"POST",params:{controller:"insert"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},update:{method:"POST",params:{controller:"update"}}})}]),angular.module("xCallyShuttleApp").factory("MotionDialerSpooler",["$resource",function(a){return a("/api/rest/spooler/:controller/:retrieve/:peer",null,{list:{method:"POST",params:{controller:"list"}},"delete":{method:"POST",params:{controller:"delete"}},find:{method:"POST",params:{controller:"find"}},summary:{method:"POST",params:{controller:"summary"}},close:{method:"POST",params:{controller:"retrieve",retrieve:"close"}},open:{method:"POST",params:{controller:"retrieve",retrieve:"open"}},blacklist:{method:"POST",params:{controller:"retrieve",retrieve:"blacklist"}},planning:{method:"POST",params:{controller:"retrieve",retrieve:"planning"}},planningpeer:{method:"POST",params:{controller:"retrieve",retrieve:"planning",peer:"peer"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.processes",{url:"/processes",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("MotionDialerProcessViewCtrl",["$scope","$translate","$stateParams","$uibModal","xAlert","uiGridConstants","usSpinnerService","MotionDialerProcess","MotionDialerSpooler","Modal","VoiceQueue",function(a,b,c,d,e,f,g,h,i,j,k){a.process={},a.techs=["SIP","IAX","LOCAL","KHOMP"],a.dialFormats=["tech/device/number","tech/number@device"],a.checkDuplicates=["ALWAYS","IFOPEN","NO"],a.codecs=["g729","ilbc","gsm","ulaw","alaw"],a.getProcess=function(){return h.find({id:parseInt(c.id)}).$promise.then(function(b){console.log(b),b.status>0?(b.response.RMI.codecs=b.response.RMI.codecs.split(","),a.process=b.response.RMI):e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})},a.getSummary=function(){return i.summary({id_process:parseInt(c.id)}).$promise.then(function(b){if(b.status>0){a.summary=b.response.RMI.totals,a.total=0;for(var c=0;c<a.summary.length;c++)a.total+=a.summary[c][1]}else e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})["finally"](function(){g.stop("spinner-grid")})},a.updateProcess=function(){var c=_.clone(a.process);return delete c.updatedtime,delete c.id_list,delete c.createdtime,delete c.runtime,delete c.fetch_sort,c.codecs=c.codecs.join(","),""===c.timezone&&delete c.timezone,h.update(c).$promise.then(function(c){c.status>0?(c.response.RMI.codecs=c.response.RMI.codecs.split(","),a.process=c.response.RMI,e.show(b.instant("MESSAGE_WELL_DONE"),"success")):c.response.RMI.errors.forEach(function(a){a?e.show(a.field+": "+a.error,"danger"):e.show("Please, check your connection!","danger")})})["catch"](function(a){e.error(a)})},a.getSpooler=function(){return a.gridOptions={paginationPageSizes:[10,25,50,75],paginationPageSize:10,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,flatEntityAccess:!0,showGridFooter:!0,fastWatch:!0,headerCellFilter:"translate",columnDefs:[{name:"name"},{name:"phones",cellTemplate:"<div>{{row.entity.phones.join(',')}}</div>",cellClass:"ui-grid-vcenter"},{name:"retrieve",filter:{type:f.filter.SELECT,selectOptions:[{value:"PLANNED_PEER",label:"PLANNED PEER"},{value:"PLANNED",label:"PLANNED"},{value:"BLACK_LIST",label:"BLACKLIST"},{value:"OPEN",label:"OPEN"},{value:"CLOSED",label:"CLOSED"},{value:"MAX_ATTEMPTS",label:"MAX ATTEMPTS"},{value:"COUNTER_BLOCK",label:"COUNTER BLOCK"},{value:"PLANNED_REQUEST",label:"PLANNED REQUEST"},{value:"DELETE",label:"DELETE"}]}},{name:"counter",enableFiltering:!1},{name:"planningtime",cellTemplate:"<div>{{row.entity.planningtime | date:'yyyy-MM-dd HH:mm'}}</div>",cellClass:"ui-grid-vcenter",enableFiltering:!1},{name:"action",cellTemplate:'<div><a class="btn btn-xs green" data-ng-click="grid.appScope.historySpooler(row.entity.history)"><i class="icon-info"></i></a> <a class="btn btn-xs blue-hoki" data-ng-click="grid.appScope.editSpooler(row.entity)"><i class="icon-settings"></i></a> <a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteSpooler(row.entity.phones.join(), row.entity.id)"><i class="fa fa-trash"></i></a></div>',enableSorting:!1,cellClass:"ui-grid-vcenter",enableFiltering:!1}]},i.list({id_process:parseInt(c.id),page:1,size:6e5}).$promise.then(function(b){b.status>0?a.gridOptions.data=b.response.RMI.rows:e.show(b.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})["finally"](function(){g.stop("spinner-grid")})},a.deleteSpooler=j.confirm["delete"](function(c){return i["delete"]({id:c}).$promise.then(function(d){d.status>0?(_.remove(a.gridOptions.data,{id:c}),e.show(b.instant("MESSAGE_WELL_DONE"),"success")):e.show(d.message||"Please, check your connection!","danger")})["catch"](function(a){e.error(a)})}),a.historySpooler=function(b){var c=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.spooler.history.modal.html",controller:"MotionDialerViewSpoolerHistoryCtrl",resolve:{historySpooler:function(){return b}}});c.result.then(function(b){a.gridOptions.data.push(b.response.RMI)})},a.editSpooler=function(a){var b=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.spooler.edit.modal.html",controller:"MotionDialerViewSpoolerEditCtrl",resolve:{entitySpooler:function(){return a}}});b.result.then(function(){})},a.initSettings=function(){return a.queues=null,k.get().$promise.then(function(b){b&&(a.queues=b.rows,a.process.queue&&"none"!==a.process.queue&&(a.queue=_.find(b.rows,{name:a.process.queue})))})["catch"](function(a){e.error(a)})},a.createInterval=function(b){var c=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.create.interval.modal.html",controller:"MotionDialerViewCreateIntervalCtrl",resolve:{objectProcess:function(){return a.process},intervalType:function(){return b},intervalValue:function(){return b?"8:00-20:00|MON-FRI|*|*":"00:01-07:59|SAT-SUN|*|*"}}});c.result.then(function(b){a.process=b})},a.editInterval=function(b,c){var e=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.create.interval.modal.html",controller:"MotionDialerViewCreateIntervalCtrl",resolve:{objectProcess:function(){return a.process},intervalType:function(){return b},intervalValue:function(){return c}}});e.result.then(function(b){a.process=b})},a.deleteInterval=j.confirm["delete"](function(c,d){var f={id:a.process.id};return d?(f.intervals=[],f.intervals=f.intervals.concat(a.process.intervals),f.intervals.splice(c,1)):(f.not_intervals=[],f.not_intervals=f.not_intervals.concat(a.process.not_intervals),f.not_intervals.splice(c,1)),h.update(f).$promise.then(function(c){c.status>0?(c.response.RMI.codecs=c.response.RMI.codecs.split(","),a.process=c.response.RMI,e.show(b.instant("MESSAGE_WELL_DONE"),"success")):c.response.RMI.errors.forEach(function(a){a?e.show(a.field+": "+a.error,"danger"):e.show("Please, check your connection!","danger")})})["catch"](function(a){e.error(a)})}),a.runOrStop=function(){var b=d.open({animation:!0,templateUrl:"app/motiondialer/process/view/view.run.process.modal.html",controller:"MotionDialerViewRunProcessCtrl",resolve:{statusProcess:function(){return a.process.status}}});b.result.then(function(b){a.process.status=b.status})}}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewCreateIntervalCtrl",["$scope","$translate","$uibModalInstance","$stateParams","MotionDialerProcess","xAlert","objectProcess","intervalType","intervalValue","interval",function(a,b,c,d,e,f,g,h,i,j){function k(a){var b,c=a.split("|"),d={};return c.forEach(function(a,c){switch(c){case 0:"*"!==a?(b=a.split("-"),d.t_from=moment(b[0],"HH:mm"),d.t_to=moment(b[1],"HH:mm"),d.alwaysTime=!1):(d.t_from=moment(new Date),d.t_to=moment(new Date),d.alwaysTime=!0);break;case 1:"*"!==a?(b=a.split("-"),d.wd_from=b[0].toLowerCase(),d.wd_to=b[1]?b[1].toLowerCase():"always"):(d.wd_from="always",d.wd_to="always");break;case 2:"*"!==a?(b=a.split("-"),d.md_from=b[0],d.md_to=b[1]?b[1]:"always"):(d.md_from="always",d.md_to="always");break;case 3:"*"!==a?(b=a.split("-"),d.m_from=b[0],d.m_to=b[1]?b[1]:"always"):(d.m_from="always",d.m_to="always")}}),d}function l(a){var b,c,d,e;return b=a.t_from&&a.t_to&&!a.alwaysTime?moment(a.t_from).format("HH:mm")+"-"+moment(a.t_to).format("HH:mm"):"*",a.wd_from&&"always"!==a.wd_from?(c=a.wd_from.toUpperCase(),a.wd_to&&"always"!==a.wd_to&&(c+="-"+a.wd_to.toUpperCase())):c="*",a.md_from&&"always"!==a.md_from?(d=a.md_from,a.md_to&&"always"!==a.md_to&&(d+="-"+a.md_to)):d="*",a.m_from&&"always"!==a.m_from?(e=a.m_from,a.m_to&&"always"!==a.m_to&&(e+="-"+a.m_to)):e="*",b+"|"+c+"|"+d+"|"+e}a.form={},a.$interval=j.interval,a.splittedInterval=k(i),a.save=function(){var d=l(a.splittedInterval);console.log(d);var i={id:g.id};return h?(i.intervals=[],i.intervals=i.intervals.concat(g.intervals),i.intervals.push(d)):(i.not_intervals=[],i.not_intervals=i.not_intervals.concat(g.not_intervals),i.not_intervals.push(d)),console.log(i),e.update(i).$promise.then(function(a){a.status>0?(a.response.RMI.codecs=a.response.RMI.codecs.split(","),f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a.response.RMI)):a.response.RMI.errors.forEach(function(a){a?f.show(a.field+": "+a.error,"danger"):f.show("Please, check your connection!","danger")})})["catch"](function(a){f.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.motiondialer.processes.view",{url:"/view/:id",templateUrl:"app/motiondialer/process/view/view.html",controller:"MotionDialerProcessViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.motiondialer.processes.view.overview",{url:"/overview",templateUrl:"app/motiondialer/process/view/view.overview.html"}).state("main.motiondialer.processes.view.settings",{url:"/settings",templateUrl:"app/motiondialer/process/view/view.settings.html"}).state("main.motiondialer.processes.view.intervals",{url:"/intervals",templateUrl:"app/motiondialer/process/view/view.intervals.html"}).state("main.motiondialer.processes.view.spooler",{url:"/spooler",templateUrl:"app/motiondialer/process/view/view.spooler.html"})}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewRunProcessCtrl",["$scope","$stateParams","$uibModalInstance","$translate","statusProcess","MotionDialerProcess","xAlert",function(a,b,c,d,e,f,g){a.status="RUN"===e?"STOP":"RUN",a.yes=function(){f.update({id:parseInt(b.id),status:a.status}).$promise.then(function(a){a.status>0?(g.show(d.instant("MESSAGE_WELL_DONE"),"success"),c.close(a.response.RMI)):g.show(a.message||"Please, check your connection!","danger")})["catch"](function(a){g.error(a)})},a.no=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewSpoolerEditCtrl",["$scope","$translate","$uibModalInstance","$stateParams","MotionDialerSpooler","xAlert","entitySpooler","Agent",function(a,b,c,d,e,f,g,h){a.moment=moment,a.initModal=function(){return h.get().$promise.then(function(b){a.agents=[],b&&b.rows.forEach(function(b){a.agents.push("SIP/"+b.name)})})["catch"](function(a){f.error(a)})},a.entitySpooler=g,a.save=function(){var d;switch(a.entitySpooler.retrieve){case"CLOSED":d=e.close({id:parseInt(a.entitySpooler.id)});break;case"OPEN":d=e.open({id:parseInt(a.entitySpooler.id)});break;case"BLACK_LIST":d=e.blacklist({id:parseInt(a.entitySpooler.id)});break;case"PLANNED":d=e.planning({id:parseInt(a.entitySpooler.id),date:moment(a.entitySpooler.planningtime).format("YYYY-MM-DD HH:mm")});break;case"PLANNED_PEER":d=e.planningpeer({id:parseInt(a.entitySpooler.id),date:moment(a.entitySpooler.planningtime).format("YYYY-MM-DD HH:mm"),peer:a.entitySpooler.planningpeer})}d?d.$promise.then(function(a){console.log(a),a.status>0?(f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close()):a.response.RMI.errors.forEach(function(a){a?f.show(a.field+": "+a.error,"danger"):f.show("Please, check your connection!","danger")})})["catch"](function(a){f.error(a)}):f.show("RETRIEVE NOT FOUND","danger")},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("MotionDialerViewSpoolerHistoryCtrl",["$scope","$translate","$uibModalInstance","$stateParams","MotionDialerSpooler","xAlert","historySpooler",function(a,b,c,d,e,f,g){a.historySpooler=g,a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("ResetCtrl",["$scope","Auth","$location","$window","$rootScope","Setting","xAlert","$stateParams","$state",function(a,b,c,d,e,f,g,h,i){a.userReset={},a.getInfo=function(){return f.get({controller:"info"}).$promise.then(function(b){a.info=b})["catch"](function(a){console.error(a)})},e.bodyLayout="login",a.$on("$viewContentLoaded",function(){Metronic.init(),Layout.init()}),a.reset=function(){b.reset({token:h.token,password:a.userReset.password}).then(function(){i.go("login",{reset:!0})})["catch"](function(a){g.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("reset",{url:"/reset/:token",templateUrl:"app/reset/reset.html",controller:"ResetCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/login.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("SalesforceListCtrl",["$scope","SalesforceAccount","gridOptions","xAlert","$translate",function(a,b,c,d,e){a.initView=function(){var d={exporterCsvFilename:"salesforce_account.csv",columnDefs:[{name:"name",displayName:"APPLICATION_NAME"},{name:"username"},{name:"remoteUri",displayName:"APPLICATION_URI"},{name:"action",buttons:[{"class":"blue-hoki",href:"/salesforce/view/{{row.entity.id}}/account",name:"profile"},{"class":"green-jungle",name:"check",onClick:"grid.appScope.checkAccount(row.entity.id)"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=c.gridOptions(b,d,a)},a.checkAccount=function(a){return b.check({id:a}).$promise.then(function(){d.show(e.instant("MESSAGE_ACCOUNT_VERIFIED"),"success")})["catch"](function(){d.show(e.instant("MESSAGE_ACCOUNT_INVALID"),"danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.list",{url:"/list",templateUrl:"app/salesforce/list/list.html",controller:"SalesforceListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("SalesforceAccount",["$resource",function(a){return a("/api/salesforce/accounts/:id/:controller",{id:"@id"},{update:{method:"PUT"},fields:{params:{controller:"fields"},isArray:!0},check:{params:{controller:"check"}}})}]).factory("SalesforceConfiguration",["$resource",function(a){return a("/api/salesforce/accounts/:accountId/configurations/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]).factory("SalesforceField",["$resource",function(a){return a("/api/salesforce/accounts/:accountId/configurations/:configurationId/fields/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce",{url:"/salesforce",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.view.configurations",{url:"/configurations",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("SalesforceViewConfigurationListCtrl",["$scope","$stateParams","$translate","gridOptions","SalesforceConfiguration","$uibModal",function(a,b,c,d,e,f){a.initView=function(){var c={exporterCsvFilename:"salesforce_configurations.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:125,buttons:[{"class":"blue-hoki",href:"/salesforce/view/{{row.entity.AccountId}}/configurations/view/{{row.entity.id}}",name:"profile"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=d.gridOptions(e,c,a,{accountId:b.id})},a.createItem=function(){var b=f.open({animation:!0,templateUrl:"app/salesforce/view/configuration/list/create.modal.html",controller:"SalesforceCreateConfigurationCtrl"});b.result.then(function(){a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("SalesforceCreateConfigurationCtrl",["$scope","$translate","$uibModalInstance","SalesforceConfiguration","xAlert","$stateParams","channel",function(a,b,c,d,e,f,g){a.form={},a.item={},a.channels=g,a.item.channel="voice",a.item.type="Queue",a.save=function(){return d.save({accountId:f.id},a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.view.configurations.list",{url:"/list",templateUrl:"app/salesforce/view/configuration/list/list.html",controller:"SalesforceViewConfigurationListCtrl"})}]),angular.module("xCallyShuttleApp").controller("SalesforceViewConfigurationViewCtrl",["$scope","$filter","$stateParams","$translate","socket","variable","xAlert","SalesforceAccount","SalesforceConfiguration","SalesforceField","Variable",function(a,b,c,d,e,f,g,h,i,j,k){a.$on("$destroy",function(){e.unsyncUpdates("salesforce_field")}),a.config={autoHideScrollbar:!1,theme:"dark",advanced:{updateOnContentResize:!0},setHeight:300,scrollInertia:0},a.fieldType=[{type:"string",title:"String"},{type:"variable",title:"Variable"},{type:"customVariable",title:"Custom Variable"}],a.descFieldType=[{type:"string",title:"String"},{type:"keyValue",title:"Key Value"}],a.groupVariableByGroup=function(a){switch(a.group){case"voice_queue":return"Voice: Queue";default:return"Other"}},a.initView=function(){a.configurationName="",a.subjectConfig=[],a.descriptionConfig=[],a.fieldConfig=[],a.variables=f},a.getConfiguration=function(){return i.get({accountId:c.id,id:c.configurationId}).$promise.then(function(b){a.configurationName=b.name,a.subjectConfig=b.Subject,
+a.descriptionConfig=b.Description,a.fieldConfig=b.Field,e.socket.on("salesforce_field:remove",function(b){_.remove(a.subjectConfig,{id:b.id}),_.remove(a.descriptionConfig,{id:b.id}),_.remove(a.fieldConfig,{id:b.id})})})["catch"](function(a){g.error(a)})},a.getCustomVariables=function(){return k.get().$promise.then(function(b){a.customVariables=b.rows})["catch"](function(a){g.error(a)})},a.getFields=function(){return h.fields({id:c.id}).$promise.then(function(c){a.accountFields=_.sortByOrder(b("salesforce")(c),"name","asc"),console.log(a.accountFields)})["catch"](function(a){g.error(a)})},a.addItem=function(b){var d={};switch(b){case"subject":case"description":d={type:"string",content:""};break;case"field":d={content:""}}return i.save({accountId:c.id,id:c.configurationId,controller:b},d).$promise.then(function(c){switch(b){case"subject":a.subjectConfig.push(c);break;case"description":a.descriptionConfig.push(c);break;case"field":a.fieldConfig.push(c)}})["catch"](function(a){g.error(a)})},a.changeType=function(b){"variable"===b.type?(b.content="",b.variableName=""):"string"===b.type?(b.VariableId=null,b.variableName=""):"customVariable"===b.type&&(b.VariableId=null,b.content=""),a.updateField(b)},a.updateField=function(a){return j.update({accountId:c.id,configurationId:c.configurationId,id:a.id},a).$promise.then(function(){})["catch"](function(a){g.error(a)})},a.removeItem=function(a){return j["delete"]({accountId:c.id,configurationId:c.configurationId,id:a.id}).$promise.then(function(){g.show(d.instant("MESSAGE_WELL_DONE")+"!","success")})["catch"](function(a){g.error(a)})},a.changeDescType=function(b){"keyValue"===b.type?(b.content="","string"===b.keyType?(b.VariableId=null,b.variableName=""):"variable"===b.keyType?(b.keyContent="",b.VariableId=null):"customVariable"===b.keyType&&(b.keyContent="",b.variableName="")):"string"===b.type&&(b.VariableId=null,b.variableName="",b.key="",b.keyContent=""),a.updateField(b)},a.getSystemFieldOptions=function(b){if(b){var c=_.find(a.accountFields,"name",b);if(c)switch(c.type){case"picklist":return c.picklistValues;default:return}}}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.view.configurations.view",{url:"/view/:configurationId",templateUrl:"app/salesforce/view/configuration/view/view.html",controller:"SalesforceViewConfigurationViewCtrl"})}]),angular.module("xCallyShuttleApp").controller("SalesforceViewCtrl",["$scope","$http","$stateParams","$translate","$location","WizardHandler","socket","xAlert","Modal","$filter","SalesforceAccount",function(a,b,c,d,e,f,g,h,i,j,k){a.initView=function(){return k.get({id:c.id}).$promise.then(function(b){a.account=b})["catch"](function(a){h.error(a)})},a.updateItem=function(){return k.update({id:c.id},a.account).$promise.then(function(){h.show(d.instant("MESSAGE_WELL_DONE")+".","success")})["catch"](function(a){h.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.view",{url:"/view/:id",templateUrl:"app/salesforce/view/view.html",controller:"SalesforceViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.salesforce.view.account",{url:"/account",templateUrl:"app/salesforce/view/view.account.html"})}]),angular.module("xCallyShuttleApp").controller("SalesforceWizardCtrl",["$scope","$http","$location","$translate","xAlert","WizardHandler",function(a,b,c,d,e,f){a.translate=d,a.initWizard=function(){a.$translate=d,a.forms={},a.item={},a.item.serverUrl=c.protocol()+"://"+location.host},a.next=function(){f.wizard().next()},a.exitValidation=function(a){return a},a.createItem=function(){console.log(a.item),b.post("api/salesforce/accounts",a.item).success(function(){e.show(d.instant("MESSAGE_WELL_DONE")+".","success"),c.path("/salesforce/list")}).error(function(a){e.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.salesforce.wizard",{url:"/wizard",templateUrl:"app/salesforce/wizard/wizard.html",controller:"SalesforceWizardCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.customization",{url:"/customization",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("CustomizationGeneralViewCtrl",["$scope","gridOptions","$uibModal","FileUploader","$cookieStore","xAlert","$translate","Setting","$rootScope",function(a,b,c,d,e,f,g,h,i){a.radioSwitch={isActive:i.license.custom?!0:!1,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"};var j=a.uploader=new d({url:"api/settings/logo/main",queueLimit:1,withCredentials:!0,headers:{Authorization:"Bearer "+e.get("token")}});j.filters.push({name:"imageFilter",fn:function(a){var b="|"+a.type.slice(a.type.lastIndexOf("/")+1)+"|";return-1!=="|jpg|png|jpeg|".indexOf(b)}}),j.onSuccessItem=function(a,b){i.settings.logo=b.logo,f.show(g.instant("MESSAGE_WELL_DONE"),"success")},j.onErrorItem=function(){f.show(g.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")},j.onCompleteAll=function(){j.clearQueue()};var k=a.uploader2=new d({url:"api/settings/logo/login",queueLimit:1,withCredentials:!0,headers:{Authorization:"Bearer "+e.get("token")}});k.filters.push({name:"imageFilter",fn:function(a){var b="|"+a.type.slice(a.type.lastIndexOf("/")+1)+"|";return-1!=="|jpg|png|jpeg|".indexOf(b)}}),k.onSuccessItem=function(a,b){f.show(g.instant("MESSAGE_WELL_DONE"),"success")},k.onErrorItem=function(){f.show(g.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")},k.onCompleteAll=function(){k.clearQueue()},a.initView=function(){return h.get({id:1}).$promise.then(function(b){a.settings={defaultLogo:b.defaultLogo,defaultLoginLogo:b.defaultLoginLogo,footerWhiteLabel:b.footerWhiteLabel,defaultFooterWhiteLabel:b.defaultFooterWhiteLabel}})["catch"](function(a){f.error(a)})},a.update=function(){return h.update({id:1},a.settings).$promise.then(function(b){_.merge(i.settings,a.settings),f.show(g.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){f.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.customization.view.general",{url:"/general",templateUrl:"app/setting/customization/view/general/general.html",controller:"CustomizationGeneralViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/scripts/jquery.sparkline.min.js","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js","assets/scripts/profile.js"]})}]}})}]),angular.module("xCallyShuttleApp").controller("CustomizationViewCtrl",["$scope",function(a){}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.customization.view",{url:"/view",templateUrl:"app/setting/customization/view/view.html",controller:"CustomizationViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.general",{url:"/general",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("GeneralMainViewCtrl",["$scope","xAlert","$translate","Setting",function(a,b,c,d){a.initView=function(){return d.get({id:1}).$promise.then(function(b){a.settings={agi_port:b.agi_port,min_internal:b.min_internal,min_mailbox:b.min_mailbox,securePassword:b.securePassword}})["catch"](function(a){b.error(a)})},a.update=function(){return d.update({id:1},a.settings).$promise.then(function(a){b.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){b.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.general.view.main",{url:"/main",templateUrl:"app/setting/general/view/main/main.html",controller:"GeneralMainViewCtrl"})}]),angular.module("xCallyShuttleApp").controller("GeneralViewCtrl",["$scope",function(a){}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.general.view",{url:"/view",templateUrl:"app/setting/general/view/view.html",controller:"GeneralViewCtrl"})}]),angular.module("xCallyShuttleApp").factory("License",["$resource",function(a){return a("/api/licenses/:id/:controller",{id:"@id"},{request:{method:"POST",params:{id:"request"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.license",{url:"/license",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("LicenseUpdateCtrl",["$scope","$translate","$uibModalInstance","xAlert","Setting",function(a,b,c,d,e){a.form={},a.item={},a.getLicense=function(){return e.get({id:1}).$promise.then(function(b){a.item.license=b.license})["catch"](function(a){d.error(a)})},a.update=function(){return e.update({id:1},a.item).$promise.then(function(a){d.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){d.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").controller("LicenseViewCtrl",["$scope","$rootScope","$translate","License","xAlert","$window","$uibModal",function(a,b,c,d,e,f,g){a.radioSwitch={isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.initView=function(){return d.get(function(b){a.item=b.license})},a.submitRequest=function(){return d.request(a.item,function(){e.show(c.instant("MESSAGE_WELL_DONE"),"success")},function(a){switch(a.status){case 304:e.show(a.statusText,"info");break;default:e.error(a)}})},a.updateLicense=function(){var a=g.open({animation:!0,templateUrl:"app/setting/license/view/update.modal.html",controller:"LicenseUpdateCtrl"});a.result.then(function(){f.location.reload()})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.license.view",{url:"/view",templateUrl:"app/setting/license/view/view.html",controller:"LicenseViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/pricing-tables.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("Externip",["$resource",function(a){return a("/api/network/externips/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("Localnet",["$resource",function(a){return a("/api/network/localnets/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.network",{url:"/network",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("ExternipCtrl",["$scope","$uibModal","gridOptions","Externip",function(a,b,c,d){a.initView=function(){var b={exporterCsvFilename:"network_externip.csv",columnDefs:[{name:"value"},{name:"action",buttons:[{"class":"blue-hoki",onClick:"grid.appScope.createItem(row.entity)",name:"profile"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=c.gridOptions(d,b,a)},a.createItem=function(c){var d=b.open({animation:!0,templateUrl:"app/setting/network/view/externip/externip.create.modal.html",controller:"ExternipCreateCtrl",resolve:{item:c}});d.result.then(function(){a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("ExternipCreateCtrl",["$scope","$translate","$uibModalInstance","$stateParams","Externip","xAlert","item",function(a,b,c,d,e,f,g){a.initModal=function(){a.form={},a.item=g||{},a.title=g?b.instant("APPLICATION_EDIT_EXTERNIP"):b.instant("APPLICATION_NEW_EXTERNIP")},a.save=function(){return g?e.update({id:a.item.id},a.item).$promise.then(function(a){f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){f.error(a)}):e.save({},a.item).$promise.then(function(a){f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){f.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.network.view.externip",{url:"/externip",templateUrl:"app/setting/network/view/externip/externip.html",controller:"ExternipCtrl"})}]),angular.module("xCallyShuttleApp").controller("LocalnetCtrl",["$scope","gridOptions","Localnet","$uibModal",function(a,b,c,d){a.initView=function(){var d={exporterCsvFilename:"network_localnet.csv",columnDefs:[{name:"value"},{name:"action",buttons:[{"class":"blue-hoki",onClick:"grid.appScope.createItem(row.entity)",name:"profile"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=b.gridOptions(c,d,a)},a.createItem=function(b){var c=d.open({animation:!0,templateUrl:"app/setting/network/view/localnet/localnet.create.modal.html",controller:"LocalnetCreateCtrl",resolve:{item:b}});c.result.then(function(){a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("LocalnetCreateCtrl",["$scope","$translate","$uibModalInstance","$stateParams","Localnet","xAlert","item",function(a,b,c,d,e,f,g){a.initModal=function(){if(a.form={},a.item=g||{},a.title=g?b.instant("APPLICATION_EDIT_LOCALNET"):b.instant("APPLICATION_NEW_LOCALNET"),g&&g.value){var c=a.item.value.split("/");c.length>1&&(a.item.address=c[0],a.item.mask=c[1])}},a.save=function(){var d=a.item.address+"/"+a.item.mask;return g?e.update({id:a.item.id},{value:d}).$promise.then(function(a){f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){f.error(a)}):e.save({},{value:d}).$promise.then(function(a){f.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){f.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.network.view.localnet",{url:"/localnet",templateUrl:"app/setting/network/view/localnet/localnet.html",controller:"LocalnetCtrl"})}]),angular.module("xCallyShuttleApp").controller("NetworkViewCtrl",function(){}),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.network.view",{url:"/view",templateUrl:"app/setting/network/view/view.html",controller:"NetworkViewCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting",{url:"/setting",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:18}}})}]),angular.module("xCallyShuttleApp").factory("Setting",["$resource",function(a){return a("/api/settings/:id/:controller/:param",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("Smtp",["$resource",function(a){return a("/api/mail/servers/out/:id/:controller/:controller2",{id:"@id"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.smtp",{url:"/smtp",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("SmtpViewCtrl",["$scope","$stateParams","$translate","socket","MailServerOut","Setting","MailAccount","xAlert",function(a,b,c,d,e,f,g,h){a.initView=function(){return a.smtpDisabled=!1,a.isActive=!0,a.size="small",a.animate=!0,a.radioOff=!0,a.handleWidth="auto",a.labelWidth="auto",a.inverse=!0,a.offColor="danger",a.onColor="success",a.CONST_TIMEOUT=3e4,a.item={account:{service:!0,MailServerOut:{ssl:!1}}},f.get({id:"smtp"}).$promise.then(function(b){a.item.account=b,d.socket.on("mail_server_out:state",function(b){Number(b.id)===a.item.account.MailServerOut.id&&(a.item.account.MailServerOut.state=b.state,a.item.account.MailServerOut.source=JSON.parse(b.source))})})["catch"](function(b){switch(console.log(b),b.status){case 404:a.item.account.name=null,a.item.account.address=null,a.item.account.MailServerOut={ssl:!1},h.show("Service SMTP server not configured.","info");break;default:h.error(b)}})},a.updateItem=function(){return a.item.account.id?(delete a.item.account.MailServerOut.state,delete a.item.account.MailServerOut.source,f.update({id:"smtp",controller:a.item.account.id},a.item.account).$promise.then(function(){h.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){h.error(a)})):f.save({id:"smtp"},{description:"Custom Account",name:a.item.account.name,address:a.item.account.address,service:a.item.account.service,custom:!0,MailServerOut:a.item.account.MailServerOut}).$promise.then(function(){h.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){h.error(a)})},a.test=function(){return e.get({id:a.item.account.MailServerOut.id,controller:"test"}).$promise["catch"](function(a){console.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.smtp.view",{url:"/view",templateUrl:"app/setting/smtp/view/view.html",controller:"SmtpViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system",{url:"/system",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("SystemViewConsoleCtrl",["$scope","Setting","xAlert","usSpinnerService","$timeout","$translate",function(a,b,c,d,e,f){function g(b){var c=_.findIndex(a.commandHistory.commands,function(a){return a===b});-1!==c&&a.commandHistory.commands.splice(c,1),a.commandHistory.commands.unshift(b)}a.output="<b>"+f.instant("APPLICATION_CONSOLE_WELCOME")+"</b><br/>",a.item={command:""},a.commandHistory={commands:[],index:-1},a.busy=!1,a.cmdFocus=function(){e(function(){angular.element("#command").trigger("focus")})},a.sendCmd=function(){return a.commandHistory.index=-1,a.tmp=a.item.command,a.item.command="",a.output+="<b>motion*CLI> "+a.tmp+"</b><br>",a.tmp?(g(a.tmp.trim()),a.busy=!0,d.spin("console-spinner"),b.save({controller:"asterisk"},{command:a.tmp}).$promise.then(function(b){a.output+=b.content.replace(/(?:\r\n|\r|\n)/g,"<br />").replace("Response: Follows<br />Privilege: Command<br />","").replace(/ActionID: .[0-9]*<br \/>/,"").replace(/ActionID: .[0-9]*/,"")+"<br>",d.stop("console-spinner"),a.busy=!1,a.cmdFocus()})["catch"](function(b){d.stop("console-spinner"),a.output+="command error:"+b.data.message+"<br>",a.busy=!1,a.cmdFocus()})):void 0},a.keyUp=function(b){switch(b.keyCode){case 40:a.commandHistory.commands[a.commandHistory.index-1]?a.item.command=a.commandHistory.commands[--a.commandHistory.index]:(a.item.command="",a.commandHistory.index=-1);break;case 38:a.commandHistory.commands[a.commandHistory.index+1]&&(a.item.command=a.commandHistory.commands[++a.commandHistory.index]);break;case 37:break;case 39:break;default:a.commandHistory.index=-1}},e(function(){angular.element("#command").trigger("focus"),d.stop("console-spinner")})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system.view.console",{url:"/console",templateUrl:"app/setting/system/view/console/console.html",controller:"SystemViewConsoleCtrl"})}]),angular.module("xCallyShuttleApp").controller("SystemViewGeneralCtrl",["$scope","$stateParams","$translate","socket","Setting","xAlert","usSpinnerService",function(a,b,c,d,e,f,g){function h(b){a.system.memory={labels:_.keys(b.memory.details),values:_.values(_.map(b.memory.details,function(a){return Math.round(a/1024)})),Total:Math.round(b.memory.Total/1024)},g.stop("memory-spinner"),a.system.disks=[],_.forEach(b.disks,function(b){a.system.disks.push({mount:b.mount,size:Number((b.size/1048576).toFixed(2)),values:_.values(_.map(b.details,function(a){return Number((a/1048576).toFixed(2))})),labels:_.keys(b.details)})}),a.system.mount=a.system.disks[0],g.stop("disk-spinner"),a.system.cpu={motion:Math.round(b.cpu.motion),cores:[]},_.forEach(b.cpu.cores,function(b){delete b.nice,delete b.irq,a.system.cpu.cores.push({labels:_.keys(b),values:_.values(b),colours:["#803690","#DCDCDC","#00ADF9"]})}),g.stop("cpu-spinner")}a.system={mount:void 0},a.initView=function(){return g.spin("memory-spinner"),g.spin("disk-spinner"),g.spin("cpu-spinner"),e.get({controller:"system"}).$promise.then(function(a){h(a)})["catch"](function(a){f.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system.view.general",{url:"/general",templateUrl:"app/setting/system/view/general/general.html",controller:"SystemViewGeneralCtrl"})}]),angular.module("xCallyShuttleApp").controller("SystemViewLogsCtrl",["$scope","$stateParams","$translate","socket","Setting","xAlert","usSpinnerService",function(a,b,c,d,e,f,g){a.initView=function(){return a.logs={errors:"",output:""},g.spin("logs-spinner"),e.get({controller:"logs"}).$promise.then(function(b){a.logs=b,g.stop("logs-spinner")})["catch"](function(a){f.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system.view.logs",{url:"/logs",templateUrl:"app/setting/system/view/logs/logs.html",controller:"SystemViewLogsCtrl"})}]),angular.module("xCallyShuttleApp").controller("SystemViewCtrl",["$scope",function(a){}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.system.view",{url:"/view",templateUrl:"app/setting/system/view/view.html",controller:"SystemViewCtrl"})}]),angular.module("xCallyShuttleApp").controller("UpdateListCtrl",["$scope","gridOptions","$uibModal","$location","Update",function(a,b,c,d,e){a.initCounter=function(){a.$on("timer-stopped",function(a,b){console.log("Timer Stopped - data = ",b),d.path("/dashboard/voice")})},a.initView=function(){var c={exporterCsvFilename:"updates.csv",enableFiltering:!1,enableSorting:!1,enablePaginationControls:!1,enableSelectAll:!1,columnDefs:[{name:"message"},{width:125,name:"version",cellClass:"text-center ui-grid-vcenter"},{width:125,name:"createdAt",displayName:"APPLICATION_UPDATED_AT",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><span am-time-ago="row.entity.createdAt"></span></div>'}]};a.gridOptions=b.gridOptions(e,c,a)},a.pull=function(){c.open({animation:!0,templateUrl:"app/setting/update/list/list.pull.html",controller:"UpdateListPullCtrl"})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.updates.list",{url:"/list",templateUrl:"app/setting/update/list/list.html",controller:"UpdateListCtrl"}).state("main.setting.updates.landing",{url:"/landing",templateUrl:"app/setting/update/list/landing.html",controller:"UpdateListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/error.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("UpdateListPullCtrl",["$scope","$uibModalInstance","$translate","$location","Update",function(a,b,c,d,e){a.modal={dismissable:!0,title:"Confirm Checkout",html:"Are you sure you want to checkout?",buttons:[{classes:"btn btn-success",text:"Checkout",click:function(){return e.pull().$promise["finally"](function(){b.dismiss("close"),d.path("/setting/updates/landing")})}},{classes:"btn default",text:"Cancel",click:function(){b.dismiss("cancel")}}]}}]),angular.module("xCallyShuttleApp").factory("Update",["$resource",function(a){return a("/api/updates/:id/:controller",{id:"@id"},{pull:{method:"GET",params:{id:"pull"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.setting.updates",{url:"/updates",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["hasUpdate"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").controller("SquareOdbcListCtrl",["$scope","$uibModal","$translate","SquareOdbc","gridOptions","xAlert",function(a,b,c,d,e,f){a.initView=function(){var b={exporterCsvFilename:"odbc.csv",columnDefs:[{name:"name"},{name:"dsn",displayName:"APPLICATION_ODBC"},{name:"description"},{name:"action",width:250,buttons:[{"class":"blue-hoki",href:"/square/odbc/view/{{row.entity.id}}/settings",name:"settings"},{"class":"green-jungle",name:"check",onClick:"grid.appScope.checkConnection(row.entity.id)"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=e.gridOptions(d,b,a)},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/square/odbc/list/list.create.modal.html",controller:"SquareOdbcListCreateCtrl"});c.result.then(function(){a.gridOptions.getPage()})},a.checkConnection=function(a){return d.get({id:a,controller:"check"}).$promise.then(function(){f.show(c.instant("MESSAGE_CONNECTION_VERIFIED"),"success")})["catch"](function(){f.show(c.instant("MESSAGE_CONNECTION_INVALID"),"danger")})}}]),angular.module("xCallyShuttleApp").controller("SquareOdbcListCreateCtrl",["$scope","$translate","$uibModalInstance","SquareOdbc","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.item.dsn||(a.item.dsn="DRIVER=MySQL;SERVER=127.0.0.1;UID=xcall;PWD=password;DATABASE=motion"),a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.odbc.list",{url:"/list",templateUrl:"app/square/odbc/list/list.html",controller:"SquareOdbcListCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.odbc",{url:"/odbc",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").factory("SquareOdbc",["$resource",function(a){return a("/api/square/odbc/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("SquareOdbcViewCtrl",["$scope","$translate","$stateParams","SquareOdbc","xAlert",function(a,b,c,d,e){a.odbc={},a.getOdbc=function(){return d.get({id:c.id}).$promise.then(function(b){a.odbc=b})["catch"](function(a){e.error(a)})},a.updateOdbc=function(){var f=angular.copy(a.odbc);return d.update({id:c.id},f).$promise.then(function(){e.show(b.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){e.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.odbc.view",{url:"/view/:id",templateUrl:"app/square/odbc/view/view.html",controller:"SquareOdbcViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.square.odbc.view.settings",{url:"/settings",templateUrl:"app/square/odbc/view/view.settings.html"})}]),angular.module("xCallyShuttleApp").controller("SquareProjectListCtrl",["$scope","$uibModal","SquareProject","gridOptions",function(a,b,c,d){a.initView=function(){var b={exporterCsvFilename:"projects.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:160,buttons:[{"class":"blue-hoki",href:"/square/projects/view/{{row.entity.id}}",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=d.gridOptions(c,b,a)},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/square/project/list/list.create.modal.html",controller:"SquareProjectListCreateCtrl"});c.result.then(function(b){console.log(b),a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("SquareProjectListCreateCtrl",["$scope","$translate","$uibModalInstance","SquareProject","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.projects.list",{url:"/list",templateUrl:"app/square/project/list/list.html",controller:"SquareProjectListCtrl",authenticate:!0})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.projects",{url:"/projects",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").factory("SquareProject",["$resource",function(a){return a("/api/square/projects/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("SquareProjectViewCtrl",["$scope","$stateParams","Auth","xAlert","SquareProject","socket","$translate","$log","$uibModal",function(a,b,c,d,e,f,g,h,i){a.squareProject={},a.$on("$destroy",function(){f.unsyncUpdates("square_project")}),a.getProject=function(){return e.get({id:b.id}).$promise.then(function(b){a.squareProject=b,angular.element(document).ready(function(){window.onerror=function(a,b,c){try{if(null!==a&&-1!==a.indexOf("Script error."));else{var e=new Image;e.src="assets/plugins/mxgraph/images/1x1.png?msg="+encodeURIComponent(a)+"&url="+encodeURIComponent(b)+"&lnum="+encodeURIComponent(c)}}catch(f){d.error(f)}},b.token=c.getToken();var a=new EditorUi(new Editor);a.openString(b.preproduction,b.name,b),a.editor.graphChangeListener=function(a,b){var c=b.properties.rtChange||!1;c||(this.modified=!0)}}),f.socket.on("square_project:save",function(c){c.id===b.id&&(a.squareProject=_.merge(a.squareProject,c))})})["catch"](function(a){d.error(a)})},a.editNotes=function(){var c=i.open({animation:!0,templateUrl:"app/square/project/view/projectNotes.modal.html",controller:["$scope","$uibModalInstance","notes",function(a,b,c){a.notes=c,a.close=function(){b.close(a.notes)},a.cancel=function(){b.dismiss("cancel")}}],resolve:{notes:{value:a.squareProject.notes}}});c.result.then(function(a){return e.update({id:b.id},{notes:a.value}).$promise.then(function(){d.show(g.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){d.error(a)})},function(){h.info("Modal dismissed at: "+new Date)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.projects.view",{url:"/view/:id",templateUrl:"app/square/project/view/view.html",controller:"SquareProjectViewCtrl",authenticate:!0,resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",serie:!0,cache:!1,files:["assets/plugins/mxgraph/css/common.css","assets/plugins/mxgraph/css/explorer.css","assets/plugins/mxgraph/styles/grapheditor.css","assets/plugins/mxgraph/styles/custom.css","assets/plugins/square/js/custom.js","assets/plugins/mxgraph/js/mxClient.js","assets/plugins/square/js/Editor.js","assets/plugins/square/js/Graph.js","assets/plugins/square/js/EditorUi.js","assets/plugins/square/js/Actions.js","assets/plugins/square/js/Menus.js","assets/plugins/square/js/Sidebar.js","assets/plugins/square/js/Toolbar.js","assets/plugins/square/js/Dialogs.js"]}])}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.realtime",{url:"/realtime",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:14}}})}]),angular.module("xCallyShuttleApp").factory("ReportSquare",["$resource",function(a){return a("/api/report/square/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("ReportSquareDetail",["$resource",function(a){return a("/api/report/square/details/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("SquareRealtimeViewGeneralCtrl",["$scope","$log","$uibModal","$translate","socket","xAlert","ReportSquare","usSpinnerService","$q","uiGridConstants",function(a,b,c,d,e,f,g,h,i,j){
 function k(b){return h.spin("spinner-grid"),g.get(m).$promise.then(function(b){a.gridOptions.totalItems=b.count,a.gridOptions.data=b.rows})["catch"](function(a){f.error(a)})["finally"](function(){b&&l(),h.stop("spinner-grid")})}function l(){e.socket.on("report_square:save",function(b){if(b.leaveAt){var c=_.remove(a.gridOptions.data,{id:b.id});c&&k()}else{var d=_.find(a.gridOptions.data,{id:b.id});if(!d&&a.gridOptions.data.length<m.limit){var e=_.clone(m);if(_.forEach(["offset","limit","controller","order"],function(a){delete e[a]}),_.isEmpty(e))a.gridOptions.data.push(b);else{var f=!0;_.forOwn(e,function(a,c){_.includes(b[c],a)||(f=!1)}),f&&a.gridOptions.data.push(b)}}}})}var m={controller:"realtime",offset:0,limit:25};a.moment=moment,a.init=function(){a.gridOptions={enableGridMenu:!0,headerCellFilter:"translate",enableHorizontalScrollbar:0,enableVerticalScrollbar:0,enableFiltering:!0,showGridFooter:!0,paginationPageSizes:[10,25,50,75],paginationPageSize:25,useExternalPagination:!0,useExternalSorting:!0,useExternalFiltering:!0,showTreeExpandNoChildren:!0,columnDefs:[{name:"uniqueid"},{name:"callerid"},{name:"extension"},{name:"project_name",displayName:"APPLICATION_PROJECT",headerCellFilter:"translate"},{name:"joinAt",displayName:"APPLICATION_ELAPSED_TIME",headerCellFilter:"translate",cellClass:"text-center ui-grid-vcenter",cellTemplate:'<div><timer start-time="grid.appScope.moment(row.entity.joinAt).unix()*1000">{{hhours}}:{{mminutes}}:{{sseconds}}</timer></div>',enableSorting:!1,enableColumnMenu:!1,enableFiltering:!1}],data:[],gridMenuTitleFilter:function(a){var b=i.defer();return b.resolve(d.instant(a)),b.promise},onRegisterApi:function(b){a.gridApi=b,a.gridApi.grid.registerDataChangeCallback(function(){n(a.gridApi.core.getVisibleRows(a.gridApi.grid).length)}),a.gridApi.core.on.sortChanged(a,function(a,b){0===b.length?m.order=null:m.order=b[0].name+" "+b[0].sort.direction.toUpperCase(),k()}),a.gridApi.pagination.on.paginationChanged(a,function(a,b){m.offset=(a-1)*b,m.limit=b,k()}),a.gridApi.core.on.filterChanged(a,function(){var a=this.grid;a.columns.forEach(function(a){a.filters[0].term?m[a.name]=a.filters[0].term:delete m[a.name]}),k()})}},k(!0)};var n=function(a){var b=a?30*a+130:270;angular.element(document.getElementsByClassName("ui-grid")[0]).css("height",b+"px"),angular.element(document.getElementsByClassName("ui-grid-viewport")).css("height",30*a+"px")};a.$on("$destroy",function(){e.unsyncUpdates("report_square")})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.realtime.view.general",{url:"/general",templateUrl:"app/square/realtime/view/general/general.html",controller:"SquareRealtimeViewGeneralCtrl"})}]),angular.module("xCallyShuttleApp").controller("SquareRealtimeViewCtrl",["$scope",function(a){}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.realtime.view",{url:"/view",templateUrl:"app/square/realtime/view/view.html",controller:"SquareRealtimeViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}})}]),angular.module("xCallyShuttleApp").controller("SquareRecordingListCtrl",["$scope","SquareRecording","gridOptions",function(a,b,c){a.SquareRecording=b;a.initView=function(){var d={exporterCsvFilename:"recordings.csv",rowHeight:30,columnDefs:[{name:"uniqueid"},{name:"callerid",displayName:"APPLICATION_CALLERIDNUM"},{name:"filename"},{name:"extension"},{name:"projectName",displayName:"APPLICATION_PROJECT"},{name:"audio",displayName:"",width:100,enableSorting:!1,enableFiltering:!1,cellClass:"ui-grid-vcenter",cellTemplate:"<div><audio-file-download data-ng-if=\"row.entity.savePath.split('.').pop() == 'wav'\" params=\"{id:row.entity.id,controller:'stream'}\" resource=\"grid.appScope.SquareRecording\"></audio-file-download><span data-ng-if=\"row.entity.value.split('.').pop() == 'gsm'\" title=\"{{'MESSAGE_GSM_PREVIEW_NOT_SUPPORTED' | translate}}\">{{'MESSAGE_GSM_PREVIEW_NOT_SUPPORTED' | translate}}</span></div>"},{name:"action",width:80,buttons:[{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.filename || row.entity.uniqueid, row.entity.id)"},{directive:'<motion-file-download params="{id:row.entity.id,controller:\'stream\'}" resource="grid.appScope.SquareRecording" mimetype="audio/wav" btnclass="btn btn-xs blue-hoki" filename="(row.entity.filename || row.entity.uniqueid)+\'.wav\'"></motion-file-download>'}]}]};a.gridOptions=c.gridOptions(b,d,a)}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.recordings.list",{url:"/list",templateUrl:"app/square/recording/list/list.html",controller:"SquareRecordingListCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square.recordings",{url:"/recordings",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").factory("SquareRecording",["$resource",function(a){return a("/api/square/recordings/:id/:controller",{id:"@id"},{update:{method:"PUT"},patch:{method:"PATCH"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.square",{url:"/square",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:14}}})}]),angular.module("xCallyShuttleApp").factory("Agent",["$resource",function(a){return a("/api/agents/:id/:controller/:controller1/:controller2/:controller3",{id:"@id"},{changePassword:{method:"PUT",params:{controller:"password"}},update:{method:"PUT"},patch:{method:"PATCH"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.agents",{url:"/agents",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user","agent"],redirectTo:"landing",id:4}}})}]),angular.module("xCallyShuttleApp").controller("AgentListCtrl",["$scope","$timeout","Agent","Auth","gridOptions",function(a,b,c,d,e){a.initView=function(){a.Auth=d;var b={exporterCsvFilename:"agents.csv",columnDefs:[{name:"fullname"},{name:"name",displayName:"APPLICATION_USERNAME"},{name:"internal"},{name:"email"},{name:"description"},{name:"action",width:100,buttons:[{"class":"blue-hoki",href:"/staff/agents/view/{{row.entity.id}}/account",name:"profile"},{"class":"green-meadow",href:"/staff/agents/view/{{row.entity.id}}/queues/voice",name:"queues"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.fullname, row.entity.id)"}]}]};a.gridOptions=e.gridOptions(c,b,a)}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.agents.list",{url:"/list",templateUrl:"app/staff/agent/list/list.html",controller:"AgentListCtrl",data:{permissions:{only:["admin","user","agent"],redirectTo:"landing",id:4}}})}]),angular.module("xCallyShuttleApp").controller("AgentViewCtrl",["$scope","$http","xAlert","$translate","$stateParams","$cookieStore","Agent","FileUploader","Auth","MailQueue","User","VoiceQueue","ChatQueue","FaxQueue","SmsQueue","OpenChannelQueue","Setting",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){a.Auth=i,a.radioSwitch={isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.recordSwitch={onText:"On",offText:"Off",isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.initVoiceQueues=function(){var a={},b={};return l.get().$promise.then(function(b){return a.queues=_.map(b.rows,function(a){return{name:a.name}}),g.get({id:e.id,controller:"voice",controller2:"queues"}).$promise}).then(function(a){b.queues=_.map(a.rows,function(a){return{name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a,b,"voice",e.id,g)})["catch"](function(a){console.error(a)})},a.initChatQueues=function(){var a={},b={};return m.get().$promise.then(function(b){return a.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}}),g.get({id:e.id,controller:"chat",controller2:"queues"}).$promise}).then(function(a){b.queues=_.map(a.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a,b,"chat",e.id,g)})["catch"](function(a){console.error(a)})},a.initMailQueues=function(){var a={},b={};return j.get().$promise.then(function(b){return a.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}}),g.get({id:e.id,controller:"mail",controller2:"queues"}).$promise}).then(function(a){b.queues=_.map(a.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a,b,"mail",e.id,g)})["catch"](function(a){console.error(a)})},a.initSmsQueues=function(){var a={},b={};return o.get().$promise.then(function(b){return a.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}}),g.get({id:e.id,controller:"sms",controller2:"queues"}).$promise}).then(function(a){b.queues=_.map(a.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a,b,"sms",e.id,g)})["catch"](function(a){console.error(a)})},a.initFaxQueues=function(){var a={},b={};return n.get().$promise.then(function(b){return a.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}}),g.get({id:e.id,controller:"fax",controller2:"queues"}).$promise}).then(function(a){b.queues=_.map(a.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a,b,"fax",e.id,g)})["catch"](function(a){console.error(a)})},a.initOpenchannelQueues=function(){var a={},b={};return p.get().$promise.then(function(b){return a.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}}),g.get({id:e.id,controller:"openchannel",controller2:"queues"}).$promise}).then(function(a){b.queues=_.map(a.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a,b,"openchannel",e.id,g)})["catch"](function(a){console.error(a)})},a.updatePassword=function(){var b={newPassword:a.agent.newPwd};return i.isAdmin()?b.id=e.id:b.oldPassword=a.agent.currentPwd,k.changePassword(b).$promise.then(function(){c.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){c.error(a)})};var r=a.uploader=new h({url:"api/users/"+e.id+"/avatar",queueLimit:1,withCredentials:!0,headers:{Authorization:"Bearer "+f.get("token")}});r.filters.push({name:"imageFilter",fn:function(a){var b="|"+a.type.slice(a.type.lastIndexOf("/")+1)+"|";return-1!=="|jpg|png|jpeg|".indexOf(b)}}),r.onSuccessItem=function(b,e){a.agent.userpic=e.userpic,a.agent.id===i.getCurrentUser().id&&(i.getCurrentUser().userpic=e.userpic),c.show(d.instant("MESSAGE_WELL_DONE"),"success")},r.onErrorItem=function(){c.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")},r.onCompleteAll=function(){r.clearQueue()},a.initView=function(){return g.get({id:e.id}).$promise.then(function(b){return a.agent=b,a.agent.transport=a.agent.transport?a.agent.transport.split(","):[],a.agent.allow=a.agent.allow?a.agent.allow.split(";"):[],a.agent.nat=a.agent.nat?a.agent.nat.split(","):[],q.get({id:1}).$promise}).then(function(b){a.setting=b})["catch"](function(a){c.error(a)})},a.patchItem=function(){return g.update({id:e.id},{chatCapacity:a.agent.chatCapacity,mailCapacity:a.agent.mailCapacity,faxCapacity:a.agent.faxCapacity,smsCapacity:a.agent.smsCapacity,openchannelCapacity:a.agent.openchannelCapacity}).$promise.then(function(){c.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){c.error(a)})},a.updateItem=function(){var b=angular.copy(a.agent);return delete b.password,delete b.md5secret,b.transport=b.transport.join(","),b.allow=b.allow.join(";"),b.nat=b.nat.join(","),g.update({id:e.id},b).$promise.then(function(){c.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){c.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.agents.view",{url:"/view/:id",templateUrl:"app/staff/agent/view/view.html",controller:"AgentViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]},data:{permissions:{only:["admin","user","agent"],redirectTo:"landing",id:4}}}).state("main.staff.agents.view.account",{url:"/account",templateUrl:"app/staff/agent/view/view.account.html",data:{permissions:{only:["admin","user","agent"],redirectTo:"landing",id:4}},resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/scripts/jquery.sparkline.min.js","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js","assets/scripts/profile.js"]})}]}}).state("main.staff.agents.view.voice",{url:"/voice",templateUrl:"app/staff/agent/view/view.voice.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:4}}}).state("main.staff.agents.view.chat",{url:"/chat",templateUrl:"app/staff/agent/view/view.chat.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:4}}}).state("main.staff.agents.view.mail",{url:"/mail",templateUrl:"app/staff/agent/view/view.mail.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:4}}}).state("main.staff.agents.view.fax",{url:"/fax",templateUrl:"app/staff/agent/view/view.fax.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:4}}}).state("main.staff.agents.view.sms",{url:"/sms",templateUrl:"app/staff/agent/view/view.sms.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:4}}}).state("main.staff.agents.view.openchannel",{url:"/openchannel",templateUrl:"app/staff/agent/view/view.openchannel.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:4}}}).state("main.staff.agents.view.motionbar",{url:"/motionbar",templateUrl:"app/staff/agent/view/view.motionbar.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:4}}}).state("main.staff.agents.view.queues",{url:"/queues",templateUrl:"app/staff/agent/view/view.queues.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:4}},cache:!1,serie:!0,resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/jquery-multi-select/css/multi-select.css","assets/plugins/jquery-multi-select/js/jquery.multi-select.js","assets/plugins/jquery-quicksearch/jquery.quicksearch.js","assets/scripts/components-dropdowns.js"]})}]}}).state("main.staff.agents.view.queues.voice",{url:"/voice",templateUrl:"app/staff/agent/view/view.queues.voice.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:7}}}).state("main.staff.agents.view.queues.chat",{url:"/chat",templateUrl:"app/staff/agent/view/view.queues.chat.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:8}}}).state("main.staff.agents.view.queues.mail",{url:"/mail",templateUrl:"app/staff/agent/view/view.queues.mail.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:9}}}).state("main.staff.agents.view.queues.fax",{url:"/fax",templateUrl:"app/staff/agent/view/view.queues.fax.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:10}}}).state("main.staff.agents.view.queues.sms",{url:"/sms",templateUrl:"app/staff/agent/view/view.queues.sms.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:11}}}).state("main.staff.agents.view.queues.openchannel",{url:"/openchannel",templateUrl:"app/staff/agent/view/view.queues.openchannel.html",data:{permissions:{only:["admin","user"],redirectTo:"landing",id:20}}})}]),angular.module("xCallyShuttleApp").controller("AgentWizardCtrl",["$scope","$rootScope","$location","$translate","$http","Agent","VoiceQueue","ChatQueue","MailQueue","SmsQueue","FaxQueue","OpenChannelQueue","Setting","xAlert","WizardHandler",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){a.maxAmount=1e3,a._data={voice:{queues:[]},chat:{queues:[]},mail:{queues:[]},sms:{queues:[]},fax:{queues:[]},openchannel:{queues:[]}},a._agent=angular.copy(a._data),a.initVoiceQueues=function(){return g.get().$promise.then(function(b){a._data.voice.queues=_.map(b.rows,function(a){return{name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a._data.voice,a._agent.voice,"voice",null,null)})["catch"](function(a){console.error(a)})},a.initChatQueues=function(){return h.get().$promise.then(function(b){a._data.chat.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a._data.chat,a._agent.chat,"chat",null,null)})["catch"](function(a){console.error(a)})},a.initMailQueues=function(){return i.get().$promise.then(function(b){a._data.mail.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a._data.mail,a._agent.mail,"mail",null,null)})["catch"](function(a){console.error(a)})},a.initSmsQueues=function(){return j.get().$promise.then(function(b){a._data.sms.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a._data.sms,a._agent.sms,"sms",null,null)})["catch"](function(a){console.error(a)})},a.initFaxQueues=function(){return k.get().$promise.then(function(b){a._data.fax.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a._data.fax,a._agent.fax,"fax",null,null)})["catch"](function(a){console.error(a)})},a.initOpenchannelQueues=function(){return l.get().$promise.then(function(b){a._data.openchannel.queues=_.map(b.rows,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindAgent(a._data.openchannel,a._agent.openchannel,"openchannel",null,null)})["catch"](function(a){console.error(a)})},a.forms={info:void 0,voice:void 0},a.item={role:"agent",allow:["alaw","ulaw","gsm"],transport:["udp"],context:"from-sip"},a.next=function(){o.wizard().next()},a.getAmount=function(){return m.get({controller:"internal",internal:a.item.minInternal}).$promise.then(function(b){a.item.minInternal=Number(b.value),a.maxAmount=b.range||1e3})["catch"](function(a){n.error(a)})},a.exitValidation=function(a){return a},a.getFirstFreeInternal=function(){return m.get({controller:"internal"}).$promise.then(function(b){return a.internal=b,a.item.internal=b.value,a.item.minInternal=b.value,a.maxAmount=b.range||1e3,m.get({id:1}).$promise}).then(function(b){a.setting=b})["catch"](function(a){n.error(a)})},a.createItem=function(){var b=angular.copy(a.item);return delete b.minInternal,b.transport&&(b.transport=b.transport.join(",")),a.item.allow&&(b.allow=b.allow.join(";")),b.channels=a._agent,f.save(b).$promise.then(function(){c.path("/staff/agents/list")})["catch"](function(a){console.log(a),n.error(a)})},a.createItems=function(){var b=angular.copy(a.item);return delete b.internal,b.transport&&(b.transport=b.transport.join(",")),b.allow&&(b.allow=b.allow.join(";")),f.save({id:"bulk"},b).$promise.then(function(){c.path("/staff/agents/list")})["catch"](function(a){console.log(a),n.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.agents.wizard",{url:"/wizard",templateUrl:"app/staff/agent/wizard/wizard.html",controller:"AgentWizardCtrl",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}},resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/jquery-multi-select/css/multi-select.css","assets/plugins/jquery-multi-select/js/jquery.multi-select.js","assets/plugins/jquery-quicksearch/jquery.quicksearch.js","assets/scripts/components-dropdowns.js"]})}]}}).state("main.staff.agents.bulk",{url:"/bulk",templateUrl:"app/staff/agent/wizard/wizard-bulk.html",controller:"AgentWizardCtrl",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff",{url:"/staff",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("TeamCreateCtrl",["$scope","$uibModalInstance","Team","xAlert",function(a,b,c,d){a.form={},a.item={},a.ok=function(){return c.save(a.item).$promise.then(function(){b.close(a.item)})["catch"](function(a){d.error(a)})},a.cancel=function(){b.dismiss("cancel")}}]),angular.module("xCallyShuttleApp").controller("TeamListCtrl",["$scope","Team","gridOptions","$uibModal",function(a,b,c,d){a.initView=function(){var d={exporterCsvFilename:"teams.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:100,buttons:[{"class":"{{row.entity.defaultEntry ? 'blue-hoki disabled' : 'blue-hoki'}}",href:"/staff/teams/view/{{row.entity.id}}/settings",name:"profile"},{"class":"{{row.entity.defaultEntry ? 'green-turquoise disabled' : 'green-turquoise'}}",name:"agents",href:"/staff/teams/view/{{row.entity.id}}/agents"},{"class":"{{row.entity.defaultEntry ? 'red-sunglo disabled' : 'red-sunglo'}}",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=c.gridOptions(b,d,a)},a.createItem=function(){d.open({animation:!0,templateUrl:"app/staff/team/list/create.modal.html",controller:"TeamCreateCtrl"}).result.then(function(){a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.teams.list",{url:"/list",templateUrl:"app/staff/team/list/list.html",controller:"TeamListCtrl"})}]),angular.module("xCallyShuttleApp").factory("Team",["$resource",function(a){return a("/api/teams/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.teams",{url:"/teams",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"landing"}}})}]),angular.module("xCallyShuttleApp").controller("TeamViewCtrl",["$scope","$http","$stateParams","$translate","Team","Agent","xAlert",function(a,b,c,d,e,f,g){var h=function(){return{select:function(b){return console.log("agents",b),e.save({id:a.team.id,controller:"agents"},{agents:b})},deselect:function(b){return e["delete"]({id:a.team.id,controller:"agents",agents:b})}}};a.initView=function(){return e.get({id:c.id}).$promise.then(function(b){a.team=b})["catch"](function(a){g.error(a)})},a.initAgents=function(){return f.get().$promise.then(function(b){return a.agents=b.rows,e.get({id:c.id,controller:"agents"}).$promise}).then(function(b){ComponentsDropdowns.bindTeam(_.map(b.rows,"id"),_.map(a.agents,function(a){return{id:a.id,name:a.name,fullname:a.fullname,internal:a.internal}}),h)})["catch"](function(a){g.error(a)})},a.updateItem=function(){var b=angular.copy(a.team);return e.update({id:c.id},b).$promise.then(function(){g.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){g.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.teams.view",{url:"/view/:id",templateUrl:"app/staff/team/view/view.html",controller:"TeamViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.staff.teams.view.agents",{url:"/agents",templateUrl:"app/staff/team/view/view.agents.html",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/jquery-multi-select/css/multi-select.css","assets/plugins/jquery-multi-select/js/jquery.multi-select.js","assets/plugins/jquery-quicksearch/jquery.quicksearch.js","assets/scripts/components-dropdowns.js"]}])}]}}).state("main.staff.teams.view.settings",{url:"/settings",templateUrl:"app/staff/team/view/view.settings.html"})}]),angular.module("xCallyShuttleApp").controller("TelephoneListCtrl",["$scope","Telephone","gridOptions",function(a,b,c){a.initView=function(){var d={exporterCsvFilename:"telephones.csv",columnDefs:[{name:"fullname"},{name:"name"},{name:"internal"},{name:"description"},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/staff/telephones/view/{{row.entity.id}}/account",name:"profile"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.fullname, row.entity.id)"}]}]};a.gridOptions=c.gridOptions(b,d,a)}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.telephones.list",{url:"/list",templateUrl:"app/staff/telephone/list/list.html",controller:"TelephoneListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").factory("Telephone",["$resource",function(a){return a("/api/telephones/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.telephones",{url:"/telephones",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"landing"}}})}]),angular.module("xCallyShuttleApp").controller("TelephoneViewCtrl",["$scope","$http","$stateParams","$translate","$cookieStore","Auth","xAlert","Telephone",function(a,b,c,d,e,f,g,h){a.initView=function(){return a.Auth=f,a.forms={},h.get({id:c.id}).$promise.then(function(b){delete b.password,a.item=b,a.item.transport=a.item.transport?a.item.transport.split(","):[],a.item.allow=a.item.allow?a.item.allow.split(";"):[]})["catch"](function(a){g.error(a)})},a.updateItem=function(){var b=angular.copy(a.item);return b.transport=b.transport.join(","),b.allow=b.allow.join(";"),h.update(b).$promise.then(function(){g.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){g.error(a)})},a.updatePassword=function(){return h.update({password:a.item.password}).$promise.then(function(){g.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){g.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.telephones.view",{url:"/view/:id",templateUrl:"app/staff/telephone/view/view.html",controller:"TelephoneViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.staff.telephones.view.account",{url:"/account",templateUrl:"app/staff/telephone/view/view.account.html",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css","assets/scripts/jquery.sparkline.min.js","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js","assets/scripts/profile.js"]})}]}}).state("main.staff.telephones.view.voice",{url:"/voice",templateUrl:"app/staff/telephone/view/view.voice.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").controller("TelephoneWizardCtrl",["$scope","$http","$location","WizardHandler","xAlert","$translate","Telephone","Setting",function(a,b,c,d,e,f,g,h){a.forms={},a.item={allow:["alaw","ulaw","gsm"],transport:["udp"],context:"from-sip"},a.next=function(){d.wizard().next()},a.exitValidation=function(a){return a},a.getFirstFreeInternal=function(){return h.get({controller:"internal"}).$promise.then(function(b){a.item.internal=b.value})["catch"](function(a){e.error(a)})},a.createItem=function(){var b=angular.copy(a.item);return b.transport&&(b.transport=b.transport.join(",")),a.item.allow&&(b.allow=b.allow.join(";")),g.save(b).$promise.then(function(){c.path("/staff/telephones/list")})["catch"](function(a){e.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.telephones.wizard",{url:"/wizard",templateUrl:"app/staff/telephone/wizard/wizard.html",controller:"TelephoneWizardCtrl"})}]),angular.module("xCallyShuttleApp").controller("UserListCtrl",["$scope","$timeout","User","Auth","gridOptions",function(a,b,c,d,e){function f(a){if(a){var b=_.words(a),c=_.map(b,function(a){return a?a[0]:""});return c.join("").toUpperCase()}return!1}a.getUserAvatar=function(a,c,d){b(function(){angular.element("#userImg"+a).avatar({useGravatar:!1,initials:d?[]:f(c),fallbackImage:"api/users/avatar/"+d,size:80})})},a.isAdmin=function(a){return"admin"===a},a.initView=function(){var b={exporterCsvFilename:"users.csv",columnDefs:[{name:"fullname"},{name:"name",displayName:"APPLICATION_USERNAME"},{name:"internal"},{name:"email"},{name:"description"},{name:"action",width:100,buttons:[{"class":"blue-hoki",href:"/staff/users/view/{{row.entity.id}}/account",name:"profile"},{"class":"green-meadow",href:"/staff/users/view/{{row.entity.id}}/permit/voice",name:"permits",hide:"grid.appScope.isAdmin(row.entity.role)"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.fullname, row.entity.id)"}]}]};a.gridOptions=e.gridOptions(c,b,a)}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.users.list",{url:"/list",templateUrl:"app/staff/user/list/list.html",controller:"UserListCtrl"})}]),angular.module("xCallyShuttleApp").factory("Module",["$resource",function(a){return a("/api/modules/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("User",["$resource",function(a){return a("/api/users/:id/:controller/:controller2/:controller3",{id:"@id"},{changePassword:{method:"PUT",params:{controller:"password"}},update:{method:"PUT"},me:{method:"GET",params:{id:"me"}}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.users",{url:"/users",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"landing"}}})}]),angular.module("xCallyShuttleApp").controller("UserViewCtrl",["$scope","$stateParams","$cookieStore","$translate","FileUploader","User","Auth","xAlert","MailQueue","VoiceQueue","ChatQueue","FaxQueue","SmsQueue","OpenChannelQueue","Team","Module","Setting",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){function r(b){var c=_.find(a.modules,{id:b.ModuleId});if(b.status===!0)c.status=!0;else{var d=_.filter(c.SubModules,{status:!0});d.length||(c.status=!1)}c.ModuleId&&r(c)}function s(a,b){a.forEach(function(a){a.status=b,a.SubModules&&a.SubModules.length&&s(a.SubModules,b)})}function t(a,b){b.forEach(function(b){_.find(a,{id:b.id})?b.status=!0:b.status=!1,b.SubModules&&b.SubModules.length&&t(a,b.SubModules)})}function u(a,b){return a=_.union(a,_.map(_.filter(b,{status:!0}),"id")),b.forEach(function(b){b.SubModules&&b.SubModules.length&&(a=_.union(a,u(a,b.SubModules)))}),a}a.Auth=g,a._=_,a.moduleSwitch={onText:"On",offText:"Off",isActive:!0,size:"mini",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.initVoiceQueues=function(){var a={},c={};return j.get().$promise.then(function(c){return a.queues=_.map(c.rows,function(a){return{name:a.name}}),f.query({id:b.id,controller:"allowed",controller2:"voice",controller3:"queues"}).$promise}).then(function(a){c.queues=_.map(a,function(a){return{name:a.name}})}).then(function(){ComponentsDropdowns.bindPermit(a,c,"voice",b.id,f)})["catch"](function(a){console.error(a)})},a.initChatQueues=function(){var a={},c={};return k.get().$promise.then(function(c){return a.queues=_.map(c.rows,function(a){return{id:a.id,name:a.name}}),f.query({id:b.id,controller:"allowed",controller2:"chat",controller3:"queues"}).$promise}).then(function(a){c.queues=_.map(a,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindPermit(a,c,"chat",b.id,f)})["catch"](function(a){console.error(a)})},a.initMailQueues=function(){var a={},c={};return i.get().$promise.then(function(c){return a.queues=_.map(c.rows,function(a){
 return{id:a.id,name:a.name}}),f.query({id:b.id,controller:"allowed",controller2:"mail",controller3:"queues"}).$promise}).then(function(a){c.queues=_.map(a,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindPermit(a,c,"mail",b.id,f)})["catch"](function(a){console.error(a)})},a.initSmsQueues=function(){var a={},c={};return m.get().$promise.then(function(c){return a.queues=_.map(c.rows,function(a){return{id:a.id,name:a.name}}),f.query({id:b.id,controller:"allowed",controller2:"sms",controller3:"queues"}).$promise}).then(function(a){c.queues=_.map(a,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindPermit(a,c,"sms",b.id,f)})["catch"](function(a){console.error(a)})},a.initFaxQueues=function(){var a={},c={};return l.get().$promise.then(function(c){return a.queues=_.map(c.rows,function(a){return{id:a.id,name:a.name}}),f.query({id:b.id,controller:"allowed",controller2:"fax",controller3:"queues"}).$promise}).then(function(a){c.queues=_.map(a,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindPermit(a,c,"fax",b.id,f)})["catch"](function(a){console.error(a)})},a.initOpenchannelQueues=function(){var a={},c={};return n.get().$promise.then(function(c){return a.queues=_.map(c.rows,function(a){return{id:a.id,name:a.name}}),f.query({id:b.id,controller:"allowed",controller2:"openchannel",controller3:"queues"}).$promise}).then(function(a){c.queues=_.map(a,function(a){return{id:a.id,name:a.name}})}).then(function(){ComponentsDropdowns.bindPermit(a,c,"openchannel",b.id,f)})["catch"](function(a){console.error(a)})},a.initView=function(){return f.get({id:b.id}).$promise.then(function(b){return a.user=b,a.user.transport=a.user.transport?a.user.transport.split(","):[],a.user.allow=a.user.allow?a.user.allow.split(";"):[],q.get({id:1}).$promise}).then(function(b){a.setting=b})["catch"](function(a){h.error(a)})},a.updateItem=function(){var c=angular.copy(a.user);return delete c.password,delete c.md5secret,c.transport=c.transport.join(","),c.allow=c.allow.join(";"),f.update({id:b.id},c).$promise.then(function(){h.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){h.error(a)})},a.updatePassword=function(){var c={newPassword:a.user.newPwd};return g.isAdmin()?c.id=b.id:c.oldPassword=a.user.currentPwd,f.changePassword(c).$promise.then(function(){h.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){h.error(a)})};var v=a.uploader=new e({url:"api/users/"+b.id+"/avatar",queueLimit:1,withCredentials:!0,headers:{Authorization:"Bearer "+c.get("token")}});v.filters.push({name:"imageFilter",fn:function(a){var b="|"+a.type.slice(a.type.lastIndexOf("/")+1)+"|";return-1!=="|jpg|png|jpeg|".indexOf(b)}}),a.getModules=function(){return a.associatedModules=[],p.get().$promise.then(function(c){return a.modules=_.filter(c.rows,function(a){return!a.ModuleId}),f.query({id:b.id,controller:"allowed",controller2:"modules"}).$promise}).then(function(b){t(b,a.modules)})["catch"](function(a){h.error(a)})},a.updatePermissions=function(c){c.ModuleId&&r(c),c.SubModules&&c.SubModules.length&&s(c.SubModules,c.status);var e=u([],a.modules);return f.save({id:b.id,controller:"allowed",controller2:"modules"},{modules:e}).$promise.then(function(){h.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){h.error(a)})},v.onSuccessItem=function(b,c){a.user.userpic=c.userpic,a.user.id===g.getCurrentUser().id&&(g.getCurrentUser().userpic=c.userpic),h.show(d.instant("MESSAGE_WELL_DONE"),"success")},v.onErrorItem=function(){h.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")},v.onCompleteAll=function(){v.clearQueue()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.users.view",{url:"/view/:id",templateUrl:"app/staff/user/view/view.html",controller:"UserViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.staff.users.view.account",{url:"/account",templateUrl:"app/staff/user/view/view.account.html",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css","assets/scripts/jquery.sparkline.min.js","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js","assets/scripts/profile.js"]})}]}}).state("main.staff.users.view.voice",{url:"/voice",templateUrl:"app/staff/user/view/view.voice.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}}).state("main.staff.users.view.permit",{url:"/permit",templateUrl:"app/staff/user/view/view.permit.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}},cache:!1,serie:!0,resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/jquery-multi-select/css/multi-select.css","assets/plugins/jquery-multi-select/js/jquery.multi-select.js","assets/plugins/jquery-quicksearch/jquery.quicksearch.js","assets/scripts/components-dropdowns.js"]})}]}}).state("main.staff.users.view.permit.voice",{url:"/voice",templateUrl:"app/staff/user/view/view.permit.voice.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}}).state("main.staff.users.view.permit.chat",{url:"/chat",templateUrl:"app/staff/user/view/view.permit.chat.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.chat"}}}).state("main.staff.users.view.permit.mail",{url:"/mail",templateUrl:"app/staff/user/view/view.permit.mail.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.mail"}}}).state("main.staff.users.view.permit.fax",{url:"/fax",templateUrl:"app/staff/user/view/view.permit.fax.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.fax"}}}).state("main.staff.users.view.permit.sms",{url:"/sms",templateUrl:"app/staff/user/view/view.permit.sms.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.sms"}}}).state("main.staff.users.view.permit.openchannel",{url:"/openchannel",templateUrl:"app/staff/user/view/view.permit.openchannel.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.openchannel"}}}).state("main.staff.users.view.permit.modules",{url:"/modules",templateUrl:"app/staff/user/view/view.permit.modules.html",data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").controller("UserWizardCtrl",["$scope","$location","WizardHandler","xAlert","$translate","User","Setting","Auth",function(a,b,c,d,e,f,g,h){a.initWizard=function(){return a.Auht=h,a.forms={info:void 0,voice:void 0},a.item={role:"user",host:"dynamic",context:"from-sip"},g.get({controller:"internal"}).$promise.then(function(b){a.item.internal=b.value})["catch"](function(a){d.error(a)})},a.next=function(){c.wizard().next()},a.exitValidation=function(a){return a},a.createItem=function(){return f.save(a.item).$promise.then(function(){b.path("/staff/users/list")})["catch"](function(a){d.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.staff.users.wizard",{url:"/wizard",templateUrl:"app/staff/user/wizard/wizard.html",controller:"UserWizardCtrl"})}]),angular.module("xCallyShuttleApp").controller("SugarcrmListCtrl",["$scope","SugarcrmAccount","gridOptions","xAlert","$translate","Modal",function(a,b,c,d,e,f){a.initView=function(){var d={exporterCsvFilename:"sugarcrm_account.csv",columnDefs:[{name:"name",displayName:"APPLICATION_NAME"},{name:"username"},{name:"remoteUri",displayName:"APPLICATION_REMOTE_ADDRESS"},{name:"action",width:250,buttons:[{"class":"blue-hoki",href:"/sugarcrm/view/{{row.entity.id}}/account",name:"profile"},{"class":"green-jungle",name:"check",onClick:"grid.appScope.checkAccount(row.entity.id)"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=c.gridOptions(b,d,a)},a.checkAccount=function(a){return b.get({id:a,controller:"check"}).$promise.then(function(){d.show(e.instant("MESSAGE_ACCOUNT_VERIFIED"),"success")})["catch"](function(a){d.show(e.instant("MESSAGE_ACCOUNT_INVALID"),"danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.sugarcrm.list",{url:"/list",templateUrl:"app/sugarcrm/list/list.html",controller:"SugarcrmListCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{name:"smart-table",insertBefore:"#ng_load_plugins_before",files:["assets/css/smart_table.css"]}])}]}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.sugarcrm",{url:"/sugarcrm",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin"],redirectTo:"main.dashboard.voice"}}})}]),angular.module("xCallyShuttleApp").factory("SugarcrmAccount",["$resource",function(a){return a("/api/sugarcrm/accounts/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("SugarcrmConfiguration",["$resource",function(a){return a("/api/sugarcrm/configurations/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").factory("SugarcrmField",["$resource",function(a){return a("/api/sugarcrm/fields/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").controller("SugarcrmViewCtrl",["$scope","$http","$stateParams","$translate","$location","$filter","WizardHandler","socket","xAlert","Modal",function(a,b,c,d,e,f,g,h,i,j){a.$stateParams=c,a.config={autoHideScrollbar:!1,theme:"dark",advanced:{updateOnContentResize:!0},setHeight:500,scrollInertia:0},a.initConfiguration=function(){a.formsConfiguration={},a.configuration={}},a.goNext=function(){g.wizard().next()},a.formValidation=function(a){return a},a.$on("$destroy",function(){h.unsyncUpdates("sugarcrm_configuration"),h.unsyncUpdates("sugarcrm_field")}),a.initView=function(){b.get("/api/sugarcrm/accounts/"+c.id).success(function(b){a.account=b}).error(function(a){i.error(a)})},a.updateItem=function(){b.put("/api/sugarcrm/accounts/"+c.id,a.account).success(function(){i.show(d.instant("MESSAGE_WELL_DONE")+".","success")}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.getConfigurations=function(){b.get("/api/sugarcrm/configurations",{params:{AccountId:c.id}}).success(function(b){a.configurations=b,h.socket.on("sugarcrm_configuration:remove",function(b){_.remove(a.configurations,{id:b.id})})}).error(function(a){i.error(a)})},a.deleteConfiguration=j.confirm["delete"](function(a){b["delete"]("api/sugarcrm/configurations/"+a).success(function(){i.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})}),a.createConfiguration=function(){a.configuration.AccountId=c.id,b.post("api/sugarcrm/configurations",a.configuration).success(function(a){e.path("sugarcrm/view/"+c.id+"/configurations/settings/"+a.id)}).error(function(){i.show("Something went wrong!","danger")})},a.fieldType=["string","variable"],a.descFieldType=["string","key_value"],a.getFields=function(){b.get("/api/sugarcrm/accounts/"+c.id+"/fields").success(function(b){a.accountFields=_.sortByOrder(f("sugarcrm")(_.toArray(b)),"name","asc"),_.forEach(b,function(a){a.options=_.toArray(a.options)})}).error(function(a){i.error(a)})},a.getConfiguration=function(){b.get("/api/sugarcrm/configurations/"+c.configurationId).success(function(b){a.configurationName=b.name,a.subjectConfig=b.Subject,a.descriptionConfig=b.Description,a.fieldConfig=b.Field,h.socket.on("sugarcrm_field:remove",function(b){_.remove(a.subjectConfig,{id:b.id}),_.remove(a.descriptionConfig,{id:b.id}),_.remove(a.fieldConfig,{id:b.id})})}).error(function(a){i.error(a)})},a.getVariables=function(){b.get("/api/variables").success(function(b){a.variables=b.rows}).error(function(a){i.error(a)})},a.removeItem=function(a){b["delete"]("api/sugarcrm/fields/"+a.id).success(function(){i.show(d.instant("MESSAGE_WELL_DONE"),"success")}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG"),"danger")})},a.addItemSubject=function(){var d={type:"string",content:""};b.post("/api/sugarcrm/configurations/"+c.configurationId+"/subject",d).success(function(b){a.subjectConfig.push(b)}).error(function(){i.show("Something went wrong!","danger")})},a.addItemDescription=function(){var d={type:"string",content:""};b.post("/api/sugarcrm/configurations/"+c.configurationId+"/description",d).success(function(b){a.descriptionConfig.push(b)}).error(function(){i.show("Something went wrong!","danger")})},a.addItemField=function(){var d={content:""};b.post("/api/sugarcrm/configurations/"+c.configurationId+"/field",d).success(function(b){a.fieldConfig.push(b)}).error(function(){i.show("Something went wrong!","danger")})},a.updateField=function(a){b.put("/api/sugarcrm/fields/"+a.id,a).success(function(){}).error(function(){i.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})},a.changeType=function(b){"variable"===b.type?b.content="":"string"===b.type&&(b.VariableId=null),a.updateField(b)},a.changeDescType=function(b){"key_value"===b.type?(b.content="","string"===b.keyType?b.VariableId=null:"variable"===b.keyType&&(b.keyContent="")):"string"===b.type&&(b.VariableId=null,b.key="",b.keyContent=""),a.updateField(b)},a.changeFieldType=function(b){b.content="",a.updateField(b)},a.getSystemFieldOptions=function(b){if(b){var c=_.find(a.accountFields,"name",b);return c?c.options.length>0?c.options:null:void 0}}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.sugarcrm.view",{url:"/view/:id",templateUrl:"app/sugarcrm/view/view.html",controller:"SugarcrmViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.sugarcrm.view.account",{url:"/account",templateUrl:"app/sugarcrm/view/view.account.html"}).state("main.sugarcrm.view.configurations",{url:"/configurations",templateUrl:"app/sugarcrm/view/view.configurations.html"}).state("main.sugarcrm.view.configurations.settings",{url:"/settings/:configurationId",templateUrl:"app/sugarcrm/view/view.configurationSettings.html",controller:"SugarcrmViewCtrl"}).state("main.sugarcrm.view.configuration",{url:"/configuration",templateUrl:"app/sugarcrm/view/view.configuration.html"})}]),angular.module("xCallyShuttleApp").controller("SugarcrmkWizardCtrl",["$scope","$http","$location","$translate","xAlert","WizardHandler",function(a,b,c,d,e,f){a.translate=d,a.initWizard=function(){a.$translate=d,a.forms={},a.item={}},a.next=function(){f.wizard().next()},a.exitValidation=function(a){return a},a.createItem=function(){b.post("api/sugarcrm/accounts",a.item).success(function(){e.show(d.instant("MESSAGE_WELL_DONE")+".","success"),c.path("/sugarcrm/list")}).error(function(){e.show(d.instant("MESSAGE_SOMETHING_WENT_WRONG")+".","danger")})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.sugarcrm.wizard",{url:"/wizard",templateUrl:"app/sugarcrm/wizard/wizard.html",controller:"SugarcrmkWizardCtrl"})}]),angular.module("xCallyShuttleApp").factory("CannedAnswer",["$resource",function(a){return a("/api/answers/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.answers",{url:"/answers",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:13}}})}]),angular.module("xCallyShuttleApp").controller("AnswerListCtrl",["$scope","$uibModal","CannedAnswer","gridOptions",function(a,b,c,d){a.initView=function(){var b={exporterCsvFilename:"answers.csv",columnDefs:[{name:"key",displayName:"APPLICATION_NAME"},{name:"value"},{name:"description"},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/tools/answers/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.key, row.entity.id)"}]}]};a.gridOptions=d.gridOptions(c,b,a)},a.createItem=function(){b.open({animation:!0,templateUrl:"app/tools/answer/list/list.create.modal.html",controller:"AnswerListCreateCtrl"}).result.then(function(b){a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("AnswerListCreateCtrl",["$scope","$translate","$uibModalInstance","CannedAnswer","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.answers.list",{url:"/list",templateUrl:"app/tools/answer/list/list.html",controller:"AnswerListCtrl"})}]),angular.module("xCallyShuttleApp").controller("AnswerViewCtrl",["$scope","$http","xAlert","$translate","$stateParams","$location","CannedAnswer",function(a,b,c,d,e,f,g){a.getAnswer=function(){return g.get({id:e.id}).$promise.then(function(b){a.answer=b})["catch"](function(a){c.error(a)})},a.updateAnswer=function(){var b=angular.copy(a.answer);return g.update({id:e.id},b).$promise.then(function(){c.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){c.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.answers.view",{url:"/view/:id",templateUrl:"app/tools/answer/view/view.html",controller:"AnswerViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.tools.answers.view.settings",{url:"/settings",templateUrl:"app/tools/answer/view/view.settings.html"})}]),angular.module("xCallyShuttleApp").factory("Automation",["$resource",function(a){return a("/api/automations/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.automations",{url:"/automations",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:13}}})}]),angular.module("xCallyShuttleApp").controller("AutomationListCtrl",["$scope","$http","$translate","xAlert","Automation","gridOptions",function(a,b,c,d,e,f){a.onText="On",a.offText="Off",a.isActive=!0,a.size="mini",a.animate=!0,a.radioOff=!0,a.handleWidth="auto",a.labelWidth="auto",a.inverse=!0,a.offColor="danger",a.onColor="success",a.initView=function(){var b={exporterCsvFilename:"Automations.csv",columnDefs:[{name:"name"},{name:"description"},{name:"channel"},{name:"status",cellTemplate:'<div class="centered-uigrid-td"><input data-ng-change="grid.appScope.updateItem(row.entity)", bs-switch ng-model="row.entity.status" type="checkbox" switch-active="{{ grid.appScope.isActive }}" switch-on-text="{{ grid.appScope.onText }}" switch-off-text="{{ grid.appScope.offText }}" switch-on-color="{{ grid.appScope.onColor }}" switch-off-color="{{ grid.appScope.offColor }}" switch-animate="{{ grid.appScope.animate }}" switch-size="{{ grid.appScope.size }}" switch-label="{{ grid.appScope.label }}" switch-icon="{{ grid.appScope.icon }}" switch-radio-off="{{ grid.appScope.radioOff }}" switch-label-width="{{ grid.appScope.labelWidth }}" switch-handle-width="{{ grid.appScope.handleWidth }}"></div>',width:100,enableFiltering:!1},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/tools/automations/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=f.gridOptions(e,b,a)},a.updateItem=function(a){return e.update({id:a.id},a).$promise.then(function(){d.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){console.error(a),d.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.automations.list",{url:"/list",templateUrl:"app/tools/automation/list/list.html",controller:"AutomationListCtrl"})}]),angular.module("xCallyShuttleApp").controller("AutomationViewCtrl",["$scope","$stateParams","$http","$translate","xAlert","automations","Automation","$location",function(a,b,c,d,e,f,g,h){a.$automations=f,a.recordSwitch={onText:"On",offText:"Off",isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.forms={general:{}},a.addCondition=function(b){a.automation[b].push({field:"",operator:"",value:""})},a.removeCondition=function(b,c){a.automation[b].splice(c,1)},a.addAction=function(){a.automation.Actions.push({action:"",data1:"",data2:"",data3:"",data4:"",data5:""})},a.resetActionData=function(a){a.data1="",a.data2="",a.data3="",a.data4="",a.data5=""},a.removeAction=function(b){a.automation.Actions.splice(b,1)},a.initView=function(){return g.get({id:b.id}).$promise.then(function(b){a.automation=b})["catch"](function(a){e.error(a),h.path("/tools/automations/list")})},a.updateAutomation=function(){return g.update({id:b.id},a.automation).$promise.then(function(){e.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){console.error(a),e.error(a)})},a.exitValidation=function(b){return console.log(b&&(a.automation.All.length||a.automation.Any.length)&&a.automation.Actions.length),b&&(a.automation.All.length||a.automation.Any.length)&&a.automation.Actions.length?!0:!1}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.automations.view",{url:"/view/:id",templateUrl:"app/tools/automation/view/view.html",controller:"AutomationViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]})}]}}).state("main.tools.automations.view.settings",{url:"/settings",templateUrl:"app/tools/automation/view/view.settings.html"}).state("main.tools.automations.view.routes",{url:"/routes",templateUrl:"app/tools/automation/view/view.routes.html"}).state("main.tools.automations.view.application",{url:"/application",templateUrl:"app/tools/automation/view/view.application.html"})}]),angular.module("xCallyShuttleApp").controller("AutomationWizardCtrl",["$scope","$http","$location","xAlert","automations","WizardHandler","Automation",function(a,b,c,d,e,f,g){a.$automations=e,a.statusSwitch={onText:"On",offText:"Off",isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.tempData={voice:{},mail:{},chat:{},fax:{}},a.item={All:[],Any:[],Actions:[]},a.forms={general:void 0,settings:void 0},a.addCondition=function(b){a.item[b].push({field:"",operator:"",value:""})},a.removeCondition=function(b,c){a.item[b].splice(c,1)},a.addAction=function(){a.item.Actions.push({action:"",data1:"",data2:"",data3:"",data4:"",data5:""})},a.resetActionData=function(a){a.data1="",a.data2="",a.data3="",a.data4="",a.data5=""},a.removeAction=function(b){a.item.Actions.splice(b,1)},a.$watch("item.channel",function(b,c){c&&(a.tempData[c].All=_.clone(a.item.All,!0),a.tempData[c].Any=_.clone(a.item.Any,!0),a.tempData[c].Actions=_.clone(a.item.Actions,!0)),a.item.All=a.tempData[b].All?a.tempData[b].All:[],a.item.Any=a.tempData[b].Any?a.tempData[b].Any:[],a.item.Actions=a.tempData[b].Actions?a.tempData[b].Actions:[]},!0),a.item.channel="mail",a.createItem=function(){return g.save(a.item).$promise.then(function(){c.path("/tools/automations/list")})["catch"](function(a){console.error(a),d.error(a)})},a.next=function(){f.wizard().next()},a.previous=function(){f.wizard().previous()},a.exitValidation=function(a){return a},a.exitSettingsValidation=function(b){return b&&(a.item.All.length||a.item.Any.length)&&a.item.Actions.length?!0:!1}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.automations.wizard",{url:"/wizard",templateUrl:"app/tools/automation/wizard/wizard.html",controller:"AutomationWizardCtrl"})}]),angular.module("xCallyShuttleApp").factory("Interval",["$resource",function(a){return a("/api/intervals/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.intervals",{url:"/intervals",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:13}}})}]),angular.module("xCallyShuttleApp").controller("IntervalListCtrl",["$scope","$uibModal","Interval","gridOptions",function(a,b,c,d){a.initView=function(){var b={exporterCsvFilename:"intervals.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/tools/intervals/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=d.gridOptions(c,b,a)},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/tools/interval/list/list.create.modal.html",controller:"IntervalListCreateCtrl"});c.result.then(function(b){console.log(b),a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("IntervalListCreateCtrl",["$scope","$translate","$uibModalInstance","Interval","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.intervals.list",{url:"/list",templateUrl:"app/tools/interval/list/list.html",controller:"IntervalListCtrl"})}]),angular.module("xCallyShuttleApp").controller("IntervalViewCtrl",["$scope","$http","xAlert","$translate","$stateParams","socket","$location","WizardHandler","Modal","interval",function(a,b,c,d,e,f,g,h,i,j){function k(b){var c,d,e,f;c=b.t_from&&b.t_to&&!b.alwaysTime?moment(b.t_from).format("HH:mm")+"-"+moment(b.t_to).format("HH:mm"):"*",b.wd_from&&"always"!==b.wd_from?(d=b.wd_from,b.wd_to&&"always"!==b.wd_to&&(d+="-"+b.wd_to)):d="*",b.md_from&&"always"!==b.md_from?(e=b.md_from,b.md_to&&"always"!==b.md_to&&(e+="-"+b.md_to)):e="*",b.m_from&&"always"!==b.m_from?(f=b.m_from,b.m_to&&"always"!==b.m_to&&(f+="-"+b.m_to)):f="*",void 0!==a.selectedSubInterval?a.interval.SubIntervals[a.selectedSubInterval].interval=c+","+d+","+e+","+f:a.subinterval.interval=c+","+d+","+e+","+f}a.$translate=d,a.$interval=j.interval,a.selectedSubInterval=void 0,a.gridOptions={columnDefs:[{name:"name",displayName:"APPLICATION_NAME",headerCellFilter:"translate"},{name:"interval",displayName:"APPLICATION_INTERVAL",headerCellFilter:"translate"},{name:"action",displayName:"APPLICATION_ACTION",headerCellFilter:"translate",width:125,cellTemplate:'<a class="btn btn-xs blue-hoki" data-ng-click="grid.appScope.openSubInterval(grid.appScope.gridOptions.data.indexOf(row.entity))">{{\'APPLICATION_SETTINGS\' | translate}}</a><a class="btn btn-xs red-sunglo" data-ng-click="grid.appScope.deleteSubInterval(row.entity.name+\' interval\', grid.appScope.gridOptions.data.indexOf(row.entity))">{{\'APPLICATION_DELETE\' | translate}}</a>'}]},a.forms={subinterval:void 0,general:void 0},a.initSubInterval=function(b){b&&(a.selectedSubInterval=void 0),a.subinterval={},a.splittedInterval={t_from:moment(new Date),t_to:moment(new Date),wd_from:"always",wd_to:"always",md_from:"always",md_to:"always",m_from:"always",m_to:"always",alwaysTime:!0}},a.next=function(){h.wizard().next()},a.previous=function(){h.wizard().previous()},a.exitValidation=function(a){return a},a.deselectAndRedirect=function(b){a.selectedSubInterval=void 0,g.path(b)},a.getInterval=function(){b.get("/api/intervals/"+e.id).success(function(b){a.interval=b,a.gridOptions.data=b.SubIntervals}).error(function(a){console.error(a),g.path("/tools/intervals/list")})},a.openSubInterval=function(b){a.selectedSubInterval=b,g.path("/tools/intervals/view/"+e.id+"/subintervals/settings")},a.updateInterval=function(f){a.selectedSubInterval=void 0,b.put("/api/intervals/"+e.id,a.interval).success(function(){a.getInterval(),c.show(d.instant("MESSAGE_WELL_DONE")+"!","success"),f&&g.path("/tools/intervals/view/"+e.id+"/"+f)}).error(function(a){c.error(a)})},a.getSubInterval=function(){void 0===a.selectedSubInterval&&g.path("/tools/intervals/list"),a.splittedInterval={t_from:moment(new Date),t_to:moment(new Date)};var b,c=a.interval.SubIntervals[a.selectedSubInterval]?a.interval.SubIntervals[a.selectedSubInterval].interval.split(","):["*","*","*","*"];c.forEach(function(c,d){switch(d){case 0:"*"!==c?(b=c.split("-"),a.splittedInterval.t_from=moment(b[0],"HH:mm"),a.splittedInterval.t_to=moment(b[1],"HH:mm"),a.splittedInterval.alwaysTime=!1):(a.splittedInterval.t_from=moment(new Date),a.splittedInterval.t_to=moment(new Date),a.splittedInterval.alwaysTime=!0);break;case 1:"*"!==c?(b=c.split("-"),a.splittedInterval.wd_from=b[0],a.splittedInterval.wd_to=b[1]?b[1]:"always"):(a.splittedInterval.wd_from="always",a.splittedInterval.wd_to="always");break;case 2:"*"!==c?(b=c.split("-"),a.splittedInterval.md_from=b[0],a.splittedInterval.md_to=b[1]?b[1]:"always"):(a.splittedInterval.md_from="always",a.splittedInterval.md_to="always");break;case 3:"*"!==c?(b=c.split("-"),a.splittedInterval.m_from=b[0],a.splittedInterval.m_to=b[1]?b[1]:"always"):(a.splittedInterval.m_from="always",a.splittedInterval.m_to="always")}})},a.$watch("splittedInterval",function(a){a&&k(a)},!0),a.addSubInterval=function(){a.interval.SubIntervals.push(a.subinterval),a.updateInterval("subintervals")},a.deleteSubInterval=i.confirm["delete"](function(b){a.interval.SubIntervals.splice(b,1),a.updateInterval()})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.intervals.view",{url:"/view/:id",templateUrl:"app/tools/interval/view/view.html",controller:"IntervalViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.tools.intervals.view.settings",{url:"/settings",templateUrl:"app/tools/interval/view/view.settings.html"}).state("main.tools.intervals.view.subintervals",{url:"/subintervals",templateUrl:"app/tools/interval/view/view.subintervals.html"}).state("main.tools.intervals.view.subinterval",{url:"/subinterval",templateUrl:"app/tools/interval/view/view.subinterval.html"}).state("main.tools.intervals.view.subintervals.settings",{url:"/settings",templateUrl:"app/tools/interval/view/view.subintervalSettings.html"})}]),angular.module("xCallyShuttleApp").controller("PauseListCtrl",["$scope","$log","$uibModal","$translate","Pause","gridOptions",function(a,b,c,d,e,f){a.initView=function(){var b={exporterCsvFilename:"pauses.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/tools/pauses/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=f.gridOptions(e,b,a)},a.createItem=function(){var b=c.open({animation:!0,templateUrl:"app/tools/pause/list/list.create.modal.html",controller:"PauseListCreateCtrl"});b.result.then(function(b){console.log(b),a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("PauseListCreateCtrl",["$scope","$translate","$uibModalInstance","Pause","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),
 c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.pauses.list",{url:"/list",templateUrl:"app/tools/pause/list/list.html",controller:"PauseListCtrl"})}]),angular.module("xCallyShuttleApp").factory("Pause",["$resource",function(a){return a("/api/pauses/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.pauses",{url:"/pauses",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:13}}})}]),angular.module("xCallyShuttleApp").controller("PauseViewCtrl",["$scope","$http","xAlert","$translate","$stateParams","$location","Pause",function(a,b,c,d,e,f,g){a.getPause=function(){return g.get({id:e.id}).$promise.then(function(b){a.pause=b})["catch"](function(a){c.error(a)})},a.updatePause=function(){var b=angular.copy(a.pause);return g.update({id:e.id},b).$promise.then(function(){c.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){c.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.pauses.view",{url:"/view/:id",templateUrl:"app/tools/pause/view/view.html",controller:"PauseViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.tools.pauses.view.settings",{url:"/settings",templateUrl:"app/tools/pause/view/view.settings.html"})}]),angular.module("xCallyShuttleApp").controller("SchedulerListCtrl",["$scope","Scheduler","gridOptions","xAlert","$translate","socket",function(a,b,c,d,e,f){a._=_,a.switches={isActive:!0,size:"mini",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.scheduleTypes=[{name:"APPLICATION_REPORT_EXTRACTION",value:"report"},{name:"APPLICATION_HISTORY_MOVE",value:"history"},{name:"APPLICATION_DB_BACKUP",value:"backup"}],a.initView=function(){var d={exporterCsvFilename:"Schedules.csv",columnDefs:[{name:"name"},{name:"type",cellTemplate:'<div class="centered-uigrid-td">{{grid.appScope._.find(grid.appScope.scheduleTypes,{value:row.entity.type}).name | translate}}</div>'},{name:"description"},{name:"active",cellTemplate:'<div class="centered-uigrid-td"><input data-ng-change="grid.appScope.updateItem(row.entity)", bs-switch ng-model="row.entity.active" type="checkbox" switch-active="{{ grid.appScope.switches.isActive }}" switch-on-text="{{ \'APPLICATION_YES\' | translate }}" switch-off-text="{{ \'APPLICATION_NO\' | translate }}" switch-on-color="{{ grid.appScope.switches.onColor }}" switch-off-color="{{ grid.appScope.switches.offColor }}" switch-animate="{{ grid.appScope.switches.animate }}" switch-size="{{ grid.appScope.switches.size }}" switch-label="{{ grid.appScope.switches.label }}" switch-icon="{{ grid.appScope.switches.icon }}" switch-radio-off="{{ grid.appScope.switches.radioOff }}" switch-label-width="{{ grid.appScope.switches.labelWidth }}" switch-handle-width="{{ grid.appScope.switches.handleWidth }}"></div>',enableFiltering:!1,enableSorting:!1},{name:"sendMail",displayName:"APPLICATION_SEND_MAIL",cellTemplate:'<div data-ng-if="row.entity.type == \'report\'" class="centered-uigrid-td"><input data-ng-change="grid.appScope.updateItem(row.entity)", bs-switch ng-model="row.entity.sendMail" type="checkbox" switch-active="{{ grid.appScope.switches.isActive }}" switch-on-text="{{ \'APPLICATION_YES\' | translate }}" switch-off-text="{{ \'APPLICATION_NO\' | translate }}" switch-on-color="{{ grid.appScope.switches.onColor }}" switch-off-color="{{ grid.appScope.switches.offColor }}" switch-animate="{{ grid.appScope.switches.animate }}" switch-size="{{ grid.appScope.switches.size }}" switch-label="{{ grid.appScope.switches.label }}" switch-icon="{{ grid.appScope.switches.icon }}" switch-radio-off="{{ grid.appScope.switches.radioOff }}" switch-label-width="{{ grid.appScope.switches.labelWidth }}" switch-handle-width="{{ grid.appScope.switches.handleWidth }}"></div>',enableFiltering:!1,enableSorting:!1},{name:"action",width:100,buttons:[{"class":"blue-hoki",href:"/tools/scheduler/view/{{row.entity.id}}/settings",name:"settings"},{"class":"green-turquoise",name:"run",onClick:"grid.appScope.runSchedule(row.entity.id)"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=c.gridOptions(b,d,a)},a.updateItem=function(a){return b.update({id:a.id},a).$promise.then(function(){d.show(e.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){console.error(a),d.error(a)})},a.runSchedule=function(a){return b.get({id:a,controller:"run"}).$promise.then(function(){d.show(e.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){console.error(a),d.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.scheduler.list",{url:"/list",templateUrl:"app/tools/scheduler/list/list.html",controller:"SchedulerListCtrl"})}]),angular.module("xCallyShuttleApp").factory("Scheduler",["$resource",function(a){return a("/api/scheduler/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.scheduler",{url:"/scheduler",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:13}}})}]),angular.module("xCallyShuttleApp").controller("SchedulerViewCtrl",["$scope","xAlert","$translate","$stateParams","socket","$location","ReportTree","Scheduler","DefaultReport","CustomReport","$timeout","MailServerOut",function(a,b,c,d,e,f,g,h,i,j,k,l){function m(){switch(a.schedule.cronType=a.rangeExec.type,a.rangeExec.type){case"daily":a.schedule.cron="00 "+a.rangeExec.hour+" * * *";break;case"weekly":a.schedule.cron="00 "+a.rangeExec.hour+" * * "+a.rangeExec.weekDays.join(",");break;case"monthly":a.schedule.cron="00 "+a.rangeExec.hour+" "+a.rangeExec.monthDay+" * *"}}function n(b){var c;switch(b.cronType){case"daily":a.rangeExec.hour=Number(b.cron.split(" ")[1]),a.rangeExec.type=b.cronType;break;case"weekly":c=b.cron.split(" "),a.rangeExec.hour=Number(c[1]),c[4].split(",").forEach(function(b){a.rangeExec.weekDays.push(Number(b))}),a.rangeExec.type=b.cronType;break;case"monthly":c=b.cron.split(" "),a.rangeExec.hour=Number(c[1]),a.rangeExec.monthDay=Number(c[2]),a.rangeExec.type=b.cronType;break;case"currentDay":a.switchValues.today=!0}a.$watch("rangeExec",function(b){a.switchValues.today||m()},!0)}a.forms={},a.rangeExec={weekDays:[],monthDay:null,hour:0,type:null},a.initReports=function(){var c;return a.reports=[],a.tempTodayCron=null,g.query().$promise.then(function(b){return a.defaultTreeData=JSON.parse(b[0].tree),a.customTreeData=JSON.parse(b[1].tree),i.get().$promise}).then(function(b){return a.defRep=b.rows,a.defRep.length&&_.forEach(a.defRep,function(b){c=_.find(a.defaultTreeData,{id:b.parent}),c&&(b.parent="Motion Reports - "+c.text,b.type="default")}),j.get().$promise}).then(function(b){return a.cusRep=b.rows,a.cusRep.length&&_.forEach(a.cusRep,function(b){c=_.find(a.customTreeData,{id:b.parent}),c&&(b.parent="Custom Reports - "+c.text,b.type="custom")}),l.get().$promise}).then(function(b){a.mailServers=b.rows;var c=_.find(a.mailServers,{MailAccountId:null});c&&(c.username+=" (custom)")})["catch"](function(a){b.error(a)})},a.initView=function(){return h.get({id:d.id}).$promise.then(function(b){a.schedule=b,n(b)}).then(function(){e.socket.on("schedule:update",function(b){a.schedule.id===b.id&&(a.schedule.active=b.active,a.schedule.sendMail=b.sendMail)})})["catch"](function(a){console.error(a),f.path("/tools/scheduler/list")})},a.refreshSlider=function(){k(function(){a.$broadcast("rzSliderForceRender"),a.refreshSlider=null})},a.monthDays=function(){for(var a=[],b=1;31>=b;b++)a.push(b);return a}(),a.hours=function(){for(var a=[],b=0;23>=b;b++)a.push(b);return a}(),a.setReportTree=function(b){a.schedule.reportType=b.type},a.validitySlider={ceil:24,floor:0,showTicks:!0},a.switchValues={today:!1},a.switches={isActive:!0,size:"mini",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.scheduleTypes=[{name:"APPLICATION_REPORT_EXTRACTION",value:"report"}],a.todayCron=[{name:"15 min",value:"*/15 * * * *"},{name:"30 min",value:"*/30 * * * *"},{name:"1 h",value:"0 * * * *"}],a.reportRanges=[{name:"APPLICATION_PREVIOUS_DAY",value:"yesterday"},{name:"APPLICATION_LAST_SEVEN_DAYS",value:"last7"},{name:"APPLICATION_LAST_THIRTY_DAYS",value:"last30"},{name:"APPLICATION_LAST_MONTH",value:"lastMonth"}],a.cronTypes=[{name:"APPLICATION_DAY",value:"daily"},{name:"APPLICATION_WEEK",value:"weekly"},{name:"APPLICATION_MONTH",value:"monthly"}],a.weekDays=[{name:"APPLICATION_MONDAY",value:1},{name:"APPLICATION_TUESDAY",value:2},{name:"APPLICATION_WEDNESDAY",value:3},{name:"APPLICATION_THURSDAY",value:4},{name:"APPLICATION_FRIDAY",value:5},{name:"APPLICATION_SATURDAY",value:6},{name:"APPLICATION_SUNDAY",value:0}],a.checkToday=function(){a.switchValues.today?(a.schedule.cron=angular.copy(a.tempTodayCron),a.schedule.cronType="currentDay"):(a.tempTodayCron=angular.copy(a.schedule.cron),a.schedule.cron=void 0,m())},a.updateSchedule=function(){return h.update({id:a.schedule.id},a.schedule).$promise.then(function(){b.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){console.error(a),b.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.scheduler.view",{url:"/view/:id",templateUrl:"app/tools/scheduler/view/view.html",controller:"SchedulerViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.tools.scheduler.view.settings",{url:"/settings",templateUrl:"app/tools/scheduler/view/view.settings.html"})}]),angular.module("xCallyShuttleApp").controller("SchedulerWizardCtrl",["$scope","WizardHandler","$location","xAlert","Scheduler","ReportTree","$translate","DefaultReport","CustomReport","MailServerOut",function(a,b,c,d,e,f,g,h,i,j){function k(){switch(a.item.cronType=a.rangeExec.type,a.rangeExec.type){case"daily":a.item.cron="00 "+a.rangeExec.hour+" * * *";break;case"weekly":a.item.cron="00 "+a.rangeExec.hour+" * * "+a.rangeExec.weekDays.join(",");break;case"monthly":a.item.cron="00 "+a.rangeExec.hour+" "+a.rangeExec.monthDay+" * *"}}a.forms={},a.item={validityStart:8,validityEnd:16,type:"report",reportType:"default"},a.initReports=function(){a.reports=[];var b;return f.query().$promise.then(function(b){return a.defaultTreeData=JSON.parse(b[0].tree),a.customTreeData=JSON.parse(b[1].tree),h.get().$promise}).then(function(c){return a.defRep=c.rows,a.defRep.length&&_.forEach(a.defRep,function(c){b=_.find(a.defaultTreeData,{id:c.parent}),b&&(c.parent="Motion Reports - "+b.text,c.type="default")}),i.get().$promise}).then(function(c){return a.cusRep=c.rows,a.cusRep.length&&_.forEach(a.cusRep,function(c){b=_.find(a.customTreeData,{id:c.parent}),b&&(c.parent="Custom Reports - "+b.text,c.type="custom")}),j.get().$promise}).then(function(b){a.mailServers=b.rows;var c=_.find(a.mailServers,{MailAccountId:null});c&&(c.username+=" (custom)")})["catch"](function(a){d.error(a)})},a.setReportTree=function(b){a.item.reportType=b.type},a.validitySlider={ceil:24,floor:0,showTicks:!0},a.switchValues={today:!1},a.switches={isActive:!0,size:"mini",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.scheduleTypes=[{name:"APPLICATION_REPORT_EXTRACTION",value:"report"}],a.todayCron=[{name:"15 min",value:"*/15 * * * *"},{name:"30 min",value:"*/30 * * * *"},{name:"1 h",value:"0 * * * *"}],a.reportRanges=[{name:"APPLICATION_PREVIOUS_DAY",value:"yesterday"},{name:"APPLICATION_LAST_SEVEN_DAYS",value:"last7"},{name:"APPLICATION_LAST_THIRTY_DAYS",value:"last30"},{name:"APPLICATION_LAST_MONTH",value:"lastMonth"}],a.cronTypes=[{name:"APPLICATION_DAY",value:"daily"},{name:"APPLICATION_WEEK",value:"weekly"},{name:"APPLICATION_MONTH",value:"monthly"}],a.weekDays=[{name:"APPLICATION_MONDAY",value:1},{name:"APPLICATION_TUESDAY",value:2},{name:"APPLICATION_WEDNESDAY",value:3},{name:"APPLICATION_THURSDAY",value:4},{name:"APPLICATION_FRIDAY",value:5},{name:"APPLICATION_SATURDAY",value:6},{name:"APPLICATION_SUNDAY",value:0}],a.tempTodayCron=null,a.checkToday=function(){a.switchValues.today?(a.item.cron=angular.copy(a.tempTodayCron),a.item.cronType="currentDay"):(a.tempTodayCron=angular.copy(a.item.cron),a.item.cron=void 0,k())},a.monthDays=function(){for(var a=[],b=1;31>=b;b++)a.push(b);return a}(),a.hours=function(){for(var a=[],b=0;23>=b;b++)a.push(b);return a}(),a.rangeExec={weekDays:[],monthDay:null,hour:0,type:null},a.$watch("rangeExec",function(b){a.switchValues.today||k()},!0),a.next=function(){b.wizard().next()},a.previous=function(){b.wizard().previous()},a.exitValidation=function(a){return a},a.createItem=function(){return e.save(a.item).$promise.then(function(){c.path("/tools/scheduler/list")})["catch"](function(a){d.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.scheduler.wizard",{url:"/wizard",templateUrl:"app/tools/scheduler/wizard/wizard.html",controller:"SchedulerWizardCtrl"})}]),angular.module("xCallyShuttleApp").controller("SoundListCtrl",["$scope","$http","socket","Modal","$q","FileUploader","$translate","xAlert","$cookieStore","$sce","Sound",function(a,b,c,d,e,f,g,h,i,j,k){a.Sound=k,a.isCollapsed=!0,a.downloadButtonClass="btn btn-xs blue-hoki",a["delete"]=d.confirm["delete"](function(a){b["delete"]("/api/sounds/"+a).success(function(a){}).error(function(a){console.log(a)})}),a.updateAudio=function(a,c){var d=e.defer();return b.put("/api/sounds/"+a,c).success(function(a){d.resolve()}).error(function(a){console.log(a.message),d.reject(a.message)}),d.promise},a.$on("$destroy",function(){c.unsyncUpdates("sound")}),a.initList=function(){b.get("/api/sounds").success(function(b){a.sounds=b.rows,b.rows.length||(a.isCollapsed=!1),c.syncUpdates("sound",a.sounds,function(){a.sounds.length||(a.isCollapsed=!1)})})};var l=a.uploader=new f({url:"/api/sounds",withCredentials:!0,headers:{Authorization:"Bearer "+i.get("token")}});l.filters.push({name:"customFilter",fn:function(a,b){return this.queue.length<10}}),l.onWhenAddingFileFailed=function(a,b,c){console.info("onWhenAddingFileFailed",a,b,c)},l.onAfterAddingFile=function(a){console.info("onAfterAddingFile",a)},l.onAfterAddingAll=function(a){console.info("onAfterAddingAll",a)},l.onBeforeUploadItem=function(a){console.info("onBeforeUploadItem",a)},l.onProgressItem=function(a,b){console.info("onProgressItem",a,b),a.isUploading=!0},l.onProgressAll=function(a){console.info("onProgressAll",a)},l.onSuccessItem=function(a,b,c,d){console.info("onSuccessItem",a,b,c,d),a.isUploading=!1},l.onErrorItem=function(a,b,c,d){console.info("onErrorItem",a,b,c,d),a.responseMessage=b,a.isUploading=!1},l.onCancelItem=function(a,b,c,d){console.info("onCancelItem",a,b,c,d),a.isUploading=!1},l.onCompleteItem=function(a,b,c,d){console.info("onCompleteItem",a,b,c,d),a.isUploading=!1},l.onCompleteAll=function(){console.info("onCompleteAll")}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.sounds.list",{url:"/list",templateUrl:"app/tools/sound/list/list.html",controller:"SoundListCtrl",authenticate:!0,resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js"]})}]}})}]),angular.module("xCallyShuttleApp").factory("Sound",["$resource",function(a){return a("/api/sounds/:id/:controller",{name:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.sounds",{url:"/sounds",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:13}}})}]),angular.module("xCallyShuttleApp").controller("TagListCtrl",["$scope","$uibModal","Tag","gridOptions","$rootScope",function(a,b,c,d,e){a.initView=function(){var b={exporterCsvFilename:"tag.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/tools/tags/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=d.gridOptions(c,b,a)},a.createItem=function(){var c=b.open({animation:!0,templateUrl:"app/tools/tag/list/list.create.modal.html",controller:"TagListCreateCtrl"});c.result.then(function(){a.gridOptions.getPage()})}}]),angular.module("xCallyShuttleApp").controller("TagListCreateCtrl",["$scope","$translate","$uibModalInstance","Tag","xAlert",function(a,b,c,d,e){a.form={},a.item={},a.save=function(){return d.save(a.item).$promise.then(function(a){e.show(b.instant("MESSAGE_WELL_DONE"),"success"),c.close(a)})["catch"](function(a){e.error(a)})},a.cancel=function(){c.dismiss()}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.tags.list",{url:"/list",templateUrl:"app/tools/tag/list/list.html",controller:"TagListCtrl"})}]),angular.module("xCallyShuttleApp").factory("Tag",["$resource",function(a){return a("/api/tags/:id/:controller/:tag",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.tags",{url:"/tags",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:13}}})}]),angular.module("xCallyShuttleApp").controller("TagViewCtrl",["$scope","$http","xAlert","$translate","$stateParams","$location","Tag","gridOptions","List","Company","Contact","uiGridConstants","usSpinnerService",function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){m.stop("spinner-grid"),a.readyGrid=!0}a.getTag=function(){return g.get({id:e.id}).$promise.then(function(b){a.tag=b})["catch"](function(a){c.error(a)})},a.updateTag=function(){var b=angular.copy(a.tag);return g.update({id:e.id},b).$promise.then(function(){c.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){c.error(a)})},a.initChat=function(){m.spin("spinner-grid");var b={enableRowSelection:!1,exporterCsvFilename:"tagChat.csv",columnDefs:[{name:"type"},{name:"status"},{name:"ChatWebsite.name",displayName:"APPLICATION_WEBSITE"},{name:"ChatVisitor.email",displayName:"APPLICATION_VISITOR"},{name:"action",width:40,buttons:[{"class":"green",name:"chatRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'chatRoom')"}]}]};a.gridOptions=h.gridOptions(g,b,a,{controller:"chat",tag:a.tag.name},null,null,n())},a.initMail=function(){m.spin("spinner-grid");var b={enableRowSelection:!1,exporterCsvFilename:"tagMail.csv",columnDefs:[{name:"subject"},{name:"from"},{name:"account"},{name:"status"},{name:"action",width:40,buttons:[{"class":"green",name:"mailRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'mailRoom')"}]}]};a.gridOptions=h.gridOptions(g,b,a,{controller:"mail",tag:a.tag.name},null,null,n())},a.initFax=function(){m.spin("spinner-grid");var b={enableRowSelection:!1,exporterCsvFilename:"tagFax.csv",columnDefs:[{name:"from"},{name:"account"},{name:"status"},{name:"action",width:40,buttons:[{"class":"green",name:"faxRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'faxRoom')"}]}]};a.gridOptions=h.gridOptions(g,b,a,{controller:"fax",tag:a.tag.name},null,null,n())},a.initSms=function(){m.spin("spinner-grid");var b={enableRowSelection:!1,exporterCsvFilename:"tagSms.csv",columnDefs:[{name:"from"},{name:"status"},{name:"action",width:40,buttons:[{"class":"green",name:"smsRoom",onClick:"grid.appScope.openRoom(row.entity.id, 'smsRoom')"}]}]};a.gridOptions=h.gridOptions(g,b,a,{controller:"sms",tag:a.tag.name},null,null,n())},a.initContacts=function(){a.readyGrid=!1,m.spin("spinner-grid");var b;return i.get().$promise.then(function(b){return a.lists=[],b.rows.forEach(function(b,c){a.lists.push({value:b.id,label:b.name})}),j.get().$promise}).then(function(b){a.companies=[],b.rows.forEach(function(b,c){a.companies.push({value:b.id,label:b.name})})}).then(function(){b={enableRowSelection:!1,exporterCsvFilename:"tagContacts.csv",columnDefs:[{name:"firstName"},{name:"lastName"},{name:"phone"},{name:"email"},{name:"ListId",displayName:"APPLICATION_LIST",field:"List.name",filter:{type:l.filter.SELECT,selectOptions:a.lists}},{name:"CompanyId",displayName:"APPLICATION_COMPANY",field:"Company.name",filter:{type:l.filter.SELECT,term:e.companyId||null,selectOptions:a.companies}},{name:"action",width:40,buttons:[{"class":"blue-hoki",name:"profile",onClick:"grid.appScope.openContactTab(row.entity)"}]}]},a.gridOptions=h.gridOptions(g,b,a,{controller:"contacts",tag:a.tag.name},null,null,n())})["catch"](function(a){c.error(a)})},a.openRoom=function(b,c){var d=_.find(a.workspaces,{id:b,type:c});if(d)d.active=!0;else{var e;switch(c){case"mailRoom":e="icon-envelope";break;case"chatRoom":e="fa fa-users";break;case"faxRoom":e="icon-paper-plane";break;case"smsRoom":e="glyphicon glyphicon-comment"}a.workspaces.push({id:b,type:c,"class":e,active:!0})}}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.tags.view",{url:"/view/:id",templateUrl:"app/tools/tag/view/view.html",controller:"TagViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.tools.tags.view.settings",{url:"/settings",templateUrl:"app/tools/tag/view/view.settings.html"}).state("main.tools.tags.view.chat",{url:"/chat",templateUrl:"app/tools/tag/view/view.chat.html"}).state("main.tools.tags.view.mail",{url:"/mail",templateUrl:"app/tools/tag/view/view.mail.html"}).state("main.tools.tags.view.fax",{url:"/fax",templateUrl:"app/tools/tag/view/view.fax.html"}).state("main.tools.tags.view.sms",{url:"/sms",templateUrl:"app/tools/tag/view/view.sms.html"}).state("main.tools.tags.view.contacts",{url:"/contacts",templateUrl:"app/tools/tag/view/view.contacts.html"})}]),angular.module("xCallyShuttleApp").controller("TemplateListCtrl",["$scope","Template","gridOptions",function(a,b,c){a.initView=function(){var d={exporterCsvFilename:"templates.csv",columnDefs:[{name:"name"},{name:"description"},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/tools/templates/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=c.gridOptions(b,d,a)}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.templates.list",{url:"/list",templateUrl:"app/tools/template/list/list.html",controller:"TemplateListCtrl"})}]),angular.module("xCallyShuttleApp").factory("Template",["$resource",function(a){return a("/api/templates/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.templates",{url:"/templates",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:13}}})}]),angular.module("xCallyShuttleApp").controller("TemplateViewCtrl",["$scope","$rootScope","$http","$translate","$stateParams","xAlert","Template","templateVariable","Variable",function(a,b,c,d,e,f,g,h,i){a.initItem=function(){CKEDITOR.plugins.addExternal("richparams","/assets/plugins/ckeditor-richparams/"),a.options={language:b.language,allowedContent:!0,entities:!1,skin:"office2013",contentsCss:"/assets/css/global/richparams.css",extraPlugins:"richparams,autogrow",autoGrow_minHeight:450,richparams:h,disableNativeSpellChecker:!1,toolbar:[{name:"clipboard",items:["Cut","Copy","Paste","PasteText","PasteFromWord","-","Undo","Redo"]},{name:"links",items:["Link","Unlink","Anchor"]},{name:"insert",items:["Image","Table","HorizontalRule","SpecialChar"]},{name:"tools",items:["Maximize"]},{name:"document",items:["Source"]},"/",{name:"basicstyles",items:["Bold","Italic","Underline","Strike","Subscript","Superscript","-","RemoveFormat"]},{name:"paragraph",items:["NumberedList","BulletedList","-","Outdent","Indent","-","Blockquote"]},{name:"styles",items:["Styles","Format"]},"/",{name:"motion",items:["voice","chat","mail"]}]},a.form={},a.item={},a.item=g.get({id:e.id})},a.updateItem=function(){return g.update(a.item).$promise.then(function(){f.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){f.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.templates.view",{url:"/view/:id",templateUrl:"app/tools/template/view/view.html",controller:"TemplateViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load([{insertBefore:"#ng_load_plugins_before",files:["assets/plugins/bootstrap-fileinput/bootstrap-fileinput.css","assets/css/profile.css","assets/css/tasks.css"]}])}]}}).state("main.tools.templates.view.settings",{url:"/settings",templateUrl:"app/tools/template/view/view.settings.html"})}]),angular.module("xCallyShuttleApp").controller("TemplateWizardCtrl",["$scope","$rootScope","$location","$http","WizardHandler","xAlert","Template","templateVariable",function(a,b,c,d,e,f,g,h){a.initWizard=function(){CKEDITOR.plugins.addExternal("richparams","/assets/plugins/ckeditor-richparams/"),a.options={language:b.language,allowedContent:!0,entities:!1,skin:"office2013",contentsCss:"/assets/css/global/richparams.css",extraPlugins:"richparams,autogrow",autoGrow_minHeight:450,disableNativeSpellChecker:!1,richparams:h,toolbar:[{name:"clipboard",items:["Cut","Copy","Paste","PasteText","PasteFromWord","-","Undo","Redo"]},{name:"links",items:["Link","Unlink","Anchor"]},{name:"insert",items:["Image","Table","HorizontalRule","SpecialChar"]},{name:"tools",items:["Maximize"]},{name:"document",items:["Source"]},"/",{name:"basicstyles",items:["Bold","Italic","Underline","Strike","Subscript","Superscript","-","RemoveFormat"]},{name:"paragraph",items:["NumberedList","BulletedList","-","Outdent","Indent","-","Blockquote"]},{name:"styles",items:["Styles","Format"]},"/",{name:"motion",items:["voice","chat","mail"]}]},a.item={},a.form={}},a.exitValidation=function(a){return a},a.createItem=function(){return g.save({name:a.item.name,description:a.item.description,subject:a.item.subject||null,html:a.item.html||null,text:a.item.text||null}).$promise.then(function(){c.path("/tools/templates/list")})["catch"](function(a){f.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.templates.wizard",{url:"/wizard",templateUrl:"app/tools/template/wizard/wizard.html",controller:"TemplateWizardCtrl"})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools",{url:"/tools",template:"<div ui-view></div>","abstract":!0})}]),angular.module("xCallyShuttleApp").controller("TriggerListCtrl",["$scope","$http","$translate","Modal","xAlert","Trigger","gridOptions",function(a,b,c,d,e,f,g){a.onText="On",a.offText="Off",a.isActive=!0,a.size="mini",a.animate=!0,a.radioOff=!0,a.handleWidth="auto",a.labelWidth="auto",a.inverse=!0,a.offColor="danger",a.onColor="success",a.initView=function(){var b={exporterCsvFilename:"Triggers.csv",columnDefs:[{name:"name"},{name:"description"},{name:"channel"},{name:"status",cellTemplate:'<div class="centered-uigrid-td"><input data-ng-change="grid.appScope.updateItem(row.entity)", bs-switch ng-model="row.entity.status" type="checkbox" switch-active="{{ grid.appScope.isActive }}" switch-on-text="{{ grid.appScope.onText }}" switch-off-text="{{ grid.appScope.offText }}" switch-on-color="{{ grid.appScope.onColor }}" switch-off-color="{{ grid.appScope.offColor }}" switch-animate="{{ grid.appScope.animate }}" switch-size="{{ grid.appScope.size }}" switch-label="{{ grid.appScope.label }}" switch-icon="{{ grid.appScope.icon }}" switch-radio-off="{{ grid.appScope.radioOff }}" switch-label-width="{{ grid.appScope.labelWidth }}" switch-handle-width="{{ grid.appScope.handleWidth }}"></div>',width:100,enableFiltering:!1},{name:"action",width:75,buttons:[{"class":"blue-hoki",href:"/tools/triggers/view/{{row.entity.id}}/settings",name:"settings"},{"class":"red-sunglo",name:"delete",onClick:"grid.appScope.deleteItem(row.entity.name, row.entity.id)"}]}]};a.gridOptions=g.gridOptions(f,b,a)},a.updateItem=function(a){return f.update({id:a.id},a).$promise.then(function(){e.show(c.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){e.error(a)})}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.triggers.list",{url:"/list",templateUrl:"app/tools/trigger/list/list.html",controller:"TriggerListCtrl"})}]),angular.module("xCallyShuttleApp").factory("Trigger",["$resource",function(a){return a("/api/triggers/:id/:controller",{id:"@id"},{update:{method:"PUT"}})}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.triggers",{url:"/triggers",template:"<div ui-view></div>","abstract":!0,data:{permissions:{only:["admin","user"],redirectTo:"landing",id:13}}})}]),angular.module("xCallyShuttleApp").controller("TriggerViewCtrl",["$scope","$stateParams","$http","$translate","xAlert","triggers","Trigger","$location",function(a,b,c,d,e,f,g,h){a.$triggers=f,a.recordSwitch={onText:"On",offText:"Off",isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.forms={general:{}},a.addCondition=function(b){a.trigger[b].push({field:"",operator:"",value:""})},a.removeCondition=function(b,c){a.trigger[b].splice(c,1)},a.addAction=function(){a.trigger.Actions.push({action:"",data1:"",data2:"",data3:"",data4:"",data5:""})},a.resetActionData=function(a){a.data1="",a.data2="",a.data3="",a.data4="",a.data5=""},a.removeAction=function(b){a.trigger.Actions.splice(b,1)},a.initView=function(){return g.get({id:b.id}).$promise.then(function(b){a.trigger=b})["catch"](function(a){e.error(a),h.path("/tools/triggers/list")})},a.updateTrigger=function(){return g.update({id:b.id},a.trigger).$promise.then(function(){e.show(d.instant("MESSAGE_WELL_DONE"),"success")})["catch"](function(a){console.error(a),e.error(a)})},a.exitValidation=function(b){return b&&(a.trigger.All.length||a.trigger.Any.length)&&a.trigger.Actions.length?!0:!1}}]),angular.module("xCallyShuttleApp").config(["$stateProvider",function(a){a.state("main.tools.triggers.view",{url:"/view/:id",templateUrl:"app/tools/trigger/view/view.html",controller:"TriggerViewCtrl",resolve:{deps:["$ocLazyLoad",function(a){return a.load({insertBefore:"#ng_load_plugins_before",files:["assets/css/profile.css","assets/css/tasks.css"]})}]}}).state("main.tools.triggers.view.settings",{url:"/settings",templateUrl:"app/tools/trigger/view/view.settings.html"}).state("main.tools.triggers.view.routes",{url:"/routes",templateUrl:"app/tools/trigger/view/view.routes.html"}).state("main.tools.triggers.view.application",{url:"/application",templateUrl:"app/tools/trigger/view/view.application.html"})}]),angular.module("xCallyShuttleApp").controller("TriggerWizardCtrl",["$scope","$http","$location","xAlert","triggers","WizardHandler","Trigger",function(a,b,c,d,e,f,g){a.$triggers=e,a.statusSwitch={onText:"On",offText:"Off",isActive:!0,size:"small",animate:!0,radioOff:!0,handleWidth:"auto",labelWidth:"auto",inverse:!0,offColor:"danger",onColor:"success"},a.tempData={voice:{},mail:{},chat:{},fax:{}},a.item={All:[],
index 405bb05..598f36b 100644 (file)
@@ -50,7 +50,7 @@
     <![endif]-->
     <script src="app/037c0eef.vendor.js"></script>
 
-    <script src="app/9815d674.app.js"></script>
+    <script src="app/b742896d.app.js"></script>
 
     <!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
     <!-- BEGIN CORE PLUGINS -->