{extends file="admin-layout.tpl"}

{block name="no-return-functions"}
    {$admin_current_location = 'configuration'}
{/block}

{block name="page-title"}{intl l='List of not rewriten urls' d="rewriteurl.bo.default"}{/block}

{block name="main-content"}
    <div>
        <div id="wrapper" class="container">

            <ul class="breadcrumb">
                <li><a href="{url path='/admin/home'}">{intl l="Home" d="rewriteurl.bo.default"}</a></li>
                <li><a href="{url path='/admin/configuration'}">{intl l="Configuration" d="rewriteurl.bo.default"}</a></li>
                <li>{intl l="Not rewriten urls" d="rewriteurl.bo.default"}</li>
            </ul>

            <div class="row">
                <div class="col-md-12 general-block-decorator">
                    <div class="row">
                        <div class="col-md-4 title">
                            {intl l="List of not rewriten urls" d="rewriteurl.bo.default"}
                        </div>
                        <div class="col-md-4">
                            <div class="form-container pull-right">
                                <div class="inner-toolbar" style="border:none;">
                                    <div class="inner-actions">
                                        <ul class="nav nav-pills">
                                            {loop name="lang_list" type="lang" backend_context="1"}
                                                <li {if $ID == $edit_language_id}class="active"{/if}>
                                                    {if $current_tab}
                                                        {$lang_url = {url path={$page_url|default:$current_url nofilter} edit_language_id=$ID page_category=1 page_brand=1 page_content=1 page_folder=1 page_product=1 current_tab=$current_tab}}
                                                    {else}
                                                        {$lang_url = {url path={$page_url|default:$current_url nofilter} edit_language_id=$ID page_category=1 page_brand=1 page_content=1 page_folder=1 page_product=1}}
                                                    {/if}
                                                    <a class="language-change-button" data-language-id="{$ID}" href="{$lang_url nofilter}" title="{intl l='Edit information in %lng' d="rewriteurl.bo.default" lng={$TITLE}}">
                                                        <img src="{image file="assets/img/flags/$CODE.png"}" alt=$TITLE />
                                                    </a>
                                                </li>
                                            {/loop}
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <button type="button" class="btn btn-default pull-right js-popover" data-html="true" data-container="body" data-toggle="popover" data-placement="left"
                                    data-content="{intl l='For questions or bug reporting, thank you to use %url.' url='<a href=\'https://github.com/thelia-modules/RewriteUrl\' target=\'_blank\'>GitHub</a>' d="rewriteurl.bo.default"}">
                                <i class="glyphicon glyphicon-info-sign"></i>
                            </button>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12">
                            <ul class="nav nav-tabs" id="tabbed-menu" role="tablist">
                                <li role="presentation" class="active">
                                    <a href="#categories" aria-controls="categories" role="tab" data-toggle="tab">
                                        {intl l="Categories" d="rewriteurl.bo.default"}
                                        <span class="label label-warning">({count type="list-notrewritenurls" name="list-notrewritenurls-category" lang=$edit_language_id view="category"})</span>
                                    </a>
                                </li>
                                <li role="presentation">
                                    <a href="#products" aria-controls="products" role="tab" data-toggle="tab">
                                        {intl l="Products" d="rewriteurl.bo.default"}
                                        <span class="label label-warning">({count type="list-notrewritenurls" name="list-notrewritenurls-product" lang=$edit_language_id view="product"})</span>
                                    </a>
                                </li>
                                <li role="presentation">
                                    <a href="#brands" aria-controls="brands" role="tab" data-toggle="tab">
                                        {intl l="Brands" d="rewriteurl.bo.default"}
                                        <span class="label label-warning">({count type="list-notrewritenurls" name="list-notrewritenurls-brand" lang=$edit_language_id view="brand"})</span>
                                    </a>
                                </li>
                                <li role="presentation">
                                    <a href="#folders" aria-controls="folders" role="tab" data-toggle="tab">
                                        {intl l="Folders" d="rewriteurl.bo.default"}
                                        <span class="label label-warning">({count type="list-notrewritenurls" name="list-notrewritenurls-folder" lang=$edit_language_id view="folder"})</span>
                                    </a>
                                </li>
                                <li role="presentation">
                                    <a href="#contents" aria-controls="contents" role="tab" data-toggle="tab">
                                        {intl l="Contents" d="rewriteurl.bo.default"}
                                        <span class="label label-warning">({count type="list-notrewritenurls" name="list-notrewritenurls-content" lang=$edit_language_id view="content"})</span>
                                    </a>
                                </li>
                            </ul>
                            <div class="tab-content">
                                <div role="tabpanel" class="tab-pane active" id="categories">
                                    {ifloop rel="list-notrewritenurls-category"}
                                        <div class="table-responsive">
                                            <table class="table table-striped table-condensed">
                                                <caption class="clearfix">
                                                    {intl l='Categories' d="rewriteurl.bo.default"}
                                                </caption>

                                                <thead>
                                                <tr>
                                                    <th>
                                                        {intl l='ID' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th>
                                                        {intl l='Name' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th class="actions">
                                                        {intl l='Actions' d="rewriteurl.bo.default"}
                                                    </th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                {loop type="list-notrewritenurls" name="list-notrewritenurls-category" page=$page_category backend_context="on" lang=$edit_language_id view="category" limit="10"}
                                                    <tr>
                                                        <td>
                                                            {$ID}
                                                        </td>
                                                        <td>
                                                            <a title="{intl l='Change this category' d="rewriteurl.bo.default"}" href="{url path="/admin/categories/update?category_id=%id" id=$ID}">{$NAME}</a>
                                                        </td>
                                                        <td class="actions">
                                                            <a class="btn btn-info" title="{intl l='Change this category' d="rewriteurl.bo.default"}" href="{url path="/admin/categories/update?category_id=%id" id=$ID}">
                                                                <span class="glyphicon glyphicon-edit"></span>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                {/loop}
                                                </tbody>
                                                <tfoot>
                                                <tr>
                                                    <td colspan="100">
                                                        {include
                                                        file = "includes/pagination.html"

                                                        loop_ref       = "list-notrewritenurls-category"
                                                        max_page_count = 10
                                                        page_param_name = "page_category"
                                                        page_url       = {url path="/admin/list-notrewritenurls" current_tab='categories'}
                                                        }

                                                    </td>
                                                </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                    {/ifloop}
                                    {elseloop rel="list-notrewritenurls-category"}
                                        <br/>
                                        <div class="alert alert-info">
                                            {intl l="All your categories have rewriten urls" d="rewriteurl.bo.default"}
                                        </div>
                                    {/elseloop}
                                </div>
                                <div role="tabpanel" class="tab-pane" id="products">
                                    {ifloop rel="list-notrewritenurls-product"}
                                        <div class="table-responsive">
                                            <table class="table table-striped table-condensed">
                                                <caption class="clearfix">
                                                    {intl l='Products' d="rewriteurl.bo.default"}
                                                </caption>

                                                <thead>
                                                <tr>
                                                    <th>
                                                        {intl l='ID' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th>
                                                        {intl l='Name' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th>
                                                        {intl l='Reference' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th class="actions">
                                                        {intl l='Actions' d="rewriteurl.bo.default"}
                                                    </th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                {loop type="list-notrewritenurls" name="list-notrewritenurls-product" lang=$edit_language_id view='product' page=$page_product limit="10" backend_context="on"}
                                                    <tr>
                                                        <td>
                                                            {$ID}
                                                        </td>
                                                        <td>
                                                            <a title="{intl l='Change this product' d="rewriteurl.bo.default"}" href="{url path="/admin/products/update?product_id=%id" id=$ID}">{$NAME}</a>
                                                        </td>
                                                        <td>
                                                            {$REF}
                                                        </td>
                                                        <td class="actions">
                                                            <a class="btn btn-info" title="{intl l='Change this product' d="rewriteurl.bo.default"}" href="{url path="/admin/products/update?product_id=%id" id=$ID}">
                                                                <span class="glyphicon glyphicon-edit"></span>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                {/loop}
                                                </tbody>
                                                <tfoot>
                                                <tr>
                                                    <td colspan="100">
                                                        {include
                                                        file = "includes/pagination.html"

                                                        loop_ref       = "list-notrewritenurls-product"
                                                        max_page_count = 10
                                                        page_param_name = "page_product"
                                                        page_url       = {url path="/admin/list-notrewritenurls" current_tab='products'}
                                                        }

                                                    </td>
                                                </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                    {/ifloop}
                                    {elseloop rel="list-notrewritenurls-product"}
                                        <br/>
                                        <div class="alert alert-info">
                                            {intl l="All your products have rewriten urls" d="rewriteurl.bo.default"}
                                        </div>
                                    {/elseloop}
                                </div>
                                <div role="tabpanel" class="tab-pane" id="brands">
                                    {ifloop rel="list-notrewritenurls-brand"}
                                        <div class="table-responsive">
                                            <table class="table table-striped table-condensed">
                                                <caption class="clearfix">
                                                    {intl l='Brands' d="rewriteurl.bo.default"}
                                                </caption>

                                                <thead>
                                                <tr>
                                                    <th>
                                                        {intl l='ID' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th>
                                                        {intl l='Name' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th class="actions">
                                                        {intl l='Actions' d="rewriteurl.bo.default"}
                                                    </th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                {loop type="list-notrewritenurls" name="list-notrewritenurls-brand" lang=$edit_language_id view='brand' page=$page_brand limit="10" backend_context="on"}
                                                    <tr>
                                                        <td>
                                                            {$ID}
                                                        </td>
                                                        <td>
                                                            <a title="{intl l='Change this category' d="rewriteurl.bo.default"}" href="{url path="/admin/brand/update/%id" id=$ID}">{$NAME}</a>
                                                        </td>
                                                        <td class="actions">
                                                            <a class="btn btn-info" title="{intl l='Change this category' d="rewriteurl.bo.default"}" href="{url path="/admin/brand/update/%id" id=$ID}">
                                                                <span class="glyphicon glyphicon-edit"></span>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                {/loop}
                                                </tbody>
                                                <tfoot>
                                                <tr>
                                                    <td colspan="100">
                                                        {include
                                                        file = "includes/pagination.html"

                                                        loop_ref       = "list-notrewritenurls-brand"
                                                        max_page_count = 10
                                                        page_param_name = "page_brand"
                                                        page_url       = {url path="/admin/list-notrewritenurls" current_tab='brands'}
                                                        }
                                                    </td>
                                                </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                    {/ifloop}
                                    {elseloop rel="list-notrewritenurls-brand"}
                                        <br/>
                                        <div class="alert alert-info">
                                            {intl l="All your brands have rewriten urls" d="rewriteurl.bo.default"}
                                        </div>
                                    {/elseloop}
                                </div>
                                <div role="tabpanel" class="tab-pane" id="folders">
                                    {ifloop rel="list-notrewritenurls-folder"}
                                        <div class="table-responsive">
                                            <table class="table table-striped table-condensed">
                                                <caption class="clearfix">
                                                    {intl l='Folders' d="rewriteurl.bo.default"}
                                                </caption>

                                                <thead>
                                                <tr>
                                                    <th>
                                                        {intl l='ID' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th>
                                                        {intl l='Name' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th class="actions">
                                                        {intl l='Actions' d="rewriteurl.bo.default"}
                                                    </th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                {loop type="list-notrewritenurls" name="list-notrewritenurls-folder" lang=$edit_language_id view='folder' page=$page_folder limit="10" backend_context="on"}
                                                    <tr>
                                                        <td>
                                                            {$ID}
                                                        </td>
                                                        <td>
                                                            <a title="{intl l='Change this folder' d="rewriteurl.bo.default"}" href="{url path="/admin/folders/update/%id" id=$ID}">{$NAME}</a>
                                                        </td>
                                                        <td class="actions">
                                                            <a class="btn btn-info" title="{intl l='Change this folder' d="rewriteurl.bo.default"}" href="{url path="/admin/folders/update/%id" id=$ID}">
                                                                <span class="glyphicon glyphicon-edit"></span>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                {/loop}
                                                </tbody>
                                                <tfoot>
                                                <tr>
                                                    <td colspan="100">
                                                        {include
                                                        file = "includes/pagination.html"

                                                        loop_ref       = "list-notrewritenurls-folder"
                                                        max_page_count = 10
                                                        page_param_name = "page_folder"
                                                        page_url       = {url path="/admin/list-notrewritenurls" current_tab='folders'}
                                                        }
                                                    </td>
                                                </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                    {/ifloop}
                                    {elseloop rel="list-notrewritenurls-folder"}
                                        <br/>
                                        <div class="alert alert-info">
                                            {intl l="All your folders have rewriten urls" d="rewriteurl.bo.default"}
                                        </div>
                                    {/elseloop}
                                </div>
                                <div role="tabpanel" class="tab-pane" id="contents" >
                                    {ifloop rel="list-notrewritenurls-content"}
                                        <div class="table-responsive">
                                            <table class="table table-striped table-condensed">
                                                <caption class="clearfix">
                                                    {intl l='Contents' d="rewriteurl.bo.default"}
                                                </caption>

                                                <thead>
                                                <tr>
                                                    <th>
                                                        {intl l='ID' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th>
                                                        {intl l='Name' d="rewriteurl.bo.default"}
                                                    </th>
                                                    <th class="actions">
                                                        {intl l="Actions" d="rewriteurl.bo.default"}
                                                    </th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                {loop type="list-notrewritenurls" name="list-notrewritenurls-content" lang=$edit_language_id view='content' page=$page_content limit="10" backend_context="on"}
                                                    <tr>
                                                        <td>
                                                            {$ID}
                                                        </td>
                                                        <td>
                                                            <a title="{intl l='Change this content' d="rewriteurl.bo.default"}" href="{url path="/admin/content/update/%id" id=$ID}">{$NAME}</a>
                                                        </td>
                                                        <td class="actions">
                                                            <a class="btn btn-info" title="{intl l='Change this content' d="rewriteurl.bo.default"}" href="{url path="/admin/content/update/%id" id=$ID}">
                                                                <span class="glyphicon glyphicon-edit"></span>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                {/loop}
                                                </tbody>
                                                <tfoot>
                                                <tr>
                                                    <td colspan="100">
                                                        {include
                                                        file = "includes/pagination.html"

                                                        loop_ref       = "list-notrewritenurls-content"
                                                        max_page_count = 10
                                                        page_param_name = "page_content"
                                                        page_url       = {url path="/admin/list-notrewritenurls" current_tab='contents'}
                                                        }
                                                    </td>
                                                </tr>
                                                </tfoot>
                                            </table>
                                        </div>
                                    {/ifloop}
                                    {elseloop rel="list-notrewritenurls-content"}
                                        <br/>
                                        <div class="alert alert-info">
                                            {intl l="All your contents have rewriten urls" d="rewriteurl.bo.default"}
                                        </div>
                                    {/elseloop}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{/block}

{block name="javascript-initialization"}
    <script>
    $(function() {
        $('.js-popover').popover();
        {if ! empty($current_tab)}
            $('.nav-tabs a[href="#{$current_tab}"]').trigger("click");
        {/if}
    });
    </script>
{/block}