<div class="general-block-decorator">
    <div class="table-responsive">
        <table class="table table-striped table-condensed table-left-aligned">
            <caption class="clearfix">
                {$caption_title|default:{intl l='classic modules'}}
            </caption>
            <thead>
            <tr>
                <th>
                {admin_sortable_header
                   current_order=$module_order
                   order='id'
                   reverse_order='id_reverse'
                   path={url path='/admin/modules'}
                   request_parameter_name='module_order'
                   label="{intl l='ID'}"
                }
                </th>
                <th>
                {admin_sortable_header
                   current_order=$module_order
                   order='alpha'
                   reverse_order='alpha_reverse'
                   path={url path='/admin/modules'}
                   request_parameter_name='module_order'
                   label="{intl l='Name'}"
                }
                </th>

                <th>
                {admin_sortable_header
                   current_order=$module_order
                   order='code'
                   reverse_order='code_reverse'
                   path={url path='/admin/modules'}
                   request_parameter_name='module_order'
                   label="{intl l='Code'}"
                }
                </th>

                <th>
                {admin_sortable_header
                   current_order=$module_order
                   order='title'
                   reverse_order='title_reverse'
                   path={url path='/admin/modules'}
                   request_parameter_name='module_order'
                   label="{intl l='Description'}"
                }
                </th>

                <th class="text-center">
                {admin_sortable_header
                   current_order=$module_order
                   order='enabled'
                   reverse_order='enabled_reverse'
                   path={url path='/admin/modules'}
                   request_parameter_name='module_order'
                   label="{intl l='Enable/Disable'}"
                }
                </th>

                <th class="text-center">
                {admin_sortable_header
                   current_order=$module_order
                   order='manual'
                   reverse_order='manual_reverse'
                   path={url path='/admin/modules'}
                   request_parameter_name='module_order'
                   label="{intl l='Position'}"
                }
                </th>

                {module_include location='modules_table_header'}

                <th class="actions">{intl l="Actions"}</th>
            </tr>
            </thead>

            <tbody>
            {loop type="module" name="module.{$module_type}" module_type={$module_type|default:1} order=$module_order backend_context=1}
                <tr {if ! $EXISTS}class="warning"{/if}>
                    <td>{$ID}</td>
                    <td>{$TITLE}</td>
                    <td>{$CODE}</td>
                    <td>{$CHAPO}</td>

                    {if $EXISTS}
                        <td class="text-center">
                            <div class="make-switch switch-small module-activation" data-id="{$ID}" data-on="success" data-off="danger" data-on-label="<i class='glyphicon glyphicon-ok-circle'></i>" data-off-label="<i class='glyphicon glyphicon-remove-circle'></i>">
                                <input type="checkbox" {if $ACTIVE}checked{/if}>
                            </div>
                            <noscript>
                                {if $ACTIVE}
                                    <a title="{intl l="Deactivate %title module" title={$TITLE}}" href="{url path="/admin/module/toggle-activation/{$ID}"}">{intl l="deactivation"}</a>
                                {else}
                                    <a title="{intl l="activate %title module" title={$TITLE}}" href="{url path="/admin/module/toggle-activation/{$ID}"}">{intl l="activation"}</a>
                                {/if}
                            </noscript>
                        </td>

                        <td class="text-center">
                            {admin_position_block
                                resource="admin.modules"
                                access="UPDATE"
                                path={url path="admin/module/update-position"}
                                url_parameter="module_id"
                                in_place_edit_class="modulePositionChange"
                                position=$POSITION
                                id=$ID
                            }
                        </td>
                    {else}
                        <td colspan="2" class="text-left">
                            <span class="label label-warning">Warning</span>
                            {intl l="This module cannot be started, some files are probably missing."}
                        </td>
                    {/if}

                    {module_include location='modules_table_row'}

                    <td class="text-right">
                        <div class="btn-group">
                            {if $EXISTS}
                                {if $CONFIGURABLE == 1}
                                    {loop type="auth" name="can_change" role="ADMIN" module=$CODE access="VIEW"}
                                        <a class="{if ! $ACTIVE}disabled {/if} btn btn-primary btn-xs" id="config-btn-{$ID}" title="{intl l='Configure this module'}" href="{url path="/admin/module/$CODE"}">{intl l="Configure"}</a>
                                    {/loop}
                                {/if}

                                {*loop type="auth" name="can_change" role="ADMIN" resource="admin.modules" access="VIEW"}
                                    <a class="btn btn-default btn-xs" title="{intl l='Read the documentation of this module'}" href="{url path="/admin/module/documentation/$ID"}"><span class="glyphicon glyphicon-book"></span></a>
                                {/loop*}

                                {loop type="auth" name="can_change" role="ADMIN" resource="admin.module" access="UPDATE"}
                                    <a class="btn btn-default btn-xs" title="{intl l='Edit this module'}" href="{url path="/admin/module/update/$ID"}"><span class="glyphicon glyphicon-edit"></span></a>
                                {/loop}
                            {/if}

                            {loop type="auth" name="can_delete" role="ADMIN" resource="admin.module" access="DELETE"}
                                <a class="btn btn-default btn-xs module-delete-action" title="{intl l='Delete this module'}" href="#delete_module_dialog" data-id="{$ID}" data-toggle="modal"><span class="glyphicon glyphicon-trash"></span></a>
                            {/loop}
                        </div>
                    </td>
                </tr>
            {/loop}
            </tbody>
        </table>
    </div>
</div>