diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopStaff.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopStaff.razor index 7cd673cb..efe5aa5c 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopStaff.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Shop/ShopStaff.razor @@ -208,7 +208,8 @@ else if (_staff.Any()) _staffFormMessage = "Vui lòng nhập đầy đủ email và mật khẩu."; _staffFormSuccess = false; return; } var (ok, err) = await DataService.InviteStaffWithAccountAsync(new PosDataService.InviteStaffWithAccountRequest( - _newStaffEmail, _newStaffPassword, _newStaffFirstName, _newStaffLastName, _newStaffRole, ShopId)); + _newStaffEmail, _newStaffPassword, _newStaffFirstName, _newStaffLastName, _newStaffRole, ShopId, + _newStaffCode, _newStaffPhone, _newStaffAddress)); if (!ok) { _staffFormMessage = err ?? "Lỗi tạo tài khoản IAM. Kiểm tra email/mật khẩu."; _staffFormSuccess = false; return; } _staffFormMessage = $"Đã tạo tài khoản + mời NV '{_newStaffEmail}' thành công!"; _staffFormSuccess = true; } diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/PosDataService.cs b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/PosDataService.cs index 73de71dc..467e8fa1 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/PosDataService.cs +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Services/PosDataService.cs @@ -1181,7 +1181,8 @@ public class PosDataService // ═══ STAFF IAM ═══ - public record InviteStaffWithAccountRequest(string Email, string Password, string FirstName, string LastName, string Role, Guid? ShopId); + public record InviteStaffWithAccountRequest(string Email, string Password, string FirstName, string LastName, string Role, Guid? ShopId, + string? EmployeeCode = null, string? Phone = null, string? Address = null); public async Task<(bool Ok, string? Error)> InviteStaffWithAccountAsync(InviteStaffWithAccountRequest req) { diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/StaffController.cs b/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/StaffController.cs index af3bbeb4..e1b718a0 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/StaffController.cs +++ b/apps/web-client-tpos-net/src/WebClientTpos.Server/Controllers/StaffController.cs @@ -105,7 +105,10 @@ public class StaffController : ControllerBase role = body.TryGetProperty("role", out var r1) ? r1.GetString() : "Cashier", shopId = body.TryGetProperty("shopId", out var s1) ? s1.GetString() : null as string, firstName = iamPayload.firstName, - lastName = iamPayload.lastName + lastName = iamPayload.lastName, + employeeCode = body.TryGetProperty("employeeCode", out var ec1) ? ec1.GetString() : null as string, + phone = body.TryGetProperty("phone", out var ph1) ? ph1.GetString() : null as string, + address = body.TryGetProperty("address", out var ad1) ? ad1.GetString() : null as string }; return await _merchant.PostAsJsonAsync("/api/v1/merchants/me/staff/create-active", createPayload).ProxyAsync(); } @@ -118,7 +121,10 @@ public class StaffController : ControllerBase role = body.TryGetProperty("role", out var r2) ? r2.GetString() : "Cashier", shopId = body.TryGetProperty("shopId", out var s2) ? s2.GetString() : null as string, firstName = iamPayload.firstName, - lastName = iamPayload.lastName + lastName = iamPayload.lastName, + employeeCode = body.TryGetProperty("employeeCode", out var ec2) ? ec2.GetString() : null as string, + phone = body.TryGetProperty("phone", out var ph2) ? ph2.GetString() : null as string, + address = body.TryGetProperty("address", out var ad2) ? ad2.GetString() : null as string }; return await _merchant.PostAsJsonAsync("/api/v1/merchants/me/staff/invite", invitePayload).ProxyAsync(); }