Skip to content
Snippets Groups Projects
Commit 40f78148 authored by Sebastian Kehr's avatar Sebastian Kehr :rowboat_tone2: Committed by Dorian Merz
Browse files

refs #16442 [fid] label for orders

* add label attribute to order dto
* adjust order templates to display order label
parent 3ab241f1
Branches
Tags
No related merge requests found
......@@ -690,8 +690,7 @@ class UserController extends AbstractBase
try {
$user = $this->client->requestUserDetails();
$viewModel = $this->createViewModel();
$viewModel->setVariable('orders',$user->getOrders());
$viewModel->setVariable('addresses',$user->getAddresses());
$viewModel->setVariable('orders', $user->getOrders());
$viewModel->setTemplate('fid/user/orders');
return $viewModel;
} catch (ClientException $exception) {
......
......@@ -52,6 +52,19 @@ class Order
*/
protected $type = '';
/**
* @var string
* @Groups({
* "order:creation:request",
* "order:creation:response",
* "order:list:response",
* "user:details:response",
* "user:creation:response",
* "user:update:response"
* })
*/
protected $label = '';
/**
* @var User|null
* @Groups({
......@@ -106,6 +119,22 @@ class Order
$this->id = $id;
}
/**
* @return string
*/
public function getLabel(): string
{
return $this->label;
}
/**
* @param string $label
*/
public function setLabel(string $label): void
{
$this->label = $label;
}
/**
* @return string
*/
......
......@@ -8,7 +8,7 @@
<?=$this->render('fid/user/orders/additionals-headers');?>
</tr>
<?php foreach ($orders as $order): ?>
<?=$this->render('fid/user/orders/entry', compact('order', 'addresses'))?>
<?=$this->render('fid/user/orders/entry', compact('order'))?>
<?php endforeach; ?>
</table>
<?php endif; ?>
......
<!-- fid: fid - user - orders - data -->
<td>
<?php $recordId = $data['recordId'];
$recordLabel = $data['recordTitle'] ?? $recordId;
//$recordLabel = "ʙ";
<?php
$recordId = $this->order->getData()['record']['id'];
$recordLabel = $this->order->getLabel();
if ($recordLink = $this->recordLink()->getRecordLink($recordId, 'id')):
?>
<a onClick="$('#modal').modal('hide');" target="_self" href="<?=$recordLink?>"><?=$this->escapeHtml($recordLabel)?></a>
?>
<a onClick="$('#modal').modal('hide');" target="_self" href="<?=$recordLink?>"><?=$this->escapeHtml($recordLabel)?></a>
<?php else: ?>
<?=$this->escapeHtml($recordLabel)?>
<?php endif; ?>
......
<!-- fid: fid - user - orders - entry -->
<tr name="order-<?=$this->escapeHtml($order->getId())?>">
<td><?=$this->escapeHtml($order->getCreatedAt()->format('d.m.Y'))?></td>
<?php $data = $order->getData() ?>
<?=$this->render('fid/user/orders/additionals-data', compact('data', 'addresses'))?>
<tr name="order-<?=$this->escapeHtml($this->order->getId())?>">
<td><?=$this->escapeHtml($this->order->getCreatedAt()->format('d.m.Y'))?></td>
<?=$this->render('fid/user/orders/additionals-data', compact('order'))?>
</tr>
<!-- fid: fid - user - orders - entry - END -->
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment