update
This commit is contained in:
@@ -1,48 +1,70 @@
|
||||
<div class="tasks_main_view">
|
||||
<div class="_left_column">
|
||||
<select name="filtr" class="form-control">
|
||||
<option value="">--- wybierz filtr ---</option>
|
||||
<? foreach ( $this -> tasks_filtrs as $filtr ):?>
|
||||
<option value="<?= $filtr[ 'id' ];?>"><?= $filtr[ 'name' ];?></option>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
<div class="_buttons">
|
||||
<a href="#" class="btn btn-success btn_small" id="_new_filtr">zapisz</a>
|
||||
<a href="#" class="btn btn-primary btn_small" id="_update_filtr">aktualizuj</a>
|
||||
<!-- set default -->
|
||||
<a href="#" class="btn btn-dark btn_small" id="_set_default_filtr">domyślny</a>
|
||||
</div>
|
||||
<div class="_projects">
|
||||
<h4>Projekty</h4>
|
||||
<? foreach ( $this -> projects as $project ):?>
|
||||
<div class="_project">
|
||||
<div class="project_row">
|
||||
<label for="project_<?= $project[ 'id' ];?>">
|
||||
<input type="checkbox" class="g-checkbox" name="projects" value="<?= $project[ 'id' ];?>" <? if ( is_array( $this -> selected_projects ) and in_array( $project['id'], $this -> selected_projects ) ):?>checked<? endif;?>>
|
||||
<?= $project[ 'name' ];?> <span class="project_count">(<?= (int)$project['total_tasks'];?>)</span>
|
||||
</label>
|
||||
<? if ( \controls\Users::permissions( $this -> user['id'], 'projects', 'project_delete' ) ):?>
|
||||
<a href="#" class="project_delete_inline" project_id="<?= (int)$project['id'];?>" project_name="<?= htmlspecialchars( $project['name'] );?>" title="Usuń projekt">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
<? endif;?>
|
||||
<div class="filters_panel">
|
||||
<div class="filters_panel_header">
|
||||
<div class="filters_panel_title">
|
||||
<i class="fa fa-filter"></i>
|
||||
<h3>Filtry</h3>
|
||||
</div>
|
||||
<span class="active_filters_badge">Aktywne: <strong id="active_filters_count">0</strong></span>
|
||||
</div>
|
||||
<div class="filters_controls">
|
||||
<label class="filters_label" for="tasks_saved_filter">Zapisany filtr</label>
|
||||
<select name="filtr" id="tasks_saved_filter" class="form-control">
|
||||
<option value="">--- wybierz filtr ---</option>
|
||||
<? foreach ( $this -> tasks_filtrs as $filtr ):?>
|
||||
<option value="<?= $filtr[ 'id' ];?>"><?= $filtr[ 'name' ];?></option>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
<div class="_buttons">
|
||||
<a href="#" class="btn btn-success btn_small" id="_new_filtr"><i class="fa fa-plus"></i>Zapisz</a>
|
||||
<a href="#" class="btn btn-primary btn_small" id="_update_filtr"><i class="fa fa-refresh"></i>Aktualizuj</a>
|
||||
<!-- set default -->
|
||||
<a href="#" class="btn btn-dark btn_small" id="_set_default_filtr"><i class="fa fa-star-o"></i>Domyślny</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="filters_section _projects">
|
||||
<div class="filters_section_header">
|
||||
<h4>Projekty</h4>
|
||||
<input type="text" class="form-control filters_search" data-filter-target="projects" placeholder="Szukaj projektu...">
|
||||
</div>
|
||||
<div class="filters_section_list">
|
||||
<? foreach ( $this -> projects as $project ):?>
|
||||
<div class="_project filters_item" data-filter-item="projects">
|
||||
<div class="project_row">
|
||||
<label for="project_<?= $project[ 'id' ];?>">
|
||||
<input id="project_<?= $project[ 'id' ];?>" type="checkbox" class="g-checkbox" name="projects" value="<?= $project[ 'id' ];?>" <? if ( is_array( $this -> selected_projects ) and in_array( $project['id'], $this -> selected_projects ) ):?>checked<? endif;?>>
|
||||
<?= $project[ 'name' ];?> <span class="project_count">(<?= (int)$project['total_tasks'];?>)</span>
|
||||
</label>
|
||||
<? if ( \controls\Users::permissions( $this -> user['id'], 'projects', 'project_delete' ) ):?>
|
||||
<a href="#" class="project_delete_inline" project_id="<?= (int)$project['id'];?>" project_name="<?= htmlspecialchars( $project['name'] );?>" title="Usuń projekt">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
<? endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<? endforeach;?>
|
||||
</div>
|
||||
</div>
|
||||
<? if ( $this -> user['id'] == 1 ):?>
|
||||
<div class="filters_section _users">
|
||||
<div class="filters_section_header">
|
||||
<h4>Użytkownicy</h4>
|
||||
<input type="text" class="form-control filters_search" data-filter-target="users" placeholder="Szukaj użytkownika...">
|
||||
</div>
|
||||
<div class="filters_section_list">
|
||||
<? foreach ( $this -> users as $user ):?>
|
||||
<div class="_user filters_item" data-filter-item="users">
|
||||
<label for="user_<?= $user[ 'id' ];?>">
|
||||
<input id="user_<?= $user[ 'id' ];?>" type="checkbox" class="g-checkbox" name="users" value="<?= $user[ 'id' ];?>" <? if ( is_array( $this -> selected_users ) and in_array( $user['id'], $this -> selected_users ) ):?>checked<? endif;?>>
|
||||
<?= $user[ 'name' ];?> <?= $user[ 'surname' ];?>
|
||||
</label>
|
||||
</div>
|
||||
<? endforeach;?>
|
||||
</div>
|
||||
</div>
|
||||
<? endforeach;?>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<? if ( $this -> user['id'] == 1 ):?>
|
||||
<div class="_users">
|
||||
<h4>Użytkownicy</h4>
|
||||
<? foreach ( $this -> users as $user ):?>
|
||||
<div class="_user">
|
||||
<label for="user_<?= $user[ 'id' ];?>">
|
||||
<input type="checkbox" class="g-checkbox" name="users" value="<?= $user[ 'id' ];?>" <? if ( is_array( $this -> selected_users ) and in_array( $user['id'], $this -> selected_users ) ):?>checked<? endif;?>>
|
||||
<?= $user[ 'name' ];?> <?= $user[ 'surname' ];?>
|
||||
</label>
|
||||
</div>
|
||||
<? endforeach;?>
|
||||
</div>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<div class="_right_column">
|
||||
<div class="action_menu">
|
||||
@@ -134,79 +156,23 @@
|
||||
<div class="task_popup">
|
||||
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.tasks_main_view ._left_column {
|
||||
width: fit-content;
|
||||
min-width: 350px;
|
||||
max-width: 520px;
|
||||
}
|
||||
|
||||
.tasks_main_view ._right_column {
|
||||
flex: 1;
|
||||
max-width: none;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_row label {
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_row .project_count {
|
||||
display: inline-block;
|
||||
margin-left: 3px;
|
||||
padding: 0 6px;
|
||||
border-radius: 10px;
|
||||
background: #1f3d72;
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_delete_inline {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #cc563d;
|
||||
background: #cc563d;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
transition: all .2s ease;
|
||||
margin: 1px 0;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_delete_inline:hover {
|
||||
background: #b74831;
|
||||
border-color: #b74831;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_delete_inline i {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.gantt-target .gantt-container.gantt-draggable {
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.gantt-target .gantt-container.gantt-dragging {
|
||||
cursor: grabbing;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
let isProgrammaticUpdate = false;
|
||||
function updateActiveFiltersCounter()
|
||||
{
|
||||
var activeFiltersCount = $( '.tasks_main_view input.g-checkbox:checked' ).length;
|
||||
$( '#active_filters_count' ).text( activeFiltersCount );
|
||||
}
|
||||
|
||||
function applyFiltersSearch( target, value )
|
||||
{
|
||||
var normalizedValue = value.toLowerCase().trim();
|
||||
$( '.tasks_main_view [data-filter-item="' + target + '"]' ).each(function() {
|
||||
var itemText = $( this ).text().toLowerCase();
|
||||
var shouldShow = normalizedValue === '' || itemText.indexOf( normalizedValue ) !== -1;
|
||||
$( this ).toggle( shouldShow );
|
||||
});
|
||||
}
|
||||
|
||||
var tasks = [
|
||||
<?
|
||||
@@ -1368,7 +1334,8 @@
|
||||
});
|
||||
|
||||
isProgrammaticUpdate = false;
|
||||
// wywołuj z tablicami, nie ze stringami
|
||||
updateActiveFiltersCounter();
|
||||
// wywoluj z tablicami, nie ze stringami
|
||||
reload_tasks(projectsArr, usersArr);
|
||||
}
|
||||
}
|
||||
@@ -1512,6 +1479,13 @@
|
||||
radioClass: 'iradio_square-blue',
|
||||
});
|
||||
|
||||
updateActiveFiltersCounter();
|
||||
|
||||
$( '.tasks_main_view' ).on( 'input', '.filters_search', function() {
|
||||
var target = $( this ).attr( 'data-filter-target' );
|
||||
applyFiltersSearch( target, $( this ).val() );
|
||||
});
|
||||
|
||||
$(".tasks_main_view input.g-checkbox").on('ifChanged', function (e) {
|
||||
$(this).trigger("change", e);
|
||||
});
|
||||
@@ -1529,6 +1503,7 @@
|
||||
}).get();
|
||||
projects.join( "," );
|
||||
users.join( "," );
|
||||
updateActiveFiltersCounter();
|
||||
reload_tasks( projects, users );
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user