{% extends 'bulma.html.twig' %}

{% block title %}Administration > Jeu > Éditer{% endblock %}

{% block content %}

    {{ form_errors(form) }}
    {{ form_start(form) }}

    {{ form_row(form.name) }}
    {{ form_row(form.slug) }}
    {{ form_row(form.description)}}

    {# gestion de l'illustration #}
    <div class="box">
    <div class="field">
        <div class="columns">
            <div class="column">
                {{ form_label(form.picture) }}
                <div class="file has-name is-fullwidth" id="file-js"  {{ stimulus_controller('bulma-filenames') }}>
                <label class="file-label" >
                    {{ form_widget(form.picture) }}
                    <span class="file-cta">
                    <span class="file-icon">
                        <twig:ux:icon name="bi:cloud-upload" />
                    </span>
                    <span class="file-label"> Choisissez un fichier… </span>
                    </span>
                    <span class="file-name"> aucun fichier </span>
                </label>
                </div>
                {{ form_help(form.picture) }}
                {% if game.picture %}
                <div class="field mt-2">
                <p><a data-id="{{ path('app_admin_game_del_pic', {id: game.id}) }}" href="#" class="button is-danger" {{ stimulus_controller('admin_confirm') }}><twig:ux:icon name="bi:trash-fill" class="small-icon-in-text"/> Supprimer l'image chargée.</a></p>
                </div>
                {% endif %}
                

            </div>
            <div class="column">
                {% if game.picture %}
                <img src="/images/games/{{ game.picture }}" class="image is-3by1"/>
                {% endif %}
            </div>
        </div>
    </div>
    </div>
    





    <div class="box">
    {{ form_row(form.ageRecommendation) }}
    <div class="field">
        {{ form_label(form.genre) }}
        {{ form_widget(form.genre) }}
        {{ form_help(form.genre) }}
    </div>
    </div>

    <div class="columns">
        <div class="column">
            <div class="box" {{ stimulus_controller('admin_game') }}>
                <h3 class="title is-5">Support du jeu</h3>
                <div class="field" id="library-controller">
                    {{ form_widget(form.isInAssoLibrary) }}
                    {{ form_label(form.isInAssoLibrary) }}
                    {{ form_help(form.isInAssoLibrary) }}
                </div>
                <div class="field only-in-library {% if not game.isInAssoLibrary %}is-hidden{% endif %}">
                    {{ form_widget(form.isPhysical) }}
                    {{ form_label(form.isPhysical) }}
                    {{ form_help(form.isPhysical) }}
                </div>
                <div class="field only-in-library {% if not game.isInAssoLibrary %}is-hidden{% endif %}">
                    {{ form_widget(form.isNumerical) }}
                    {{ form_label(form.isNumerical) }}
                    {{ form_help(form.isNumerical) }}
                </div>
                <div class="field only-in-library {% if not game.isInAssoLibrary %}is-hidden{% endif %}">
                    {{ form_label(form.urlNumericalVersion) }}
                    {{ form_widget(form.urlNumericalVersion) }}
                    {{ form_help(form.urlNumericalVersion) }}
                </div>   
            </div>
        </div>
        <div class="column">
            <div class="box">
                <h3 class="title is-5">Gestion de la fiche</h3>
                {{ form_row(form.addBy) }}
                {{ form_row(form.addDatetime) }}
                <div class="field">
                    {{ form_widget(form.isValidByAdmin) }}
                    {{ form_label(form.isValidByAdmin) }}
                    {{ form_help(form.isValidByAdmin) }}
                </div>

                {{ form_widget(form) }}
            </div>
        </div>
    </div>
    




    <div class="control">
        <button class="button is-primary" type="submit">Envoyer</button>
        <a href="{{ path('app_admin_game') }}" class="button">Annuler</a>
    </div>

    {{ form_end(form) }}

{% endblock %}
