13 lines
404 KiB
JavaScript
13 lines
404 KiB
JavaScript
![]() |
"use strict";var Bahmni=Bahmni||{};Bahmni.Common=Bahmni.Common||{},function(){var hostUrl=localStorage.getItem("host")?"https://"+localStorage.getItem("host"):"",rootDir=localStorage.getItem("rootDir")||"",RESTWS=hostUrl+"/openmrs/ws/rest",RESTWS_V1=hostUrl+"/openmrs/ws/rest/v1",BAHMNI_CORE=RESTWS_V1+"/bahmnicore",EMRAPI=RESTWS+"/emrapi",BACTERIOLOGY=RESTWS_V1,BASE_URL=hostUrl+"/bahmni_config/openmrs/apps/",CUSTOM_URL=hostUrl+"/implementation_config/openmrs/apps/",IE_APPS_API=RESTWS_V1+"/bahmniie",serverErrorMessages=[{serverMessage:"Cannot have more than one active order for the same orderable and care setting at same time",clientMessage:"One or more drugs you are trying to order are already active. Please change the start date of the conflicting drug or remove them from the new prescription."},{serverMessage:"[Order.cannot.have.more.than.one]",clientMessage:"One or more drugs you are trying to order are already active. Please change the start date of the conflicting drug or remove them from the new prescription."}],representation="custom:(uuid,name,names,conceptClass,setMembers:(uuid,name,names,conceptClass,setMembers:(uuid,name,names,conceptClass,setMembers:(uuid,name,names,conceptClass))))",unAuthenticatedReferenceDataMap={"/openmrs/ws/rest/v1/location?tags=Login+Location&s=byTags&v=default":"LoginLocations","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=locale.allowed.list":"LocaleList"},authenticatedReferenceDataMap={"/openmrs/ws/rest/v1/idgen/identifiertype":"IdentifierTypes","/openmrs/module/addresshierarchy/ajax/getOrderedAddressHierarchyLevels.form":"AddressHierarchyLevels","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=mrs.genders":"Genders","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=bahmni.encountersession.duration":"encounterSessionDuration","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=bahmni.relationshipTypeMap":"RelationshipTypeMap","/openmrs/ws/rest/v1/bahmnicore/config/bahmniencounter?callerContext=REGISTRATION_CONCEPTS":"RegistrationConcepts","/openmrs/ws/rest/v1/relationshiptype?v=custom:(aIsToB,bIsToA,uuid)":"RelationshipType","/openmrs/ws/rest/v1/personattributetype?v=custom:(uuid,name,sortWeight,description,format,concept)":"PersonAttributeType","/openmrs/ws/rest/v1/entitymapping?mappingType=loginlocation_visittype&s=byEntityAndMappingType":"LoginLocationToVisitTypeMapping","/openmrs/ws/rest/v1/bahmnicore/config/patient":"PatientConfig","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Consultation+Note&v=custom:(uuid,name,answers)":"ConsultationNote","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Lab+Order+Notes&v=custom:(uuid,name)":"LabOrderNotes","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Impression&v=custom:(uuid,name)":"RadiologyImpressionConfig","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=All_Tests_and_Panels&v=custom:(uuid,name:(uuid,name),setMembers:(uuid,name:(uuid,name)))":"AllTestsAndPanelsConcept","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Dosage+Frequency&v=custom:(uuid,name,answers)":"DosageFrequencyConfig","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Dosage+Instructions&v=custom:(uuid,name,answers)":"DosageInstructionConfig","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=bahmni.encounterType.default":"DefaultEncounterType","/openmrs/ws/rest/v1/concept?s=byFullySpecifiedName&name=Stopped+Order+Reason&v=custom:(uuid,name,answers)":"StoppedOrderReasonConfig","/openmrs/ws/rest/v1/ordertype":"OrderType","/openmrs/ws/rest/v1/bahmnicore/config/drugOrders":"DrugOrderConfig","/openmrs/ws/rest/v1/bahmnicore/sql/globalproperty?property=drugOrder.drugOther":"NonCodedDrugConcept"};authenticatedReferenceDataMap["/openmrs/ws/rest/v1/entitymapping?mappingType=location_encountertype&s=byEntityAndMappingType&entityUuid="+(localStorage.getItem("LoginInformation")?JSON.parse(localStorage.getItem("LoginInformation")).currentLocation.uuid:"")]="LoginLocationToEncounterTypeMapping",Bahmni.Common.Constants={hostURL:hostUrl,dateFormat:"dd/mm/yyyy",dateDisplayFormat:"DD
|
||
|
!_.isEmpty(providers.results)&&hasAnyActiveProvider(providers.results)?($rootScope.currentUser=new Bahmni.Auth.User(data.results[0]),$rootScope.currentUser.currentLocation=$bahmniCookieStore.get(Bahmni.Common.Constants.locationCookieName).name,$rootScope.$broadcast("event:user-credentialsLoaded",data.results[0]),deferrable.resolve(data.results[0])):(self.destroy(),deferrable.reject("YOU_HAVE_NOT_BEEN_SETUP_PROVIDER"))},function(){self.destroy(),deferrable.reject("COULD_NOT_GET_PROVIDER")})},function(){self.destroy(),deferrable.reject("Could not get roles for the current user.")}),deferrable.promise):(this.destroy().finally(function(){$rootScope.$broadcast("event:auth-loginRequired"),deferrable.reject("No User in session. Please login again.")}),deferrable.promise)},this.getLoginLocationUuid=function(){return $bahmniCookieStore.get(Bahmni.Common.Constants.locationCookieName)?$bahmniCookieStore.get(Bahmni.Common.Constants.locationCookieName).uuid:null},this.changePassword=function(currentUserUuid,oldPassword,newPassword){return $http({method:"POST",url:Bahmni.Common.Constants.passwordUrl,data:{oldPassword:oldPassword,newPassword:newPassword},headers:{"Content-Type":"application/json"}})},this.loadProviders=function(userInfo){return $http.get(Bahmni.Common.Constants.providerUrl,{method:"GET",params:{user:userInfo.uuid},cache:!1}).success(function(data){var providerUuid=data.results.length>0?data.results[0].uuid:void 0;$rootScope.currentProvider={uuid:providerUuid}})}}]).factory("authenticator",["$rootScope","$q","$window","sessionService",function($rootScope,$q,$window,sessionService){var authenticateUser=function(){var defer=$q.defer(),sessionDetails=sessionService.get();return sessionDetails.then(function(response){response.data.authenticated?defer.resolve():(defer.reject("User not authenticated"),$rootScope.$broadcast("event:auth-loginRequired"))}),defer.promise};return{authenticateUser:authenticateUser}}]).directive("logOut",["sessionService","$window","configurationService","auditLogService",function(sessionService,$window,configurationService,auditLogService){return{link:function(scope,element){element.bind("click",function(){scope.$apply(function(){auditLogService.log(void 0,"USER_LOGOUT_SUCCESS",void 0,"MODULE_LABEL_LOGOUT_KEY").then(function(){sessionService.destroy().then(function(){$window.location="../home/index.html#/login"})})})})}}}]).directive("btnUserInfo",[function(){return{restrict:"CA",link:function(scope,elem){elem.bind("click",function(event){$(this).next().toggleClass("active"),event.stopPropagation()}),$(document).find("body").bind("click",function(){$(elem).next().removeClass("active")})}}}]),angular.module("bahmni.common.appFramework",["authentication"]);var Bahmni=Bahmni||{};Bahmni.Common=Bahmni.Common||{},Bahmni.Common.AppFramework=Bahmni.Common.AppFramework||{},angular.module("bahmni.common.appFramework").config(["$compileProvider",function($compileProvider){$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|chrome-extension|file):/)}]).service("appService",["$http","$q","sessionService","$rootScope","mergeService","loadConfigService","messagingService","$translate",function($http,$q,sessionService,$rootScope,mergeService,loadConfigService,messagingService,$translate){var currentUser=null,baseUrl=Bahmni.Common.Constants.baseUrl,customUrl=Bahmni.Common.Constants.customUrl,appDescriptor=null;$rootScope.meetId=null;var loadConfig=function(url){return loadConfigService.loadConfig(url,appDescriptor.contextPath)},loadTemplate=function(appDescriptor){var deferrable=$q.defer();return loadConfig(baseUrl+appDescriptor.contextPath+"/appTemplate.json").then(function(result){_.keys(result.data).length>0&&appDescriptor.setTemplate(result.data),deferrable.resolve(appDescriptor)},function(error){404!==error.status?deferrable.reject(error):deferrable.resolve(appDescriptor)}),deferrable.promise},setDefinition=function(baseResultData,customResultData){customResultData&&(_.keys(baseResultData).length>0||_.keys(customResultData.length>0))?appDescriptor.setDefinition(baseResultData,customResultData)
|
||
|
controller:function($scope,backlinkService){$scope.backLinks=backlinkService.getAllUrls(),$scope.$on("$stateChangeSuccess",function(event,state){state.data&&state.data.backLinks&&(backlinkService.setUrls(state.data.backLinks),$scope.backLinks=backlinkService.getAllUrls())}),$scope.$on("$destroy",function(){window.onbeforeunload=void 0})},restrict:"E"}}),angular.module("bahmni.common.uiHelper").controller("MessageController",["$scope","messagingService",function($scope,messagingService){$scope.messages=messagingService.messages,$scope.getMessageText=function(level){var string="";return $scope.messages[level].forEach(function(message){string=string.concat(message.value)}),string},$scope.hideMessage=function(level){messagingService.hideMessages(level)},$scope.isErrorMessagePresent=function(){return $scope.messages.error.length>0},$scope.isInfoMessagePresent=function(){return $scope.messages.info.length>0}}]),angular.module("bahmni.common.uiHelper").service("messagingService",["$rootScope","$timeout",function($rootScope,$timeout){this.messages={error:[],info:[]};var self=this;$rootScope.$on("event:serverError",function(event,errorMessage){self.showMessage("error",errorMessage,"serverError")}),this.showMessage=function(level,message,errorEvent){var messageObject={value:"",isServerError:!1};messageObject.value=message,errorEvent?messageObject.isServerError=!0:"info"==level&&this.createTimeout("info",4e3);var index=_.findIndex(this.messages[level],function(msg){return msg.value==messageObject.value});index>=0&&this.messages[level].splice(index,1),this.messages[level].push(messageObject)},this.createTimeout=function(level,time){$timeout(function(){self.messages[level]=[]},time,!0)},this.hideMessages=function(level){self.messages[level].length=0},this.clearAll=function(){self.messages.error=[],self.messages.info=[]}}]),angular.module("bahmni.common.uiHelper").service("confirmBox",["$rootScope","ngDialog",function($rootScope,ngDialog){var dialog,confirmBox=function(config){var confirmBoxScope=$rootScope.$new();confirmBoxScope.close=function(){ngDialog.close(dialog.id),confirmBoxScope.$destroy()},confirmBoxScope.scope=config.scope,confirmBoxScope.actions=config.actions,dialog=ngDialog.open({template:"../common/ui-helper/views/confirmBox.html",scope:confirmBoxScope,className:config.className||"ngdialog-theme-default"})};return confirmBox}]),angular.module("bahmni.common.uiHelper").directive("bahmniAutocomplete",["$translate",function($translate){var link=function(scope,element,attrs,ngModelCtrl){var source=scope.source(),responseMap=scope.responseMap&&scope.responseMap(),onSelect=scope.onSelect(),onEdit=scope.onEdit&&scope.onEdit(),minLength=scope.minLength||2,formElement=element[0],validationMessage=scope.validationMessage||$translate.instant("SELECT_VALUE_FROM_AUTOCOMPLETE_DEFAULT_MESSAGE"),validateIfNeeded=function(value){scope.strictSelect&&(scope.isInvalid=value!==scope.selectedValue,_.isEmpty(value)&&(scope.isInvalid=!1))};scope.$watch("initialValue",function(){scope.initialValue&&(scope.selectedValue=scope.initialValue,scope.isInvalid=!1)}),element.autocomplete({autofocus:!0,minLength:minLength,source:function(request,response){source({elementId:attrs.id,term:request.term,elementType:attrs.type}).then(function(data){var results=responseMap?responseMap(data):data;response(results)})},select:function(event,ui){return scope.selectedValue=ui.item.value,ngModelCtrl.$setViewValue(ui.item.value),null!=onSelect&&onSelect(ui.item),validateIfNeeded(ui.item.value),scope.blurOnSelect&&element.blur(),scope.$apply(),scope.$eval(attrs.ngDisabled),scope.$apply(),!0},search:function(event,ui){null!=onEdit&&onEdit(ui.item);var searchTerm=$.trim(element.val());validateIfNeeded(searchTerm),searchTerm.length<minLength&&event.preventDefault()}});var changeHanlder=function(e){validateIfNeeded(element.val())},keyUpHandler=function(e){validateIfNeeded(element.val()),scope.$apply()};element.on("change",changeHanlder),element.on("keyup",keyUpHandler),scope.$watch("isInvalid",function(){ngModelCtrl.$setValidity("selection",!scope.isInvalid),formElement
|
||
|
}function _(b){return/undefined|null|boolean|number|string/.test(a.type(b))}function aa(b,c,d){if(a.isFunction(b)&&(b=[b]),b){var e,f;for(e=0;e<b.length;e++)f=b[e].apply(c,d)||f;return f}}function ba(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]}function ca(a){return(a+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"<br />")}function da(a){return a.replace(/&.*?;/g,"")}function ea(b){var c=[];return a.each(b,function(a,b){null!=b&&c.push(a+":"+b)}),c.join(";")}function fa(a){return a.charAt(0).toUpperCase()+a.slice(1)}function ga(a,b){return a-b}function ha(a){return a%1===0}function ia(a,b){var c=a[b];return function(){return c.apply(a,arguments)}}function ja(a,b,c){var d,e,f,g,h,i=function(){var j=+new Date-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=+new Date;var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}}function ka(c,d,e){var f,g,h,i,j=c[0],k=1==c.length&&"string"==typeof j;return b.isMoment(j)?(i=b.apply(null,c),ma(j,i)):U(j)||void 0===j?i=b.apply(null,c):(f=!1,g=!1,k?db.test(j)?(j+="-01",c=[j],f=!0,g=!0):(h=eb.exec(j))&&(f=!h[5],g=!0):a.isArray(j)&&(g=!0),i=d||f?b.utc.apply(b,c):b.apply(null,c),f?(i._ambigTime=!0,i._ambigZone=!0):e&&(g?i._ambigZone=!0:k&&(i.utcOffset?i.utcOffset(j):i.zone(j)))),i._fullCalendar=!0,i}function la(a,c){var d,e,f=!1,g=!1,h=a.length,i=[];for(d=0;h>d;d++)e=a[d],b.isMoment(e)||(e=Va.moment.parseZone(e)),f=f||e._ambigTime,g=g||e._ambigZone,i.push(e);for(d=0;h>d;d++)e=i[d],c||!f||e._ambigTime?g&&!e._ambigZone&&(i[d]=e.clone().stripZone()):i[d]=e.clone().stripTime();return i}function ma(a,b){a._ambigTime?b._ambigTime=!0:b._ambigTime&&(b._ambigTime=!1),a._ambigZone?b._ambigZone=!0:b._ambigZone&&(b._ambigZone=!1)}function na(a,b){a.year(b[0]||0).month(b[1]||0).date(b[2]||0).hours(b[3]||0).minutes(b[4]||0).seconds(b[5]||0).milliseconds(b[6]||0)}function oa(a,b){return gb.format.call(a,b)}function pa(a,b){return qa(a,va(b))}function qa(a,b){var c,d="";for(c=0;c<b.length;c++)d+=ra(a,b[c]);return d}function ra(a,b){var c,d;return"string"==typeof b?b:(c=b.token)?hb[c]?hb[c](a):oa(a,c):b.maybe&&(d=qa(a,b.maybe),d.match(/[1-9]/))?d:""}function sa(a,b,c,d,e){var f;return a=Va.moment.parseZone(a),b=Va.moment.parseZone(b),f=(a.localeData||a.lang).call(a),c=f.longDateFormat(c)||c,d=d||" - ",ta(a,b,va(c),d,e)}function ta(a,b,c,d,e){var f,g,h,i,j=a.clone().stripZone(),k=b.clone().stripZone(),l="",m="",n="",o="",p="";for(g=0;g<c.length&&(f=ua(a,b,j,k,c[g]),f!==!1);g++)l+=f;for(h=c.length-1;h>g&&(f=ua(a,b,j,k,c[h]),f!==!1);h--)m=f+m;for(i=g;h>=i;i++)n+=ra(a,c[i]),o+=ra(b,c[i]);return(n||o)&&(p=e?o+d+n:n+d+o),l+p+m}function ua(a,b,c,d,e){var f,g;return"string"==typeof e?e:!!((f=e.token)&&(g=ib[f.charAt(0)],g&&c.isSame(d,g)))&&oa(a,f)}function va(a){return a in jb?jb[a]:jb[a]=wa(a)}function wa(a){for(var b,c=[],d=/\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g;b=d.exec(a);)b[1]?c.push(b[1]):b[2]?c.push({maybe:wa(b[2])}):b[3]?c.push({token:b[3]}):b[5]&&c.push(b[5]);return c}function xa(){}function ya(a,b){var c;return $(b,"constructor")&&(c=b.constructor),"function"!=typeof c&&(c=b.constructor=function(){a.apply(this,arguments)}),c.prototype=X(a.prototype),Y(b,c.prototype),Z(b,c.prototype),Y(a,c),c}function za(a,b){Y(b,a.prototype)}function Aa(a,b){return!a&&!b||!(!a||!b)&&(a.component===b.component&&Ba(a,b)&&Ba(b,a))}function Ba(a,b){for(var c in a)if(!/^(component|left|right|top|bottom)$/.test(c)&&a[c]!==b[c])return!1;return!0}function Ca(a){var b=Ea(a);return"background"===b||"inverse-background"===b}function Da(a){return"inverse-background"===Ea(a)}function Ea(a){return ba((a.source||{}).rendering,a.rendering)}function Fa(a){var b,c,d={};for(b=0;b<a.length;b++)c=a[b],(d[c._id]||(d[c._id]=[])).push(c);return d}function Ga(a,b){return a.start-b.start}function Ha(c){var d,e,f,g,h=Va.dataAttrPrefix;return h&&(h+="-"),d=c.data(h+"event")||null,d&&(d="object"==typeof d?a.extend({},d):{},e=d.start,nu
|
||
|
this.trigger("dragEnd",a),this.destroyHrefHack()},startDelay:function(a){var b=this;this.delay?this.delayTimeoutId=setTimeout(function(){b.handleDelayEnd(a)},this.delay):this.handleDelayEnd(a)},handleDelayEnd:function(a){this.isDelayEnded=!0,this.isDistanceSurpassed&&this.startDrag(a)},handleDistanceSurpassed:function(a){this.isDistanceSurpassed=!0,this.isDelayEnded&&this.startDrag(a)},handleTouchMove:function(a){this.isDragging&&a.preventDefault(),this.handleMove(a)},handleMouseMove:function(a){this.handleMove(a)},handleTouchScroll:function(a){this.isDragging||this.endInteraction(a,!0)},initHrefHack:function(){var a=this.subjectEl;(this.subjectHref=a?a.attr("href"):null)&&a.removeAttr("href")},destroyHrefHack:function(){var a=this.subjectEl,b=this.subjectHref;setTimeout(function(){b&&a.attr("href",b)},0)},trigger:function(a){this.options[a]&&this.options[a].apply(this,Array.prototype.slice.call(arguments,1)),this["_"+a]&&this["_"+a].apply(this,Array.prototype.slice.call(arguments,1))}});pb.mixin({isAutoScroll:!1,scrollBounds:null,scrollTopVel:null,scrollLeftVel:null,scrollIntervalId:null,scrollSensitivity:30,scrollSpeed:200,scrollIntervalMs:50,initAutoScroll:function(){var a=this.scrollEl;this.isAutoScroll=this.options.scroll&&a&&!a.is(window)&&!a.is(document),this.isAutoScroll&&this.listenTo(a,"scroll",ja(this.handleDebouncedScroll,100))},destroyAutoScroll:function(){this.endAutoScroll(),this.isAutoScroll&&this.stopListeningTo(this.scrollEl,"scroll")},computeScrollBounds:function(){this.isAutoScroll&&(this.scrollBounds=n(this.scrollEl))},updateAutoScroll:function(a){var b,c,d,e,f=this.scrollSensitivity,g=this.scrollBounds,h=0,i=0;g&&(b=(f-(w(a)-g.top))/f,c=(f-(g.bottom-w(a)))/f,d=(f-(v(a)-g.left))/f,e=(f-(g.right-v(a)))/f,b>=0&&1>=b?h=b*this.scrollSpeed*-1:c>=0&&1>=c&&(h=c*this.scrollSpeed),d>=0&&1>=d?i=d*this.scrollSpeed*-1:e>=0&&1>=e&&(i=e*this.scrollSpeed)),this.setScrollVel(h,i)},setScrollVel:function(a,b){this.scrollTopVel=a,this.scrollLeftVel=b,this.constrainScrollVel(),!this.scrollTopVel&&!this.scrollLeftVel||this.scrollIntervalId||(this.scrollIntervalId=setInterval(ia(this,"scrollIntervalFunc"),this.scrollIntervalMs))},constrainScrollVel:function(){var a=this.scrollEl;this.scrollTopVel<0?a.scrollTop()<=0&&(this.scrollTopVel=0):this.scrollTopVel>0&&a.scrollTop()+a[0].clientHeight>=a[0].scrollHeight&&(this.scrollTopVel=0),this.scrollLeftVel<0?a.scrollLeft()<=0&&(this.scrollLeftVel=0):this.scrollLeftVel>0&&a.scrollLeft()+a[0].clientWidth>=a[0].scrollWidth&&(this.scrollLeftVel=0)},scrollIntervalFunc:function(){var a=this.scrollEl,b=this.scrollIntervalMs/1e3;this.scrollTopVel&&a.scrollTop(a.scrollTop()+this.scrollTopVel*b),this.scrollLeftVel&&a.scrollLeft(a.scrollLeft()+this.scrollLeftVel*b),this.constrainScrollVel(),this.scrollTopVel||this.scrollLeftVel||this.endAutoScroll()},endAutoScroll:function(){this.scrollIntervalId&&(clearInterval(this.scrollIntervalId),this.scrollIntervalId=null,this.handleScrollEnd())},handleDebouncedScroll:function(){this.scrollIntervalId||this.handleScrollEnd()},handleScrollEnd:function(){}});var qb=pb.extend({component:null,origHit:null,hit:null,coordAdjust:null,constructor:function(a,b){pb.call(this,b),this.component=a},handleInteractionStart:function(a){var b,c,d,e=this.subjectEl;this.computeCoords(),a?(c={left:v(a),top:w(a)},d=c,e&&(b=n(e),d=D(d,b)),this.origHit=this.queryHit(d.left,d.top),e&&this.options.subjectCenter&&(this.origHit&&(b=C(this.origHit,b)||b),d=E(b)),this.coordAdjust=F(d,c)):(this.origHit=null,this.coordAdjust=null),pb.prototype.handleInteractionStart.apply(this,arguments)},computeCoords:function(){this.component.prepareHits(),this.computeScrollBounds()},handleDragStart:function(a){var b;pb.prototype.handleDragStart.apply(this,arguments),b=this.queryHit(v(a),w(a)),b&&this.handleHitOver(b)},handleDrag:function(a,b,c){var d;pb.prototype.handleDrag.apply(this,arguments),d=this.queryHit(v(c),w(c)),Aa(d,this.hit)||(this.hit&&this.handleHitOut(),d&&this.handleHitOver(d))},handleDragEnd:function(){this.handleHitDone(),pb.prototype.handleDragEnd.apply(this,arguments)},handl
|
||
|
},renderSegRow:function(b,c){function d(b){for(;b>g;)k=(r[e-1]||[])[g],k?k.attr("rowspan",parseInt(k.attr("rowspan")||1,10)+1):(k=a("<td/>"),h.append(k)),q[e][g]=k,r[e][g]=k,g++}var e,f,g,h,i,j,k,l=this.colCnt,m=this.buildSegLevels(c),n=Math.max(1,m.length),o=a("<tbody/>"),p=[],q=[],r=[];for(e=0;n>e;e++){if(f=m[e],g=0,h=a("<tr/>"),p.push([]),q.push([]),r.push([]),f)for(i=0;i<f.length;i++){for(j=f[i],d(j.leftCol),k=a('<td class="fc-event-container"/>').append(j.el),j.leftCol!=j.rightCol?k.attr("colspan",j.rightCol-j.leftCol+1):r[e][g]=k;g<=j.rightCol;)q[e][g]=k,p[e][g]=j,g++;h.append(k)}d(l),this.bookendCells(h),o.append(h)}return{row:b,tbodyEl:o,cellMatrix:q,segMatrix:p,segLevels:m,segs:c}},buildSegLevels:function(a){var b,c,d,e=[];for(this.sortEventSegs(a),b=0;b<a.length;b++){for(c=a[b],d=0;d<e.length&&Ia(c,e[d]);d++);c.level=d,(e[d]||(e[d]=[])).push(c)}for(d=0;d<e.length;d++)e[d].sort(Ja);return e},groupSegRows:function(a){var b,c=[];for(b=0;b<this.rowCnt;b++)c.push([]);for(b=0;b<a.length;b++)c[a[b].row].push(a[b]);return c}}),ub.mixin({segPopover:null,popoverSegs:null,removeSegPopover:function(){this.segPopover&&this.segPopover.hide()},limitRows:function(a){var b,c,d=this.rowStructs||[];for(b=0;b<d.length;b++)this.unlimitRow(b),c=!!a&&("number"==typeof a?a:this.computeRowLevelLimit(b)),c!==!1&&this.limitRow(b,c)},computeRowLevelLimit:function(b){function c(b,c){f=Math.max(f,a(c).outerHeight())}var d,e,f,g=this.rowEls.eq(b),h=g.height(),i=this.rowStructs[b].tbodyEl.children();for(d=0;d<i.length;d++)if(e=i.eq(d).removeClass("fc-limited"),f=0,e.find("> td > :first-child").each(c),e.position().top+f>h)return d;return!1},limitRow:function(b,c){function d(d){for(;d>w;)j=t.getCellSegs(b,w,c),j.length&&(m=f[c-1][w],s=t.renderMoreLink(b,w,j),r=a("<div/>").append(s),m.append(r),v.push(r[0])),w++}var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=this,u=this.rowStructs[b],v=[],w=0;if(c&&c<u.segLevels.length){for(e=u.segLevels[c-1],f=u.cellMatrix,g=u.tbodyEl.children().slice(c).addClass("fc-limited").get(),h=0;h<e.length;h++){for(i=e[h],d(i.leftCol),l=[],k=0;w<=i.rightCol;)j=this.getCellSegs(b,w,c),l.push(j),k+=j.length,w++;if(k){for(m=f[c-1][i.leftCol],n=m.attr("rowspan")||1,o=[],p=0;p<l.length;p++)q=a('<td class="fc-more-cell"/>').attr("rowspan",n),j=l[p],s=this.renderMoreLink(b,i.leftCol+p,[i].concat(j)),r=a("<div/>").append(s),q.append(r),o.push(q[0]),v.push(q[0]);m.addClass("fc-limited").after(a(o)),g.push(m[0])}}d(this.colCnt),u.moreEls=a(v),u.limitedEls=a(g)}},unlimitRow:function(a){var b=this.rowStructs[a];b.moreEls&&(b.moreEls.remove(),b.moreEls=null),b.limitedEls&&(b.limitedEls.removeClass("fc-limited"),b.limitedEls=null)},renderMoreLink:function(b,c,d){var e=this,f=this.view;return a('<a class="fc-more"/>').text(this.getMoreLinkText(d.length)).on("click",function(g){var h=f.opt("eventLimitClick"),i=e.getCellDate(b,c),j=a(this),k=e.getCellEl(b,c),l=e.getCellSegs(b,c),m=e.resliceDaySegs(l,i),n=e.resliceDaySegs(d,i);"function"==typeof h&&(h=f.trigger("eventLimitClick",null,{date:i,dayEl:k,moreEl:j,segs:m,hiddenSegs:n},g)),"popover"===h?e.showSegPopover(b,c,j,m):"string"==typeof h&&f.calendar.zoomTo(i,h)})},showSegPopover:function(a,b,c,d){var e,f,g=this,h=this.view,i=c.parent();e=1==this.rowCnt?h.el:this.rowEls.eq(a),f={className:"fc-more-popover",content:this.renderSegPopoverContent(a,b,d),parentEl:this.el,top:e.offset().top,autoHide:!0,viewportConstrain:h.opt("popoverViewportConstrain"),hide:function(){g.segPopover.removeElement(),g.segPopover=null,g.popoverSegs=null}},this.isRTL?f.right=i.offset().left+i.outerWidth()+1:f.left=i.offset().left-1,this.segPopover=new nb(f),this.segPopover.show()},renderSegPopoverContent:function(b,c,d){var e,f=this.view,g=f.opt("theme"),h=this.getCellDate(b,c).format(f.opt("dayPopoverFormat")),i=a('<div class="fc-header '+f.widgetHeaderClass+'"><span class="fc-close '+(g?"ui-icon ui-icon-closethick":"fc-icon fc-icon-x")+'"></span><span class="fc-title">'+ca(h)+'</span><div class="fc-clear"/></div><div class="fc-body '+f.widgetContentClass+'"><div class="fc-event-container"></div></div>'),j=i.find(".fc-e
|
||
|
e[a]=b(d)}),a.datepicker&&(a.datepicker.regional[c]=a.datepicker.regional[b]=d,a.datepicker.regional.en=a.datepicker.regional[""],a.datepicker.setDefaults(d))},Va.lang=function(b,d){var e,f;e=zb[b]||(zb[b]={}),d&&(e=zb[b]=c([e,d])),f=Ra(b),a.each(Bb,function(a,b){null==e[a]&&(e[a]=b(f,e))}),yb.defaults.lang=b};var Ab={buttonText:function(a){return{prev:da(a.prevText),next:da(a.nextText),today:da(a.currentText)}},monthYearFormat:function(a){return a.showMonthAfterYear?"YYYY["+a.yearSuffix+"] MMMM":"MMMM YYYY["+a.yearSuffix+"]"}},Bb={dayOfMonthFormat:function(a,b){var c=a.longDateFormat("l");return c=c.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g,""),b.isRTL?c+=" ddd":c="ddd "+c,c},mediumTimeFormat:function(a){return a.longDateFormat("LT").replace(/\s*a$/i,"a")},smallTimeFormat:function(a){return a.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"a")},extraSmallTimeFormat:function(a){return a.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"t")},hourFormat:function(a){return a.longDateFormat("LT").replace(":mm","").replace(/(\Wmm)$/,"").replace(/\s*a$/i,"a")},noMeridiemTimeFormat:function(a){return a.longDateFormat("LT").replace(/\s*a$/i,"")}},Cb={smallDayDateFormat:function(a){return a.isRTL?"D dd":"dd D"},weekFormat:function(a){return a.isRTL?"w[ "+a.weekNumberTitle+"]":"["+a.weekNumberTitle+" ]w"},smallWeekFormat:function(a){return a.isRTL?"w["+a.weekNumberTitle+"]":"["+a.weekNumberTitle+"]w"}};Va.lang("en",yb.englishDefaults),Va.sourceNormalizers=[],Va.sourceFetchers=[];var Db={dataType:"json",cache:!1},Eb=1;yb.prototype.normalizeEvent=function(a){},yb.prototype.getPeerEvents=function(a,b){var c,d,e=this.getEventCache(),f=[];for(c=0;c<e.length;c++)d=e[c],b&&b._id===d._id||f.push(d);return f};var Fb=Va.BasicView=wb.extend({scroller:null,dayGridClass:ub,dayGrid:null,dayNumbersVisible:!1,weekNumbersVisible:!1,weekNumberWidth:null,headContainerEl:null,headRowEl:null,initialize:function(){this.dayGrid=this.instantiateDayGrid(),this.scroller=new xb({overflowX:"hidden",overflowY:"auto"})},instantiateDayGrid:function(){var a=this.dayGridClass.extend(Gb);return new a(this)},setRange:function(a){wb.prototype.setRange.call(this,a),this.dayGrid.breakOnWeeks=/year|month|week/.test(this.intervalUnit),this.dayGrid.setRange(a)},computeRange:function(a){var b=wb.prototype.computeRange.call(this,a);return/year|month/.test(b.intervalUnit)&&(b.start.startOf("week"),b.start=this.skipHiddenDays(b.start),b.end.weekday()&&(b.end.add(1,"week").startOf("week"),b.end=this.skipHiddenDays(b.end,-1,!0))),b},renderDates:function(){this.dayNumbersVisible=this.dayGrid.rowCnt>1,this.weekNumbersVisible=this.opt("weekNumbers"),this.dayGrid.numbersVisible=this.dayNumbersVisible||this.weekNumbersVisible,this.el.addClass("fc-basic-view").html(this.renderSkeletonHtml()),this.renderHead(),this.scroller.render();var b=this.scroller.el.addClass("fc-day-grid-container"),c=a('<div class="fc-day-grid" />').appendTo(b);this.el.find(".fc-body > tr > td").append(b),this.dayGrid.setElement(c),this.dayGrid.renderDates(this.hasRigidRows())},renderHead:function(){this.headContainerEl=this.el.find(".fc-head-container").html(this.dayGrid.renderHeadHtml()),this.headRowEl=this.headContainerEl.find(".fc-row")},unrenderDates:function(){this.dayGrid.unrenderDates(),this.dayGrid.removeElement(),this.scroller.destroy()},renderBusinessHours:function(){this.dayGrid.renderBusinessHours()},renderSkeletonHtml:function(){return'<table><thead class="fc-head"><tr><td class="fc-head-container '+this.widgetHeaderClass+'"></td></tr></thead><tbody class="fc-body"><tr><td class="'+this.widgetContentClass+'"></td></tr></tbody></table>'},weekNumberStyleAttr:function(){return null!==this.weekNumberWidth?'style="width:'+this.weekNumberWidth+'px"':""},hasRigidRows:function(){var a=this.opt("eventLimit");return a&&"number"!=typeof a},updateWidth:function(){this.weekNumbersVisible&&(this.weekNumberWidth=k(this.el.find(".fc-week-number")))},setHeight:function(a,b){var c,d,g=this.opt("eventLimit");this.scroller.clear(),f(this.headRow
|
||
|
return It.apply(this,arguments),this.unbindResources(!0)},X.prototype.displayEvents=function(t){return this.whenResources(function(e){return function(){return Et.call(e,t)}}(this))},X.prototype.bindResources=function(){var e;return this.isResourcesBound?void 0:(this.isResourcesBound=!0,this.settingResources=t.Deferred(),e=function(t){return function(e){return t.setResources(e),t.settingResources.resolve()}}(this),this.listenTo(this.calendar.resourceManager,{set:e,unset:this.unsetResources,reset:this.resetResources,add:this.addResource,remove:this.removeResource}),this.calendar.resourceManager.hasFetched()?e(this.calendar.resourceManager.topLevelResources):this.calendar.resourceManager.getResources())},X.prototype.unbindResources=function(t){return this.isResourcesBound?(this.stopListeningTo(this.calendar.resourceManager),"resolved"===this.settingResources.state()&&this.unsetResources(t),this.settingResources=null,this.isResourcesBound=!1):void 0},X.prototype.whenResources=function(e){return"resolved"===this.settingResources.state()?t.when(e?e():void 0):e?this.settingResources.then(e):this.settingResources.promise()},X.prototype.setResources=function(t){},X.prototype.unsetResources=function(){},X.prototype.resetResources=function(t){return this.calendar.rerenderEvents()},X.prototype.addResource=function(t){return this.resetResources(this.calendar.resourceManager.topLevelResources)},X.prototype.removeResource=function(t){return this.resetResources(this.calendar.resourceManager.topLevelResources)},Ht=f.prototype.getSegClasses,f.prototype.getSegClasses=function(t){var e,r,o,i,n;for(e=Ht.apply(this,arguments),i=this.getSegResources(t),r=0,o=i.length;o>r;r++)n=i[r],e=e.concat(n.eventClassName||[]);return e},f.prototype.getSegSkinCss=function(t){var e,r,o,i,n,s,l,h,u,a;return a=this.view,e=t.event,h=e.source||{},r=e.color,u=h.color,s=a.opt("eventColor"),l=this.getSegResources(t),o=function(){var t,e,r,o;for(o=null,e=0,r=l.length;r>e;e++)for(t=l[e];t&&!o;)o=t.eventBackgroundColor||t.eventColor,t=t._parent;return o},i=function(){var t,e,r,o;for(o=null,e=0,r=l.length;r>e;e++)for(t=l[e];t&&!o;)o=t.eventBorderColor||t.eventColor,t=t._parent;return o},n=function(){var t,e,r,o;for(o=null,e=0,r=l.length;r>e;e++)for(t=l[e];t&&!o;)o=t.eventTextColor,t=t._parent;return o},{"background-color":e.backgroundColor||r||o()||h.backgroundColor||u||a.opt("eventBackgroundColor")||s,"border-color":e.borderColor||r||i()||h.borderColor||u||a.opt("eventBorderColor")||s,color:e.textColor||n()||h.textColor||a.opt("eventTextColor")}},f.prototype.getSegResources=function(t){return t.resource?[t.resource]:this.view.calendar.getEventResources(t.event)},D=function(e){function r(t){this.calendar=t,this.initializeCache()}return kt(r,e),r.mixin(a),r.resourceGuid=1,r.ajaxDefaults={dataType:"json",cache:!1},r.prototype.calendar=null,r.prototype.topLevelResources=null,r.prototype.resourcesById=null,r.prototype.fetching=null,r.prototype.hasFetched=function(){return this.fetching&&"resolved"===this.fetching.state()},r.prototype.getResources=function(){var e;return this.fetching?t.Deferred().resolve(this.topLevelResources).promise():(e=t.Deferred(),this.fetchResources().done(function(t){return e.resolve(t)}).fail(function(){return e.resolve([])}),e)},r.prototype.fetchResources=function(){var e;return e=this.fetching,t.when(e).then(function(t){return function(){return t.fetching=t.fetchResourceInputs().then(function(r){return t.setResources(r,Boolean(e)),t.topLevelResources})}}(this))},r.prototype.fetchResourceInputs=function(){var e,o,i;switch(e=t.Deferred(),i=this.calendar.options.resources,"string"===t.type(i)&&(i={url:i}),t.type(i)){case"function":i(function(t){return function(t){return e.resolve(t)}}(this));break;case"object":o=t.ajax(t.extend({},r.ajaxDefaults,i));break;case"array":e.resolve(i);break;default:e.resolve([])}return o||(o=e.promise()),"pending"===!o.state()&&(this.calendar.pushLoading(),o.always(function(){return this.calendar.popLoading()})),o},r.prototype.resetResources=function(){return this.getResources().then(function(t){return function(){retur
|
||
|
}return C},o.prototype.buildSegLevels=function(t){var e,r,o,i,n,s,l,h,u,a,c,p,d,f;for(d=[],this.sortEventSegs(t),o=0,s=t.length;s>o;o++){for(f=t[o],f.above=[],u=0;u<d.length;){for(r=!1,c=d[u],i=0,l=c.length;l>i;i++)a=c[i],Bt(f,a)&&(f.above.push(a),r=!0);if(!r)break;u+=1}for((d[u]||(d[u]=[])).push(f),u+=1;u<d.length;){for(p=d[u],n=0,h=p.length;h>n;n++)e=p[n],Bt(f,e)&&e.above.push(f);u+=1}}return d},o.prototype.unrenderFgContainers=function(t){var e,r,o,i;for(i=[],r=0,o=t.length;o>r;r++)e=t[r],e.segContainerEl.empty(),e.segContainerEl.height(""),i.push(e.segContainerHeight=null);return i},o.prototype.fgSegHtml=function(t,e){var r,o,i,n,s,l;return o=t.event,i=this.view.isEventDraggable(o),s=t.isStart&&this.view.isEventResizableFromStart(o),n=t.isEnd&&this.view.isEventResizableFromEnd(o),r=this.getSegClasses(t,i,s||n),r.unshift("fc-timeline-event","fc-h-event"),l=this.getEventTimeText(o),'<a class="'+r.join(" ")+'" style="'+rt(this.getSegSkinCss(t))+'"'+(o.url?' href="'+yt(o.url)+'"':"")+'><div class="fc-content">'+(l?'<span class="fc-time">'+yt(l)+"</span>":"")+'<span class="fc-title">'+(o.title?yt(o.title):" ")+'</span></div><div class="fc-bg" />'+(s?'<div class="fc-resizer fc-start-resizer"></div>':"")+(n?'<div class="fc-resizer fc-end-resizer"></div>':"")+"</a>"},o.prototype.updateSegFollowers=function(t){var e,r,o,i,n;if(this.eventTitleFollower){for(i=[],e=0,r=t.length;r>e;e++)o=t[e],n=o.el.find(".fc-title"),n.length&&i.push(new P(n));return this.eventTitleFollower.setSprites(i)}},o.prototype.clearSegFollowers=function(){return this.eventTitleFollower?this.eventTitleFollower.clearSprites():void 0},o.prototype.segDragStart=function(){return o.__super__.segDragStart.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.forceRelative():void 0},o.prototype.segDragEnd=function(){return o.__super__.segDragEnd.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.clearForce():void 0},o.prototype.segResizeStart=function(){return o.__super__.segResizeStart.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.forceRelative():void 0},o.prototype.segResizeEnd=function(){return o.__super__.segResizeEnd.apply(this,arguments),this.eventTitleFollower?this.eventTitleFollower.clearForce():void 0},o.prototype.renderHelper=function(t,e){var r;return r=this.eventToSegs(t),r=this.renderFgSegEls(r),this.renderHelperSegsInContainers([[this,r]],e)},o.prototype.renderHelperSegsInContainers=function(e,r){var o,i,n,s,l,h,u,a,c,p,d,f,g,y,v,w,m,R;for(s=[],m=[],l=0,a=e.length;a>l;l++)for(g=e[l],o=g[0],R=g[1],h=0,c=R.length;c>h;h++)w=R[h],i=this.rangeToCoords(w),w.el.css({left:w.left=i.left,right:-(w.right=i.right)}),r&&r.resourceId===(null!=(y=o.resource)?y.id:void 0)?w.el.css("top",r.el.css("top")):w.el.css("top",0);for(u=0,p=e.length;p>u;u++)for(v=e[u],o=v[0],R=v[1],n=t('<div class="fc-event-container fc-helper-container"/>').appendTo(o.innerEl),s.push(n[0]),f=0,d=R.length;d>f;f++)w=R[f],n.append(w.el),m.push(w.el[0]);return this.helperEls?this.helperEls=this.helperEls.add(t(s)):this.helperEls=t(s),t(m)},o.prototype.unrenderHelper=function(){return this.helperEls?(this.helperEls.remove(),this.helperEls=null):void 0},o.prototype.renderEventResize=function(t,e){return this.renderHighlight(this.eventToSpan(t)),this.renderEventLocationHelper(t,e)},o.prototype.unrenderEventResize=function(){return this.unrenderHighlight(),this.unrenderHelper()},o.prototype.renderFill=function(t,e,r){return e=this.renderFillSegEls(t,e),this.renderFillInContainers(t,[[this,e]],r),e},o.prototype.renderFillInContainers=function(t,e,r){var o,i,n,s,l,h;for(l=[],i=0,n=e.length;n>i;i++)s=e[i],o=s[0],h=s[1],l.push(this.renderFillInContainer(t,o,h,r));return l},o.prototype.renderFillInContainer=function(e,r,o,i){var n,s,l,h,u;if(o.length){for(i||(i=e.toLowerCase()),n=t('<div class="fc-'+i+'-container" />').appendTo(r.bgSegContainerEl),l=0,h=o.length;h>l;l++)u=o[l],s=this.rangeToCoords(u),u.el.css({left:u.left=s.left,right:-(u.right=s.right)}),u.el.appendTo(n);return this.elsByFill[e]?this.elsByFill[e]=this.elsByFill[e].add(n)
|
||
|
"fc-icon-"+t+"-triangle"},e.prototype.animateExpand=function(){var t,e,r;return r=null!=(t=this.children[0])&&null!=(e=t.getLeadingRow())?e.trs:void 0,r?(r.addClass("fc-collapsed"),setTimeout(function(){return r.addClass("fc-transitioning"),r.removeClass("fc-collapsed")}),r.one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){return r.removeClass("fc-transitioning")})):void 0},e.prototype.getMaxTrInnerHeight=function(){var e;return e=0,t.each(this.trHash,function(t){return function(t,r){var o;return o=ct(r).find("> div:not(.fc-cell-content):first"),e=Math.max(o.height(),e)}}(this)),e},e.prototype.setTrInnerHeight=function(e){return t.each(this.trHash,function(t){return function(t,r){return ct(r).find("> div:not(.fc-cell-content):first").height(e)}}(this))},e.prototype.shown=function(){return this.hasOwnRow?this.rowShown(this):void 0},e.prototype.hidden=function(){return this.hasOwnRow?this.rowHidden(this):void 0},e.prototype.rowShown=function(t){return(this.parent||this.view).rowShown(t)},e.prototype.rowHidden=function(t){return(this.parent||this.view).rowHidden(t)},e.prototype.added=function(){return this.hasOwnRow?this.rowAdded(this):void 0},e.prototype.removed=function(){return this.hasOwnRow?this.rowRemoved(this):void 0},e.prototype.rowAdded=function(t){return(this.parent||this.view).rowAdded(t)},e.prototype.rowRemoved=function(t){return(this.parent||this.view).rowRemoved(t)},e}(),B=function(e){function r(t,e,o){this.groupSpec=e,this.groupValue=o,r.__super__.constructor.apply(this,arguments)}return kt(r,e),r.prototype.groupSpec=null,r.prototype.groupValue=null,r.prototype.rowRemoved=function(t){return r.__super__.rowRemoved.apply(this,arguments),t===this||this.children.length?void 0:this.remove()},r.prototype.renderGroupContentEl=function(){var e,r;return e=t('<div class="fc-cell-content" />').append(this.renderGroupTextEl()),r=this.groupSpec.render,"function"==typeof r&&(e=r(e,this.groupValue)||e),e},r.prototype.renderGroupTextEl=function(){var e,r;return r=this.groupValue||"",e=this.groupSpec.text,"function"==typeof e&&(r=e(r)||r),t('<span class="fc-cell-text" />').text(r)},r}(z),g=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return kt(r,e),r.prototype.hasOwnRow=!0,r.prototype.renderSpreadsheetContent=function(e){var r;return r=this.renderGroupContentEl(),r.prepend('<span class="fc-expander"><span class="fc-icon"></span></span>'),t('<td class="fc-divider" />').attr("colspan",this.view.colSpecs.length).append(t("<div/>").append(r)).appendTo(e)},r.prototype.renderEventContent=function(t){return t.append('<td class="fc-divider"> <div/> </td>')},r}(B),U=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return kt(r,e),r.prototype.rowspan=0,r.prototype.leadingTr=null,r.prototype.groupTd=null,r.prototype.rowShown=function(t){return this.rowspan+=1,this.renderRowspan(),r.__super__.rowShown.apply(this,arguments)},r.prototype.rowHidden=function(t){return this.rowspan-=1,this.renderRowspan(),r.__super__.rowHidden.apply(this,arguments)},r.prototype.renderRowspan=function(){var e;return this.rowspan?(this.groupTd||(this.groupTd=t('<td class="'+this.view.widgetContentClass+'"/>').append(this.renderGroupContentEl())),this.groupTd.attr("rowspan",this.rowspan),e=this.getLeadingRow().getTr("spreadsheet"),e!==this.leadingTr?(e&&e.prepend(this.groupTd),this.leadingTr=e):void 0):(this.groupTd&&(this.groupTd.remove(),this.groupTd=null),this.leadingTr=null)},r}(B),p=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return kt(e,t),e.prototype.hasOwnRow=!0,e.prototype.segContainerEl=null,e.prototype.segContainerHeight=null,e.prototype.innerEl=null,e.prototype.bgSegContainerEl=null,e.prototype.isSegsRendered=!1,e.prototype.bgSegs=null,e.prototype.fgSegs=null,e.prototype.renderEventContent=function(t){return t.html('<td class="'+this.view.widgetContentClass+'"> <div> <div class="fc-event-container" /> </div> </td>'),this.segContainerEl=t.find(".fc-event-container"),this.innerEl=this.bgSegContainerEl=t.find("td
|
||
|
var days1InBinary=convertDaysToBinary(avb1.days),days2InBinary=convertDaysToBinary(avb2.days);return 0!==(days1InBinary&days2InBinary)},hasOverlappingTimes=function(avb1,avb2){return avb1.startTime<avb2.endTime&&avb2.startTime<avb1.endTime};scope.confirmDelete=function(){var childScope={};childScope.message="CONFIRM_DELETE_AVAILABILITY",childScope.ok=deleteAvailability,childScope.cancel=cancelDelete,confirmBox({scope:childScope,actions:[{name:"cancel",display:"CANCEL_KEY"},{name:"ok",display:"OK_KEY"}],className:"ngdialog-theme-default delete-program-popup"})};var deleteAvailability=function(closeDialog){var index=scope.availabilityList.indexOf(scope.availability);scope.availabilityList.splice(index,1),closeDialog()},cancelDelete=function(closeDialog){closeDialog()};scope.cancel=function(){scope.availability=scope.backUpAvailability,scope.doesOverlap=!1,scope.state=states.READONLY},scope.enableEdit=function(){scope.backUpAvailability=scope.availability,scope.availability=angular.copy(scope.availability),scope.state=states.EDIT},scope.isNew=function(){return scope.state===states.NEW},scope.isEdit=function(){return scope.state===states.EDIT},scope.isReadOnly=function(){return scope.state===states.READONLY},init()};return{restrict:"AE",scope:{availability:"=?",availabilityList:"=",state:"=",disableMaxLoad:"="},link:link,templateUrl:"../appointments/views/admin/appointmentServiceAvailability.html"}}]),angular.module("bahmni.appointments").directive("serviceTypes",["ngDialog","messagingService","appointmentsService",function(ngDialog,messagingService,appointmentsService){var controller=function($scope){$scope.serviceType={},$scope.updateServiceTypeDuration=function(){_.isEmpty($scope.serviceType.name)?($scope.serviceType.duration=void 0,$scope.serviceTypesForm.serviceTypeName.$setValidity("uniqueServiceTypeName",!0)):$scope.serviceType.duration=$scope.serviceType.duration||Bahmni.Appointments.Constants.defaultServiceTypeDuration};var validateServiceType=function(serviceType){var nonVoidedServiceTypes=_.filter($scope.service.serviceTypes,function(serviceType){return!serviceType.voided});return!_.find(nonVoidedServiceTypes,serviceType)};$scope.addServiceType=function(serviceType){validateServiceType(serviceType)?($scope.service.serviceTypes.push({name:serviceType.name,duration:serviceType.duration?serviceType.duration:0}),$scope.serviceType={name:void 0,duration:void 0},$scope.serviceTypesForm.serviceTypeName.$setValidity("uniqueServiceTypeName",!0)):$scope.serviceTypesForm.serviceTypeName.$setValidity("uniqueServiceTypeName",!1)};var openConfirmationDialog=function(serviceType){ngDialog.openConfirm({template:"views/admin/serviceTypeDeleteConfirmation.html",scope:$scope,data:{serviceType:serviceType},closeByEscape:!0})};$scope.deleteServiceType=function(serviceType){_.isEmpty(serviceType.uuid)?openConfirmationDialog(serviceType):appointmentsService.getAppointmentsForServiceType(serviceType.uuid).then(function(response){response.data.length?messagingService.showMessage("error","APPOINTMENT_SERVICE_TYPE_DELETE_CONFIRMATION_DIALOG_MESSAGE_KEY"):openConfirmationDialog(serviceType)})},$scope.deleteServiceTypeOnConfirmation=function(serviceType){_.isEmpty(serviceType.uuid)?_.remove($scope.service.serviceTypes,serviceType):serviceType.voided=!0,ngDialog.close()},$scope.cancelTransition=function(){ngDialog.close()}};return{restrict:"E",scope:{service:"="},templateUrl:"../appointments/views/admin/serviceTypes.html",controller:controller}}]),angular.module("bahmni.appointments").directive("colorPicker",["$document",function($document){return{restrict:"E",scope:{colors:"=",selectedColor:"="},templateUrl:"../appointments/views/admin/colorPicker.html",link:function(scope){scope.showTheColorPicker=function(event){scope.showColorPicker=!scope.showColorPicker,event.stopPropagation()},scope.setColor=function(color,event){scope.selectedColor=color,scope.showColorPicker=!1,event.stopPropagation()},$document.bind("click",function(ev){scope.showColorPicker=!1,scope.$digest()})}}}]),angular.module("bahmni.appointments").directive("datePicker",funct
|
||
|
})},filterTimingsBasedOnInput=function(enteredNumber,allowedList){var showTimes=[];return _.each(allowedList,function(time){(time.startsWith(enteredNumber)||1===time.indexOf(enteredNumber)&&0===time.indexOf(0))&&showTimes.push(time)}),0===showTimes.length?allowedList:showTimes};$scope.onKeyDownOnStartTime=function(){$scope.showStartTimes=filterTimingsBasedOnInput($scope.appointment.startTime,$scope.startTimes)},$scope.onKeyDownOnEndTime=function(){$scope.showEndTimes=filterTimingsBasedOnInput($scope.appointment.endTime,$scope.endTimes)},$scope.onSelectStartTime=function(data){setMinDuration(),$scope.warning.startTime=!isAppointmentTimeWithinServiceAvailability($scope.appointment.startTime),moment($scope.appointment.startTime,"hh:mm a",!0).isValid()&&($scope.appointment.endTime=moment($scope.appointment.startTime,"hh:mm a").add($scope.minDuration,"m").format("hh:mm a"),$scope.onSelectEndTime())};var isSelectedSlotOutOfRange=function(){return!(!$scope.appointment.startTime||$scope.warning.appointmentDate||$scope.warning.startTime||$scope.warning.endTime)&&!isAppointmentStartTimeAndEndTimeWithinServiceAvailability()};$scope.onSelectEndTime=function(data){$scope.warning.endTime=!1,$scope.checkAvailability(),$scope.warning.endTime=!isAppointmentTimeWithinServiceAvailability($scope.appointment.endTime),$scope.warning.outOfRange=isSelectedSlotOutOfRange()};var triggerSlotCalculation=function(){$scope.appointment&&$scope.appointment.service&&$scope.appointment.date&&$scope.appointment.startTime&&$scope.appointment.endTime&&_.isEmpty($scope.selectedService.serviceTypes)&&getSlotsInfo()};$scope.responseMap=function(data){return _.map(data,function(patientInfo){return patientInfo.label=patientInfo.givenName+(patientInfo.familyName?" "+patientInfo.familyName:"")+" ("+patientInfo.identifier+")",patientInfo})};var clearAvailabilityInfo=function(){$scope.warning.appointmentDate=!1,$scope.warning.startTime=!1,$scope.warning.endTime=!1,$scope.warning.outOfRange=!1,clearSlotsInfo()};$scope.onSpecialityChange=function(){$scope.appointment.specialityUuid||delete $scope.appointment.specialityUuid,delete $scope.selectedService,delete $scope.appointment.service,delete $scope.appointment.serviceType,delete $scope.appointment.location,clearAvailabilityInfo()},$scope.onServiceChange=function(){clearAvailabilityInfo(),delete $scope.appointment.serviceType,delete $scope.weeklyAvailabilityOnSelectedDate,$scope.appointment.service&&setServiceDetails($scope.appointment.service).then(function(){$scope.onSelectStartTime()})},$scope.onServiceTypeChange=function(){$scope.appointment.serviceType&&(setMinDuration(),clearAvailabilityInfo(),$scope.onSelectStartTime())};var getWeeklyAvailabilityOnADate=function(date,weeklyAvailability){var dayOfWeek=moment(date).format("dddd").toUpperCase();return _.filter(weeklyAvailability,function(o){return o.dayOfWeek===dayOfWeek})},setServiceAvailableTimesForADate=function(date){$scope.allowedStartTime=$scope.selectedService.startTime||"12:00 am",$scope.allowedEndTime=$scope.selectedService.endTime||"11:59 pm",$scope.selectedService.weeklyAvailability&&$scope.selectedService.weeklyAvailability.length>0&&($scope.weeklyAvailabilityOnSelectedDate=getWeeklyAvailabilityOnADate(date,$scope.selectedService.weeklyAvailability),$scope.weeklyAvailabilityOnSelectedDate&&0===$scope.weeklyAvailabilityOnSelectedDate.length&&($scope.allowedStartTime=void 0,$scope.allowedEndTime=void 0))},isServiceAvailableOnWeekDate=function(dayOfWeek,weeklyAvailability){return _.find(weeklyAvailability,function(wA){return wA.dayOfWeek===dayOfWeek})};$scope.checkAvailability=function(){if($scope.warning.appointmentDate=!1,!$scope.isPastAppointment&&$scope.selectedService&&$scope.appointment.date){setServiceAvailableTimesForADate($scope.appointment.date);var allSlots,dayOfWeek=moment($scope.appointment.date).format("dddd").toUpperCase();_.isEmpty($scope.selectedService.weeklyAvailability)?allSlots=getAllSlots($scope.selectedService.startTime,$scope.selectedService.endTime,$scope.minDuration):(allSlots=getSlotsForWeeklyAvailability(dayOfWeek,$scope.selec
|
||
|
},setAppointments=function(params){return autoRefreshStatus=!1,$scope.weekView?appointmentsService.searchAppointments(params).then(resolveAppointmentsData):appointmentsService.getAllAppointments(params).then(resolveAppointmentsData)},resolveAppointmentsData=function(response){$scope.allAppointmentsForDay=response.data;var filteredAppointments=appointmentsFilter($scope.allAppointmentsForDay,$state.params.filterParams);return $rootScope.appointmentsData=filteredAppointments,autoRefreshStatus=!0,parseAppointments(filteredAppointments,$state.params.filterParams)},setAppointmentsInAutoRefresh=function(){if(autoRefreshStatus){var viewDate=$scope.startDate||moment().startOf("day").toDate(),params={forDate:viewDate};if($scope.weekView){var weekStartDate=getWeekStartDate(viewDate),weekEndDate=getWeekEndDate(weekStartDate);params={startDate:weekStartDate,endDate:weekEndDate}}setAppointments(params)}},autoRefresh=function(){if(enableAutoRefresh){var autoRefreshIntervalInMilliSeconds=autoRefreshIntervalInSeconds*SECONDS_TO_MILLISECONDS_FACTOR;return $interval(setAppointmentsInAutoRefresh,autoRefreshIntervalInMilliSeconds)}}();return $scope.$on("$destroy",function(){enableAutoRefresh&&$interval.cancel(autoRefresh)}),init()}]),angular.module("bahmni.appointments").controller("AppointmentsListViewController",["$scope","$state","$rootScope","$translate","$stateParams","spinner","appointmentsService","appService","appointmentsFilter","printer","checkinPopUp","confirmBox","ngDialog","messagingService","appointmentCommonService","$interval",function($scope,$state,$rootScope,$translate,$stateParams,spinner,appointmentsService,appService,appointmentsFilter,printer,checkinPopUp,confirmBox,ngDialog,messagingService,appointmentCommonService,$interval){$scope.enableSpecialities=appService.getAppDescriptor().getConfigValue("enableSpecialities"),$scope.enableServiceTypes=appService.getAppDescriptor().getConfigValue("enableServiceTypes"),$scope.allowedActions=appService.getAppDescriptor().getConfigValue("allowedActions")||[],$scope.allowedActionsByStatus=appService.getAppDescriptor().getConfigValue("allowedActionsByStatus")||{},$scope.colorsForListView=appService.getAppDescriptor().getConfigValue("colorsForListView")||{};var maxAppointmentProviders=appService.getAppDescriptor().getConfigValue("maxAppointmentProviders")||1;$scope.enableResetAppointmentStatuses=appService.getAppDescriptor().getConfigValue("enableResetAppointmentStatuses"),$scope.manageAppointmentPrivilege=Bahmni.Appointments.Constants.privilegeManageAppointments,$scope.ownAppointmentPrivilege=Bahmni.Appointments.Constants.privilegeOwnAppointments,$scope.resetAppointmentStatusPrivilege=Bahmni.Appointments.Constants.privilegeResetAppointmentStatus,$scope.searchedPatient=!1,$scope.additionalInfoColumns=appService.getAppDescriptor().getConfigValue("additionalInfoColumns")||{};var autoRefreshIntervalInSeconds=parseInt(appService.getAppDescriptor().getConfigValue("autoRefreshIntervalInSeconds")),enableAutoRefresh=!isNaN(autoRefreshIntervalInSeconds),autoRefreshStatus=!0;const SECONDS_TO_MILLISECONDS_FACTOR=1e3;var oldPatientData=[],currentUserPrivileges=$rootScope.currentUser.privileges,currentProviderUuId=$rootScope.currentProvider.uuid;$scope.$on("filterClosedOpen",function(event,args){$scope.isFilterOpen=args.filterViewStatus});var init=function(){$scope.searchedPatient=$stateParams.isSearchEnabled&&$stateParams.patient,$scope.startDate=$stateParams.viewDate||moment().startOf("day").toDate(),$scope.isFilterOpen=$stateParams.isFilterOpen},buildTableHeader=function(){$scope.tableInfo=[{heading:"APPOINTMENT_PATIENT_ID",sortInfo:"patient.identifier",enable:!0},{heading:"APPOINTMENT_PATIENT_NAME",sortInfo:"patient.name",class:!0,enable:!0},{heading:"APPOINTMENT_DATE",sortInfo:"date",enable:!0},{heading:"APPOINTMENT_START_TIME_KEY",sortInfo:"startDateTime",enable:!0},{heading:"APPOINTMENT_END_TIME_KEY",sortInfo:"endDateTime",enable:!0},{heading:"APPOINTMENT_PROVIDER",sortInfo:"provider.name",class:!0,enable:!0},{heading:"APPOINTMENT_SERVICE_SPECIALITY_KEY",sortInfo:"service.speciality.name",
|