diff --git a/CPRNIMS.Domain/Contracts/PR/IPRequest.cs b/CPRNIMS.Domain/Contracts/PR/IPRequest.cs index 0692f27..c6eeb01 100644 --- a/CPRNIMS.Domain/Contracts/PR/IPRequest.cs +++ b/CPRNIMS.Domain/Contracts/PR/IPRequest.cs @@ -39,5 +39,7 @@ namespace CPRNIMS.Domain.Contracts.PR Task PostPutDeniedItem(PRDto PRDto); Task PutSupplierAlterOffer(PRDto pRDto); Task PostPutProjectCode(PRDto prDto); + Task> GetRemovedPR(PRDto pRDto); + Task> GetApprovedPR(PRDto pRDto); } } diff --git a/CPRNIMS.Domain/Services/PR/PRequest.cs b/CPRNIMS.Domain/Services/PR/PRequest.cs index 5306705..81c7afa 100644 --- a/CPRNIMS.Domain/Services/PR/PRequest.cs +++ b/CPRNIMS.Domain/Services/PR/PRequest.cs @@ -414,6 +414,24 @@ namespace CPRNIMS.Domain.Services.PR } } + public async Task> GetRemovedPR(PRDto pRDto) + { + var allItems = await _dbContext.RemovedPRs + .FromSqlRaw("EXEC GetRemovedPR @UserId", + new SqlParameter("@UserId", pRDto.UserId)).ToListAsync(); + + return allItems ?? new List(); + } + + public async Task> GetApprovedPR(PRDto pRDto) + { + var allItems = await _dbContext.ApprovedPrs + .FromSqlRaw("EXEC GetApprovedPR @UserId", + new SqlParameter("@UserId", pRDto.UserId)).ToListAsync(); + + return allItems ?? new List(); + } + #endregion } } diff --git a/CPRNIMS.Domain/UIContracts/PR/IPRequest.cs b/CPRNIMS.Domain/UIContracts/PR/IPRequest.cs index 605a0ac..4121dd3 100644 --- a/CPRNIMS.Domain/UIContracts/PR/IPRequest.cs +++ b/CPRNIMS.Domain/UIContracts/PR/IPRequest.cs @@ -11,6 +11,9 @@ namespace CPRNIMS.Domain.UIContracts.PR public interface IPRequest { #region Get + Task> GetAllPR(User user, PRVM viewModel); + Task?> GetApprovedPR(User user, PRVM viewModels); + Task?> GetRemovedPR(User user, PRVM viewModels); Task?> GetApproverName(User user, PRVM viewModels); Task?> GetApproverNameByPRNo(User user, PRVM viewModels); Task> GetForReceiving(User user, PRVM viewModel); @@ -19,7 +22,6 @@ namespace CPRNIMS.Domain.UIContracts.PR Task> GetPRByRRId(User user, PRVM viewModel); Task> GetRRDetailByPO(User user, PRVM viewModel); Task> GetPRStatusById(User user, PRVM viewModel); - Task> GetAllPR(User user, PRVM viewModel); Task> GetPRArchived(User user, PRVM viewModel); Task> GetMyPR(User user, PRVM viewModel); Task> GetPRDetailByPRNo(User user, PRVM viewModel); diff --git a/CPRNIMS.Domain/UIServices/PR/PRequest.cs b/CPRNIMS.Domain/UIServices/PR/PRequest.cs index 28e048f..80b95bb 100644 --- a/CPRNIMS.Domain/UIServices/PR/PRequest.cs +++ b/CPRNIMS.Domain/UIServices/PR/PRequest.cs @@ -201,6 +201,17 @@ namespace CPRNIMS.Domain.UIServices.PR return await SendGetApiRequest(user, viewModel, _configuration["LLI:NonInvent:PRMgmt:GetSupplierAlterOfferDetails"]); } + public async Task?> GetApprovedPR(User user, PRVM viewModel) + { + return await SendGetApiRequest(user, viewModel, + _configuration["LLI:NonInvent:PRMgmt:GetApprovedPR"]); + } + + public async Task?> GetRemovedPR(User user, PRVM viewModel) + { + return await SendGetApiRequest(user, viewModel, + _configuration["LLI:NonInvent:PRMgmt:GetRemovedPR"]); + } #endregion #region POST PUT public async Task PostPRApproveReject(User user, PRVM viewModel) diff --git a/CPRNIMS.Infrastructure/Database/NonInventoryDbContext.cs b/CPRNIMS.Infrastructure/Database/NonInventoryDbContext.cs index e8abb1d..4129d04 100644 --- a/CPRNIMS.Infrastructure/Database/NonInventoryDbContext.cs +++ b/CPRNIMS.Infrastructure/Database/NonInventoryDbContext.cs @@ -44,6 +44,8 @@ namespace CPRNIMS.Infrastructure.Database public virtual DbSet ItemCarts { get; set; } public virtual DbSet PRs { get; set; } public virtual DbSet Approved { get; set; } + public virtual DbSet ApprovedPrs { get; set; } + public virtual DbSet RemovedPRs { get; set; } public virtual DbSet SMTPCredentials { get; set; } public virtual DbSet PRDetails { get; set; } public virtual DbSet PRItemLists { get; set; } diff --git a/CPRNIMS.Infrastructure/Entities/Purchasing/ApprovedPR.cs b/CPRNIMS.Infrastructure/Entities/Purchasing/ApprovedPR.cs new file mode 100644 index 0000000..e962105 --- /dev/null +++ b/CPRNIMS.Infrastructure/Entities/Purchasing/ApprovedPR.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPRNIMS.Infrastructure.Entities.Purchasing +{ + public class ApprovedPR + { + [Key] + public long PRDetailsId { get; set; } + public long PRNo { get; set; } + public long PRId { get; set; } + public long ItemNo { get; set; } + public string? ItemName { get; set; } + public string? ItemDescription { get; set; } + public string? Department { get; set; } + public string? ItemCategoryName { get; set; } + public string? Remarks { get; set; } + public string? StatusName { get; set; } + public DateTime DateNeeded { get; set; } + public DateTime CreatedDate { get; set; } + public string? AttestedDate { get; set; } + public string? ApprovedDate { get; set; } + public string? UOMName { get; set; } + public decimal Qty { get; set; } + public string? ApprovedBy { get; set; } + public string? AttestedBy { get; set; } + public string? CreatedBy { get; set; } + public int RemainingDays { get; set; } + } +} diff --git a/CPRNIMS.Infrastructure/Entities/Purchasing/RemovedPR.cs b/CPRNIMS.Infrastructure/Entities/Purchasing/RemovedPR.cs new file mode 100644 index 0000000..78d1116 --- /dev/null +++ b/CPRNIMS.Infrastructure/Entities/Purchasing/RemovedPR.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CPRNIMS.Infrastructure.Entities.Purchasing +{ + public class RemovedPR + { + [Key] + public long PRDetailsId { get; set; } + public long PRNo { get; set; } + public long PRId { get; set; } + public long ItemNo { get; set; } + public string? ItemName { get; set; } + public string? ItemDescription { get; set; } + public string? Department { get; set; } + public string? ItemCategoryName { get; set; } + public string? Remarks { get; set; } + public string? StatusName { get; set; } + public DateTime DateNeeded { get; set; } + public DateTime CreatedDate { get; set; } + public string? AttestedDate { get; set; } + public string? ApprovedDate { get; set; } + public string? UOMName { get; set; } + public decimal Qty { get; set; } + public string? ApprovedBy { get; set; } + public string? AttestedBy { get; set; } + public string? CreatedBy { get; set; } + } +} diff --git a/CPRNIMS.Infrastructure/ViewModel/PR/PRVM.cs b/CPRNIMS.Infrastructure/ViewModel/PR/PRVM.cs index ec25e5e..ce8f866 100644 --- a/CPRNIMS.Infrastructure/ViewModel/PR/PRVM.cs +++ b/CPRNIMS.Infrastructure/ViewModel/PR/PRVM.cs @@ -132,6 +132,9 @@ namespace CPRNIMS.Infrastructure.ViewModel.PR public long PRId { get; set; } public string? FileName { get; set; } public string? OrigFileName { get; set; } + public string? AttestedDate { get; set; } + public string? ApprovedDate { get; set; } + public int RemainingDays { get; set; } public ItemReceivingList? ItemList { get; set; } public PRList? PRList { get; set; } } diff --git a/CPRNIMS.WebApi/Controllers/Items/ItemMgmtController.cs b/CPRNIMS.WebApi/Controllers/Items/ItemMgmtController.cs index e41d50f..7adeecf 100644 --- a/CPRNIMS.WebApi/Controllers/Items/ItemMgmtController.cs +++ b/CPRNIMS.WebApi/Controllers/Items/ItemMgmtController.cs @@ -108,7 +108,7 @@ namespace CPRNIMS.WebApi.Controllers.Items PRId = dto.PRId }; await _item.PostPutAttachment(attachment); - // await SendNotificationEmail(dto); + await SendNotificationEmail(dto); } return dto; diff --git a/CPRNIMS.WebApi/Controllers/PR/PRMgmtController.cs b/CPRNIMS.WebApi/Controllers/PR/PRMgmtController.cs index be3045b..1577ca5 100644 --- a/CPRNIMS.WebApi/Controllers/PR/PRMgmtController.cs +++ b/CPRNIMS.WebApi/Controllers/PR/PRMgmtController.cs @@ -348,6 +348,22 @@ namespace CPRNIMS.WebApi.Controllers.PR nameof(GetAllPR), false ); } + [HttpPost("GetApprovedPR")] + public async Task GetApprovedPR(PRDto PRDto) + { + return await ExecuteWithErrorHandling( + () => _pRequest.GetApprovedPR(PRDto), + nameof(GetApprovedPR), false + ); + } + [HttpPost("GetRemovedPR")] + public async Task GetRemovedPR(PRDto PRDto) + { + return await ExecuteWithErrorHandling( + () => _pRequest.GetRemovedPR(PRDto), + nameof(GetRemovedPR), false + ); + } [HttpPost("GetMyPR")] public async Task GetMyPR(PRDto PRDto) { diff --git a/CPRNIMS.WebApps/Controllers/PR/PRMgmtController.cs b/CPRNIMS.WebApps/Controllers/PR/PRMgmtController.cs index a64bd97..e9c4ee2 100644 --- a/CPRNIMS.WebApps/Controllers/PR/PRMgmtController.cs +++ b/CPRNIMS.WebApps/Controllers/PR/PRMgmtController.cs @@ -20,7 +20,22 @@ namespace CPRNIMS.WebApps.Controllers.PR { _pRequest = pRequest; } - #region Get + #region Get + public async Task GetAllPR(PRVM viewModels) + { + response = await _pRequest.GetAllPR(GetUser(), viewModels); + return GetResponse(response); + } + public async Task GetApprovedPR(PRVM viewModels) + { + response = await _pRequest.GetApprovedPR(GetUser(), viewModels); + return GetResponse(response); + } + public async Task GetRemovedPR(PRVM viewModels) + { + response = await _pRequest.GetRemovedPR(GetUser(), viewModels); + return GetResponse(response); + } [HttpGet] public async Task GetPRAttachment(string fileName) { @@ -51,7 +66,6 @@ namespace CPRNIMS.WebApps.Controllers.PR return StatusCode(500, "Error retrieving file"); } } - public async Task GetProjectCodes(PRVM viewModels) { response = await _pRequest.GetProjectCodes(GetUser(), viewModels); @@ -67,11 +81,6 @@ namespace CPRNIMS.WebApps.Controllers.PR response = await _pRequest.GetApproverName(GetUser(), viewModels); return GetResponse(response); } - public async Task GetAllPR(PRVM viewModels) - { - response = await _pRequest.GetAllPR(GetUser(), viewModels); - return GetResponse(response); - } public async Task GetPRDetailByPRNo(PRVM viewModels) { response = await _pRequest.GetPRDetailByPRNo(GetUser(), viewModels); @@ -135,9 +144,7 @@ namespace CPRNIMS.WebApps.Controllers.PR } public async Task GetDashBoard() { - var viewModel = new PRVM(); - - response = await _pRequest.GetDashBoard(GetUser(), viewModel); + response = await _pRequest.GetDashBoard(GetUser(), new PRVM()); return GetResponse(response); } @@ -325,6 +332,10 @@ namespace CPRNIMS.WebApps.Controllers.PR { return ViewComponent("Dashboard", new { dashboardId = DashboardId }); } + public IActionResult GetTabbedById(int TableId) + { + return ViewComponent("PRTabbed", new { tableId = TableId }); + } public async Task DashBoard() { return await IsAuthenTicated(); diff --git a/CPRNIMS.WebApps/ViewComponents/PR/PRTabbed.cs b/CPRNIMS.WebApps/ViewComponents/PR/PRTabbed.cs new file mode 100644 index 0000000..4239372 --- /dev/null +++ b/CPRNIMS.WebApps/ViewComponents/PR/PRTabbed.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.Mvc; + +namespace CPRNIMS.WebApps.ViewComponents.PR +{ + public class PRTabbedViewComponent : ViewComponent + { + public IViewComponentResult Invoke(int tableId) + { + string viewName = tableId switch + { + 1 => "~/Views/Components/PRMgmt/PRTabbedTable/AllPR.cshtml", + 2 => "~/Views/Components/PRMgmt/PRTabbedTable/ApprovedPR.cshtml", + _ => "~/Views/Components/PRMgmt/PRTabbedTable/RemovedPR.cshtml" + }; + return View(viewName); + } + } +} diff --git a/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/AllPR.cshtml b/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/AllPR.cshtml new file mode 100644 index 0000000..12584b9 --- /dev/null +++ b/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/AllPR.cshtml @@ -0,0 +1,58 @@ + +
+ + + + + + + + + + + + + + + +
PRNoNew PRNoItemName'sReq. DateReq. ByDateNeededChargeToAction
+
+ + \ No newline at end of file diff --git a/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/ApprovedPR.cshtml b/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/ApprovedPR.cshtml new file mode 100644 index 0000000..d91d38d --- /dev/null +++ b/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/ApprovedPR.cshtml @@ -0,0 +1,160 @@ +
+ + + + + + + + + + + + + + + + + + + + +
StatusRemaining DaysPRNoItemNoItemNameQtyPR ByPR DateAttested ByAttested DateApproved ByApproved DateCharge To
+
+ + \ No newline at end of file diff --git a/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/RemovedPR.cshtml b/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/RemovedPR.cshtml new file mode 100644 index 0000000..ddc1b4c --- /dev/null +++ b/CPRNIMS.WebApps/Views/Components/PRMgmt/PRTabbedTable/RemovedPR.cshtml @@ -0,0 +1,149 @@ +
+ + + + + + + + + + + + + + + + + + + +
PRNoItemNoItemNameQtyPR ByPR DateAttested ByAttested DateApproved ByApproved DateCharge ToRemarks
+
+ + \ No newline at end of file diff --git a/CPRNIMS.WebApps/Views/PRMgmt/Index.cshtml b/CPRNIMS.WebApps/Views/PRMgmt/Index.cshtml index a285c21..679b58f 100644 --- a/CPRNIMS.WebApps/Views/PRMgmt/Index.cshtml +++ b/CPRNIMS.WebApps/Views/PRMgmt/Index.cshtml @@ -1,37 +1,35 @@ 
-
-

PR List

+ +
+
+ + + +
+
+ + +
+

All Purchase Requests

+
+
-
-
- - - - - - - - - - - - - - - - - -
PRNoNew PRNoItemName'sReq. DateReq. ByDateNeededChargeToAction
+