{% extends "layout_default.phtml" %}

{% block meta_title %}{% trans 'Profile' %}{% endblock %}
{% set active_menu = 'system' %}

{% block content %}

<!-- Full width tabs --> 
<div class="widget simpleTabs first">
    <ul class="tabs">
        <li><a href="#tab-profile">{% trans 'Profile' %}</a></li>
        <li><a href="#tab-password">{% trans 'Password' %}</a></li>
        <li><a href="#tab-api">{% trans 'API' %}</a></li>
    </ul>

    <div class="tab_container">
        <div id="tab-profile" class="tab_content nopadding">
            
            <div class="help">
                <h3>{% trans 'Manage staff member details' %}</h3>
            </div>

            <form method="post" action="admin/staff/update" class="mainForm api-form" data-api-redirect="staff">
                <fieldset>
                    <div class="rowElem noborder">
                        <label>{% trans 'Group' %}</label>
                        <div class="formRight">
                            {{ mf.selectbox('admin_group_id', admin.staff_group_get_pairs, staff.group.id, 1) }}
                        </div>
                        <div class="fix"></div>
                    </div>
                    <div class="rowElem">
                        <label for="name">{% trans 'Name' %}</label>
                        <div class="formRight">
                            <input type="text" name="name" value="{{staff.name}}" required="required"/>
                        </div>
                        <div class="fix"></div>
                    </div>
                    <div class="rowElem">
                        <label for="email">{% trans 'Email' %}</label>
                        <div class="formRight">
                            <input type="text" name="email" value="{{staff.email}}" required="required"/>
                        </div>
                        <div class="fix"></div>
                    </div>  
                    <div class="rowElem">
                        <label>{% trans 'Status' %}</label>
                        <div class="formRight">
                            <input type="radio" name="status" value="active"{% if staff.status == 'active' %} checked="checked"{% endif %}/><label>Active</label>
                            <input type="radio" name="status" value="inactive"{% if staff.status == 'inactive' %} checked="checked"{% endif %} /><label>Inactive</label>
                        </div>
                        <div class="fix"></div>
                    </div>
                    <div class="rowElem">
                        <label for="signature">{% trans 'Signature' %}</label>
                        <div class="formRight">
                            <textarea name="signature" cols="5" rows="2">{{staff.signature}}</textarea>
                        </div>
                        <div class="fix"></div>
                    </div>
                    <input type="hidden" name="id" value="{{ staff.id }}">
                    <input type="submit" value="{% trans 'Update' %}" class="greyishBtn submitForm" />
                </fieldset>
            </form>

            <div class="body">
                <a href="{{ 'staff'|alink }}"  title="" class="btnIconLeft mr10"><img src="images/icons/dark/arrowLeft.png" alt="" class="icon"><span>Go back</span></a>
            </div>
        </div>
        
        <div id="tab-password" class="tab_content nopadding">
            <div class="help">
                <h3>{% trans 'Change staff member password' %}</h3>
            </div>

            <form method="post" action="admin/staff/change_password" class="mainForm api-form" data-api-msg="{% trans 'Staff member password changed' %}">
                <fieldset>
                    <div class="rowElem">
                        <label for="password">{% trans 'Password' %}</label>
                        <div class="formRight">
                        <input type="password" name="password" required="required"/>
                        </div>
                        <div class="fix"></div>
                    </div>
                    <div class="rowElem">
                        <label for="password_confirm">{% trans 'Repeat same password' %}</label>
                        <div class="formRight">
                        <input type="password" name="password_confirm" required="required"/>
                        </div>
                        <div class="fix"></div>
                    </div>
                    
                    <input type="hidden" name="id" value="{{ staff.id }}">
                    <input type="submit" value="{% trans 'Submit' %}" class="greyishBtn submitForm" />
                </fieldset>
            </form>
        </div>
        
        <div id="tab-api" class="tab_content nopadding">
            <div class="help">
                <h3>{% trans 'Api key is used to manage system via other interfaces.' %}</h3>
            </div>

            <form method="post" action="admin/staff/profile_generate_api_key" class="mainForm api-form" data-api-reload="1">
                <fieldset>
                    <div class="rowElem">
                        <label>{% trans 'API key' %}</label>
                        <div class="formRight">
                            <input type="text" value="{{ admin.staff_profile_get.api_token }}"/>
                        </div>
                        <div class="fix"></div>
                    </div>
                    <input type="hidden" name="id" value="{{ staff.id }}">
                    <input type="submit" value="{% trans 'Generate new key' %}" class="greyishBtn submitForm" />
                </fieldset>
            </form>

        </div>
    </div>
    <div class="fix"></div>	 
</div>

{% endblock %}