<xf:title>{{ phrase('finalize_import') }}</xf:title>

<xf:form action="{{ link('import/finalize') }}" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:inforow>
				{{ phrase('all_data_has_now_been_imported_last_step_is_to_finalize_import') }}
			</xf:inforow>
			<xf:macro name="notes" arg-notes="{$notes}" />
		</div>
		<xf:submitrow submit="{{ phrase('finalize_import') }}" sticky="true" />
	</div>
</xf:form>

<xf:macro name="notes" arg-notes="!">
	<xf:formrow label="{{ phrase('import_log_table') }}"
		explain="{{ phrase('this_table_contains_mappings_from_old_ids_to_new_ids') }}">
		{$notes.logTable}
	</xf:formrow>
	<xf:formrow label="{{ phrase('total_run_time') }}">
		<xf:if is="$notes.runTime > 3600">
			{{ phrase('x_hours', {'count': number($notes.runTime / 3600, 2)}) }}
		<xf:elseif is="$notes.runTime >= 120" />
			{{ phrase('x_minutes', {'count': number($notes.runTime / 60, 2)}) }}
		<xf:else />
			{{ phrase('x_seconds', {'count': number($notes.runTime)}) }}
		</xf:if>
	</xf:formrow>
	<xf:formrow label="{{ phrase('import_totals') }}">
		<xf:foreach loop="$notes.totals" value="$total">
			<dl class="pairs pairs--columns pairs--fixedSmall">
				<dt>{$total.title}</dt>
				<dd>
					{$total.total|number}
					<xf:if is="$total.total">
						<xf:if is="$total.time > 3600">
							{{ parens(phrase('x_hours_y_minutes', {
								'hours': number($total.time / 3600, 0),
								'minutes': number(($total.time / 60) % 60, 0)
							})) }}
						<xf:elseif is="$total.time >= 120" />
							{{ parens(phrase('x_minutes', {'count': number($total.time / 60, 2)})) }}
						<xf:else />
							{{ parens(phrase('x_seconds', {'count': number($total.time)})) }}
						</xf:if>
					</xf:if>
				</dd>
			</dl>
		</xf:foreach>
	</xf:formrow>
	<xf:if is="$notes.notes">
		<hr class="formRowSep" />

		<xf:foreach loop="$notes.notes" value="$noteSet">
			<xf:formrow label="{$noteSet.title}">
				<ul style="margin-top: 0; margin-bottom: 0">
				<xf:foreach loop="$noteSet.entries" value="$entry">
					<li>{$entry}</li>
				</xf:foreach>
				</ul>
			</xf:formrow>
		</xf:foreach>
	</xf:if>
</xf:macro>