{% extends "layout_default.phtml" %}

{% import "macro_functions.phtml" as mf %}

{% set active_menu = 'products' %}

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

{% block breadcrumbs %}
<ul>
    <li class="firstB"><a href="{{ '/'|alink }}">{{ 'Home'|trans }}</a></li>
    <li><a href="{{ 'product'|alink }}">{{ 'Products'|trans }}</a></li>
    <li><a href="{{ 'product'|alink }}#tab-categories">{{ 'Categories'|trans }}</a></li>
    <li class="lastB">{{ category.title}}</li>
</ul>
{% endblock %}

{% block content %}
<div class="widget">
    <div class="head">
        <h5>{{ category.title }}</h5>
    </div>
    
    <form method="post" action="{{ 'api/admin/product/category_update'|link }}" class="mainForm save api-form" data-api-msg="{{ 'Category updated'|trans }}">
        <fieldset>
            <div class="rowElem noborder">
                <label>{{ 'Title'|trans }}:</label>
                <div class="formRight">
                    <input type="text" name="title" value="{{ category.title }}" required="required"/>
                </div>
                <div class="fix"></div>
            </div>
            
            <div class="rowElem">
                <label>{{ 'Icon'|trans }}:</label>
                <div class="formRight">
                    <input type="text" name="icon_url" id="bb-icon" value="{{ category.icon_url }}" style="width: 80%"/>
                    <input type="button" value="{{ 'Browse'|trans }}" class="bHtml blueBtn button" />
                </div>
                <div class="fix"></div>
            </div>

            <textarea name="description" cols="5" rows="20" class="bb-textarea">{{ category.description }}</textarea>

            <input type="submit" value="{{ 'Update'|trans }}" class="greyishBtn submitForm" />
            <input type="hidden" name="id" value="{{ category.id }}"/>
        </fieldset>
    </form>
</div>
{% endblock %}

{% block head %}{{ mf.bb_editor('.bb-textarea') }}{% endblock %}

{% block js %}
<script type="text/javascript">
    $(function() {
        $(".bHtml").click( function() {
            jAlert(bb.load("{{ 'filemanager/icons'|alink }}", { rel: "bb-icon" }), "{{ 'Select icon and click OK'|trans }}");
        });
    });
</script>
{% endblock %}
