<?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:widgets="http://mxchange.org/jsf/core/widgets"
- xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
- xmlns:h="http://xmlns.jcp.org/jsf/html"
- xmlns:f="http://xmlns.jcp.org/jsf/core">
-
- <ui:define name="admin_title">
+<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:define name="document_admin_title">
<h:outputText value="#{msg.PAGE_TITLE_ADMIN_LIST_CONTACT}" />
</ui:define>
</ui:define>
<ui:define name="content">
- <widgets:outputMessageBox message="#{msg.ADMIN_CONTACT_LIST_EMPTY}" messageStyleClass="alert-danger" rendered="#{contactController.allContacts().isEmpty()}" />
+ <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"
+ >
- <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>
+ <p:panelGrid
+ columns="3"
+ layout="grid"
+ columnClasses="ui-grid-col-4,ui-grid-col-6,ui-grid-col-2"
+ >
+ <p:spacer />
- <h:link outcome="admin_show_contact" title="#{msg.ADMIN_LINK_SHOW_CONTACT_DATA_TITLE}" value="#{contact.contactId}">
- <f:param name="contactId" value="#{contact.contactId}" />
- </h:link>
- </h:column>
+ <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"
+ />
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{msg.ADMIN_CONTACT_PERSONAL_TITLE}" />
- </f:facet>
+ <p:inputText
+ id="globalFilter"
+ onkeyup="PF('contactList').filter()"
+ placeholder="#{msg.ENTER_KEYWORD}"
+ />
+ </p:panelGrid>
- <h:outputText value="#{msg[contact.contactPersonalTitle.messageKey]}" />
- </h:column>
+ <p:outputPanel>
+ <p:spacer height="4" />
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{msg.ADMIN_CONTACT_FIRST_NAME}" />
+ <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>
- <h:outputText value="#{contact.contactFirstName}" />
- </h:column>
+ <p:ajax
+ event="rowSelect"
+ update="form-list-contacts:contact-details"
+ oncomplete="PF('contactDialog').show()"
+ />
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{msg.ADMIN_CONTACT_FAMILY_NAME}" />
- </f:facet>
+ <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}" />
+ </p:link>
+ </p:column>
- <h:outputText value="#{contact.contactFamilyName}" />
- </h: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.contactPersonalTitle.messageKey]}" />
+ </p:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{msg.ADMIN_CONTACT_USAGE}" />
- </f:facet>
+ <p:column
+ headerText="#{msg.ADMIN_CONTACT_FIRST_NAME}"
+ sortBy="#{contact.contactFirstName}"
+ filterBy="#{contact.contactFirstName}"
+ filterMatchMode="contains"
+ >
+ <h:outputText value="#{contact.contactFirstName}" />
+ </p:column>
- <h:outputText value="#{msg[beanHelper.getContactUsageMessageKey(contact)]}" />
- </h:column>
+ <p:column
+ headerText="#{msg.ADMIN_CONTACT_FAMILY_NAME}"
+ sortBy="#{contact.contactFamilyName}"
+ filterBy="#{contact.contactFamilyName}"
+ filterMatchMode="contains"
+ >
+ <h:outputText value="#{contact.contactFamilyName}" />
+ </p:column>
- <h:column>
- <f:facet name="header">
- <h:outputText value="#{msg.ADMIN_CONTACT_CREATED}" />
- </f:facet>
+ <p:column
+ headerText="#{msg.ENTRY_CREATED_HEADER}"
+ sortBy="#{contact.contactEntryCreated}"
+ filterBy="#{contact.contactEntryCreated}"
+ filterMatchMode="contains"
+ >
+ <h:outputText value="#{contact.contactEntryCreated}">
+ <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+ </h:outputText>
+ </p:column>
- <h:outputText id="contactCreated" value="#{contact.contactCreated.time}">
- <f:convertDateTime for="contactCreated" type="both" timeStyle="short" dateStyle="short" />
- </h:outputText>
- </h:column>
- </h:dataTable>
+ <p:column
+ headerText="#{msg.ENTRY_UPDATED_HEADER}"
+ sortBy="#{contact.contactEntryUpdated}"
+ filterBy="#{contact.contactEntryUpdated}"
+ filterMatchMode="contains"
+ >
+ <h:outputText value="#{contact.contactEntryUpdated}">
+ <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+ </h:outputText>
+ </p:column>
- <h:form id="form_admin_add_contact">
- <h:panelGroup styleClass="table table-medium" layout="block">
- <div class="table-header">
+ <p:column
+ headerText="#{msg.ADMIN_CONTACT_USAGE}"
+ sortable="false"
+ filterable="false"
+ >
+ <h:outputText value="#{msg[beanHelper.getContactUsageMessageKey(contact)]}" />
+ </p:column>
+
+ <p:column
+ headerText="#{msg.ADMIN_ACTION_LINKS_HEADER}"
+ sortable="false"
+ filterable="false"
+ >
+ <p:menuButton value="#{msg.OPTIONS}">
+ <p:menuitem outcome="admin_show_contact" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_USER_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
+ <f:param name="contactId" value="#{contact.contactId}" />
+ </p:menuitem>
+
+ <p:menuitem outcome="admin_edit_contact" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_USER_TITLE}">
+ <f:param name="contactId" value="#{contact.contactId}" />
+ </p:menuitem>
+
+ <p:menuitem outcome="admin_delete_contact">
+ <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_CONTACT_TITLE}" />
+ <f:param name="contactId" value="#{contact.contactId}" />
+ </p:menuitem>
+ </p:menuButton>
+ </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}" />
- </div>
+ </f:facet>
- <div class="para">
- <h:outputText value="#{msg.ADMIN_ADD_CONTACT_MINIMUM_DATA}" />
- </div>
+ <h:outputText value="#{msg.ADMIN_ADD_CONTACT_MINIMUM_DATA}" />
- <widgets:outputAdminContactDataFormFields />
+ <ui:include src="/WEB-INF/templates/admin/contact/admin_form_contact_data.tpl" />
- <div class="table-footer">
- <h:commandButton styleClass="reset divider-right" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
- <h:commandButton styleClass="submit" type="submit" id="button_add_contact" value="#{msg.BUTTON_ADMIN_ADD_CONTACT}" action="#{adminContactController.addContact()}" />
- </div>
- </h:panelGroup>
+ <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="form-list-contacts:contactList"
+ />
+ </p:panelGrid>
+ </f:facet>
+ </p:panelGrid>
</h:form>
</ui:define>
</ui:composition>