(window.webpackJsonp=window.webpackJsonp||[]).push([[239],{2674:function(e,t,n){"use strict";n.r(t);var r=n(5),c=(n(22),n(39),n(99)),l=n(13),o={layout:function(e){switch(e.params.role){case"inventory":return"inventoryLayout";case"department":return"departmentLayout";case"manager":return"hospitalLayout";case"billing":return"billingLayout";case"ambulance":return"AmbulanceLayout";case"pharmacy":return"pharmacyLayout"}},data:function(){return{role:"",refreshKey:0}},created:function(){var e=this.$route.params;this.role=e.role},mounted:function(){var e=this;this._alertsInterval=setInterval((function(){e.syncAlerts()}),15e3),window.addEventListener("focus",this.handleResume),document.addEventListener("visibilitychange",this.handleVisibilityChange)},beforeDestroy:function(){clearInterval(this._alertsInterval),window.removeEventListener("focus",this.handleResume),document.removeEventListener("visibilitychange",this.handleVisibilityChange)},methods:{getSyncMethod:function(){switch(this.role){case"billing":return c.a.syncReactiveStaffAlerts.bind(c.a);case"inventory":return l.a.syncInventoryReactiveStaffAlerts.bind(l.a);case"department":return l.a.syncDepartmentReactiveStaffAlerts.bind(l.a);case"manager":return l.a.syncManagerReactiveStaffAlerts.bind(l.a);case"ambulance":return l.a.syncAmbulanceReactiveStaffAlerts.bind(l.a);case"pharmacy":return l.a.syncPharmacyReactiveStaffAlerts.bind(l.a);default:return null}},syncAlerts:function(){var e=this;return Object(r.a)(regeneratorRuntime.mark((function t(){var n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.getSyncMethod()){t.next=3;break}return t.abrupt("return");case 3:return t.prev=3,t.next=6,n();case 6:null!=(r=t.sent)&&r.changed&&(e.refreshKey+=1),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(3),console.error("Error syncing ".concat(e.role," alerts page:"),t.t0);case 13:case"end":return t.stop()}}),t,null,[[3,10]])})))()},handleResume:function(){this.syncAlerts()},handleVisibilityChange:function(){document.hidden||this.syncAlerts()}}},h=n(10),component=Object(h.a)(o,(function(){var e=this,t=e._self._c;return t("div",[t("AlertsPage",{attrs:{isMobile:!0,role:e.role,"refresh-key":e.refreshKey}})],1)}),[],!1,null,null,null);t.default=component.exports;installComponents(component,{AlertsPage:n(82).default})}}]);