NINS_CODE/bahmniapps/appointments/appointments.min.11ddddde.js

13 lines
379 KiB
JavaScript
Raw Permalink Normal View History

2024-12-12 22:37:39 +06:00
"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/",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-MMM-YYYY",timeDisplayFormat:"hh:m
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,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):_.keys(baseResultData).length>0&&appDescriptor.setDefinition(baseResultData)},loadDefinition=function(appDescriptor){var deferrable=$q.defer();return loadConfig(baseUrl+appDescriptor.contextPath+"/app.json").then(function(baseResult){baseResult.data.shouldOverRideConfig?loadConfig(customUrl+appDescriptor.contextPath+"/app.json").then(function(customResult){setDefinition(baseResult.data,customResult.data),deferrable.resolve(appDescriptor)},function(){setDefinition(baseResult.data),deferrable.resolve(appDescriptor)}):(setDefinition(baseResult.data),deferrable.resolve(appDescriptor))},function(error){404!==error.status?deferrable.reject(error):deferrable.resolve(appDescriptor)}),deferrable.promise},setExtensions=function(baseResultData,customResultData){customResultData?appDescriptor.setExtensions(baseResultData,customResultData):appDescriptor.setExtensions(baseResultData)},loadExtensions=function(appDescriptor,extensionFileName){var deferrable=$q.defer();return loadConfig(baseUrl+appDescriptor.extensionPath+extensionFileName).then(function(baseResult){baseResult.data.shouldOverRideConfig?loadConfig(customUrl+appDescriptor.extensionPath+extensionFileName).then(function(customResult){setExtensions(baseResult.data,customResult.data),deferrable.resolve(ap
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.setCustomValidity(scope.isInvalid?validationMessage:"")}),scope.$on("$destroy",function(){element.off("change",changeHanlder),element.off("keyup",keyUpHandler)})};return{link:link,require:"ngModel",scope:{source:"&",responseMap:"&?",onSelect:"&",onEdit:"&?",minLength:"=?",blurOnSelect:"=?",strictSelect:"=?
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,null==e&&(e=d.time),f=d.duration,g=d.stick,delete d.start,delete d.time,delete d.duration,delete d.stick),null==e&&(e=c.data(h+"start")),null==e&&(e=c.data(h+"time")),null==f&&(f=c.data(h+"duration")),null==g&&(g=c.data(h+"stick")),e=null!=e?b.duration(e):null,f=null!=f?b.duration(f):null,g=Boolean(g),{eventProps:d,startTime:e,duration:f,stick:g}}function Ia(a,b){var c,d;for(c=0;c<b.length;c++)if(d=b[c],d.leftCol<=a.rightCol&&d.rightCol>=a.leftCol)return!0;return!1}function Ja(a,b){return a.leftCol-b.leftCol}function Ka(a){var b,c,d,e=[];for(b=0;b<a.length;b++){for(c=a[b],d=0;d<e.length&&Na(c
},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)},handleHitOver:function(a){var b=Aa(a,this.origHit);this.hit=a,this.trigger("hitOver",this.hit,b,this.origHit)},handleHitOut:function(){this.hit&&(this.trigger("hitOut",this.hit),this.handleHitDone(),this.hit=null)},handleHitDone:function(){this.hit&&this.trigger("hitDone",this.hit)},handleInteractionEnd:function(){pb.prototype.handleInteractionEnd.apply(this,arguments),this.origHit=null,this.hit=null,this.component.releaseHits()},handleScrollEnd:function(){pb.prototype.handleScrollEnd.apply(this,arguments),this.computeCoords()},queryHit:function(a,b){return this.coordAdjust&&(a+=this.coordAd
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-event-container");for(d=this.renderFgSegEls(d,!0),this.popoverSegs=d,e=0;e<d.length;e++)this.prepareHits(),d[e].hit=this.getCellHit(b,c),this.releaseHits(),j.append(d[e].el);return i},resliceDaySegs:function(b,c){var d=a.map(b,function(a){return a.event}),e=c.clone(),f=e.clone().add(1,"days"),g={start:e,end:f};return b=this.eventsToSegs(d,function(a){var b=K(a,g);return b?[b]:[]}),this.sortEventSegs(b),b},getMoreLinkText:function(a){var b=this.view.opt("eventLimitText");return"function"==typeof b?b(a):"+"+a+" "+b},getCellSegs:function(a,b,c){for(var d,e=this.row
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.headRowEl),this.dayGrid.removeSegPopover(),g&&"number"==typeof g&&this.dayGrid.limitRows(g),c=this.computeScrollerHeight(a),this.setGridHeight(c,b),g&&"number"!=typeof g&&this.dayGrid.limitRows(g),b||(this.scroller.setHeight(c),d=this.scroller.getScrollbarWidths(),(d.left||d.right)&&(e(this.headRowEl,d),c=this.computeScrollerHeight(a),this.scroller.setHeight(c)),this.scroller.lockOverflow(d))},computeScrollerHeight:function(a){return a-l(this.el,this.scroller.el)},setGridHeight:function(a,b){b?j(this.dayGrid.rowEls):i(this.dayGrid.rowEls,a,!0)},queryScroll:function(){re
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(){return t.trigger("reset",t.topLevelResources)}}(this))},r.prototype.getResourceById=function(t){return this.resourcesById[t]},r.prototype.initializeCache=function(){return this.topLevelResources=[],this.resourcesById={}},r.prototype.setResources=function(t,e){var r,o,i,n,s,l;for(this.initializeCache(),s=function(){var e,r,o;for(o=[],e=0,r=t.length;r>e;e++)n=t[e],o.push(this.buildResource(n));return o}.call(this),l=function(){var t,e,r;for(r=[],t=0,e=s.length;e>t;t++)i=s[t],this.addResourceToIndex(i)&&r.push(i);return r}.call(this),r=0,o=l.l
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):"&nbsp;")+'</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):this.elsByFill[e]=n}},o.prototype.renderDrag=function(t,e){return e?this.renderEventLocationHelper(t,e):(this.renderHighlight(this.eventToSpan(t)),null)},o.prototype.unrenderDrag=function(){return this.unrenderHelper(),this.unrenderHighlight()},o}(f),tt=function(t){var e,r,o,i;for(o=0,e=0,r=t.length;r>e;e++)i=t[e],o=Math.max(o,Z(i));return o},Z=function(t){return null==t.top&&(t.top=tt(t.above)),t.top+t.height},Bt=function(t,e){return t.left<e.right&&t.right>e.left},S=18,m=6,w=200,R=1e3,h={m
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 > div"),this.ensureSegsRendered()},e.prototype.ensureSegsRendered=function(){return this.isSegsRendered?void 0:(this.bgSegs&&this.view.timeGrid.renderFillInContainer("bgEvent",this,this.bgSegs),this.fgSegs&&this.view.timeGrid.renderFgSegsInContainers([[this,this.fgSegs]]),this.isSegsRendered=!0)},e.prototype.unrenderEventContent=function(){return this.bgSegs=null,this.fgSegs=null,this.isSegsRendered=!1},e}(z),F=function(e){function r(t,e){this.resource=e,r.__super__.constructor.apply(this,arguments)}return kt
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",function(){var controller=function($scope){var dateUtil=Bahmni.Common.Util.DateUtil,init=function(){$scope.viewDate||$scope.goToCurrent(),viewDateChange()},viewDateChange=function(){(!$scope.lastValidDate||$scope.lastValidDate&&$scope.viewDate&&$scope.lastValidDate.getTime()!==$scope.viewDate.getTime())&&($scope.lastValidDate=$scope.viewDate,$scope.onChange($scope.viewDate))};$scope.goToPrevious=function(){$scope.viewDate=$scope.viewDate&&dateUtil.subtractDays($scope.viewDate,1),viewDateChange()},$scope.goToCurrent=function(){$scope.viewDate=moment().startOf("day").toDate(),viewDateChange()},$scope.goToNext=function(){$scope.viewDate=$scope.viewDate&&dateUtil.addDays($scope.viewDate,1),viewDateChange()},$scope.keydownEvent=function(){var keyCode;event&&(keyCode=event.keyCode?event.keyCode:event.which),!keyCode||46!==keyCode&&8!==keyCode?keyCode&&13===keyCode&&viewDateChange():event.preventDefault()},$scope.dateChanged=function(){viewDateChange()},init()};return{restrict:"E",scope:{viewDate:"=",onChange:"=",lastValidDate:"="},templateUrl:"../appointments/views/manage/datePicker.html",controller:controller}}),angular.module("bahmni.appointments").directive("weekPicker",function(){var controller=function($scope){var dateUtil=Bahmni.Common.Util.DateUtil,init=function(){$scope.viewDate||$
_.each(dayAvailability,function(day){var allSlots=getAllSlots(day.startTime,day.endTime,durationInMin);slots.startTime=_.concat(slots.startTime,allSlots.startTime),slots.endTime=_.concat(slots.endTime,allSlots.endTime)}),slots},getAllSlots=function(startTimeString,endTimeString,durationInMin){startTimeString=_.isEmpty(startTimeString)?"00:00":startTimeString,endTimeString=_.isEmpty(endTimeString)?"23:59":endTimeString;for(var startTime=getFormattedTime(startTimeString),endTime=getFormattedTime(endTimeString),result=[],slots={startTime:[],endTime:[]},current=moment(startTime);current.valueOf()<=endTime.valueOf();)result.push(current.format("hh:mm a")),current.add(durationInMin,"minutes");return slots.startTime=_.slice(result,0,result.length-1),slots.endTime=_.slice(result,1),slots},getFormattedTime=function(time){return moment(time,"hh:mm a")},isFormFilled=function(){return!_.every(_.values($scope.appointment),function(value){return!value})},cleanUpListenerStateChangeStart=$scope.$on("$stateChangeStart",function(event,toState,toParams,fromState,fromParams){isFormFilled()&&$scope.showConfirmationPopUp&&(event.preventDefault(),ngDialog.close(),$scope.toStateConfig={toState:toState,toParams:toParams},$scope.displayConfirmationDialog())}),newAppointmentStartingEndingBeforeExistingAppointment=function(existingStart,newStart,newEnd){return newEnd<=existingStart},newAppointmentStartingEndingAfterExistingAppointment=function(newStart,existingStart,existingEnd){return newStart>=existingEnd},isNewAppointmentConflictingWithExistingAppointment=function(existingAppointment,newAppointment){var existingStart=moment(existingAppointment.startDateTime),existingEnd=moment(existingAppointment.endDateTime),newStart=moment(newAppointment.startDateTime),newEnd=moment(newAppointment.endDateTime);return!(newAppointmentStartingEndingBeforeExistingAppointment(existingStart,newStart,newEnd)||newAppointmentStartingEndingAfterExistingAppointment(newStart,existingStart,existingEnd))},checkForConflict=function(existingAppointment,newAppointment){var isOnSameDay=0===moment(existingAppointment.startDateTime).diff(moment(newAppointment.startDateTime),"days"),isAppointmentTimingConflicted=isNewAppointmentConflictingWithExistingAppointment(existingAppointment,newAppointment);return existingAppointment.uuid!==newAppointment.uuid&&"Cancelled"!==existingAppointment.status&&isOnSameDay&&isAppointmentTimingConflicted},getConflictingAppointments=function(appointment){return _.filter($scope.patientAppointments,function(bookedAppointment){return checkForConflict(bookedAppointment,appointment)})},saveAppointment=function(appointment){return spinner.forPromise(appointmentsService.save(appointment).then(function(){messagingService.showMessage("info","APPOINTMENT_SAVE_SUCCESS"),$scope.showConfirmationPopUp=!1;var params=$state.params;params.viewDate=moment($scope.appointment.date).startOf("day").toDate(),params.isFilterOpen=!0,params.isSearchEnabled=params.isSearchEnabled&&$scope.isEditMode(),$state.go("^",params,{reload:!0})}))},wireAutocompleteEvents=function(){$("#endTimeID").bind("focus",function(){$("#endTimeID").autocomplete("search")});var $startTimeID=$("#startTimeID");$startTimeID.bind("focus",function(){$("#startTimeID").autocomplete("search")}),$startTimeID.bind("focusout",function(){$scope.onSelectStartTime()})};return $scope.isEditMode=function(){return $scope.appointment.uuid},$scope.isEditAllowed=function(){return!$scope.isPastAppointment&&("Scheduled"===$scope.appointment.status||"CheckedIn"===$scope.appointment.status)},$scope.navigateToPreviousState=function(){$state.go("^",$state.params,{reload:!0})},init()}]),angular.module("bahmni.appointments").controller("AppointmentServiceController",["$scope","$q","spinner","$state","appointmentsServiceService","locationService","messagingService","specialityService","ngDialog","appService","appointmentServiceContext","confirmBox",function($scope,$q,spinner,$state,appointmentsServiceService,locationService,messagingService,specialityService,ngDialog,appService,appointmentServiceContext,confirmBox){$scope.showCo
return service.selected}).map(function(service){return service.id}).value(),$scope.isServiceTypeEnabled?$state.params.filterParams.serviceTypeUuids=$scope.selectedSpecialities.filter(function(service){return!service.selected}).reduce(function(accumulator,service){return accumulator.concat(service.children)},[]).filter(function(serviceType){return serviceType.selected}).reduce(function(accumulator,serviceType){return accumulator.concat(serviceType.id)},[]):$state.params.filterParams.serviceTypeUuids=[]),$state.params.filterParams.providerUuids=_.map($scope.selectedProviders,function(provider){return provider.uuid}),$state.params.filterParams.statusList=_.map($scope.selectedStatusList,function(status){return status.value})},$scope.isFilterApplied=function(){return _.find($state.params.filterParams,function(filterParam){return!_.isEmpty(filterParam)})},$scope.$watch(function(){return $state.params.isFilterOpen},function(isFilterHidden){$scope.isFilterOpen=isFilterHidden,$scope.isSearchEnabled=isFilterHidden},!0),$scope.$watch(function(){return $state.params.isSearchEnabled},function(isSearchEnabled){$scope.isSearchEnabled=isSearchEnabled},!0),$scope.$watch(function(){return $state.current.tabName},function(newValue,oldValue){newValue!==oldValue&&("calendar"===newValue?($scope.statusList=_.filter($scope.statusList,function(status){return"Cancelled"!==status.name}),$scope.selectedStatusList=_.filter($scope.selectedStatusList,function(status){return"Cancelled"!==status.name})):$scope.statusList=_.map(Bahmni.Appointments.Constants.appointmentStatusList,function(status){return{name:status,value:status}}))},!0),init()}]),angular.module("bahmni.appointments").filter("appointments",[function(){var filterAppointmentsByService=function(appointments,serviceUuids){return _.filter(appointments,function(appointment){return appointment.service&&_.includes(serviceUuids,appointment.service.uuid)})},filterAppointmentsByServiceType=function(appointments,serviceTypeUuids){return _.filter(appointments,function(appointment){return appointment.serviceType&&_.includes(serviceTypeUuids,appointment.serviceType.uuid)})},filterAppointmentsByProviders=function(appointments,providerUuids){return _.isEmpty(providerUuids)?appointments:_.filter(appointments,function(appointment){return appointment.provider?appointment.provider&&_.includes(providerUuids,appointment.provider.uuid):_.includes(providerUuids,"no-provider-uuid")})},filterAppointmentsByStatus=function(appointments,statusList){return _.isEmpty(statusList)?appointments:_.filter(appointments,function(appointment){return _.includes(statusList,appointment.status)})};return function(appointments,filters){if(_.isEmpty(filters))return appointments;if(_.isEmpty(filters.serviceUuids)&&_.isEmpty(filters.serviceTypeUuids)){var appointmentsFilteredByProviders=filterAppointmentsByProviders(appointments,filters.providerUuids);return filterAppointmentsByStatus(appointmentsFilteredByProviders,filters.statusList)}var appointmentsFilteredByService=filterAppointmentsByService(appointments,filters.serviceUuids),appointmentsFilteredByServiceType=filterAppointmentsByServiceType(appointments,filters.serviceTypeUuids),appointmentsFilteredBySpeciality=appointmentsFilteredByService.concat(appointmentsFilteredByServiceType),appointmentsFilteredByProviders=filterAppointmentsByProviders(appointmentsFilteredBySpeciality,filters.providerUuids);return filterAppointmentsByStatus(appointmentsFilteredByProviders,filters.statusList)}}]);