|
|
|
|
@ -7,10 +7,13 @@
|
|
|
|
|
package analiseacidentestrabalho;
|
|
|
|
|
|
|
|
|
|
import com.sun.rave.web.ui.appbase.AbstractPageBean;
|
|
|
|
|
import com.sun.rave.web.ui.component.DropDown;
|
|
|
|
|
import com.sun.rave.web.ui.component.StaticText;
|
|
|
|
|
import db.AnalisesDataProvider;
|
|
|
|
|
import db.UtilizadoresDataProvider;
|
|
|
|
|
import global.Global;
|
|
|
|
|
import javax.faces.FacesException;
|
|
|
|
|
import javax.faces.component.html.HtmlPanelGrid;
|
|
|
|
|
import javax.faces.context.FacesContext;
|
|
|
|
|
import utils.JSFUtils;
|
|
|
|
|
import utils.Utils;
|
|
|
|
|
@ -43,6 +46,24 @@ public class Acesso extends AbstractPageBean {
|
|
|
|
|
public void setStWelcome(StaticText st) {
|
|
|
|
|
this.stWelcome = st;
|
|
|
|
|
}
|
|
|
|
|
private DropDown drpEstabelecimentos = new DropDown();
|
|
|
|
|
|
|
|
|
|
public DropDown getDrpEstabelecimentos() {
|
|
|
|
|
return drpEstabelecimentos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setDrpEstabelecimentos(DropDown dd) {
|
|
|
|
|
this.drpEstabelecimentos = dd;
|
|
|
|
|
}
|
|
|
|
|
private HtmlPanelGrid gridEstabelecimento = new HtmlPanelGrid();
|
|
|
|
|
|
|
|
|
|
public HtmlPanelGrid getGridEstabelecimento() {
|
|
|
|
|
return gridEstabelecimento;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setGridEstabelecimento(HtmlPanelGrid hpg) {
|
|
|
|
|
this.gridEstabelecimento = hpg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// </editor-fold>
|
|
|
|
|
|
|
|
|
|
@ -118,6 +139,16 @@ public class Acesso extends AbstractPageBean {
|
|
|
|
|
//System.out.println("NOME UNICODE : " + nomeUnicode);
|
|
|
|
|
String nomeHtml = Utils.unicodeToHTML( u.getNome() );
|
|
|
|
|
stWelcome.setText("Bem vindo(a) " + nomeHtml);
|
|
|
|
|
|
|
|
|
|
if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR)
|
|
|
|
|
{
|
|
|
|
|
initializeEstabelecimentos();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gridEstabelecimento.setRendered(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -200,9 +231,29 @@ public class Acesso extends AbstractPageBean {
|
|
|
|
|
switch(permissao.intValue())
|
|
|
|
|
{
|
|
|
|
|
case 1: //seguranca
|
|
|
|
|
return "form_seguranca";
|
|
|
|
|
return "form_seguranca";
|
|
|
|
|
case 2: //rh
|
|
|
|
|
return "form_rh";
|
|
|
|
|
case 3: //hs
|
|
|
|
|
return "form_hs";
|
|
|
|
|
return "form_hs";
|
|
|
|
|
case 6: //gestor
|
|
|
|
|
Integer estabelecimento = null;
|
|
|
|
|
if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR)
|
|
|
|
|
{
|
|
|
|
|
estabelecimento = (Integer) drpEstabelecimentos.getSelected();
|
|
|
|
|
// if(estabelecimento.intValue() == -1)
|
|
|
|
|
// {
|
|
|
|
|
// getSessionBean1().setMsg("Falta estabelecimento!");
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// u.setEstabelecimento(estabelecimento_outro);
|
|
|
|
|
u.setEstabelecimento_gestor(estabelecimento);
|
|
|
|
|
}
|
|
|
|
|
return "form_gestor";
|
|
|
|
|
case 7: //dir ger rh
|
|
|
|
|
return "form_dir_ger_rh";
|
|
|
|
|
case 8: //dir_siprp
|
|
|
|
|
return "form_dir_siprp";
|
|
|
|
|
default:
|
|
|
|
|
@ -223,8 +274,25 @@ public class Acesso extends AbstractPageBean {
|
|
|
|
|
|
|
|
|
|
Utilizador u = getSessionBean1().getCurrentUser();
|
|
|
|
|
// String curUser = "?user=" + u.getId().toString();
|
|
|
|
|
FacesContext fc = getFacesContext().getCurrentInstance();
|
|
|
|
|
Global.redirectToPlanos(fc, u);
|
|
|
|
|
FacesContext fc = getFacesContext().getCurrentInstance();
|
|
|
|
|
|
|
|
|
|
Integer estabelecimento = null;
|
|
|
|
|
if(u.getTipo().intValue() == Global.TIPO_UTILIZADOR_GESTOR)
|
|
|
|
|
{
|
|
|
|
|
estabelecimento = (Integer) drpEstabelecimentos.getSelected();
|
|
|
|
|
// if(estabelecimento.intValue() == -1)
|
|
|
|
|
// {
|
|
|
|
|
// getSessionBean1().setMsg("Falta estabelecimento!");
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// u.setEstabelecimento(estabelecimento_outro);
|
|
|
|
|
u.setEstabelecimento_gestor(estabelecimento);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Global.redirectToPlanos(fc, u);
|
|
|
|
|
|
|
|
|
|
// FacesContext fc = getFacesContext().getCurrentInstance();
|
|
|
|
|
// Utilizador u = getSessionBean1().getCurrentUser();
|
|
|
|
|
@ -240,6 +308,24 @@ public class Acesso extends AbstractPageBean {
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initializeEstabelecimentos()
|
|
|
|
|
{
|
|
|
|
|
AnalisesDataProvider adp = new AnalisesDataProvider();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
com.sun.rave.web.ui.model.Option[] listGestorOptions = adp.getEstabelecimentosGestorList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(true));
|
|
|
|
|
//listGestorOptions[0].setLabel("-Seleccionar-");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getSessionBean1().setEstabelecimentosGestorOptions( listGestorOptions );
|
|
|
|
|
drpEstabelecimentos.setSelected(new Integer(0));
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|