update
This commit is contained in:
@@ -16,10 +16,17 @@
|
||||
<h4>Projekty</h4>
|
||||
<? foreach ( $this -> projects as $project ):?>
|
||||
<div class="_project">
|
||||
<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' ];?> (<?= $project['total_tasks'];?>)
|
||||
</label>
|
||||
<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>
|
||||
</div>
|
||||
<? endforeach;?>
|
||||
</div>
|
||||
@@ -127,6 +134,69 @@
|
||||
<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;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
let isProgrammaticUpdate = false;
|
||||
|
||||
@@ -172,7 +242,49 @@
|
||||
function normalizeGanttTasks( tasksData )
|
||||
{
|
||||
if ( Array.isArray( tasksData ) && tasksData.length > 0 )
|
||||
return tasksData;
|
||||
{
|
||||
var longTaskThresholdDays = 21;
|
||||
var clipStartMoment = null;
|
||||
|
||||
tasksData.forEach( function( task ) {
|
||||
var startMoment = moment( task.start, 'YYYY-MM-DD', true );
|
||||
var endMoment = moment( task.end, 'YYYY-MM-DD', true );
|
||||
|
||||
if ( !startMoment.isValid() || !endMoment.isValid() )
|
||||
return;
|
||||
|
||||
var durationDays = endMoment.diff( startMoment, 'days' );
|
||||
if ( durationDays < longTaskThresholdDays )
|
||||
{
|
||||
if ( !clipStartMoment || startMoment.isBefore( clipStartMoment ) )
|
||||
clipStartMoment = startMoment.clone();
|
||||
}
|
||||
} );
|
||||
|
||||
if ( !clipStartMoment )
|
||||
clipStartMoment = moment().startOf( 'day' );
|
||||
|
||||
return tasksData.map( function( task ) {
|
||||
var normalizedTask = Object.assign( {}, task );
|
||||
var startMoment = moment( normalizedTask.start, 'YYYY-MM-DD', true );
|
||||
var endMoment = moment( normalizedTask.end, 'YYYY-MM-DD', true );
|
||||
|
||||
if ( !startMoment.isValid() || !endMoment.isValid() )
|
||||
return normalizedTask;
|
||||
|
||||
var durationDays = endMoment.diff( startMoment, 'days' );
|
||||
|
||||
if ( durationDays >= longTaskThresholdDays && startMoment.isBefore( clipStartMoment ) && endMoment.isSameOrAfter( clipStartMoment ) )
|
||||
{
|
||||
normalizedTask.start = clipStartMoment.format( 'YYYY-MM-DD' );
|
||||
|
||||
if ( typeof normalizedTask.name === 'string' && normalizedTask.name.indexOf( '... ' ) !== 0 )
|
||||
normalizedTask.name = '... ' + normalizedTask.name;
|
||||
}
|
||||
|
||||
return normalizedTask;
|
||||
} );
|
||||
}
|
||||
|
||||
return getEmptyGanttTasks();
|
||||
}
|
||||
@@ -232,7 +344,8 @@
|
||||
console.log(mode);
|
||||
},
|
||||
view_mode: 'Half Day',
|
||||
language: 'en'
|
||||
language: 'en',
|
||||
sync_parent_end_with_children: false
|
||||
});
|
||||
console.log(gantt_chart);
|
||||
|
||||
@@ -443,11 +556,46 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.task_popup .close', function(e) {
|
||||
e.preventDefault();
|
||||
close_task_popup();
|
||||
return false;
|
||||
});
|
||||
$( 'body' ).on( 'click', '.task_popup .close', function(e) {
|
||||
e.preventDefault();
|
||||
close_task_popup();
|
||||
return false;
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.project_delete_inline', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var project_id = $( this ).attr( 'project_id' );
|
||||
var project_name = $( this ).attr( 'project_name' );
|
||||
|
||||
$.confirm({
|
||||
title: 'Potwierdź',
|
||||
content: 'Na pewno chcesz usunąć projekt <b>' + project_name + '</b>?',
|
||||
type: 'orange',
|
||||
closeIcon: true,
|
||||
closeIconClass: 'fa fa-close',
|
||||
typeAnimated: true,
|
||||
animation: 'opacity',
|
||||
boxWidth: '500px',
|
||||
useBootstrap: false,
|
||||
theme: 'material',
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: 'Anuluj',
|
||||
btnClass: 'btn-default',
|
||||
action: function() {}
|
||||
},
|
||||
confirm: {
|
||||
text: 'Usuń projekt',
|
||||
btnClass: 'btn-red',
|
||||
keys: [ 'enter' ],
|
||||
action: function() {
|
||||
document.location.href = '/projects/project_delete/project_id=' + project_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'click', '.current_status', function() {
|
||||
$( this ).find( '.status_change' ).toggle();
|
||||
|
||||
Reference in New Issue
Block a user