+
@@ -113,12 +113,11 @@
methods: {
async fetchUsers() {
try {
- const response = await fetch(`/IdentityAPI/GetTechnicianUserInformation/`, {
+ const response = await fetch(`/InvMainAPI/UserList/`, {
method: 'POST',
});
if (response.ok) {
- const data = await response.json();
- this.users = data.technicianUsers;
+ this.users = await response.json();
}
else {
console.error(`Failed to fetch user: ${response.statusText}`);
@@ -230,11 +229,11 @@
},
{
"title": "Station User PIC",
- "data": "stationPicID",
+ "data": "fullName",
},
{
- "title": "Department ID",
- "data": "departmentId",
+ "title": "Department",
+ "data": "departmentName",
},
{
"title": "Delete",
@@ -250,7 +249,7 @@
})
// Attach click event listener to the delete buttons
- $('#stationDatatable tbody').on('click', '.delete-btn', function () {
+ $('#stationDatatable tbody').off('click', '.delete-btn').on('click', '.delete-btn', function () {
const stationId = $(this).data('id');
self.deleteStation(stationId);
});
@@ -259,7 +258,8 @@
},
updateDepartment() {
// Find the selected user by their full name
- const selectedUser = this.users.find(user => user.fullname === this.selectedUserName);
+ const selectedUser = this.users.find(user => user.fullName === this.selectedUserName);
+ console.log(selectedUser);
if (selectedUser) {
this.stationUserPIC = selectedUser.id;
this.departmentId = selectedUser.department.departmentId;
diff --git a/Controllers/API/IdentityAPI.cs b/Controllers/API/IdentityAPI.cs
index 308849f..e6c8d99 100644
--- a/Controllers/API/IdentityAPI.cs
+++ b/Controllers/API/IdentityAPI.cs
@@ -70,44 +70,44 @@ namespace PSTW_CentralSystem.Controllers.API
}
}
- [HttpPost("GetTechnicianUserInformation")]
- public async Task
GetTechnicianUserInformation()
- {
- try
- {
- var users = await _identityDbContext.Users
- .Include(u => u.Department)
- .ToListAsync(); // Retrieve all users with department info
+ //[HttpPost("GetTechnicianUserInformation")]
+ //public async Task GetTechnicianUserInformation()
+ //{
+ // try
+ // {
+ // var users = await _identityDbContext.Users
+ // .Include(u => u.Department)
+ // .ToListAsync(); // Retrieve all users with department info
- var technicianUsers = new List