{% extends "base.html.twig" %}
{% trans_default_domain 'www' %}
{% set t_root = 'coach.profile' %}

{% block title %}{{ new ? (t_root ~ '.edit-page.new-title')|trans : (t_root ~ '.edit-page.edit-title')|trans|raw }}{% endblock %}
{% block page_title %}{{ new ? (t_root ~ '.edit-page.new-title')|trans : (t_root ~ '.edit-page.edit-title')|trans|raw }}{% endblock %}

{% block body %}

    <div class="row mt-2">

        {{ form_start(form) }}
            <div class="form-errors">
                {{ form_errors(form) }}
            </div>

            <div class="col mb-3">
                {{ form_label(form.first_name, t_root ~ '.fields.@first-name.label', { 'label_attr': {'class': 'form-label'} }) }}
                <div class="form-errors"> {{ form_errors(form.first_name) }} </div>
                {{ form_widget(form.first_name, { 'attr': {'class': 'form-control', 'placeholder': t_root ~ '.fields.@first-name.placeholder'} }) }}
            </div>

            <div class="col mb-3">
                {{ form_label(form.last_name, t_root ~ '.fields.@last-name.label', { 'label_attr': {'class': 'form-label'} }) }}
                <div class="form-errors"> {{ form_errors(form.last_name) }} </div>
                {{ form_widget(form.last_name, { 'attr': {'class': 'form-control', 'placeholder': t_root ~ '.fields.@last-name.placeholder'} }) }}
            </div>

            <div class="col mb-3">
                {{ form_label(form.email, t_root ~ '.fields.@email.label', { 'label_attr': {'class': 'form-label'} }) }}
                <div class="form-errors"> {{ form_errors(form.email) }} </div>
                {{ form_widget(form.email, { 'attr': {'class': 'form-control', 'placeholder': t_root ~ '.fields.@email.placeholder'} }) }}
            </div>

            <div class="col mb-3">
                {{ form_label(form.coach_settings.company, t_root ~ '.fields.@company.label', { 'label_attr': {'class': 'form-label'} }) }}
                <div class="form-errors"> {{ form_errors(form.coach_settings.company) }} </div>
                {{ form_widget(form.coach_settings.company, { 'attr': {'class': 'form-control', 'placeholder': t_root ~ '.fields.@company.placeholder'} }) }}
            </div>

            <div class="col mb-3">
                {{ form_label(form.coach_settings.logoFile, t_root ~ '.fields.@logo.label', { 'label_attr': {'class': 'form-label'} }) }}
                <div class="form-errors"> {{ form_errors(form.coach_settings.logoFile) }} </div>
                <twig:ImageEditor view='{{ form.coach_settings.logoFile }}' />

                {# <react-image-editor 
                    data-defaultImageURL="xxxxx" 
                    data-imgMinWidth="{{ 500 }}"
                    data-imgMinHeight="{{ 500 }}"
                    data-fileMaxSize="{{ 500 }}" 
                
                    data-inputName="{{ 'xxxx' }}"
                    data-inputId="{{ 'xxxx' }}"
                    >
                </react-image-editor> #}
            

                {{ form_help(form.coach_settings.logoFile) }}
            </div>

            {% do form.coach_settings.logoFile.setRendered() %}

            <div class="edit-actions">
                <button type="submit" class="btn btn-success">{{ (t_root ~ '.actions.save')|trans }}</button>
                <a href="{{ path('admin_user_change_password') }}" class="btn btn-warning">{{ (t_root ~ '.actions.change-password')|trans }}</a>
            </div>

        {{ form_end(form) }}


    </div>

    {% if new %}
        <div class="row mt-2">
            <div class="alert alert-warning">
                <i class="fa fa-warning"></i> {{ (t_root ~ ".after-creation-warning")|trans }}
            </div>
        </div>
    {% endif %}

{% endblock %}