Add task work date management and enhance task popup layout

This commit is contained in:
2025-02-12 16:11:40 +01:00
parent 1f35e408bc
commit 65b78d49fd
8 changed files with 167 additions and 37 deletions

View File

@@ -726,6 +726,33 @@
document.location.href = '/tasks/main_view/tasks_closed=show';
});
$( 'body' ).on( 'change', '.task_work_date_start', function()
{
var date_start = $( this ).val();
var task_work_id = $( this ).attr( 'task_work_id' );
$( this ).attr( 'disabled', 'disabled' );
$.ajax({
type: 'POST',
cache: false,
url: '/tasks/change_task_work_date_start/',
data: {
date_start: date_start,
task_work_id: task_work_id
},
beforeSend: function() { },
success: function( response )
{
$( '.task_work_start' ).removeAttr( 'disabled' );
}
});
});
$( 'body' ).on( 'click', '.task_popup .time_worked_toggle', function(e){
e.preventDefault();
$( '.task_popup .task_details' ).toggleClass( 'open_works_time' );
});
$( function()
{
$( '.projects_container input.g-checkbox').on( 'change', function (e) {

View File

@@ -92,7 +92,11 @@
</div>
<div class="time box">
<h3>Przepracowany czas</h3>
<div class="time_worked"><?= sprintf( "%02d%s%02d%s%02d", floor( $this -> task['total_time'] / 3600 ), ':', ( $this -> task['total_time'] / 60) % 60, ':', $this -> task['total_time'] % 60 );?></div>
<div class="time_worked">
<a href="#" class="time_worked_toggle">
<?= sprintf( "%02d%s%02d%s%02d", floor( $this -> task['total_time'] / 3600 ), ':', ( $this -> task['total_time'] / 60) % 60, ':', $this -> task['total_time'] % 60 );?>
</a>
</div>
<a href="#" class="task_start <? if ( $this -> task['is_open'] ):?> hidden<? endif;?>" task_id="<?= $this -> task['id'];?>">
<i class="fa fa-play"></i> Włącz timer
</a>
@@ -101,5 +105,13 @@
</a>
</div>
</div>
<div class="task_work_details">
<? foreach ( $this -> task_works as $task_work ):?>
<div class="_line">
<div class="_user"><?= \factory\Users::user_details( $task_work['user_id'] )['name'] . ' ' . \factory\Users::user_details( $task_work['user_id'] )['surname'];?></div>
<input type="text" class="form-control task_work_date_start" task_work_id="<?= $task_work['id'];?>" value="<?= $task_work['date_start'];?>"><span>-</span><input type="text" class="form-control task_work_end" task_work_id="<?= $task_work['id'];?>" value="<?= $task_work['date_end'];?>">
</div>
<? endforeach;?>
</div>
</div>
</div>