diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs index da35e035..a539994b 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/PersonalWorkstationViewModel.cs @@ -53,6 +53,10 @@ namespace IRaCIS.Core.Application.Contracts public class TrialSiteSurveyStat:TrialSelectDTO { public int? ApprovalRequiredCount { get; set; } + + + + public int? ApprovalRequiredSiteCount { get; set; } } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs index 1e302c97..f9a734d0 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/PersonalWorkstation.cs @@ -91,11 +91,15 @@ namespace IRaCIS.Core.Application [HttpPost] public async Task> GetSiteSurveyApprovalList(TrialSiteSurveyStatQuery query) { + if (_userInfo.IsAdmin) + { + return new PageOutput(query.PageIndex, query.PageSize, 0, new List()); + } return await _trialRepository .Where(t => t.TrialUserList.Any(t => t.UserId == _userInfo.Id)) .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM,c=> c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count()>0) - .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved).Count() > 0) + .WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, c => c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count() > 0) .ProjectTo(_mapper.ConfigurationProvider, new { userTypeEnumInt = _userInfo.UserTypeEnumInt, userId = _userInfo.Id }) .OrderByDescending(t=>t.ApprovalRequiredCount).ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField, query.Asc); diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs index 44c19771..22b24bb7 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/_MapConfig.cs @@ -236,7 +236,14 @@ namespace IRaCIS.Core.Application.Service u.MapFrom( c => userTypeEnumInt == (int)UserTypeEnum.ProjectManager|| userTypeEnumInt == (int)UserTypeEnum.APM ? c.TrialSiteSurveyList.Where(t=> t.State==TrialSiteSurveyEnum.SPMApproved).Count() : c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Count()) - ); + ) + + .ForMember(t => t.ApprovalRequiredSiteCount, u => + u.MapFrom(c => userTypeEnumInt == (int)UserTypeEnum.ProjectManager || userTypeEnumInt == (int)UserTypeEnum.APM ? + c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.SPMApproved ).Select(t=>t.SiteId).Distinct().Count() + : c.TrialSiteSurveyList.Where(t => t.State == TrialSiteSurveyEnum.CRCSubmitted).Select(t => t.SiteId).Distinct().Count()) + ) + ; var userTypeId = Guid.Empty; CreateMap()