use user phone
This commit is contained in:
@@ -5,6 +5,7 @@ public class UserInfoResponse {
|
|||||||
private String username;
|
private String username;
|
||||||
private String email;
|
private String email;
|
||||||
private String fullName;
|
private String fullName;
|
||||||
|
private String phone;
|
||||||
private String avatarUrl;
|
private String avatarUrl;
|
||||||
private String role;
|
private String role;
|
||||||
private Long storeId;
|
private Long storeId;
|
||||||
@@ -45,6 +46,14 @@ public class UserInfoResponse {
|
|||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAvatarUrl() {
|
public String getAvatarUrl() {
|
||||||
return avatarUrl;
|
return avatarUrl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ public class UserRequest {
|
|||||||
private String password;
|
private String password;
|
||||||
private String fullName;
|
private String fullName;
|
||||||
private String email;
|
private String email;
|
||||||
|
private String phone;
|
||||||
private String role;
|
private String role;
|
||||||
private Boolean active;
|
private Boolean active;
|
||||||
|
|
||||||
@@ -43,6 +44,14 @@ public class UserRequest {
|
|||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRole() {
|
public String getRole() {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class UserResponse {
|
|||||||
private String username;
|
private String username;
|
||||||
private String fullName;
|
private String fullName;
|
||||||
private String email;
|
private String email;
|
||||||
|
private String phone;
|
||||||
private String role;
|
private String role;
|
||||||
private Boolean active;
|
private Boolean active;
|
||||||
private LocalDateTime createdAt;
|
private LocalDateTime createdAt;
|
||||||
@@ -47,6 +48,14 @@ public class UserResponse {
|
|||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
public String getRole() {
|
public String getRole() {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ public class StaffAccountsController {
|
|||||||
String firstName = names[0];
|
String firstName = names[0];
|
||||||
String lastName = names[1];
|
String lastName = names[1];
|
||||||
String email = user.getEmail() != null ? user.getEmail() : "";
|
String email = user.getEmail() != null ? user.getEmail() : "";
|
||||||
String phone = "";
|
String phone = user.getPhone() != null ? user.getPhone() : "";
|
||||||
boolean active = user.getActive() != null ? user.getActive() : false;
|
boolean active = user.getActive() != null ? user.getActive() : false;
|
||||||
Timestamp createdAt = user.getCreatedAt() != null
|
Timestamp createdAt = user.getCreatedAt() != null
|
||||||
? Timestamp.from(user.getCreatedAt().atZone(ZoneId.systemDefault()).toInstant())
|
? Timestamp.from(user.getCreatedAt().atZone(ZoneId.systemDefault()).toInstant())
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import javafx.scene.control.TextField;
|
|||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.example.petshopdesktop.api.dto.user.UserRequest;
|
import org.example.petshopdesktop.api.dto.user.UserRequest;
|
||||||
import org.example.petshopdesktop.api.endpoints.UserApi;
|
import org.example.petshopdesktop.api.endpoints.UserApi;
|
||||||
|
import org.example.petshopdesktop.Validator;
|
||||||
import org.example.petshopdesktop.util.ActivityLogger;
|
import org.example.petshopdesktop.util.ActivityLogger;
|
||||||
|
|
||||||
public class StaffRegisterDialogController {
|
public class StaffRegisterDialogController {
|
||||||
@@ -49,6 +50,7 @@ public class StaffRegisterDialogController {
|
|||||||
String firstName = value(txtFirstName);
|
String firstName = value(txtFirstName);
|
||||||
String lastName = value(txtLastName);
|
String lastName = value(txtLastName);
|
||||||
String email = value(txtEmail);
|
String email = value(txtEmail);
|
||||||
|
String phone = value(txtPhone);
|
||||||
String username = value(txtUsername);
|
String username = value(txtUsername);
|
||||||
String password = txtPassword.getText() == null ? "" : txtPassword.getText();
|
String password = txtPassword.getText() == null ? "" : txtPassword.getText();
|
||||||
String confirm = txtPasswordConfirm.getText() == null ? "" : txtPasswordConfirm.getText();
|
String confirm = txtPasswordConfirm.getText() == null ? "" : txtPasswordConfirm.getText();
|
||||||
@@ -61,6 +63,15 @@ public class StaffRegisterDialogController {
|
|||||||
lblError.setText("Email is required.");
|
lblError.setText("Email is required.");
|
||||||
return;
|
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()) {
|
if (username.isBlank()) {
|
||||||
lblError.setText("Username is required.");
|
lblError.setText("Username is required.");
|
||||||
return;
|
return;
|
||||||
@@ -83,6 +94,7 @@ public class StaffRegisterDialogController {
|
|||||||
request.setPassword(password);
|
request.setPassword(password);
|
||||||
request.setFullName(firstName + " " + lastName);
|
request.setFullName(firstName + " " + lastName);
|
||||||
request.setEmail(email);
|
request.setEmail(email);
|
||||||
|
request.setPhone(phone);
|
||||||
request.setRole("STAFF");
|
request.setRole("STAFF");
|
||||||
request.setActive(true);
|
request.setActive(true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user