From 9b31a50115ef6862bedfabe84c60b1ffa5930eb6 Mon Sep 17 00:00:00 2001 From: Mohd Ariff Date: Fri, 24 Jan 2025 16:29:47 +0800 Subject: [PATCH] Update --- Controllers/API/Inventory/InvMainAPI.cs | 15 +- Views/PublicInventory/ItemInformation.cshtml | 132 ++++-- wwwroot/Media/System/Logo-PSTW-A4.svg | 443 +++++++++++++++++++ 3 files changed, 552 insertions(+), 38 deletions(-) create mode 100644 wwwroot/Media/System/Logo-PSTW-A4.svg diff --git a/Controllers/API/Inventory/InvMainAPI.cs b/Controllers/API/Inventory/InvMainAPI.cs index 627506b..fa8de0c 100644 --- a/Controllers/API/Inventory/InvMainAPI.cs +++ b/Controllers/API/Inventory/InvMainAPI.cs @@ -469,7 +469,16 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory [HttpPost("GetItem/{id}")] // Endpoint to retrieve an item by its ID public async Task GetItem(string id) { - var item = await _centralDbContext.Items.Include("CreatedBy").Include("Department").Include("Product").FirstOrDefaultAsync(i => i.UniqueID == id); + var item = await _centralDbContext.Items + .Include("CreatedBy") + .Include("Department") + .Include("Product") + .Include(i => i.Movement) + .ThenInclude(m => m!.FromStore) + .Include(i => i.Movement) + .ThenInclude(m => m!.FromStation) + .Include(i => i.Movement) + .ThenInclude(m => m!.FromUser).FirstOrDefaultAsync(i => i.UniqueID == id); if (item == null){ return NotFound(new { success = false, message = "Item not found" }); } @@ -491,6 +500,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory item.ConvertPrice, item.DODate, item.Warranty, + item.PartNumber, EndWDate = item.EndWDate.ToString("dd/MM/yyyy"), InvoiceDate = item.InvoiceDate?.ToString("dd/MM/yyyy"), item.Department?.DepartmentName, @@ -498,6 +508,9 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory item.Product!.ProductName, item.Product!.ProductShortName, item.Product!.ImageProduct, + CurrentUser = item.Movement?.FromUser?.UserName, + CurrentStore = item.Movement?.FromStore?.StoreName, + CurrentStation = item.Movement?.FromStation?.StationName, QRString = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.Value}/I/{item.UniqueID}" // Generate QR String }; return Json(singleItem); diff --git a/Views/PublicInventory/ItemInformation.cshtml b/Views/PublicInventory/ItemInformation.cshtml index 4759fae..0cfbc1c 100644 --- a/Views/PublicInventory/ItemInformation.cshtml +++ b/Views/PublicInventory/ItemInformation.cshtml @@ -48,49 +48,107 @@ -
-
-
-
-
- Product Image -
-
-

{{thisItem.uniqueID}}

-
+
+
+ +
+
+
+ Product Image
-
-
-
-

- Item Name: {{thisItem.productName}} -

-
-
-

- Part Number: Part Number -

-
-
-

- Serial Number: {{thisItem.serialNumber}} -

-
-
-

- PIC: Station PIC -

-
-
-

- Location: Item Location -

+
+ + +
+
+
+ Product Image +
+
+

{{ thisItem.uniqueID }}

+
+
+
+ + +
+
+ +
+

+ Item Name: + {{ thisItem.productName }} +

+
+ + +
+

+ Part Number: + {{ thisItem.partNumber }} +

+
+ + +
+

+ Serial Number: + {{ thisItem.serialNumber }} +

+
+ + +
+

+ PIC: + Station PIC +

+
+ + +
+
+
+
+ Current Information +
+
    + +
  • +
    + + User: + + + {{ thisItem.currentUser }} + +
    +
  • + + +
  • + + Store: + + {{ thisItem.currentStore }} +
  • + + +
  • + + Station: + + {{ thisItem.currentStation || 'N/A' }} +
  • +
+
+
@@ -143,7 +201,7 @@ ); if (response.ok) { this.thisItem = await response.json(); - console.log(this.thisItem); + // console.log(this.thisItem); } else { console.error('Failed to fetch item information'); this.responseMessage = await response.text(); diff --git a/wwwroot/Media/System/Logo-PSTW-A4.svg b/wwwroot/Media/System/Logo-PSTW-A4.svg new file mode 100644 index 0000000..0ee1d93 --- /dev/null +++ b/wwwroot/Media/System/Logo-PSTW-A4.svg @@ -0,0 +1,443 @@ + +image/svg+xml \ No newline at end of file