1'use strict' 2var app=angular.module('doselectWeb',['doselectWebAppConfig','ngMaterial','doselectWebControllers','chCommonDirectives','doselectWebDirectives','doselectWebFilters']).config(['$locationProvider','$sceDelegateProvider',function($locationProvider,$sceDelegateProvider){$locationProvider.html5Mode({enabled:true,rewriteLinks:false}) 3var resourceUrls=[];if(globals.frontEndWhiteListResourceUrls){resourceUrls=globals.frontEndWhiteListResourceUrls 4delete globals.frontEndWhiteListResourceUrls} 5$sceDelegateProvider.resourceUrlWhitelist(["self","https://assets.doselect.com/**","https://assets.central.d1.sg1.chsh.in/**","https://assets.central.stg2.sg1.chsh.in/**","https://assets.central.stg3.sg1.chsh.in/**","https://assets.central.stg.sg1.chsh.in/**","https://assets.fn-assessments.chsh.in/**","https://*.central.d1.sg1.chsh.in/**/*.*","https://*.central.stg2.sg1.chsh.in/**/*.*","https://*.central.stg3.sg1.chsh.in/**/*.*","https://*.central.stg.sg1.chsh.in/**/*.*","https://*.fn-assessments.chsh.in/**/*.*","https://*.firstnaukri.com/**/*","https://assets.central.d2.sg1.chsh.in/**","https://*.central.d2.sg1.chsh.in/**/*.*","https://assets.central.d3.sg1.chsh.in/**","https://*.central.d3.sg1.chsh.in/**/*.*","https://assets.central.d4.sg1.chsh.in/**","https://*.central.d4.sg1.chsh.in/**/*.*","https://assets.central.d5.sg1.chsh.in/**","https://*.central.d5.sg1.chsh.in/**/*.*","https://assets.central.d6.sg1.chsh.in/**","https://*.central.d6.sg1.chsh.in/**/*.*","https://assets.central.d7.sg1.chsh.in/**","https://*.central.d7.sg1.chsh.in/**/*.*","https://assets.central.d8.sg1.chsh.in/**","https://*.central.d8.sg1.chsh.in/**/*.*","https://assets.fn-assessments1.chsh.in/**","https://*.fn-assessments1.chsh.in/**/*.*","https://assets.fn-assessments2.chsh.in/**","https://*.fn-assessments2.chsh.in/**/*.*","https://assets.fn-assessments3.chsh.in/**","https://*.fn-assessments3.chsh.in/**/*.*","https://assets.fn-assessments4.chsh.in/**","https://*.fn-assessments4.chsh.in/**/*.*","https://assets.fn-assessments5.chsh.in/**","https://*.fn-assessments5.chsh.in/**/*.*","https://assets.fn-assessments6.chsh.in/**","https://*.fn-assessments6.chsh.in/**/*.*","https://assets.fn-assessments7.chsh.in/**","https://*.fn-assessments7.chsh.in/**/*.*","https://assets.fn-assessments8.chsh.in/**","https://*.fn-assessments8.chsh.in/**/*.*","https://*.fn-assessments.central.stg.sg1.chsh.in/**/*.*","https://assets.fn-assessments.central.stg.sg1.chsh.in/**","https://*.fn-assessments.central.stg.sg1.chsh.in/**","https://assets.assessment.nc.naukri.com/**","https://static.assessment.nc.naukri.com/**","https://*.assessment.nc.naukri.com/**/*.*","https://*.onlinetest.nc.naukri.com/**/*.*","https://*.contest.nc.naukri.com/**/*.*","https://*.fn-hackathon-ui.nc.naukri.com/**/*.*","https://assets.staging.assessment.nc.naukri.com/**","https://static.staging.assessment.nc.naukri.com/**","https://*.staging.assessment.nc.naukri.com/**/*.*","https://*.staging.onlinetest.nc.naukri.com/**/*.*","https://*.staging.contest.nc.naukri.com/**/*.*","https://*.staging.fn-hackathon-ui.nc.naukri.com/**/*.*",].concat(resourceUrls));}]);angular.module('chCommonDirectives',[]).directive('resize',['$window',function($window){return{compile:function(elm,attrs){var win=angular.element($window) 6elm.css('height',(win[0].innerHeight-parseInt(attrs.resizeOffset))+'px') 7return function(scope,elem,attrs){var win=angular.element($window) 8win.bind('resize',function(e){var w=win[0] 9elem.css('height',(w.innerHeight-parseInt(attrs.resizeOffset))+'px')})}}}}]).directive('geoPattern',[function(){return{scope:{geoPattern:'@',geoPatternImg:'@',geoPatternOptions:'=?'},compile:function(elm,attrs){return function(scope,elm,attrs){scope.geoPatternOptions=scope.geoPatternOptions||{} 10var p=GeoPattern.generate(scope.geoPattern,scope.geoPatternOptions).toDataUrl()+'fixed' 11if(scope.geoPatternImg){var p1='url('+scope.geoPatternImg+') no-repeat, '+p 12elm.css('background','linear-gradient(rgba(0,0,0,0.1),rgba(0,0,0,0.9)),'+p1) 13elm.css('background-size','cover')}else{elm.css('background','linear-gradient(rgba(0,0,0,0.1),rgba(0,0,0,0.9)),'+p)} 14attrs.$observe('geoPatternImg',function(){var p2='url('+scope.geoPatternImg+') no-repeat, '+p 15elm.css('background','linear-gradient(rgba(0,0,0,0.1),rgba(0,0,0,0.9)),'+p2) 16elm.css('background-size','cover')}) 17if(_.has(attrs,'geoPatternOptions')){scope.$watch('geoPatternOptions',function(newValue,oldValue,scope){p=GeoPattern.generate(scope.geoPattern,scope.geoPatternOptions).toDataUrl()+'fixed' 18elm.css('background','linear-gradient(rgba(0,0,0,0.1),rgba(0,0,0,0.9)),'+p)})}}}}}]).directive('uiSrefDynamic',['$rootScope',function($rootScope){return{restrict:'AE',scope:{stateName:'@',stateParams:'='},replace:true,template:"<a href='{$href$}'></a>",compile:function(elm,attrs){return function(scope,elm,attrs){scope.href=$rootScope.$state.href(scope.stateName,scope.stateParams)}}}}]).directive('stateSpy',['$rootScope',function($rootScope){return{restrict:'A',scope:{stateSpy:'@'}
18,compile:function(elm,attrs){return function(scope,elm,attrs){if($rootScope.$state.current.name==scope.stateSpy){angular.element(elm).addClass('active')}else{angular.element(elm).removeClass('active')} 19$rootScope.$on('$stateChangeSuccess',function(event,toState,toParams,fromState,fromParams){if(toState.name==scope.stateSpy){angular.element(elm).addClass('active')}else{angular.element(elm).removeClass('active')}})}}}}]).directive('tabStateSpy',['$rootScope',function($rootScope){var updateMarker=function(elm){elm=angular.element(elm) 20var newIndex=_.findIndex(elm.isolateScope().$mdTabsCtrl.tabs,function(tab){return(tab.element[0].attributes.state.value==$rootScope.$state.current.name)})||0 21var tabScope=elm.isolateScope() 22$rootScope.selectedIndex=newIndex 23tabScope.$evalAsync()} 24return{restrict:'A',link:function(scope,elm,attrs){updateMarker(elm) 25var markerListener=$rootScope.$on('$stateChangeSuccess',function(event,toState,toParams,fromState,fromParams){updateMarker(elm)}) 26scope.$on('$destroy',function(){markerListener()})}}}]).directive('fileReader',function(){return{scope:{fileReader:'=',fileReaderType:'@'},link:function(scope,element){element.bind('change',function(changeEvent){var files=changeEvent.target.files 27if(files.length){var r=new FileReader() 28r.onload=function(e){var contents=e.target.result 29scope.$apply(function(){scope.fileReader=contents})} 30if(scope.fileReaderType==='text'){r.readAsText(files[0])}else if(scope.fileReaderType==='image'){r.readAsDataURL(files[0])}}})}}}).directive('mref',['$mdDialog',function($mdDialog){return{scope:{mref:'@',mrefData:'='},link:function(scope,element){element.bind('click',function(event){$mdDialog.show({templateUrl:tUrl(scope.mref),parent:angular.element(document.body),targetEvent:event,controller:['$scope','$mdDialog','$rootScope',function($scope,$mdDialog,$rootScope){$scope.data=scope.mrefData 31$scope.cancel=$mdDialog.cancel}]})})}}}]).directive('starButton',[function(){return{restrict:'E',replace:true,scope:{object:'='},templateUrl:tRootUrl('directives/star-button.html'),controller:['$scope','Restangular',function($scope,Restangular){$scope.star=function(state){return $scope.object.patch({starred:state}).then(function(r){angular.copy(r,$scope.object)})}}]}}]).directive('scrollGlue',['$parse',function($parse){function unboundState(initValue){var activated=initValue 32return{getValue:function(){return activated},setValue:function(value){activated=value}}} 33function oneWayBindingState(getter,scope){return{getValue:function(){return getter(scope)},setValue:function(){}}} 34function twoWayBindingState(getter,setter,scope){return{getValue:function(){return getter(scope)},setValue:function(value){if(value!==getter(scope)){scope.$apply(function(){setter(scope,value)})}}}} 35function createActivationState(attr,scope){if(attr!==''){var getter=$parse(attr) 36if(getter.assign!==undefined){return twoWayBindingState(getter,getter.assign,scope)}else{return oneWayBindingState(getter,scope)}}else{return unboundState(true)}} 37return{priority:1,restrict:'A',link:function(scope,$el,attrs){var el=$el[0],activationState=createActivationState(attrs.scrollGlue,scope) 38function scrollToBottom(){el.scrollTop=el.scrollHeight} 39function onScopeChanges(scope){if(activationState.getValue()&&!shouldActivateAutoScroll()){scrollToBottom()}} 40function shouldActivateAutoScroll(){return el.scrollTop+el.clientHeight+1>=el.scrollHeight} 41function onScroll(){activationState.setValue(shouldActivateAutoScroll())} 42scope.$watch(onScopeChanges) 43$el.bind('scroll',onScroll)}}}]).directive('ngEnter',function(){return function(scope,element,attrs){element.bind('keydown keypress',function(event){if(event.which===13&&!event.shiftKey){scope.$apply(function(){scope.$eval(attrs.ngEnter)}) 44event.preventDefault()}})}}).directive('noBackspace',function(){return function(scope,element,attrs){element.bind('keydown keypress',function(event){if(event.which===8){var nodeName=event.target.nodeName.toLowerCase() 45if(!((nodeName==='input'&&(event.target.type==='text'||event.target.type==='number'||event.target.type==='email'||event.target.type==='search'||event.target.type==='password'))||nodeName==='textarea'||event.target.contentEditable==='true')){event.preventDefault()}}})}}).directive('ngEsc',function(){return function(scope,element,attrs){element.bind('keydown keypress',function(event){if(event.which===27){scope.$apply(function(){scope.$eval(attrs.ngEsc)}) 46event.preventDefault()}})}}).directive('confirmDelete',['$mdDialog',function($mdDialog){return{terminal:true,link:function(scope,element,attr){var func=attr.confirmDelete 47element.bind('click',function(e){var dialog=$mdDialog.confirm().title('Are you sure?').content('You cannot undo deleting this item!').ok("I'm Sure").cancel('Cancel').targetEvent(e).parent(angular.element(document.body)) 48$mdDialog.show(dialog).then(function(){scope.$eval(func)})})}}}]).directive('confirmAction',['$mdDialog',function($mdDialog){return{terminal:true,scope:{confirmActionTitle:'@',confirmActionContent:'@'},link:function(scope,element,attr){var func=attr.confirmAction 49var $scope=angular.element(element).isolateScope().$parent 50element.bind('click',function(e){var dialog=$mdDialog.confirm().title(scope.confirmActionTitle).content(scope.confirmActionContent).ok("I'm Sure").cancel('Cancel').targetEvent(e).parent(angular.element(document.body)) 51$mdDialog.show(dialog).then(function(){$scope.$eval(func)})})}}}]).directive('spinner',['$rootScope','$stateParams','$q','Utils',function($rootScope,$stateParams,$q,Utils){return{restrict:'AE',template:'<div ng-class="{maxwidthclipper: __clip}" flex style="padding: 0;"><div class="spinner" ng-show="!loaded" flex><div class="loader" layout="column" layout-align="center center"><md-progress-circular style=" margin: 0 auto;" class="md-hue-2" md-mode="indeterminate"></md-progress-circular><div class="text" ng-bind="loadingMessage"></div></div></div><div ng-transclude ng-class="{hideshallow: !loaded}" flex></div></div>',transclude:true,replace:true,link:function(scope,element,attrs){if(attrs.$attr.clip){scope.__clip=true} 52if(attrs.control=='manual'){scope.$watch(function(){return scope.isLoading},function(){scope.loaded=!scope.isLoading})} 53scope.loaded=false 54scope.loadingMessage=$rootScope.loadingMessage() 55if(scope._providers){scope.$providers={} 56angular.forEach(scope._providers,function(ns){Utils.list_provider(ns).then(function(r){scope.$providers[ns]=r})})} 57$q.all(scope.promises).then(function(){scope.loaded=true 58if($stateParams.action){scope[$stateParams.action]() 59$stateParams['action']=null 60$rootScope.$state.transitionTo($rootScope.$state.current.name,$stateParams,{notify:false})} 61if(scope._setPath!==undefined){scope._setPath() 62$rootScope.title=_.pluck($rootScope.path.slice().reverse(),'0').join(' • ')+' - DoSelect'}})}}}]).directive('timer',['$timeout','$rootScope',function($timeout,$rootScope){return{scope:{size:'@size',start:'@start',end:'@end',created:'@created',status:'=status'},restrict:'E',template:'<svg tooltip="{$status$}" tooltip-placement="left" tooltip-append-to-body="true"><path/></svg>',transclude:true,compile:function(elm,attrs){var svg=elm[0].childNodes[0] 63var path=elm[0].childNodes[0].childNodes[0] 64svg.setAttribute('width',attrs.size) 65svg.setAttribute('height',attrs.size) 66svg.setAttribute('viewBox','0 0 '+attrs.size+' '+attrs.size) 67svg.style.background='rgba(255, 255, 255, 0.2)' 68svg.setAttribute('class','timer-widget') 69path.setAttribute('transform','translate('+parseInt(attrs.size)/2+', '+parseInt(attrs.size)/2+')') 70return function(scope,element,attrs){var start,end,created,delta,elapsed 71var now=$rootScope.$moment().unix() 72attrs.$observe('start',function(value){start=$rootScope.$momentTZ(value).unix()}) 73var loader,pi,a,size,t 74var draw=function(){a++ 75if(a<360){var r=(a*pi/180),x=Math.sin(r)*parseInt('-'+size),y=Math.cos(r)*parseInt('-'+size),mid=(a<180)?1:0,anim='M 0 0 v '+'-'+size+' A '+size+' '+size+' 1 '+mid+' 1 '+x+' '+y+' z' 76var fill='#fafafa' 77if(a<=120){fill='#2ecc71'}else if(a>120&&a<=240){fill='#f1c40f'}else{fill='#e74c3c'} 78loader.setAttribute('d',anim) 79loader.style.fill=fill 80window.setTimeout(draw,t)}} 81attrs.$observe('created',function(value){created=$rootScope.$momentTZ(value).unix() 82if(now<start){delta=start-created 83elapsed=now-created 84loader=element[0].childNodes[0].childNodes[0],a=(360*elapsed/delta),pi=Math.PI,size=(parseInt(attrs.size)/2).toString(),t=delta*1000/360 85if(delta>0){draw()}}}) 86attrs.$observe('end',function(value){end=$rootScope.$momentTZ(value).unix() 87if((now>
87start)&&(now<end)){delta=end-start 88elapsed=now-start 89loader=element[0].childNodes[0].childNodes[0],a=(360*elapsed/delta),pi=Math.PI,size=(parseInt(attrs.size)/2).toString(),t=delta*1000/360 90if(delta>0){draw()}}})}}}}]).directive('uiValidate',function(){return{restrict:'A',require:'ngModel',link:function(scope,elm,attrs,ctrl){var validateFn,validators={},validateExpr=scope.$eval(attrs.uiValidate) 91if(!validateExpr){return} 92if(angular.isString(validateExpr)){validateExpr={validator:validateExpr}} 93angular.forEach(validateExpr,function(exprssn,key){validateFn=function(valueToValidate){var expression=scope.$eval(exprssn,{'$value':valueToValidate}) 94if(angular.isObject(expression)&&angular.isFunction(expression.then)){expression.then(function(){ctrl.$setValidity(key,true)},function(){ctrl.$setValidity(key,false)}) 95return valueToValidate}else if(expression){ctrl.$setValidity(key,true) 96return valueToValidate}else{ctrl.$setValidity(key,false) 97return valueToValidate}} 98validators[key]=validateFn 99ctrl.$formatters.push(validateFn) 100ctrl.$parsers.push(validateFn)}) 101function apply_watch(watch){if(angular.isString(watch)){scope.$watch(watch,function(){angular.forEach(validators,function(validatorFn){validatorFn(ctrl.$modelValue)})}) 102return} 103if(angular.isArray(watch)){angular.forEach(watch,function(expression){scope.$watch(expression,function(){angular.forEach(validators,function(validatorFn){validatorFn(ctrl.$modelValue)})})}) 104return} 105if(angular.isObject(watch)){angular.forEach(watch,function(expression,validatorKey){if(angular.isString(expression)){scope.$watch(expression,function(){validators[validatorKey](ctrl.$modelValue)})} 106if(angular.isArray(expression)){angular.forEach(expression,function(intExpression){scope.$watch(intExpression,function(){validators[validatorKey](ctrl.$modelValue)})})}})}} 107if(attrs.uiValidateWatch){apply_watch(scope.$eval(attrs.uiValidateWatch))}}}}).directive('noData',['$rootScope','$q','$filter',function($rootScope,$q,$filter){return{restrict:'EA',template:'<div class="row">'+'<div class="col-sm-offset-2 col-sm-8 not-found-block">'+'<img ng-src="{$url$}" alt="No content to show">'+'<div class="msg">'+'<h3>{$ ndHeading $}</h3>'+'<p>{$ ndBody $}</p>'+'</div>'+'</div>'+'</div>',scope:{ndType:'@',ndHeading:'@',ndBody:'@'},link:function($scope,element,attrs){var image_url='dashboard/img/'+$scope.ndType+'.png' 108$scope.url=$filter('staticurl')(image_url)}}}]).directive('empty',['$filter',function($filter){return{restrict:'E',transclude:true,template:'<div layout="row" class="empty">'+'<div ng-show="type">'+'<img ng-src="{$url$}" alt="No content to show">'+'</div>'+'<div layout="column" ng-transclude flex>'+'</div>'+'</div>',scope:{type:'@'},link:function($scope,element,attrs){var image_url='assets/images/boticons/'+$scope.type+'.png' 109$scope.url=$filter('staticurl')(image_url)}}}]).directive('emptyState',['$filter',function($filter){return{restrict:'E',transclude:true,template:'<div layout="column" layout-align="center center" class="empty-state">'+'<img ng-src="{$url$}" alt="No content to show">'+'<div ng-transclude flex layout="column" layout-align="center center">'+'</div>'+'</div>',scope:{type:'@'},link:function($scope,element,attrs){var image_url='assets/images/boticons/'+$scope.type+'.png' 110$scope.url=$filter('staticurl')(image_url)}}}]).directive('noDataText',['$rootScope','$q','$filter',function($rootScope,$q,$filter){return{restrict:'EA',template:'<div class="not-found-block-text-only">'+'<h3>{$ ndHeading $}</h3>'+'<p>{$ ndBody $}</p>'+'</div>',scope:{ndHeading:'@',ndBody:'@'},link:function($scope,element,attrs){}}}]).directive('recordAvailabilityValidator',['$http',function($http){return{require:'ngModel',link:function(scope,element,attrs,ngModel){var apiUrl=attrs.recordAvailabilityValidator 111function setAsLoading(bool){ngModel.$setValidity('recordLoading',!bool)} 112function setAsAvailable(bool){ngModel.$setValidity('recordAvailable',bool)} 113function setAsInvalid(bool){ngModel.$setValidity('recordInvalid',!bool)} 114ngModel.$parsers.push(function(value){var _valid=ngModel.$validators[ngModel.$$parserName]?ngModel.$validators[ngModel.$$parserName](value):true 115if(!value||value.length==0||!_valid)return value 116setAsLoading(true) 117setAsAvailable(false)
118setAsInvalid(true) 119$http.post(apiUrl,{value:value}).success(function(r){if(r.status==='AVAILABLE'){setAsLoading(false) 120setAsAvailable(true) 121setAsInvalid(false)}else if(r.status==='INVALID'){setAsLoading(false) 122setAsInvalid(true) 123setAsAvailable(false)}else if(r.status==='NOT AVAILABLE'){setAsLoading(false) 124setAsAvailable(false) 125setAsInvalid(false)}}).error(function(){setAsLoading(false) 126setAsAvailable(false) 127setAsInvalid(true)}) 128return value})}}}]).directive('listInput',['$rootScope',function($rootScope){return{restrict:'E',transclude:true,scope:{maxLength:'@',listType:'@',buttonText:'@',modalTemplateUrl:'@',items:'=',imageMode:'='},templateUrl:tRootUrl('directives/list-input.html'),controller:['$scope','$rootScope','$mdDialog',function($scope,$rootScope,$mdDialog){$scope.newImage={url:''} 129$scope.addImage=function(url){console.log('Adding image...') 130console.log(url) 131if(url){$scope.save({url:url})}} 132$scope.save=function(item){$scope.items=$scope.items||[] 133$scope.items.unshift(item) 134$rootScope.$broadcast('_saveViewMain')} 135$scope.sortableConfig={animation:150,handle:'.drag-handle',ghostClass:'list-sortable-ghost',onEnd:function(evt){$rootScope.$broadcast('_saveViewMain')}} 136$scope.delete=function(item){_.pull($scope.items,item) 137$rootScope.$broadcast('_saveViewMain')} 138$scope.openModal=function(ev,item){$mdDialog.show({templateUrl:tRootUrl($scope.modalTemplateUrl),parent:angular.element(document.body),targetEvent:ev,controller:['$scope','$mdDialog','save',function($scope,$mdDialog,save){$scope.cancel=$mdDialog.cancel 139var data=item||{} 140$scope.data=angular.copy(data) 141$scope.save=function(){if(!(item)){save($scope.data)}else{angular.copy($scope.data,item) 142$rootScope.$broadcast('_saveViewMain')} 143$mdDialog.cancel()}}],resolve:{save:function(){return $scope.save}}})}}]}}]).directive('inject',function(){return{link:function($scope,$element,$attrs,controller,$transclude){if(!$transclude){throw minErr('ngTransclude')('orphan','Illegal use of ngTransclude directive in the template! '+'No parent directive that requires a transclusion found. '+'Element: {0}',startingTag($element))} 144var innerScope=$scope.$new() 145$transclude(innerScope,function(clone){$element.empty() 146$element.append(clone) 147$element.on('$destroy',function(){innerScope.$destroy()})})}}}).directive('httpPrefix',function(){return{restrict:'A',require:'ngModel',link:function(scope,element,attrs,controller){function ensureHttpPrefix(value){if(value&&!/^(https?):\/\//i.test(value)&&'http://'.indexOf(value)===-1){controller.$setViewValue('http://'+value) 148controller.$render() 149return'http://'+value} 150else 151{return value}} 152controller.$formatters.push(ensureHttpPrefix) 153controller.$parsers.splice(0,0,ensureHttpPrefix)}}}).directive('breadcrumbs',[function(){return{scope:true,restrict:'AE',templateUrl:tRootUrl('directives/breadcrumbs.html'),replace:true,controller:['$scope','$rootScope',function($scope,$rootScope){$scope.getURL=function(crumb){return $rootScope.$state.href(crumb[1],crumb[2])}}],link:function($scope,iElm,iAttrs,controller){}}}]).directive('menuLink',['$rootScope',function($rootScope){return{terminal:true,scope:{type:'@',state:'@',icon:'@',title:'@'},templateUrl:tRootUrl('directives/menu-link.html'),link:function($scope){$scope.link=$scope.type=='link'}}}]).directive('menuToggle',['$rootScope',function($rootScope){return{terminal:true,scope:{links:'=',state:'@',icon:'@',title:'@'},templateUrl:tRootUrl('directives/menu-toggle.html'),link:function($scope){$scope.$watch(function(){return $rootScope.$state.includes($scope.state)},function(){$scope.isOpen=$rootScope.$state.includes($scope.state)}) 154$scope.toggle=function(){$scope.isOpen=!$scope.isOpen}}}}]).directive('mdDataTable',['$rootScope',function($rootScope){return{restrict:'AE',transclude:true,replace:true,template:'<div ng-transclude style="overflow-y: auto;"></div>',controller:['$scope','$q','$filter','ngTableParams',function($scope,$q,$filter,ngTableParams){$q.all($scope.promises).then(function(){$scope.tableParams=new ngTableParams({page:1,count:10},{counts:[],total:$scope.tableData.length,getData:function($defer,params){var orderedData=params.sorting()?$filter('orderBy')($scope.tableData,params.orderBy()):$scope.tableData()
155$defer.resolve(orderedData.slice((params.page()-1)*params.count(),params.page()*params.count()))}})})}]}}]).directive('solutionStatusLabel',[function(){return{restrict:'AE',transclude:true,replace:true,scope:{present:'=',submitted:'=',status:'=',expiry:'=',subTestType:'=',mode:'@',},templateUrl:tRootUrl('directives/solution-status-label.html')}}]).directive('dateTimePicker',['$rootScope',function($rootScope){return{restrict:'AE',replace:true,scope:{datetime:'=',max:'=',min:'=',mode:'@'},templateUrl:tRootUrl('directives/date-time-picker.html'),link:function($scope,elm,attrs){},controller:['$rootScope','$scope','$mdDialog',function($rootScope,$scope,$mdDialog){$scope.openModal=function(event){$mdDialog.show({templateUrl:tRootUrl('directives/date-time-picker-modal.html'),parent:angular.element(document.body),targetEvent:event,controller:['$rootScope','$scope','$mdDialog','datetime',function($rootScope,$scope,$mdDialog,datetime){$scope.cancel=$mdDialog.cancel 156$scope.d={} 157$scope.d.datetime=datetime 158$scope.save=function(d){d=$rootScope.$momentTZ(d) 159angular.copy(d,datetime) 160$mdDialog.cancel() 161$rootScope.$broadcast('_saveViewMain')}}],resolve:{datetime:function(){return $scope.datetime}}})}}]}}]).directive('datetimePicker',['$rootScope',function($rootScope){return{restrict:'AE',replace:true,scope:{datetime:'=',max:'@',min:'@',mode:'@'},templateUrl:tRootUrl('directives/datetime-picker.html'),link:function($scope,elm,attrs){if(!($scope.min)){$scope.min=$rootScope.$momentTZ('1970-01-01')}else{$scope.min=$rootScope.$momentTZ($scope.min)} 162if(!($scope.max)){$scope.max=$rootScope.$momentTZ()}else{$scope.max=$rootScope.$momentTZ($scope.max)} 163$scope.$watch(function(){return $scope.datetime},function(){if($scope.datetime){_.forEach($scope.parts,function(t){$scope.range[t]=$scope.generateRange($scope.min,$scope.max,t,$scope.datetime)})}})},controller:['$scope','$rootScope',function($scope,$rootScope){var monthNames=['January','February','March','April','May','June','July','August','September','October','November','December'] 164$scope.parts=['minute','hour','date','month','year'] 165$scope.dt={} 166$scope.update_datetime=function(from,to){_.forEach($scope.parts,function(t){to.set(t,from[t])})} 167$scope.update_dt=function(from,to){_.forEach($scope.parts,function(t){to[t]=from.get(t)})} 168$scope.getMonthName=function(m){return monthNames[m]} 169$scope.range={} 170$scope.zeros={'month':0,'date':1,'hour':0,'minute':0} 171$scope.ones={'month':12,'hour':24,'minute':60} 172function daysInMonth(month,year){return new Date(year,month+1,0).getDate()} 173var validate_parts=function(parts,obj,comparer){var flag=true 174_.forEach(parts,function(t){flag=flag&&obj.get(t)===comparer.get(t)}) 175return flag} 176var new_min=function(from,type,current){var parts=$scope.parts 177var new_from=from.clone() 178_.forEach(parts.slice(_.indexOf(parts,type)+1),function(t){new_from.set(t,current.get(t))}) 179_.forEach(parts.slice(0,_.indexOf(parts,type)+1),function(t){new_from.set(t,$scope.zeros[t])}) 180return new_from} 181var new_max=function(to,type,current){var parts=$scope.parts 182var new_to=to.clone() 183if(!(validate_parts(parts.slice(_.indexOf($scope.parts,type)+1),new_to,current))){_.forEach(parts.slice(0,_.indexOf(parts,type)+1),function(t){if(t=='date'){new_to.set(t,daysInMonth(current.month(),current.year()))}else{new_to.set(t,$scope.ones[t])}})} 184return new_to} 185$scope.generateRange=function(from,to,type,current){var parts=$scope.parts 186var range=[] 187var compares=parts.slice(_.indexOf(parts,type)+1) 188var by=type=='date'?'days':type 189moment.range(new_min(from,type,current),new_max(to,type,current)).by(by,function(m){if(validate_parts(compares,m,current)){range.push(m.get(type))}}) 190return range}}]}}]);'use strict' 191var appConfig=angular.module('doselectWebAppConfig',['ngMessages','ngMaterial','720kb.socialshare']) 192var staticurl=function(input){return STATIC_URL+input} 193appConfig.run(['$rootScope','$window','$http','$templateCache','$mdToast',function($rootScope,$window,$http,$templateCache,$mdToast){$rootScope.$moment=moment 194$rootScope.$momentTZ=moment 195$rootScope.$currentMonth=$rootScope.$moment().month() 196$rootScope.$currentYear=$rootScope.$moment().year() 197$rootScope._=_ 198$rootScope.$go=function(url){$window.location.href=url} 199var icon_urls=['svg/trophy.svg','svg/inr.svg','svg/gbp.svg','svg/yen.svg','svg/eur.svg'] 200angular.forEach(icon_urls,function(url){$http.get(staticurl(url),{cache:$templateCache})}) 201$rootScope.getETA=function(start,end){var now=$rootScope.$moment() 202var start=$rootScope.$moment(start) 203var end=$rootScope.$moment(end) 204if(now.isBefore(start)){return'Starts '+start.fromNow()} 205else if(now.isAfter(start)&&now.isBefore(end)){return'Ends '+end.fromNow()} 206else{return'Ended.'}} 207$rootScope.alert=function(message,delay,type){if($rootScope.isAlreadyToast!==true){var theme=type||'default' 208$mdToast.show({hideDelay:delay||5000,position:'bottom left',template:'<md-toast class="toast" ng-class="type"><md-icon>info_outline</md-icon><span class="md-toast-text">{$ message $}</span></md-toast>',controller:['$scope',function($scope){$scope.message=message 209$scope.type=theme}]})}} 210$rootScope.errorToast=function(errorToastObject){var message=errorToastObject?errorToastObject.message:undefined;var copyText=errorToastObject?errorToastObject.copyText:null;var errorCode=errorToastObject?errorToastObject.errorCode:undefined;var delay=errorToastObject?errorToastObject.delay:false;if($rootScope.isAlreadyToast!==true){$rootScope.isAlreadyToast=true;$mdToast.show({hideDelay:delay,position:'bottom left',template:'<md-toast class="toast error" ng-class="type">'+'<md-icon>info_outline</md-icon>'+'<span class="md-toast-text">'+'<b>'+'{$ message $} '+'<u ng-click="copy()" ng-mouseleave="resetTooltip()">'+'<md-tooltip md-visible="showCopyToolTip" md-direction="top">'+'{$ toolTipText $}
210'+'</md-tooltip>'+'{$ copyText $}'+'</u>'+' '+'<span class="error-code">'+'({$ errorCode $})'+'</span>'+'</b>'+'</span>'+'<md-icon class="close" ng-click="closeToast()">close</md-icon>'+'</md-toast>',controller:['$scope',function($scope){$scope.message=message;$scope.copyText=copyText;$scope.errorCode=errorCode;$scope.toolTipText='Click here to copy';$scope.showCopyToolTip=false;$scope.closeToast=function(){$mdToast.hide();$rootScope.isAlreadyToast=false;};}]});}};}]) 211appConfig.config(['$interpolateProvider','$httpProvider','$compileProvider','$mdIconProvider','$mdThemingProvider',function($interpolateProvider,$httpProvider,$compileProvider,$mdIconProvider,$mdThemingProvider){$compileProvider.debugInfoEnabled(false) 212$interpolateProvider.startSymbol('{$') 213$interpolateProvider.endSymbol('$}') 214$httpProvider.defaults.xsrfCookieName='doselectcsrf' 215$httpProvider.defaults.xsrfHeaderName='X-CSRFToken' 216$mdIconProvider.defaultFontSet('material-icons').icon('ext-trophy',staticurl('svg/trophy.svg'),24).icon('ext-inr',staticurl('svg/inr.svg'),24).icon('ext-eur',staticurl('svg/eur.svg'),24).icon('ext-gbp',staticurl('svg/gbp.svg'),24).icon('ext-yen',staticurl('svg/yen.svg'),24) 217$mdThemingProvider.theme('default').accentPalette('green')}]) 218var tRootUrl=function(path){var BASE_TEMPLATE_URL='/_internals/_providers/tplprovider/' 219return BASE_TEMPLATE_URL+path+'/'};'use strict' 220var controllers=angular.module('doselectWebControllers',[]) 221controllers.controller('WebSignupCtrl',['$scope','$http','$location',function($scope,$http,$location){$scope.data={} 222$scope.passwordValidationRegex=/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[$@$!%*#^)(_+|~=`}{:";'></\-&])[A-Za-z\d$@$!%*#^)(_+|~=`}{:";'></\-&]{8,40}$/ 223$scope.usernameValidationRegex=/^[a-z][a-z0-9._]+$/;function getParameterByName(name){name=name.replace(/[\[]/,'\\[').replace(/[\]]/,'\\]') 224var regex=new RegExp('[\\?&]'+name+'=([^&#]*)') 225var results=regex.exec(location.search) 226return results==null?'':decodeURIComponent(results[1].replace(/\+/g,' '))} 227$scope.email=getParameterByName('email')}]) 228controllers.controller('accountsCtrl',['$scope','$location','$timeout',function($scope,$location,$timeout){$scope.selectedIndex=0;$scope.isEmailReadOnly=false;$scope.usernameValidationRegex=/^[a-z][a-z0-9._]+$/;$scope.passwordValidationRegex=/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[$@$!%*#^)(_+|~=`}{:";'></\-&])[A-Za-z\d$@$!%*#^)(_+|~=`}{:";'></\-&]{8,40}$/ 229if($location.url()==='/signup'||$location.url().startsWith('/signup?')){$scope.selectedIndex=1} 230$scope.toggleLoginAndSignup=function(index){console.log(index);$scope.selectedIndex=index;};$scope.$watch('selectedIndex',function(current,old){switch(current){case 0:$location.url('/login') 231document.title="Login - DoSelect" 232break 233case 1:$location.url('/signup') 234document.title="Developer Signup - DoSelect" 235break}}) 236$scope.initialize=function(user_email,first_name,last_name){$scope.email=user_email;$scope.firstName=first_name;$scope.lastName=last_name;$timeout(function(){if(!last_name||last_name.length>30||!(/^[a-zA-Z\s]*$/.test(last_name.trim()))){$scope.form.last_name.$setDirty();} 237if(!first_name||first_name.length>30||!(/^[a-zA-Z\s]*$/.test(first_name.trim()))){$scope.form.first_name.$setDirty();} 238if(!user_email||user_email.length>75){$scope.form.email.$setDirty();}else{$scope.isEmailReadOnly=true;}})};$scope.checkPassword=function(){if($scope.password1!==$scope.confirmPasswordValue){$scope.form.confirmPasswordValue.$setValidity('confirmPasswordMisMatch',false);}else{$scope.form.confirmPasswordValue.$setValidity('confirmPasswordMisMatch',true);}};}]) 239controllers.controller('updateContactCtrl',['$scope','$http','$location',function($scope,$http,$location){$scope.errorMessage='' 240$scope.contactUpdateData={whatsappConsent:false,phone:null,isSubmitted:false};function extractParamsFromUrl(){var userId=null;var accessCode=null;var searchParams=$location.search();accessCode=encodeURIComponent(searchParams.access_code)||null;userId=searchParams.userid||null;return{userId:userId,accessCode:accessCode};} 241(function(){var params=extractParamsFromUrl();$scope.userId=params.userId==='None'?null:params.userId;if($scope.userId&¶ms.accessCode){var apiUrl=$location.path().split('/')[0]+'/user.get_details/'+params.userId+'?access_code='+params.accessCode;$http.get(apiUrl).then(function(resp){$scope.contactUpdateData.phone=Number(resp.data.phone)||'';$scope.contactUpdateData.whatsappConsent=resp.data.sms_whatsapp_declaration}).catch(function(error){});}else{console.error("userId or access_code not found in URL parameters.");}})();$scope.onChange=function(){$scope.errorMessage='';} 242$scope.onUpdateContactClick=function(ev){var params=extractParamsFromUrl();var apiUrl=$location.path().split('/')[0]+'/user.update_details' 243var payload={user_id:params.userId,access_code:params.accessCode,phone:Number($scope.contactUpdateData.phone),sms_whatsapp_declaration:$scope.contactUpdateData.whatsappConsent} 244if($scope.contactUpdateData.name){payload['full_name']=$scope.contactUpdateData.name.toString()} 245if(((!$scope.userId&&$scope.contactUpdateData.aggrement)||$scope.userId)&&payload.phone){$http.post(apiUrl,payload).then(function(resp){$scope.contactUpdateData.isSubmitted=true;}).catch(function(error){$scope.errorMessage=error.data.description;});}};}]);controllers.controller('updateDrpController',['$scope','$http','$rootScope',function($scope,$http,$rootScope){$scope.downloadReport=function(){$http.post('/drp/send_reports',{email:globals.userEmail}).then(function(resp){$rootScope.alert(resp.data.message)}
245).catch(function(err){$rootScope.errorToast(err)})}}]);;'use strict' 246var directives=angular.module('doselectWebDirectives',[]) 247directives.directive('minResize',['$window',function($window){return{compile:function(elm,attrs){var win=angular.element($window) 248elm.css('min-height',(win[0].innerHeight-parseInt(attrs.resizeOffset))+'px') 249return function(scope,elem,attrs){var win=angular.element($window) 250win.bind('resize',function(e){var w=win[0] 251elem.css('min-height',(w.innerHeight-parseInt(attrs.resizeOffset))+'px')})}}}}]) 252directives.directive('recordAvailabilityValidator',['$http',function($http){return{require:'ngModel',link:function(scope,element,attrs,ngModel){var apiUrl=attrs.recordAvailabilityValidator 253function setAsLoading(bool){ngModel.$setValidity('recordLoading',!bool)} 254function setAsAvailable(bool){ngModel.$setValidity('recordAvailable',bool)} 255function setAsInvalid(bool){ngModel.$setValidity('recordInvalid',!bool)} 256ngModel.$parsers.push(function(value){var _valid=ngModel.$validators[ngModel.$$parserName]?ngModel.$validators[ngModel.$$parserName](value):true 257if(!value||value.length==0||!_valid)return value 258setAsLoading(true) 259setAsAvailable(false) 260setAsInvalid(true) 261$http.post(apiUrl,{value:value}).success(function(r){if(r.status==='AVAILABLE'){setAsLoading(false) 262setAsAvailable(true) 263setAsInvalid(false)}else if(r.status==='INVALID'){setAsLoading(false) 264setAsInvalid(true) 265setAsAvailable(false)}else if(r.status==='NOT AVAILABLE'){setAsLoading(false) 266setAsAvailable(false) 267setAsInvalid(false)}}).error(function(){setAsLoading(false) 268setAsAvailable(false) 269setAsInvalid(true)}) 270return value})}}}]) 271directives.directive('shareDialog',['$mdDialog',function($mdDialog){return{scope:{shareData:'='},link:function(scope,element){element.bind('click',function(event){$mdDialog.show({templateUrl:tRootUrl('directives/share-dialog.html'),parent:angular.element(document.body),targetEvent:event,controller:['$scope','$mdDialog','shareData',function($scope,$mdDialog,shareData){if(!(shareData.url)){shareData.url=location.href} 272$scope.shareData=shareData 273$scope.cancel=$mdDialog.cancel}],resolve:{shareData:function(){return scope.shareData}}})})}}}]);'use strict' 274var filters=angular.module('doselectWebFilters',[]) 275filters.filter('getcategory',function(){return function(input){var types={'LNG':'Programming Langauge','AFW':'Application Framework','OSY':'Operating System','PAR':'Paradigm','OTH':'Others'} 276if(input){return types[input]}else{return''}}}) 277filters.filter('staticurl',function(){return function(input){return STATIC_URL+input}}) 278filters.filter('getcurrency',function(){return function(input){var currency={'USD':'$','INR':'â¹','SGD':'$','EUR':'â¬','GBP':'£','CAD':'$','JPY':'Â¥','CNY':'Â¥'} 279return currency[input]}}) 280filters.filter('humanizeInt',function(){return function(input,decimals){var bigNumPrefixes,decimalIndex,decimalPart,decimalPartArray,length,number,numberLength,numberLengths,output,outputNumber,signString,unsignedNumber,unsignedNumberCharacterArray,unsignedNumberString,wholePart,wholePartArray,_i,_len,_length 281if(decimals==null){decimals=0} 282decimals=Math.max(decimals,0) 283number=parseInt(input,10) 284signString=number<0?'-':'' 285unsignedNumber=Math.abs(number) 286unsignedNumberString=''+unsignedNumber 287numberLength=unsignedNumberString.length 288numberLengths=[13,10,7,4] 289bigNumPrefixes=['T','B','M','k'] 290if(unsignedNumber<1000){return''+signString+unsignedNumberString} 291if(numberLength>numberLengths[0]+3){return number.toExponential(decimals).replace('e+','x10^')} 292for(_i=0,_len=numberLengths.length;_i<_len;_i++){_length=numberLengths[_i] 293if(numberLength>=_length){length=_length 294break}} 295decimalIndex=numberLength-length+1 296unsignedNumberCharacterArray=unsignedNumberString.split('') 297wholePartArray=unsignedNumberCharacterArray.slice(0,decimalIndex) 298decimalPartArray=unsignedNumberCharacterArray.slice(decimalIndex,decimalIndex+decimals+1) 299wholePart=wholePartArray.join('') 300decimalPart=decimalPartArray.join('') 301if(decimalPart.length<decimals){decimalPart+=''+(Array(decimals-decimalPart.length+1).join('0'))} 302if(decimals===0){output=''+signString+wholePart+bigNumPrefixes[numberLengths.indexOf(length)]}else{outputNumber=(+(''+wholePart+'.'+decimalPart)).toFixed(decimals) 303output=''+signString+outputNumber+bigNumPrefixes[numberLengths.indexOf(length)]} 304return output}}) 305filters.filter('getjobtype',function(){return function(input){var types={'FLT':'Full-time','CON':'Contractor','INT':'Intern','COF':'Co-founder'} 306return types[input]}});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.