diff --git a/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml b/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml
index 86d4f90..50fa915 100644
--- a/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml
+++ b/Areas/Inventory/Views/InventoryMaster/ItemMovement.cshtml
@@ -104,9 +104,13 @@
Latest Movement
-
- {{ movement.toOther === 'On Delivery' ? 'Receive' : 'Return' }}
+
+
+ {{ movement.action === 'Assign' ? 'Assign' : (movement.toOther === 'On Delivery' ? 'Receive' : 'Return') }}
+
@@ -186,7 +190,7 @@
- @* *@
+
@@ -195,9 +199,13 @@
-
- {{ movement.toOther === 'On Delivery' ? 'Receive' : 'Return' }}
+
+
+ {{ movement.action === 'Assign' ? 'Assign' : (movement.toOther === 'On Delivery' ? 'Receive' : 'Return') }}
+
@@ -282,37 +290,37 @@
- @* *@
- @* *@
+
+
@@ -338,36 +346,36 @@
const app = Vue.createApp({
data() {
return {
- companies: [
- {
- companyId: 1,
- companyName: "PSTW",
- departments: [{ departmentId: 1, departmentName: "Air" }, { departmentId: 2, departmentName: "Marine" }, { departmentId: 3, departmentName: "River" }]
- },
- {
- companyId: 2,
- companyName: "TES",
- departments: [{ departmentId: 1, departmentName: "Air" }],
- },
- ],
- company: "",
- Dept: null,
- teamTypes: ["Continuous", "Manual"],
- teamType: "",
- productName: null,
- imageProduct: null,
- productCategory: null,
- serialNumber: "",
- quantity: 1,
- supplierName: null,
- purchaseDate: null,
- PO: null,
- currency: "MYR",
- DefaultPrice: 0.01,
- currencyRate: 1,
- convertPrice: 0.01,
- DONo:null,
- DODate: null,
+ // companies: [
+ // {
+ // companyId: 1,
+ // companyName: "PSTW",
+ // departments: [{ departmentId: 1, departmentName: "Air" }, { departmentId: 2, departmentName: "Marine" }, { departmentId: 3, departmentName: "River" }]
+ // },
+ // {
+ // companyId: 2,
+ // companyName: "TES",
+ // departments: [{ departmentId: 1, departmentName: "Air" }],
+ // },
+ // ],
+ // company: "",
+ // Dept: null,
+ // teamTypes: ["Continuous", "Manual"],
+ // teamType: "",
+ // productName: null,
+ // imageProduct: null,
+ // productCategory: null,
+ // serialNumber: "",
+ // quantity: 1,
+ // supplierName: null,
+ // purchaseDate: null,
+ // PO: null,
+ // currency: "MYR",
+ // DefaultPrice: 0.01,
+ // currencyRate: 1,
+ // convertPrice: 0.01,
+ // DONo:null,
+ // DODate: null,
warranty: 0,
EndWDate: null,
invoiceNo: null,
@@ -378,16 +386,16 @@
stations: [],
stores: [],
users:[],
- suppliers: [
- {
- supplierId: 1,
- supplierName: "Pang",
- },
- {
- supplierId: 2,
- supplierName: "Ms Kim",
- },
- ],
+ // suppliers: [
+ // {
+ // supplierId: 1,
+ // supplierName: "Pang",
+ // },
+ // {
+ // supplierId: 2,
+ // supplierName: "Ms Kim",
+ // },
+ // ],
isModalOpen: false,
selectedProduct: "",
selectedSupplier: "",
@@ -395,15 +403,16 @@
selectedDepartment: "",
selectedTeamType: "",
selectedtoStation: "",
- currencies: {},
+ consignmentNoteUrl: "",
+ // currencies: {},
showItemModal: false,
loading: false,
- thisQRInfo: {
- uniqueID: null,
- departmentName: null,
- serialNumber: null,
- endWDate: null,
- },
+ // thisQRInfo: {
+ // uniqueID: null,
+ // departmentName: null,
+ // serialNumber: null,
+ // endWDate: null,
+ // },
items: [],
currentUser: null,
currentUserCompanyDept: null,
@@ -450,7 +459,27 @@
},
methods: {
+ remark(remark) {
+ document.getElementById("remarkContent").innerText = remark || "No remark message provide.";
+ let modal = new bootstrap.Modal(document.getElementById("remarkModal"));
+ modal.show();
+ },
+ consignmentNote(consignmentNote) {
+ if (!consignmentNote) {
+ this.consignmentNoteUrl = "No consignment note available.";
+ new bootstrap.Modal(document.getElementById('consignmentModal')).show();
+ return;
+ }
+
+ // Pastikan URL betul
+ this.consignmentNoteUrl = consignmentNote;
+
+ // Tunggu Vue update sebelum buka modal
+ this.$nextTick(() => {
+ new bootstrap.Modal(document.getElementById('consignmentModal')).show();
+ });
+ },
initiateTable() {
this.loading = true;
@@ -590,8 +619,12 @@
const data = await response.json();
this.items = data.filter(item =>
item.toUser === this.currentUser.id ||
- item.lastUser === this.currentUser.id
+ item.lastUser === this.currentUser.id ||
+ item.toStore === this.currentUser.store
);
+
+
+ console.log(this.items);
}
diff --git a/Controllers/API/IdentityAPI.cs b/Controllers/API/IdentityAPI.cs
index f62d5ae..308849f 100644
--- a/Controllers/API/IdentityAPI.cs
+++ b/Controllers/API/IdentityAPI.cs
@@ -43,14 +43,19 @@ namespace PSTW_CentralSystem.Controllers.API
return NotFound(new { message = $"Unable to load user with ID '{_userManager.GetUserId(User)}'." });
}
- var userInfo = await _identityDbContext.Users.Include(u => u.Department).Select(u => new
+ var storeId = await _identityDbContext.InventoryMasters.Where(s => s.UserId == user.Id).Select(s => s.StoreId).FirstOrDefaultAsync();
+
+ var userInfo = await _identityDbContext.Users.Include(u => u.Department)
+ .Include(u => u.Store)
+ .Select(u => new
{
id = u.Id,
email = u.NormalizedEmail,
company = u.Department!.Company!.CompanyName,
department = u.Department,
role = userRole,
- }).Where(u => u.id == user.Id).FirstOrDefaultAsync();
+ store = storeId != 0 ? storeId : (int?)null
+ }).Where(u => u.id == user.Id).FirstOrDefaultAsync();
if (userInfo == null)
{
diff --git a/Models/UserModel.cs b/Models/UserModel.cs
index b032721..43cb207 100644
--- a/Models/UserModel.cs
+++ b/Models/UserModel.cs
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Identity;
+using PSTW_CentralSystem.Areas.Inventory.Models;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -12,6 +13,7 @@ namespace PSTW_CentralSystem.Models
public int? departmentId { get; set; }
[ForeignKey("departmentId")]
public virtual DepartmentModel? Department { get; set; }
-
+
+ public virtual InventoryMasterModel? Store { get; set; }
}
}