]> 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 9bb415b3ed43caf754e9fd0674c70858259d5983..9cb7b3b93abc8bfc04e446a7bf9ad238608225e5 100644 (file)
@@ -1,11 +1,14 @@
 <?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">
+<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:define name="admin_title">
+       <ui:define name="document_admin_title">
                <h:outputText value="#{msg.PAGE_TITLE_ADMIN_LIST_COUNTRY}" />
        </ui:define>
 
        </ui:define>
 
        <ui:define name="content">
-               <h:dataTable id="table_list_countries" var="country" value="#{countryController.allCountries()}" styleClass="table table-medium" headerClass="table-header-column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_COUNTRIES}" rendered="#{not countryController.allCountries().isEmpty()}">
-                       <h:column>
+               <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"
+                               >
+
                                <f:facet name="header">
-                                       <h:outputText value="#{msg.ADMIN_ID_NUMBER}" />
-                               </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_edit_country" title="#{msg.ADMIN_LINK_EDIT_DELETE_COUNTRY_TITLE}" value="#{country.countryId}">
-                                       <f:param name="countryId" value="#{country.countryId}" />
-                               </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_LIST_COUNTRY_DATA_COUNTRY_CODE}" />
-                               </f:facet>
+                                                       <p:inputText
+                                                               id="globalFilter"
+                                                               onkeyup="PF('countryList').filter()"
+                                                               placeholder="#{msg.ENTER_KEYWORD}"
+                                                               />
+                                               </p:panelGrid>
 
-                               <h:outputText value="#{country.countryCode}" />
-                       </h:column>
+                                               <p:outputPanel>
+                                                       <p:spacer height="4" />
 
-                       <h:column>
-                               <f:facet name="header">
-                                       <h:outputText value="#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_EXTERNAL_DIAL_PREFIX}" />
+                                                       <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>
 
-                               <h:outputText value="#{country.countryExternalDialPrefix}" />
-                       </h:column>
+                               <p:ajax
+                                       event="rowSelect"
+                                       update="form-list-countries:country-details"
+                                       oncomplete="PF('countryDialog').show()"
+                                       />
 
-                       <h:column>
-                               <f:facet name="header">
-                                       <h:outputText value="#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_NAME}" />
-                               </f:facet>
+                               <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}" />
+                                       </p:link>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_CODE}"
+                                       sortBy="#{country.countryCode}"
+                                       filterBy="#{country.countryCode}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{country.countryCode}" />
+                               </p:column>
+
+                               <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}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_ABROAD_DIAL_PREFIX}"
+                                       sortBy="#{country.countryAbroadDialPrefix}"
+                                       filterBy="#{country.countryAbroadDialPrefix}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{country.countryAbroadDialPrefix}" />
+                               </p:column>
 
-                               <h:outputText value="#{msg[country.countryI18nKey]}" />
-                       </h:column>
-               </h:dataTable>
+                               <p:column
+                                       headerText="#{msg.DATA_IS_REQUIRED}"
+                                       sortBy="#{country.countryIsLocalPrefixRequired}"
+                                       filterBy="#{country.countryIsLocalPrefixRequired}"
+                                       filterMatchMode="contains"
+                                       >
 
-               <h:form id="form_add_country">
-                       <h:panelGroup styleClass="table table-medium" layout="block">
+                                       <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>
 
                                <ui:include src="/WEB-INF/templates/admin/country/admin_form_country_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_country" value="#{msg.BUTTON_ADMIN_ADD_COUNTRY}" action="#{adminCountryController.addCountry()}" />
-                               </div>
+                               <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">