]> git.mxchange.org Git - jjobs-war.git/blobdiff - web/admin/country/admin_country_list.xhtml
Please cherry-pick:
[jjobs-war.git] / web / admin / country / admin_country_list.xhtml
index a34b34060877ab4d5c75b9a5d0a4df939ca44f54..9cb7b3b93abc8bfc04e446a7bf9ad238608225e5 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: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">#{msg.PAGE_TITLE_ADMIN_LIST_COUNTRY}</ui:define>
+       <ui:define name="document_admin_title">
+               <h:outputText value="#{msg.PAGE_TITLE_ADMIN_LIST_COUNTRY}" />
+       </ui:define>
 
-               <ui:define name="content_header">
-                       #{msg.CONTENT_TITLE_ADMIN_LIST_COUNTRY}
-               </ui:define>
+       <ui:define name="content_header">
+               <h:outputText value="#{msg.CONTENT_TITLE_ADMIN_LIST_COUNTRY}" />
+       </ui:define>
 
-               <ui:define name="content">
-                       <h:dataTable id="table_list_countries" var="country" value="#{countryController.allCountries()}" styleClass="table_medium" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_COUNTRIES}" rendered="#{not countryController.allCountries().isEmpty()}">
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_ID}" />
-                                       </f:facet>
+       <ui:define name="content">
+               <h:form id="form-list-countries">
+                       <p:dataTable
+                               id="countryList"
+                               var="country"
+                               value="#{countryListController.allCountries}"
+                               paginator="true"
+                               paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
+                               filteredValue="#{countryListController.filteredCountries}"
+                               rows="10"
+                               rowKey="#{country.countryId}"
+                               reflow="true"
+                               resizableColumns="true"
+                               rowsPerPageTemplate="5,10,20,50,100"
+                               sortMode="multiple"
+                               summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_COUNTRY}"
+                               emptyMessage="#{msg.ADMIN_EMPTY_LIST_COUNTRY}"
+                               widgetVar="countryList"
+                               selectionMode="single"
+                               selection="#{countryListController.selectedCountry}"
+                               skipChildren="true"
+                               >
 
-                                       <h:link outcome="admin_edit_country" title="#{msg.ADMIN_LINK_EDIT_DELETE_COUNTRY_TITLE}" value="#{country.countryId}">
+                               <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('countryList').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="countryList" trigger="toggler" />
+                                               </p:outputPanel>
+                                       </p:panelGrid>
+                               </f:facet>
+
+                               <p:ajax
+                                       event="rowSelect"
+                                       update="form-list-countries:country-details"
+                                       oncomplete="PF('countryDialog').show()"
+                                       />
+
+                               <p:column
+                                       headerText="#{msg.ID_HEADER}"
+                                       sortBy="#{country.countryId}"
+                                       filterable="false"
+                                       >
+                                       <p:link
+                                               outcome="admin_show_country"
+                                               value="#{country.countryId}"
+                                               title="#{msg.ADMIN_LINK_SHOW_COUNTRY_TITLE}"
+                                               >
                                                <f:param name="countryId" value="#{country.countryId}" />
-                                       </h:link>
-                               </h:column>
+                                       </p:link>
+                               </p:column>
 
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_CODE}" />
-                                       </f:facet>
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_CODE}"
+                                       sortBy="#{country.countryCode}"
+                                       filterBy="#{country.countryCode}"
+                                       filterMatchMode="contains"
+                                       >
 
                                        <h:outputText value="#{country.countryCode}" />
-                               </h:column>
+                               </p:column>
 
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_EXTERNAL_DIAL_PREFIX}" />
-                                       </f:facet>
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_NAME}"
+                                       sortBy="#{msg[country.countryI18nKey]}"
+                                       filterBy="#{msg[country.countryI18nKey]}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{msg[country.countryI18nKey]}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_EXTERNAL_DIAL_PREFIX}"
+                                       sortBy="#{country.countryExternalDialPrefix}"
+                                       filterBy="#{country.countryExternalDialPrefix}"
+                                       filterMatchMode="contains"
+                                       >
 
                                        <h:outputText value="#{country.countryExternalDialPrefix}" />
-                               </h:column>
+                               </p:column>
 
-                               <h:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_NAME}" />
-                                       </f:facet>
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_ABROAD_DIAL_PREFIX}"
+                                       sortBy="#{country.countryAbroadDialPrefix}"
+                                       filterBy="#{country.countryAbroadDialPrefix}"
+                                       filterMatchMode="contains"
+                                       >
 
-                                       <h:outputText value="#{msg[country.countryI18nKey]}" />
-                               </h:column>
-                       </h:dataTable>
-
-                       <h:form id="form_add_country">
-                               <h:panelGroup styleClass="table_medium" layout="block">
-                                       <div class="table_header">
-                                               <h:outputText value="#{msg.ADMIN_ADD_COUNTRY_TITLE}" />
-                                       </div>
-
-                                       <ui:include src="/WEB-INF/templates/admin/country/admin_form_country_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_country" value="#{msg.BUTTON_ADMIN_ADD_COUNTRY}" action="#{adminCountryController.addCountry()}" />
-                                       </div>
-                               </h:panelGroup>
-
-                               <div class="para notice">
-                                       <h:outputText value="#{msg.ADMIN_ADD_COUNTRY_NOTICES}" />
-                                       <ul>
-                                               <li><h:outputText value="#{msg.ADMIN_ADD_COUNTRY_I18N_KEY_NOTICE}" /></li>
-                                       </ul>
+                                       <h:outputText value="#{country.countryAbroadDialPrefix}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.DATA_IS_REQUIRED}"
+                                       sortBy="#{country.countryIsLocalPrefixRequired}"
+                                       filterBy="#{country.countryIsLocalPrefixRequired}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{country.countryIsLocalPrefixRequired ? msg.CHOICE_YES : msg.CHOICE_NO}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_PHONE_CODE}"
+                                       sortBy="#{country.countryPhoneCode}"
+                                       filterBy="#{country.countryPhoneCode}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{country.countryPhoneCode}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_CREATED_HEADER}"
+                                       sortBy="#{country.countryEntryCreated}"
+                                       filterBy="#{country.countryEntryCreated}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{country.countryEntryCreated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_UPDATED_HEADER}"
+                                       sortBy="#{country.countryEntryUpdated}"
+                                       filterBy="#{country.countryEntryUpdated}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{country.countryEntryUpdated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ADMIN_ACTION_LINKS_HEADER}"
+                                       filterable="false"
+                                       sortable="false"
+                                       >
+                                       <p:menuButton value="#{msg.OPTIONS}">
+                                               <p:menuitem
+                                                       outcome="admin_show_country"
+                                                       value="#{msg.ADMIN_LINK_SHOW_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_SHOW_COUNTRY_TITLE}"
+                                                       >
+                                                       <f:param name="countryId" value="#{country.countryId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem
+                                                       outcome="admin_edit_country"
+                                                       value="#{msg.ADMIN_LINK_EDIT_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_EDIT_COUNTRY_TITLE}"
+                                                       >
+                                                       <f:param name="countryId" value="#{country.countryId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_delete_country">
+                                                       <h:outputText
+                                                               styleClass="link-danger"
+                                                               value="#{msg.ADMIN_LINK_DELETE_SHORT}"
+                                                               title="#{msg.ADMIN_LINK_DELETE_COUNTRY_TITLE}"
+                                                               />
+                                                       <f:param name="countryId" value="#{country.countryId}" />
+                                               </p:menuitem>
+                                       </p:menuButton>
+                               </p:column>
+                       </p:dataTable>
+
+                       <p:dialog
+                               dynamic="true"
+                               modal="true"
+                               resizable="false"
+                               header="#{msg.ADMIN_SINGLE_COUNTRY_DETAILS_HEADER}"
+                               hideEffect="fade"
+                               showEffect="fade"
+                               widgetVar="countryDialog"
+                               position="top"
+                               responsive="true"
+                               closeOnEscape="true"
+                               >
+                               <p:outputPanel id="country-details">
+                                       <p:panelGrid columns="2" rendered="#{not empty countryListController.selectedCountry}">
+                                               <f:facet name="header">
+                                                       <h:outputFormat value="#{msg.ADMIN_COUNTRY_DETAILS_HEADER}">
+                                                               <f:param value="#{msg[countryListController.selectedCountry.countryI18nKey]}" />
+                                                               <f:param value="#{countryListController.selectedCountry.countryId}" />
+                                                       </h:outputFormat>
+                                               </f:facet>
+
+                                               <p:outputLabel value="#{msg.ID_HEADER}" title="#{msg.COUNTRY_ID_NUMBER_TITLE}" />
+                                               <h:outputText value="#{countryListController.selectedCountry.countryId}" />
+                                       </p:panelGrid>
+                               </p:outputPanel>
+                       </p:dialog>
+               </h:form>
+
+               <h:form>
+                       <h:panelGroup layout="block">
+                               <div class="table-header">
+                                       <h:outputText value="#{msg.ADMIN_ADD_COUNTRY_TITLE}" />
                                </div>
-                       </h:form>
-               </ui:define>
-       </ui:composition>
-</html>
+
+                               <ui:include src="/WEB-INF/templates/admin/country/admin_form_country_data.tpl" />
+
+                               <p:panelGrid columns="2" layout="grid">
+                                       <p:commandButton
+                                               type="reset"
+                                               value="#{msg.BUTTON_RESET_FORM}"
+                                               />
+
+                                       <p:commandButton
+                                               type="submit"
+                                               value="#{msg.BUTTON_ADMIN_ADD_COUNTRY}"
+                                               action="#{adminCountryController.addCountry()}"
+                                               update="form-list-countries:countryList"
+                                               />
+                               </p:panelGrid>
+                       </h:panelGroup>
+
+                       <div class="para notice">
+                               <h:outputText value="#{msg.ADMIN_ADD_COUNTRY_NOTICES}" />
+                               <ul>
+                                       <li><h:outputText value="#{msg.ADMIN_ADD_COUNTRY_I18N_KEY_NOTICE}" /></li>
+                               </ul>
+                       </div>
+               </h:form>
+       </ui:define>
+</ui:composition>