]> git.mxchange.org Git - jjobs-war.git/blobdiff - web/admin/contact/admin_contact_list.xhtml
Please cherry-pick:
[jjobs-war.git] / web / admin / contact / admin_contact_list.xhtml
index 6e6879cceb45d0c3df038474224f4a7345b0c901..9eb72bd3cff854172765616106c550adc9106370 100644 (file)
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html
-       lang="#{localizationController.language}" xml:lang="#{localizationController.language}"
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+       template="/WEB-INF/templates/admin/admin_base.tpl"
        xmlns="http://www.w3.org/1999/xhtml"
+       xmlns:core="http://mxchange.org/jsf/core/widgets"
+       xmlns:links="http://mxchange.org/jsf/core/links"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
        xmlns:h="http://xmlns.jcp.org/jsf/html"
        xmlns:f="http://xmlns.jcp.org/jsf/core"
+       xmlns:p="http://primefaces.org/ui"
        >
 
-       <ui:composition template="/WEB-INF/templates/admin/admin_base.tpl">
-               <ui:define name="admin_title">
-                       <h:outputText value="#{msg.PAGE_TITLE_ADMIN_LIST_CONTACT}" />
-               </ui:define>
-
-               <ui:define name="content_header">
-                       <h:outputText value="#{msg.CONTENT_TITLE_ADMIN_LIST_CONTACT}" />
-               </ui:define>
-
-               <ui:define name="content">
-                       <h:outputText styleClass="errors" value="#{msg.ADMIN_CONTACT_LIST_EMPTY}"rendered="#{userController.allUsers().isEmpty()}" />
-
-                       <h:dataTable id="table_list_contacts" var="contact" value="#{contactController.allContacts()}" styleClass="table_full" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_CONTACT}" rendered="#{not contactController.allContacts().isEmpty()}">
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_CONTACT_ID}" />
-                                       </f:facet>
-
-                                       <h:link outcome="admin_show_contact" title="#{msg.ADMIN_LINK_SHOW_CONTACT_TITLE}" value="#{contact.contactId}">
+       <ui:define name="document_admin_title">
+               <h:outputText value="#{msg.PAGE_TITLE_ADMIN_LIST_CONTACT}" />
+       </ui:define>
+
+       <ui:define name="content_header">
+               <h:outputText value="#{msg.CONTENT_TITLE_ADMIN_LIST_CONTACT}" />
+       </ui:define>
+
+       <ui:define name="content">
+               <h:form id="form-list-contacts">
+                       <p:dataTable
+                               id="contactList"
+                               var="contact"
+                               value="#{contactListController.allContacts}"
+                               paginator="true"
+                               paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
+                               filteredValue="#{contactListController.filteredContacts}"
+                               rows="10"
+                               rowKey="#{contact.contactId}"
+                               reflow="true"
+                               resizableColumns="true"
+                               rowsPerPageTemplate="5,10,20,50,100"
+                               sortMode="multiple"
+                               summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_CONTACT}"
+                               emptyMessage="#{msg.ADMIN_EMPTY_LIST_CONTACT}"
+                               widgetVar="contactList"
+                               selectionMode="single"
+                               selection="#{contactListController.selectedContact}"
+                               skipChildren="true"
+                               >
+
+                               <f:facet name="header">
+                                       <p:panelGrid
+                                               columns="3"
+                                               layout="grid"
+                                               columnClasses="ui-grid-col-4,ui-grid-col-6,ui-grid-col-2"
+                                               >
+                                               <p:spacer />
+
+                                               <p:panelGrid
+                                                       columns="2"
+                                                       columnClasses="ui-grid-4,ui-grid-8"
+                                                       layout="grid"
+                                                       styleClass="ui-noborder"
+                                                       >
+                                                       <p:outputLabel for="globalFilter" value="#{msg.SEARCH_ALL_FIELDS}" style="float: right" />
+                                                       <p:inputText id="globalFilter" onkeyup="PF('contactList').filter()" placeholder="#{msg.ENTER_KEYWORD}"/>
+                                               </p:panelGrid>
+
+                                               <p:outputPanel>
+                                                       <p:spacer height="4" />
+
+                                                       <p:commandButton
+                                                               id="toggler"
+                                                               type="button"
+                                                               value="#{msg.SELECT_SHOWN_COLUMNS}"
+                                                               styleClass="column-selector"
+                                                               />
+
+                                                       <p:columnToggler datasource="contactList" trigger="toggler" />
+                                               </p:outputPanel>
+                                       </p:panelGrid>
+                               </f:facet>
+
+                               <p:ajax
+                                       event="rowSelect"
+                                       update=":master:form-list-contacts:contact-details"
+                                       oncomplete="PF('contactDialog').show()"
+                                       />
+
+                               <p:column
+                                       headerText="#{msg.ID_HEADER}"
+                                       sortBy="#{contact.contactId}"
+                                       filterable="false"
+                                       >
+                                       <p:link
+                                               outcome="admin_show_contact"
+                                               value="#{contact.contactId}"
+                                               title="#{msg.ADMIN_LINK_SHOW_CONTACT_DATA_TITLE}"
+                                               >
                                                <f:param name="contactId" value="#{contact.contactId}" />
-                                       </h:link>
-                               </h:column>
-
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_CONTACT_GENDER}" />
+                                       </p:link>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ADMIN_CONTACT_PERSONAL_TITLE}"
+                                       sortBy="#{contact.contactPersonalTitle}"
+                                       filterBy="#{contact.contactPersonalTitle}"
+                                       filterMatchMode="exact"
+                                       >
+                                       <f:facet name="filter">
+                                               <p:selectOneMenu onchange="PF('contactList').filter()">
+                                                       <f:converter converterId="PersonalTitleConverter" />
+                                                       <f:selectItem itemLabel="#{msg.CHOICE_ALL}" itemValue="#{null}" />
+                                                       <f:selectItems
+                                                               value="#{dataController.personalTitles}"
+                                                               var="personalTitle"
+                                                               itemValue="#{personalTitle}"
+                                                               itemLabel="#{msg[personalTitle.messageKey]}"
+                                                               />
+                                               </p:selectOneMenu>
                                        </f:facet>
-
-                                       <h:outputText value="#{msg[contact.contactGender.messageKey]}" />
-                               </h:column>
-
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_CONTACT_FIRST_NAME}" />
-                                       </f:facet>
-
+                                       <h:outputText value="#{msg[contact.contactPersonalTitle.messageKey]}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ADMIN_CONTACT_FIRST_NAME}"
+                                       sortBy="#{contact.contactFirstName}"
+                                       filterBy="#{contact.contactFirstName}"
+                                       filterMatchMode="contains"
+                                       >
                                        <h:outputText value="#{contact.contactFirstName}" />
-                               </h:column>
-
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_CONTACT_FAMILY_NAME}" />
-                                       </f:facet>
-
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ADMIN_CONTACT_FAMILY_NAME}"
+                                       sortBy="#{contact.contactFamilyName}"
+                                       filterBy="#{contact.contactFamilyName}"
+                                       filterMatchMode="contains"
+                                       >
                                        <h:outputText value="#{contact.contactFamilyName}" />
-                               </h:column>
-
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_CONTACT_USAGE}" />
-                                       </f:facet>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_CREATED_HEADER}"
+                                       sortBy="#{contact.contactCreated}"
+                                       filterBy="#{contact.contactCreated}"
+                                       filterMatchMode="contains"
+                                       >
+                                       <h:outputText value="#{contact.contactCreated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_UPDATED_HEADER}"
+                                       sortBy="#{contact.contactUpdated}"
+                                       filterBy="#{contact.contactUpdated}"
+                                       filterMatchMode="contains"
+                                       >
+                                       <h:outputText value="#{contact.contactUpdated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
 
+                               <p:column
+                                       headerText="#{msg.ADMIN_CONTACT_USAGE}"
+                                       sortable="false"
+                                       filterable="false"
+                                       >
                                        <h:outputText value="#{msg[beanHelper.getContactUsageMessageKey(contact)]}" />
-                               </h:column>
-
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_CONTACT_CREATED}" />
-                                       </f:facet>
-
-                                       <h:outputText id="contactCreated" value="#{contact.contactCreated.time}">
-                                               <f:convertDateTime for="contactCreated" type="both" timeStyle="short" dateStyle="short" />
-                                       </h:outputText>
-                               </h:column>
-                       </h:dataTable>
-
-                       <h:form id="form_admin_add_contact">
-                               <h:panelGroup styleClass="table_medium" layout="block">
-                                       <div class="table_header">
-                                               <h:outputText value="#{msg.ADMIN_ADD_CONTACT_TITLE}" />
-                                       </div>
-
-                                       <div class="para">
-                                               <h:outputText value="#{msg.ADMIN_ADD_CONTACT_MINIMUM_DATA}" />
-                                       </div>
-
-                                       <ui:include src="/WEB-INF/templates/admin/contact/admin_form_contact_data.tpl" />
-
-                                       <div class="table_footer">
-                                               <h:commandButton styleClass="reset right_space" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
-                                               <h:commandButton styleClass="submit" type="submit" id="add_contact" value="#{msg.BUTTON_ADMIN_ADD_CONTACT}" action="#{adminContactController.addContact()}" />
-                                       </div>
-                               </h:panelGroup>
-                       </h:form>
-               </ui:define>
-       </ui:composition>
-</html>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ADMIN_ACTION_LINKS_HEADER}"
+                                       sortable="false"
+                                       filterable="false"
+                                       >
+                                       <links:outputContactAdminDropdownMenu contact="#{contact}" />
+                               </p:column>
+                       </p:dataTable>
+
+                       <p:dialog
+                               dynamic="true"
+                               modal="true"
+                               resizable="false"
+                               header="#{msg.ADMIN_SINGLE_CONTACT_DETAILS_HEADER}"
+                               hideEffect="fade"
+                               showEffect="fade"
+                               widgetVar="contactDialog"
+                               position="top"
+                               responsive="true"
+                               closeOnEscape="true"
+                               >
+                               <p:outputPanel id="contact-details">
+                                       <p:panelGrid columns="2" rendered="#{not empty contactListController.selectedContact}">
+                                               <f:facet name="header">
+                                                       <h:outputFormat value="#{msg.ADMIN_CONTACT_DETAILS_HEADER}">
+                                                               <f:param value="#{msg[contactListController.selectedContact.contactPersonalTitle.messageKey]}" />
+                                                               <f:param value="#{contactListController.selectedContact.contactFirstName}" />
+                                                               <f:param value="#{contactListController.selectedContact.contactFamilyName}" />
+                                                               <f:param value="#{contactListController.selectedContact.contactId}" />
+                                                       </h:outputFormat>
+                                               </f:facet>
+
+                                               <p:outputLabel value="#{msg.ID_HEADER}" title="#{msg.CONTACT_ID_NUMBER_TITLE}" />
+                                               <h:outputText value="#{contactListController.selectedContact.contactId}" />
+                                       </p:panelGrid>
+                               </p:outputPanel>
+                       </p:dialog>
+               </h:form>
+
+               <h:form>
+                       <p:panelGrid
+                               columns="1"
+                               layout="grid"
+                               >
+                               <f:facet name="header">
+                                       <h:outputText value="#{msg.ADMIN_ADD_CONTACT_TITLE}" />
+                               </f:facet>
+
+                               <h:outputText value="#{msg.ADMIN_ADD_CONTACT_MINIMUM_DATA}" />
+
+                               <core:outputAdminContactDataFormFields allowEmptyRequiredData="true" />
+
+                               <f:facet name="footer">
+                                       <p:panelGrid columns="2" layout="grid">
+                                               <p:commandButton
+                                                       styleClass="reset"
+                                                       type="reset"
+                                                       value="#{msg.BUTTON_RESET_FORM}"
+                                                       />
+                                               <p:commandButton
+                                                       type="submit"
+                                                       value="#{msg.BUTTON_ADMIN_ADD_CONTACT}"
+                                                       action="#{adminContactController.addContact()}"
+                                                       update=":master:form-list-contacts:contactList"
+                                                       />
+                                       </p:panelGrid>
+                               </f:facet>
+                       </p:panelGrid>
+               </h:form>
+       </ui:define>
+</ui:composition>