<dtml-var manage_page_header>

<dtml-with "_(management_view='Undo')">
  <dtml-var manage_tabs>
</dtml-with>

<main class="container-fluid">

	<dtml-if undoable_transactions>

		<dtml-unless first_transaction><dtml-call "REQUEST.set('first_transaction', None)"></dtml-unless>

		<p class="form-help mt-4">
			This application's transactional feature allows you to easily undo changes 
			made to the application's settings or data. You can revert the application 
			to a <em>snapshot</em> of its state at a previous point in time.
		</p>

		<form action="manage_undo_transactions" method="post">
			<dtml-unless first_transaction><dtml-call "REQUEST.set('first_transaction', None)"></dtml-unless>

			<nav class="zmi-find-results nav row mb-2">
				<div class="col-6">
					<dtml-if first_transaction
						><a class="btn btn-primary" title="View later transactions"
							href="manage_UndoForm?first_transaction:int=<dtml-var expr="first_transaction*2-last_transaction"
							>&last_transaction:int=&dtml-first_transaction;&PrincipiaUndoBatchSize:int=&dtml-PrincipiaUndoBatchSize;"
							><i class="fas fa-chevron-left"></i>&nbsp;&nbsp;Later Transactions</a>
					<dtml-else>
						&nbsp;
					</dtml-if>
				</div>
				<div class="col-6 text-right">
					<dtml-if expr="_.len(undoable_transactions) == PrincipiaUndoBatchSize"
						><a class="btn btn-primary" title="View earlier transactions" 
							href="manage_UndoForm?first_transaction:int=&dtml-last_transaction;&last_transaction:int=<dtml-var expr="last_transaction+PrincipiaUndoBatchSize"
							>&PrincipiaUndoBatchSize:int=&dtml-PrincipiaUndoBatchSize;"
							>Earlier Transactions&nbsp;&nbsp;<i class="fas fa-chevron-right"></i></a>
					<dtml-else>
						&nbsp;
					</dtml-if>
				</div>
			</nav>

			<table class="table table-sm table-striped">
				<tbody>
					<dtml-in undoable_transactions mapping>
						<tr>
							<td>
								<div class="form-check text-right"><input class="form-check-input" type="checkbox" name="transaction_info:list" value="&dtml-id;" /></div>
							</td>
							<td>
								<dtml-var description html_quote newline_to_br> 
								by <strong><dtml-if user_name>&dtml-user_name;<dtml-else><em>Zope</em></dtml-if></strong>
							</td>
							<td class="text-nowrap">
								<dtml-var time fmt="%Y-%m-%d %H:%M:%S">
							</td>
						</tr>
					</dtml-in>
				</tbody>
			</table>

			<div class="zmi-controls">
				<input class="btn btn-primary" type="submit" name="submit" value=" Undo " />
			</div>

		</form>

	<dtml-else>

		<div class="alert alert-warning mt-4">There are no transactions that can be undone.</div>

</dtml-if>

</main>

<dtml-var manage_page_footer>
