diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs index a89cb0031..b4c15eea3 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs @@ -104,7 +104,7 @@ {{/zone}} {{#zone "bottomJs"}} {{js "js/nav-menu.js"}} {{/zone}} diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/public/js/nav-menu.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/public/js/nav-menu.js index c15f80b26..5015563a9 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/public/js/nav-menu.js +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/public/js/nav-menu.js @@ -22,6 +22,15 @@ var modalPopup = ".wr-modalpopup", var emmAdminBasePath = "/api/device-mgt/v1.0"; +//function openCollapsedNav() { +// $(".wr-hidden-nav-toggle-btn").addClass("active"); +// $("#hiddenNav").slideToggle("slideDown", function () { +// if ($(this).css("display") == "none") { +// $(".wr-hidden-nav-toggle-btn").removeClass("active"); +// } +// }); +//} + /* * set popup maximum height function. */ @@ -50,74 +59,93 @@ function hidePopup() { $(modalPopup).hide(); } -var updateNotificationCount = function (data, textStatus, jqXHR) { +/* + * QR-code generation function. + */ +function generateQRCode(qrCodeClass) { + var enrollmentURL = $("#qr-code-modal").data("enrollment-url"); + $(qrCodeClass).qrcode({ + text: enrollmentURL, + width: 200, + height: 200 + }); +} + +function toggleEnrollment() { + $(".modalpopup-content").html($("#qr-code-modal").html()); + generateQRCode(".modalpopup-content .qr-code"); + showPopup(); +} + +var updateNotificationCountOnSuccess = function (data, textStatus, jqXHR) { + var notificationBubble = "#notification-bubble"; if (jqXHR.status == 200 && data) { var responsePayload = JSON.parse(data); - var newNotificationsCount = responsePayload.count; + var newNotificationsCount = responsePayload["count"]; if (newNotificationsCount > 0) { - $("#notification-bubble").html(newNotificationsCount); + $(notificationBubble).html(newNotificationsCount); + $(notificationBubble).show(); + } else { + $(notificationBubble).hide(); } -// } else { -// $("#notification-bubble").html("Error"); -// } } }; -function loadNotificationsPanel() { - if ("true" == $("#right-sidebar").attr("is-authorized")) { - var serviceURL = emmAdminBasePath + "/notifications?status=NEW"; - invokerUtil.get(serviceURL, updateNotificationCount, hideNotificationCount); - loadNewNotifications(); - } else { - $("#notification-bubble-wrapper").remove(); - } +function updateNotificationCountOnError() { + var notificationBubble = "#notification-bubble"; + $(notificationBubble).html("Error"); + $(notificationBubble).show(); } -function hideNotificationCount(jqXHR) { - if (jqXHR.status == 404) { - // this means "no new notifications to show" - $("#notification-bubble").hide(); +function loadNewNotificationsOnSideViewPanel() { + if ($("#right-sidebar").attr("is-authorized") == "false") { + $("#notification-bubble-wrapper").remove(); } else { - $("#notification-bubble").html("Error"); + var serviceURL = emmAdminBasePath + "/notifications?status=NEW"; + invokerUtil.get(serviceURL, updateNotificationCountOnSuccess, updateNotificationCountOnError); + loadNewNotifications(); } } function loadNewNotifications() { var messageSideBar = ".sidebar-messages"; - if ($("#right-sidebar").attr("is-authorized") == "true") { + if ($("#right-sidebar").attr("is-authorized") == "false") { + $(messageSideBar).html("