first commit
This commit is contained in:
306
admin/templates/list.tpl
Normal file
306
admin/templates/list.tpl
Normal file
@@ -0,0 +1,306 @@
|
||||
{extends "frame.tpl"}
|
||||
|
||||
{block name=body_class}{if $smarty.get.window == 1}class="window"{/if}{/block}
|
||||
|
||||
{block "css-entry" append}
|
||||
{encore_entry_link_tags entry='list' build='admin'}
|
||||
{/block}
|
||||
|
||||
{block "js-entry" append}
|
||||
{encore_entry_script_tags entry='list' build='admin'}
|
||||
{/block}
|
||||
|
||||
{block name="js" append}
|
||||
{if $searchWnd}
|
||||
<script type="text/javascript">
|
||||
function searchResult(val, data) {
|
||||
if (val == null)
|
||||
return
|
||||
|
||||
if (top.transferValues != null) {
|
||||
top.transferValues(val, data)
|
||||
} else {
|
||||
alert('Chyba skriptu')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block "content"}
|
||||
{function paginationList}
|
||||
{include "utils/pager.tpl"}
|
||||
{/function}
|
||||
|
||||
<div class="container-fluid list-wrapper{if $smarty.get.window} list-wrapper-window{/if} {block "list-wrapper-class"}{/block}">
|
||||
{block topPagination}
|
||||
{/block}
|
||||
|
||||
{block "list-content"}
|
||||
<div class="wpj-panel {block "list-panel-class"}{/block}">
|
||||
{block "list-filter"}
|
||||
{include "utils/listFilter.tpl"}
|
||||
{if !empty($filtersValue)}
|
||||
{*¨todo - kde to je ?*}
|
||||
<div class="wpj-panel-heading">
|
||||
<div class="list-filters-wrapper">
|
||||
<div class="list-filters-left">
|
||||
{foreach $filtersValue as $filter}
|
||||
<div class="filter-item">
|
||||
<div class="list_filter">
|
||||
<select name="IDpr" class="selecter input-sm">
|
||||
{$filter@key}
|
||||
{foreach $filter as $option}
|
||||
<option value="{$option@key}"
|
||||
{if $option.choiced == true}selected{/if}>{$option.name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
<script type="text/javascript">
|
||||
$('.list_filter select').change(function(e) {
|
||||
$this = $(this)
|
||||
window.location.href = window.location.href + '&' + $this.serialize()
|
||||
})
|
||||
</script>
|
||||
{block "list-filter-item"}
|
||||
{/block}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block listTable}
|
||||
<table class="{block 'table-class'}table table-striped{/block} {block unsortable}{/block}"{* width="100%" border="0"
|
||||
cellspacing="0" cellpadding="0"*}>
|
||||
{block list}
|
||||
{block 'list-header'}
|
||||
{$sum = 0}
|
||||
{foreach $columns.fields as $label => $column}
|
||||
{if ($column.wpjAdmin and !isSuperuser()) or $column.visible == 'N'}
|
||||
{continue}
|
||||
{/if}
|
||||
{if not $column.size|is_numeric}
|
||||
{continue}
|
||||
{/if}
|
||||
{$sum = $sum+$column.size}
|
||||
{/foreach}
|
||||
<thead>
|
||||
{foreach $columns.fields as $label => $column}
|
||||
{* todo header - sorting + row & col-xs-12*}
|
||||
{if ($column.wpjAdmin and !isSuperuser()) or $column.visible == 'N'}
|
||||
{continue}
|
||||
{/if}
|
||||
{if $column.size|is_numeric}
|
||||
{$width=($column['size']/$sum*100)|cat:'%'}
|
||||
{else}
|
||||
{$width=$column.size}
|
||||
{/if}
|
||||
<th style="width:{$width}" class="{$column.class}">
|
||||
{if $column@last}
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
{/if}
|
||||
{if $orderParam.sort == $label}
|
||||
{if $orderParam.direction == "DESC"}
|
||||
{$order = ""}
|
||||
{else}
|
||||
{$order = "-"}
|
||||
{/if}
|
||||
{else}
|
||||
{$order = ""}
|
||||
{/if}
|
||||
{$labelTitle = $object->printHeaderLabel($column.title, $column)}
|
||||
{if $pager && $column.field and $label != 'check'}
|
||||
<a href='{$pager->getUrl(["order" => $order|cat:$label ])}'
|
||||
title="{$labelTitle}">
|
||||
{$labelTitle}
|
||||
{if $orderParam.sort == $label}
|
||||
<span class="bi bi-chevron-{if $order == ''}down{else}up{/if}"></span>
|
||||
{/if}
|
||||
</a>
|
||||
{else}
|
||||
<span title="{$labelTitle}">{$labelTitle}</span>
|
||||
{/if}
|
||||
{if $column.wpjAdmin and isSuperuser()}
|
||||
<span class="glyphicon glyphicon-flash" style="color:#AAB2BD;"
|
||||
title="Vidí pouze wpjAdmin"></span>
|
||||
{/if}
|
||||
|
||||
{if $column.tooltip}
|
||||
<a class="help-tip" data-toggle="tooltip" title="{$column.tooltip|translate}">
|
||||
<i class="bi bi-question-circle"></i>
|
||||
</a>
|
||||
{/if}
|
||||
{if $label == 'check' or $label == 'Vybrat'}
|
||||
{block 'list-header-check'}{/block}
|
||||
{/if}
|
||||
{if $column@last}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</th>
|
||||
{/foreach}
|
||||
</thead>
|
||||
{/block}
|
||||
|
||||
<tbody>
|
||||
{block 'list-rows'}
|
||||
{foreach $SQL as $row}
|
||||
{$table = $object->getTableDef()}
|
||||
<tr {if $table.class}class="{$object->resolveCallable($table.class, $row)}"{/if}>
|
||||
{foreach $table.fields as $column}
|
||||
{if !(($column.wpjAdmin && !isSuperuser()) || ($column['visible'] == 'N'))}
|
||||
<td>
|
||||
<div class="list_item {if $isEditing}is-editable{/if} {$object->getItemClass($column.class, $row, $column.fieldType)}">
|
||||
{$object->printListRowItem($column, $row)}
|
||||
</div>
|
||||
</td>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/block}
|
||||
</tbody>
|
||||
{/block}
|
||||
</table>
|
||||
{/block}
|
||||
</div>
|
||||
|
||||
{$addItem = $object->getAddItem()}
|
||||
{if $addItem}
|
||||
<a href="javascript:nw('{$addItem.type}', '0', '{$addItem.params}&autoclose=1');" class="btn btn-success btn-block">
|
||||
<span class="glyphicon glyphicon-plus"></span> Přidat položku
|
||||
</a>
|
||||
{block addItem}
|
||||
{/block}
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block bottomPagination}
|
||||
<div class="pagination-sticky">
|
||||
{include "utils/pager.tpl"}
|
||||
|
||||
<div class="pagination-buttons">
|
||||
{block buttons}
|
||||
<div class="{if $pageCount > 5}dropup{else}dropdown{/if} dropup-actions">
|
||||
<button class="btn dropdown-toggle" type="button" id="listDropdownTrigger" data-toggle="dropdown">
|
||||
Akce
|
||||
</button>
|
||||
<ul class="dropdown-menu" aria-labelledby="adminActionsDropdownTrigger" id="listDropdownTrigger">
|
||||
{if $showExport}
|
||||
{block 'exportButtons'}
|
||||
<li>
|
||||
<a title="Export zobrazených dat do .xlsx" data-export-url value="Export">
|
||||
Export zobrazených dat do .xlsx
|
||||
</a>
|
||||
</li>
|
||||
{/block}
|
||||
{/if}
|
||||
{block buttons_dropup}{/block}
|
||||
</ul>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block "list-filter-mass-edit"}
|
||||
{if $showMassEdit}
|
||||
<a title="Hromadná úprava" href="{$pager->getUrl(['s'=>'listEdit.php'])}"
|
||||
class="btn btn-secondary"><span class="bi bi-list-check m-r-1"></span>Hromadná úprava
|
||||
</a>
|
||||
{/if}
|
||||
{/block}
|
||||
|
||||
{block delivery_buttons}{/block}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
|
||||
<script>
|
||||
{block onready append}
|
||||
{*{if $columns.id}*}
|
||||
$('.table').on('click', 'tr, li', function(e) {
|
||||
var sel = getSelection().toString()
|
||||
if (sel)
|
||||
return false
|
||||
|
||||
if ($(e.target).is(':button') || $(e.target).closest('a').length > 0 || $(e.currentTarget).is('.no-row-click')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$link = $(e.currentTarget).find('a')
|
||||
if ($link.length > 0) {
|
||||
tag = $(e.target).prop('tagName')
|
||||
parentElem = $(e.target).prop('parentElement');
|
||||
if (tag != 'A' && tag != 'INPUT' && tag != 'SELECT' && tag != 'TEXTAREA' && tag != 'OPTION' && tag != 'LABEL' && $link.attr('href') && parentElem.className != 'chosen-results' && $(e.target).closest('.dbbackup').length <= 0) {
|
||||
if ('{$smarty.get.s}' == 'list.php') {
|
||||
window.location = $link.attr('href')
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
})
|
||||
{*{/if}*}
|
||||
|
||||
$('body').tooltip({
|
||||
html: true,
|
||||
selector: '.list_item:not(.columnFeeds):not(.edit_list_item):not(.is-editable):not(.hiddenTooltip), .list_item.columnCampaigns',
|
||||
title: function() {
|
||||
var $this = $(this)
|
||||
var padding = [parseInt($this.css('padding-left')) + parseInt($this.css('padding-right')), parseInt($this.css('padding-top')) + parseInt($this.css('padding-bottom'))]
|
||||
if ((this.scrollWidth - padding[0] - $this.width() > 5 || this.scrollHeight - padding[1] - $this.height() > 5) || (this.classList.value.indexOf('columnCampaigns') > 0 && $this.html().trim().length > 0)) {
|
||||
return $this.html()
|
||||
}
|
||||
},
|
||||
placement: function() {
|
||||
return $(this.$element).find('img').length > 0 ? 'right' : 'bottom'
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
$('.wpj-panel').tooltip({
|
||||
html: true,
|
||||
selector: '.columnFeeds .glyphicon, .columnFeeds .bi',
|
||||
placement: 'bottom',
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
var posx = getWindowStorage('listPosition_x', '')
|
||||
window.scrollTo(0, posx)
|
||||
|
||||
var ID = getWindowStorage('listHighRow', '')
|
||||
|
||||
rows = $('tr A[href^=javascript]')
|
||||
rows_obj = getPrevNextArray(rows)
|
||||
$(rows_obj).each(function() {
|
||||
if ($(this)[0].ID == ID) {
|
||||
$($(this)[0].item).closest('tr').addClass('highRow')
|
||||
}
|
||||
})
|
||||
|
||||
setWindowStorage('listPosition_x', null)
|
||||
setWindowStorage('listHighRow', null)
|
||||
})
|
||||
|
||||
function customRefresh(url) {
|
||||
setWindowStorage('listPosition_x', window.scrollY, window)
|
||||
|
||||
var js = $('.highRow').find('td a[href^=javascript]').attr('href')
|
||||
var ID
|
||||
if (typeof js == 'undefined')
|
||||
ID = 0
|
||||
else
|
||||
ID = js.replace(/javascript:nw\(\'(.+)'\, '(\d+)'\, '(.*)'\);/, '$2')
|
||||
|
||||
setWindowStorage('listHighRow', ID, window)
|
||||
}
|
||||
|
||||
$('a[data-export-url]').on('click', function() {
|
||||
window.open(window.location + '&acn=export')
|
||||
});
|
||||
{/block}
|
||||
</script>
|
||||
Reference in New Issue
Block a user