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

{% set active_menu = 'products' %}

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

{% block breadcrumbs %}
<ul class="breadcrumb">
    <li class="breadcrumb-item">
        <a href="{{ '/'|url }}">
            <svg class="icon">
                <use xlink:href="#home" />
            </svg>
        </a>
    </li>
    <li class="breadcrumb-item">
        <a href="{{ 'product'|url }}">{{ 'Products'|trans }}</a>
    </li>
    <li class="breadcrumb-item">
        <a href="{{ 'product'|url }}#tab-categories">{{ 'Categories'|trans }}</a>
    </li>
    <li class="breadcrumb-item active" aria-current="page">{{ category.title}}</li>
</ul>
{% endblock %}

{% block content %}
<div class="card">
    <form method="post" action="{{ 'product/category_update'|api_url }}" {{ fb_api_form({message: 'Category Updated'|trans}) }}>
        {% embed 'partial_admin_form_card.html.twig' with {
            title: category.title,
            subtitle: 'Update the category title, icon, and description shown on the products area.'|trans,
            body_class: 'pt-4',
            footer_align: 'between'
        } %}
            {% block form_content %}
                <div class="row g-3">
                    <div class="col-lg-6">
                        <label class="form-label">{{ 'Title'|trans }}</label>
                        <input class="form-control" type="text" name="title" value="{{ category.title }}" required>
                    </div>
                    <div class="col-lg-6">
                        <label class="form-label">{{ 'Icon'|trans }}</label>
                        <input class="form-control" type="text" name="icon_url" id="bb-icon" value="{{ category.icon_url }}">
                    </div>
                    <div class="col-12">
                        <label class="form-label">{{ 'Description'|trans }}</label>
                        <textarea class="editor-textarea" name="description" rows="5">{{ category.description }}</textarea>
                    </div>
                </div>
                <input type="hidden" name="id" value="{{ category.id }}">
            {% endblock %}

            {% block form_actions %}
                <a href="{{ 'product'|url }}" class="btn btn-secondary">
                    <svg class="icon">
                        <use xlink:href="#arrow-sm-left" />
                    </svg>
                    {{ 'Go Back'|trans }}
                </a>
                <button class="btn btn-primary" type="submit">{{ 'Update'|trans }}</button>
            {% endblock %}
        {% endembed %}
    </form>
</div>
{% endblock %}

{% block head %}{{ wysiwyg('.editor-textarea') }}{% endblock %}
