From f76ad94d81185c4e89e71b889bc91fc516320c1a Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 28 May 2025 13:29:02 +0200 Subject: [PATCH] Add Plugin Sort Collectlayouter --- .../PSC/Shop/ContactBundle/Model/Contact.php | 22 ++++ .../Transformer/Model/Contact.php | 6 +- .../Controller/Frontend/UserController.php | 124 +++++++++--------- .../CollectLayouter/Model/ElementBinding.php | 13 ++ .../views/frontend/user/list.html.twig | 13 +- 5 files changed, 111 insertions(+), 67 deletions(-) diff --git a/src/new/src/PSC/Shop/ContactBundle/Model/Contact.php b/src/new/src/PSC/Shop/ContactBundle/Model/Contact.php index 29487d4ae..d791cbad2 100755 --- a/src/new/src/PSC/Shop/ContactBundle/Model/Contact.php +++ b/src/new/src/PSC/Shop/ContactBundle/Model/Contact.php @@ -20,6 +20,12 @@ class Contact #[OA\Property(type: 'string')] private string $uuid = ""; + #[OA\Property(type: 'string', format: 'date')] + private ?\DateTime $updated = null; + + #[OA\Property(type: 'string', format: 'date')] + private ?\DateTime $created = null; + #[OA\Property(type: 'boolean')] private bool $locked = false; @@ -502,4 +508,20 @@ class Contact { $this->countryCode = $countryCode; } + public function setCreated(\DateTime $created): void + { + $this->created = $created; + } + public function getCreated(): ?\DateTime + { + return $this->created; + } + public function setUpdated(\DateTime $updated): void + { + $this->updated = $updated; + } + public function getUpdated(): ?\DateTime + { + return $this->updated; + } } diff --git a/src/new/src/PSC/Shop/ContactBundle/Transformer/Model/Contact.php b/src/new/src/PSC/Shop/ContactBundle/Transformer/Model/Contact.php index afd0cd89b..9116a20bb 100755 --- a/src/new/src/PSC/Shop/ContactBundle/Transformer/Model/Contact.php +++ b/src/new/src/PSC/Shop/ContactBundle/Transformer/Model/Contact.php @@ -147,10 +147,12 @@ class Contact } $contact->setAccount($account); - $contact->setUUId((string)$contactEntity->getUuid()); - $contact->setEMail((string)$contactEntity->getEmail()); + $contact->setUuid((string)$contactEntity->getUuid()); + $contact->setEmail((string)$contactEntity->getEmail()); $contact->setUid((int)$contactEntity->getUid()); $contact->setUsername((string)$contactEntity->getEmail()); + $contact->setCreated($contactEntity->getCreatedAt()); + $contact->setUpdated($contactEntity->getUpdatedAt()); $contact->setCustomerNumber((string)$contactDoc->getKundenNr()); $contact->setLocked((bool)$contactEntity->isLocked()); diff --git a/src/new/var/plugins/Custom/PSC/CollectLayouter/Controller/Frontend/UserController.php b/src/new/var/plugins/Custom/PSC/CollectLayouter/Controller/Frontend/UserController.php index fb8492201..78456e550 100755 --- a/src/new/var/plugins/Custom/PSC/CollectLayouter/Controller/Frontend/UserController.php +++ b/src/new/var/plugins/Custom/PSC/CollectLayouter/Controller/Frontend/UserController.php @@ -79,74 +79,74 @@ class UserController extends AbstractController ]; $titleEnable = array_values(array_filter($docData, function ($elm) { - if($elm['name'] == 'data[title][enable]') { + if ($elm['name'] == 'data[title][enable]') { return $elm; } })); - if(count($titleEnable) && $titleEnable[0]['value'] == 1) { + if (count($titleEnable) && $titleEnable[0]['value'] == 1) { $data['titleEnable'] = true; } $pos2Enable = array_values(array_filter($docData, function ($elm) { - if($elm['name'] == 'data[position2][enable]') { + if ($elm['name'] == 'data[position2][enable]') { return $elm; } })); - if(count($pos2Enable) && $pos2Enable[0]['value'] == 1) { + if (count($pos2Enable) && $pos2Enable[0]['value'] == 1) { $data['abteilungEnable'] = true; } $pos3Enable = array_values(array_filter($docData, function ($elm) { - if($elm['name'] == 'data[position3][enable]') { + if ($elm['name'] == 'data[position3][enable]') { return $elm; } })); - if(count($pos3Enable) && $pos3Enable[0]['value'] == 1) { + if (count($pos3Enable) && $pos3Enable[0]['value'] == 1) { $data['functionEnable'] = true; } $officeEnable = array_values(array_filter($docData, function ($elm) { - if($elm['name'] == 'data[office][enable]') { + if ($elm['name'] == 'data[office][enable]') { return $elm; } })); - if(count($officeEnable) && $officeEnable[0]['value'] == 1) { + if (count($officeEnable) && $officeEnable[0]['value'] == 1) { $data['company2Enable'] = true; } $fonEnable = array_values(array_filter($docData, function ($elm) { - if($elm['name'] == 'data[fon][enable]') { + if ($elm['name'] == 'data[fon][enable]') { return $elm; } })); - if(count($fonEnable) && $fonEnable[0]['value'] == 1) { + if (count($fonEnable) && $fonEnable[0]['value'] == 1) { $data['phoneEnable'] = true; } $mobileEnable = array_values(array_filter($docData, function ($elm) { - if($elm['name'] == 'data[mobile][enable]') { + if ($elm['name'] == 'data[mobile][enable]') { return $elm; } })); - if(count($mobileEnable) && $mobileEnable[0]['value'] == 1) { + if (count($mobileEnable) && $mobileEnable[0]['value'] == 1) { $data['mobileEnable'] = true; } $faxEnable = array_values(array_filter($docData, function ($elm) { - if($elm['name'] == 'data[fax][enable]') { + if ($elm['name'] == 'data[fax][enable]') { return $elm; } })); - if(count($faxEnable) && $faxEnable[0]['value'] == 1) { + if (count($faxEnable) && $faxEnable[0]['value'] == 1) { $data['faxEnable'] = true; } @@ -190,43 +190,43 @@ class UserController extends AbstractController $docData = []; - if(isset($data['titleEnable']) && $data['titleEnable']) { + if (isset($data['titleEnable']) && $data['titleEnable']) { $docData[] = [ 'name' => 'data[title][enable]', 'value' => '1' ]; } - if(isset($data['abteilungEnable']) && $data['abteilungEnable']) { + if (isset($data['abteilungEnable']) && $data['abteilungEnable']) { $docData[] = [ 'name' => 'data[position2][enable]', 'value' => '1' ]; } - if(isset($data['functionEnable']) && $data['functionEnable']) { + if (isset($data['functionEnable']) && $data['functionEnable']) { $docData[] = [ 'name' => 'data[position3][enable]', 'value' => '1' ]; } - if(isset($data['company2Enable']) && $data['company2Enable']) { + if (isset($data['company2Enable']) && $data['company2Enable']) { $docData[] = [ 'name' => 'data[office][enable]', 'value' => '1' ]; } - if(isset($data['phoneEnable']) && $data['phoneEnable']) { + if (isset($data['phoneEnable']) && $data['phoneEnable']) { $docData[] = [ 'name' => 'data[fon][enable]', 'value' => '1' ]; } - if(isset($data['mobileEnable']) && $data['mobileEnable']) { + if (isset($data['mobileEnable']) && $data['mobileEnable']) { $docData[] = [ 'name' => 'data[mobile][enable]', 'value' => '1' ]; } - if(isset($data['faxEnable']) && $data['faxEnable']) { + if (isset($data['faxEnable']) && $data['faxEnable']) { $docData[] = [ 'name' => 'data[fax][enable]', 'value' => '1' @@ -261,7 +261,7 @@ class UserController extends AbstractController $form->handleRequest($request); $contactExists = false; - if($form->isSubmitted()) { + if ($form->isSubmitted()) { $data = $form->getData(); $contactEx = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact') @@ -269,7 +269,7 @@ class UserController extends AbstractController ->setParameter('username', $data['email'])->setParameter('shop', $selectedShop->getUID()) ->getQuery()->getOneOrNullResult(); - if($contactEx) { + if ($contactEx) { $contactExists = true; } } @@ -342,43 +342,43 @@ class UserController extends AbstractController $docData = []; - if(isset($data['titleEnable']) && $data['titleEnable']) { + if (isset($data['titleEnable']) && $data['titleEnable']) { $docData[] = [ 'name' => 'data[title][enable]', 'value' => '1' ]; } - if(isset($data['abteilungEnable']) && $data['abteilungEnable']) { + if (isset($data['abteilungEnable']) && $data['abteilungEnable']) { $docData[] = [ 'name' => 'data[position2][enable]', 'value' => '1' ]; } - if(isset($data['functionEnable']) && $data['functionEnable']) { + if (isset($data['functionEnable']) && $data['functionEnable']) { $docData[] = [ 'name' => 'data[position3][enable]', 'value' => '1' ]; } - if(isset($data['company2Enable']) && $data['company2Enable']) { + if (isset($data['company2Enable']) && $data['company2Enable']) { $docData[] = [ 'name' => 'data[office][enable]', 'value' => '1' ]; } - if(isset($data['phoneEnable']) && $data['phoneEnable']) { + if (isset($data['phoneEnable']) && $data['phoneEnable']) { $docData[] = [ 'name' => 'data[fon][enable]', 'value' => '1' ]; } - if(isset($data['mobileEnable']) && $data['mobileEnable']) { + if (isset($data['mobileEnable']) && $data['mobileEnable']) { $docData[] = [ 'name' => 'data[mobile][enable]', 'value' => '1' ]; } - if(isset($data['faxEnable']) && $data['faxEnable']) { + if (isset($data['faxEnable']) && $data['faxEnable']) { $docData[] = [ 'name' => 'data[fax][enable]', 'value' => '1' @@ -405,11 +405,11 @@ class UserController extends AbstractController #[Route('/list/{productUuid}/{orderBy}/{sort}', name: 'plugin_custom_psc_collectlayouter_user_list')] public function list(Request $request, string $productUuid = 'none', $orderBy = 'uid', $sort = 'asc'): array { - if($this->getUser() == null || !$this->getUser()->getIsSek()) { + if ($this->getUser() == null || !$this->getUser()->getIsSek()) { throw new AccessDeniedException("Not Sek"); } $product = false; - if($productUuid != "none") { + if ($productUuid != "none") { $product = $this->entityManager->getRepository(Product::class)->findOneBy(['uuid' => $productUuid]); $productDoc = $this->documentManager->getRepository(\PSC\Shop\EntityBundle\Document\Product::class)->findOneBy(['uid' => $product->getUID()]); @@ -456,33 +456,33 @@ class UserController extends AbstractController $ids = []; - foreach($qb->getQuery()->execute() as $row) { + foreach ($qb->getQuery()->execute() as $row) { $ids[] = (int)$row->getUid(); } $contacts = []; - if($productDoc) { + if ($productDoc) { $accountMode = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterAccountFilter'); $accountSelect = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterOrdersAccount'); - if($accountMode == 1) { - $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact') - ->orderBy('contact.' . $orderBy, $sort) - ->leftJoin('contact.shops', 'shop') - ->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId()) - ->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute(); - }elseif($accountMode == 2) { + if ($accountMode == 1) { + $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact') + ->orderBy('contact.' . $orderBy, $sort) + ->leftJoin('contact.shops', 'shop') + ->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId()) + ->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute(); + } elseif ($accountMode == 2) { $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact') ->orderBy('contact.' . $orderBy, $sort) ->leftJoin('contact.shops', 'shop') ->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $this->getUser()->getAccount())->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId()) ->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute(); - }elseif($accountMode == 3) { + } elseif ($accountMode == 3) { $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact') ->orderBy('contact.' . $orderBy, $sort) ->leftJoin('contact.shops', 'shop') ->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $accountSelect)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId()) ->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute(); - }elseif($accountMode == 4) { + } elseif ($accountMode == 4) { $accounts = []; $accounts[] = $accountSelect; $accounts = $this->getAccountsForAccount($accounts, $accountSelect); @@ -491,7 +491,7 @@ class UserController extends AbstractController ->leftJoin('contact.shops', 'shop') ->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId()) ->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute(); - }elseif($accountMode == 5) { + } elseif ($accountMode == 5) { $accounts = []; $accounts[] = $this->getUser()->getAccount(); $accounts = $this->getAccountsForAccount($accounts, $this->getUser()->getAccount()); @@ -501,7 +501,7 @@ class UserController extends AbstractController ->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId()) ->andwhere('(contact.uid in (:ids) or contact.firstname like :q or contact.lastname like :q or contact.username like :q or contact.company like :q or contact.street like :q or contact.houseNumber like :q or contact.city like :q or contact.zip like :q or CONCAT(contact.firstname, \' \', contact.lastname) like :q)')->setParameter('ids', $ids)->setParameter("q", $q)->getQuery()->execute(); } - }else{ + } else { $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact') ->orderBy('contact.' . $orderBy, $sort) ->leftJoin('contact.shops', 'shop') @@ -511,8 +511,8 @@ class UserController extends AbstractController } $temp = []; - foreach($contacts as $contact) { - if(count($contact->getShopContact()) == 1) { + foreach ($contacts as $contact) { + if (count($contact->getShopContact()) == 1) { $contactObj = new \PSC\Shop\ContactBundle\Model\Contact(); $this->contactTransformer->fromDb($contactObj, $contact); $temp[] = $contactObj; @@ -521,7 +521,7 @@ class UserController extends AbstractController return array( 'contacts' => $temp, - 'sort' => $sort, + 'sort' => $sort == 'asc' ? 'desc' : 'asc', 'orderBy' => $orderBy, 'basket' => $basket, 'productUuid' => $productUuid, @@ -531,32 +531,32 @@ class UserController extends AbstractController } else { $contacts = []; - if($productDoc) { + if ($productDoc) { $accountMode = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterAccountFilter'); $accountSelect = $productDoc->getPluginSettingModule('collectlayouter', 'uploadCollectLayouterOrdersAccount'); - if($accountMode == 1) { + if ($accountMode == 1) { $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute(); - }elseif($accountMode == 2) { + } elseif ($accountMode == 2) { $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $this->getUser()->getAccount())->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute(); - }elseif($accountMode == 3) { + } elseif ($accountMode == 3) { $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account = :account')->setParameter('account', $accountSelect)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute(); - }elseif($accountMode == 4) { + } elseif ($accountMode == 4) { $accounts = []; $accounts[] = $accountSelect; $accounts = $this->getAccountsForAccount($accounts, $accountSelect); $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute(); - }elseif($accountMode == 5) { + } elseif ($accountMode == 5) { $accounts = []; $accounts[] = $this->getUser()->getAccount(); $accounts = $this->getAccountsForAccount($accounts, $this->getUser()->getAccount()); $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop AND contact.account in (:account)')->setParameter('account', $accounts)->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute(); } - }else{ + } else { $contacts = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->createQueryBuilder('contact')->leftJoin('contact.shops', 'shop')->where('contact.username != :sysadmin_email AND contact.enable = 1 AND contact.uid != 1 AND shop.uid = :shop')->setParameter('sysadmin_email', "sysadmin@printshopcreator.de")->setParameter('shop', $this->shopService->getShopByDomain()->getId())->orderBy('contact.' . $orderBy, $sort)->getQuery()->execute(); } $temp = []; - foreach($contacts as $contact) { - if(count($contact->getShopContact()) == 1) { + foreach ($contacts as $contact) { + if (count($contact->getShopContact()) == 1) { $contactObj = new \PSC\Shop\ContactBundle\Model\Contact(); $this->contactTransformer->fromDb($contactObj, $contact); $temp[] = $contactObj; @@ -565,7 +565,7 @@ class UserController extends AbstractController return array( 'contacts' => $temp, - 'sort' => $sort, + 'sort' => $sort == 'asc' ? 'desc' : 'asc', 'orderBy' => $orderBy, 'basket' => $basket, 'productUuid' => $productUuid, @@ -582,7 +582,7 @@ class UserController extends AbstractController $contact = $entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Contact')->findOneBy(array('uuid' => $contactUuid)); $copyContact = $contactService->copy($contact); - if($productUuid != "") { + if ($productUuid != "") { return $this->redirectToRoute('plugin_custom_psc_collectlayouter_collect', ['productUuid' => $productUuid, 'contactUuid' => $copyContact->getUuid(), 'mode' => 2]); } return $this->redirectToRoute('plugin_custom_psc_collectlayouter_user_edit', ['productUuid' => $productUuid, 'contactUuid' => $copyContact->getUuid()]); @@ -621,10 +621,10 @@ class UserController extends AbstractController $vcard->addName($contact->getLastname(), $contact->getFirstname(), "", "", ""); $vcard->addCompany($contact->getCompany()); $title = $contact->getPosition(); - if($contact->getAbteilung() != "") { + if ($contact->getAbteilung() != "") { $title = $title . ', ' . $contact->getAbteilung(); } - if($contact->getFunction() != "") { + if ($contact->getFunction() != "") { $title = $title . ', ' . $contact->getFunction(); } $vcard->addJobtitle($title); @@ -640,7 +640,7 @@ class UserController extends AbstractController private function getAccountsForAccount(array $accounts, $accountSelect) { $accountsEntity = $this->entityManager->getRepository('PSC\Shop\EntityBundle\Entity\Account')->findBy(array('parent' => $accountSelect)); - foreach($accountsEntity as $accountEntity) { + foreach ($accountsEntity as $accountEntity) { $accounts[] = $accountEntity->getId(); $accounts = $this->getAccountsForAccount($accounts, $accountEntity->getId()); } diff --git a/src/new/var/plugins/Custom/PSC/CollectLayouter/Model/ElementBinding.php b/src/new/var/plugins/Custom/PSC/CollectLayouter/Model/ElementBinding.php index a57a62704..578c3169c 100755 --- a/src/new/var/plugins/Custom/PSC/CollectLayouter/Model/ElementBinding.php +++ b/src/new/var/plugins/Custom/PSC/CollectLayouter/Model/ElementBinding.php @@ -141,6 +141,19 @@ enum ElementBinding: int ]; } + public function getSortField(): string + { + return match($this) { + self::none => "", + self::UsernameLogin => 'username', + self::UsernameLogin => 'username', + self::Company => 'company', + self::Firstname => 'firstname', + self::Lastname => 'lastname', + default => '' + }; + } + public function getField(Contact $contact): string { return match($this) { diff --git a/src/new/var/plugins/Custom/PSC/CollectLayouter/Resources/views/frontend/user/list.html.twig b/src/new/var/plugins/Custom/PSC/CollectLayouter/Resources/views/frontend/user/list.html.twig index abe50bb7f..087573cb1 100755 --- a/src/new/var/plugins/Custom/PSC/CollectLayouter/Resources/views/frontend/user/list.html.twig +++ b/src/new/var/plugins/Custom/PSC/CollectLayouter/Resources/views/frontend/user/list.html.twig @@ -19,9 +19,15 @@ - + {% for setting in settings.getListSetting %} - + {% endfor %} @@ -36,6 +42,7 @@ {% for contact in contacts %} {% if contact.layouterData.firstname != 'Vorname' and contact.layouterData.lastname != 'Nachname' and contact.layouterData.firstname != 'anonym' and contact.layouterData.lastname != 'anonym' %} + {% for setting in settings.getListSetting %} {% endfor %} @@ -65,4 +72,4 @@ Zurück zur ProduktkonfigurationZum Warenkorb -{% endblock %} \ No newline at end of file +{% endblock %}
aktualisiert am{{ setting.label }} + {% if setting.binding.getSortField() != "" %} + {{ setting.label }} + {% else %} + {{ setting.label }} + {% endif %} +
{{ contact.updated|date("d.m.Y") }}{{ setting.binding.getField(contact) }}