diff --git a/Areas/Inventory/Controllers/ItemMovementController.cs b/Areas/Inventory/Controllers/ItemMovementController.cs index fe1eb52..2615623 100644 --- a/Areas/Inventory/Controllers/ItemMovementController.cs +++ b/Areas/Inventory/Controllers/ItemMovementController.cs @@ -15,7 +15,7 @@ namespace PSTW_CentralSystem.Areas.Inventory.Controllers { return View(); } - public ActionResult Qr() + public ActionResult QrUser() { return View(); } diff --git a/Areas/Inventory/Models/ItemMovementModel.cs b/Areas/Inventory/Models/ItemMovementModel.cs index fb81751..435d490 100644 --- a/Areas/Inventory/Models/ItemMovementModel.cs +++ b/Areas/Inventory/Models/ItemMovementModel.cs @@ -14,6 +14,7 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models public int? ToUser { get; set; } [Comment("Repair, Calibration, Faulty, Ready To Deploy, On Delivery")] public string? ToOther { get; set; } + public DateTime sendDate { get; set; } [Comment("Register, StockIn, Stock Out")] public string? Action { get; set; } public int? Quantity { get; set; } @@ -25,6 +26,7 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models public int? LastStation{ get; set; } [Comment("Repair, Calibration, Faulty, Ready To Deploy, On Delivery")] public string? LatestStatus { get; set; } + public DateTime receiveDate { get; set; } public bool MovementComplete { get; set; } = false; //public virtual ItemModel? Item { get; set; } //[ForeignKey("ToStore")] diff --git a/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml b/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml index a07e6c2..562064e 100644 --- a/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml +++ b/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml @@ -323,13 +323,17 @@ }, { "title": "Delete", - "data": "requestId", - "render": function (data) { - var deleteButton = ``; - return deleteButton; - }, + "data": "requestId", + "render": function (data, type, row) { + if (row.status === "Approved" || row.status === "Rejected") { + return ``; + } else { + return ``; + } + }, "className": "align-middle", } + ], responsive: true, }) diff --git a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml index 8e61127..dba0ca4 100644 --- a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml +++ b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml @@ -15,31 +15,28 @@ .table td img { display: block !important; } + + -@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml"); +@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartialUser.cshtml");
- @* *@ +
- @*
-
- Loading... -
-
*@ - @*
*@ -
+

QR & Barcode Scanner

-

Scan Result:

-
-

Scan Result:

-
- -
+
+

Item Receive Information :

+
+
+
@@ -74,11 +71,11 @@
-
+
- Current Information + Receiver Information
    @@ -96,7 +93,7 @@
  • - Store: + Store: {{ thisItem.currentStore }}
  • @@ -113,20 +110,11 @@
- @*
*@ - @*

Welcome, Admin! You have full access.

*@ - @*

Welcome, User! You have limited access.

*@ - @*

Guest View: Please log in.

*@ - @*
*@
- - - -
-
+
@@ -134,51 +122,30 @@
-

REGISTRATION ITEM

+

+

Station Deploy :

- +
- +
- -
-
- - -
- -
- + +
- @* Remark *@ -
- -
- -
-
- -
@* Submit and Reset Buttons *@
- - + +
@@ -195,27 +162,14 @@
@section Scripts { + @{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); } - - - - -} \ No newline at end of file +} diff --git a/Areas/Inventory/Views/_InventoryPartialUser.cshtml b/Areas/Inventory/Views/_InventoryPartialUser.cshtml index 08ceac0..1c181a1 100644 --- a/Areas/Inventory/Views/_InventoryPartialUser.cshtml +++ b/Areas/Inventory/Views/_InventoryPartialUser.cshtml @@ -15,7 +15,7 @@
- +

diff --git a/Controllers/API/Inventory/InvMainAPI.cs b/Controllers/API/Inventory/InvMainAPI.cs index 3db2258..c9b62b7 100644 --- a/Controllers/API/Inventory/InvMainAPI.cs +++ b/Controllers/API/Inventory/InvMainAPI.cs @@ -474,6 +474,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory .Include("CreatedBy") .Include("Department") .Include("Product") + .Include("Movement") .Include(i => i.Movement) .ThenInclude(m => m!.FromStore) .Include(i => i.Movement) @@ -486,6 +487,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory var singleItem = new { item.ItemID, + item.MovementId, item.UniqueID, item.CompanyId, item.DepartmentId, @@ -510,8 +512,11 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory item.Product!.ProductShortName, item.Product!.ImageProduct, CurrentUser = item.Movement?.FromUser?.UserName, + CurrentUserId = item.Movement?.FromUser?.Id, CurrentStore = item.Movement?.FromStore?.StoreName, CurrentStation = item.Movement?.FromStation?.StationName, + item.Movement?.ToOther, + item.Movement?.LatestStatus, QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.UniqueID}" // Generate QR String }; return Json(singleItem); @@ -755,8 +760,6 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory } } - - [HttpGet("ItemRequestListEachUser/{userId}")] public async Task ItemRequestListEachUser(int userId) { @@ -766,7 +769,6 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory return Ok(requests); } - [HttpDelete("DeleteRequest/{requestId}")] public async Task DeleteRequest(int requestId) { @@ -989,5 +991,86 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory #endregion AllUser + + #region ScannerUser + [HttpPost("UpdateItemMovementUser")] + public async Task UpdateItemMovementUser([FromBody] ItemMovementModel receiveMovement) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + + try + { + + var updatedList = await _centralDbContext.ItemMovements.FindAsync(receiveMovement.Id); + + if (updatedList == null) + { + return NotFound("Item movement record not found."); + } + + updatedList.LastStation = receiveMovement.LastStation; + updatedList.LatestStatus = receiveMovement.LatestStatus; + updatedList.receiveDate = receiveMovement.receiveDate; + updatedList.MovementComplete = receiveMovement.MovementComplete; + + _centralDbContext.ItemMovements.Update(updatedList); + await _centralDbContext.SaveChangesAsync(); + + return Json(updatedList); + } + catch (Exception ex) + { + return BadRequest(ex.Message); + } + } + + [HttpPost("ReturnItemMovementUser")] + public async Task ReturnItemMovementUser([FromBody] ItemMovementModel returnMovement) + { + if (!ModelState.IsValid) + { + return BadRequest(ModelState); + } + + try + { + + var updatedList = await _centralDbContext.ItemMovements + .Where(r => r.Id == returnMovement.Id) + .FirstAsync(); + + updatedList.ItemId = updatedList.ItemId; + updatedList.ToStation = updatedList.ToStation; + updatedList.ToStore = updatedList.ToStore; + updatedList.ToUser = updatedList.ToUser; + updatedList.ToOther = updatedList.ToOther; + updatedList.sendDate = updatedList.sendDate; + updatedList.ToStation = updatedList.ToStation; + updatedList.Action = updatedList.Action; + updatedList.Quantity = updatedList.Quantity; + updatedList.Remark = updatedList.Remark; + updatedList.ConsignmentNote = updatedList.ConsignmentNote; + updatedList.Date = updatedList.Date; + updatedList.LastUser = updatedList.LastUser; + updatedList.LastStore = updatedList.ToStore; + + updatedList.LastStation = returnMovement.LastStation; + updatedList.LatestStatus = returnMovement.LatestStatus; + updatedList.receiveDate = returnMovement.receiveDate; + updatedList.MovementComplete = returnMovement.MovementComplete; + + await _centralDbContext.SaveChangesAsync(); + + return Json(updatedList); + } + catch (Exception ex) + { + return BadRequest(ex.Message); + } + } + #endregion } }