angular.module("Wizdom365.Birthday",[]).config(["$compileProvider",function(i){}]);
!function(){function e(){return{beforeAddClass:i,removeClass:t}}function i(e,i,t){var n=e.attr("direction");if("ng-hide"==i){var o=$(e).parent().width();"right"!==n&&(o=-o),window.TweenLite.to(e,.5,{left:o,onComplete:t})}else t()}function t(e,i,t){var n=e.attr("direction");if("ng-hide"==i){e.removeClass("ng-hide");var o=$(e).parent().width();"right"===n&&(o=-o),window.TweenLite.fromTo(e,.5,{left:o},{left:0,onComplete:t})}else t()}angular.module("Wizdom365.Birthday").animation(".slide-animation-birthdayslider",e)}();
angular.module("Wizdom365.Birthday").directive("wizdom365Birthday",[function(){return{scope:{},template:'<div class="bootstrap-wrapper">\n                        	<div class="wizdom-birthday">\n                                <div class="webpart-edit-button-container" ng-if="editMode">\n                                    <button class="editWebpartButton btn" ng-click="editWebpart()" type="button" title=\'{{"Edit Webpart" | translate}}\'>\n                                        <span class="ms-Icon ms-Icon--Edit"></span><span class="editWebpartButtonText">{{"Edit" | translate}}</span>\n                                    </button>\n                                </div>\n                        		<div wizdom-include=\'webpartProperties.templateUrl\'></div>\n                        	</div>\n                        </div>',link:function(e,t,r){},controller:["$scope","$element","$attrs","webpartPropertiesService","$http","contextInfo","birthdayApi","$modal","$interval","sessionStorageService","$window",function(e,t,r,n,i,a,o,s,d,p,c){function u(){var t=l();t&&(e.birthdays=t,e.birthdays.length>0&&(e.hideWebpart=!1));var r={plusDays:e.webpartProperties.plusDays,sourceId:e.webpartProperties.sourceId,managedProperty:e.webpartProperties.managedProperty,department:e.webpartProperties.department,useUsersDepartment:e.webpartProperties.useUsersDepartment,location:e.webpartProperties.location,useUsersLocation:e.webpartProperties.useUsersLocation};o.getUsersByBirthday(r).then(function(t){e.birthdays=t.persons,e.birthdays.length>0&&(e.hideWebpart=!1,e.startAnimation()),b(e.birthdays)})}function l(){return JSON.parse(p.getItem("birthdays:"+e.webpartId))}function b(t){p.setItem("birthdays:"+e.webpartId,JSON.stringify(t))}e.webpartId=n.getWebpartId(t);var m=r.webpartProperties?JSON.parse(r.webpartProperties):null;e.webpartProperties={plusDays:m&&null!=m.plusDays?m.plusDays:25,sourceId:m&&m.sourceId||"b09a7990-05ea-4af9-81ef-edfab16c4e31",managedProperty:m&&m.managedProperty||"w365Birthday",useUsersDepartment:m&&m.useUsersDepartment||!1,department:m&&m.department||"",useUsersLocation:m&&m.useUsersLocation||!1,location:m&&m.location||"",templateUrl:m&&m.templateUrl||"Birthday/Templates/ViewTemplates/defaultlist.html"},n.hideEditCode(t),e.editMode=n.isInEditMode(t),n.toggleWebpart(t,!1),e.$watch("hideWebpart",function(e,r){void 0!=e&&n.toggleWebpart(t,!e)},!0);var f=function(){e.$applyAsync(function(){u(),e.startAnimation()})},I=function(){e.$applyAsync(function(){e.stopAnimation()})},h=angular.element(c);h.on("focus",f),h.on("blur",I);a.pageListId,a.pageItemId;e.spHostUrl=a.spHostUrl,e.editWebpart=function(){s.open({templateUrl:"Birthday/Templates/Dialogs/EditWebpart.html",controller:"birthdayEditCtrl",windowClass:"bootstrap-wrapper",resolve:{webpartId:function(){return e.webpartId},webpartProperties:function(){return e.webpartProperties}}}).result.then(function(t){t&&(e.webpartProperties=t,u())})},e.currentIndex=0,e.isCurrentSlideIndex=function(t){return e.currentIndex===t},e.direction="left",e.currentIndex=0,e.setCurrentSlideIndex=function(t){e.direction=t>e.currentIndex?"left":"right",e.currentIndex=t},e.isCurrentSlideIndex=function(t){return e.currentIndex===t},e.nextSlide=function(){e.direction="left",e.currentIndex=e.currentIndex<e.birthdays.length-1?++e.currentIndex:0},e.prevSlide=function(){e.direction="right",e.currentIndex=e.currentIndex>0?e.currentIndex-1:e.birthdays.length-1},e.goToSlide=function(t){t!=e.currentIndex&&(t<e.currentIndex?(e.stopAnimation(),e.direction="right",e.currentIndex=t):t>e.currentIndex&&(e.stopAnimation(),e.direction="left",e.currentIndex=t))};var y;e.startAnimation=function(){angular.isDefined(y)||(y=d(function(){e.nextSlide()},1e5))},e.stopAnimation=function(){angular.isDefined(y)&&(d.cancel(y),y=void 0)},u()}]}}]);
!function(){function e(e){var r={baseUrl:"api/wizdom/birthday",getUsersByBirthday:function(r){return e.getAppCached(this.baseUrl+"?plusDays="+r.plusDays+"&sourceId="+r.sourceId+"&managedProp="+r.managedProperty+"&department="+r.department+"&useUsersDepartment="+r.useUsersDepartment+"&location="+r.location+"&useUsersLocation="+r.useUsersLocation)}};return r}angular.module("Wizdom365.Birthday").factory("birthdayApi",e),e.$inject=["webapiService"]}();
angular.module("Wizdom365").requires.push("Wizdom365.Birthday");
angular.module("Wizdom365").run(["$templateCache", function($templateCache) {if($templateCache.get('Birthday/Templates/ViewTemplates/BirthdayPicture.html') == null) $templateCache.put('Birthday/Templates/ViewTemplates/BirthdayPicture.html','<div id=\"birthday\" ng-show=\"::birthdays.length\" style=\"padding-top: 0;\">\r\n\r\n	<div id=\"wizdomBirthdaySlider\" style=\"position:relative; height: 100px; overflow: hidden;\" ng-mouseleave=\"startAnimation()\" ng-mouseover=\"stopAnimation()\">\r\n\r\n		<div ng-repeat=\"item in ::birthdays\"\r\n			 class=\"birthdayPerson slide-animation-birthdayslider\"\r\n			 direction=\"{{direction}}\"\r\n			 ng-swipe-left=\"nextSlide()\"\r\n			 ng-swipe-right=\"prevSlide()\"\r\n			 ng-show=\"isCurrentSlideIndex($index)\" style=\"padding-top: 0;\">\r\n			<!--\r\n			<a href=\"{{ item.publicUrl }}\">\r\n				<span ng-bind=\"item.name\"></span>\r\n				<span>{{ item.date | date: \'d MMM\' }}</span>\r\n			</a>\r\n			-->\r\n\r\n			<div class=\"wizdom-employees bootstrap-wrapper\" style=\"text-align: left;\">\r\n				<div class=\"wizdom-employees-row\">\r\n					<div class=\"wizdom-employees-imgColumn\">\r\n						<div wizdom365-presence-picture=\"\" size=\"AVATAR\" accountname=\"item.accountName\" email=\"item.email\" name=\"item.name\" image=\"item.pictureURL\"></div>\r\n					</div>\r\n\r\n					<div class=\"wizdom-employees-textColumn\">\r\n						<h4 class=\"name\"><a ng-href=\"{{::item.publicUrl}}\">{{::item.name}}</a></h4>\r\n						<section>\r\n							<div class=\"department\" ng-show=\"::(item.date.length)\"><b>{{\'Birthday\' | translate}}:</b> {{::item.date | wizdom365PhonebookDateFilter | date: \'MMMM d\'}}</div>\r\n						</section>\r\n					</div>\r\n				</div>\r\n			</div>\r\n\r\n\r\n		</div>\r\n	</div>\r\n	<div class=\"container-fluid wd-birthday-pagination-container wizdom-fullwidth text-center\" ng-if=\"birthdays.length > 1\">\r\n		<div class=\"wd-birthday-pagination-inner-container row\">\r\n			<pagination total-items=\"birthdays.length\"\r\n				ng-model=\"$index\"\r\n				ng-change=\"setCurrentSlideIndex($index -1)\"\r\n				items-per-page=\"1\"\r\n				max-size=\"10\"\r\n				boundary-links=\"true\"\r\n				previous-text=\"&lsaquo;\"\r\n				next-text=\"&rsaquo;\"\r\n				first-text=\"&laquo;\"\r\n				last-text=\"&raquo;\"></pagination>\r\n		</div>\r\n	</div>\r\n</div>');
if($templateCache.get('Birthday/Templates/ViewTemplates/defaultlist.html') == null) $templateCache.put('Birthday/Templates/ViewTemplates/defaultlist.html','<div id=\"birthday\" ng-show=\"::birthdays.length\">\r\n\r\n	<div class=\"icon-birthday-flag-dims icon-birthday-flag\" style=\"margin:0 auto;\">\r\n	</div>\r\n\r\n\r\n	<div class=\"birthday-heading\">\r\n		<span ng-if=\"webpartProperties.plusDays == 0\">\r\n			<!-- {{ birthdays.length }} -->\r\n			{{ \"Birthday(s) today!\" | translate }}\r\n		</span>\r\n		<span ng-if=\"webpartProperties.plusDays > 0\">\r\n			<!-- {{ birthdays.length }} -->\r\n			{{ \"Upcoming birthday(s)\" | translate }}\r\n		</span>\r\n	</div>\r\n\r\n	<div id=\"wizdomBirthdaySlider\" style=\"position:relative; height: 100px; overflow:hidden;\" ng-mouseleave=\"startAnimation()\" ng-mouseover=\"stopAnimation()\">\r\n		<div ng-repeat=\"item in ::birthdays\"\r\n			 class=\"birthdayPerson slide-animation-birthdayslider\"\r\n			 direction=\"{{direction}}\"\r\n			 ng-swipe-left=\"nextSlide()\"\r\n			 ng-swipe-right=\"prevSlide()\"\r\n			 ng-show=\"isCurrentSlideIndex($index)\" style=\"padding-top: 0;\">\r\n			<!--\r\n				<a href=\"{{ item.publicUrl }}\">\r\n				<span ng-bind=\"item.name\"></span>\r\n				<span>{{ item.date | date: \'d MMM\' }}</span>\r\n			</a>\r\n			-->\r\n	\r\n			<div class=\"wizdom-employees bootstrap-wrapper\" style=\"text-align: left;\">\r\n				<div class=\"wizdom-employees-row\">\r\n					\r\n\r\n					<div class=\"wizdom-employees-textColumn\">\r\n						<h4 class=\"name\"><a ng-href=\"{{::item.publicUrl}}\">{{::item.name}}</a></h4>\r\n						<section>\r\n							<div class=\"department\" ng-show=\"::(item.date.length)\"><b>{{\'Birthday\' | translate}}:</b> {{::item.date | wizdom365PhonebookDateFilter | date: \'MMMM d\'}}</div>\r\n						</section>\r\n					</div>\r\n				</div>\r\n			</div>\r\n		</div>\r\n\r\n		<div class=\"container-fluid wd-birthday-pagination-container wizdom-fullwidth text-center birthday-margin\" ng-if=\"birthdays.length > 1\">\r\n			<div class=\"wd-birthday-pagination-inner-container row\">\r\n				<pagination total-items=\"birthdays.length\"\r\n					ng-model=\"$index\"\r\n					ng-change=\"setCurrentSlideIndex($index -1)\"\r\n					items-per-page=\"1\"\r\n					max-size=\"10\"\r\n					boundary-links=\"true\"\r\n					previous-text=\"&lsaquo;\"\r\n					next-text=\"&rsaquo;\"\r\n					first-text=\"&laquo;\"\r\n					last-text=\"&raquo;\"></pagination>\r\n			\r\n			</div>\r\n		</div>\r\n	</div>\r\n</div>');}]);