This commit is contained in:
2026-02-28 14:48:24 +01:00
parent 20f502543a
commit f6ba7ebc36
15 changed files with 1030 additions and 129 deletions

View File

@@ -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>