{% extends "layout.html" %}
{% from "_macros.html" import render_manage_form_styles, render_manage_form_scripts, render_jquery_steps_header, render_cropper_logo_block, render_crop_image_form_section, render_google_place_autocomplete_header, render_google_place_autocomplete_field, render_field_with_errors, render_field %}

{%- block title -%}
{{ _('Update organizer') }}
{%- endblock -%}

{% block styles %}
{{ render_manage_form_styles() }}
{% endblock %}

{% block header %}
{{ render_manage_form_scripts() }}
{{ render_jquery_steps_header() }}
{{ render_google_place_autocomplete_header() }}
{{ render_cropper_logo_block() }}
{% endblock %}

{% block content %}

<h1>{{ _('Update organizer') }}</h1>
<form action="{{ url_for('organizer_update', id=organizer.id) }}" method="POST" enctype="multipart/form-data">
  {{ form.hidden_tag() }}

  <div class="card mb-4">
    <div class="card-header">
      {{ _('Organizer') }}
    </div>
    <div class="card-body">
      {{ render_field_with_errors(form.name) }}
    </div>
  </div>

  <div class="card mb-4">
    <div class="card-header">
      {{ _('Location') }}
    </div>
    <div class="card-body">

      {{ render_google_place_autocomplete_field(True) }}

      {{ form.location.hidden_tag() }}
      {{ render_field_with_errors(form.location.street) }}
      {{ render_field_with_errors(form.location.postalCode) }}
      {{ render_field_with_errors(form.location.city) }}
      {{ render_field_with_errors(form.location.state) }}
      {{ render_field_with_errors(form.location.latitude) }}
      {{ render_field_with_errors(form.location.longitude) }}
    </div>
  </div>

  {{ render_crop_image_form_section(form.logo) }}

  <div class="card mb-4">
    <div class="card-header">
      {{ _('Additional information') }}
    </div>
    <div class="card-body">
    {{ render_field_with_errors(form.url) }}
    {{ render_field_with_errors(form.email) }}
    {{ render_field_with_errors(form.phone) }}
    {{ render_field_with_errors(form.fax) }}
    </div>
  </div>

  {{ render_field(form.submit) }}
</form>

{% endblock %}
