<commit_before>{**
 * @param array    $columns           Available columns
 * @param array    $actions           Available actions
 * @param array    $exports           Available exports
 * @param array    $filters           Available filters
 * @param Form     $filter            Walkaround for latte (does not know $form in snippet in foreach, etc)
 * @param Row[]    $rows              List of rows (each contain a item from data source)
 * @param DataGrid $control           Parent (DataGrid)
 * @param string   $original_template Original template file path
 * @param string   $icon_prefix       Icon prefix (fa fa-)
 *}

<div class="datagrid card card-1 primary datagrid-{!$control->getName()}">
	{**
	 * Own data
	 *}
	<div n:snippet="grid">
	{snippetArea gridSnippets}
		{form filter, class => 'ajax'}
			{**
			 * Filter form
			 *}
			{if $control->hasOuterFilterRendering()}
				<div class="row row-filters">
					{var $i = 0}
					<div class="col-sm-6" n:foreach="$filters as $f">
						{**
						 * Each fitler is rendered separately in its own template
						 *}
						{include $f->getTemplate(), filter => $f, input => $form['filter'][$f->getKey()], outer => TRUE}
						{var $i = $i+1}
					</div>
				</div>
			{/if}
			<table class="table table-hover table-bordered" n:snippet="table" n:block="data">
				<thead>
					<tr class="row-group-actions" n:if="$control->hasGroupActions() || $exports || $control->canHideColumns()">
						<th colspan="{$control->getColumnsCount()}" class="form-inline">
							{if $control->hasGroupActions()}
								{block group_actions}
									{_'ublaboo_datagrid.group_actions'}:
									{foreach $filter['group_action']->getControls() as $form_control}
										{if $form_control instanceof \Nette\Forms\Controls\SubmitButton}
											{input $form_control, class => 'btn btn-primary btn-sm', style => 'display:none'}
										{elseif $form_control->getName() == 'group_action'}
											{input $form_control, class => 'form-control input-sm', disabled => TRUE}
										{else}
											{input $form_control, class => 'form-control input-sm', style => 'display:none'}
										{/if}
									{/foreach}
								{/block}
							{/if}

							<span class="pull-right exports" n:if="$exports" n:block="exports">
								{foreach $exports as $export}{$export->render()}{/foreach}
							</span>

							<span class="pull-right settings" n:block="settings" n:if="$control->canHideColumns()">
								<div class="btn-group">
									<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
										<i class="{$icon_prefix}gear"></i>
									</button>
									<ul class="dropdown-menu dropdown-menu--grid">
										<li>
											<a n:href="showAllColumns!" class="ajax"><i class="{$icon_prefix}eye"></i> {_'ublaboo_datagrid.show_all_columns'}</a>
										</li>
									</ul>
								</div>
							</span>
						</th>
					</tr>
					<tr n:block="header">
						<th n:if="$control->hasGroupActions()" rowspan="2" class="col-checkbox">
							<input class="happy gray-border primary" name="toggle-all" type="checkbox" data-check="{!$control->getName()}" data-check-all="{$control->getName()}">
						</th>
						{foreach $columns as $key => $column}
							{var $align = $column->hasAlign() ? $column->getAlign() : 'left'}
							<th class="col-{$column->getColumnName()} text-{$align}">
								{var $col_header = 'col-' . $key . '-header'}

								{**
								 * Column header can be defined also with block {col-<key>-header}
								 *}
								{ifset #$col_header}
									{include #$col_header, column => $column}
								{else}
									{if $column->isSortable()}
										<a n:class="$column->isSortedBy() ? 'sort' : '', 'ajax'" n:href="sort!, sort => $column->getSortNext()">
											{_$column->getName()}
											{if $column->isSortedBy()}
												<span n:class="$column->isSortAsc() ? $icon_prefix . 'up' : $icon_prefix . 'down', 'fa'"></span>
											{else}
												<span class="{$icon_prefix}sort"></span>
											{/if}
										</a>
									{else}
										{_$column->getName()}
									{/if}

									<span class="column-settings-menu pull-right" n:if="$control->canHideColumns()">
										<div class="btn-group">
											<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
												<i class="{$icon_prefix}caret-down"></i>
											</a>
											<ul class="dropdown-menu dropdown-menu--grid">
												<li>
													<a n:href="hideColumn!, column => $key" class="ajax">
														<i class="{$icon_prefix}eye-slash"></i> {_'ublaboo_datagrid.hide_column'}</a>
												</li>
											</ul>
										</div>
									</span>
								{/ifset}

								{if !$control->hasOuterFilterRendering() && isset($filters[$key])}
									<hr>
									{var $i = $filter['filter'][$key]}
									{include $filters[$key]->getTemplate(), filter => $filters[$key], input => $i, outer => FALSE}
								{/if}
							</th><commit_msg>Sorting - caret icon update<commit_after>{**
 * @param array    $columns           Available columns
 * @param array    $actions           Available actions
 * @param array    $exports           Available exports
 * @param array    $filters           Available filters
 * @param Form     $filter            Walkaround for latte (does not know $form in snippet in foreach, etc)
 * @param Row[]    $rows              List of rows (each contain a item from data source)
 * @param DataGrid $control           Parent (DataGrid)
 * @param string   $original_template Original template file path
 * @param string   $icon_prefix       Icon prefix (fa fa-)
 *}

<div class="datagrid card card-1 primary datagrid-{!$control->getName()}">
	{**
	 * Own data
	 *}
	<div n:snippet="grid">
	{snippetArea gridSnippets}
		{form filter, class => 'ajax'}
			{**
			 * Filter form
			 *}
			{if $control->hasOuterFilterRendering()}
				<div class="row row-filters">
					{var $i = 0}
					<div class="col-sm-6" n:foreach="$filters as $f">
						{**
						 * Each fitler is rendered separately in its own template
						 *}
						{include $f->getTemplate(), filter => $f, input => $form['filter'][$f->getKey()], outer => TRUE}
						{var $i = $i+1}
					</div>
				</div>
			{/if}
			<table class="table table-hover table-bordered" n:snippet="table" n:block="data">
				<thead>
					<tr class="row-group-actions" n:if="$control->hasGroupActions() || $exports || $control->canHideColumns()">
						<th colspan="{$control->getColumnsCount()}" class="form-inline">
							{if $control->hasGroupActions()}
								{block group_actions}
									{_'ublaboo_datagrid.group_actions'}:
									{foreach $filter['group_action']->getControls() as $form_control}
										{if $form_control instanceof \Nette\Forms\Controls\SubmitButton}
											{input $form_control, class => 'btn btn-primary btn-sm', style => 'display:none'}
										{elseif $form_control->getName() == 'group_action'}
											{input $form_control, class => 'form-control input-sm', disabled => TRUE}
										{else}
											{input $form_control, class => 'form-control input-sm', style => 'display:none'}
										{/if}
									{/foreach}
								{/block}
							{/if}

							<span class="pull-right exports" n:if="$exports" n:block="exports">
								{foreach $exports as $export}{$export->render()}{/foreach}
							</span>

							<span class="pull-right settings" n:block="settings" n:if="$control->canHideColumns()">
								<div class="btn-group">
									<button type="button" class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
										<i class="{$icon_prefix}gear"></i>
									</button>
									<ul class="dropdown-menu dropdown-menu--grid">
										<li>
											<a n:href="showAllColumns!" class="ajax"><i class="{$icon_prefix}eye"></i> {_'ublaboo_datagrid.show_all_columns'}</a>
										</li>
									</ul>
								</div>
							</span>
						</th>
					</tr>
					<tr n:block="header">
						<th n:if="$control->hasGroupActions()" rowspan="2" class="col-checkbox">
							<input class="happy gray-border primary" name="toggle-all" type="checkbox" data-check="{!$control->getName()}" data-check-all="{$control->getName()}">
						</th>
						{foreach $columns as $key => $column}
							{var $align = $column->hasAlign() ? $column->getAlign() : 'left'}
							<th class="col-{$column->getColumnName()} text-{$align}">
								{var $col_header = 'col-' . $key . '-header'}

								{**
								 * Column header can be defined also with block {col-<key>-header}
								 *}
								{ifset #$col_header}
									{include #$col_header, column => $column}
								{else}
									{if $column->isSortable()}
										<a n:class="$column->isSortedBy() ? 'sort' : '', 'ajax'" n:href="sort!, sort => $column->getSortNext()">
											{_$column->getName()}
											{if $column->isSortedBy()}
												<span n:class="$column->isSortAsc() ? $icon_prefix . 'caret-up' : $icon_prefix . 'caret-down', 'fa'"></span>
											{else}
												<span class="{$icon_prefix}sort"></span>
											{/if}
										</a>
									{else}
										{_$column->getName()}
									{/if}

									<span class="column-settings-menu pull-right" n:if="$control->canHideColumns()">
										<div class="btn-group">
											<a type="button" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
												<i class="{$icon_prefix}caret-down"></i>
											</a>
											<ul class="dropdown-menu dropdown-menu--grid">
												<li>
													<a n:href="hideColumn!, column => $key" class="ajax">
														<i class="{$icon_prefix}eye-slash"></i> {_'ublaboo_datagrid.hide_column'}</a>
												</li>
											</ul>
										</div>
									</span>
								{/ifset}

								{if !$control->hasOuterFilterRendering() && isset($filters[$key])}
									<hr>
									{var $i = $filter['filter'][$key]}
									{include $filters[$key]->getTemplate(), filter => $filters[$key], input => $i, outer => FALSE}
								{/if}
							</th>
{'fraction_non_alphanumeric': 0.18084689276612428, 'fraction_numerical': 0.0009801999607920015, 'mean_word_length': 2.491786447638604, 'pattern_counts': {'":': 0, '<': 123, '<?xml version=': 0, '>': 213, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4368229', 'n_tokens_mistral': 4554, 'n_tokens_neox': 3184, 'n_words': 700}