{* FILES *}
<div class="nk-block">
    <div class="nk-block-head">
        <h5 class="title mb-3">Файлы</h5>
        <p>Новые файлы появятся после сохранения</p>
    </div>
    <div class="row g-3 align-center">
        <div class="col-lg-12">
            <div class="form-group">
                <label class="custom-file-label" for="ajax_upload_file">Выбрать файл</label>
                <input type="file" class="custom-file-input" id="ajax_upload_file" accept="image/*,video/*,audio/*,.docx,.doc,.xlsx,.xls,.pdf,.zip,.rar">
                <progress class="w-100" min="0" max="100" value="0"></progress>
            </div>
        </div>
        <div class="col-lg-9">
            <label id="ajax_upload_file_status"></label>
        </div>
    </div>

    {if $files|count > 0}
    <div class="table-mob-scroll card-variants">
        <div class="card-inner card-bordered p-0 mb-2">

            <table class="table table-striped sortable-table">
                <thead>
                    <tr>
                        <th class="py-2" scope="col">Тип</th>
                        <th class="py-2" scope="col">Ссылка</th>
                        <th class="py-2" scope="col">Описание</th>
                        <th class="py-2" scope="col">Добавлен</th>
                        <th class="py-2" scope="col">Размер</th>
                        <th class="py-2" scope="col">Удалить</th>
                    </tr>
                </thead>
                <tbody>
                    {foreach $files as $file}
                        <tr class="js-file-item">
                            <td width=10%>
                                <span><b>{$file->filetype|strtoupper}</b></span>
                            </td>
                            <td width=10% valign=middle>
                                <a href="{$config->root_url}/{$file->filepath}" class="btn btn-trigger btn-icon js-clipboard-copy" data-toggle="tooltip" data-placement="top" title="Копировать">
                                    <em class="icon ti ti-copy"></em>
                                </a>
                            </td>
                            <td width=45%>
                                <input type="hidden" name="files[id][]" value="{$file->id}">
                                <input type="text" class="form-control" name="files[name][]" placeholder="Название" value="{$file->name|escape}">
                            </td>
                            <td width=15%>
                                <span>{$file->added|date:"d F Y"}</span>
                            </td>
                            <td width=10%>
                                <span>{$file->filesize|size}</span>
                            </td>
                            <td width=10%>
                                <button type="button" class="btn btn-trigger btn-icon text-danger js-delete-file" data-toggle="tooltip" data-placement="top" title="" data-original-title="Удалить">
                                    <em class="icon ti ti-trash"></em>
                                </button>
                            </td>
                        </tr>
                    {/foreach}
                </tbody>
            </table>

        </div>
    </div>
    {/if}
    <div class="text-center">
        <div class="form-group mt-2">
            <button type="submit" class="btn btn-success">Сохранить</button>
        </div>
    </div>
</div>
