Pequeña mejora

This commit is contained in:
Roberto Orden Erena
2019-12-28 23:06:32 +01:00
parent 2e0cc8bf36
commit 47caa1fc54
2 changed files with 29 additions and 25 deletions

View File

@@ -11,13 +11,11 @@
<ui:composition template="../header.xhtml"> <ui:composition template="../header.xhtml">
<ui:define name="content"> <ui:define name="content">
<h:form id="frmMT"> <h:form id="frmMT">
<p:messages id="mesgs" showDetail="true" closable="true"
autoupdate="true" />
<div class="ui-g ui-fluid"> <div class="ui-g ui-fluid">
<div class="ui-g-5 ui-md-5"> <div class="ui-g-5 ui-md-5">
<p:panel id="mainPanel" header="Pruebas médicas"> <p:panel id="mainPanel" header="Pruebas médicas">
<f:facet name="actions"> <f:facet name="actions">
<h:commandLink action="#{mt.addMT}" immediate="true" update="frmMT" rendered="#{mt.patIdSelected != -1}" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default"> <h:commandLink action="#{mt.addMT}" immediate="true" update="frmMT" styleClass="ui-panel-titlebar-icon ui-corner-all ui-state-default">
<h:outputText styleClass="ui-icon pi pi-plus" /> <h:outputText styleClass="ui-icon pi pi-plus" />
</h:commandLink> </h:commandLink>
</f:facet> </f:facet>

View File

@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.component.html.HtmlSelectOneMenu; import javax.faces.component.html.HtmlSelectOneMenu;
import javax.faces.event.AjaxBehaviorEvent; import javax.faces.event.AjaxBehaviorEvent;
import javax.faces.view.ViewScoped; import javax.faces.view.ViewScoped;
@@ -99,7 +100,8 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
public List<PatientTO> getPatients() { public List<PatientTO> getPatients() {
if (userType == UserType.SPECIALIST_DOCTOR) { if (userType == UserType.SPECIALIST_DOCTOR) {
// Cargar los pacientes a los que ha añadido pruebas médicas el médico especialista // Cargar los pacientes a los que ha añadido pruebas médicas el médico
// especialista
return getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID); return getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID);
} else if (userType == UserType.FAMILY_DOCTOR) { } else if (userType == UserType.FAMILY_DOCTOR) {
// Cargar los pacientes del médico de familia que tiene pruebas médicas hechas // Cargar los pacientes del médico de familia que tiene pruebas médicas hechas
@@ -120,6 +122,7 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
/*************************************************** METODOS PARA LA VISTA */ /*************************************************** METODOS PARA LA VISTA */
private Integer patIdSelected = -1; private Integer patIdSelected = -1;
public void setPatIdSelected(Integer value) { public void setPatIdSelected(Integer value) {
this.patIdSelected = value; this.patIdSelected = value;
this.addNewMode = false; this.addNewMode = false;
@@ -168,10 +171,14 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
} }
public void addMT() { public void addMT() {
if (this.patIdSelected != -1) {
this.selected = new MedicalTestTO(); this.selected = new MedicalTestTO();
this.selected.setId(-1); this.selected.setId(-1);
this.selected.setObservations(""); this.selected.setObservations("");
this.addNewMode = true; this.addNewMode = true;
} else {
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Atención!", "Debe elegir un paciente al que añadir la prueba médica.");
}
} }
public boolean isAddNewMode() { public boolean isAddNewMode() {
@@ -190,5 +197,4 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
return !addNewMode && this.selected != null; return !addNewMode && this.selected != null;
} }
} }