use user phone

This commit is contained in:
2026-03-14 20:12:48 -06:00
parent 82d35feb9a
commit 42f8f568ae
5 changed files with 40 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ public class UserInfoResponse {
private String username;
private String email;
private String fullName;
private String phone;
private String avatarUrl;
private String role;
private Long storeId;
@@ -45,6 +46,14 @@ public class UserInfoResponse {
this.fullName = fullName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getAvatarUrl() {
return avatarUrl;
}

View File

@@ -5,6 +5,7 @@ public class UserRequest {
private String password;
private String fullName;
private String email;
private String phone;
private String role;
private Boolean active;
@@ -43,6 +44,14 @@ public class UserRequest {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getRole() {
return role;
}

View File

@@ -7,6 +7,7 @@ public class UserResponse {
private String username;
private String fullName;
private String email;
private String phone;
private String role;
private Boolean active;
private LocalDateTime createdAt;
@@ -47,6 +48,14 @@ public class UserResponse {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getRole() {
return role;
}

View File

@@ -143,7 +143,7 @@ public class StaffAccountsController {
String firstName = names[0];
String lastName = names[1];
String email = user.getEmail() != null ? user.getEmail() : "";
String phone = "";
String phone = user.getPhone() != null ? user.getPhone() : "";
boolean active = user.getActive() != null ? user.getActive() : false;
Timestamp createdAt = user.getCreatedAt() != null
? Timestamp.from(user.getCreatedAt().atZone(ZoneId.systemDefault()).toInstant())

View File

@@ -11,6 +11,7 @@ import javafx.scene.control.TextField;
import javafx.stage.Stage;
import org.example.petshopdesktop.api.dto.user.UserRequest;
import org.example.petshopdesktop.api.endpoints.UserApi;
import org.example.petshopdesktop.Validator;
import org.example.petshopdesktop.util.ActivityLogger;
public class StaffRegisterDialogController {
@@ -49,6 +50,7 @@ public class StaffRegisterDialogController {
String firstName = value(txtFirstName);
String lastName = value(txtLastName);
String email = value(txtEmail);
String phone = value(txtPhone);
String username = value(txtUsername);
String password = txtPassword.getText() == null ? "" : txtPassword.getText();
String confirm = txtPasswordConfirm.getText() == null ? "" : txtPasswordConfirm.getText();
@@ -61,6 +63,15 @@ public class StaffRegisterDialogController {
lblError.setText("Email is required.");
return;
}
if (phone.isBlank()) {
lblError.setText("Phone is required.");
return;
}
String phoneError = Validator.isValidPhoneNumber(phone, "Phone");
if (!phoneError.isEmpty()) {
lblError.setText(phoneError.trim());
return;
}
if (username.isBlank()) {
lblError.setText("Username is required.");
return;
@@ -83,6 +94,7 @@ public class StaffRegisterDialogController {
request.setPassword(password);
request.setFullName(firstName + " " + lastName);
request.setEmail(email);
request.setPhone(phone);
request.setRole("STAFF");
request.setActive(true);