diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj b/400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj index 2b60b11..c08ba31 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/AIAHTML5.ADMIN.API.csproj @@ -21,6 +21,7 @@ ..\packages\WebGrease.1.5.2\lib + true @@ -320,6 +321,9 @@ AIADBEntity.tt + + AIADBEntity.tt + AIADBEntity.tt @@ -729,7 +733,7 @@ - True + False True 65397 / diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs index aed9fea..1745af0 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/LicenseController.cs @@ -365,9 +365,11 @@ namespace AIAHTML5.ADMIN.API.Controllers public HttpResponseMessage UpdateLicenseModulesStatus(JObject jsonData) { bool Status = false; - Tuple LicenseModuleStatus = new Tuple( + Tuple LicenseModuleStatus = new Tuple( jsonData["licenseId"].Value(), - jsonData["moduleStatusText"].Value()); + jsonData["moduleStatusText"].Value(), + jsonData["isAodOn"].Value(), + jsonData["CourseListText"].Value()); try { Status = LicenseModel.UpdateLicenseModulesStatus(dbContext, LicenseModuleStatus); @@ -387,6 +389,23 @@ namespace AIAHTML5.ADMIN.API.Controllers } } + [Route("GetLicenseAodCourse")] + [HttpGet] + public HttpResponseMessage GetLicenseAodCourse(int LicenseId) + { + List courseList; + try + { + courseList = LicenseModel.GetLicenseAodCourse(dbContext, LicenseId); + return Request.CreateResponse(HttpStatusCode.OK, courseList); + } + catch (Exception ex) + { + // Log exception code goes here + return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message); + } + } + [Route("CheckAccountNumber")] [HttpGet] @@ -423,4 +442,5 @@ namespace AIAHTML5.ADMIN.API.Controllers } } + } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs index 6eb4669..b811649 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Controllers/UserController.cs @@ -121,9 +121,10 @@ namespace AIAHTML5.ADMIN.API.Controllers string tagName = jsonData["tagName"].Value(); long SessionId = jsonData["SessionId"].Value(); bool isSiteUser = jsonData["isSiteUser"].Value(); + bool isAdmin = jsonData["isAdmin"].Value(); try { - Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, SessionId, isSiteUser); + Status = UserModel.ManageUserLoginStatus(dbContext, userId, tagName, SessionId, isSiteUser, isAdmin); return Request.CreateResponse(HttpStatusCode.OK, Status.ToString()); } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs index 39f165b..3a68d29 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.Context.cs @@ -3553,7 +3553,7 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateLicenseModestySettings", licenseEditionIdParameter, siteIdParameter, isModestyParameter, isSiteUserParameter, status); } - public virtual int usp_UpdateLicenseModuleStatus(Nullable licenseId, string moduleStatusText, ObjectParameter status) + public virtual int usp_UpdateLicenseModuleStatus(Nullable licenseId, string moduleStatusText, Nullable isAodOn, string courseListText, ObjectParameter status) { var licenseIdParameter = licenseId.HasValue ? new ObjectParameter("LicenseId", licenseId) : @@ -3563,7 +3563,15 @@ namespace AIAHTML5.ADMIN.API.Entity new ObjectParameter("ModuleStatusText", moduleStatusText) : new ObjectParameter("ModuleStatusText", typeof(string)); - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateLicenseModuleStatus", licenseIdParameter, moduleStatusTextParameter, status); + var isAodOnParameter = isAodOn.HasValue ? + new ObjectParameter("isAodOn", isAodOn) : + new ObjectParameter("isAodOn", typeof(bool)); + + var courseListTextParameter = courseListText != null ? + new ObjectParameter("CourseListText", courseListText) : + new ObjectParameter("CourseListText", typeof(string)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_UpdateLicenseModuleStatus", licenseIdParameter, moduleStatusTextParameter, isAodOnParameter, courseListTextParameter, status); } public virtual int usp_UpdateLicenseUserGroupUsers(Nullable userGroupId, string userIds, ObjectParameter status) @@ -5003,7 +5011,7 @@ namespace AIAHTML5.ADMIN.API.Entity return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("usp_InsertAIAUser", sLoginIdParameter, sPasswordParameter, sFirstnameParameter, sLastnameParameter, iUserTypeIdParameter, sEmailIdParameter, iSecurityQuesIdParameter, sSecurityAnswerParameter, iCreatorIdParameter, iLicenseIdParameter, iEditionIdParameter, status); } - public virtual ObjectResult> usp_ManageUserLoginStatus(Nullable userId, string tag, Nullable sessionId, Nullable isSiteUser) + public virtual ObjectResult> usp_ManageUserLoginStatus(Nullable userId, string tag, Nullable sessionId, Nullable isSiteUser, Nullable isAdmin) { var userIdParameter = userId.HasValue ? new ObjectParameter("userId", userId) : @@ -5021,7 +5029,20 @@ namespace AIAHTML5.ADMIN.API.Entity new ObjectParameter("isSiteUser", isSiteUser) : new ObjectParameter("isSiteUser", typeof(bool)); - return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, sessionIdParameter, isSiteUserParameter); + var isAdminParameter = isAdmin.HasValue ? + new ObjectParameter("isAdmin", isAdmin) : + new ObjectParameter("isAdmin", typeof(bool)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction>("usp_ManageUserLoginStatus", userIdParameter, tagParameter, sessionIdParameter, isSiteUserParameter, isAdminParameter); + } + + public virtual ObjectResult GetCoursesToLicense(Nullable licenseId) + { + var licenseIdParameter = licenseId.HasValue ? + new ObjectParameter("licenseId", licenseId) : + new ObjectParameter("licenseId", typeof(int)); + + return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("GetCoursesToLicense", licenseIdParameter); } } } diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx index 3e05020..a1f36b4 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/AIADBEntity.edmx @@ -339,6 +339,9 @@ + + + @@ -1413,6 +1416,7 @@ + @@ -1503,6 +1507,8 @@ + + @@ -1912,7 +1918,7 @@ - + @@ -2582,6 +2588,8 @@ + + @@ -3013,6 +3021,10 @@ + + + + @@ -4343,6 +4355,11 @@ + + + + + @@ -6328,6 +6345,15 @@ + + + + + + + + + diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetCoursesToLicense_Result.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetCoursesToLicense_Result.cs new file mode 100644 index 0000000..efd5fc3 --- /dev/null +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Entity/GetCoursesToLicense_Result.cs @@ -0,0 +1,20 @@ +//------------------------------------------------------------------------------ +// +// This code was generated from a template. +// +// Manual changes to this file may cause unexpected behavior in your application. +// Manual changes to this file will be overwritten if the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace AIAHTML5.ADMIN.API.Entity +{ + using System; + + public partial class GetCoursesToLicense_Result + { + public string CourseId { get; set; } + public string CourseName { get; set; } + public bool Status { get; set; } + } +} diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs index f3662ac..ec8b34a 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/LicenseModel.cs @@ -433,12 +433,12 @@ namespace AIAHTML5.ADMIN.API.Models return LicenseModulesStatusList; } - public static bool UpdateLicenseModulesStatus(AIADatabaseV5Entities dbContext, Tuple LicenseModuleStatus) + public static bool UpdateLicenseModulesStatus(AIADatabaseV5Entities dbContext, Tuple LicenseModuleStatus) { var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); try { - dbContext.usp_UpdateLicenseModuleStatus(LicenseModuleStatus.Item1, LicenseModuleStatus.Item2, spStatus); + dbContext.usp_UpdateLicenseModuleStatus(LicenseModuleStatus.Item1, LicenseModuleStatus.Item2, LicenseModuleStatus.Item3, LicenseModuleStatus.Item4, spStatus); return (bool)spStatus.Value; } catch (Exception ex) @@ -447,6 +447,17 @@ namespace AIAHTML5.ADMIN.API.Models } } + public static List GetLicenseAodCourse(AIADatabaseV5Entities dbContext, int LicenseId) + { + List result = new List(); + try + { + result = dbContext.GetCoursesToLicense(LicenseId).ToList(); + } + catch (Exception ex) { } + return result; + } + public static bool CheckAccountNumber(AIADatabaseV5Entities dbContext, string AccountNo) { var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); diff --git a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs index 8c65375..2c3615b 100644 --- a/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs +++ b/400-SOURCECODE/AIAHTML5.ADMIN.API/Models/UserModel.cs @@ -65,12 +65,12 @@ namespace AIAHTML5.ADMIN.API.Models return false; } } - public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, long SessionId, bool isSiteUser) + public static bool ManageUserLoginStatus(AIADatabaseV5Entities dbContext, int userId, string tagName, long SessionId, bool isSiteUser,bool isAdmin) { bool loginStatus = false; try { - loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, SessionId, isSiteUser).FirstOrDefault()); + loginStatus = Convert.ToBoolean(dbContext.usp_ManageUserLoginStatus(userId, tagName, SessionId, isSiteUser, isAdmin).FirstOrDefault()); return loginStatus; } diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs index 89a0d67..1e9fee5 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/AIAConstants.cs @@ -46,6 +46,7 @@ namespace AIAHTML5.API.Constants public const string LAB_EXERCISE_SAVE_SUCCESS = "Your lab exercise attempt is saved."; public const string LAB_EXERCISE_SAVE_FAILURE = "We are unable to save your lab exercise attempt, please try again."; public const string SAVED_LAB_EXERCISE_NOT_FOUND = "Saved Lab Exercise not found."; + public const string NO_COURSE_FOUND = "NO COURSE FOUND"; public const string VALIDATED_CLIENT = "Valid Client."; public const string INVALID_CLIENT = "InValid Client."; public const string MSG_NOT_AUTHORIZE_SITE_USER = "User is not authorized."; diff --git a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs index 4a8b00e..bfaf6d8 100644 --- a/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs +++ b/400-SOURCECODE/AIAHTML5.API/Constants/DBConstants.cs @@ -44,5 +44,6 @@ namespace AIAHTML5.API.Constants public const string GET_USER_LOGIN_STATUS = "usp_ManageUserLoginStatus"; public const string GET_AOD_AUTHENTICATION_STATUS = "usp_AodAuthenticationStatus"; public const string INSERT_SITE_LOGIN_LOG = "usp_InsertSiteLoginLog"; + public const string GET_AOD_COURSE_ITEMS = "GetSelectedCoursesToLicense"; } } \ No newline at end of file diff --git a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs index 084d929..33ac18a 100644 --- a/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs +++ b/400-SOURCECODE/AIAHTML5.API/Controllers/AuthenticateController.cs @@ -535,8 +535,9 @@ namespace AIAHTML5.API.Controllers string tagName = jsonData["tagName"].Value(); long SessionId = jsonData["SessionId"].Value(); bool isSiteUser = jsonData["isSiteUser"].Value(); + bool isAdmin = jsonData["isAdmin"].Value(); - loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, SessionId, isSiteUser); + loginStatus = AIAHTML5.API.Models.Users.GetUserLoginStatus(userId, tagName, SessionId, isSiteUser, isAdmin); return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(loginStatus) }; } @@ -591,6 +592,28 @@ namespace AIAHTML5.API.Controllers } } + [HttpGet] + [Route("api/GetAodCoursesList")] + public HttpResponseMessage GetAodCoursesList([FromUri] int LicenseId) + { + try + { + DBModel db = new DBModel(); + List courselist = db.GetSelectedCourseList(LicenseId); + + if (courselist.Count>0) + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(JsonConvert.SerializeObject(courselist)) }; + else + return new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = new StringContent(AIAConstants.NO_COURSE_FOUND) }; + + } + catch (Exception e) + { + return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(AIAConstants.ERROR_IN_FECTHING_DETAILS) }; + + } + + } // PUT api/authenticate/5 public void Put(int id, [FromBody]string value) { diff --git a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs index 9e64f2c..c93417d 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs @@ -350,7 +350,7 @@ namespace AIAHTML5.API.Models return objUser; } - internal static string GetUserLoginStatus(int userId,string tagName, long SessionId, bool isSiteUser) + internal static string GetUserLoginStatus(int userId,string tagName, long SessionId, bool isSiteUser,bool isAdmin) { string status=string.Empty; DBModel objModel = new DBModel(); @@ -367,6 +367,7 @@ namespace AIAHTML5.API.Models cmd.Parameters.AddWithValue("@tag", tagName); cmd.Parameters.AddWithValue("@sessionId", SessionId); cmd.Parameters.AddWithValue("@isSiteUser", isSiteUser); + cmd.Parameters.AddWithValue("@isAdmin", isAdmin); adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); @@ -425,6 +426,47 @@ namespace AIAHTML5.API.Models return status; } + internal List GetSelectedCourseList(int licenseId) + { + AodCourse course = null; + List courselist = new List(); + + SqlConnection conn = new SqlConnection(dbConnectionString); + SqlCommand cmd = new SqlCommand(); + SqlDataAdapter adapter; + + DataSet ds = new DataSet(); + + cmd.Connection = conn; + cmd.CommandText = DBConstants.GET_AOD_COURSE_ITEMS; + cmd.CommandType = CommandType.StoredProcedure; + + cmd.Parameters.AddWithValue("@licenseId", licenseId); + + adapter = new SqlDataAdapter(cmd); + adapter.Fill(ds); + + if (ds != null && ds.Tables.Count > 0) + { + DataTable dt = ds.Tables[0]; + + if (dt.Rows.Count > 0) + { + foreach (DataRow dr in dt.Rows) + { + course = new AodCourse(); + + course.CourseId= dr["CourseId"].ToString(); + course.CourseName = dr["CourseName"].ToString(); + course.BodySystem = dr["BodySystem"].ToString(); + courselist.Add(course); + } + } + } + + return courselist; + } + internal User GetSelectedSettings(int userId,bool isSiteUser) { logger.Debug(" Inside GetSelectedSettings for userId = " + userId); diff --git a/400-SOURCECODE/AIAHTML5.API/Models/User.cs b/400-SOURCECODE/AIAHTML5.API/Models/User.cs index b0ae88f..3848846 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/User.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/User.cs @@ -128,6 +128,13 @@ namespace AIAHTML5.API.Models public int ExptImageLimit { get; set; } } + public class AodCourse + { + public string CourseId { get; set; } + public string CourseName { get; set; } + public string BodySystem { get; set; } + } + public class LicenseUserInsertImageDetail { public int LicenseId { get; set; } diff --git a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs index 3ddd15c..88d467a 100644 --- a/400-SOURCECODE/AIAHTML5.API/Models/Users.cs +++ b/400-SOURCECODE/AIAHTML5.API/Models/Users.cs @@ -340,10 +340,10 @@ namespace AIAHTML5.API.Models return objUser; } - internal static string GetUserLoginStatus(int userId, string tagName, long SessionId, bool isSiteUser) + internal static string GetUserLoginStatus(int userId, string tagName, long SessionId, bool isSiteUser,bool isAdmin) { string status = null; - status = DBModel.GetUserLoginStatus(userId, tagName, SessionId, isSiteUser); + status = DBModel.GetUserLoginStatus(userId, tagName, SessionId, isSiteUser, isAdmin); return status; } diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AODController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AODController.js index 3c4369f..423112f 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/AODController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/AODController.js @@ -1,21 +1,20 @@ 'use strict'; -AIA.controller("AODController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout","DataService", "ModuleService", "$interval", "AIAConstants", -function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout,DataService, ModuleService, $interval, AIAConstants) { +AIA.controller("AODController", ["$scope", "$window", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout","DataService", "ModuleService", "$interval", "AuthenticationService", "AIAConstants", +function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout,DataService, ModuleService, $interval,AuthenticationService, AIAConstants) { $scope.ObjectAttribute=function(windowviewid) { var windata={ 'multiwinid': windowviewid, 'AODAnimationData': [], 'moduleName': '', - 'aodUrl':'', + 'aodUrl':'AodHome/CoursePlayerAIA', 'courseId':'', - 'uid':'2',//categoty id. courseid cheched in category id + 'uid':'2',//categoty id. courseid checked in category id 'requestType':'SCORMPackage', 'currentViewTitle': '', 'parentSlugName': '', - 'currentSlug': '', - 'imageId': '' + 'currentSlug': '', }; return windata; } @@ -109,22 +108,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if (index != -1) { // remove module which one is loaded - var reffid=$rootScope.AODWindowData[index].imageId; $rootScope.AODWindowData.splice(index, 1); - //remove also stream/source video from close panel from cb - if($rootScope.collectAnimationSource !=undefined) - { - for (var vdx = 0 ; vdx < $rootScope.collectAnimationSource.length; vdx++) { - if(reffid==$rootScope.collectAnimationSource[vdx].imageId) - $rootScope.collectAnimationSource.splice(vdx, 1); - } - } if ($('#' + panelid).html() != undefined) { $('#' + panelid).remove(); } - // $rootScope.resetjsPanelTop(panelid); } } } @@ -166,62 +155,45 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout if ($rootScope.refreshcheck == null) { $location.path('/'); } - // code that will be executed ... - // every time this view is loaded - - + $rootScope.currentActiveModuleTitle = "ADAM ON DEMAND"; $scope.SetAODwindowStoreData($rootScope.MULTI_VIEW_ID, 'moduleName', "ADAM ON DEMAND"); $scope.LoadAODJsonData($rootScope.MULTI_VIEW_ID); - - setTimeout(function () { - - //call time interval function until load Illustration data - var timeintval = null; - timeintval = $interval(function () { - var AODAnimationData = $scope.GetAODwindowStoreData($rootScope.MULTI_VIEW_ID, 'AODAnimationData'); - if (AODAnimationData.length>0) { - $scope.stopIntervalAOD(); - $scope.loadAODList($rootScope.MULTI_VIEW_ID); - } - else - { - console.log("waiting for aod Data"); - } - }, 100); - - $scope.stopIntervalAOD = function () { - if (angular.isDefined(timeintval)) { - $interval.cancel(timeintval); - timeintval = undefined; - } - }; - - }, 200); - }; + + }; $scope.LoadAODJsonData = function (windowviewid) { - var promise = DataService.getJson('~/../content/data/json/aod/aod_courselist.json') - promise.then( - function (result) { - - var AODAnimationData = new jinqJs() - .from(result.root.AODData) - .orderBy([{ field: '_BodySystem', sort: 'asc' }]) - .select(); + //LicenseId would be zero for admin and gernal admin + //get this from DB + AuthenticationService.GetAodCoursesList($rootScope.userData.LicenseId) + .then( + function (aodResult) { + if(aodResult.length>0 && aodResult != AIAConstants.NO_COURSE_FOUND) + { - $scope.SetAODwindowStoreData(windowviewid, 'AODAnimationData', AODAnimationData); + var AODAnimationData = new jinqJs() + .from(aodResult) + .orderBy([{ field: 'BodySystem', sort: 'asc' }]) + .select(); - }, - function (error) { - $scope.EnableUI(); - - } - ); + $scope.SetAODwindowStoreData(windowviewid, 'AODAnimationData', AODAnimationData); + + $scope.loadAODList(windowviewid); + } + else + { + $('#errorMessage').text(AIAConstants.NO_COURSE_FOUND_MESSAGE); + $("#messageModal").modal('show'); + $scope.EnableUI(); + } + }, + function (error) { + $scope.EnableUI(); + }) }; @@ -232,13 +204,13 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('#grid-view').empty(); angular.forEach(selectedAODListViewData, function (value, key) { - var imagePath = "~/../content/images/aod/thumbnails/" + value._ThumbnailImage; + var imagePath = "~/../content/images/aod/thumbnails/" + value.CourseId+'.jpg'; - var $el = $('
' + var $el = $('').appendTo('#grid-view'); + + '' + + '

'+'ID: '+ value.CourseId + '

' + value.CourseName + '

').appendTo('#grid-view'); $compile($el)($scope); @@ -300,10 +272,10 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout var selectedTileData = []; selectedTileData = new jinqJs() .from(selectedAODListViewData) - .where('_ImageId = ' + $event.currentTarget.id) + .where('CourseId = ' + $event.currentTarget.id) .select(); - $rootScope.ViewTitle = selectedTileData[0]._Title; + $rootScope.ViewTitle = selectedTileData[0].CourseName; } else { $rootScope.ViewTitle = $event.currentTarget.textContent; @@ -313,35 +285,12 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout localStorage.setItem("currentBodyViewId", $event.currentTarget.id); $scope.SetAODwindowStoreData(windowviewid, 'currentViewTitle', $rootScope.ViewTitle); - $scope.SetAODwindowStoreData(windowviewid, 'imageId', $event.currentTarget.id); - - var promise = DataService.getJson('~/../content/data/json/aod/aod_courselist_video.json') - promise.then( - function (result) { - // $scope.AnimationData = result; - $scope.AODlistViewData = result.root.AODData; - var id = $scope.GetAODwindowStoreData(windowviewid, 'imageId'); - var clickedAODVideoData = []; - clickedAODVideoData = new jinqJs() - .from($scope.AODlistViewData) - .where('_CourseId == ' + id) - .select(); - - $scope.SetAODwindowStoreData(windowviewid, 'aodUrl', clickedAODVideoData[0]._VideoUrl); - $scope.SetAODwindowStoreData(windowviewid, 'courseId', clickedAODVideoData[0]._CourseId); - - var AODGridViewScrollPosition = $($window).scrollTop(); - localStorage.setItem('AODGridViewScroll', AODGridViewScrollPosition); - $location.url('/AOD-view-detail'); - - }, - function (error) { - - } + $scope.SetAODwindowStoreData(windowviewid, 'courseId', $event.currentTarget.id); - ); + var AODGridViewScrollPosition = $($window).scrollTop(); + localStorage.setItem('AODGridViewScroll', AODGridViewScrollPosition); + $location.url('/AOD-view-detail'); - } @@ -435,8 +384,6 @@ function ($scope, $window, $rootScope, $compile, $http, log, $location, $timeout $('#aodvideo_' + windowviewid).attr('src', aodSiteUrl); - //var canvasDIvHeight = $('#aodImagePanel_' + windowviewid+ " .jsPanel-content").height(); - // $('#aodContentDiv_'+ windowviewid ).css("height",canvasDIvHeight); } //Calling methode for save Js Panel Activity for SaveCB diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js index 913b3f7..2bfd5e6 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js @@ -341,11 +341,12 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data var head = $(innerDoc).contents().find("head"); //hide menu link var css = ''; - var storefunc = ''; + // var storefunc = ''; $(head).append(css); - $(head).append(storefunc); + // $(head).append(storefunc); var canvasDIvHeight = $("#dvOpenResourcePanel .jsPanel-content").height(); $('#OpenModuleInCB').css('height', canvasDIvHeight); @@ -377,7 +378,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $scope.loadopenresourceContent(head, iframe); } - }, 500); + }, 100); } @@ -386,7 +387,7 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $timeout(function () { sessionStorage.setItem('isModuleOpenByOpenResource', 'true'); sessionStorage.removeItem('ExitsCBFileDetail'); - OpenDefaultModule(iframe); + // OpenDefaultModule(iframe); }, 500); @@ -723,11 +724,15 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data //incase site user login userid is 0 so then using license id //logout site user while reload url without parameter var userId=loggedInUser.Id==0?loggedInUser.LicenseId:loggedInUser.Id; + + //licenseId would be zero for admin/gernal admin + var isadminType=loggedInUser.LicenseId==0?true:false; $scope.checkuserstatus = { userId: userId, tagName: loggedInUser.Id==0?'logout':'update', SessionId:loggedInUser.SessionId, - isSiteUser:loggedInUser.isSiteUser + isSiteUser:loggedInUser.isSiteUser, + isAdmin:isadminType } // this case found when browser closed by user after login. after long time (after 20 min) open site again @@ -2005,7 +2010,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data userId: null, tagName: null, SessionId:null, - isSiteUser:false + isSiteUser:false, + isAdmin:false } console.log('user session start'); $rootScope.CheckUserSession('insert'); @@ -2084,6 +2090,8 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data $rootScope.userStatus.tagName=tagName; $rootScope.userStatus.SessionId=$rootScope.userData.SessionId; $rootScope.userStatus.isSiteUser=$rootScope.userData.isSiteUser; + //licenseId would be zero for admin/gernal admin + $rootScope.userStatus.isAdmin=$rootScope.userData.LicenseId==0?true:false; AuthenticationService.ManageUserLoginStatus($rootScope.userStatus) .then( @@ -8501,20 +8509,14 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data setting.modesty =Formatsetting.modesty ; setting.skintone = Formatsetting.ethnicity; - // var isallowToChange=false; if($rootScope.userData.isSiteUser) { // send as user id setting.userId = $rootScope.userData.siteId; - //isallowToChange=$rootScope.userData.EditionId<3; } else { setting.userId = $rootScope.userData.Id; - //concurrent license - // only instructor - //if($rootScope.userData.LicenseId!=0) - // isallowToChange=$rootScope.userData.EditionId<3; } @@ -8531,8 +8533,6 @@ function ($rootScope, $scope, Modules, $log, $location, $compile, $timeout, Data setting.isSiteUser=$rootScope.userData.isSiteUser; setting.LicenseEditionId=$rootScope.userData.LicenseEditionId; - // if(isallowToChange ||$rootScope.userData.LicenseId==0) - // { AuthenticationService.saveSetings(setting) .then( function (result) { diff --git a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js index ff91160..0a9c2af 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js @@ -553,7 +553,9 @@ AIA.constant("AIAConstants", { "CB_Confirm_Password_Not_Match": "confirm password not matched.", "CB_Add_Slide_First": "Please add slide first to export this section.", "CB_Curriculum_Name_Empty": "Curriculum name is empty!", - + "NO_COURSE_FOUND": "NO COURSE FOUND", + "NO_COURSE_FOUND_MESSAGE": "No Selected A.D.A.M. courses found for this user account. Please contact ADAM.", + "NO_BODY_SYSTEM_AVAILABLE": "Selected body system is not available on this layer.", "COOKIES_MESSAGE": "You need to enable your browser's cookies to run this application.", "SAVED_LAB_EXERCISE_NOT_FOUND": "Saved Lab Exercise not found.", diff --git a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js index d453639..8841d3c 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js @@ -131,6 +131,28 @@ return deferred.promise; }, + GetAodCoursesList: function (licenseId) { + var deferred = $q.defer(); + + $http({ + url: "/API/api/GetAodCoursesList", + method: "GET", + params: { LicenseId: licenseId } + }) + + .success(function (data, status, headers, config) { + deferred.resolve(data); + }).error(function (data, status, headers, config) { + console.log('error') + deferred.reject(data); + $rootScope.isVisibleLogin = true; + $('#errorMessage').text(data); + $("#messageModal").modal('show'); + + }); + return deferred.promise; + }, + validateClientSite: function (clientInfo) { var deferred = $q.defer(); diff --git a/400-SOURCECODE/Admin/package-lock.json b/400-SOURCECODE/Admin/package-lock.json index fe83fad..97603b1 100644 --- a/400-SOURCECODE/Admin/package-lock.json +++ b/400-SOURCECODE/Admin/package-lock.json @@ -507,6 +507,15 @@ "moment": "^2.19.3" } }, + "angular2-multiselect-checkbox-dropdown": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/angular2-multiselect-checkbox-dropdown/-/angular2-multiselect-checkbox-dropdown-1.4.0.tgz", + "integrity": "sha1-eN+iYuqAPvx9x/ctRmRdcCs59Is=", + "requires": { + "bootstrap": "*", + "font-awesome": "*" + } + }, "angular4-slimscroll": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/angular4-slimscroll/-/angular4-slimscroll-1.0.5.tgz", @@ -3855,6 +3864,11 @@ } } }, + "font-awesome": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.7.0.tgz", + "integrity": "sha1-j6jPBBGhoxr9B7BtKQK7n8gVoTM=" + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", diff --git a/400-SOURCECODE/Admin/package.json b/400-SOURCECODE/Admin/package.json index f534f6a..c15cae3 100644 --- a/400-SOURCECODE/Admin/package.json +++ b/400-SOURCECODE/Admin/package.json @@ -30,6 +30,7 @@ "@types/node": "^6.0.102", "angular2-json2csv": "^1.1.2", "angular2-moment": "^1.9.0", + "angular2-multiselect-checkbox-dropdown": "^1.4.0", "angular4-slimscroll": "^1.0.5", "bootstrap": "^3.1.1", "chosen-js": "^1.8.7", diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/README.md b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/README.md new file mode 100644 index 0000000..437697d --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/README.md @@ -0,0 +1,134 @@ +# Angular2 Multiselect Dropdown +[![npm version](https://img.shields.io/npm/v/angular2-multiselect-dropdown.svg)](https://www.npmjs.com/package/angular2-multiselect-dropdown) + +Angular 2 multiselect dropdown component for web applications. Easy to integrate and use. + + +# [Documentation](http://cuppalabs.github.io/components/multiselectDropdown) | [Demo](https://cuppalabs.github.io/angular2-multiselect-dropdown). + +## Getting Started +### Installation +- The Mutiselect Dropdown package is published on the [npm](https://www.npmjs.com/package/angular2-multiselect-dropdown) Registry. +- Install the package : + `npm install angular2-multiselect-checkbox-dropdown` + +- Once installed import `AngularMultiSelectModule` from the installed package into your module as follows: + +### Usage +Import `AngularMultiSelectModule` into `NgModule` in `app.module.ts` +```js +import { AngularMultiSelectModule } from 'angular2-multiselect-checkbox-dropdown/angular2-multiselect-dropdown'; + +@NgModule({ + // ... + imports: [ + AngularMultiSelectModule, + ] + // ... +}) + +``` + +Declare the component data variables and options in your component where you want to consume the dropdown component. + +```js + +import { Component, OnInit } from '@angular/core'; + +export class AppComponent implements OnInit { + dropdownList = []; + selectedItems = []; + dropdownSettings = {}; + ngOnInit(){ + this.dropdownList = [ + {"id":1,"itemName":"India"}, + {"id":2,"itemName":"Singapore"}, + {"id":3,"itemName":"Australia"}, + {"id":4,"itemName":"Canada"}, + {"id":5,"itemName":"South Korea"}, + {"id":6,"itemName":"Germany"}, + {"id":7,"itemName":"France"}, + {"id":8,"itemName":"Russia"}, + {"id":9,"itemName":"Italy"}, + {"id":10,"itemName":"Sweden"} + ]; + this.selectedItems = [ + {"id":2,"itemName":"Singapore"}, + {"id":3,"itemName":"Australia"}, + {"id":4,"itemName":"Canada"}, + {"id":5,"itemName":"South Korea"} + ]; + this.dropdownSettings = { + singleSelection: false, + text:"Select Countries", + selectAllText:'Select All', + unSelectAllText:'UnSelect All', + enableSearchFilter: true, + classes:"myclass custom-class" + }; + } + onItemSelect(item:any){ + console.log(item); + console.log(this.selectedItems2); + } + OnItemDeSelect(item:any){ + console.log(item); + console.log(this.selectedItems2); + } + onSelectAll(items: any){ + console.log(items); + } + onDeSelectAll(items: any){ + console.log(items); + } +} +``` + +Add the following component tag in you template +```html + + +``` + +### Settings +The following list of settings are supported by the component. Configure the settings to meet your requirement. + +| Setting |Type | Description | Default Value | +|:--- |:--- |:--- |:--- | +| singleSelection | Boolean | To set the dropdown for single item selection only. | false | +| text | String | Text to be show in the dropdown, when no items are selected. | 'Select' | +| enableCheckAll | Boolean | Enable the option to select all items in list | false | +| selectAllText | String | Text to display as the label of select all option | Select All | +| unSelectAllText | String | Text to display as the label of unSelect option | UnSelect All | +| enableSearchFilter | Boolean | Enable filter option for the list. | false | +| maxHeight | Number | Set maximum height of the dropdown list in px. | 300 | +| badgeShowLimit | Number | Limit the number of badges/items to show in the input field. If not set will show all selected. | All | +| classes | String | Custom classes to the dropdown component. Classes are added to the dropdown selector tag. To add multiple classes, the value should be space separated class names.| '' | +| limitSelection | Number | Limit the selection of number of items from the dropdown list. Once the limit is reached, all unselected items gets disabled. | none | + +### Callback Methods +- `onSelect` - Return the selected item on selection. + Example : (onSelect)="onItemSelect($event)" +- `onDeSelect` - Return the un-selected item on un-selecting. + Example : (onDeSelect)="OnItemDeSelect($event)" +- `onSelectAll` - Return the list of all selected items. + Example : (onSelectAll)="onSelectAll($event)" +- `onDeSelectAll` - Returns an empty array. + Example : (onDeSelectAll)="onDeSelectAll($event)" + + +## Run locally +- Clone the repository or downlod the .zip,.tar files. +- Run `npm install` +- Run `ng serve` for a dev server +- Navigate to `http://localhost:4200/` + The app will automatically reload if you change any of the source files. + +## License +MIT License. diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/angular2-multiselect-dropdown.ts b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/angular2-multiselect-dropdown.ts new file mode 100644 index 0000000..5331a00 --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/angular2-multiselect-dropdown.ts @@ -0,0 +1 @@ +export * from './src/app/angular2-multiselect-dropdown/multiselect.component'; \ No newline at end of file diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/package.json b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/package.json new file mode 100644 index 0000000..f17bf6f --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/package.json @@ -0,0 +1,80 @@ +{ + "_args": [ + [ + { + "raw": "angular2-multiselect-checkbox-dropdown", + "scope": null, + "escapedName": "angular2-multiselect-checkbox-dropdown", + "name": "angular2-multiselect-checkbox-dropdown", + "rawSpec": "", + "spec": "latest", + "type": "tag" + }, + "D:\\tamil\\angular-projects\\Angular2-AdminLTE-master" + ] + ], + "_from": "angular2-multiselect-checkbox-dropdown@1.4.0", + "_id": "angular2-multiselect-checkbox-dropdown@1.4.0", + "_inBundle": false, + "_inCache": true, + "_integrity": "sha1-eN+iYuqAPvx9x/ctRmRdcCs59Is=", + "_location": "/angular2-multiselect-checkbox-dropdown", + "_nodeVersion": "6.10.3", + "_npmUser": { + "name": "tamilzh", + "email": "tamilzhchelvan@gmail.com" + }, + "_npmVersion": "3.10.10", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "angular2-multiselect-checkbox-dropdown@1.4.0", + "name": "angular2-multiselect-checkbox-dropdown", + "escapedName": "angular2-multiselect-checkbox-dropdown", + "rawSpec": "1.4.0", + "saveSpec": null, + "fetchSpec": "1.4.0" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/angular2-multiselect-checkbox-dropdown/-/angular2-multiselect-checkbox-dropdown-1.4.0.tgz", + "_shasum": "78dfa262ea803efc7dc7f72d46645d702b39f48b", + "_shrinkwrap": null, + "_spec": "angular2-multiselect-checkbox-dropdown@1.4.0", + "_where": "F:\\AIAProject\\400-SOURCECODE\\Admin", + "angular-cli": {}, + "bundleDependencies": false, + "dependencies": { + "bootstrap": "*", + "font-awesome": "*" + }, + "deprecated": false, + "description": "[![npm version](https://img.shields.io/npm/v/angular2-multiselect-dropdown.svg)](https://www.npmjs.com/package/angular2-multiselect-dropdown)", + "devDependencies": {}, + "directories": {}, + "dist": { + "shasum": "346520b7512dc677da738bfcc7249045c2e0efde", + "tarball": "https://registry.npmjs.org/angular2-multiselect-checkbox-dropdown/-/angular2-multiselect-checkbox-dropdown-1.0.0.tgz" + }, + "license": "MIT", + "maintainers": [ + { + "name": "tamilzh", + "email": "tamilzhchelvan@gmail.com" + } + ], + "name": "angular2-multiselect-checkbox-dropdown", + "optionalDependencies": {}, + "private": false, + "scripts": { + "e2e": "ng e2e", + "lint": "ng lint", + "ng": "ng", + "start": "ng serve", + "test": "ng test" + }, + "version": "1.4.0" +} diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/clickOutside.ts b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/clickOutside.ts new file mode 100644 index 0000000..96384cc --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/clickOutside.ts @@ -0,0 +1,24 @@ +import {Directive, ElementRef, Output, EventEmitter, HostListener} from '@angular/core'; + +@Directive({ + selector: '[clickOutside]' +}) +export class ClickOutsideDirective { + constructor(private _elementRef: ElementRef) { + } + + @Output() + public clickOutside = new EventEmitter(); + + @HostListener('document:click', ['$event', '$event.target']) + public onClick(event: MouseEvent, targetElement: HTMLElement): void { + if (!targetElement) { + return; + } + + const clickedInside = this._elementRef.nativeElement.contains(targetElement); + if (!clickedInside) { + this.clickOutside.emit(event); + } + } +} \ No newline at end of file diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/list-filter.ts b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/list-filter.ts new file mode 100644 index 0000000..f074c8a --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/list-filter.ts @@ -0,0 +1,31 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +import { ListItem } from './multiselect.model'; + +@Pipe({ + name: 'listFilter', + pure: false +}) +export class ListFilterPipe implements PipeTransform { + transform(items: ListItem[], filter: ListItem): ListItem[] { + if (!items || !filter) { + return items; + } + // filter items array, items which match and return true will be kept, false will be filtered out + return items.filter((item: ListItem) => this.applyFilter(item, filter)); + } + + /** + * Perform the filtering. + * + * @param {Book} book The book to compare to the filter. + * @param {Book} filter The filter to apply. + * @return {boolean} True if book satisfies filters, false if not. + */ + applyFilter(item: ListItem, filter: ListItem): boolean { + if (filter.itemName && item.itemName.toLowerCase().indexOf(filter.itemName.toLowerCase()) === -1) { + return false; + } + return true; + } +} \ No newline at end of file diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component.html b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component.html new file mode 100644 index 0000000..0649c4a --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component.html @@ -0,0 +1,43 @@ +
+
+ +
+ +
\ No newline at end of file diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component.scss b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component.scss new file mode 100644 index 0000000..5a25d8b --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component.scss @@ -0,0 +1,239 @@ + +$base-color: #0079FE; + +.cuppa-dropdown{ + position: relative; +} +.c-btn{ + display: inline-block; + background: #fff; + border: 1px solid #ccc; + border-radius: 3px; + font-size: 14px; + color: #333; +} +.c-btn:focus{ + outline: none; + } +.selected-list{ + .c-list{ + float: left; + padding: 0px; + margin: 0px; + .c-token{ + list-style: none; + padding: 0px 5px; + background: $base-color; + color: #fff; + border-radius: 2px; + margin-right: 4px; + float: left; + .c-label{ + display: block; + float: left; + /*width: 50px; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden;*/ + } + .fa-remove{ + margin-left: 1px; + font-size: 12px; + } + } + } + .fa-angle-down, .fa-angle-up{ + font-size: 15pt; + position: absolute; + right: 10px; + top: 25%; + } + button{ + width: 100%; + box-shadow: 0px 1px 5px #959595; + padding: 10px; + } +} +.dropdown-list{ + position: absolute; + padding-top: 14px; + width: 100%; + z-index: 9999; + ul{ + padding: 0px; + list-style: none; + overflow: auto; + margin: 0px; + li{ + padding: 10px 10px; + cursor: pointer; + text-align: left; + } + li:first-child{ + padding-top: 10px; + } + li:last-child{ + padding-bottom: 10px; + } + li:hover{ + background: #f5f5f5; + } + } + ul::-webkit-scrollbar{ + width: 8px; + } + ul::-webkit-scrollbar-thumb{ + background: #cccccc; + border-radius: 5px; + } + ul::-webkit-scrollbar-track{ + background: #f2f2f2; + } +} +.arrow-up { + width: 0; + height: 0; + border-left: 13px solid transparent; + border-right: 13px solid transparent; + border-bottom: 15px solid #fff; + margin-left: 15px; + position: absolute; + top: 0; +} +.list-area{ + border: 1px solid #ccc; + border-radius: 3px; + background: #fff; + margin: 0px; + box-shadow: 0px 1px 5px #959595; +} +.select-all{ + padding: 10px; + border-bottom: 1px solid #ccc; + text-align: left; +} +.list-filter{ + border-bottom: 1px solid #ccc; + position: relative; + input{ + border: 0px; + width: 100%; + height: 35px; + padding: 0px 0px 0px 35px; + } + input:focus{ + outline: none; + } + .fa{ + position: absolute; + top: 10px; + left: 13px; + color: #888; + } +} +.pure-checkbox input[type="checkbox"] { + border: 0; + clip: rect(0 0 0 0); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; +} +.pure-checkbox input[type="checkbox"]:focus + label:before, +.pure-checkbox input[type="checkbox"]:hover + label:before + { + border-color: $base-color; + background-color: #f2f2f2; +} +.pure-checkbox input[type="checkbox"]:active + label:before { + transition-duration: 0s; +} +.pure-checkbox input[type="checkbox"] + label{ + position: relative; + padding-left: 2em; + vertical-align: middle; + user-select: none; + cursor: pointer; + margin: 0px; + color: #000; +} +.pure-checkbox input[type="checkbox"] + label:before{ + box-sizing: content-box; + content: ''; + color: $base-color; + position: absolute; + top: 50%; + left: 0; + width: 14px; + height: 14px; + margin-top: -9px; + border: 2px solid $base-color; + text-align: center; + transition: all 0.4s ease; +} +.pure-checkbox input[type="checkbox"] + label:after{ + box-sizing: content-box; + content: ''; + background-color: $base-color; + position: absolute; + top: 50%; + left: 4px; + width: 10px; + height: 10px; + margin-top: -5px; + transform: scale(0); + transform-origin: 50%; + transition: transform 200ms ease-out; +} +.pure-checkbox input[type="checkbox"]:disabled + label:before{ + border-color: #cccccc; +} +.pure-checkbox input[type="checkbox"]:disabled:focus + label:before +.pure-checkbox input[type="checkbox"]:disabled:hover + label:before{ + background-color: inherit; +} +.pure-checkbox input[type="checkbox"]:disabled:checked + label:before{ + background-color: #cccccc; +} +.pure-checkbox input[type="checkbox"] + label:after{ + background-color: transparent; + top: 50%; + left: 4px; + width: 8px; + height: 3px; + margin-top: -4px; + border-style: solid; + border-color: #ffffff; + border-width: 0 0 3px 3px; + border-image: none; + transform: rotate(-45deg) scale(0); +} +.pure-checkbox input[type="checkbox"]:checked + label:after{ + content: ''; + transform: rotate(-45deg) scale(1); + transition: transform 200ms ease-out; +} +.pure-checkbox input[type="radio"]:checked + label:before{ + animation: borderscale 300ms ease-in; + background-color: white; +} +.pure-checkbox input[type="radio"]:checked + label:after{ + transform: scale(1); +} +.pure-checkbox input[type="radio"] + label:before{ + border-radius: 50%; +} +.pure-checkbox input[type="checkbox"]:checked + label:before{ + animation: borderscale 200ms ease-in; + background: $base-color; +} +.pure-checkbox input[type="checkbox"]:checked + label:after{ + transform: rotate(-45deg) scale(1); +} +@keyframes borderscale { + 50% { + box-shadow: 0 0 0 2px $base-color; + } +} \ No newline at end of file diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component.ts b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component.ts new file mode 100644 index 0000000..4075444 --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.component.ts @@ -0,0 +1,217 @@ +import { Component, OnInit, NgModule, OnChanges, ViewEncapsulation,forwardRef, Input, Output, EventEmitter, ElementRef, AfterViewInit, Pipe, PipeTransform } from '@angular/core'; +import { FormsModule, NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'; +import { CommonModule } from '@angular/common'; +import { ListItem , MyException} from './multiselect.model'; +import { DropdownSettings } from './multiselect.interface'; +import { ClickOutsideDirective } from './clickOutside'; +import { ListFilterPipe } from './list-filter'; + +export const DROPDOWN_CONTROL_VALUE_ACCESSOR: any = { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => AngularMultiSelect), + multi: true +}; +const noop = () => { +}; + +@Component({ + selector:'angular2-multiselect', + templateUrl: './multiselect.component.html', + host: { '[class]' : 'defaultSettings.classes' }, + styleUrls:['./multiselect.component.scss'], + providers: [DROPDOWN_CONTROL_VALUE_ACCESSOR] +}) + +export class AngularMultiSelect implements OnInit, ControlValueAccessor { + + @Input() + data: Array; + + @Input() + settings:DropdownSettings; + + @Output('onSelect') + onSelect: EventEmitter = new EventEmitter(); + + @Output('onDeSelect') + onDeSelect: EventEmitter = new EventEmitter(); + + @Output('onSelectAll') + onSelectAll: EventEmitter> = new EventEmitter>(); + + @Output('onDeSelectAll') + onDeSelectAll: EventEmitter> = new EventEmitter>(); + + @Input() + selectedItems: Array; + + public isActive: boolean = false; + public isSelectAll: boolean = false; + filter: ListItem = new ListItem(); + defaultSettings:DropdownSettings = { + singleSelection: false, + text:'Select', + enableCheckAll: true, + selectAllText: 'Select All', + unSelectAllText: 'UnSelect All', + enableSearchFilter: false, + maxHeight: 300, + badgeShowLimit: 999999999999, + classes:'' + } + constructor(){ + + } + ngOnInit(){ + this.settings = Object.assign(this.defaultSettings, this.settings); + /* this.selectedItems = []; + for(var t=0;t this.selectedItems.length){ + this.isSelectAll = false; + } + if(this.data.length == this.selectedItems.length){ + this.isSelectAll = true; + } + } + private onTouchedCallback: () => void = noop; + private onChangeCallback: (_: any) => void = noop; + + writeValue(value: any) { + if (value !== undefined && value !== null) { + if(this.settings.singleSelection){ + try{ + + if(value.length > 1){ + this.selectedItems = [value[0]]; + throw new MyException(404, { "msg": "Single Selection Mode, Selected Items cannot have more than one item." }); + } + else + this.selectedItems = value; + } + catch(e){ + console.error(e.body.msg); + } + + } + else{ + if(this.settings.limitSelection){ + this.selectedItems = value.splice(0,this.settings.limitSelection); + } + else{ + this.selectedItems = value; + } + } + } else { + this.selectedItems = []; + } + } + + //From ControlValueAccessor interface + registerOnChange(fn: any) { + this.onChangeCallback = fn; + } + + //From ControlValueAccessor interface + registerOnTouched(fn: any) { + this.onTouchedCallback = fn; + } + trackByFn(index,item){ + return item.id; + } + isSelected(clickedItem:ListItem){ + let found = false; + this.selectedItems.forEach(item => { + if(clickedItem.id === item.id){ + found = true; + } + }); + return found; + } + addSelected(item: ListItem){ + if(this.settings.singleSelection){ + this.selectedItems = []; + this.selectedItems.push(item); + } + else + this.selectedItems.push(item); + this.onChangeCallback(this.selectedItems); + } + removeSelected(clickedItem: ListItem){ + this.selectedItems.forEach(item => { + if(clickedItem.id === item.id){ + this.selectedItems.splice(this.selectedItems.indexOf(item),1); + } + }); + this.onChangeCallback(this.selectedItems); + } + toggleDropdown(){ + this.isActive = !this.isActive; + //date 8th july2021 :birendra + if(this.data.length == this.selectedItems.length){ + this.isSelectAll = true; + } + if(this.isActive) + { + $('#courseDiv').css("height","340px"); + } + else + { + $('#courseDiv').css("height","40px"); + } + + } + closeDropdown(){ + this.isActive = false; + $('#courseDiv').css("height","40px"); + } + toggleSelectAll(){ + if(!this.isSelectAll){ + this.selectedItems = []; + this.selectedItems = this.data.slice(); + this.isSelectAll = true; + this.onChangeCallback(this.selectedItems); + this.onSelectAll.emit(this.selectedItems); + } + else{ + this.selectedItems = []; + this.isSelectAll = false; + this.onChangeCallback(this.selectedItems); + this.onDeSelectAll.emit(this.selectedItems); + } + } +} + +@NgModule({ + imports: [ CommonModule,FormsModule ], + declarations: [AngularMultiSelect, ClickOutsideDirective, ListFilterPipe], + exports: [AngularMultiSelect, ClickOutsideDirective, ListFilterPipe] +}) +export class AngularMultiSelectModule { } diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.interface.ts b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.interface.ts new file mode 100644 index 0000000..fda4856 --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.interface.ts @@ -0,0 +1,12 @@ +export interface DropdownSettings{ + singleSelection: Boolean; + text: String; + enableCheckAll : Boolean; + selectAllText: String; + unSelectAllText: String; + enableSearchFilter: Boolean; + maxHeight: Number; + badgeShowLimit: Number; + classes: String; + limitSelection?: Number; +} \ No newline at end of file diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.model.ts b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.model.ts new file mode 100644 index 0000000..27a4ce1 --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/src/app/angular2-multiselect-dropdown/multiselect.model.ts @@ -0,0 +1,13 @@ +export class ListItem{ + id: Number; + itemName: String +} +export class MyException { + status : number; + body : any; + constructor(status : number, body : any) { + this.status = status; + this.body = body; + } + +} \ No newline at end of file diff --git a/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/tsconfig.json b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/tsconfig.json new file mode 100644 index 0000000..a35a8ee --- /dev/null +++ b/400-SOURCECODE/Admin/src/app/angular2-multiselect-checkbox-dropdown/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "outDir": "./dist/out-tsc", + "baseUrl": "src", + "sourceMap": true, + "declaration": false, + "moduleResolution": "node", + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2016", + "dom" + ] + } +} diff --git a/400-SOURCECODE/Admin/src/app/app.component.html b/400-SOURCECODE/Admin/src/app/app.component.html index bef8abe..4f1c24a 100644 --- a/400-SOURCECODE/Admin/src/app/app.component.html +++ b/400-SOURCECODE/Admin/src/app/app.component.html @@ -57,7 +57,7 @@
- +
diff --git a/400-SOURCECODE/Admin/src/app/app.component.ts b/400-SOURCECODE/Admin/src/app/app.component.ts index 9e61f38..a7fca5e 100644 --- a/400-SOURCECODE/Admin/src/app/app.component.ts +++ b/400-SOURCECODE/Admin/src/app/app.component.ts @@ -142,7 +142,8 @@ export class AppComponent implements OnInit { userId: this.global.UserId, tagName: tagname, SessionId:this.global.SessionId, - isSiteUser:this.global.isSiteUser + isSiteUser:this.global.isSiteUser, + isAdmin:this.global.isAdmin }).subscribe(status => { //console.log(status); if(status=='False') @@ -178,4 +179,13 @@ export class AppComponent implements OnInit { //this.router.navigate([this.global.LiveURL]); } + changeOfRoutes() + { + //used to hide nevigation on ipad device while nevigate to page + + $('#navbar').removeClass('navbar-collapse collapse in'); + $('#navbar').addClass('navbar-collapse collapse'); + + } + } diff --git a/400-SOURCECODE/Admin/src/app/app.module.ts b/400-SOURCECODE/Admin/src/app/app.module.ts index b223e9a..cedbc89 100644 --- a/400-SOURCECODE/Admin/src/app/app.module.ts +++ b/400-SOURCECODE/Admin/src/app/app.module.ts @@ -16,6 +16,8 @@ import { BsDatepickerModule, ModalModule } from 'ngx-bootstrap'; import { BsModalService } from 'ngx-bootstrap/modal'; import { BsDropdownModule } from 'ngx-bootstrap'; import { Ng2OrderModule } from 'ng2-order-pipe'; //importing the module +import { AngularMultiSelectModule } from './angular2-multiselect-checkbox-dropdown/angular2-multiselect-dropdown'; + //import { ModalModule } from 'ngx-bootstrap/modal'; import { UpdateUserProfile } from './components/userentity/updateuserprofile.component'; @@ -86,7 +88,7 @@ import { MyFilterPipe } from './shared/my-filter.pipe'; MyFilterPipe ], imports: [ - BrowserModule, AppRoutingModule, HttpClientModule, FormsModule, ReactiveFormsModule, HttpModule, Ng2Bs3ModalModule, + BrowserModule, AppRoutingModule, HttpClientModule, FormsModule, ReactiveFormsModule, HttpModule, Ng2Bs3ModalModule,AngularMultiSelectModule, BsDatepickerModule.forRoot(), ModalModule.forRoot(), BsDropdownModule.forRoot(), Ng2OrderModule,MomentModule,NgIdleKeepaliveModule.forRoot() //ModalModule.forRoot() // , AngularFireModule.initializeApp(firebaseConfig), diff --git a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/license.service.ts b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/license.service.ts index a8d9af9..c048d99 100644 --- a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/license.service.ts +++ b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/license.service.ts @@ -120,6 +120,11 @@ export class LicenseService{ .map(this.extractData) .catch((res: Response) => this.handleError(res)); } + GetLicenseAodCourse(licenseId: number) { + return this.http.get(this.commonService.resourceBaseUrl + "License/GetLicenseAodCourse?LicenseId=" + licenseId) + .map(this.extractData) + .catch((res: Response) => this.handleError(res)); + } InsertLicense(obj: any) { //let options = new RequestOptions({ headers: this.headers }); @@ -266,19 +271,35 @@ export class LicenseService{ .catch((res: Response) => this.handleError(res)); } - UpdateLicenseModulesStatus(jsonObj: any) { + UpdateLicenseModulesStatus(jsonObj: any,isAodOn:boolean,CourseList:any) { //let options = new RequestOptions({ headers: this.headers }); var moduleStatusText = ''; + var CourseListText = ''; jsonObj.lstModuleStatus.forEach(element => { moduleStatusText += element.m_Item1 + '-' + element.m_Item2 + '|'; }); if(moduleStatusText != '') { moduleStatusText = moduleStatusText.substr(0, moduleStatusText.length - 1); } + + if(isAodOn) + { + CourseList.forEach(element => { + CourseListText += element.CourseId + ',' + element.Status + '|'; + }); + if(CourseListText != '') { + CourseListText = CourseListText.substr(0, CourseListText.length - 1); + } + + } + var jsonData = { 'licenseId': jsonObj.licenseId, - 'moduleStatusText': moduleStatusText + 'moduleStatusText': moduleStatusText, + 'isAodOn':isAodOn, + 'CourseListText':CourseListText }; + var headers = new Headers({ 'Content-Type': 'application/json' }); diff --git a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/licensemodulesettings.component.html b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/licensemodulesettings.component.html index 5b19017..fc53484 100644 --- a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/licensemodulesettings.component.html +++ b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/licensemodulesettings.component.html @@ -43,41 +43,52 @@ -
+
-
+
-
+
- -
+ +
-
+
{{item.m_Item3}}
- -
+
+
+ + + +
-
- + +
+
-
- +
+
+
diff --git a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/licensemodulesettings.component.ts b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/licensemodulesettings.component.ts index 7306a28..8aa3383 100644 --- a/400-SOURCECODE/Admin/src/app/components/LicenseEntity/licensemodulesettings.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/LicenseEntity/licensemodulesettings.component.ts @@ -25,6 +25,11 @@ export class LicenseModuleSettings implements OnInit { modalRef: BsModalRef; LicenseId:number=0; AccountNumber:string=''; + aodModuleStatus: boolean; + aodAllCourseList=[]; + dropdownList = []; + selectedItems = []; + dropdownSettings = {}; constructor(private _loadingService: LoadingService, private licenseService: LicenseService, public globalService: GlobalService, @@ -32,8 +37,10 @@ export class LicenseModuleSettings implements OnInit { private modalService: BsModalService, private _confirmService: ConfirmService) { } ngOnInit(): void { + this.aodModuleStatus=false; + this._loadingService.ShowLoading("global-loading"); - $('#accountSelect').chosen({allow_single_deselect:true,width:'200px',placeholder_text_single:'Select Account',search_contains:true }); + $('#accountSelect').chosen({allow_single_deselect:true,width:'250px',placeholder_text_single:'Select Account',search_contains:true }); this.license = new License(); this.alerts = ''; @@ -41,6 +48,7 @@ export class LicenseModuleSettings implements OnInit { licenseId: [0], accountNumber: [''], lstModuleStatus: [this.fb.array([])], + courselist: [] }); if (this.globalService.UserType > 2) { @@ -65,9 +73,9 @@ export class LicenseModuleSettings implements OnInit { var selectedText= $(".chosen-single span" ).text(); this.AccountNumberChanged(selectedValue,selectedText); }); - + } - + openModal(template: TemplateRef) { this.modalRef = this.modalService.show(template); } @@ -91,8 +99,20 @@ export class LicenseModuleSettings implements OnInit { this.licenseService.GetLicenseModulesStatus(this.LicenseId) .subscribe(st => { this.lstModuleStatus = st; + var aod= st.filter(item => item.m_Item1 ==17); //aod module + if(aod[0].m_Item2) + { + this.aodModuleStatus=true; + } + this.updateModuleSettingsFrm.setControl('lstModuleStatus', this.fb.array(this.lstModuleStatus)); this._loadingService.HideLoading("global-loading"); + + if(this.aodModuleStatus) + { + this.LoadAODCourseList(); + } + }, error => this.error = error); } @@ -101,6 +121,8 @@ export class LicenseModuleSettings implements OnInit { this.lstModuleStatus = null; this.LicenseId=LicenseId; this.AccountNumber=AccountNumber; + this.aodModuleStatus=false; + this.aodAllCourseList=[]; this.updateModuleSettingsFrm.controls['licenseId'].setValue(LicenseId); this.updateModuleSettingsFrm.controls['accountNumber'].setValue(AccountNumber); @@ -108,6 +130,96 @@ export class LicenseModuleSettings implements OnInit { } + LoadAODCourseList() + { + this._loadingService.ShowLoading("global-loading"); + this.aodAllCourseList=[]; + this.dropdownList = []; + this.selectedItems = []; + this.dropdownSettings = { + singleSelection: false, + text:"AOD Courses List", + selectAllText:'Select All', + unSelectAllText:'UnSelect All', + enableSearchFilter: true, + maxHeight:200, + classes:"myclass custom-class" + }; + + this.licenseService.GetLicenseAodCourse(this.LicenseId) + .subscribe(courselist => { + this.aodAllCourseList = courselist; + var selectedCourse= courselist.filter(item => item.Status ==true); //aod module + + for(var i=0;i this.error = error); + + } + updateAodCourseItemList(ischached:any,id:any) + { + let itemIndex = this.aodAllCourseList.findIndex(item => item.CourseId ==id); + this.aodAllCourseList[itemIndex].Status = ischached; + } + onItemSelect(item:any){ + // console.log(item); + // console.log(this.selectedItems); + this.updateAodCourseItemList(true,item.id); + } + OnItemDeSelect(item:any){ + // console.log(item); + this.updateAodCourseItemList(false,item.id); + } + onSelectAll(items: any){ + //console.log(items); + //console.log(this.selectedItems); + for(var ind=0;ind) { this.alerts = ''; if (this.alerts == '') { this._loadingService.ShowLoading("global-loading"); var obj = this.updateModuleSettingsFrm.value; - return this.licenseService.UpdateLicenseModulesStatus(obj) + return this.licenseService.UpdateLicenseModulesStatus(obj,this.aodModuleStatus,this.aodAllCourseList) .subscribe( - n => (this.AfterUpdateData(n, template)), - error => this.error = error); + n =>{ + this.AfterUpdateData(n, template) + }, + error =>{ + this.ErrorUpdateData(error, template) + }); } } diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts index 8147c30..8753b3f 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/user.service.ts @@ -56,7 +56,7 @@ export class UserService { //////////Manage UserLogin Status/////////// ManageUserLoginStatus(obj: any) { - var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'SessionId': obj.SessionId,'isSiteUser': obj.isSiteUser }; + var jsonData = { 'userId': obj.userId, 'tagName': obj.tagName,'SessionId': obj.SessionId,'isSiteUser': obj.isSiteUser,'isAdmin': obj.isAdmin }; console.log(obj); var headers = new Headers({ 'Content-Type': 'application/json' diff --git a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts index 45d9111..d8a3c89 100644 --- a/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts +++ b/400-SOURCECODE/Admin/src/app/components/UserEntity/users.component.ts @@ -408,7 +408,9 @@ export class UsersList implements OnInit, AfterViewChecked { this.userservice.ManageUserLoginStatus({ userId: this.selectedId, tagName: 'adminlogout', - SessionId:this.global.SessionId + SessionId:this.global.SessionId, + isSiteUser:this.global.isSiteUser, + isAdmin:this.global.isAdmin }).subscribe(x => { console.log(x); this.EditbuttonStatus=undefined; diff --git a/400-SOURCECODE/Admin/src/app/shared/global.ts b/400-SOURCECODE/Admin/src/app/shared/global.ts index 3ab3e04..9d6febc 100644 --- a/400-SOURCECODE/Admin/src/app/shared/global.ts +++ b/400-SOURCECODE/Admin/src/app/shared/global.ts @@ -29,6 +29,7 @@ export class GlobalService { aiaPingInterval:number=0; SessionId:number=0; isSiteUser:boolean=false; + isAdmin:boolean=false; RemoveColumns: Array = ["Serial_No", "LicenseId","RowNum"] error; public href: string = ""; @@ -41,7 +42,7 @@ export class GlobalService { var newsessionid = date.getTime();//timestamp is the number of milliseconds that have passed since January 1, 1970 localStorage.setItem('loggedInUserDetails', JSON.stringify( { - "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016","aiaIdleTime": 300,"aiaIdleTimeOut": 30,"aiaPingInterval": 10,"SessionId":newsessionid,"isSiteUser":false, "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null + "Id": 1, "FirstName": "Maribel", "LastName": "sfsfsfsfsfsfs", "EmailId": "ravi.vishwakarma@ebix.com", "LoginId": "superadmin", "Password": "ebix@2016","aiaIdleTime": 300,"aiaIdleTimeOut": 30,"aiaPingInterval": 10,"SessionId":newsessionid,"isSiteUser":false,"isAdmin":true, "SecurityQuestionId": 1, "SecurityAnswer": "boxer", "CreatorId": 1, "CreationDate": "2009-03-02T00:00:00", "DeactivationDate": null, "ModifierId": 1, "ModifiedDate": "2017-01-24T02:03:19", "UserType": "Super Admin", "UserTypeId": 1, "IsActive": true, "IsCorrectPassword": false, "IncorrectLoginAttemptCount": 0, "IsBlocked": false, "LicenseId": 0, "EditionId": 0, "LoginFailureCauseId": 0, "Modules": [{ "slug": "da-view-list", "name": "Dissectible Anatomy", "id": 1 }, { "slug": "tile-view-list", "name": "Atlas Anatomy", "id": 2 }, { "slug": "3d-anatomy-list", "name": "3D Anatomy", "id": 3 }, { "slug": "clinical-illustrations", "name": "Clinical Illustrations", "id": 4 }, { "slug": "clinical-animations", "name": "Clinical Animations", "id": 5 }, { "slug": "Link/encyclopedia", "name": "Encyclopedia", "id": 6 }, { "slug": "curriculum-builder", "name": "Curriculum Builder", "id": 7 }, { "slug": "anatomy-test", "name": "Anatomy Test", "id": 8 }, { "slug": "Link/IP-10", "name": "IP 10", "id": 9 }, { "slug": "lab-exercises", "name": "Lab Exercises", "id": 10 }, { "slug": "Link/indepth-reports", "name": "In-Depth Reports", "id": 11 }, { "slug": "Link/complementary-and-alternate-medicine", "name": "CAM", "id": 12 }, { "slug": "ADAM-images", "name": "A.D.A.M. Images", "id": 13 }, { "slug": "Link/bodyguide", "name": "Body Guide", "id": 14 }, { "slug": "Link/health-navigator", "name": "Symptom Navigator", "id": 15 }, { "slug": "Link/wellness-tools", "name": "The Wellness Tools", "id": 16 }, { "slug": "Link/aod", "name": "A.D.A.M. OnDemand", "id": 1017 }], "LicenseInfo": { "Id": 0, "AccountNumber": "AIAS000319" }, "LicenseSubscriptions": null, "IsSubscriptionExpired": false, "SubscriptionExpirationDate": null, "TermsAndConditionsTitle": null, "TermsAndConditionsText": null })); } @@ -57,6 +58,7 @@ export class GlobalService { this.aiaPingInterval=this.loggedInUser.aiaPingInterval; this.SessionId=this.loggedInUser.SessionId; this.isSiteUser=this.loggedInUser.isSiteUser; + this.isAdmin=this.loggedInUser.LicenseId==0?true:false;; }