diff --git a/Areas/Inventory/Models/ProductModel.cs b/Areas/Inventory/Models/ProductModel.cs index 275bc36..2c5ba93 100644 --- a/Areas/Inventory/Models/ProductModel.cs +++ b/Areas/Inventory/Models/ProductModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; - +using PSTW_CentralSystem.Models; namespace PSTW_CentralSystem.Areas.Inventory.Models { public class ProductModel diff --git a/Areas/Inventory/Models/RequestModel.cs b/Areas/Inventory/Models/RequestModel.cs index 293adc1..15de668 100644 --- a/Areas/Inventory/Models/RequestModel.cs +++ b/Areas/Inventory/Models/RequestModel.cs @@ -11,7 +11,7 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models public int ProductId { get; set; } [ForeignKey("ProductId")] public virtual ProductModel? Product { get; set; } - public int StationId { get; set; } + public int? StationId { get; set; } [ForeignKey("StationId")] public virtual StationModel? Station { get; set; } public int UserId { get; set; } @@ -23,7 +23,7 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models public string? status { get; set; } public DateTime requestDate { get; set; } public DateTime? approvalDate { get; set; } - public int RequestQuantity { get; set; } + public int? RequestQuantity { get; set; } public string? Document { get; set; } } diff --git a/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml b/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml index 65fa097..a68575a 100644 --- a/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml +++ b/Areas/Inventory/Views/ItemMovement/ItemRequest.cshtml @@ -78,12 +78,14 @@
- +
@@ -91,12 +93,7 @@
-
- -
+
@@ -108,16 +105,31 @@ - + @* Who will assign to *@
+ +
+ +
+
+ + +
- +
@@ -180,8 +192,8 @@ return { requestId : null, userId : null, - stationId : null, - productId : null, + stationId : "", + productId : "", remark: "", document: null, quantity: 0, @@ -189,14 +201,14 @@ requestDate : null, approvalDate : null, productCategory: "", + assign: "", productName: null, - productCategory: null, stations: [], selectedProduct: "", selectedStation: "", selectedCategory: "", - categories: ["Asset", "Part", "Disposable"], + assigns: ["Self-Assign", "Station"], showRequestModal: false, loading: false, products: [], @@ -213,12 +225,14 @@ ]); }, computed: { - showProduct() { - if (!this.selectedProduct) { + if (!this.productId) { return []; // No company selected, return empty list } - const product = this.products.find(c => c.productId === this.selectedProduct); + const product = this.products.find(c => c.productId === this.productId); + + this.productCategory = product.category; + return product ? product : {}; }, }, @@ -238,7 +252,7 @@ }, async addRequest() { try { - const requiredFields = ['stationId', 'productId', 'quantity', 'productCategory']; + const requiredFields = ['productId', 'quantity', 'assign']; // Loop through required fields and check if any are null or empty for (let field of requiredFields) { @@ -248,6 +262,17 @@ } } + if (this.assign === "Station"){ + if (this.stationId == null) { + alert('Request Error', `Please fill in required fields : Station.`, 'warning'); + return; + } + } + + if (this.assign === "Self-Assign"){ + this.stationId = null; + } + this.userId = this.currentUser.id; this.status = "Requested"; @@ -356,6 +381,13 @@ "title": "Remark", "data": "remarkUser", }, + { + "title": "Station Deploy", + "data": "stationName", + "render": function (data, type, full, meta) { + return data ? data : "Self Assign"; + } + }, { "title": "Request Date", "data": "requestDate", @@ -410,6 +442,13 @@ "title": "Request Quantity", "data": "requestQuantity", }, + { + "title": "Station Deploy", + "data": "stationName", + "render": function (data, type, full, meta) { + return data ? data : "Self Assign"; + } + }, { "title": "Document / Picture", "data": "document", @@ -562,8 +601,8 @@ }, resetForm() { - this.stationId = null; - this.productId = null; + this.stationId = ""; + this.productId = ""; this.remark = ""; this.document = null; this.quantity = 0; @@ -571,9 +610,9 @@ this.requestDate = null; this.approvalDate = null; this.productCategory = ""; + this.assign = "", this.productName = null; - this.productCategory = null; this.selectedProduct = ""; this.selectedStation = ""; this.selectedCategory = ""; @@ -615,6 +654,7 @@ this.loading = false; } }, + }, }); diff --git a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml index dac81b6..d91bb26 100644 --- a/Areas/Inventory/Views/ItemMovement/QrUser.cshtml +++ b/Areas/Inventory/Views/ItemMovement/QrUser.cshtml @@ -53,11 +53,22 @@ -
+

Item Receive Information :

+

Station Assign

-
+
+

Item Receive Information :

+

Self Assign

+
+ +

Item Return Information :

+

Station

+
+
+

Item Return Information :

+

Self Assign

@@ -102,7 +113,7 @@

PIC: - Station PIC + {{thisItem.currentStation || 'No Station Deploy (Self Assign)' }}

@@ -126,21 +137,13 @@
- -
  • - - Store: - - {{ thisItem.currentStore }} -
  • - -
  • - - Station: - - {{ thisItem.currentStation || 'N/A' }} -
  • + + + + + +
    @@ -166,21 +169,6 @@ - -
  • - - Store: - - {{ thisItem.toStoreName }} -
  • - - -
  • - - Station: - - {{ thisItem.toStationName || 'N/A' }} -
  • @@ -200,32 +188,15 @@


    -

    Station Deploy :

    -
    -
    -
    - -
    - -
    - -
    -
    - -
    - - @* Submit and Reset Buttons *@ -
    -
    - - -
    + @* Submit and Reset Buttons *@ +
    +
    + +
    +
    @@ -235,7 +206,7 @@ -
    +
    @@ -244,35 +215,14 @@


    -

    Station Deploy :

    -
    -
    -
    - - -
    - -
    - -
    -
    - - -
    - -
    - -
    -
    -
    - - @* Submit and Reset Buttons *@ -
    -
    - -
    + @* Submit and Reset Buttons *@ +
    +
    + +
    +
    @@ -280,6 +230,68 @@
    + + + + + +