Add Plugin Sort Collectlayouter
This commit is contained in:
parent
a9fd3632df
commit
f76ad94d81
@ -20,6 +20,12 @@ class Contact
|
|||||||
#[OA\Property(type: 'string')]
|
#[OA\Property(type: 'string')]
|
||||||
private string $uuid = "";
|
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')]
|
#[OA\Property(type: 'boolean')]
|
||||||
private bool $locked = false;
|
private bool $locked = false;
|
||||||
|
|
||||||
@ -502,4 +508,20 @@ class Contact
|
|||||||
{
|
{
|
||||||
$this->countryCode = $countryCode;
|
$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->setAccount($account);
|
||||||
|
|
||||||
$contact->setUUId((string)$contactEntity->getUuid());
|
$contact->setUuid((string)$contactEntity->getUuid());
|
||||||
$contact->setEMail((string)$contactEntity->getEmail());
|
$contact->setEmail((string)$contactEntity->getEmail());
|
||||||
$contact->setUid((int)$contactEntity->getUid());
|
$contact->setUid((int)$contactEntity->getUid());
|
||||||
$contact->setUsername((string)$contactEntity->getEmail());
|
$contact->setUsername((string)$contactEntity->getEmail());
|
||||||
|
$contact->setCreated($contactEntity->getCreatedAt());
|
||||||
|
$contact->setUpdated($contactEntity->getUpdatedAt());
|
||||||
$contact->setCustomerNumber((string)$contactDoc->getKundenNr());
|
$contact->setCustomerNumber((string)$contactDoc->getKundenNr());
|
||||||
|
|
||||||
$contact->setLocked((bool)$contactEntity->isLocked());
|
$contact->setLocked((bool)$contactEntity->isLocked());
|
||||||
|
|||||||
@ -521,7 +521,7 @@ class UserController extends AbstractController
|
|||||||
|
|
||||||
return array(
|
return array(
|
||||||
'contacts' => $temp,
|
'contacts' => $temp,
|
||||||
'sort' => $sort,
|
'sort' => $sort == 'asc' ? 'desc' : 'asc',
|
||||||
'orderBy' => $orderBy,
|
'orderBy' => $orderBy,
|
||||||
'basket' => $basket,
|
'basket' => $basket,
|
||||||
'productUuid' => $productUuid,
|
'productUuid' => $productUuid,
|
||||||
@ -565,7 +565,7 @@ class UserController extends AbstractController
|
|||||||
|
|
||||||
return array(
|
return array(
|
||||||
'contacts' => $temp,
|
'contacts' => $temp,
|
||||||
'sort' => $sort,
|
'sort' => $sort == 'asc' ? 'desc' : 'asc',
|
||||||
'orderBy' => $orderBy,
|
'orderBy' => $orderBy,
|
||||||
'basket' => $basket,
|
'basket' => $basket,
|
||||||
'productUuid' => $productUuid,
|
'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
|
public function getField(Contact $contact): string
|
||||||
{
|
{
|
||||||
return match($this) {
|
return match($this) {
|
||||||
|
|||||||
@ -19,9 +19,15 @@
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<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 %}
|
{% 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 %}
|
{% endfor %}
|
||||||
<th style=""></th>
|
<th style=""></th>
|
||||||
<th style=""></th>
|
<th style=""></th>
|
||||||
@ -36,6 +42,7 @@
|
|||||||
{% for contact in contacts %}
|
{% for contact in contacts %}
|
||||||
{% if contact.layouterData.firstname != 'Vorname' and contact.layouterData.lastname != 'Nachname' and contact.layouterData.firstname != 'anonym' and contact.layouterData.lastname != 'anonym' %}
|
{% if contact.layouterData.firstname != 'Vorname' and contact.layouterData.lastname != 'Nachname' and contact.layouterData.firstname != 'anonym' and contact.layouterData.lastname != 'anonym' %}
|
||||||
<tr>
|
<tr>
|
||||||
|
<td style="">{{ contact.updated|date("d.m.Y") }}</td>
|
||||||
{% for setting in settings.getListSetting %}
|
{% for setting in settings.getListSetting %}
|
||||||
<td style="">{{ setting.binding.getField(contact) }}</td>
|
<td style="">{{ setting.binding.getField(contact) }}</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user