Add Plugin Sort Collectlayouter
This commit is contained in:
parent
a9fd3632df
commit
f76ad94d81
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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,
|
||||
@ -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,
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -19,9 +19,15 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th style=""><a href="{{ path("plugin_custom_psc_collectlayouter_user_list", { productUuid: productUuid, orderBy: 'updatedAt', sort: sort }) }}">aktualisiert am</a></th>
|
||||
{% for setting in settings.getListSetting %}
|
||||
<th style="">{{ setting.label }}</th>
|
||||
<th style="">
|
||||
{% if setting.binding.getSortField() != "" %}
|
||||
<a href="{{ path("plugin_custom_psc_collectlayouter_user_list", { productUuid: productUuid, orderBy: setting.binding.getSortField(), sort: sort }) }}">{{ setting.label }}</a>
|
||||
{% else %}
|
||||
{{ setting.label }}
|
||||
{% endif %}
|
||||
</th>
|
||||
{% endfor %}
|
||||
<th style=""></th>
|
||||
<th style=""></th>
|
||||
@ -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' %}
|
||||
<tr>
|
||||
<td style="">{{ contact.updated|date("d.m.Y") }}</td>
|
||||
{% for setting in settings.getListSetting %}
|
||||
<td style="">{{ setting.binding.getField(contact) }}</td>
|
||||
{% endfor %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user