From 3895b1bae62cde403c7b7259b1792bfe4824fc99 Mon Sep 17 00:00:00 2001 From: Renan Soares Date: Wed, 22 Jan 2025 22:09:23 -0300 Subject: [PATCH 1/3] Addition of a filter search bar in clients, secretaries and services class --- .../gerenciamento/ClienteController.java | 37 ++++++++++++++++- .../gerenciamento/SecretarioController.java | 28 ++++++++++--- .../gerenciamento/ServicoController.java | 40 ++++++++++++++++--- .../fxml/gerenciamento/clientes.fxml | 6 ++- .../fxml/gerenciamento/secretarios.fxml | 6 ++- .../fxml/gerenciamento/servicos.fxml | 6 ++- 6 files changed, 107 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ClienteController.java b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ClienteController.java index 392695b..3aae372 100644 --- a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ClienteController.java +++ b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ClienteController.java @@ -15,6 +15,7 @@ import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.collections.transformation.FilteredList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; @@ -53,10 +54,15 @@ public class ClienteController implements Initializable { @FXML private TableColumn acaoColumn; + @FXML + private TextField filterField; + private ClienteRepository clienteRepository = new ClienteRepository(); private ObservableList clientesList = FXCollections.observableArrayList(); + private FilteredList filteredData; + @Override public void initialize(URL url, ResourceBundle resourceBundle) { tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY_ALL_COLUMNS); @@ -82,6 +88,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) { configurarColunaAcao(); atualizarTableView(); + configurarBuscaClientes(); // apos atualizarTableView() } private void configurarColunaAcao() { @@ -268,10 +275,36 @@ private void abrirPaginaVerPets(Cliente cliente) { } public void atualizarTableView() { - clientesList = FXCollections.observableArrayList(clienteRepository.findAll()); - tableView.setItems(clientesList); + clientesList.setAll(clienteRepository.findAll()); + } + + private void configurarBuscaClientes() { + filteredData = new FilteredList<>(clientesList, p -> true); + + filterField.textProperty().addListener((observable, oldValue, newValue) -> { + filteredData.setPredicate(cliente -> { + if (newValue == null || newValue.isEmpty()) { + return true; + } + String lowerCaseFilter = newValue.toLowerCase(); + + // Verificando se o nome do cliente ou telefone contém o termo de busca + boolean matchesCliente = cliente.getNome().toLowerCase().contains(lowerCaseFilter) || + cliente.getTelefone().toLowerCase().contains(lowerCaseFilter); + + // Verificando se algum nome de pet contém o termo de busca + boolean matchesPet = cliente.getPets().stream() + .anyMatch(pet -> pet.getNome().toLowerCase().contains(lowerCaseFilter)); + + // Retorna true se qualquer um dos campos for um match + return matchesCliente || matchesPet; + }); + }); + + tableView.setItems(filteredData); } + public void handleSuccessfulOperation(String message) { FeedbackManager.showFeedback( feedbackContainer, diff --git a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/SecretarioController.java b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/SecretarioController.java index 903f690..a22c87e 100644 --- a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/SecretarioController.java +++ b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/SecretarioController.java @@ -9,6 +9,7 @@ import javafx.beans.binding.DoubleBinding; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.collections.transformation.FilteredList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; @@ -16,10 +17,7 @@ import javafx.geometry.Pos; import javafx.scene.Parent; import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.TableCell; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableView; +import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.HBox; import javafx.stage.Modality; @@ -45,10 +43,15 @@ public class SecretarioController implements Initializable { @FXML private TableColumn acaoColumn; // Ação + @FXML + private TextField filterField; + private SecretarioRepository secretarioRepository = new SecretarioRepository(); private ObservableList secretariosList; + private FilteredList filteredData; + @Override public void initialize(URL url, ResourceBundle resourceBundle) { @@ -71,11 +74,13 @@ public void initialize(URL url, ResourceBundle resourceBundle) { configurarColunaAcao(); atualizarTableView(); + configurarBuscaClientes(); } public void atualizarTableView() { secretariosList = FXCollections.observableArrayList(secretarioRepository.findAll()); - tableView.setItems(secretariosList); + filteredData = new FilteredList<>(secretariosList, p -> true); + tableView.setItems(filteredData); } private void configurarColunaAcao() { @@ -201,6 +206,19 @@ private void abrirModalExcluir(Long secretarioId) { } } + private void configurarBuscaClientes() { + filterField.textProperty().addListener((observable, oldValue, newValue) -> { + filteredData.setPredicate(secretario -> { + if (newValue == null || newValue.isEmpty()) { + return true; + } + String lowerCaseFilter = newValue.toLowerCase(); + return secretario.getNomeUsuario().toLowerCase().contains(lowerCaseFilter) + || secretario.getTelefone().toLowerCase().contains(lowerCaseFilter); + }); + }); + } + public void handleSuccessfulOperation(String message) { FeedbackManager.showFeedback( feedbackContainer, diff --git a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ServicoController.java b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ServicoController.java index 0867f9c..f9033c5 100644 --- a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ServicoController.java +++ b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ServicoController.java @@ -8,6 +8,7 @@ import javafx.beans.binding.DoubleBinding; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.collections.transformation.FilteredList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; @@ -15,10 +16,7 @@ import javafx.geometry.Pos; import javafx.scene.Parent; import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.TableCell; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableView; +import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.HBox; import javafx.stage.Modality; @@ -48,10 +46,15 @@ public class ServicoController implements Initializable { @FXML private TableColumn acaoColumn; + @FXML + private TextField filterField; + private ServicoRepository servicoRepository = new ServicoRepository(); private ObservableList servicosList = FXCollections.observableArrayList(); + private FilteredList filteredData; + @Override public void initialize(URL url, ResourceBundle resourceBundle) { tableView.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY_ALL_COLUMNS); @@ -219,10 +222,35 @@ private void abrirModalExcluir(Long servicoId) { } public void atualizarTableView() { - servicosList = FXCollections.observableArrayList(servicoRepository.findAll()); - tableView.setItems(servicosList); + servicosList.setAll(servicoRepository.findAll()); // Atualiza a lista com os serviços + configurarBuscaServicos(); // Configura a busca + } + + private void configurarBuscaServicos() { + filteredData = new FilteredList<>(servicosList, p -> true); + + filterField.textProperty().addListener((observable, oldValue, newValue) -> { + filteredData.setPredicate(servico -> { + if (newValue == null || newValue.isEmpty()) { + return true; // Se o campo de busca estiver vazio, mostra todos os serviços + } + String lowerCaseFilter = newValue.toLowerCase(); + + // Verificando se o nome do serviço, descrição ou preço contém o termo de busca + boolean matchesNome = servico.getNomeServico().toLowerCase().contains(lowerCaseFilter); + boolean matchesDescricao = servico.getDescricao() != null && servico.getDescricao().toLowerCase().contains(lowerCaseFilter); + boolean matchesPreco = servico.getValorServico().toString().contains(newValue); // Comparando com o preço + + // Retorna true se qualquer um dos campos for um match + return matchesNome || matchesDescricao || matchesPreco; + }); + }); + + tableView.setItems(filteredData); // Aplica a lista filtrada à tabela } + + public void handleSuccessfulOperation(String message) { FeedbackManager.showFeedback( feedbackContainer, diff --git a/src/main/resources/fxml/gerenciamento/clientes.fxml b/src/main/resources/fxml/gerenciamento/clientes.fxml index e12efc3..9316a3c 100644 --- a/src/main/resources/fxml/gerenciamento/clientes.fxml +++ b/src/main/resources/fxml/gerenciamento/clientes.fxml @@ -6,6 +6,7 @@ + @@ -30,7 +31,10 @@ - + + + + diff --git a/src/main/resources/fxml/gerenciamento/secretarios.fxml b/src/main/resources/fxml/gerenciamento/secretarios.fxml index de733ae..c5658cb 100644 --- a/src/main/resources/fxml/gerenciamento/secretarios.fxml +++ b/src/main/resources/fxml/gerenciamento/secretarios.fxml @@ -6,6 +6,7 @@ + @@ -30,7 +31,10 @@ - + + + + diff --git a/src/main/resources/fxml/gerenciamento/servicos.fxml b/src/main/resources/fxml/gerenciamento/servicos.fxml index 1b9c57f..2f93432 100644 --- a/src/main/resources/fxml/gerenciamento/servicos.fxml +++ b/src/main/resources/fxml/gerenciamento/servicos.fxml @@ -6,6 +6,7 @@ + @@ -30,7 +31,10 @@ - + + + + From ad6ed7c11e4b33bb86287f3620f907bc50b24dd2 Mon Sep 17 00:00:00 2001 From: Rian Lima Date: Sat, 25 Jan 2025 01:11:52 -0300 Subject: [PATCH 2/3] added style to search field. --- src/main/resources/META-INF/persistence.xml | 2 +- src/main/resources/css/style.css | 10 ++++++++++ .../resources/fxml/gerenciamento/clientes.fxml | 15 ++++++++------- .../resources/fxml/gerenciamento/secretarios.fxml | 7 ++++--- .../resources/fxml/gerenciamento/servicos.fxml | 5 +++-- src/main/resources/fxml/popup/feedback.fxml | 2 +- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index 6124802..fd56067 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -19,7 +19,7 @@ - + diff --git a/src/main/resources/css/style.css b/src/main/resources/css/style.css index a3d5d2f..ff65ba6 100644 --- a/src/main/resources/css/style.css +++ b/src/main/resources/css/style.css @@ -19,6 +19,16 @@ root { -fx-font-family: "Roboto", serif; } +.search_input { + -fx-font-family: "Roboto", serif; + -fx-font-weight: 400; + -fx-font-style: normal; + -fx-font-size: 18px; + -fx-background-color: white; + -fx-border-color: #CCCCCC; + -fx-border-radius: 5px; +} + .default_text_input { -fx-font-family: "Roboto", serif; -fx-font-weight: 400; diff --git a/src/main/resources/fxml/gerenciamento/clientes.fxml b/src/main/resources/fxml/gerenciamento/clientes.fxml index 9316a3c..9c9e225 100644 --- a/src/main/resources/fxml/gerenciamento/clientes.fxml +++ b/src/main/resources/fxml/gerenciamento/clientes.fxml @@ -10,12 +10,12 @@ - + - + - + - - - - + + + + + diff --git a/src/main/resources/fxml/gerenciamento/secretarios.fxml b/src/main/resources/fxml/gerenciamento/secretarios.fxml index c5658cb..7c7ae30 100644 --- a/src/main/resources/fxml/gerenciamento/secretarios.fxml +++ b/src/main/resources/fxml/gerenciamento/secretarios.fxml @@ -32,9 +32,10 @@ - - - + + + + diff --git a/src/main/resources/fxml/gerenciamento/servicos.fxml b/src/main/resources/fxml/gerenciamento/servicos.fxml index 2f93432..47ffa5d 100644 --- a/src/main/resources/fxml/gerenciamento/servicos.fxml +++ b/src/main/resources/fxml/gerenciamento/servicos.fxml @@ -33,8 +33,9 @@ - - + + + diff --git a/src/main/resources/fxml/popup/feedback.fxml b/src/main/resources/fxml/popup/feedback.fxml index e04e5da..1085009 100644 --- a/src/main/resources/fxml/popup/feedback.fxml +++ b/src/main/resources/fxml/popup/feedback.fxml @@ -6,7 +6,7 @@ - + From 641585cdc32d2e1361b686cdf33b64fe07162cc8 Mon Sep 17 00:00:00 2001 From: Rian Lima Date: Sat, 25 Jan 2025 18:28:52 -0300 Subject: [PATCH 3/3] fixed feedback toast error and added search field for pets table --- .../gerenciamento/AnimalController.java | 51 +++++--- .../gerenciamento/ClienteController.java | 21 +--- .../gerenciamento/SecretarioController.java | 17 ++- .../gerenciamento/ServicoController.java | 15 +-- .../mundoanimal/utils/FeedbackManager.java | 13 +- src/main/resources/META-INF/persistence.xml | 2 +- src/main/resources/css/style.css | 2 +- .../fxml/gerenciamento/clientes.fxml | 118 +++++++++++------- .../resources/fxml/gerenciamento/pets.fxml | 105 ++++++++++------ .../fxml/gerenciamento/secretarios.fxml | 101 +++++++++------ .../fxml/gerenciamento/servicos.fxml | 112 ++++++++++------- src/main/resources/fxml/popup/feedback.fxml | 2 +- 12 files changed, 345 insertions(+), 214 deletions(-) diff --git a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/AnimalController.java b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/AnimalController.java index 76f48ec..bbcd504 100644 --- a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/AnimalController.java +++ b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/AnimalController.java @@ -15,6 +15,8 @@ import javafx.beans.binding.DoubleBinding; import javafx.collections.FXCollections; import javafx.collections.ObservableList; +import javafx.collections.transformation.FilteredList; +import javafx.collections.transformation.SortedList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; @@ -22,10 +24,7 @@ import javafx.geometry.Pos; import javafx.scene.Parent; import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.control.TableCell; -import javafx.scene.control.TableColumn; -import javafx.scene.control.TableView; +import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.HBox; import javafx.stage.Modality; @@ -51,6 +50,14 @@ public class AnimalController implements Initializable { @FXML private TableColumn acaoColumn; + @FXML + private Label numberOfResults; + + @FXML + private TextField filterField; + + private FilteredList filteredData; + private Cliente cliente; // Dono dos pets que serão exibidos na tabela private ObservableList petsList = FXCollections.observableArrayList(); @@ -228,27 +235,43 @@ private void abrirModalExcluir(Long animalId) { } } - public void inicializarTabela() { - petsList.clear(); - petsList.addAll(cliente.getPets()); - tableView.setItems(petsList); + private void configurarBuscaPets() { + filteredData = new FilteredList<>(petsList, p -> true); + filterField.textProperty().addListener((observable, oldValue, newValue) -> { + filteredData.setPredicate(animal -> { + if (newValue == null || newValue.isEmpty()) { + return true; + } + String lowerCaseFilter = newValue.toLowerCase(); + boolean matchesNome = animal.getNome().toLowerCase().contains(lowerCaseFilter); + boolean matchesEspecie = animal.getEspecie().toString().toLowerCase().contains(lowerCaseFilter); + + return matchesNome || matchesEspecie; + }); + + SortedList sortedData = new SortedList<>(filteredData); + sortedData.comparatorProperty().bind(tableView.comparatorProperty()); + + tableView.setItems(sortedData); + numberOfResults.setText(filteredData.size() + " registro(s) retornado(s)"); + }); } public void voltarParaPaginaClientes() { + filterField.clear(); ScreenManagerHolder.getInstance().switchTo(ScreenEnum.CLIENTES); } public void setCliente(Cliente cliente) { this.cliente = cliente; + atualizarTableView(); + configurarBuscaPets(); } public void atualizarTableView() { - // Limpa a lista atual - petsList.clear(); - // Adiciona os pets atualizados - petsList.addAll(cliente.getPets()); - // Força um refresh na TableView - tableView.refresh(); + petsList.setAll(cliente.getPets()); + tableView.setItems(petsList); + numberOfResults.setText(petsList.size() + " registro(s) retornado(s)"); } public void handleSuccessfulOperation(String message) { diff --git a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ClienteController.java b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ClienteController.java index 3aae372..f330e5a 100644 --- a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ClienteController.java +++ b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ClienteController.java @@ -8,9 +8,6 @@ import com.carvalhotechsolutions.mundoanimal.repositories.ClienteRepository; import com.carvalhotechsolutions.mundoanimal.utils.FeedbackManager; import com.carvalhotechsolutions.mundoanimal.utils.ScreenManagerHolder; -import de.jensd.fx.glyphs.fontawesome.FontAwesomeIcon; -import javafx.animation.FadeTransition; -import javafx.animation.PauseTransition; import javafx.beans.binding.DoubleBinding; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; @@ -26,10 +23,8 @@ import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.HBox; -import javafx.scene.paint.Color; import javafx.stage.Modality; import javafx.stage.Stage; -import javafx.util.Duration; import java.io.IOException; import java.net.URL; @@ -54,6 +49,9 @@ public class ClienteController implements Initializable { @FXML private TableColumn acaoColumn; + @FXML + private Label numberOfResults; + @FXML private TextField filterField; @@ -269,42 +267,35 @@ private void abrirPaginaVerPets(Cliente cliente) { // Configurar o controlador do modal AnimalController animalController = ScreenManagerHolder.getInstance().getAnimalController(); animalController.setCliente(cliente); - animalController.inicializarTabela(); + animalController.atualizarTableView(); ScreenManagerHolder.getInstance().switchTo(ScreenEnum.PETS); } public void atualizarTableView() { clientesList.setAll(clienteRepository.findAll()); + numberOfResults.setText(clientesList.size() + " registro(s) retornado(s)"); } private void configurarBuscaClientes() { filteredData = new FilteredList<>(clientesList, p -> true); - filterField.textProperty().addListener((observable, oldValue, newValue) -> { filteredData.setPredicate(cliente -> { if (newValue == null || newValue.isEmpty()) { return true; } String lowerCaseFilter = newValue.toLowerCase(); - - // Verificando se o nome do cliente ou telefone contém o termo de busca boolean matchesCliente = cliente.getNome().toLowerCase().contains(lowerCaseFilter) || cliente.getTelefone().toLowerCase().contains(lowerCaseFilter); - - // Verificando se algum nome de pet contém o termo de busca boolean matchesPet = cliente.getPets().stream() .anyMatch(pet -> pet.getNome().toLowerCase().contains(lowerCaseFilter)); - - // Retorna true se qualquer um dos campos for um match return matchesCliente || matchesPet; }); + numberOfResults.setText(filteredData.size() + " registro(s) retornado(s)"); }); - tableView.setItems(filteredData); } - public void handleSuccessfulOperation(String message) { FeedbackManager.showFeedback( feedbackContainer, diff --git a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/SecretarioController.java b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/SecretarioController.java index a22c87e..2987089 100644 --- a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/SecretarioController.java +++ b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/SecretarioController.java @@ -31,6 +31,9 @@ public class SecretarioController implements Initializable { @FXML private HBox feedbackContainer; + @FXML + private Label numberOfResults; + @FXML private TableView tableView; @@ -48,7 +51,7 @@ public class SecretarioController implements Initializable { private SecretarioRepository secretarioRepository = new SecretarioRepository(); - private ObservableList secretariosList; + private ObservableList secretariosList = FXCollections.observableArrayList(); private FilteredList filteredData; @@ -74,13 +77,12 @@ public void initialize(URL url, ResourceBundle resourceBundle) { configurarColunaAcao(); atualizarTableView(); - configurarBuscaClientes(); + configurarBuscaSecretarios(); } public void atualizarTableView() { - secretariosList = FXCollections.observableArrayList(secretarioRepository.findAll()); - filteredData = new FilteredList<>(secretariosList, p -> true); - tableView.setItems(filteredData); + secretariosList.setAll(secretarioRepository.findAll()); + numberOfResults.setText(secretariosList.size() + " registro(s) retornado(s)"); } private void configurarColunaAcao() { @@ -206,7 +208,8 @@ private void abrirModalExcluir(Long secretarioId) { } } - private void configurarBuscaClientes() { + private void configurarBuscaSecretarios() { + filteredData = new FilteredList<>(secretariosList, p -> true); filterField.textProperty().addListener((observable, oldValue, newValue) -> { filteredData.setPredicate(secretario -> { if (newValue == null || newValue.isEmpty()) { @@ -216,7 +219,9 @@ private void configurarBuscaClientes() { return secretario.getNomeUsuario().toLowerCase().contains(lowerCaseFilter) || secretario.getTelefone().toLowerCase().contains(lowerCaseFilter); }); + numberOfResults.setText(filteredData.size() + " registro(s) retornado(s)"); }); + tableView.setItems(filteredData); } public void handleSuccessfulOperation(String message) { diff --git a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ServicoController.java b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ServicoController.java index f9033c5..58a4540 100644 --- a/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ServicoController.java +++ b/src/main/java/com/carvalhotechsolutions/mundoanimal/controllers/gerenciamento/ServicoController.java @@ -31,6 +31,9 @@ public class ServicoController implements Initializable { @FXML private HBox feedbackContainer; + @FXML + private Label numberOfResults; + @FXML private TableView tableView; @@ -79,6 +82,7 @@ public void initialize(URL url, ResourceBundle resourceBundle) { configurarColunaValor(); configurarColunaAcao(); atualizarTableView(); + configurarBuscaServicos(); } private void configurarColunaAcao() { @@ -222,13 +226,12 @@ private void abrirModalExcluir(Long servicoId) { } public void atualizarTableView() { - servicosList.setAll(servicoRepository.findAll()); // Atualiza a lista com os serviços - configurarBuscaServicos(); // Configura a busca + servicosList.setAll(servicoRepository.findAll()); + numberOfResults.setText(servicosList.size() + " registro(s) retornado(s)"); } private void configurarBuscaServicos() { filteredData = new FilteredList<>(servicosList, p -> true); - filterField.textProperty().addListener((observable, oldValue, newValue) -> { filteredData.setPredicate(servico -> { if (newValue == null || newValue.isEmpty()) { @@ -244,13 +247,11 @@ private void configurarBuscaServicos() { // Retorna true se qualquer um dos campos for um match return matchesNome || matchesDescricao || matchesPreco; }); + numberOfResults.setText(filteredData.size() + " registro(s) retornado(s)"); }); - - tableView.setItems(filteredData); // Aplica a lista filtrada à tabela + tableView.setItems(filteredData); } - - public void handleSuccessfulOperation(String message) { FeedbackManager.showFeedback( feedbackContainer, diff --git a/src/main/java/com/carvalhotechsolutions/mundoanimal/utils/FeedbackManager.java b/src/main/java/com/carvalhotechsolutions/mundoanimal/utils/FeedbackManager.java index 3cc4510..9a498c5 100644 --- a/src/main/java/com/carvalhotechsolutions/mundoanimal/utils/FeedbackManager.java +++ b/src/main/java/com/carvalhotechsolutions/mundoanimal/utils/FeedbackManager.java @@ -15,17 +15,19 @@ public class FeedbackManager { private static final String POPUP_FXML = "/fxml/popup/feedback.fxml"; public enum FeedbackType { - SUCCESS("CHECK_CIRCLE", "#43b554"), - ERROR("TIMES_CIRCLE", "#FF6F6F"), - WARNING("EXCLAMATION_CIRCLE", "#FFA500"), - INFO("INFO_CIRCLE", "#686AFF"); + SUCCESS("CHECK_CIRCLE", "#FFFFFF", "#43b554"), + ERROR("TIMES_CIRCLE", "#FFFFFF" ,"#FF6F6F"), + WARNING("EXCLAMATION_CIRCLE", "#FFFFFF" ,"#FFA500"), + INFO("INFO_CIRCLE", "#FFFFFF" ,"#686AFF"); private final String icon; private final String color; + private final String backgroundColor; - FeedbackType(String icon, String color) { + FeedbackType(String icon, String color, String backgroundColor) { this.icon = icon; this.color = color; + this.backgroundColor = backgroundColor; } } @@ -36,6 +38,7 @@ public static void showFeedback(HBox container, String message, FeedbackType typ // Configurar o estilo do popup popupContent.getStyleClass().add("popup"); + popupContent.setStyle(String.format("-fx-background-color: %s;", type.backgroundColor)); // Encontrar e configurar os componentes FontAwesomeIcon icon = (FontAwesomeIcon) popupContent.lookup("#icon"); diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml index fd56067..6124802 100644 --- a/src/main/resources/META-INF/persistence.xml +++ b/src/main/resources/META-INF/persistence.xml @@ -19,7 +19,7 @@ - + diff --git a/src/main/resources/css/style.css b/src/main/resources/css/style.css index ff65ba6..5981c6d 100644 --- a/src/main/resources/css/style.css +++ b/src/main/resources/css/style.css @@ -285,9 +285,9 @@ root { /* CSS POPUP - INÍCIO */ .popup { - -fx-background-color: white; -fx-background-radius: 5px; -fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.2), 10, 0, 0, 0); + -fx-font-weight: 800; } /* CSS POPUP - FIM */ \ No newline at end of file diff --git a/src/main/resources/fxml/gerenciamento/clientes.fxml b/src/main/resources/fxml/gerenciamento/clientes.fxml index 9c9e225..a6cf309 100644 --- a/src/main/resources/fxml/gerenciamento/clientes.fxml +++ b/src/main/resources/fxml/gerenciamento/clientes.fxml @@ -9,58 +9,84 @@ + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + + - - - + + + + - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/gerenciamento/pets.fxml b/src/main/resources/fxml/gerenciamento/pets.fxml index 8fc8dde..0ab5c0c 100644 --- a/src/main/resources/fxml/gerenciamento/pets.fxml +++ b/src/main/resources/fxml/gerenciamento/pets.fxml @@ -9,48 +9,79 @@ - - - - + + + - + + + + - + - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/fxml/gerenciamento/secretarios.fxml b/src/main/resources/fxml/gerenciamento/secretarios.fxml index 7c7ae30..04266ee 100644 --- a/src/main/resources/fxml/gerenciamento/secretarios.fxml +++ b/src/main/resources/fxml/gerenciamento/secretarios.fxml @@ -9,53 +9,78 @@ + - - - - + - + + + + - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - - - - - - - - - - - - - - - - - + + diff --git a/src/main/resources/fxml/gerenciamento/servicos.fxml b/src/main/resources/fxml/gerenciamento/servicos.fxml index 47ffa5d..9a43358 100644 --- a/src/main/resources/fxml/gerenciamento/servicos.fxml +++ b/src/main/resources/fxml/gerenciamento/servicos.fxml @@ -10,57 +10,83 @@ - - - - + + - + + + + - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/src/main/resources/fxml/popup/feedback.fxml b/src/main/resources/fxml/popup/feedback.fxml index 1085009..f07d128 100644 --- a/src/main/resources/fxml/popup/feedback.fxml +++ b/src/main/resources/fxml/popup/feedback.fxml @@ -12,7 +12,7 @@ -