-
Notifications
You must be signed in to change notification settings - Fork 1
/
bookingbug-angular-admin-dashboard.min.js
executable file
·4 lines (4 loc) · 107 KB
/
bookingbug-angular-admin-dashboard.min.js
1
2
3
4
(function(){"use strict";angular.module("BBAdminDashboard.calendar.controllers",[]),angular.module("BBAdminDashboard.calendar.services",[]),angular.module("BBAdminDashboard.calendar.directives",[]),angular.module("BBAdminDashboard.calendar.translations",[]),angular.module("BBAdminDashboard.calendar",["BBAdminDashboard.calendar.controllers","BBAdminDashboard.calendar.services","BBAdminDashboard.calendar.directives","BBAdminDashboard.calendar.translations"])}).call(this),function(){"use strict";angular.module("BBAdminDashboard.calendar").run(["RuntimeStates","AdminCalendarOptions","SideNavigationPartials",function(RuntimeStates,AdminCalendarOptions,SideNavigationPartials){"ngInject";AdminCalendarOptions.use_default_states&&RuntimeStates.state("calendar",{parent:AdminCalendarOptions.parent_state,url:"calendar",templateUrl:"calendar/index.html",controller:"CalendarPageCtrl"}).state("calendar.people",{url:"/people/:assets",templateUrl:"calendar/people.html"}).state("calendar.resources",{url:"/resources/:assets",templateUrl:"calendar/resources.html"}),AdminCalendarOptions.show_in_navigation&&SideNavigationPartials.addPartialTemplate("calendar","calendar/nav.html")}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.check-in.controllers",[]),angular.module("BBAdminDashboard.check-in.services",[]),angular.module("BBAdminDashboard.check-in.directives",[]),angular.module("BBAdminDashboard.check-in.translations",[]),angular.module("BBAdminDashboard.check-in",["BBAdminDashboard.check-in.controllers","BBAdminDashboard.check-in.services","BBAdminDashboard.check-in.directives","BBAdminDashboard.check-in.translations"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.check-in").run(["RuntimeStates","AdminCheckInOptions","SideNavigationPartials",function(RuntimeStates,AdminCheckInOptions,SideNavigationPartials){"ngInject";AdminCheckInOptions.use_default_states&&RuntimeStates.state("checkin",{parent:AdminCheckInOptions.parent_state,url:"check-in",templateUrl:"check-in/index.html",controller:"CheckInPageCtrl"}),AdminCheckInOptions.show_in_navigation&&SideNavigationPartials.addPartialTemplate("check-in","check-in/nav.html")}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.dashboard-iframe.controllers",[]),angular.module("BBAdminDashboard.dashboard-iframe.services",[]),angular.module("BBAdminDashboard.dashboard-iframe.directives",[]),angular.module("BBAdminDashboard.dashboard-iframe.translations",[]),angular.module("BBAdminDashboard.dashboard-iframe",["BBAdminDashboard.dashboard-iframe.controllers","BBAdminDashboard.dashboard-iframe.services","BBAdminDashboard.dashboard-iframe.directives","BBAdminDashboard.dashboard-iframe.translations"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.dashboard-iframe").run(["RuntimeStates","AdminDashboardIframeOptions","SideNavigationPartials",function(RuntimeStates,AdminDashboardIframeOptions,SideNavigationPartials){"ngInject";AdminDashboardIframeOptions.use_default_states&&RuntimeStates.state("dashboard",{parent:AdminDashboardIframeOptions.parent_state,url:"dashboard",controller:"DashboardIframePageCtrl",templateUrl:"dashboard-iframe/index.html",deepStateRedirect:{"default":{state:"dashboard.page",params:{path:"view/dashboard/index",fixed:!0}}}}).state("dashboard.page",{url:"/page/:path",controller:"DashboardSubIframePageCtrl",templateUrl:"core/iframe-page.html"}),AdminDashboardIframeOptions.show_in_navigation&&SideNavigationPartials.addPartialTemplate("dashboard-iframe","dashboard-iframe/nav.html")}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.clients.controllers",[]),angular.module("BBAdminDashboard.clients.services",[]),angular.module("BBAdminDashboard.clients.directives",[]),angular.module("BBAdminDashboard.clients.translations",[]),angular.module("BBAdminDashboard.clients",["BBAdminDashboard.clients.controllers","BBAdminDashboard.clients.services","BBAdminDashboard.clients.directives","BBAdminDashboard.clients.translations"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.clients").run(["RuntimeStates","AdminClientsOptions","SideNavigationPartials",function(RuntimeStates,AdminClientsOptions,SideNavigationPartials){"ngInject";AdminClientsOptions.use_default_states&&RuntimeStates.state("clients",{parent:AdminClientsOptions.parent_state,url:"clients",templateUrl:"clients/index.html",controller:"ClientsPageCtrl"}).state("clients.new",{url:"/new",templateUrl:"client_new.html",controller:"ClientsNewPageCtrl"}).state("clients.all",{url:"/all",templateUrl:"clients/listing.html",controller:"ClientsAllPageCtrl"}).state("clients.edit",{url:"/edit/:id",templateUrl:"clients/item.html",resolve:{client:function(company,$stateParams,BBModel){var params;return params={company:company,id:$stateParams.id},BBModel.Admin.Client.$query(params)}},controller:"ClientsEditPageCtrl"}),AdminClientsOptions.show_in_navigation&&SideNavigationPartials.addPartialTemplate("clients","clients/nav.html")}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe.controllers",[]),angular.module("BBAdminDashboard.config-iframe.services",[]),angular.module("BBAdminDashboard.config-iframe.directives",[]),angular.module("BBAdminDashboard.config-iframe.translations",[]),angular.module("BBAdminDashboard.config-iframe",["BBAdminDashboard.config-iframe.controllers","BBAdminDashboard.config-iframe.services","BBAdminDashboard.config-iframe.directives","BBAdminDashboard.config-iframe.translations"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe").run(["RuntimeStates","AdminConfigIframeOptions","SideNavigationPartials",function(RuntimeStates,AdminConfigIframeOptions,SideNavigationPartials){"ngInject";AdminConfigIframeOptions.use_default_states&&RuntimeStates.state("config",{parent:AdminConfigIframeOptions.parent_state,url:"config",templateUrl:"config-iframe/index.html",controller:"ConfigIframePageCtrl",deepStateRedirect:{"default":{state:"config.business.page",params:{path:"person"}}}}).state("config.business",{url:"/business",templateUrl:"core/tabbed-substates-page.html",controller:"ConfigIframeBusinessPageCtrl",deepStateRedirect:{"default":{state:"config.business.page",params:{path:"person"}}}}).state("config.business.page",{url:"/page/:path",templateUrl:"core/iframe-page.html",controller:"ConfigSubIframePageCtrl"}).state("config.event-settings",{url:"/event-settings",templateUrl:"core/tabbed-substates-page.html",controller:"ConfigIframeEventSettingsPageCtrl",deepStateRedirect:{"default":{state:"config.event-settings.page",params:{path:"sessions/courses"}}}}).state("config.event-settings.page",{url:"/page/:path",templateUrl:"core/iframe-page.html",controller:"ConfigSubIframePageCtrl"}).state("config.promotions",{url:"/promotions",templateUrl:"core/tabbed-substates-page.html",controller:"ConfigIframePromotionsPageCtrl",deepStateRedirect:{"default":{state:"config.promotions.page",params:{path:"price/deal/summary"}}}}).state("config.promotions.page",{url:"/page/:path",templateUrl:"core/iframe-page.html",controller:"ConfigSubIframePageCtrl"}).state("config.booking-settings",{url:"/booking-settings",templateUrl:"core/tabbed-substates-page.html",controller:"ConfigIframeBookingSettingsPageCtrl",deepStateRedirect:{"default":{state:"config.booking-settings.page",params:{path:"detail_type"}}}}).state("config.booking-settings.page",{url:"/page/:path",templateUrl:"core/iframe-page.html",controller:"ConfigSubIframePageCtrl"}),AdminConfigIframeOptions.show_in_navigation&&SideNavigationPartials.addPartialTemplate("config-iframe","config-iframe/nav.html")}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").config(["$logProvider","$httpProvider",function($logProvider,$httpProvider){"ngInject";$logProvider.debugEnabled(!0),$httpProvider.defaults.withCredentials=!0}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard",["ngStorage","ngResource","ngTouch","ngSanitize","ngLocalData","ngCookies","ngMessages","BBAdmin","BBAdminServices","BBAdminBooking","BBAdmin.Directives","BBMember","ui.calendar","ui.bootstrap","ui.router","ct.ui.router.extras","trNgGrid","toggle-switch","pascalprecht.translate","angular-loading-bar","ngScrollable","toastr","BBAdminDashboard.check-in","BBAdminDashboard.clients","BBAdminDashboard.login","BBAdminDashboard.logout","BBAdminDashboard.reset-password","BBAdminDashboard.calendar","BBAdminDashboard.dashboard-iframe","BBAdminDashboard.members-iframe","BBAdminDashboard.settings-iframe","BBAdminDashboard.config-iframe","BBAdminDashboard.publish-iframe"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").run(["RuntimeStates","AdminCoreOptions","RuntimeRoutes","AdminLoginService",function(RuntimeStates,AdminCoreOptions,RuntimeRoutes,AdminLoginService){"ngInject";RuntimeRoutes.otherwise("/"),RuntimeStates.state("root",{url:"/",templateUrl:"core/layout.html",resolve:{user:function($q,BBModel,AdminSsoLogin){var defer;return defer=$q.defer(),BBModel.Admin.Login.$user().then(function(user){return user?defer.resolve(user):AdminSsoLogin.ssoLoginPromise().then(function(admin){return BBModel.Admin.Login.$setLogin(admin),BBModel.Admin.Login.$user().then(function(user){return defer.resolve(user)},function(err){return defer.reject({reason:"GET_USER_ERROR",error:err})})},function(err){return defer.reject({reason:"NOT_LOGGABLE_ERROR"})})},function(err){return defer.reject({reason:"LOGIN_SERVICE_ERROR",error:err})}),defer.promise},company:function(user,$q,BBModel){var defer;return defer=$q.defer(),user.$getCompany().then(function(company){return company.companies&&company.companies.length>0?defer.reject({reason:"COMPANY_IS_PARENT"}):defer.resolve(company)},function(err){return BBModel.Admin.Login.$logout().then(function(){return defer.reject({reason:"GET_COMPANY_ERROR"})},function(err){return defer.reject({reason:"LOGOUT_ERROR"})})}),defer.promise}},controller:"CorePageController",deepStateRedirect:{"default":{state:AdminCoreOptions.default_state}}})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.login.controllers",[]),angular.module("BBAdminDashboard.login.services",[]),angular.module("BBAdminDashboard.login.directives",[]),angular.module("BBAdminDashboard.login.translations",[]),angular.module("BBAdminDashboard.login",["BBAdminDashboard.login.controllers","BBAdminDashboard.login.services","BBAdminDashboard.login.directives","BBAdminDashboard.login.translations"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.login").run(["RuntimeStates","AdminLoginOptions",function(RuntimeStates,AdminLoginOptions){"ngInject";AdminLoginOptions.use_default_states&&RuntimeStates.state("login",{url:"/login",resolve:{user:function($q,BBModel,AdminSsoLogin){var defer;return defer=$q.defer(),BBModel.Admin.Login.$user().then(function(user){return user?defer.resolve(user):AdminSsoLogin.ssoLoginPromise().then(function(admin){return BBModel.Admin.Login.$setLogin(admin),BBModel.Admin.Login.$user().then(function(user){return defer.resolve(user)},function(err){return defer.reject({reason:"GET_USER_ERROR",error:err})})},function(err){return defer.resolve()})},function(err){return defer.reject({reason:"LOGIN_SERVICE_ERROR",error:err})}),defer.promise}},controller:"LoginPageCtrl",templateUrl:"login/index.html"})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.logout").config(["$stateProvider","$urlRouterProvider",function($stateProvider,$urlRouterProvider){"ngInject";$stateProvider.state("logout",{url:"/logout",controller:"LogoutPageCtrl"})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.logout.controllers",[]),angular.module("BBAdminDashboard.logout.services",[]),angular.module("BBAdminDashboard.logout.directives",[]),angular.module("BBAdminDashboard.logout",["BBAdminDashboard.logout.controllers","BBAdminDashboard.logout.services","BBAdminDashboard.logout.directives"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.reset-password").config(["$stateProvider","$urlRouterProvider",function($stateProvider,$urlRouterProvider){"ngInject";$stateProvider.state("reset-password",{url:"/reset-password",controller:"ResetPasswordPageCtrl",templateUrl:"reset-password/index.html"})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.reset-password",[])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.members-iframe.controllers",[]),angular.module("BBAdminDashboard.members-iframe.services",[]),angular.module("BBAdminDashboard.members-iframe.directives",[]),angular.module("BBAdminDashboard.members-iframe.translations",[]),angular.module("BBAdminDashboard.members-iframe",["BBAdminDashboard.members-iframe.controllers","BBAdminDashboard.members-iframe.services","BBAdminDashboard.members-iframe.directives","BBAdminDashboard.members-iframe.translations"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.members-iframe").run(["RuntimeStates","AdminMembersIframeOptions","SideNavigationPartials",function(RuntimeStates,AdminMembersIframeOptions,SideNavigationPartials){"ngInject";AdminMembersIframeOptions.use_default_states&&RuntimeStates.state("members",{parent:AdminMembersIframeOptions.parent_state,url:"members",templateUrl:"members-iframe/index.html",controller:"MembersIframePageCtrl",deepStateRedirect:{"default":{state:"members.page",params:{path:"client"}}}}).state("members.page",{url:"/page/:path/:id",templateUrl:"core/boxed-iframe-page.html",controller:"MembersSubIframePageCtrl"}),AdminMembersIframeOptions.show_in_navigation&&SideNavigationPartials.addPartialTemplate("members-iframe","members-iframe/nav.html")}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe.controllers",[]),angular.module("BBAdminDashboard.settings-iframe.services",[]),angular.module("BBAdminDashboard.settings-iframe.directives",[]),angular.module("BBAdminDashboard.settings-iframe.translations",[]),angular.module("BBAdminDashboard.settings-iframe",["BBAdminDashboard.settings-iframe.controllers","BBAdminDashboard.settings-iframe.services","BBAdminDashboard.settings-iframe.directives","BBAdminDashboard.settings-iframe.translations"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe").run(["RuntimeStates","AdminSettingsIframeOptions","SideNavigationPartials",function(RuntimeStates,AdminSettingsIframeOptions,SideNavigationPartials){"ngInject";AdminSettingsIframeOptions.use_default_states&&RuntimeStates.state("settings",{parent:AdminSettingsIframeOptions.parent_state,url:"settings",templateUrl:"settings-iframe/index.html",deepStateRedirect:{"default":{state:"settings.page",params:{path:"company/mycompany"}},params:!0}}).state("settings.page",{url:"/page/:path",templateUrl:"core/boxed-iframe-page.html",controller:"SettingsSubIframePageCtrl"}).state("settings.basic-settings",{url:"/basic-settings",templateUrl:"core/tabbed-substates-page.html",controller:"SettingsIframeBasicSettingsPageCtrl",deepStateRedirect:{"default":{state:"settings.basic-settings.page",params:{path:"conf/setting/user_edit"}}}}).state("settings.basic-settings.page",{url:"/page/:path",templateUrl:"core/iframe-page.html",controller:"SettingsSubIframePageCtrl"}).state("settings.advanced-settings",{url:"/advanced-settings",templateUrl:"core/tabbed-substates-page.html",controller:"SettingsIframeAdvancedSettingsPageCtrl",deepStateRedirect:{"default":{state:"settings.advanced-settings.page",params:{path:"conf/payment/payment_edit"}}}}).state("settings.advanced-settings.page",{url:"/page/:path",templateUrl:"core/iframe-page.html",controller:"SettingsSubIframePageCtrl"}).state("settings.integrations",{url:"/integrations",templateUrl:"core/tabbed-substates-page.html",controller:"SettingsIframeIntegrationsPageCtrl",deepStateRedirect:{"default":{state:"settings.integrations.page",params:{path:"conf/addons/payment"}}}}).state("settings.integrations.page",{url:"/page/:path",templateUrl:"core/iframe-page.html",controller:"SettingsSubIframePageCtrl"}).state("settings.subscription",{url:"/subscription",templateUrl:"core/tabbed-substates-page.html",controller:"SettingsIframeSubscriptionPageCtrl",deepStateRedirect:{"default":{state:"settings.subscription.page",params:{path:"subscription/show"}}}}).state("settings.subscription.page",{url:"/page/:path",templateUrl:"core/iframe-page.html",controller:"SettingsSubIframePageCtrl"}),AdminSettingsIframeOptions.show_in_navigation&&SideNavigationPartials.addPartialTemplate("settings-iframe","settings-iframe/nav.html")}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.publish-iframe.controllers",[]),angular.module("BBAdminDashboard.publish-iframe.services",[]),angular.module("BBAdminDashboard.publish-iframe.directives",[]),angular.module("BBAdminDashboard.publish-iframe.translations",[]),angular.module("BBAdminDashboard.publish-iframe",["BBAdminDashboard.publish-iframe.controllers","BBAdminDashboard.publish-iframe.services","BBAdminDashboard.publish-iframe.directives","BBAdminDashboard.publish-iframe.translations"])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.publish-iframe").run(["RuntimeStates","AdminPublishIframeOptions","SideNavigationPartials",function(RuntimeStates,AdminPublishIframeOptions,SideNavigationPartials){"ngInject";AdminPublishIframeOptions.use_default_states&&RuntimeStates.state("publish",{parent:AdminPublishIframeOptions.parent_state,url:"publish",templateUrl:"publish-iframe/index.html",controller:"PublishIframePageCtrl",deepStateRedirect:{"default":{state:"publish.page",params:{path:"conf/inset/intro"}}}}).state("publish.page",{url:"/page/:path",templateUrl:"core/boxed-iframe-page.html",controller:"PublishSubIframePageCtrl"}),AdminPublishIframeOptions.show_in_navigation&&SideNavigationPartials.addPartialTemplate("publish-iframe","publish-iframe/nav.html")}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.calendar.controllers").controller("CalendarPageCtrl",["$log","$scope","$state",function($log,$scope,$state){"ngInject";var bindToPusherChannel,gotToProperState,init,refetch;init=function(){bindToPusherChannel(),"calendar"===$state.current.name&&gotToProperState()},gotToProperState=function(){$scope.bb.company.$has("people")?$state.go("calendar.people"):$scope.bb.company.$has("resources")&&$state.go("calendar.resources")},bindToPusherChannel=function(){var pusherChannel;pusherChannel=$scope.company.getPusherChannel("bookings"),pusherChannel&&(pusherChannel.bind("create",refetch),pusherChannel.bind("update",refetch),pusherChannel.bind("destroy",refetch))},refetch=_.throttle(function(data){return $log.info("== booking push received in bookings == ",data),$scope.$broadcast("refetchBookings",data)},1e3,{leading:!1}),init()}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.calendar.controllers").controller("bbResourceCalendarController",["AdminBookingPopup","AdminCalendarOptions","AdminCompanyService","AdminMoveBookingPopup","$attrs","BBAssets","BBModel","$bbug","CalendarEventSources","ColorPalette","Dialog","$filter","GeneralOptions","ModalForm","PrePostTime","ProcessAssetsFilter","$q","$rootScope","$scope","$state","TitleAssembler","$translate","$window","uiCalendarConfig",function(AdminBookingPopup,AdminCalendarOptions,AdminCompanyService,AdminMoveBookingPopup,$attrs,BBAssets,BBModel,$bbug,CalendarEventSources,ColorPalette,Dialog,$filter,GeneralOptions,ModalForm,PrePostTime,ProcessAssetsFilter,$q,$rootScope,$scope,$state,TitleAssembler,$translate,$window,uiCalendarConfig){"ngInject";var applyFilters,assetsListener,calOptions,changeSelectedResources,collectionListener,company,companyListener,companyServices,currentDateListener,dayHasAvailability,editBooking,fcEventAfterRender,fcEventClick,fcEventDragStop,fcEventDrop,fcEventRender,fcEventResize,fcLoading,fcResources,fcSelect,fcViewRender,filters,getBookingTitle,getCalendarAssets,getCompanyPromise,getEvents,init,isTimeRangeAvailable,languageChangedHandler,lazyUpdateDate,newCheckoutHandler,prepareCalOptions,prepareEventSources,prepareUiCalOptions,pusherBooking,pusherSubscribe,refetchBookingsHandler,refreshBooking,selectedResourcesListener,servicesListener,setTimeToMoment,updateBooking,updateDate,vm;vm=this,filters=null,company=null,companyServices=[],calOptions=[],vm.assets=[],vm.selectedResources={selected:[]},init=function(){applyFilters(),prepareCalOptions(),prepareEventSources(),prepareUiCalOptions(),$scope.$watch("selectedResources.selected",selectedResourcesListener),$scope.$watch("currentDate",currentDateListener),$scope.$on("refetchBookings",refetchBookingsHandler),$scope.$on("newCheckout",newCheckoutHandler),$rootScope.$on("BBLanguagePicker:languageChanged",languageChangedHandler),getCompanyPromise().then(companyListener),vm.changeSelectedResources=changeSelectedResources},applyFilters=function(){filters={requestedAssets:ProcessAssetsFilter($state.params.assets)},vm.showAll=!0,filters.requestedAssets.length>0&&(vm.showAll=!1)},setTimeToMoment=function(date,time){var newDate;return newDate=moment(time,"HH:mm"),newDate.set({year:parseInt(date.get("year")),month:parseInt(date.get("month")),date:parseInt(date.get("date")),second:0}),newDate},prepareEventSources=function(){vm.eventSources=[{events:getEvents}]},getEvents=function(start,end,timezone,callback){vm.loading=!0,getCompanyPromise().then(function(company){var options;return options={labelAssembler:$scope.labelAssembler?$scope.labelAssembler:AdminCalendarOptions.bookings_label_assembler,blockLabelAssembler:$scope.blockLabelAssembler?$scope.blockLabelAssembler:AdminCalendarOptions.block_label_assembler,externalLabelAssembler:$scope.externalLabelAssembler?$scope.externalLabelAssembler:AdminCalendarOptions.external_label_assembler,noCache:!0,showAll:vm.showAll,type:calOptions.type,selectedResources:vm.selectedResources.selected,calendarView:uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("getView").type},$scope.model&&(options.showAll=!1,options.selectedResources=[$scope.model]),CalendarEventSources.getAllCalendarEntries(company,start,end,options).then(function(results){return vm.loading=!1,callback(results)})})},prepareCalOptions=function(){calOptions=$scope.$eval($attrs.bbResourceCalendar),calOptions||(calOptions={}),calOptions.defaultView||($scope.model?calOptions.defaultView="agendaWeek":calOptions.defaultView="timelineDay"),calOptions.views||($scope.model?calOptions.views="listDay,timelineDayThirty,agendaWeek,month":calOptions.views="timelineDay,listDay,timelineDayThirty,agendaWeek,month"),calOptions.name?vm.calendar_name=calOptions.name:vm.calendar_name="resourceCalendar",null==calOptions.min_time&&(calOptions.min_time=GeneralOptions.calendar_min_time),null==calOptions.max_time&&(calOptions.max_time=GeneralOptions.calendar_max_time),null==calOptions.cal_slot_duration&&(calOptions.cal_slot_duration=GeneralOptions.calendar_slot_duration)},prepareUiCalOptions=function(){vm.uiCalOptions={calendar:{locale:$translate.use(),schedulerLicenseKey:"0598149132-fcs-1443104297",eventStartEditable:!1,eventDurationEditable:!1,minTime:calOptions.min_time,maxTime:calOptions.max_time,height:"auto",buttonText:{today:$translate.instant("ADMIN_DASHBOARD.CALENDAR_PAGE.TODAY")},header:{left:"today,prev,next",center:"title",right:calOptions.views},defaultView:calOptions.defaultView,views:{listDay:{buttonText:$translate.instant("ADMIN_DASHBOARD.CALENDAR_PAGE.AGENDA")},agendaWeek:{slotDuration:$filter("minutesToString")(calOptions.cal_slot_duration),buttonText:$translate.instant("ADMIN_DASHBOARD.CALENDAR_PAGE.WEEK"),groupByDateAndResource:!1},month:{eventLimit:5,buttonText:$translate.instant("ADMIN_DASHBOARD.CALENDAR_PAGE.MONTH")},timelineDay:{slotDuration:$filter("minutesToString")(calOptions.cal_slot_duration),eventOverlap:!1,slotWidth:25,buttonText:$translate.instant("ADMIN_DASHBOARD.CALENDAR_PAGE.DAY",{minutes:calOptions.cal_slot_duration}),resourceAreaWidth:"18%"}},resourceGroupField:"group",resourceLabelText:" ",eventResourceEditable:!0,selectable:!0,lazyFetching:!1,columnFormat:AdminCalendarOptions.column_format,resources:fcResources,eventDragStop:fcEventDragStop,eventDrop:fcEventDrop,eventClick:fcEventClick,eventRender:fcEventRender,eventAfterRender:fcEventAfterRender,select:fcSelect,viewRender:fcViewRender,eventResize:fcEventResize,loading:fcLoading}}},fcResources=function(callback){return getCalendarAssets(callback)},fcEventDragStop=function(event,jsEvent,ui,view){return event.oldResourceIds=event.resourceIds},fcEventDrop=function(event,delta,revertFunc){var end,item_defaults,newAssetId,orginal_resource,start;return 3!==event.status&&(event.person_id&&event.resource_id||delta.days()>0)?(start=event.start,end=event.end,item_defaults={date:start.format("YYYY-MM-DD"),time:60*start.hour()+start.minute()},event.resourceId&&(newAssetId=event.resourceId.substring(0,event.resourceId.indexOf("_")),event.resourceId.indexOf("_p")>-1?(item_defaults.person=newAssetId,orginal_resource=""+event.person_id+"_p"):event.resourceId.indexOf("_r")>-1&&(item_defaults.resource=newAssetId,orginal_resource=""+event.resource_id+"_r")),void getCompanyPromise().then(function(company){return AdminMoveBookingPopup.open({min_date:setTimeToMoment(start,calOptions.min_time),max_date:setTimeToMoment(end,calOptions.max_time),from_datetime:moment(start.toISOString()),to_datetime:moment(end.toISOString()),item_defaults:item_defaults,company_id:company.id,booking_id:event.id,success:function(_this){return function(model){return refreshBooking(event)}}(this),fail:function(){return refreshBooking(event),revertFunc()}})})):Dialog.confirm({title:$translate.instant("ADMIN_DASHBOARD.CALENDAR_PAGE.MOVE_MODAL_HEADING"),model:event,body:$translate.instant("ADMIN_DASHBOARD.CALENDAR_PAGE.MOVE_MODAL_BODY"),success:function(_this){return function(model){return updateBooking(event)}}(this),fail:function(){return revertFunc()}})},fcEventClick=function(event,jsEvent,view){return event.$has("edit")?editBooking(new BBModel.Admin.Booking(event)):void 0},fcEventRender=function(event,element){var a,link,service,type;return type=uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("getView").type,service=_.findWhere(companyServices,{id:event.service_id}),$scope.model||("listDay"===type?(link=$bbug(element.children()[2]),link&&(a=link.children()[0],a&&(!event.person_name||calOptions.type&&"person"!==calOptions.type?event.resource_name&&"resource"===calOptions.type&&(a.innerHTML=event.resource_name+" - "+a.innerHTML):a.innerHTML=event.person_name+" - "+a.innerHTML))):"agendaWeek"!==type&&"month"!==type||(link=$bbug(element.children()[0]),link&&(a=link.children()[1],a&&(!event.person_name||calOptions.type&&"person"!==calOptions.type?event.resource_name&&"resource"===calOptions.type&&(a.innerHTML=event.resource_name+"<br/>"+a.innerHTML):a.innerHTML=event.person_name+"<br/>"+a.innerHTML)))),service&&"listDay"!==type&&(element.css("background-color",service.color),element.css("color",service.textColor),element.css("border-color",service.textColor)),element},fcEventAfterRender=function(event,elements,view){return null==event.rendering||"background"!==event.rendering?PrePostTime.apply(event,elements,view,$scope):void 0},fcSelect=function(start,end,jsEvent,view,resource){var item_defaults;if(!jsEvent||"fc-scroller"!==jsEvent.target.className)return view.calendar.unselect(),!calOptions.enforce_schedules||isTimeRangeAvailable(start,end,resource)||1===Math.abs(start.diff(end,"days"))&&dayHasAvailability(start)?(Math.abs(start.diff(end,"days"))>0&&(end.subtract(1,"days"),end=setTimeToMoment(end,calOptions.max_time)),item_defaults={date:start.format("YYYY-MM-DD"),time:60*start.hour()+start.minute()},resource&&"person"===resource.type?item_defaults.person=resource.id.substring(0,resource.id.indexOf("_")):resource&&"resource"===resource.type&&(item_defaults.resource=resource.id.substring(0,resource.id.indexOf("_"))),getCompanyPromise().then(function(company){return AdminBookingPopup.open({min_date:setTimeToMoment(start,calOptions.min_time),max_date:setTimeToMoment(end,calOptions.max_time),from_datetime:moment(start.toISOString()),to_datetime:moment(end.toISOString()),item_defaults:item_defaults,first_page:"quick_pick",on_conflict:"cancel()",company_id:company.id})})):void 0},fcViewRender=function(view,element){var date,newDate;return date=uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("getDate"),newDate=moment().tz(moment.tz.guess()),newDate.set({year:parseInt(date.get("year")),month:parseInt(date.get("month")),date:parseInt(date.get("date")),hour:0,minute:0,second:0}),$scope.currentDate=newDate.toDate()},fcEventResize=function(event,delta,revertFunc,jsEvent,ui,view){return event.duration=event.end.diff(event.start,"minutes"),updateBooking(event)},fcLoading=function(isLoading,view){return vm.calendarLoading=isLoading},$scope.openDatePicker=function($event){return $event.preventDefault(),$event.stopPropagation(),$scope.datePickerOpened=!0},isTimeRangeAvailable=function(start,end,resource){var en,events,st;return st=moment(start.toISOString()).unix(),en=moment(end.toISOString()).unix(),events=uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("clientEvents",function(event){return"background"===event.rendering&&st>=event.start.unix()&&event.end&&en<=event.end.unix()&&(resource&&parseInt(event.resourceId)===parseInt(resource.id)||!resource)}),events.length>0},dayHasAvailability=function(start){var events;return events=uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("clientEvents",function(event){return"background"===event.rendering&&event.start.year()===start.year()&&event.start.month()===start.month()&&event.start.date()===start.date()}),events.length>0},selectedResourcesListener=function(newValue,oldValue){var assets,params;newValue!==oldValue&&(assets=[],angular.forEach(newValue,function(asset){return assets.push(asset.id)}),params=$state.params,params.assets=assets.join(),$state.go($state.current.name,params,{notify:!1,reload:!1}))},getCalendarAssets=function(callback){return $scope.model?void callback([$scope.model]):(vm.loading=!0,void getCompanyPromise().then(function(company){vm.showAll?BBAssets.getAssets(company).then(function(assets){var asset,i,len;for(calOptions.type&&(assets=_.filter(assets,function(a){return a.type===calOptions.type})),i=0,len=assets.length;len>i;i++)asset=assets[i],asset.id=asset.identifier;return vm.loading=!1,callback(assets)}):(vm.loading=!1,callback(vm.selectedResources.selected))}))},getBookingTitle=function(booking){var blockLabelAssembler,labelAssembler;return labelAssembler=$scope.labelAssembler?$scope.labelAssembler:AdminCalendarOptions.bookings_label_assembler,blockLabelAssembler=$scope.blockLabelAssembler?$scope.blockLabelAssembler:AdminCalendarOptions.block_label_assembler,3!==booking.status&&labelAssembler?TitleAssembler.getTitle(booking,labelAssembler):3===booking.status&&blockLabelAssembler?TitleAssembler.getTitle(booking,blockLabelAssembler):booking.title},refreshBooking=function(booking){booking.$refetch().then(function(response){return booking.resourceIds=[],booking.resourceId=null,null!=booking.person_id&&booking.resourceIds.push(booking.person_id+"_p"),null!=booking.resource_id&&booking.resourceIds.push(booking.resource_id+"_r"),booking.title=getBookingTitle(booking),uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("updateEvent",booking)})},updateBooking=function(booking){var newAssetId;booking.resourceId&&(newAssetId=booking.resourceId.substring(0,booking.resourceId.indexOf("_")),booking.resourceId.indexOf("_p")>-1?booking.person_id=newAssetId:booking.resourceId.indexOf("_r")>-1&&(booking.resource_id=newAssetId)),booking.$update().then(function(response){return booking.resourceIds=[],booking.resourceId=null,null!=booking.person_id&&booking.resourceIds.push(booking.person_id+"_p"),null!=booking.resource_id&&booking.resourceIds.push(booking.resource_id+"_r"),booking.title=getBookingTitle(booking),uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("updateEvent",booking);
})},editBooking=function(booking){var templateUrl,title;3===booking.status?(templateUrl="edit_block_modal_form.html",title="Edit Block"):(templateUrl="edit_booking_modal_form.html",title="Edit Booking"),ModalForm.edit({templateUrl:templateUrl,model:booking,title:title,params:{locale:$translate.use()},success:function(_this){return function(response){var item_defaults;return"string"==typeof response&&"move"===response&&(item_defaults={person:booking.person_id,resource:booking.resource_id},getCompanyPromise().then(function(company){return AdminMoveBookingPopup.open({item_defaults:item_defaults,company_id:company.id,booking_id:booking.id,success:function(_this){return function(model){return refreshBooking(booking)}}(this),fail:function(){return refreshBooking(booking)}})})),response.is_cancelled?uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("removeEvents",[response.id]):(booking.title=getBookingTitle(booking),uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("updateEvent",booking))}}(this)})},pusherBooking=function(res){var booking;null!=res.id&&(booking=_.first(uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("clientEvents",res.id)),booking&&booking.$refetch?booking.$refetch().then(function(){return booking.title=getBookingTitle(booking),uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("updateEvent",booking)}):uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("refetchEvents"))},pusherSubscribe=function(_this){return function(){var pusher_channel;company&&(pusher_channel=company.getPusherChannel("bookings"),pusher_channel&&(pusher_channel.bind("create",pusherBooking),pusher_channel.bind("update",pusherBooking),pusher_channel.bind("destroy",pusherBooking)))}}(this),updateDate=function(date){var assembledDate;uiCalendarConfig.calendars[vm.calendar_name]&&(assembledDate=moment.utc(),assembledDate.set({year:parseInt(date.getFullYear()),month:parseInt(date.getMonth()),date:parseInt(date.getDate()),hour:0,minute:0,second:0}),uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("gotoDate",assembledDate))},lazyUpdateDate=_.debounce(updateDate,400),currentDateListener=function(newDate,oldDate){newDate!==oldDate&&null!=oldDate&&lazyUpdateDate(newDate)},refetchBookingsHandler=function(){uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("refetchEvents")},newCheckoutHandler=function(){uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("refetchEvents")},languageChangedHandler=function(){$state.go($state.current,{},{reload:!0})},getCompanyPromise=function(){var defer;return defer=$q.defer(),company?defer.resolve(company):AdminCompanyService.query($attrs).then(function(_company){return company=_company,defer.resolve(company)}),defer.promise},changeSelectedResources=function(){vm.showAll&&(vm.selectedResources.selected=[]),uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("refetchResources"),uiCalendarConfig.calendars[vm.calendar_name].fullCalendar("refetchEvents")},assetsListener=function(assets){var asset,i,len;for(i=0,len=assets.length;len>i;i++)asset=assets[i],asset.id=asset.identifier;vm.loading=!1,calOptions.type&&(assets=_.filter(assets,function(a){return a.type===calOptions.type})),vm.assets=assets,filters.requestedAssets.length>0&&(angular.forEach(vm.assets,function(asset){var isInArray;return isInArray=_.find(filters.requestedAssets,function(id){return id===asset.id}),"undefined"!=typeof isInArray?vm.selectedResources.selected.push(asset):void 0}),changeSelectedResources())},companyListener=function(company){vm.loading=!0,BBAssets.getAssets(company).then(assetsListener),company.$get("services").then(collectionListener),pusherSubscribe()},collectionListener=function(collection){collection.$get("services").then(servicesListener)},servicesListener=function(services){var service;companyServices=function(){var i,len,results1;for(results1=[],i=0,len=services.length;len>i;i++)service=services[i],results1.push(new BBModel.Admin.Service(service));return results1}(),ColorPalette.setColors(companyServices)},init()}])}.call(this),function(){angular.module("BBAdminDashboard.calendar.directives").directive("bbNewBooking",function(){return{restrict:"AE",replace:!0,scope:!0,controller:["$scope","AdminBookingPopup","$uibModal","$timeout","$rootScope","AdminBookingOptions",function($scope,AdminBookingPopup,$uibModal,$timeout,$rootScope,AdminBookingOptions){return $scope.newBooking=function(){return AdminBookingPopup.open({item_defaults:{day_view:AdminBookingOptions.day_view,merge_people:!0,merge_resources:!0,date:moment($scope.$parent.currentDate).isValid()?moment($scope.$parent.currentDate).format("YYYY-MM-DD"):moment().format("YYYY-MM-DD")},company_id:$rootScope.bb.company.id,on_conflict:"cancel()",template:"main"})}}]}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.calendar.directives").directive("bbResourceCalendar",["$compile","$templateCache","$timeout",function($compile,$templateCache,$timeout){"ngInject";var link;return link=function(scope,element,attrs){var addDatePickerToFCToolbar,documentReadyListener,init;init=function(){$timeout(documentReadyListener,0)},documentReadyListener=function(){addDatePickerToFCToolbar()},addDatePickerToFCToolbar=function(){var datePickerElement,toolbarElement,toolbarLeftElement,uiCalElement;uiCalElement=angular.element(document.getElementById("uicalendar")),toolbarElement=angular.element(uiCalElement.children()[0]),toolbarLeftElement=angular.element(toolbarElement.children()[0]),datePickerElement=$compile($templateCache.get("calendar_date_picker.html"))(scope),toolbarLeftElement.append(datePickerElement)},init()},{controller:"bbResourceCalendarController",controllerAs:"vm",link:link,templateUrl:"calendar/resource-calendar.html",replace:!0,scope:{labelAssembler:"@",blockLabelAssembler:"@",externalLabelAssembler:"@",model:"=?"}}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.calendar.services").provider("AdminCalendarOptions",function(){var options;options={use_default_states:!0,show_in_navigation:!0,parent_state:"root",column_format:null,bookings_label_assembler:"{service_name} - {client_name}",block_label_assembler:"Blocked",external_label_assembler:"{title}"},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.calendar.services").service("CalendarEventSources",["AdminScheduleService","BBModel","$exceptionHandler","$q","TitleAssembler","$translate",function(AdminScheduleService,BBModel,$exceptionHandler,$q,TitleAssembler,$translate){"ngInject";var bookingBelongsToSelectedResources,getAllCalendarEntries,getAvailabilityBackground,getBookingsAndBlocks,getExternalBookings;return bookingBelongsToSelectedResources=function(resources,booking){var belongs;return belongs=!1,_.each(resources,function(asset){return _.contains(booking.resourceIds,asset.id)?belongs=!0:void 0}),belongs},getBookingsAndBlocks=function(company,start,end,options){var deferred,params;return null==options&&(options={}),deferred=$q.defer(),params={company:company,start_date:start.format("YYYY-MM-DD"),end_date:end.format("YYYY-MM-DD"),skip_cache:!(null==options.noCache||!options.noCache)},BBModel.Admin.Booking.$query(params).then(function(bookings){var booking,filteredBookings,i,len,ref;for(filteredBookings=[],ref=bookings.items,i=0,len=ref.length;len>i;i++)booking=ref[i],booking.service_name=$translate.instant(booking.service_name),booking.resourceIds=[],null!=booking.person_id&&booking.resourceIds.push(booking.person_id+"_p"),null!=booking.resource_id&&booking.resourceIds.push(booking.resource_id+"_r"),(null==options.showAll||null!=options.showAll&&options.showAll||bookingBelongsToSelectedResources(options.selectedResources,booking))&&(booking.useFullTime(),booking.$has("edit")&&(booking.startEditable=!0),3!==booking.status&&null!=options.labelAssembler?booking.title=TitleAssembler.getTitle(booking,options.labelAssembler):3===booking.status&&null!=options.blockLabelAssembler&&(booking.title=TitleAssembler.getTitle(booking,options.blockLabelAssembler)),(!options.type||"resource"===options.type&&booking.resource_id||"person"===options.type&&booking.person_id)&&filteredBookings.push(booking));return deferred.resolve(filteredBookings)},function(err){return deferred.reject(err)}),deferred.promise},getExternalBookings=function(company,start,end,options){var deferred,params;return null==options&&(options={}),deferred=$q.defer(),company.$has("external_bookings")?(params={start:start.format(),end:end.format(),no_cache:!(null==options.noCache||!options.noCache)},company.$get("external_bookings",params).then(function(collection){var booking,bookings,i,len;if(bookings=collection.external_bookings){for(i=0,len=bookings.length;len>i;i++)booking=bookings[i],booking.resourceIds=[],null!=booking.person_id&&booking.resourceIds.push(booking.person_id+"_p"),null!=booking.resource_id&&booking.resourceIds.push(booking.resource_id+"_r"),booking.title||(booking.title="Blocked"),null!=options.externalLabelAssembler&&(booking.title=TitleAssembler.getTitle(booking,options.externalLabelAssembler)),booking.className="status_external",booking.type="external",booking.editable=!1,booking.startEditable=!1,booking.durationEditable=!1,booking.resourceEditable=!1;return deferred.resolve(bookings)}return deferred.resolve([])},function(err){return deferred.reject(err)})):deferred.resolve([]),deferred.promise},getAvailabilityBackground=function(company,start,end,options){var deferred;return null==options&&(options={}),deferred=$q.defer(),AdminScheduleService.getAssetsScheduleEvents(company,start,end,!options.showAll,options.selectedResources).then(function(availabilities){var avail,availability,i,id,j,len,len1,overAllAvailabilities,sorted,src,test,test_id;if("timelineDay"===options.calendarView)return deferred.resolve(availabilities);for(overAllAvailabilities=[],i=0,len=availabilities.length;len>i;i++)avail=availabilities[i],avail.unix_start=moment(avail.start).unix(),avail.unix_end=moment(avail.end).unix(),avail.delete_me=!1;for(sorted=_.sortBy(availabilities,function(x){return moment(x.start).unix()}),id=0,test_id=1;test_id<sorted.length;)src=sorted[id],test=sorted[test_id],src.delete_me?(id+=1,test_id=id+1):test.unix_end>src.unix_end&&test.unix_start<src.unix_end?(src.end=test.end,src.unix_end=test.unix_end,test.delete_me=!0,test_id+=1):test.unix_end<=src.unix_end?(test.delete_me=!0,test_id+=1):(id+=1,test_id+=1);for(j=0,len1=sorted.length;len1>j;j++)availability=sorted[j],availability.delete_me||overAllAvailabilities.push({start:availability.start,end:availability.end,rendering:"background",title:"Joined availability "+moment(availability.start).format("YYYY-MM-DD"),allDay:"month"===options.calendarView});return deferred.resolve(overAllAvailabilities)},function(err){return deferred.reject(err)}),deferred.promise},getAllCalendarEntries=function(company,start,end,options){var deferred,promises;return null==options&&(options={}),deferred=$q.defer(),promises=[getBookingsAndBlocks(company,start,end,options),getExternalBookings(company,start,end,options),getAvailabilityBackground(company,start,end,options)],$q.all(promises).then(function(resolutions){var allResults;return allResults=[],angular.forEach(resolutions,function(results,index){return allResults=allResults.concat(results)}),deferred.resolve(allResults)},function(err){return deferred.reject(err)}),deferred.promise},{getBookingsAndBlocks:getBookingsAndBlocks,getExternalBookings:getExternalBookings,getAvailabilityBackground:getAvailabilityBackground,getAllCalendarEntries:getAllCalendarEntries}}])}.call(this),function(){angular.module("BBAdminDashboard.calendar.services").factory("PrePostTime",["$compile",function($compile){return{apply:function(event,elements,view,scope){var contentDiv,e,element,i,len,post,postHeight,postWidth,pre,preHeight,preWidth,results,totalDuration;for(results=[],i=0,len=elements.length;len>i;i++){if(e=elements[i],element=angular.element(e),totalDuration=event.duration+event.pre_time+event.post_time,event.pre_time)switch(view.name){case"agendaWeek":case"agendaDay":preHeight=event.pre_time*(element.height()+2)/totalDuration,pre=$compile("<div class='pre' style='height:"+preHeight+"px'></div>")(scope),element.prepend(pre);break;case"timelineDay":contentDiv=element.children()[0],preWidth=event.pre_time*(element.width()+2)/totalDuration,pre=$compile("<div class='pre' style='width:"+preWidth+"px'></div>")(scope),element.prepend(pre),angular.element(contentDiv).css("padding-left",preWidth+"px")}if(event.post_time)switch(view.name){case"agendaWeek":case"agendaDay":postHeight=event.post_time*(element.height()+2)/totalDuration,post=$compile("<div class='post' style='height:"+postHeight+"px'></div>")(scope),results.push(element.append(post));break;case"timelineDay":postWidth=event.post_time*(element.width()+2)/totalDuration,post=$compile("<div class='post' style='width:"+postWidth+"px'></div>")(scope),results.push(element.append(post));break;default:results.push(void 0)}else results.push(void 0)}return results}}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.calendar.services").factory("TitleAssembler",function(){var expression;return expression=new RegExp("\\{([a-zA-z_-]+)\\|?([a-zA-z_-]+)?:?([a-zA-z0-9{}_-]+)?\\}","g"),{getTitle:function(object,pattern){var i,index,label,len,match,parts,patternMatches,replaceWith;if(null==object||null==pattern)return null;if(patternMatches=pattern.match(expression),null==patternMatches||0===patternMatches.length)return pattern;for(label=pattern,index=i=0,len=patternMatches.length;len>i;index=++i)match=patternMatches[index],parts=match.split(expression),parts.splice(0,1),parts.pop(),object.hasOwnProperty(parts[0])?(replaceWith=object[parts[0]],null!=parts[1]&&null!=$filter(parts[1])&&(replaceWith=null!=parts[2]?$filter(parts[1])(replaceWith,$scope.$eval(parts[2])):$filter(parts[1])(replaceWith)),label=label.replace(match,replaceWith)):label=label.replace(match,"");return label}}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.calendar.translations").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{SIDE_NAV:{CALENDAR_PAGE:{CALENDAR:"Calendar",PEOPLE:"Staff",RESOURCES:"Resources"}},CALENDAR_PAGE:{SHOW:"Show",ALL:"all",SOME:"some",SELECT_STAFF_RESOURCES:"Select staff or resource...",EMAIL:"email",TODAY:"Today",WEEK:"Week",MONTH:"Month",DAY:"Day ({{minutes}}m)",AGENDA:"Agenda",STAFF:"Staff",RESOURCES:"Resources",MOVE_MODAL_HEADING:"Move",MOVE_MODAL_BODY:"Are you sure you want to move?",ADD_BOOKING:"Add Booking"}}})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.check-in.controllers").controller("CheckInPageCtrl",["$scope","$state","$log",function($scope,$state,$log){var pusher_channel,refetch;return pusher_channel=$scope.company.getPusherChannel("bookings"),refetch=_.throttle(function(data){return $log.info("== booking push received in checkin == ",data),$scope.$broadcast("refetchCheckin",data)},1e3,{leading:!1}),pusher_channel?(pusher_channel.bind("create",refetch),pusher_channel.bind("update",refetch),pusher_channel.bind("destroy",refetch)):void 0}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.check-in.directives").directive("bbAddWalkin",function(){return{restrict:"AE",replace:!0,scope:!0,link:function(scope,element,attrs){},controller:["$scope","AdminBookingPopup","$timeout",function($scope,AdminBookingPopup,$timeout){return $scope.walkIn=function(){return AdminBookingPopup.open({item_defaults:{pick_first_time:!0,merge_people:!0,merge_resources:!0,date:moment().format("YYYY-MM-DD")},on_conflict:"cancel()",company_id:$scope.bb.company.id})}}]}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.check-in.directives").directive("bbCheckinTable",function(){return{restrict:"AE",replace:!1,scope:!0,templateUrl:"check-in/checkin-table.html",controller:"CheckinsController",link:function(scope,element,attrs){}}}),angular.module("BBAdminDashboard.check-in.directives").controller("CheckinsController",["$scope","$rootScope","BusyService","$q","$filter","AdminTimeService","ModalForm","AdminSlotService","$timeout","AlertService","BBModel",function($scope,$rootScope,BusyService,$q,$filter,AdminTimeService,ModalForm,AdminSlotService,$timeout,AlertService,BBModel){return $scope.$on("refetchCheckin",function(event,res){return $scope.getAppointments(null,null,null,null,null,!0)}),$scope.getAppointments=function(currentPage,filterBy,filterByFields,orderBy,orderByReverse,skipCache){var defer,mobile,params;return null==skipCache&&(skipCache=!0),filterByFields&&null!=filterByFields.name&&(filterByFields.name=filterByFields.name.replace(/\s/g,"")),filterByFields&&null!=filterByFields.mobile&&(mobile=filterByFields.mobile,0===mobile.indexOf("0")&&(filterByFields.mobile=mobile.substring(1))),defer=$q.defer(),params={company:$scope.company,date:moment().format("YYYY-MM-DD"),url:$scope.bb.api_url},skipCache&&(params.skip_cache=!0),filterBy&&(params.filter_by=filterBy),filterByFields&&(params.filter_by_fields=filterByFields),orderBy&&(params.order_by=orderBy),orderByReverse&&(params.order_by_reverse=orderByReverse),BBModel.Admin.Booking.$query(params).then(function(_this){return function(res){var i,item,len,ref;for($scope.booking_collection=res,$scope.bookings=[],$scope.bmap={},ref=res.items,i=0,len=ref.length;len>i;i++)item=ref[i],3!==item.status&&($scope.bookings.push(item.id),$scope.bmap[item.id]=item);return $scope.booking_collection.addCallback($scope,function(booking,status){var j,len1,ref1,results;for($scope.bookings=[],$scope.bmap={},ref1=$scope.booking_collection.items,results=[],j=0,len1=ref1.length;len1>j;j++)item=ref1[j],3!==item.status?($scope.bookings.push(item.id),results.push($scope.bmap[item.id]=item)):results.push(void 0);return results}),defer.resolve($scope.bookings)}}(this),function(err){return defer.reject(err)}),defer.promise},$scope.setStatus=function(_this){return function(booking,status){var clone;return clone=_.clone(booking),clone.current_multi_status=status,booking.$update(clone).then(function(res){return $scope.booking_collection.checkItem(res)},function(err){return AlertService.danger({msg:"Something went wrong"})})}}(this),$scope.edit=function(booking){return booking.$getAnswers().then(function(answers){var answer,i,len,ref;for(ref=answers.answers,i=0,len=ref.length;len>i;i++)answer=ref[i],booking["question"+answer.question_id]=answer.value;return ModalForm.edit({model:booking,title:"Booking Details",templateUrl:"edit_booking_modal_form.html",success:function(b){return b=new BBModel.Admin.Booking(b),$scope.bmap[b.id]=b}})})},$scope.getAppointments(null,null,null,null,null,!0)}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.check-in.services").provider("AdminCheckInOptions",function(){var options;options={use_default_states:!0,show_in_navigation:!0,parent_state:"root"},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.check-in.translations").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{SIDE_NAV:{CHECK_IN_PAGE:{CHECK_IN:"Check in"}},CHECK_IN_PAGE:{CHECK_IN:"Check in",NO_SHOW:"No Show",WALK_IN:"Walk in",CUSTOMER:"Customer",STAFF_MEMBER:"Staff Member",DUE:"Due",ARRIVED:"Arrived",BEEING_SEEN:"Being Seen",COMPLETED:"Completed",NO_SHOW_BUTTON:"Mark No Show",CHECK_IN_BUTTON:"Check in",SERVE:"Serve",WAITING_FOR:"Waiting for {{period}}",BEING_SEEN_FOR:"Being seen for {{period}}",WAS_DUE:"Was due {{period}}",COMPLETED_BUTTON:"Completed"}}})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.dashboard-iframe.controllers").controller("DashboardIframePageCtrl",["$scope","$state","$window","AdminBookingPopup",function($scope,$state,$window,AdminBookingPopup){return $scope.parent_state=$state.is("view"),$scope.bb.side_menu="dashboard_menu",$scope.path="view/dashboard/index",$window.addEventListener("message",function(_this){return function(event){return event&&event.data&&event.data.type&&"booking"===event.data.type?AdminBookingPopup.open({size:"lg",company_id:$scope.bb.company.id,on_conflict:"cancel()",item_defaults:{date:event.data.date,time:5*event.data.iarray,person:event.data.person,resource:event.data.resource}}):void 0}}(this))}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.dashboard-iframe.controllers").controller("DashboardSubIframePageCtrl",["$scope","$state","$stateParams",function($scope,$state,$stateParams){return $scope.path=$stateParams.path,"view/dashboard/index"===$scope.path?$scope.fullHeight=!0:void 0}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.dashboard-iframe.services").provider("AdminDashboardIframeOptions",function(){var options;options={use_default_states:!0,show_in_navigation:!0,parent_state:"root"},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.dashboard-iframe.translations").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{SIDE_NAV:{DASHBOARD_IFRAME_PAGE:{DASHBOARD:"Dashboard",UPCOMING_RECENT:"Upcoming & Recent",SEARCH:"Search",BULK_BOOKINGS:"Bulk bookings",INSIGHTS:"Insights"}}}})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.clients.controllers").controller("ClientsAllPageCtrl",["$scope","$state",function($scope,$state){return $scope.set_current_client(null)}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.clients.controllers").controller("ClientsEditPageCtrl",["$scope","client","$state","company","BBModel",function($scope,client,$state,company,BBModel){return $scope.client=client,$scope.historicalStartDate=moment().add(-1,"years"),$scope.historicalEndDate=moment(),$scope.memberSaveCallback=function(){var params;return params={company_id:company.id,id:$state.params.id,flush:!0},BBModelAdmin.Client.$query(params).then(function(client){return $scope.client=client})}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.clients.controllers").controller("ClientsNewPageCtrl",["$scope","$state",function($scope,$state){}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.clients.controllers").controller("ClientsPageCtrl",["$scope","$state",function($scope,$state){return $scope.clientsOptions={search:null},$scope.set_current_client=function(client){return $scope.current_client=client}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.clients.directives").directive("bbClientsTable",function(){return{restrict:"AE",replace:!0,scope:!0,controller:"TabletClients",link:function(scope,element,attrs){}}}),angular.module("BBAdminDashboard.clients.directives").controller("TabletClients",["$scope","$rootScope","$q","BBModel","AlertService",function($scope,$rootScope,$q,BBModel,AlertService){return $scope.clientDef=$q.defer(),$scope.clientPromise=$scope.clientDef.promise,$scope.per_page=15,$scope.total_entries=0,$scope.clients=[],$scope.getClients=function(currentPage,filterBy,filterByFields,orderBy,orderByReverse){var clientDef,fields,mobile,params;return fields=angular.copy(filterByFields),null!=fields.mobile&&(mobile=fields.mobile,0===mobile.indexOf("0")&&(fields.mobile=mobile.substring(1))),clientDef=$q.defer(),params={company:$scope.bb.company,per_page:$scope.per_page,page:currentPage+1,filter_by:filterBy,filter_by_fields:fields,order_by:orderBy,order_by_reverse:orderByReverse},BBModel.Admin.Client.$query(params).then(function(_this){return function(clients){return $scope.clients=clients.items,$scope.total_entries=clients.total_entries,clientDef.resolve(clients.items)}}(this),function(err){return console.log(err),clientDef.reject(err)})}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.clients.services").provider("AdminClientsOptions",function(){var options;options={use_default_states:!0,show_in_navigation:!0,parent_state:"root"},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.clients.translations").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{SIDE_NAV:{CLIENTS_PAGE:{CLIENTS:"Customers"}},CLIENTS_PAGE:{CLIENTS:"Customers",CLIENT:"Customer",NAME:"Name",EMAIL:"Email",MOBILE:"Mobile",PHONE:"Phone",ACTIONS:"Actions",EDIT:"Edit",ABOUT:"About",ADDRESS:"Address",UPCOMING_BOOKINGS:"Upcoming Bookings",PAST_BOOKINGS:"Past Bookings",CUSTOMER_DETAILS:"Customer Details"}}})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe.controllers").controller("ConfigIframeBookingSettingsPageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.pageHeader="ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BOOKING_SETTINGS.TITLE",$scope.tabs=[{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BOOKING_SETTINGS.TAB_QUESTIONS",icon:"fa fa-question-circle",path:'config.booking-settings.page({path: "detail_type"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BOOKING_SETTINGS.TAB_QUESTION_GROUPS",icon:"fa fa-question-circle",path:'config.booking-settings.page({path: "detail_group"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BOOKING_SETTINGS.TAB_BOOKING_TEXT",icon:"fa fa-file-text",path:'config.booking-settings.page({path: "conf/text/text_edit"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BOOKING_SETTINGS.TAB_ADDRESSES",icon:"fa fa-building-o",path:'config.booking-settings.page({path: "address"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BOOKING_SETTINGS.TAB_IMAGES",icon:"fa fa-picture-o",path:'config.booking-settings.page({path: "media/image/all"})'}],$scope.contentsLoading=!1,$scope.$on("iframeLoaded",function(){return $scope.contentsLoading=!1,$scope.$apply()}),$scope.$on("iframeLoading",function(){return $scope.contentsLoading=!0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe.controllers").controller("ConfigIframeBusinessPageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.pageHeader="ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BUSINESS.TITLE",$scope.tabs=[{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BUSINESS.TAB_STAFF",icon:"fa fa-male",path:'config.business.page({path: "person"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BUSINESS.TAB_RESOURCES",icon:"fa fa-diamond",path:'config.business.page({path: "resource"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BUSINESS.TAB_SERVICES",icon:"fa fa-wrench",path:'config.business.page({path: "service"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BUSINESS.TAB_WHO_WHAT_WHERE",icon:"fa fa-question-circle",path:'config.business.page({path: "grid"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.BUSINESS.TAB_QUEUES",icon:"fa fa-users",path:'config.business.page({path: "client_queue"})'}],$scope.contentsLoading=!1,$scope.$on("iframeLoaded",function(){return $scope.contentsLoading=!1,$scope.$apply()}),$scope.$on("iframeLoading",function(){return $scope.contentsLoading=!0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe.controllers").controller("ConfigIframeEventSettingsPageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.pageHeader="ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.EVENT_SETTINGS.TITLE",$scope.tabs=[{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.EVENT_SETTINGS.TAB_COURSES",icon:"fa fa-clipboard",path:'config.event-settings.page({path: "sessions/courses"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.EVENT_SETTINGS.TAB_SINGLE_EVENTS",icon:"fa fa-ticket",path:'config.event-settings.page({path: "sessions/events"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.EVENT_SETTINGS.TAB_REGULAR_EVENTS",icon:"fa fa-calendar",path:'config.event-settings.page({path: "sessions/recurring"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.EVENT_SETTINGS.TAB_GROUPS",icon:"fa fa-object-group",path:'config.event-settings.page({path: "sessions/types"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.EVENT_SETTINGS.TAB_TEMPLATES",icon:"fa fa-folder-open",path:'config.event-settings.page({path: "sessions/template"})'}],$scope.contentsLoading=!1,$scope.$on("iframeLoaded",function(){return $scope.contentsLoading=!1,$scope.$apply()}),$scope.$on("iframeLoading",function(){return $scope.contentsLoading=!0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe.controllers").controller("ConfigIframePageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.parent_state=$state.is("config"),$scope.path="edit",$rootScope.$on("$stateChangeStart",function(event,toState,toParams,fromState,fromParams){return $scope.parent_state=!1,"config"===toState.name?$scope.parent_state=!0:void 0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe.controllers").controller("ConfigIframePromotionsPageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.pageHeader="ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.PROMOTIONS.TITLE",$scope.tabs=[{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.PROMOTIONS.TAB_DEALS",icon:"fa fa-exclamation-triangle",path:'config.promotions.page({path: "price/deal/summary"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.PROMOTIONS.TAB_COUPONS",icon:"fa fa-money",path:'config.promotions.page({path: "price/coupon"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.PROMOTIONS.TAB_BULK_PURCHASES",icon:"fa fa-th",path:'config.promotions.page({path: "price/block"})'},{name:"ADMIN_DASHBOARD.CONFIG_IFRAME_PAGE.PROMOTIONS.TAB_PACKAGES",icon:"fa fa-gift",path:'config.promotions.page({path: "package"})'}],$scope.contentsLoading=!1,$scope.$on("iframeLoaded",function(){return $scope.contentsLoading=!1,$scope.$apply()}),$scope.$on("iframeLoading",function(){return $scope.contentsLoading=!0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe.controllers").controller("ConfigSubIframePageCtrl",["$scope","$state","$stateParams",function($scope,$state,$stateParams){return $scope.path=$stateParams.path,$scope.pageHeader=null,$scope.$emit("iframeLoading",{}),$scope.onIframeLoad=function(){return $scope.$emit("iframeLoaded",{})}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe.services").provider("AdminConfigIframeOptions",function(){var options;options={use_default_states:!0,show_in_navigation:!0,parent_state:"root"},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.config-iframe.translations").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{SIDE_NAV:{CONFIG_IFRAME_PAGE:{CONFIG:"Config",YOUR_BUSINESS:"Your business",EVENT_SETTINGS:"Event settings",PROMOTIONS:"Promotions",BOOKING_SETTINGS:"Booking settings"}},CONFIG_IFRAME_PAGE:{BUSINESS:{TITLE:"Configure: Business",TAB_STAFF:"Staff",TAB_RESOURCES:"Resource",
TAB_SERVICES:"Services",TAB_WHO_WHAT_WHERE:"Who / What / Where",TAB_QUEUES:"Queues"},EVENT_SETTINGS:{TITLE:"Event settings",TAB_COURSES:"Courses",TAB_SINGLE_EVENTS:"Single events",TAB_REGULAR_EVENTS:"Regular events",TAB_GROUPS:"Groups",TAB_TEMPLATES:"Templates"},PROMOTIONS:{TITLE:"Promotions",TAB_DEALS:"Deals",TAB_COUPONS:"Coupons",TAB_BULK_PURCHASES:"Bulk purchases",TAB_PACKAGES:"Packages"},BOOKING_SETTINGS:{TITLE:"Booking settings",TAB_QUESTIONS:"Questions",TAB_QUESTION_GROUPS:"Question Groups",TAB_BOOKING_TEXT:"Booking text",TAB_ADDRESSES:"Addresses",TAB_IMAGES:"Images"}}}})}])}.call(this),function(){"use strict";var controller;controller=["$scope","$state","company","$uibModalStack","$rootScope","GeneralOptions","CompanyStoreService",function($scope,$state,company,$uibModalStack,$rootScope,GeneralOptions,CompanyStoreService){"ngInject";$scope.company=company,$scope.bb.company=company,$scope.user=$rootScope.user,moment.tz.setDefault(company.timezone),CompanyStoreService.country_code=company.country_code,CompanyStoreService.currency_code=company.currency_code,CompanyStoreService.time_zone=company.timezone,$scope.isState=function(states){return $state.includes(states)},$rootScope.$on("$stateChangeStart",function(){return $uibModalStack.dismissAll()})}],angular.module("BBAdminDashboard").controller("CorePageController",controller)}.call(this),function(){"use strict";angular.module("BBAdminDashboard").directive("adminIframe",["$window","$timeout",function($window,$timeout){return{restrict:"A",scope:{path:"=",apiUrl:"=",fullHeight:"=?",extraParams:"=?",onLoad:"=?"},templateUrl:"core/admin-iframe.html",controller:["$scope","$sce",function($scope,$sce){return $scope.frameSrc=$sce.trustAsResourceUrl($scope.apiUrl+"/"+unescape($scope.path)+("?whitelabel=adminlte&uiversion=aphid&"+($scope.extraParams?$scope.extraParams:void 0)))}],link:function(scope,element,attrs){var calculateFullHeight;calculateFullHeight=function(containerHeight){var contentSection,heightToConsider;return heightToConsider=0,contentSection=angular.element(document.querySelectorAll("section.content")),contentSection.length&&(contentSection=contentSection[0],heightToConsider+=parseInt($window.getComputedStyle(contentSection,null).getPropertyValue("padding-top")),heightToConsider+=parseInt($window.getComputedStyle(contentSection,null).getPropertyValue("padding-bottom"))),containerHeight-heightToConsider},element.find("iframe")[0].onload=function(){return scope.$emit("iframeLoaded",{}),"function"==typeof scope.onLoad?(this.style.display="block",scope.onLoad()):void 0},scope.fullHeight?(element.find("iframe").height(calculateFullHeight(angular.element(document.querySelector("#content-wrapper")).height())+"px"),scope.$on("content.changed",function(event,data){return element.find("iframe").height(calculateFullHeight(data.height)+"px")})):$window.addEventListener("message",function(event){return event.data.height?element.find("iframe").height(event.data.height+"px"):void 0})}}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").directive("adminSideNav",function(){return{restrict:"A",scope:!1,templateUrl:"core/admin-side-nav.html",controller:["$scope","SideNavigationPartials",function($scope,SideNavigationPartials){return $scope.navigation=SideNavigationPartials.getOrderedPartialTemplates()}],link:function(scope,element,attrs){}}})}.call(this),function(){angular.module("BBAdminDashboard").directive("bbAdminDashboard",["PageLayout",function(PageLayout){return{restrict:"AE",scope:{bb:"=",companyId:"@",ssoToken:"@"},template:"<div ui-view></div>",controller:["$scope","$rootScope","$element","$compile","$localStorage","$state","PageLayout","BBModel","AdminSsoLogin","AdminLoginOptions",function($scope,$rootScope,$element,$compile,$localStorage,$state,PageLayout,BBModel,AdminSsoLogin,AdminLoginOptions){var api_url;$rootScope.bb=$scope.bb,api_url=$localStorage.getItem("api_url"),!$scope.bb.api_url&&api_url&&($scope.bb.api_url=api_url),AdminSsoLogin.apiUrl=$scope.bb.api_url,AdminSsoLogin.ssoToken=null!=$scope.ssoToken?$scope.ssoToken:AdminLoginOptions.sso_token,AdminSsoLogin.companyId=null!=$scope.companyId?$scope.companyId:AdminLoginOptions.company_id,$scope.$on("$stateChangeError",function(evt,to,toParams,from,fromParams,error){switch(error.reason){case"NOT_LOGGABLE_ERROR":return evt.preventDefault(),$state.go("login");case"COMPANY_IS_PARENT":return evt.preventDefault(),$state.go("login")}}),$scope.openSideMenu=function(){return PageLayout.sideMenuOn=!0},$scope.closeSideMenu=function(){return PageLayout.sideMenuOn=!1},$scope.toggleSideMenu=function(){return PageLayout.sideMenuOn=!PageLayout.sideMenuOn}}],link:function(scope,element,attrs){return scope.page=PageLayout,scope.$watch("page",function(newPage,oldPage){return newPage.sideMenuOn?(element.addClass("sidebar-open"),element.removeClass("sidebar-collapse")):(element.addClass("sidebar-collapse"),element.removeClass("sidebar-open")),newPage.boxed?element.addClass("layout-boxed"):element.removeClass("layout-boxed")},!0)}}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").directive("bbChildCompanySwitch",function(){return{restrict:"A",replace:!0,scope:!0,controller:["$scope","$state","AdminLoginService",function($scope,$state,AdminLoginService){return $scope.logoutChildCompany=function(){return $scope.bb.company.$getParent().then(function(parent_company){return AdminLoginService.setCompany(parent_company.id).then(function(response){return $state.go("login")},function(err){return $scope.formErrors.push({message:"ADMIN_DASHBOARD.LOGIN_PAGE.ERROR_ISSUE_WITH_COMPANY"})})},function(err){return $scope.formErrors.push({message:"ADMIN_DASHBOARD.LOGIN_PAGE.ERROR_ISSUE_WITH_COMPANY"})})}}]}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard").directive("bbClassicSwitch",function(){return{restrict:"A",scope:!1,link:function(scope,element,attrs){return scope.bb.api_url?attrs.$set("href",scope.bb.api_url+"?dashboard_redirect=true"):void 0}}})}.call(this),function(){angular.module("BBAdminDashboard").directive("bbIfLogin",["$uibModal","$log","$q","$rootScope","AdminCompanyService","$compile","$templateCache","ModalForm","BBModel",function($uibModal,$log,$q,$rootScope,AdminCompanyService,$compile,$templateCache,ModalForm,BBModel){var compile,link;return compile=function(){return{pre:function(scope,element,attributes){return scope.notLoaded=function(sc){return null},scope.setLoaded=function(sc){return null},scope.setPageLoaded=function(){return null},$rootScope.start_deferred=$q.defer(),$rootScope.connection_started=$rootScope.start_deferred.promise,this.whenready=$q.defer(),scope.loggedin=this.whenready.promise,AdminCompanyService.query(attributes).then(function(company){return scope.company=company,scope.bb||(scope.bb={}),scope.bb.company=company,this.whenready.resolve(),$rootScope.start_deferred.resolve()})},post:function(scope,element,attributes){}}},link=function(scope,element,attrs){},{compile:compile}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").directive("bodyResize",["$window","$timeout","AdminCoreOptions","PageLayout",function($window,$timeout,AdminCoreOptions,PageLayout){return{restrict:"A",link:function(scope,element){var _sideMenuSetup;$timeout(function(){_sideMenuSetup(!0)},0),angular.element($window).bind("resize",function(){_sideMenuSetup()}),_sideMenuSetup=function(firstLoad){null==firstLoad&&(firstLoad=!1),$window.innerWidth>768&&(!firstLoad||AdminCoreOptions.sidenav_start_open)&&!AdminCoreOptions.deactivate_sidenav?PageLayout.sideMenuOn=!0:PageLayout.sideMenuOn=!1}}}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").directive("contentHeight",["$window","$timeout",function($window,$timeout){return{restrict:"A",link:function(scope,element,attributes){var _contentHeightSetup,includeFooter,includeHeader;includeFooter=!0,includeHeader=!0,null!=attributes.includeHeader&&(includeHeader=attributes.includeHeader),null!=attributes.includeFooter&&(includeFooter=attributes.includeFooter),$timeout(function(){_contentHeightSetup()},10),angular.element($window).bind("resize",function(){_contentHeightSetup()}),_contentHeightSetup=function(){var height;height=$window.innerHeight,includeHeader===!0&&(height-=angular.element(document).find("header")[0].offsetHeight),includeFooter===!0&&(height-=angular.element(document).find("footer")[0].offsetHeight),element.css({height:height+"px"}),scope.$emit("content.changed",{height:height}),scope.$broadcast("content.changed",{height:height})}}}}])}.call(this),function(){angular.module("BBAdminDashboard").filter("minutesToString",function(){return function(minutes,format){return null==format&&(format="HH:mm"),moment(moment.duration(minutes,"minutes")._data).format(format)}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard").provider("AdminCoreOptions",function(){"ngInject";var options;options={default_state:"calendar",deactivate_sidenav:!1,deactivate_boxed_layout:!1,sidenav_start_open:!0,boxed_layout_start:!1,side_navigation:[{group_name:"SIDE_NAV_BOOKINGS",items:["calendar","clients","check-in","dashboard-iframe","members-iframe"]},{group_name:"SIDE_NAV_CONFIG",items:["config-iframe","publish-iframe","settings-iframe"]}]},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){angular.module("BBAdminDashboard").factory("AdminSsoLogin",["halClient","$q",function(halClient,$q){return{ssoToken:null,companyId:null,apiUrl:null,ssoLoginPromise:function(ssoToken,companyId,apiUrl){var data,defer;return null==ssoToken&&(ssoToken=this.ssoToken),null==companyId&&(companyId=this.companyId),null==apiUrl&&(apiUrl=this.apiUrl),defer=$q.defer(),null==ssoToken||null==companyId||null==apiUrl?(defer.reject(),defer.promise):(data={token:ssoToken},halClient.$post(apiUrl+"/api/v1/login/admin_sso/"+companyId,{},data).then(function(login){var params;return params={auth_token:login.auth_token},login.$get("administrator",params).then(function(admin){return defer.resolve(admin)},function(err){return defer.reject(err)})},function(err){return defer.reject(err)}),defer.promise)}}}])}.call(this),function(){angular.module("BBAdminDashboard").factory("AdminSsoLoginUrl",["$rootScope","company_id","$exceptionHandler",function($rootScope,company_id,$exceptionHandler){return null==$rootScope.bb.companyId&&($rootScope.bb.companyId|=company_id),$rootScope.bb.companyId||$exceptionHandler(new Error('Angular value "company_id" is undefined! '),"",!0),$rootScope.bb.api_url+"/api/v1/login/admin_sso/"+$rootScope.bb.companyId}])}.call(this),function(){angular.module("BBAdminDashboard").factory("BusyService",["$q","$log","$rootScope","AlertService","ErrorService",function($q,$log,$rootScope,AlertService,ErrorService){return{notLoaded:function(cscope){for(cscope.$emit("show:loader",cscope),cscope.isLoaded=!1;cscope;)cscope.hasOwnProperty("scopeLoaded")&&(cscope.scopeLoaded=!1),cscope=cscope.$parent},setLoaded:function(cscope){var loadingFinished;for(cscope.$emit("hide:loader",cscope),cscope.isLoaded=!0,loadingFinished=!0;cscope;)cscope.hasOwnProperty("scopeLoaded")&&($scope.areScopesLoaded(cscope)?cscope.scopeLoaded=!0:loadingFinished=!1),cscope=cscope.$parent;return loadingFinished?$rootScope.$broadcast("loading:finished"):void 0},setPageLoaded:function(scope){return null},setLoadedAndShowError:function(scope,err,error_string){return $log.warn(err,error_string),this.setLoaded(scope),409===err.status?"Rule checking failed"===err.data.error?AlertService.danger(ErrorService.createCustomError(err.data.message)):AlertService.danger(ErrorService.getError("ITEM_NO_LONGER_AVAILABLE")):err.data&&"Number of Bookings exceeds the maximum"===err.data.error?AlertService.danger(ErrorService.getError("MAXIMUM_TICKETS")):AlertService.danger(ErrorService.getError("GENERIC"))},areScopesLoaded:function(cscope){var child;if(cscope.hasOwnProperty("isLoaded")&&!cscope.isLoaded)return!1;for(child=cscope.$$childHead;child;){if(!$scope.areScopesLoaded(child))return!1;child=child.$$nextSibling}return!0}}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").factory("PageLayout",["AdminCoreOptions",function(AdminCoreOptions){return{hideSideMenuControl:this.hideSideMenuControl?this.hideSideMenuControl:AdminCoreOptions.deactivate_sidenav,hideBoxedLayoutControl:this.hideBoxedLayoutControl?this.hideBoxedLayoutControl:AdminCoreOptions.deactivate_boxed_layout,sideMenuOn:this.sideMenuOn?this.sideMenuOn:AdminCoreOptions.sidenav_start_open&&!AdminCoreOptions.deactivate_sidenav,boxed:this.boxed?this.boxed:AdminCoreOptions.boxed_layout_start}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").provider("RuntimeRoutes",["$urlRouterProvider",function($urlRouterProvider){var routeProvider;routeProvider=$urlRouterProvider,this.setProvider=function(provider){return routeProvider=provider},this.$get=function(){return routeProvider}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").provider("RuntimeStates",["$stateProvider",function($stateProvider){var stateProvider;stateProvider=$stateProvider,this.setProvider=function(provider){return stateProvider=provider},this.$get=function(){return stateProvider}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").factory("SideNavigationPartials",["AdminCoreOptions",function(AdminCoreOptions){var templatesArray;return templatesArray=[],{addPartialTemplate:function(identifier,partial){_.find(templatesArray,function(item){return item.module===identifier})||templatesArray.push({module:identifier,navPartial:partial})},getPartialTemplates:function(){return templatesArray},getOrderedPartialTemplates:function(flat){var flatOrderedList,orderedList,orphanItems;return null==flat&&(flat=!1),orderedList=[],flatOrderedList=[],angular.forEach(AdminCoreOptions.side_navigation,function(group,index){var newGroup;return angular.isArray(group.items)&&group.items.length?(newGroup={group_name:group.group_name,items:[]},angular.forEach(group.items,function(item,index){var existing;return existing=_.find(templatesArray,function(template){return template.module===item}),existing?(flatOrderedList.push(existing),newGroup.items.push(existing)):void 0}),orderedList.push(newGroup)):void 0}),orphanItems=[],angular.forEach(templatesArray,function(partial,index){var existing;return existing=_.find(flatOrderedList,function(item){return item.module===partial.module}),existing?void 0:(flatOrderedList.push(partial),orphanItems.push(partial))}),orphanItems.length&&orderedList.push({group_name:" ",items:orphanItems}),flat?flatOrderedList:orderedList}}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").factory("TemplateService",["$templateCache","$exceptionHandler",function($templateCache,$exceptionHandler){return{get:function(template){return null!=$templateCache.get(template)?$templateCache.get(template):null!=$templateCache.get("/default"+template)?$templateCache.get("/default"+template):$exceptionHandler(new Error('Template "'+template+'" not found'),"",!0)}}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard").config(["$translateProvider",function($translateProvider){"ngInject";var translations;translations={SIDE_NAV_BOOKINGS:"BOOKINGS",SIDE_NAV_CONFIG:"CONFIGURATION",ADMIN_DASHBOARD:{CORE:{GREETING:"Hi",LOGOUT:"Logout",VERSION:"Version",COPYRIGHT:"Copyright",SWITCH_TO_CLASSIC:"Switch to Classic"}}},$translateProvider.translations("en",translations)}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.login.controllers").controller("LoginPageCtrl",["$scope","$state","AdminLoginService","AdminCoreOptions","user",function($scope,$state,AdminLoginService,AdminCoreOptions,user){return $scope.user=user,$scope.loginSuccess=function(company){return $scope.company=company,$scope.bb.company=company,$state.go(AdminCoreOptions.default_state)}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.login.directives").directive("adminDashboardLogin",function(){return{restrict:"AE",replace:!0,scope:{onSuccess:"=",onCancel:"=",onError:"=",bb:"=",user:"=?"},templateUrl:"login/admin-dashboard-login.html",controller:["$scope","$rootScope","BBModel","$q","$localStorage","$state","AdminLoginOptions",function($scope,$rootScope,BBModel,$q,$localStorage,$state,AdminLoginOptions){"ngInject";var companySelection,formErrorExists;return $scope.template_vars={show_api_field:AdminLoginOptions.show_api_field,show_login:!0,show_pick_company:!1,show_pick_department:!1,show_loading:!1},$scope.login_data={email:null,password:null,selected_admin:null,selected_company:null,site:$localStorage.getItem("api_url")},$scope.formErrors=[],formErrorExists=function(message){var i,len,obj,ref;for(ref=$scope.formErrors,i=0,len=ref.length;len>i;i++)if(obj=ref[i],obj.message.match(message))return!0;return!1},companySelection=function(user){var message;return user.$has("administrators")?user.$getAdministrators().then(function(administrators){var message,params;return $scope.administrators=administrators,administrators.length>1?($scope.template_vars.show_loading=!1,$scope.template_vars.show_login=!1,$scope.template_vars.show_pick_company=!0):1===administrators.length?(params={email:$scope.login_data.email,password:$scope.login_data.password},$scope.login_data.selected_admin=_.first(administrators),$scope.login_data.selected_admin.$post("login",{},params).then(function(login){return $scope.login_data.selected_admin.$getCompany().then(function(company){return $scope.template_vars.show_loading=!1,company.companies&&company.companies.length>0?($scope.template_vars.show_pick_department=!0,$scope.departments=company.companies):($scope.login_data.selected_company=company,BBModel.Admin.Login.$setLogin($scope.login_data.selected_admin),BBModel.Admin.Login.$setCompany($scope.login_data.selected_company.id).then(function(user){return $scope.onSuccess($scope.login_data.selected_company)}))})})):($scope.template_vars.show_loading=!1,message="ADMIN_DASHBOARD.LOGIN_PAGE.ERROR_INCORRECT_CREDS",formErrorExists(message)?void 0:$scope.formErrors.push({message:message}))}):user.$has("company")?($scope.login_data.selected_admin=user,user.$getCompany().then(function(company){return company.companies&&company.companies.length>0?($scope.template_vars.show_loading=!1,$scope.template_vars.show_pick_department=!0,$scope.template_vars.show_login=!1,$scope.departments=company.companies):($scope.login_data.selected_company=company,BBModel.Admin.Login.$setLogin($scope.login_data.selected_admin),BBModel.Admin.Login.$setCompany($scope.login_data.selected_company.id).then(function(user){return $scope.onSuccess($scope.login_data.selected_company)}))},function(err){var message;return $scope.template_vars.show_loading=!1,message="ADMIN_DASHBOARD.LOGIN_PAGE.ERROR_ISSUE_WITH_COMPANY",formErrorExists(message)?void 0:$scope.formErrors.push({message:message})})):($scope.template_vars.show_loading=!1,message="ADMIN_DASHBOARD.LOGIN_PAGE.ERROR_ACCOUNT_ISSUES",formErrorExists(message)?void 0:$scope.formErrors.push({message:message}))},$scope.user&&($scope.template_vars.show_pick_department=!0,$scope.template_vars.show_login=!1,companySelection($scope.user)),$scope.login=function(isValid){var params;return isValid?($scope.template_vars.show_loading=!0,AdminLoginOptions.show_api_field&&($scope.login_data.site=$scope.login_data.site.replace(/\/+$/,""),-1===$scope.login_data.site.indexOf("http")&&($scope.login_data.site="https://"+$scope.login_data.site),$scope.bb.api_url=$scope.login_data.site,$rootScope.bb.api_url=$scope.login_data.site,$localStorage.setItem("api_url",$scope.login_data.site)),params={email:$scope.login_data.email,password:$scope.login_data.password},BBModel.Admin.Login.$login(params).then(function(user){return companySelection(user)},function(err){var message;return $scope.template_vars.show_loading=!1,message="ADMIN_DASHBOARD.LOGIN_PAGE.ERROR_INCORRECT_CREDS",formErrorExists(message)?void 0:$scope.formErrors.push({message:message})})):void 0},$scope.goToResetPassword=function(){return $state.go("reset-password")},$scope.pickCompany=function(){var params;return $scope.template_vars.show_loading=!0,$scope.template_vars.show_pick_department=!1,params={email:$scope.login_data.email,password:$scope.login_data.password},$scope.login_data.selected_admin.$post("login",{},params).then(function(login){return $scope.login_data.selected_admin.$getCompany().then(function(company){return $scope.template_vars.show_loading=!1,company.companies&&company.companies.length>0?($scope.template_vars.show_pick_department=!0,$scope.departments=company.companies):$scope.login_data.selected_company=company})})},$scope.selectCompanyDepartment=function(isValid){return $scope.template_vars.show_loading=!0,isValid?($scope.bb.company=$scope.login_data.selected_company,BBModel.Admin.Login.$setLogin($scope.login_data.selected_admin),BBModel.Admin.Login.$setCompany($scope.login_data.selected_company.id).then(function(user){return $scope.onSuccess($scope.login_data.selected_company)})):void 0}}]}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.login.services").provider("AdminLoginOptions",function(){var options;options={show_api_field:!1,use_default_states:!0,show_in_navigation:!0,parent_state:"root",sso_token:null,company_id:null},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.login.services").factory("LoggedAdmin",["AdminLoginOptions","$q",function(AdminLoginOptions,$q){var loggedAdmin;return loggedAdmin={user:null,adminAccountsArray:null,departmentsArray:null,currentCompany:null},{setUser:function(user){loggedAdmin.user=user},getUser:function(){return loggedAdmin.user},setCurrentCompany:function(company){loggedAdmin.currentCompany=company,loggedAdmin.departmentsArray=null},getCurrentCompany:function(){var deferred;return deferred=$q.defer(),null!=loggedAdmin.currentCompany?(deferred.resolve(loggedAdmin.currentCompany),deferred.promise):null==loggedAdmin.user?(deferred.reject(new Error("LOGGED_ADMIN.ERROR_NO_USER_PROVIDED")),deferred.promise):(loggedAdmin.user.$has("company")&&loggedAdmin.user.getCompanyPromise().then(function(company){return loggedAdmin.currentCompany=company,deferred.resolve(loggedAdmin.currentCompany)},function(err){return deferred.reject(new Error("LOGGED_ADMIN.ERROR_ISSUE_WITH_COMPANY"))}),deferred.promise)},getAdminAccounts:function(){var deferred;return deferred=$q.defer(),null!=loggedAdmin.adminAccountsArray?(deferred.resolve(loggedAdmin.adminAccountsArray),deferred.promise):null==loggedAdmin.user?(deferred.reject(new Error("LOGGED_ADMIN.ERROR_NO_USER_PROVIDED")),deferred.promise):(loggedAdmin.user.$has("administrators")?loggedAdmin.user.getAdministratorsPromise().then(function(adminAccounts){return loggedAdmin.adminAccountsArray=administrators,deferred.resolve(loggedAdmin.adminAccountsArray)},function(err){return deferred.reject(new Error("LOGGED_ADMIN.ERROR_COULD_NOT_GET_ADMINS"))}):(loggedAdmin.adminAccountsArray=[],deferred.resolve(loggedAdmin.adminAccountsArray)),deferred.promise)},getDepartments:function(){var deferred;return deferred=$q.defer(),null!=loggedAdmin.departmentsArray?(deferred.resolve(loggedAdmin.departmentsArray),deferred.promise):null==loggedAdmin.user?(deferred.reject(new Error("LOGGED_ADMIN.ERROR_NO_USER_PROVIDED")),deferred.promise):(this.getCurrentCompany().then(function(company){return company.companies&&company.companies.length>0?(loggedAdmin.departmentsArray=company.companies,deferred.resolve(loggedAdmin.departmentsArray)):(loggedAdmin.departmentsArray=[],deferred.resolve(loggedAdmin.departmentsArray))},function(err){return deferred.reject(err)}),deferred.promise)}}}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.login.translations").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{LOGIN_PAGE:{COMPANIES:"Companies",DEPARTMENTS:"Departments",FORGOT_PASSWORD:"Forgot your password?",HEADING:"Login to view your account",LOGIN:" Login",PASSWORD:"Password",SITE:"Site",SEARCH_COMPANY_PLACEHOLDER:"Select or search a company in the list...",SEARCH_DEPARTMENT_PLACEHOLDER:"Select or search a department in the list...",SELECT:"Select",SELECT_COMPANY:"Select company",USERNAME:"Username",ERROR_ISSUE_WITH_COMPANY:"Sorry, there seems to be a problem with the company associated with this account",ERROR_INCORRECT_CREDS:"Sorry, either your email or password was incorrect",ERROR_ACCOUNT_ISSUES:"Sorry, there seems to be a problem with this account",ERROR_REQUIRED:"This field is required."}}})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.logout.controllers").controller("LogoutPageCtrl",["AdminSsoLogin","BBModel","$scope","$state","$sessionStorage",function(AdminSsoLogin,BBModel,$scope,$state,$sessionStorage){BBModel.Admin.Login.$logout().then(function(){$sessionStorage.removeItem("user"),$sessionStorage.removeItem("auth_token"),AdminSsoLogin.ssoToken=null,AdminSsoLogin.companyId=null,$state.go("login",{},{reload:!0})})}])}.call(this),function(){"use strict";var ResetPasswordCtrl;ResetPasswordCtrl=["$scope","$state","AdminLoginOptions","AdminLoginService","QueryStringService","ValidatorService","ResetPasswordService","ResetPasswordSchemaFormService",function($scope,$state,AdminLoginOptions,AdminLoginService,QueryStringService,ValidatorService,ResetPasswordService,ResetPasswordSchemaFormService){"ngInject";var $resetPasswordCtrl,fetchSchemaForm,formErrorExists,init;$resetPasswordCtrl=this,init=function(){null==$scope.baseUrl&&($scope.baseUrl=$resetPasswordCtrl.resetPasswordSite),$resetPasswordCtrl.showApiField=AdminLoginOptions.show_api_field,$resetPasswordCtrl.resetPasswordSuccess=!1,$resetPasswordCtrl.showLoading=!1,$resetPasswordCtrl.showApiField&&($resetPasswordCtrl.resetPasswordSite=angular.copy($scope.bb.api_url)),$resetPasswordCtrl.validator=ValidatorService,$resetPasswordCtrl.formErrors=[],null!=QueryStringService("reset_password_token")&&"undefined"!==QueryStringService("reset_password_token")&&""!==QueryStringService("reset_password_token")?($resetPasswordCtrl.resetPasswordTemplate="reset-password/reset-password-by-token.html",fetchSchemaForm()):$resetPasswordCtrl.resetPasswordTemplate="reset-password/reset-password.html"},formErrorExists=function(message){var i,len,obj,ref;for(ref=$resetPasswordCtrl.formErrors,i=0,len=ref.length;len>i;i++)if(obj=ref[i],obj.message.match(message))return!0;return!1},fetchSchemaForm=function(){ResetPasswordSchemaFormService.getSchemaForm($scope.baseUrl).then(function(response){return $resetPasswordCtrl.resetPasswordSchema=angular.copy(response.data.schema),ResetPasswordSchemaFormService.setPasswordPattern($resetPasswordCtrl.resetPasswordSchema.properties.password.pattern),$resetPasswordCtrl.reset_password_pattern=ResetPasswordSchemaFormService.getPasswordPattern()},function(err){return ResetPasswordSchemaFormService.setPasswordPattern("^(?=[^\\s]*[^a-zA-Z])(?=[^\\s]*[a-zA-Z])[^\\s]{7,25}$"),$resetPasswordCtrl.reset_password_pattern=ResetPasswordSchemaFormService.getPasswordPattern()})},$resetPasswordCtrl.goBackToLogin=function(){$state.go("login")},$resetPasswordCtrl.sendResetPassword=function(email,resetPasswordSite){$resetPasswordCtrl.showLoading=!0,$resetPasswordCtrl.showApiField&&""!==resetPasswordSite&&($resetPasswordCtrl.resetPasswordSite=resetPasswordSite.replace(/\/+$/,""),-1===$resetPasswordCtrl.resetPasswordSite.indexOf("http")&&($resetPasswordCtrl.resetPasswordSite="https://"+$resetPasswordCtrl.resetPasswordSite),$scope.baseUrl=$resetPasswordCtrl.resetPasswordSite),ResetPasswordService.postRequest(email,$scope.baseUrl).then(function(response){return $resetPasswordCtrl.resetPasswordSuccess=!0,$resetPasswordCtrl.showLoading=!1},function(err){var message;return $resetPasswordCtrl.resetPasswordSuccess=!1,$resetPasswordCtrl.showLoading=!1,message="ADMIN_DASHBOARD.RESET_PASSWORD_PAGE.FORM_SUBMIT_FAIL_MSG",formErrorExists(message)?void 0:$resetPasswordCtrl.formErrors.push({message:message})})},$resetPasswordCtrl.submitSchemaForm=function(password){$resetPasswordCtrl.showLoading=!0,ResetPasswordSchemaFormService.postSchemaForm(password,$scope.baseUrl).then(function(response){var loginForm;return $resetPasswordCtrl.resetPasswordSuccess=!0,loginForm={email:response.data.email,password:password},AdminLoginService.login(loginForm).then(function(response){return $state.go("login")},function(err){return $resetPasswordCtrl.showLoading=!1,$resetPasswordCtrl.formErrors.push({message:"ADMIN_DASHBOARD.LOGIN_PAGE.ERROR_ISSUE_WITH_COMPANY"})})},function(err){var message;return $resetPasswordCtrl.resetPasswordSuccess=!1,$resetPasswordCtrl.showLoading=!1,message="ADMIN_DASHBOARD.RESET_PASSWORD_PAGE.FORM_SUBMIT_FAIL_MSG",formErrorExists(message)?void 0:$resetPasswordCtrl.formErrors.push({message:message})})},init()}],angular.module("BBAdminDashboard.reset-password").controller("ResetPasswordCtrl",ResetPasswordCtrl)}.call(this),function(){"use strict";var ResetPasswordPageCtrl;ResetPasswordPageCtrl=["$scope",function($scope){"ngInject";var init;(init=function(){null!=$scope.bb.api_url&&""!==$scope.bb.api_url&&($scope.baseUrl=angular.copy($scope.bb.api_url))})()}],angular.module("BBAdminDashboard.reset-password").controller("ResetPasswordPageCtrl",ResetPasswordPageCtrl)}.call(this),function(){"use strict";var adminDashboardResetPassword;adminDashboardResetPassword=function(){var directive;return directive={restrict:"AE",replace:!0,scope:!0,template:'<div ng-include="$resetPasswordCtrl.resetPasswordTemplate"></div>',controller:"ResetPasswordCtrl",controllerAs:"$resetPasswordCtrl"}},angular.module("BBAdminDashboard.reset-password").directive("adminDashboardResetPassword",adminDashboardResetPassword)}.call(this),function(){"use strict";var ResetPasswordSchemaFormService;ResetPasswordSchemaFormService=["$q","$http","QueryStringService",function($q,$http,QueryStringService){"ngInject";var getPasswordPattern,getSchemaForm,passwordPattern,postSchemaForm,setPasswordPattern;return passwordPattern="",setPasswordPattern=function(pattern){var password_pattern;return password_pattern=pattern},getPasswordPattern=function(){return passwordPattern},getSchemaForm=function(baseUrl){var deferred,src;return deferred=$q.defer(),src=baseUrl+"/api/v1/login/admin/reset_password_schema",$http.get(src,{}).then(function(response){return deferred.resolve(response)},function(err){return deferred.reject(err)}),deferred.promise},postSchemaForm=function(password,baseUrl){var body,deferred,resetPasswordToken,src;return deferred=$q.defer(),src=baseUrl+"/api/v1/login/admin/reset_password",resetPasswordToken=QueryStringService("reset_password_token"),body={password:password,reset_password_token:resetPasswordToken},$http.put(src,body).then(function(response){return deferred.resolve(response)},function(err){return deferred.reject(err)}),deferred.promise},{setPasswordPattern:setPasswordPattern,getPasswordPattern:getPasswordPattern,getSchemaForm:getSchemaForm,postSchemaForm:postSchemaForm}}],angular.module("BBAdminDashboard.reset-password").factory("ResetPasswordSchemaFormService",ResetPasswordSchemaFormService)}.call(this),function(){"use strict";var ResetPasswordService;ResetPasswordService=["$q","$window","$http",function($q,$window,$http){"ngInject";var postRequest;return postRequest=function(email,baseUrl){var body,deferred,path,url;return deferred=$q.defer(),url=baseUrl+"/api/v1/login/admin/reset_password_email",path=$window.location.pathname+"#/reset-password",body={email:email,path:path},$http.post(url,body).then(function(response){return deferred.resolve(response);
},function(err){return deferred.reject(err)}),deferred.promise},{postRequest:postRequest}}],angular.module("BBAdminDashboard.reset-password").factory("ResetPasswordService",ResetPasswordService)}.call(this),function(){"use strict";angular.module("BBAdminDashboard.reset-password").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{RESET_PASSWORD_PAGE:{BACK_BTN:"Back",CONFIRM_NEW_PASSWORD_LBL:"Confirm New Password",EMAIL_LBL:"Email",ENTER_NEW_PASSWORD:"Enter your new password",ENTER_EMAIL:"Enter your email address",ERROR_API_MISSING:"API url has not been set correctly.",ERROR_EMAIL_INVALID:"Please enter a valid email.",ERROR_PASSWORD_MATCH:"This needs to be the same as the new password.",ERROR_PASSWORD_PATTERN:"Password must be between 7 and 25 characters and contain at least one letter and one number.",ERROR_REQUIRED:"This field is required.",FORGOT_PASSWORD:"Forgot your password?",FORM_SUBMIT_FAIL:"Password Reset request failed",FORM_SUBMIT_SUCCESS:"Password Reset request submitted",FORM_SUBMIT_FAIL_MSG:"Sorry we couldn't update your password successfully. Please try again or contact our support team.",FORM_SUBMIT_SUCCESS_MSG:"Thank you for resetting your password. You will receive an email shortly with instructions to complete this process.",NEW_PASSWORD_LBL:"New Password",PASSWORD:"Password",PASSWORD_RESET_SUCCESS:"Password Reset complete",PASSWORD_RESET_SUCCESS_MSG:"Your password has now been successfully updated.",RESET_PASSWORD_BTN:"Reset Password",SITE_LBL:"Site"}}})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.members-iframe.controllers").controller("MembersIframePageCtrl",["$scope","$state","$rootScope","$window",function($scope,$state,$rootScope,$window){return $scope.parent_state=$state.is("members"),$rootScope.$on("$stateChangeStart",function(event,toState,toParams,fromState,fromParams){return $scope.parent_state=!1,"members"===toState.name?($scope.parent_state=!0,$scope.clearCurrentClient()):void 0}),$scope.setCurrentClient=function(client){return client?($rootScope.client_id=client,$scope.extra_params="id="+client):$scope.clearCurrentClient()},$scope.clearCurrentClient=function(){return $rootScope.client_id=null,$scope.extra_params=""},$window.addEventListener("message",function(_this){return function(event){return event&&event.data&&"client"===event.data.controller&&(event.data.id&&$scope.setCurrentClient(event.data.id),"single"===event.data.action)?$state.go("members.page",{path:"client/single",id:event.data.id}):void 0}}(this))}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.members-iframe.controllers").controller("MembersSubIframePageCtrl",["$scope","$state","$stateParams",function($scope,$state,$stateParams){return $scope.path=$stateParams.path,$stateParams.id?$scope.extra_params="id="+$stateParams.id:$scope.extra_params="",$scope.loading=!0,$scope.$on("iframeLoaded",function(){return $scope.loading=!1,$scope.$apply()})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.members-iframe.services").provider("AdminMembersIframeOptions",function(){var options;options={use_default_states:!0,show_in_navigation:!0,parent_state:"root"},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.members-iframe.translations").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{SIDE_NAV:{MEMBERS_IFRAME_PAGE:{MEMBERS:"Members",ALL_CLIENTS:"All clients",QUESTIONS:"Questions",EXPORT_TO_MAILCHIMP:"Export to Mailchimp"}}}})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe.controllers").controller("SettingsIframeAdvancedSettingsPageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.pageHeader="ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.ADVANCED_SETTINGS.TITLE",$scope.tabs=[{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.ADVANCED_SETTINGS.TAB_ONLINE_PAYMENTS",icon:"fa fa-credit-card",path:'settings.advanced-settings.page({path: "conf/payment/payment_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.ADVANCED_SETTINGS.TAB_ACCOUNTING_INTEGRATIONS",icon:"fa fa-pencil-square-o",path:'settings.advanced-settings.page({path: "conf/accounting/accounting_integration"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.ADVANCED_SETTINGS.TAB_BUSINESS_QUESTIONS",icon:"fa fa-question",path:'settings.advanced-settings.page({path: "conf/extra_question"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.ADVANCED_SETTINGS.TAB_API_SETTINGS",icon:"fa fa-code",path:'settings.advanced-settings.page({path: "conf/developer/parameter"})'}],$scope.contentsLoading=!1,$scope.$on("iframeLoaded",function(){return $scope.contentsLoading=!1,$scope.$apply()}),$scope.$on("iframeLoading",function(){return $scope.contentsLoading=!0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe.controllers").controller("SettingsIframeBasicSettingsPageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.pageHeader="ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TITLE",$scope.tabs=[{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_BUSINESS",icon:"fa fa-globe",path:'settings.basic-settings.page({path: "conf/setting/user_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_SERVICES",icon:"fa fa-wrench",path:'settings.basic-settings.page({path: "conf/setting/service_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_EVENTS",icon:"fa fa-ticket",path:'settings.basic-settings.page({path: "conf/setting/session_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_RESOURCES",icon:"fa fa-archive",path:'settings.basic-settings.page({path: "conf/setting/resource_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_WIDGET",icon:"fa fa-calendar-times-o",path:'settings.basic-settings.page({path: "conf/setting/widget_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_BOOKINGS",icon:"fa fa-book",path:'settings.basic-settings.page({path: "conf/setting/booking_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_NOTIFICATIONS",icon:"fa fa-envelope",path:'settings.basic-settings.page({path: "conf/setting/notifier_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_PRICING",icon:"fa fa-credit-card",path:'settings.basic-settings.page({path: "conf/setting/pricing_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_TERMINOLOGY",icon:"fa fa-language",path:'settings.basic-settings.page({path: "conf/language/user_edit"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_CUSTOM_TCS",icon:"fa fa-pencil-square-o",path:'settings.basic-settings.page({path: "conf/text/terms_conditions"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.BASIC_SETTINGS.TAB_EXTRA_FEATURES",icon:"fa fa-trophy",path:'settings.basic-settings.page({path: "conf/setting/features_edit"})'}],$scope.contentsLoading=!1,$scope.$on("iframeLoaded",function(){return $scope.contentsLoading=!1,$scope.$apply()}),$scope.$on("iframeLoading",function(){return $scope.contentsLoading=!0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe.controllers").controller("SettingsIframeIntegrationsPageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.pageHeader="ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.INTEGRATIONS.TITLE",$scope.tabs=[{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.INTEGRATIONS.TAB_PAYMENT",icon:"fa fa-credit-card",path:'settings.integrations.page({path: "conf/addons/payment"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.INTEGRATIONS.TAB_ACCOUNTING",icon:"fa fa-pencil-square-o",path:'settings.integrations.page({path: "conf/addons/accounting"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.INTEGRATIONS.TAB_OTHER",icon:"fa fa-question",path:'settings.integrations.page({path: "conf/addons/other"})'}],$scope.contentsLoading=!1,$scope.$on("iframeLoaded",function(){return $scope.contentsLoading=!1,$scope.$apply()}),$scope.$on("iframeLoading",function(){return $scope.contentsLoading=!0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe.controllers").controller("SettingsIframePageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.parent_state=$state.is("setting"),$scope.path="conf",$rootScope.$on("$stateChangeStart",function(event,toState,toParams,fromState,fromParams){return $scope.parent_state=!1,"setting"===toState.name?$scope.parent_state=!0:void 0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe.controllers").controller("SettingsIframeSubscriptionPageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.pageHeader="ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.SUBSCRIPTION.TITLE",$scope.tabs=[{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.SUBSCRIPTION.TAB_STATUS",icon:null,path:'settings.subscription.page({path: "subscription/show"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.SUBSCRIPTION.TAB_PAYMENT_HISTORY",icon:null,path:'settings.subscription.page({path: "payment_event"})'},{name:"ADMIN_DASHBOARD.SETTINGS_IFRAME_PAGE.SUBSCRIPTION.TAB_INVOICES",icon:null,path:'settings.subscription.page({path: "payment_invoice"})'}],$scope.contentsLoading=!1,$scope.$on("iframeLoaded",function(){return $scope.contentsLoading=!1,$scope.$apply()}),$scope.$on("iframeLoading",function(){return $scope.contentsLoading=!0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe.controllers").controller("SettingsSubIframePageCtrl",["$scope","$state","$stateParams",function($scope,$state,$stateParams){return $scope.path=$stateParams.path,$stateParams.id?$scope.extra_params="id="+$stateParams.id:$scope.extra_params="",$scope.pageHeader=null,$scope.$emit("iframeLoading",{}),$scope.onIframeLoad=function(){return $scope.$emit("iframeLoaded",{})},$scope.loading=!0,$scope.$on("iframeLoaded",function(){return $scope.loading=!1,$scope.$apply()})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe.services").provider("AdminSettingsIframeOptions",function(){var options;options={use_default_states:!0,show_in_navigation:!0,parent_state:"root"},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.publish-iframe.controllers").controller("PublishIframePageCtrl",["$scope","$state","$rootScope",function($scope,$state,$rootScope){return $scope.parent_state=$state.is("publish"),$scope.path="conf",$rootScope.$on("$stateChangeStart",function(event,toState,toParams,fromState,fromParams){return $scope.parent_state=!1,"setting"===toState.name?$scope.parent_state=!0:void 0})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.publish-iframe.controllers").controller("PublishSubIframePageCtrl",["$scope","$state","$stateParams",function($scope,$state,$stateParams){return $scope.path=$stateParams.path,$scope.loading=!0,$scope.$on("iframeLoaded",function(){return $scope.loading=!1,$scope.$apply()})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.publish-iframe.services").provider("AdminPublishIframeOptions",function(){var options;options={use_default_states:!0,show_in_navigation:!0,parent_state:"root"},this.setOption=function(option,value){options.hasOwnProperty(option)&&(options[option]=value)},this.getOption=function(option){return options.hasOwnProperty(option)?options[option]:void 0},this.$get=function(){return options}})}.call(this),function(){"use strict";angular.module("BBAdminDashboard.settings-iframe.translations").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{SIDE_NAV:{SETTINGS_IFRAME_PAGE:{ACCOUNT_SETTINGS:"Account settings",MY_BUSINESS:"My business",BASIC_SETTINGS:"Basic settings",ADVANCED_SETTINGS:"Advanced settings",INTEGRATIONS:"Integrations",IMAGES:"Images",USERS_ADMINS:"Users & Admins",ANNOUNCEMENTS:"Announcements",SUBSCRIPTION:"Subscription"}},SETTINGS_IFRAME_PAGE:{BASIC_SETTINGS:{TITLE:"Settings",TAB_BUSINESS:"Business",TAB_SERVICES:"Services",TAB_STAFF:"Staff",TAB_EVENTS:"Events",TAB_RESOURCES:"Resources",TAB_WIDGET:"Widget",TAB_BOOKINGS:"Bookings",TAB_NOTIFICATIONS:"Notifications",TAB_PRICING:"Pricing",TAB_TERMINOLOGY:"Terminology",TAB_CUSTOM_TCS:"Custom T&Cs",TAB_EXTRA_FEATURES:"Extra features"},ADVANCED_SETTINGS:{TITLE:"Advanced settings",TAB_ONLINE_PAYMENTS:"Online payments",TAB_ACCOUNTING_INTEGRATIONS:"Accounting Integrations",TAB_BUSINESS_QUESTIONS:"Business Questions",TAB_API_SETTINGS:"API settings"},INTEGRATIONS:{TITLE:"Integrations",TAB_PAYMENT:"Payment",TAB_ACCOUNTING:"Accounting",TAB_OTHER:"Other"},SUBSCRIPTION:{TITLE:"Subscription",TAB_STATUS:"Status",TAB_PAYMENT_HISTORY:"Payment history",TAB_INVOICES:"Invoices"}}}})}])}.call(this),function(){"use strict";angular.module("BBAdminDashboard.publish-iframe.translations").config(["$translateProvider",function($translateProvider){return $translateProvider.translations("en",{ADMIN_DASHBOARD:{SIDE_NAV:{PUBLISH_IRAME_PAGE:{PUBLISH:"Publish",PUBLISH_BUSINESS:"Publish business",PUBLIC_SITE:"Public site",CUSTOMISE_WIDGETS:"Customise widgets",SINGLE_WIDGET:"Single widget",BOOK_NOW_BUTTONS:"'Book Now' buttons",OTHER_TOOLS:"Other tools"}}}})}])}.call(this);