fixing approval and returning approval name
This commit is contained in:
parent
9419130ee3
commit
99be1e9c8b
@ -29,6 +29,7 @@ namespace CPRNIMS.Domain.Contracts.PR
|
||||
Task<List<AlternativeOfferDetails>> GetSupplierAlterOfferDetails(PRDto PRDto);
|
||||
Task<List<NotificationById>> GetNotificationById(PRDto PRDto);
|
||||
Task<List<PRDto>> GetApproverName(PRDto PRDto);
|
||||
Task<List<PRDto>> GetApproverNameByPRNo(PRDto PRDto);
|
||||
Task<List<ProjectCodes>> GetProjectCodes(PRDto pRDto);
|
||||
Task<MessageResponse> PRItemRemoval(PRDto pRDto);
|
||||
Task<PRDetails> PostPRApproveReject(PRDto PRDto);
|
||||
|
||||
@ -35,6 +35,31 @@ namespace CPRNIMS.Domain.Services.PR
|
||||
|
||||
return allItems ?? new List<Infrastructure.Entities.Purchasing.PRList>();
|
||||
}
|
||||
public async Task<List<PRDto>> GetApproverNameByPRNo(PRDto PRDto)
|
||||
{
|
||||
var result = await _dbContext.Approved
|
||||
.Where(a => a.PRNo == PRDto.PRNo && (a.ApproverId == 1 || a.ApproverId == 2))
|
||||
.GroupBy(a => a.PRNo)
|
||||
.Select(g => new PRDto
|
||||
{
|
||||
AttestedBy = g.Where(x => x.ApproverId == 1 && x.ApprovedBy != null)
|
||||
.Select(x => x.ApprovedBy)
|
||||
.FirstOrDefault(),
|
||||
|
||||
ApprovedBy = g.Where(x => x.ApproverId == 2 && x.ApprovedBy != null)
|
||||
.Select(x => x.ApprovedBy)
|
||||
.FirstOrDefault()
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
if (result.Any() && (result[0].AttestedBy != null || result[0].ApprovedBy != null))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return new List<PRDto>();
|
||||
}
|
||||
|
||||
public async Task<List<PRDto>> GetApproverName(PRDto PRDto)
|
||||
{
|
||||
var result = await _dbContext.Approved
|
||||
|
||||
@ -12,6 +12,7 @@ namespace CPRNIMS.Domain.UIContracts.PR
|
||||
{
|
||||
#region Get
|
||||
Task<List<PRVM>?> GetApproverName(User user, PRVM viewModels);
|
||||
Task<List<PRVM>?> GetApproverNameByPRNo(User user, PRVM viewModels);
|
||||
Task<List<PRVM>> GetForReceiving(User user, PRVM viewModel);
|
||||
Task<List<PRVM>> GetItemDetailForReceiving(User user, PRVM viewModel);
|
||||
Task<List<PRVM>> GetDashBoard(User user, PRVM viewModel);
|
||||
|
||||
@ -126,6 +126,11 @@ namespace CPRNIMS.Domain.UIServices.PR
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetApproverName"]);
|
||||
}
|
||||
public async Task<List<PRVM>?> GetApproverNameByPRNo(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
_configuration["LLI:NonInvent:PRMgmt:GetApproverNameByPRNo"]);
|
||||
}
|
||||
public async Task<List<PRVM>> GetAllPR(User user, PRVM viewModel)
|
||||
{
|
||||
return await SendGetApiRequest(user, viewModel,
|
||||
|
||||
@ -16,5 +16,6 @@ namespace CPRNIMS.Infrastructure.Entities.Purchasing
|
||||
public long PRDetailsId { get; set; }
|
||||
public string? ApprovedBy { get; set; }
|
||||
public byte ApproverId { get; set; }
|
||||
public long PRNo { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,8 @@
|
||||
using CPRNIMS.Domain.Contracts.Inventory;
|
||||
using CPRNIMS.Domain.Services;
|
||||
using CPRNIMS.Infrastructure.Dto.Inventory;
|
||||
using CPRNIMS.Infrastructure.Dto.Items;
|
||||
using CPRNIMS.Infrastructure.Dto.SMTP;
|
||||
using CPRNIMS.Infrastructure.Helper;
|
||||
using CPRNIMS.Infrastructure.ViewModel.Common;
|
||||
using CPRNIMS.WebApi.Controllers.Base;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Text;
|
||||
|
||||
namespace CPRNIMS.WebApi.Controllers.Inventory
|
||||
{
|
||||
|
||||
@ -6,7 +6,6 @@ using CPRNIMS.Infrastructure.Models.Common;
|
||||
using CPRNIMS.Infrastructure.ViewModel.Common;
|
||||
using CPRNIMS.Infrastructure.ViewModel.Items;
|
||||
using CPRNIMS.WebApi.Controllers.Base;
|
||||
using Google.Apis.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Text;
|
||||
|
||||
@ -109,7 +108,7 @@ namespace CPRNIMS.WebApi.Controllers.Items
|
||||
PRId = dto.PRId
|
||||
};
|
||||
await _item.PostPutAttachment(attachment);
|
||||
await SendNotificationEmail(dto);
|
||||
// await SendNotificationEmail(dto);
|
||||
}
|
||||
|
||||
return dto;
|
||||
|
||||
@ -308,6 +308,14 @@ namespace CPRNIMS.WebApi.Controllers.PR
|
||||
nameof(GetApproverName), false
|
||||
);
|
||||
}
|
||||
[HttpPost("GetApproverNameByPRNo")]
|
||||
public async Task<IActionResult> GetApproverNameByPRNo(PRDto PRDto)
|
||||
{
|
||||
return await ExecuteWithErrorHandling(
|
||||
() => _pRequest.GetApproverNameByPRNo(PRDto),
|
||||
nameof(GetApproverNameByPRNo), false
|
||||
);
|
||||
}
|
||||
[HttpPost("GetPRStatusById")]
|
||||
public async Task<IActionResult> GetPRStatusById(PRDto PRDto)
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ namespace CPRNIMS.WebApps.Controllers.PR
|
||||
{
|
||||
_pRequest = pRequest;
|
||||
}
|
||||
#region Get
|
||||
#region Get
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> GetPRAttachment(string fileName)
|
||||
{
|
||||
@ -57,11 +57,16 @@ namespace CPRNIMS.WebApps.Controllers.PR
|
||||
response = await _pRequest.GetProjectCodes(GetUser(), viewModels);
|
||||
return GetResponse(response);
|
||||
}
|
||||
public async Task<IActionResult> GetApproverNameByPRNo(PRVM viewModels)
|
||||
{
|
||||
response = await _pRequest.GetApproverNameByPRNo(GetUser(), viewModels);
|
||||
return GetResponse(response);
|
||||
}
|
||||
public async Task<IActionResult> GetApproverName(PRVM viewModels)
|
||||
{
|
||||
response = await _pRequest.GetApproverName(GetUser(), viewModels);
|
||||
return GetResponse(response);
|
||||
}
|
||||
}
|
||||
public async Task<IActionResult> GetAllPR(PRVM viewModels)
|
||||
{
|
||||
response = await _pRequest.GetAllPR(GetUser(), viewModels);
|
||||
|
||||
@ -77,6 +77,6 @@
|
||||
<link href="~/css/pr/TrackingV3.css" rel="stylesheet" />
|
||||
<link href="~/css/pr/ButtonStyleV2.css" rel="stylesheet" />
|
||||
@await Html.PartialAsync("PagesView/PR/_PRTracking")
|
||||
<script src="~/JsFunctions/PR/PRV6.js"></script>
|
||||
<script src="~/JsFunctions/PR/PRV7.js"></script>
|
||||
@await Html.PartialAsync("PagesView/PR/_PRScripts")
|
||||
</body>
|
||||
@ -4,7 +4,7 @@
|
||||
<link href="~/css/common/rowhighlighter.css" rel="stylesheet" />
|
||||
|
||||
<script src="~/jsfunctions/pr/PRColumnV7.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRViewV6.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRViewV7.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRPutPost.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRButtonv3.js"></script>
|
||||
<script src="~/jsfunctions/pr/PRVarV3.js"></script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user