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();
|
||||
|
||||
@@ -126,7 +126,7 @@ ob_start();
|
||||
'label' => 'Priorytet',
|
||||
'name' => 'priority',
|
||||
'id' => 'priority',
|
||||
'value' => $this -> task[ 'priority' ],
|
||||
'value' => $this -> task['id'] ? $this -> task['priority'] : 1,
|
||||
'values' => $this -> priorities
|
||||
] );
|
||||
?>
|
||||
|
||||
@@ -11,13 +11,14 @@
|
||||
<? endif;?>
|
||||
<span class="task-title-wrapper">
|
||||
<span class="task-id">#<?= $this -> task['id'];?></span>
|
||||
<span class="task-title-text"><?= $this -> task['name'];?></span>
|
||||
<a href="#" class="task-title-edit-btn" title="Edytuj tytuł"><i class="fa fa-pencil-square-o"></i></a>
|
||||
|
||||
<span class="task-title-view">
|
||||
<span class="task-title-text"><?= $this -> task['name'];?></span>
|
||||
<a href="#" class="task-title-edit-btn" title="Edytuj tytuł"><i class="fa fa-pencil"></i></a>
|
||||
</span>
|
||||
<span class="task-title-edit-box" style="display: none;">
|
||||
<input type="text" class="task-title-input" value="<?= htmlspecialchars($this -> task['name']);?>">
|
||||
<a href="#" class="task-title-save"><i class="fa fa-check"></i></a>
|
||||
<a href="#" class="task-title-cancel"><i class="fa fa-times"></i></a>
|
||||
<input type="text" class="task-title-input form-control" value="<?= htmlspecialchars($this -> task['name']);?>">
|
||||
<a href="#" class="task-title-save" title="Zapisz"><i class="fa fa-check"></i></a>
|
||||
<a href="#" class="task-title-cancel" title="Anuluj"><i class="fa fa-times"></i></a>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
@@ -87,6 +88,11 @@
|
||||
<? endforeach; endif;?>
|
||||
</div>
|
||||
<div class="task-tab-panel is-active" data-tab="description">
|
||||
<div class="task-description-editor box">
|
||||
<h3>Treść zadania</h3>
|
||||
<textarea class="form-control task-description-input" rows="5"><?= htmlspecialchars( (string)$this -> task['text'] );?></textarea>
|
||||
<a href="#" class="btn btn-primary btn-sm task-popup-compact-btn js-save-task-description" task_id="<?= (int)$this -> task['id'];?>" style="margin-top: 10px;">Zapisz treść</a>
|
||||
</div>
|
||||
<? if ( $this -> task['text'] ):?>
|
||||
<div class="description">
|
||||
<a href="#" class="fullscreen"><i class="fa fa-expand"></i></a>
|
||||
@@ -219,12 +225,17 @@
|
||||
</div>
|
||||
<div class="dates box">
|
||||
<h3>Termin</h3>
|
||||
<? if ( $this -> task['date_start'] ):?>
|
||||
<div class="date_start"><i class="fa fa-regular fa-calendar"></i><?= $this -> task['date_start'];?></div>
|
||||
<? endif;?>
|
||||
<? if ( $this -> task['date_end'] ):?>
|
||||
<div class="date_end <? if ( $this -> task['status'] != 2 and $this -> task['date_end'] == date( 'Y-m-d' ) ):?> warning<? endif;?> <? if ( $this -> task['status'] != 2 and $this -> task['date_end'] < date( 'Y-m-d' ) ):?> dangerx<? endif;?>"><i class="fa fa-regular fa-calendar"></i><?= $this -> task['date_end'];?></div>
|
||||
<? endif;?>
|
||||
<div class="task-date-edit-grid">
|
||||
<div class="task-date-field">
|
||||
<label>Data rozpoczęcia</label>
|
||||
<input type="date" class="form-control task-date-start-input" value="<?= htmlspecialchars( (string)$this -> task['date_start'] );?>">
|
||||
</div>
|
||||
<div class="task-date-field">
|
||||
<label>Data zakończenia</label>
|
||||
<input type="date" class="form-control task-date-end-input" value="<?= htmlspecialchars( (string)$this -> task['date_end'] );?>">
|
||||
</div>
|
||||
</div>
|
||||
<a href="#" class="btn btn-primary btn-sm task-popup-compact-btn js-save-task-dates" task_id="<?= (int)$this -> task['id'];?>" style="margin-top: 10px;">Zapisz terminy</a>
|
||||
</div>
|
||||
<div class="client box">
|
||||
<h3>Klient</h3>
|
||||
@@ -432,31 +443,95 @@
|
||||
}
|
||||
|
||||
.task_popup .task_details .title .task-title-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: nowrap;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.task_popup .task_details .title .task-title-view {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.task_popup .task_details .title .task-title-edit-btn {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
margin-left: 5px;
|
||||
opacity: 0.6;
|
||||
transition: opacity 0.2s;
|
||||
.task_popup .task_details .title .task-title-text {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: 600;
|
||||
}
|
||||
.task_popup .task_details .title .task-title-edit-btn:hover {
|
||||
opacity: 1;
|
||||
color: #333;
|
||||
.task_popup .task_details .title .task-title-edit-btn,
|
||||
.task_popup .task_details .title .task-title-save,
|
||||
.task_popup .task_details .title .task-title-cancel {
|
||||
border: 1px solid #099885;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 6px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #099885;
|
||||
text-decoration: none;
|
||||
flex-shrink: 0;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
.task_popup .task_details .title .task-title-edit-btn:hover,
|
||||
.task_popup .task_details .title .task-title-save:hover,
|
||||
.task_popup .task_details .title .task-title-cancel:hover {
|
||||
background: #099885;
|
||||
color: #fff;
|
||||
}
|
||||
.task_popup .task_details .title .task-title-cancel {
|
||||
border-color: #cc563d;
|
||||
color: #cc563d;
|
||||
}
|
||||
.task_popup .task_details .title .task-title-cancel:hover {
|
||||
background: #cc563d;
|
||||
color: #fff;
|
||||
}
|
||||
.task_popup .task_details .title .task-title-edit-box {
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
gap: 8px;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.task_popup .task_details .title .task-title-input {
|
||||
height: 36px;
|
||||
border-radius: 6px;
|
||||
font-size: 18px;
|
||||
padding: 4px 8px;
|
||||
width: 400px;
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
min-width: 240px;
|
||||
}
|
||||
.task_popup .task_details .content .left .task-description-editor {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.task_popup .task_details .content .left .task-description-editor .task-description-input {
|
||||
min-height: 120px;
|
||||
resize: vertical;
|
||||
}
|
||||
.task_popup .task_details .content .right .dates .task-date-edit-grid {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.task_popup .task_details .content .right .dates .task-date-field label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 4px;
|
||||
color: #4e5e6a;
|
||||
}
|
||||
.task_popup .task_details .task-popup-compact-btn {
|
||||
height: 30px;
|
||||
padding: 0 10px;
|
||||
font-size: 12px;
|
||||
border-radius: 5px;
|
||||
min-width: 0;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
@@ -610,8 +685,7 @@
|
||||
|
||||
popup.on( 'click', '.task-title-edit-btn', function( e ) {
|
||||
e.preventDefault();
|
||||
popup.find( '.task-title-edit-btn' ).hide();
|
||||
popup.find( '.task-title-text' ).hide();
|
||||
popup.find( '.task-title-view' ).hide();
|
||||
popup.find( '.task-title-edit-box' ).css( 'display', 'inline-flex' );
|
||||
popup.find( '.task-title-input' ).focus();
|
||||
});
|
||||
@@ -619,8 +693,7 @@
|
||||
popup.on( 'click', '.task-title-cancel', function( e ) {
|
||||
e.preventDefault();
|
||||
popup.find( '.task-title-edit-box' ).hide();
|
||||
popup.find( '.task-title-text' ).show();
|
||||
popup.find( '.task-title-edit-btn' ).show();
|
||||
popup.find( '.task-title-view' ).show();
|
||||
// Reset input to current text
|
||||
popup.find( '.task-title-input' ).val( popup.find( '.task-title-text' ).text() );
|
||||
});
|
||||
@@ -658,6 +731,70 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
popup.on( 'keypress', '.task-title-input', function( e ) {
|
||||
if ( e.which === 13 )
|
||||
{
|
||||
e.preventDefault();
|
||||
popup.find( '.task-title-save' ).trigger( 'click' );
|
||||
}
|
||||
});
|
||||
|
||||
popup.on( 'click', '.js-save-task-dates', function( e ) {
|
||||
e.preventDefault();
|
||||
var btn = $( this );
|
||||
var task_id = btn.attr( 'task_id' );
|
||||
var date_start = popup.find( '.task-date-start-input' ).val();
|
||||
var date_end = popup.find( '.task-date-end-input' ).val();
|
||||
|
||||
btn.text( 'Zapisywanie...' ).addClass( 'disabled' );
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/tasks/task_change_dates/',
|
||||
data: { task_id: task_id, date_start: date_start, date_end: date_end },
|
||||
success: function( response ) {
|
||||
var res = typeof response === 'string' ? JSON.parse( response ) : response;
|
||||
if ( res.status === 'success' )
|
||||
{
|
||||
btn.text( 'Zapisano!' );
|
||||
if ( typeof getSelectedTaskFilters === 'function' && typeof reload_tasks === 'function' )
|
||||
{
|
||||
var selected_filters = getSelectedTaskFilters();
|
||||
reload_tasks( selected_filters.projects, selected_filters.users );
|
||||
}
|
||||
}
|
||||
else
|
||||
btn.text( 'Błąd' );
|
||||
|
||||
setTimeout( function() { btn.text( 'Zapisz terminy' ).removeClass( 'disabled' ); }, 1400 );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
popup.on( 'click', '.js-save-task-description', function( e ) {
|
||||
e.preventDefault();
|
||||
var btn = $( this );
|
||||
var task_id = btn.attr( 'task_id' );
|
||||
var text = popup.find( '.task-description-input' ).val();
|
||||
|
||||
btn.text( 'Zapisywanie...' ).addClass( 'disabled' );
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/tasks/task_change_text/',
|
||||
data: { task_id: task_id, text: text },
|
||||
success: function( response ) {
|
||||
var res = typeof response === 'string' ? JSON.parse( response ) : response;
|
||||
if ( res.status === 'success' )
|
||||
{
|
||||
btn.text( 'Zapisano!' );
|
||||
task_popup( task_id, is_task_popup_works_time_open() );
|
||||
}
|
||||
else
|
||||
btn.text( 'Błąd' );
|
||||
|
||||
setTimeout( function() { btn.text( 'Zapisz treść' ).removeClass( 'disabled' ); }, 1400 );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
var interval_id = setInterval( function() {
|
||||
if ( !document.body.contains( popup.get( 0 ) ) )
|
||||
@@ -675,4 +812,3 @@
|
||||
}, 1000 );
|
||||
} )();
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user