commit da67aedb168f210a02e42021b8901a2cdd3afbf6
Author: Filip Jani <jsem@filek.cz>
Date:   Sun Jun 9 15:20:23 2019 +0200

    Grafické úpravy katalogu a filtrování v gridu transliterací

diff --git a/app/AdminModule/component/Transliteration/TransliterationGrid.php b/app/AdminModule/component/Transliteration/TransliterationGrid.php
index da255e2..0f342d8 100644
--- a/app/AdminModule/component/Transliteration/TransliterationGrid.php
+++ b/app/AdminModule/component/Transliteration/TransliterationGrid.php
@@ -148,6 +148,7 @@ class TransliterationGrid extends DataGrid
         // ===============
         // Definice filtrů
         // ===============
+        $allFilter = ['' => 'All'];
         $this->addFilterText(TransliterationRepository::COLUMN_BOOK_ID, 'Book')
             ->setCondition(function (Selection $selection, $value) use ($bookRepository)
             {
@@ -157,17 +158,10 @@ class TransliterationGrid extends DataGrid
                 $selection->where(BookRepository::COLUMN_ID, $bookIds);
             });
         $this->addFilterText(TransliterationRepository::COLUMN_CHAPTER, 'Chapter');
-        $this->addFilterText(TransliterationRepository::COLUMN_MUSEUM_ID, 'Museum')
-            ->setCondition(function (Selection $selection, $value) use ($museumRepository)
-            {
-                $museumIds = $museumRepository->getMuseumsLikeName($value)->fetchField(MuseumRepository::COLUMN_ID);
-                $museumIds = $museumIds ? $museumIds : NULL;
-
-                $selection->where(MuseumRepository::COLUMN_ID, $museumIds);
-            });
+        $this->addFilterSelect(TransliterationRepository::COLUMN_MUSEUM_ID, 'Museum', $allFilter + $this->museumRepository->getMuseumNameForSelect());
         $this->addFilterText(TransliterationRepository::COLUMN_MUSEUM_NO, 'Museum No');
-        $this->addFilterSelect(TransliterationRepository::COLUMN_ORIGIN_ID, 'Origin', $this->getOriginFilterArray());
-        $this->addFilterSelect(TransliterationRepository::COLUMN_BOOK_TYPE_ID, 'Book Type', $this->getBookTypeFilterArray());
+        $this->addFilterSelect(TransliterationRepository::COLUMN_ORIGIN_ID, 'Origin', $allFilter + $this->getOriginFilterArray());
+        $this->addFilterSelect(TransliterationRepository::COLUMN_BOOK_TYPE_ID, 'Book Type', $allFilter + $this->getBookTypeFilterArray());
         $this->addFilterText(TransliterationRepository::COLUMN_REG_NO, 'Reg No');
         $this->addFilterText(TransliterationRepository::COLUMN_DATE, 'Date');
 
diff --git a/app/model/repository/MuseumRepository.php b/app/model/repository/MuseumRepository.php
index cfcb48a..60d2cf1 100644
--- a/app/model/repository/MuseumRepository.php
+++ b/app/model/repository/MuseumRepository.php
@@ -47,6 +47,19 @@ class MuseumRepository extends Repository
      */
     public function getMuseumNameForSelect()
     {
-        return $this->findAll()->order(self::TABLE_NAME)->fetchPairs(self::COLUMN_ID,self::COLUMN_NAME);
+        $selectArray = [];
+        $museums = $this->findAll()->order(self::COLUMN_NAME)->fetchAll();
+
+        foreach ($museums as $museum)
+        {
+            $label = $museum->{self::COLUMN_NAME};
+            if (!empty($museum->{self::COLUMN_PLACE}))
+            {
+                $label .= ' – ' . $museum->{self::COLUMN_PLACE};
+            }
+            $selectArray[$museum->{self::COLUMN_ID}] = $label;
+        }
+
+        return $selectArray;
     }
 }
\ No newline at end of file
diff --git a/app/model/repository/OriginRepository.php b/app/model/repository/OriginRepository.php
index dc4d47f..400f2e4 100644
--- a/app/model/repository/OriginRepository.php
+++ b/app/model/repository/OriginRepository.php
@@ -24,9 +24,22 @@ class OriginRepository extends Repository
      */
     public function getOriginsForSelect()
     {
-        $origins = $this->findAll()->order(self::COLUMN_ORIGIN)->fetchPairs(self::COLUMN_ID, self::COLUMN_ORIGIN);
-        $origins[0] = '- NOT SELECTED -';
-        return $origins;
+        $selectArray = [];
+
+        $origins = $this->findAll()->order(self::COLUMN_ORIGIN)->fetchAll();
+
+        foreach ($origins as $origin)
+        {
+            $label = $origin->{self::COLUMN_ORIGIN};
+            if (!empty($origin->{self::COLUMN_OLD_NAME}))
+            {
+                $label .= ' / ' . $origin->{self::COLUMN_OLD_NAME};
+            }
+            $selectArray[$origin->{self::COLUMN_ID}] = $label;
+        }
+
+        $selectArray[0] = '- NOT SELECTED -';
+        return $selectArray;
     }
 
     /** Vrací místa původu se názvem LIKE % $name %
