Skip to content
usersEditing.xhtml 4.78 KiB
Newer Older
<?xml version="1.0" encoding="UTF-8" ?>
<ui:composition template="/WEB-INF/templates/master.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets" 
                xmlns:tsm_components="http://xmlns.jcp.org/jsf/composite/tsm_components">
    <ui:define name="title">TASMAN - Users Management</ui:define>
    <ui:define name="scripts">
        <h:outputScript library="js" name="ucd-editor.js"></h:outputScript>
    </ui:define>
    <ui:define name="content">
        <f:event listener="#{loggedInChecker.checkFromNonIndex()}" type="preRenderView" />
        <h:form id="main" rendered="#{user.admin}">

            <tsm_components:user_navbar />

            <div class="container">
                <div class="row">
                    <div class="col-sm-10 col-sm-offset-1">
                        <h1 class="text-center">Users Management</h1>
                        <br/>
                    </div>
                </div>

                <div class="form-horizontal">
                    <ui:repeat value="#{usersEditing.users}" var="u" varStatus="loop">
                        <div class="col-xs-8 col-xs-offset-2">
                            <div class="panel panel-default">
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-xs-1">
                                            <h:commandLink action="#{usersEditing.removeUser(loop.index)}" class="text-danger btn-lg pull-right">
                                                <span class="glyphicon glyphicon-trash"></span>
                                                <f:ajax execute="@form" render="@form" />
                                            </h:commandLink>
                                        </div>
                                        <div class="col-xs-11">
                                            <div class="form-group">
                                                <h:outputLabel class="control-label col-xs-3" for="username">Username</h:outputLabel>
                                                <div class="col-xs-6">
                                                    <h:inputText value="#{u.username}" class="form-control" id="username" />
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <h:outputLabel class="control-label col-xs-3" for="password">Password</h:outputLabel>
                                                <div class="col-xs-6">
                                                    <h:inputText value="#{u.password}" class="form-control" id="password" />
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <h:outputLabel class="control-label col-xs-3" for="role">Role</h:outputLabel>
                                                <div class="col-xs-6">
                                                    <h:inputText value="#{u.role}" class="form-control" id="role" />
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </ui:repeat>
                    <div class="row">
                        <div class="col-xs-8 col-xs-offset-3">
                            <h:commandLink action="#{usersEditing.addUser()}" class="btn btn-success">
                                <span class="glyphicon glyphicon-plus"></span>
                                Add user
                                <f:ajax execute="@form" render="@form" />
                            </h:commandLink>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-xs-6 col-xs-offset-3 text-center">
                            <br/><br/>
                            <h:commandLink action="#{usersEditing.save()}" class="btn btn-primary">
                                <span class="glyphicon glyphicon-floppy-disk"></span>
                                Save
                            </h:commandLink>
                        </div>
                    </div>
                </div>
            </div>
            
            <tsm_components:ucd_editor />
        </h:form>
    </ui:define>
</ui:composition>