{% if not error %}

<div class="portal-container">
	<div class="portal-section">
		<p>{{ _(client_id) }} {{ _("wants to access the following details from your account") }}</p>
	</div>
	<div class="portal-items">
		{% for dtl in details %}
		<div class="portal-section">
			{{ _(dtl.title()) }}
		</div>
      	{% endfor %}
	</div>
	<div class="portal-section">
		<div class="action-buttons" style="display: flex; flex-direction: row-reverse; width: 100%;">
			<button id="allow" class="btn btn-sm btn-primary">{{ _("Allow") }}</button>
			<button id="deny" class="btn btn-sm btn-light mr-3">{{ _("Deny") }}</button>
		  </div>
	</div>
</div>

<script type="text/javascript">
  frappe.ready(function() {
    $('#allow').on('click', function(event) {
      window.location.replace("{{ success_url | string }}");
    });
    $('#deny').on('click', function(event) {
      window.location.replace("{{ failure_url | string }}");
    });
  });
</script>
{% else %}
<div class="panel panel-danger">
  <div class="panel-heading">
    <h3 class="panel-title">{{ _("Authorization error for {}.").format(client_id) }}</h3>
  </div>
  <div class="panel-body">
    <p>{{ _("An unexpected error occurred while authorizing {}.").format(client_id) }}</p>
    <h4>{{ error }}</h4>
  </div>
</div>
{% endif %}
