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

{% set active_menu = 'client' %}

{% block meta_title %}{{ group.title}}{% endblock %}

{% block breadcrumbs %}
    <ol class="breadcrumb">
        <li class="breadcrumb-item">
            <a href="{{ '/'|alink }}">
                <svg class="icon">
                    <use xlink:href="#home" />
                </svg>
            </a>
        </li>
        <li class="breadcrumb-item">
            <a href="{{ 'client'|alink }}#tab-groups">{{ 'Client groups'|trans }}</a>
        </li>
        <li class="breadcrumb-item active" aria-current="page">{{ group.title}}</li>
    </ol>
{% endblock %}

{% block content %}
<div class="card">
    <div class="card-header">
        <h4>{{ 'Edit client group'|trans }} - {{ group.title }}</h4>
    </div>
    <form method="post" action="{{ 'api/admin/client/group_update'|link }}" class="api-form" data-api-redirect="{{ 'client'|alink }}">
        <input type="hidden" name="CSRFToken" value="{{ CSRFToken }}"/>
        <div class="card-body">
            <div class="mb-3 row">
                <label class="form-label col-3 col-form-label">{{ 'Title'|trans }}:</label>
                <div class="col">
                    <input class="form-control" type="text" name="title" value="{{ group.title }}" required>
                </div>
            </div>
        </div>

        <input type="hidden" name="id" value="{{ group.id }}">

        <div class="card-footer d-flex gap-2">
            <a href="{{ 'client'|alink }}" class="btn btn-secondary w-25">
                <svg class="icon">
                    <use xlink:href="#arrow-sm-left" />
                </svg>
                {{ 'Go back'|trans }}
            </a>
            <button class="btn btn-primary w-100" type="submit">{{ 'Update'|trans }}</button>
            <a class="btn btn-danger w-25 api-link"
                href="{{ 'api/admin/client/group_delete'|link({ 'id': group.id, 'CSRFToken': CSRFToken }) }}"
                data-api-confirm="{{ 'Are you sure?'|trans }}"
                data-api-redirect="{{ 'client'|alink }}">
                <svg class="icon">
                    <use xlink:href="#delete" />
                </svg>
            </a>
        </div>
    </form>
</div>
{% endblock %}
