Skip to content
Snippets Groups Projects
Commit 9240d092 authored by Dorian Merz's avatar Dorian Merz
Browse files

refs #16223 [fid] book orders in user profile

* adds book orders menu entry
* displays open orders in table
* adds several templates
* adds script to close modal on click to Order list links

co-authored by: ckaz <kazzer@ub.uni-leipzig.de>
parent bf3aea18
No related merge requests found
...@@ -293,7 +293,17 @@ return [ ...@@ -293,7 +293,17 @@ return [
'action' => 'updateUsername', 'action' => 'updateUsername',
], ],
], ],
] ],
'orders' => [
'type' => 'literal',
'options' => [
'route' => '/orders',
'defaults' => [
'controller' => UserController::class,
'action' => 'orders',
],
],
],
], ],
], ],
'admin' => [ 'admin' => [
......
...@@ -682,4 +682,21 @@ class UserController extends AbstractBase ...@@ -682,4 +682,21 @@ class UserController extends AbstractBase
return $viewModel; return $viewModel;
} }
public function ordersAction()
{
if (!$this->getUser()) {
return $this->forceLogin();
}
try {
$user = $this->client->requestUserDetails();
$viewModel = $this->createViewModel();
$viewModel->setVariable('orders',$user->getOrders());
$viewModel->setVariable('addresses',$user->getAddresses());
$viewModel->setTemplate('fid/user/orders');
return $viewModel;
} catch (ClientException $exception) {
$this->getMessenger()->addErrorMessage('fid::orders_error');
$this->redirect()->toRoute('myresearch-profile');
}
}
} }
...@@ -73,6 +73,12 @@ user_update_error_403 = "Es ist ein Fehler beim Aktualisieren Ihres Profils aufg ...@@ -73,6 +73,12 @@ user_update_error_403 = "Es ist ein Fehler beim Aktualisieren Ihres Profils aufg
user_update_error_expired = "Bitte loggen Sie sich ein, um Ihr Profil zu editieren." user_update_error_expired = "Bitte loggen Sie sich ein, um Ihr Profil zu editieren."
user_update_success = "Ihr Profil wurde erfolgreich aktualisiert." user_update_success = "Ihr Profil wurde erfolgreich aktualisiert."
user_my_orders = "Buchbestellungen"
orders_error = "Fehler beim Abrufen der Bestellungen"
user_orders_empty = "Für Ihr Profil liegen in den letzten 3 Monaten keine Bestellungen vor."
order_delivery_address = "Lieferadresse"
order_record = "Bestellter Titel"
password_reset_error = "Es ist ein unerwarteter Fehler aufgetreten." password_reset_error = "Es ist ein unerwarteter Fehler aufgetreten."
password_reset_error_username = "Bitte überprüfen Sie die angegebende E-Mail-Adresse %s." password_reset_error_username = "Bitte überprüfen Sie die angegebende E-Mail-Adresse %s."
password_reset_success = "Ein Link zum Ändern Ihres Passworts wurde soeben an Ihre angegebene E-Mail-Adresse %s gesendet. Die Zustellung kann einige Minuten in Anspruch nehmen. Bitte schauen Sie ggf. auch in Ihren Spamordner." password_reset_success = "Ein Link zum Ändern Ihres Passworts wurde soeben an Ihre angegebene E-Mail-Adresse %s gesendet. Die Zustellung kann einige Minuten in Anspruch nehmen. Bitte schauen Sie ggf. auch in Ihren Spamordner."
......
...@@ -73,6 +73,12 @@ user_update_error = "An unexpected error has occurred when updating your profile ...@@ -73,6 +73,12 @@ user_update_error = "An unexpected error has occurred when updating your profile
user_update_error_403 = "An error has occurred when updating your profile: Forbidden." user_update_error_403 = "An error has occurred when updating your profile: Forbidden."
user_update_error_expired = "Please log in to edit your profile." user_update_error_expired = "Please log in to edit your profile."
user_my_orders = "PDA Order Items"
orders_error = "Error when retrieving list of orders"
user_orders_empty = "There are no orders for your profile within the last 3 months."
order_delivery_address = "Delivery Address"
order_record = "Ordered Record"
password_reset_error = "An unexpected error has occurred." password_reset_error = "An unexpected error has occurred."
password_reset_error_username = "Please check if the email address %s is valid." password_reset_error_username = "Please check if the email address %s is valid."
password_reset_success = "We have sent you an e-mail to %s containing a link for changing your password. This may take several minutes. Please check also the junk folder of your mailbox." password_reset_success = "We have sent you an e-mail to %s containing a link for changing your password. This may take several minutes. Please check also the junk folder of your mailbox."
......
<!-- fid: fid - user - orders -->
<?php if (empty($orders)): ?>
<?=$this->translate('fid::user_orders_empty')?>
<?php else: ?>
<table class="table">
<tr>
<th><?=$this->translate('Date')?></th>
<?=$this->render('fid/user/orders/additionals-headers');?>
</tr>
<?php foreach ($orders as $order): ?>
<?=$this->render('fid/user/orders/entry', compact('order', 'addresses'))?>
<?php endforeach; ?>
</table>
<?php endif; ?>
<!-- fid: fid - user - orders - END -->
<!-- fid: fid - user - orders - data -->
<td>
<?php $recordId = $data['recordId'];
$recordLabel = $data['recordTitle'] ?? $recordId;
//$recordLabel = "ʙ";
if ($recordLink = $this->recordLink()->getRecordLink($recordId, 'id')):
?>
<a onClick="$('#modal').modal('hide');" target="_self" href="<?=$recordLink?>"><?=$this->escapeHtml($recordLabel)?></a>
<?php else: ?>
<?=$this->escapeHtml($recordLabel)?>
<?php endif; ?>
</td>
<td>
<?php $addressId = $data['deliveryAddress'];
if (isset($addresses[$addressId])):
?>
<?=$this->render('fid/user/address-display-inline', ['address' => $addresses[$addressId]])?>
<?php endif; ?>
</td>
<!-- fid: fid - user - orders - data - END -->
<!-- fid: fid - user - orders - additionals-headers -->
<th><?=$this->translate('fid::order_record')?></th>
<th><?=$this->translate('fid::order_delivery_address')?></th>
<!-- fid: fid - user - orders - additionals-headers - END -->
\ No newline at end of file
<!-- 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>
<!-- fid: fid - user - orders - entry - END -->
\ No newline at end of file
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
<!-- fid: myresearch - menu.phtml --> <!-- fid: myresearch - menu.phtml -->
<?php <?php
$user = $this->auth()->isLoggedIn(); $user = $this->auth()->isLoggedIn();
$patron = $user ? $this->auth()->getILSPatron() : false;
$capabilityParams = $patron ? ['patron' => $patron] : [];
?> ?>
<?php /* Offcanvas closing button missing in BS3! CK*/ ?> <?php /* Offcanvas closing button missing in BS3! CK*/ ?>
<button class="close-offcanvas btn btn-link" data-toggle="offcanvas"><?=$this->transEsc('navigate_back') ?></button> <button class="close-offcanvas btn btn-link" data-toggle="offcanvas"><?=$this->transEsc('navigate_back') ?></button>
...@@ -23,66 +21,26 @@ ...@@ -23,66 +21,26 @@
<h4><?=$this->transEsc('Your Account')?></h4> <h4><?=$this->transEsc('Your Account')?></h4>
<div class="myresearch-menu account-menu"> <div class="myresearch-menu account-menu">
<?php if ('ils-none' !== $this->ils()->getOfflineMode()): ?> <?php if ('ils-none' !== $this->ils()->getOfflineMode()): ?>
<?php if ($this->ils()->checkCapability('getMyTransactions', $capabilityParams)): ?>
<a href="<?=$this->url('myresearch-checkedout')?>" class="flex checkedout<?=$this->active == 'checkedout' ? ' active' : ''?>">
<span class="flex-col"><i class="fa fa-fw fa-book" aria-hidden="true"></i>&nbsp;<?=$this->transEsc('Checked Out Items')?></span>
<span class="checkedout-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span>
</a>
<?php endif; ?>
<?php if ($this->ils()->checkFunction('getMyTransactionHistory', $capabilityParams)): ?>
<a href="<?=$this->url('myresearch-historicloans')?>"<?=$this->active == 'historicloans' ? ' class="active"' : ''?>>
<i class="fa fa-fw fa-history" aria-hidden="true"></i> <?=$this->transEsc('Loan History')?>
</a>
<?php endif; ?>
<?php if ($this->ils()->checkCapability('getMyHolds', $capabilityParams)): ?>
<a href="<?=$this->url('myresearch-holds')?>" class="flex<?=$this->active == 'holds' ? ' active' : ''?>">
<span class="flex-col"><i class="fa fa-fw fa-flag" aria-hidden="true"></i>&nbsp;<?=$this->transEsc('Holds and Recalls')?></span>
<span class="holds-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span>
</a>
<?php endif; ?>
<?php if ($this->ils()->checkFunction('StorageRetrievalRequests', $capabilityParams)): ?>
<a href="<?=$this->url('myresearch-storageretrievalrequests')?>" class="flex<?=$this->active == 'storageRetrievalRequests' ? ' active' : ''?>">
<span class="flex-col"><i class="fa fa-fw fa-archive" aria-hidden="true"></i> <?=$this->transEsc('Storage Retrieval Requests')?></span>
<span class="storageretrievalrequests-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span>
</a>
<?php endif; ?>
<?php if ($this->ils()->checkFunction('ILLRequests', $capabilityParams)): ?>
<a href="<?=$this->url('myresearch-illrequests')?>" class="flex<?=$this->active == 'ILLRequests' ? ' active' : ''?>">
<span class="flex-col"><i class="fa fa-fw fa-exchange" aria-hidden="true"></i> <?=$this->transEsc('Interlibrary Loan Requests')?></span>
<span class="illrequests-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span>
</a>
<?php endif; ?>
<?php if ($this->ils()->checkCapability('getMyFines', $capabilityParams)): ?>
<a href="<?=$this->url('myresearch-fines')?>" class="flex<?=$this->active == 'fines' ? ' active' : ''?>">
<span class="flex-col"><i class="fa fa-fw fa-usd" aria-hidden="true"></i>&nbsp;<?=$this->transEsc('Fines')?></span>
<span class="fines-status status hidden"><i class="fa fa-spin fa-spinner" aria-hidden="true"></i></span>
</a>
<?php endif; ?>
<a href="<?=$this->url('myresearch-profile')?>"<?=$this->active == 'profile' ? ' class="active"' : ''?>> <a href="<?=$this->url('myresearch-profile')?>"<?=$this->active == 'profile' ? ' class="active"' : ''?>>
<i class="fa fa-fw fa-user" aria-hidden="true"></i> <i class="fa fa-fw fa-user" aria-hidden="true"></i>
<?=$this->transEsc('Profile')?> <?=$this->transEsc('Profile')?>
</a> </a>
<?php /* refs #15480 add password change to fid profile */ ?> <?php /* refs #15480 add password change to fid profile */ ?>
<?php if ($this->auth()->isLoggedIn()): ?>
<a href="<?=$this->url('fid/user/reset-password')?>" data-lightbox> <a href="<?=$this->url('fid/user/reset-password')?>" data-lightbox>
<span class="no-padding"> <span class="no-padding">
<i class="fa fa-fw fa-lock" aria-hidden="true"></i> <i class="fa fa-fw fa-lock" aria-hidden="true"></i>
</span> </span>
<?=$this->transEsc('Change Password')?> <?=$this->transEsc('Change Password')?>
</a> </a>
<? endif; ?>
<?php if ($this->auth()->isLoggedIn()): ?>
<a href="<?=$this->url('fid/user/change-username')?>" data-lightbox> <a href="<?=$this->url('fid/user/change-username')?>" data-lightbox>
<span class="no-padding"> <span class="no-padding">
<i class="fa fa-fw fa-envelope" aria-hidden="true"></i> <i class="fa fa-fw fa-envelope" aria-hidden="true"></i>
</span> </span>
<?=$this->transEsc('fid::username_change_link')?> <?=$this->transEsc('fid::username_change_link')?>
</a> </a>
<? endif; ?>
<?php if ($user = $this->auth()->isLoggedIn()): ?>
<span class="logout-button"> <span class="logout-button">
<a href="<?=$this->url('myresearch-logout')?>"> <a href="<?=$this->url('myresearch-logout')?>">
<span class="no-padding"> <span class="no-padding">
...@@ -92,9 +50,8 @@ ...@@ -92,9 +50,8 @@
<?=$this->transEsc("Logout")?> <?=$this->transEsc("Logout")?>
</a> </a>
</span> </span>
<? endif; ?>
<?php if ($user && $user->libraryCardsEnabled()): ?> <?php if ($user->libraryCardsEnabled()): ?>
<a href="<?=$this->url('librarycards-home')?>"<?=$this->active == 'librarycards' ? ' class="active"' : ''?>> <a href="<?=$this->url('librarycards-home')?>"<?=$this->active == 'librarycards' ? ' class="active"' : ''?>>
<i class="fa fa-fw fa-barcode" aria-hidden="true"></i> <?=$this->transEsc('Library Cards')?> <i class="fa fa-fw fa-barcode" aria-hidden="true"></i> <?=$this->transEsc('Library Cards')?>
</a> </a>
...@@ -103,7 +60,7 @@ ...@@ -103,7 +60,7 @@
</div> </div>
<br /> <br />
<?php if ($user && $this->userlist()->getMode() !== 'disabled'): ?> <?php if ($this->userlist()->getMode() !== 'disabled'): ?>
<h4><?=$this->transEsc('Your Lists')?></h4> <h4><?=$this->transEsc('Your Lists')?></h4>
<div class="myresearch-menu"> <div class="myresearch-menu">
......
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