]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Thu, 2 Apr 2020 16:29:54 +0000 (18:29 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 2 Apr 2020 16:53:26 +0000 (18:53 +0200)
- rewrote admin-headquarters-list to have filters and sorting (newer approach)
- added p:panelGrid around reset/submit buttons, still administrative contact
  list is not being updated on record insert
- used beanHelper.renderEmployee() to render department leader (employee
  instance again)
- fixed some wrong references due to last rewrite for departments
- added missing i18n key

Signed-off-by: Roland Häder <roland@mxchange.org>
17 files changed:
src/java/org/mxchange/jjobs/beans/business/headquarter/JobsAdminHeadquarterWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/headquarter/JobsHeadquarterWebRequestBean.java
src/java/org/mxchange/jjobs/beans/business/headquarter/JobsHeadquarterWebRequestController.java
src/java/org/mxchange/jjobs/beans/business/headquarter/list/JobsHeadquarterListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/beans/business/headquarter/list/JobsHeadquarterListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jjobs/converter/business/headquarter/JobsHeadquarterConverter.java
src/java/org/mxchange/jjobs/converter/business/headquarters/JobsHeadquarterConverter.java
src/java/org/mxchange/jjobs/validator/business/headquarter/JobsHeadquarterCompanyNameValidator.java
src/java/org/mxchange/jjobs/validator/emailaddress/headquarter/JobsHeadquarterEmailAddressValidator.java
src/java/org/mxchange/localization/generic_de_DE.properties
src/java/org/mxchange/localization/generic_en_US.properties
web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl
web/WEB-INF/templates/admin/department/admin_form_department_data.tpl
web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl
web/admin/contact/admin_contact_list.xhtml
web/admin/department/admin_department_list.xhtml
web/admin/headquarter/admin_headquarter_list.xhtml

index 813d2cf5b6433febc0d48749c9b40514e29760e9..af5b9e155cacd0eed4126c0d4ecaa8c08d9cfa6c 100644 (file)
@@ -33,12 +33,12 @@ import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.headquarter.AdminHeadquarterSessionBeanRemote;
 import org.mxchange.jcontactsbusiness.model.headquarter.BusinessHeadquarter;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import org.mxchange.jcontactsbusiness.model.headquarter.Headquarters;
 import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jjobs.beans.BaseJobsBean;
+import org.mxchange.jjobs.beans.business.headquarter.list.JobsHeadquarterListWebViewController;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
@@ -107,12 +107,6 @@ public class JobsAdminHeadquarterWebRequestBean extends BaseJobsBean implements
         */
        private Employable headquarterContactEmployee;
 
-       /**
-        * A general headquarter controller (backing bean)
-        */
-       @Inject
-       private JobsHeadquarterWebRequestController headquarterController;
-
        /**
         * Country
         */
@@ -138,6 +132,12 @@ public class JobsAdminHeadquarterWebRequestBean extends BaseJobsBean implements
         */
        private Short headquarterLastHouseNumber;
 
+       /**
+        * A general headquarter controller (backing bean)
+        */
+       @Inject
+       private JobsHeadquarterListWebViewController headquarterListController;
+
        /**
         * Store
         */
@@ -222,7 +222,7 @@ public class JobsAdminHeadquarterWebRequestBean extends BaseJobsBean implements
                final Headquarter headquarter = this.createHeadquarter();
 
                // Is the headquarter not created yet?
-               if (this.isHeadquarterCreatedByRequiredData(headquarter)) {
+               if (this.headquarterListController.isHeadquarterCreatedByRequiredData(headquarter)) {
                        // Then show proper faces message
                        this.showFacesMessage("form-admin-add-headquarter-office:headquarterStreet", "ADMIN_HEADQUARTER_ALREADY_CREATED"); //NOI18N
                        return;
@@ -847,36 +847,6 @@ public class JobsAdminHeadquarterWebRequestBean extends BaseJobsBean implements
                return openingTime;
        }
 
-       /**
-        * Checks whether the given headquarter' address is already found in local
-        * cache. Please note that this method fully relies on the cache, so you
-        * must always fire proper events that add/update/delete entries in cache.
-        * <p>
-        * @param headquarter Headquarter to check it's address
-        * <p>
-        * @return Whether the address has been found
-        */
-       private boolean isHeadquarterCreatedByRequiredData (final Headquarter headquarter) {
-               // Get full list from other bean
-               final List<Headquarter> allHeadquarter = this.headquarterController.allHeadquarter();
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Now check each entry
-               for (final Headquarter hq : allHeadquarter) {
-                       // Is same address?
-                       if (Headquarters.isSameAddress(hq, headquarter)) {
-                               // Found one
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
-       }
-
        /**
         * Checks if given opening time is already added
         * <p>
index dc43b6d5d440a49e8639812dd8a121f891f455d6..98a613505200628ed58d9822af8f70eaa782e922 100644 (file)
  */
 package org.mxchange.jjobs.beans.business.headquarter;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
-import java.text.MessageFormat;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcontactsbusiness.events.headquarter.added.ObservableHeadquarterAddedEvent;
-import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterNotFoundException;
-import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
 import org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRemote;
 import org.mxchange.jjobs.beans.BaseJobsBean;
 
@@ -49,206 +36,18 @@ public class JobsHeadquarterWebRequestBean extends BaseJobsBean implements JobsH
         */
        private static final long serialVersionUID = 5_028_697_360_465L;
 
-       /**
-        * A list of all headquarter
-        */
-       private final List<Headquarter> allHeadquarter;
-
-       /**
-        * A list of filtered headquarter
-        */
-       private List<Headquarter> filteredHeadquarter;
-
        /**
         * EJB for administrative purposes
         */
        @EJB (lookup = "java:global/jjobs-ejb/headquarter!org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRemote")
        private HeadquarterSessionBeanRemote headquarterBean;
 
-       /**
-        * A list of all headquarter (globally)
-        */
-       @Inject
-       @NamedCache (cacheName = "headquarterCache")
-       private Cache<Long, Headquarter> headquarterCache;
-
        /**
         * Default constructor
         */
        public JobsHeadquarterWebRequestBean () {
                // Call super constructor
                super();
-
-               // Init list
-               this.allHeadquarter = new LinkedList<>();
-       }
-
-       /**
-        * Observes events being fired when a branch office has been added.
-        * <p>
-        * @param event Event being fired
-        * <p>
-        * @throws NullPointerException If the parameter or it's carried instance is
-        * null
-        * @throws IllegalArgumentException If the branchId is zero or lower
-        */
-       public void afterHeadquarterAddedEvent (@Observes final ObservableHeadquarterAddedEvent event) {
-               // Validate parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getHeadquarter() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.headquarter is null"); //NOI18N
-               } else if (event.getHeadquarter().getHeadquarterId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.headquarter.branchId is null"); //NOI18N
-               } else if (event.getHeadquarter().getHeadquarterId() < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("event.headquarter.branchId={0} is not valid", event.getHeadquarter().getHeadquarterId())); //NOI18N
-               }
-
-               // Add instance to cache
-               this.headquarterCache.put(event.getHeadquarter().getHeadquarterId(), event.getHeadquarter());
-               this.allHeadquarter.add(event.getHeadquarter());
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Headquarter> allHeadquarter () {
-               return this.allHeadquarter;
-       }
-
-       @Override
-       public Headquarter findHeadquarterById (final Long headquarterId) throws HeadquarterNotFoundException {
-               // Validate parameter
-               if (null == headquarterId) {
-                       // Throw NPE
-                       throw new NullPointerException("headquarterId is null"); //NOI18N
-               } else if (headquarterId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("headquarterId={0} is invalid", headquarterId)); //NOI18N
-               } else if (!this.headquarterCache.containsKey(headquarterId)) {
-                       // Not found
-                       throw new HeadquarterNotFoundException(headquarterId);
-               }
-
-               // Get it from cache
-               final Headquarter headquarter = this.headquarterCache.get(headquarterId);
-
-               // Return it
-               return headquarter;
-       }
-
-       /**
-        * Getter for a list of filtered headquarter
-        * <p>
-        * @return Filtered headquarter
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Headquarter> getFilteredHeadquarter () {
-               return this.filteredHeadquarter;
-       }
-
-       /**
-        * Setter for a list of filtered headquarter
-        * <p>
-        * @param filteredHeadquarter Filtered headquarter
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredHeadquarter (final List<Headquarter> filteredHeadquarter) {
-               this.filteredHeadquarter = filteredHeadquarter;
-       }
-
-       /**
-        * Initializer method
-        */
-       @PostConstruct
-       public void initializeList () {
-               // Is cache there?
-               if (!this.headquarterCache.iterator().hasNext()) {
-                       // Get whole list from EJB
-                       final List<Headquarter> Headquarter = this.headquarterBean.allHeadquarters();
-
-                       // Add all
-                       for (final Headquarter headquarter : Headquarter) {
-                               // Add it to cache
-                               this.headquarterCache.put(headquarter.getHeadquarterId(), headquarter);
-                       }
-               }
-
-               // Is the list empty, but filled cache?
-               if (this.allHeadquarter.isEmpty() && this.headquarterCache.iterator().hasNext()) {
-                       // Build up list
-                       for (final Cache.Entry<Long, Headquarter> currentEntry : this.headquarterCache) {
-                               // Add to list
-                               this.allHeadquarter.add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.allHeadquarter.sort(new Comparator<Headquarter>() {
-                               @Override
-                               public int compare (final Headquarter headquarter1, final Headquarter headquarter2) {
-                                       return headquarter1.getHeadquarterId() > headquarter2.getHeadquarterId() ? 1 : headquarter1.getHeadquarterId() < headquarter2.getHeadquarterId() ? -1 : 0;
-                               }
-                       });
-               }
-       }
-
-       @Override
-       public Boolean isCompanyNameUsed (final String companyName) {
-               // Validate parameter
-               if (null == companyName) {
-                       // Throw NPE
-                       throw new NullPointerException("companyName is null"); //NOI18N
-               } else if (companyName.isEmpty()) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("companyName is empty"); //NOI18N
-               }
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Check all entries
-               for (final Headquarter headquarter : this.allHeadquarter()) {
-                       // Is same company name?
-                       if (Objects.equals(headquarter.getHeadquarterCompanyName(), companyName)) {
-                               // Found it
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
-       }
-
-       @Override
-       public Boolean isEmailAddressRegistered (final String emailAddress) {
-               // Validate parameter
-               if (null == emailAddress) {
-                       // Throw NPE
-                       throw new NullPointerException("emailAddress is null"); //NOI18N
-               } else if (emailAddress.isEmpty()) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
-               }
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Check all entries
-               for (final Headquarter headquarter : this.allHeadquarter()) {
-                       // Is email address used?
-                       if (Objects.equals(headquarter.getHeadquarterEmailAddress(), emailAddress)) {
-                               // Found it
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
        }
 
 }
index 6446d9244c29fec5d9cffd74ba13fb5f3e184034..f604844616e780bb1e355480f8801b4aeba932d9 100644 (file)
@@ -17,9 +17,6 @@
 package org.mxchange.jjobs.beans.business.headquarter;
 
 import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterNotFoundException;
-import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
 
 /**
  * An interface for general Headquarter controller
@@ -28,41 +25,4 @@ import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
  */
 public interface JobsHeadquarterWebRequestController extends Serializable {
 
-       /**
-        * Checks whether given company name already exists
-        * <p>
-        * @param companyName Company name to check
-        * <p>
-        * @return Whether the company name exists
-        */
-       Boolean isCompanyNameUsed (final String companyName);
-
-       /**
-        * Checks if given email address is already registered by an other
-        * headquarter
-        * <p>
-        * @param emailAddress Email address
-        * <p>
-        * @return Whether the email address has been already registered
-        */
-       Boolean isEmailAddressRegistered (final String emailAddress);
-
-       /**
-        * Returns a list of all headquarter
-        * <p>
-        * @return A list of all headquarter
-        */
-       List<Headquarter> allHeadquarter ();
-
-       /**
-        * Tries to find a headquarter with given id number
-        * <p>
-        * @param headquarterId Headquarter id
-        * <p>
-        * @return A headquarter instance
-        * <p>
-        * @throws HeadquarterNotFoundException If the headquarter was not found
-        */
-       Headquarter findHeadquarterById (final Long headquarterId) throws HeadquarterNotFoundException;
-
 }
diff --git a/src/java/org/mxchange/jjobs/beans/business/headquarter/list/JobsHeadquarterListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/business/headquarter/list/JobsHeadquarterListWebViewBean.java
new file mode 100644 (file)
index 0000000..8d79b44
--- /dev/null
@@ -0,0 +1,306 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.business.headquarter.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontactsbusiness.events.headquarter.added.ObservableHeadquarterAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterNotFoundException;
+import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
+import org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRemote;
+import org.mxchange.jcontactsbusiness.model.headquarter.Headquarters;
+import org.mxchange.jjobs.beans.BaseJobsBean;
+
+/**
+ * A list bean for headquarter
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("headquarterListController")
+@ViewScoped
+public class JobsHeadquarterListWebViewBean extends BaseJobsBean implements JobsHeadquarterListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_028_697_360_466L;
+
+       /**
+        * A list of all headquarter
+        */
+       private final List<Headquarter> allHeadquarters;
+
+       /**
+        * A list of filtered headquarter
+        */
+       private List<Headquarter> filteredHeadquarters;
+
+       /**
+        * EJB for administrative purposes
+        */
+       @EJB (lookup = "java:global/jjobs-ejb/headquarter!org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterSessionBeanRemote")
+       private HeadquarterSessionBeanRemote headquarterBean;
+
+       /**
+        * A list of all headquarter (globally)
+        */
+       @Inject
+       @NamedCache (cacheName = "headquarterCache")
+       private transient Cache<Long, Headquarter> headquarterCache;
+
+       /**
+        * Currently selected headquarter
+        */
+       private Headquarter selectedHeadquarter;
+
+       /**
+        * Default constructor
+        */
+       public JobsHeadquarterListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allHeadquarters = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being fired when a branch office has been added.
+        * <p>
+        * @param event Event being fired
+        * <p>
+        * @throws NullPointerException If the parameter or it's carried instance is
+        * null
+        * @throws IllegalArgumentException If the branchId is zero or lower
+        */
+       public void afterHeadquarterAddedEvent (@Observes final ObservableHeadquarterAddedEvent event) {
+               // Validate parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getHeadquarter() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.headquarter is null"); //NOI18N
+               } else if (event.getHeadquarter().getHeadquarterId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.headquarter.branchId is null"); //NOI18N
+               } else if (event.getHeadquarter().getHeadquarterId() < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("event.headquarter.branchId={0} is not valid", event.getHeadquarter().getHeadquarterId())); //NOI18N
+               }
+
+               // Add instance to cache
+               this.headquarterCache.put(event.getHeadquarter().getHeadquarterId(), event.getHeadquarter());
+               this.getAllHeadquarters().add(event.getHeadquarter());
+       }
+
+       @Override
+       public Headquarter findHeadquarterById (final Long headquarterId) throws HeadquarterNotFoundException {
+               // Validate parameter
+               if (null == headquarterId) {
+                       // Throw NPE
+                       throw new NullPointerException("headquarterId is null"); //NOI18N
+               } else if (headquarterId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("headquarterId={0} is invalid", headquarterId)); //NOI18N
+               } else if (!this.headquarterCache.containsKey(headquarterId)) {
+                       // Not found
+                       throw new HeadquarterNotFoundException(headquarterId);
+               }
+
+               // Get it from cache
+               final Headquarter headquarter = this.headquarterCache.get(headquarterId);
+
+               // Return it
+               return headquarter;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Headquarter> getAllHeadquarters () {
+               return this.allHeadquarters;
+       }
+
+       /**
+        * Getter for a list of filtered headquarter
+        * <p>
+        * @return Filtered headquarter
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Headquarter> getFilteredHeadquarters () {
+               return this.filteredHeadquarters;
+       }
+
+       /**
+        * Setter for a list of filtered headquarter
+        * <p>
+        * @param filteredHeadquarters Filtered headquarter
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredHeadquarters (final List<Headquarter> filteredHeadquarters) {
+               this.filteredHeadquarters = filteredHeadquarters;
+       }
+
+       /**
+        * Getter for selected headquarter
+        * <p>
+        * @return Selected headquarter
+        */
+       public Headquarter getSelectedHeadquarter () {
+               return this.selectedHeadquarter;
+       }
+
+       /**
+        * Setter for selected headquarter
+        * <p>
+        * @param selectedHeadquarter Selected headquarter
+        */
+       public void setSelectedHeadquarter (final Headquarter selectedHeadquarter) {
+               this.selectedHeadquarter = selectedHeadquarter;
+       }
+
+       /**
+        * Initializer method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.headquarterCache.iterator().hasNext()) {
+                       // Get whole list from EJB
+                       final List<Headquarter> Headquarter = this.headquarterBean.allHeadquarters();
+
+                       // Add all
+                       for (final Headquarter headquarter : Headquarter) {
+                               // Add it to cache
+                               this.headquarterCache.put(headquarter.getHeadquarterId(), headquarter);
+                       }
+               }
+
+               // Is the list empty, but filled cache?
+               if (this.getAllHeadquarters().isEmpty() && this.headquarterCache.iterator().hasNext()) {
+                       // Build up list
+                       for (final Cache.Entry<Long, Headquarter> currentEntry : this.headquarterCache) {
+                               // Add to list
+                               this.getAllHeadquarters().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllHeadquarters().sort(new Comparator<Headquarter>() {
+                               @Override
+                               public int compare (final Headquarter headquarter1, final Headquarter headquarter2) {
+                                       return headquarter1.getHeadquarterId() > headquarter2.getHeadquarterId() ? 1 : headquarter1.getHeadquarterId() < headquarter2.getHeadquarterId() ? -1 : 0;
+                               }
+                       });
+               }
+       }
+
+       @Override
+       public Boolean isCompanyNameUsed (final String companyName) {
+               // Validate parameter
+               if (null == companyName) {
+                       // Throw NPE
+                       throw new NullPointerException("companyName is null"); //NOI18N
+               } else if (companyName.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("companyName is empty"); //NOI18N
+               }
+
+               // Default is not found
+               boolean isFound = false;
+
+               // Check all entries
+               for (final Headquarter headquarter : this.getAllHeadquarters()) {
+                       // Is same company name?
+                       if (Objects.equals(headquarter.getHeadquarterCompanyName(), companyName)) {
+                               // Found it
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+       @Override
+       public Boolean isEmailAddressRegistered (final String emailAddress) {
+               // Validate parameter
+               if (null == emailAddress) {
+                       // Throw NPE
+                       throw new NullPointerException("emailAddress is null"); //NOI18N
+               } else if (emailAddress.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
+               }
+
+               // Default is not found
+               boolean isFound = false;
+
+               // Check all entries
+               for (final Headquarter headquarter : this.getAllHeadquarters()) {
+                       // Is email address used?
+                       if (Objects.equals(headquarter.getHeadquarterEmailAddress(), emailAddress)) {
+                               // Found it
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+       /**
+        * Checks whether the given headquarter' address is already found in local
+        * cache. Please note that this method fully relies on the cache, so you
+        * must always fire proper events that add/update/delete entries in cache.
+        * <p>
+        * @param headquarter Headquarter to check it's address
+        * <p>
+        * @return Whether the address has been found
+        */
+       @Override
+       public boolean isHeadquarterCreatedByRequiredData (final Headquarter headquarter) {
+               // Default is not found
+               boolean isFound = false;
+
+               // Now check each entry
+               for (final Headquarter hq : this.getAllHeadquarters()) {
+                       // Is same address?
+                       if (Headquarters.isSameAddress(hq, headquarter)) {
+                               // Found one
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/jjobs/beans/business/headquarter/list/JobsHeadquarterListWebViewController.java b/src/java/org/mxchange/jjobs/beans/business/headquarter/list/JobsHeadquarterListWebViewController.java
new file mode 100644 (file)
index 0000000..e593d64
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jjobs.beans.business.headquarter.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterNotFoundException;
+import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
+
+/**
+ * An interface for general Headquarter controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsHeadquarterListWebViewController extends Serializable {
+
+       /**
+        * Checks whether given company name already exists
+        * <p>
+        * @param companyName Company name to check
+        * <p>
+        * @return Whether the company name exists
+        */
+       Boolean isCompanyNameUsed (final String companyName);
+
+       /**
+        * Checks if given email address is already registered by an other
+        * headquarter
+        * <p>
+        * @param emailAddress Email address
+        * <p>
+        * @return Whether the email address has been already registered
+        */
+       Boolean isEmailAddressRegistered (final String emailAddress);
+
+       /**
+        * Returns a list of all headquarter
+        * <p>
+        * @return A list of all headquarter
+        */
+       List<Headquarter> getAllHeadquarters ();
+
+       /**
+        * Tries to find a headquarter with given id number
+        * <p>
+        * @param headquarterId Headquarter id
+        * <p>
+        * @return A headquarter instance
+        * <p>
+        * @throws HeadquarterNotFoundException If the headquarter was not found
+        */
+       Headquarter findHeadquarterById (final Long headquarterId) throws HeadquarterNotFoundException;
+
+       /**
+        * Checks whether the given headquarter' address is already found in local
+        * cache. Please note that this method fully relies on the cache, so you
+        * must always fire proper events that add/update/delete entries in cache.
+        * <p>
+        * @param headquarter Headquarter to check it's address
+        * <p>
+        * @return Whether the address has been found
+        */
+       boolean isHeadquarterCreatedByRequiredData (final Headquarter headquarter);
+
+}
index 3901d35812c98a04e48389f854e5ac050923ef8e..569b6471e52b8d59e7dba0fa9a1786a770bfc9d2 100644 (file)
@@ -24,8 +24,8 @@ import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterNotFoundException;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import org.mxchange.jjobs.beans.business.headquarter.JobsHeadquarterWebRequestBean;
-import org.mxchange.jjobs.beans.business.headquarter.JobsHeadquarterWebRequestController;
+import org.mxchange.jjobs.beans.business.headquarter.list.JobsHeadquarterListWebViewBean;
+import org.mxchange.jjobs.beans.business.headquarter.list.JobsHeadquarterListWebViewController;
 
 /**
  * Converter for converting company headquarter to and from id number
@@ -38,15 +38,10 @@ public class JobsHeadquarterConverter implements Converter<Headquarter> {
        /**
         * Headquarter backing bean
         */
-       private static JobsHeadquarterWebRequestController HEADQUARTER_CONTROLLER;
+       private static JobsHeadquarterListWebViewController HEADQUARTER_LIST_CONTROLLER;
 
        @Override
        public Headquarter getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == HEADQUARTER_CONTROLLER) {
-                       HEADQUARTER_CONTROLLER = CDI.current().select(JobsHeadquarterWebRequestBean.class).get();
-               }
-
                // Init instance
                Headquarter headquarter = null;
 
@@ -54,8 +49,14 @@ public class JobsHeadquarterConverter implements Converter<Headquarter> {
                        // Try to parse the value as long
                        final Long headquarterId = Long.valueOf(submittedValue);
 
+                       // Is the instance there?
+                       if (null == HEADQUARTER_LIST_CONTROLLER) {
+                               // Set it now
+                               HEADQUARTER_LIST_CONTROLLER = CDI.current().select(JobsHeadquarterListWebViewBean.class).get();
+                       }
+
                        // Try to get user instance from it
-                       headquarter = HEADQUARTER_CONTROLLER.findHeadquarterById(headquarterId);
+                       headquarter = HEADQUARTER_LIST_CONTROLLER.findHeadquarterById(headquarterId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index 9044fe99c88497107d23c811b73a26860ad01933..6a99e742dd93d3510450a8362cf601e6513b8085 100644 (file)
@@ -24,8 +24,8 @@ import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import org.mxchange.jcontactsbusiness.exceptions.headquarter.HeadquarterNotFoundException;
 import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter;
-import org.mxchange.jjobs.beans.business.headquarter.JobsHeadquarterWebRequestBean;
-import org.mxchange.jjobs.beans.business.headquarter.JobsHeadquarterWebRequestController;
+import org.mxchange.jjobs.beans.business.headquarter.list.JobsHeadquarterListWebViewBean;
+import org.mxchange.jjobs.beans.business.headquarter.list.JobsHeadquarterListWebViewController;
 
 /**
  * Converter for converting company headquarters to and from id number
@@ -38,15 +38,10 @@ public class JobsHeadquarterConverter implements Converter<Headquarter> {
        /**
         * Headquarter backing bean
         */
-       private static JobsHeadquarterWebRequestController HEADQUARTER_CONTROLLER;
+       private static JobsHeadquarterListWebViewController HEADQUARTER_LIST_CONTROLLER;
 
        @Override
        public Headquarter getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == HEADQUARTER_CONTROLLER) {
-                       HEADQUARTER_CONTROLLER = CDI.current().select(JobsHeadquarterWebRequestBean.class).get();
-               }
-
                // Init instance
                Headquarter headquarter = null;
 
@@ -54,8 +49,14 @@ public class JobsHeadquarterConverter implements Converter<Headquarter> {
                        // Try to parse the value as long
                        final Long headquarterId = Long.valueOf(submittedValue);
 
+                       // Is the instance there?
+                       if (null == HEADQUARTER_LIST_CONTROLLER) {
+                               // Then set controller
+                               HEADQUARTER_LIST_CONTROLLER = CDI.current().select(JobsHeadquarterListWebViewBean.class).get();
+                       }
+
                        // Try to get user instance from it
-                       headquarter = HEADQUARTER_CONTROLLER.findHeadquarterById(headquarterId);
+                       headquarter = HEADQUARTER_LIST_CONTROLLER.findHeadquarterById(headquarterId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index e662bac69c6176e5eeb7788d6d4ad4ee499a0600..6c8bb379d131bba7ae5fe3ffb00d1288549ad7c9 100644 (file)
@@ -24,8 +24,8 @@ import javax.faces.context.FacesContext;
 import javax.faces.validator.FacesValidator;
 import javax.faces.validator.ValidatorException;
 import org.mxchange.jcoreee.validator.string.BaseStringValidator;
-import org.mxchange.jjobs.beans.business.headquarter.JobsHeadquarterWebRequestBean;
-import org.mxchange.jjobs.beans.business.headquarter.JobsHeadquarterWebRequestController;
+import org.mxchange.jjobs.beans.business.headquarter.list.JobsHeadquarterListWebViewBean;
+import org.mxchange.jjobs.beans.business.headquarter.list.JobsHeadquarterListWebViewController;
 
 /**
  * A validator for headquarter company names
@@ -38,7 +38,7 @@ public class JobsHeadquarterCompanyNameValidator extends BaseStringValidator {
        /**
         * Headquarter backing bean
         */
-       private static JobsHeadquarterWebRequestController HEADQUARTER_CONTROLLER;
+       private static JobsHeadquarterListWebViewController HEADQUARTER_LIST_CONTROLLER;
 
        /**
         * Serial number
@@ -47,12 +47,6 @@ public class JobsHeadquarterCompanyNameValidator extends BaseStringValidator {
 
        @Override
        public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Is the instance there?
-               if (null == HEADQUARTER_CONTROLLER) {
-                       // Get bean from CDI directly
-                       HEADQUARTER_CONTROLLER = CDI.current().select(JobsHeadquarterWebRequestBean.class).get();
-               }
-
                // All accepted, required fields
                final String[] requiredFields = {"companyName"}; //NOI18N
 
@@ -80,8 +74,14 @@ public class JobsHeadquarterCompanyNameValidator extends BaseStringValidator {
                        checkExisting = Boolean.parseBoolean((String) attribute);
                }
 
+               // Is the instance there?
+               if (null == HEADQUARTER_LIST_CONTROLLER) {
+                       // Get bean from CDI directly
+                       HEADQUARTER_LIST_CONTROLLER = CDI.current().select(JobsHeadquarterListWebViewBean.class).get();
+               }
+
                // Check if name is already used
-               final Boolean nameExists = HEADQUARTER_CONTROLLER.isCompanyNameUsed(companyName);
+               final Boolean nameExists = HEADQUARTER_LIST_CONTROLLER.isCompanyNameUsed(companyName);
 
                // Is the user id valid?
                if ((!nameExists) && (checkExisting)) {
index a7deaf3eebd264f964e57cefa07615257b5ff111..bca2a33259cfbdcc462b18a9fbc6a83e9c5e1cc3 100644 (file)
@@ -25,8 +25,8 @@ import javax.faces.context.FacesContext;
 import javax.faces.validator.FacesValidator;
 import javax.faces.validator.ValidatorException;
 import org.mxchange.jcoreee.validator.string.BaseStringValidator;
-import org.mxchange.jjobs.beans.business.headquarter.JobsHeadquarterWebRequestBean;
-import org.mxchange.jjobs.beans.business.headquarter.JobsHeadquarterWebRequestController;
+import org.mxchange.jjobs.beans.business.headquarter.list.JobsHeadquarterListWebViewBean;
+import org.mxchange.jjobs.beans.business.headquarter.list.JobsHeadquarterListWebViewController;
 
 /**
  * A validator for headquarter's email address validation
@@ -44,7 +44,7 @@ public class JobsHeadquarterEmailAddressValidator extends BaseStringValidator {
        /**
         * Headquarter backing bean
         */
-       private static JobsHeadquarterWebRequestController HEADQUARTER_CONTROLLER;
+       private static JobsHeadquarterListWebViewController HEADQUARTER_LIST_CONTROLLER;
 
        /**
         * Pattern matcher
@@ -65,6 +65,7 @@ public class JobsHeadquarterEmailAddressValidator extends BaseStringValidator {
         * Default constructor
         */
        public JobsHeadquarterEmailAddressValidator () {
+               // Default is not allowed
                this.allowEmptyRequiredData = Boolean.FALSE;
        }
 
@@ -115,13 +116,13 @@ public class JobsHeadquarterEmailAddressValidator extends BaseStringValidator {
                final String clientId = component.getClientId();
 
                // Is the instance there?
-               if (null == HEADQUARTER_CONTROLLER) {
+               if (null == HEADQUARTER_LIST_CONTROLLER) {
                        // Get bean from CDI directly
-                       HEADQUARTER_CONTROLLER = CDI.current().select(JobsHeadquarterWebRequestBean.class).get();
+                       HEADQUARTER_LIST_CONTROLLER = CDI.current().select(JobsHeadquarterListWebViewBean.class).get();
                }
 
                // Is it registered?
-               final Boolean isRegistered = HEADQUARTER_CONTROLLER.isEmailAddressRegistered(emailAddress);
+               final Boolean isRegistered = HEADQUARTER_LIST_CONTROLLER.isEmailAddressRegistered(emailAddress);
 
                // Is the email address already registered?
                if ((!clientId.endsWith("resendEmailAddress")) && (isRegistered)) { //NOI18N
index cffa4945b06b977fd7cd36868e62b29898ce8062..a53e0cf4e327d97a61ca738065f0cdf4dfc52f31 100644 (file)
@@ -1229,3 +1229,4 @@ ADMIN_ASSIGNED_MANUFACTURER_LABEL=Zugewiesener Hersteller:
 BARCODE=Barcode:
 ADMIN_CONTACT_DETAILS_HEADER=Kontaktdaten zu {0} {1} {2}:
 ADMIN_DEPARTMENT_DETAILS_HEADER=Daten der Abteilung {0} (Id {1}):
+ADMIN_HEADQUARTER_DETAILS_HEADER=Haupstelle von {0} (Id {1})):
index 2af80878dc33a913be85f7eeb24f369d0eabc0ed..b7faeb42c636d0e9935f5693b919f1ff902b7434 100644 (file)
@@ -1136,3 +1136,4 @@ ADMIN_ASSIGNED_MANUFACTURER_LABEL=Assigned manufacturer:
 BARCODE=Barcode:
 ADMIN_CONTACT_DETAILS_HEADER=Contact data of {0} {1} {2}:
 ADMIN_DEPARTMENT_DETAILS_HEADER=Data of department {0} (Id {1}):
+ADMIN_HEADQUARTER_DETAILS_HEADER=Headquarter of {0} (Id {1})):
index fb72b67236b7e076fda28c585519d7ce02ef5e0e..6e0e18cf3539ecd358520a3a3cadcd9c8fd3846c 100644 (file)
                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                        <f:selectItems
-                                               value="#{headquarterController.allHeadquarter()}"
+                                               value="#{headquarterListController.allHeadquarters}"
                                                var="headquarter"
                                                itemValue="#{headquarter}"
                                                itemLabel="#{beanHelper.renderHeadquarter(headquarter)}"
index 6d45042d116d1f84542a8dbaaae23c0d6edae082..502fcb9990aa8e8ee9e721da00c5674a32e99bd4 100644 (file)
@@ -79,7 +79,7 @@
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                <f:selectItems
-                                       value="#{headquarterController.allHeadquarter()}"
+                                       value="#{headquarterListController.allHeadquarters}"
                                        var="headquarter"
                                        itemValue="#{headquarter}"
                                        itemLabel="#{beanHelper.renderHeadquarter(headquarter)}"
index 85c42867b7793df3dc2a2a4452e5782175b05ae8..efb9ea593049b349e00353937e4fc013a91f2f87 100644 (file)
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                <f:selectItems
-                                       value="#{departmentController.allDepartments()}"
+                                       value="#{departmentListController.allDepartments}"
                                        var="department"
                                        itemValue="#{department}"
                                        itemLabel="#{beanHelper.renderDepartment(department)}"
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                <f:selectItems
-                                       value="#{headquarterController.allHeadquarter()}"
+                                       value="#{headquarterListController.allHeadquarters}"
                                        var="headquarter"
                                        itemValue="#{headquarter}"
                                        itemLabel="#{beanHelper.renderHeadquarter(headquarter)}"
index be91835cd402f807c7016105d122ec23feeb6e43..9eb72bd3cff854172765616106c550adc9106370 100644 (file)
                                <core:outputAdminContactDataFormFields allowEmptyRequiredData="true" />
 
                                <f:facet name="footer">
-                                       <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 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>
index 4f72454935a31c7d71dd264be5a698e8d717e72a..d3a51beea20219dabe6eef64d12859e0ffbe5c06 100644 (file)
 
                                        <p:link
                                                outcome="admin_show_employee"
-                                               value="#{department.departmentLead.employeeId}"
+                                               value="#{beanHelper.renderEmployee(department.departmentLead)}"
                                                title="#{msg.ADMIN_LINK_SHOW_DEPARTMENT_LEAD_EMPLOYEE_TITLE}"
                                                rendered="#{not empty department.departmentLead}"
                                                >
                                        <p:panelGrid columns="2" rendered="#{not empty departmentListController.selectedDepartment}">
                                                <f:facet name="header">
                                                        <h:outputFormat value="#{msg.ADMIN_DEPARTMENT_DETAILS_HEADER}">
-                                                               <f:param value="#{msg[departmentListController.selectedDepartment.departmentI18nKey]}" />
+                                                               <f:param value="#{local[departmentListController.selectedDepartment.departmentI18nKey]}" />
                                                                <f:param value="#{departmentListController.selectedDepartment.departmentId}" />
                                                        </h:outputFormat>
                                                </f:facet>
index bc94fcd92452102a22d58237d9f09766c3e27689..089a71f1b1127cfb934c8cbd3df4e78db83bae3f 100644 (file)
        </ui:define>
 
        <ui:define name="content">
-               <h:form id="form-list-Headquarter">
+               <h:form id="form-list-headquarters">
                        <p:dataTable
                                id="headquarterList"
                                var="headquarter"
-                               value="#{headquarterController.allHeadquarter()}"
+                               value="#{headquarterListController.allHeadquarters}"
                                paginator="true"
                                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
-                               filteredValue="#{headquarterController.filteredHeadquarter}"
+                               filteredValue="#{headquarterListController.filteredHeadquarters}"
                                rows="10"
+                               rowKey="#{headquarter.headquarterId}"
                                reflow="true"
                                resizableColumns="true"
                                rowsPerPageTemplate="5,10,20,50,100"
                                sortMode="multiple"
-                               summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_HEADQUARTER}"
-                               emptyMessage="#{msg.ADMIN_EMPTY_LIST_HEADQUARTER}"
+                               summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_BRANCH_OFFICES}"
+                               emptyMessage="#{msg.ADMIN_EMPTY_LIST_BRANCH_OFFICES}"
                                widgetVar="headquarterList"
+                               selectionMode="single"
+                               selection="#{headquarterListController.selectedHeadquarter}"
+                               skipChildren="true"
                                >
 
                                <f:facet name="header">
-                                       <p:panelGrid columns="2" columnClasses="ui-grid-col-10,ui-grid-col-2" layout="grid" styleClass="ui-noborder ui-transparent-widget">
-                                               <h:outputText value="#{msg.ADMIN_LIST_HEADQUARTER_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('headquarterList').filter()" placeholder="#{msg.ENTER_KEYWORD}"/>
+                                               </p:panelGrid>
+
+                                               <p:outputPanel>
+                                                       <p:spacer height="4" />
 
-                                               <h:panelGroup>
                                                        <p:commandButton
                                                                id="toggler"
                                                                type="button"
                                                                />
 
                                                        <p:columnToggler datasource="headquarterList" trigger="toggler" />
-                                               </h:panelGroup>
+                                               </p:outputPanel>
                                        </p:panelGrid>
                                </f:facet>
 
+                               <p:ajax
+                                       event="rowSelect"
+                                       update=":master:form-list-headquarters:headquarter-details"
+                                       oncomplete="PF('headquarterDialog').show()"
+                                       />
+
                                <p:column
                                        headerText="#{msg.ID_HEADER}"
                                        sortBy="#{headquarter.headquarterId}"
                                        <links:outputHeadquarterAdminDropdownMenu headquarter="#{headquarter}" />
                                </p:column>
                        </p:dataTable>
+
+                       <p:dialog
+                               dynamic="true"
+                               modal="true"
+                               resizable="false"
+                               header="#{msg.ADMIN_SINGLE_HEADQUARTER_DETAILS_HEADER}"
+                               hideEffect="fade"
+                               showEffect="fade"
+                               widgetVar="headquarterDialog"
+                               position="top"
+                               responsive="true"
+                               closeOnEscape="true"
+                               >
+                               <p:outputPanel id="headquarter-details">
+                                       <p:panelGrid columns="2" rendered="#{not empty headquarterListController.selectedHeadquarter}">
+                                               <f:facet name="header">
+                                                       <h:outputFormat value="#{msg.ADMIN_HEADQUARTER_DETAILS_HEADER}">
+                                                               <f:param value="#{headquarterListController.selectedHeadquarter.headquarterCompanyName}" />
+                                                               <f:param value="#{headquarterListController.selectedHeadquarter.headquarterId}" />
+                                                       </h:outputFormat>
+                                               </f:facet>
+
+                                               <p:outputLabel value="#{msg.ID_HEADER}" title="#{msg.HEADQUARTER_ID_NUMBER_TITLE}" />
+                                               <h:outputText value="#{headquarterListController.selectedHeadquarter.headquarterId}" />
+                                       </p:panelGrid>
+                               </p:outputPanel>
+                       </p:dialog>
                </h:form>
 
                <h:form>
                                                        type="submit"
                                                        value="#{msg.BUTTON_ADMIN_ADD_HEADQUARTER}"
                                                        action="#{adminHeadquarterController.addHeadquarter()}"
-                                                       update=":master:form-list-Headquarter:headquarterList"
+                                                       update=":master:form-list-headquarters:headquarterList"
                                                        />
                                        </p:panelGrid>
                                </f:facet>