Add work deletion functionality and enhance task popup interactions

This commit is contained in:
2025-02-14 16:03:57 +01:00
parent 65b78d49fd
commit 1a05d881d1
8 changed files with 198 additions and 80 deletions

View File

@@ -165,7 +165,8 @@
});
}
function task_popup( task_id ) {
function task_popup( task_id, open_works_time = false ) {
$.ajax({
url: '/tasks/task_popup/',
type: 'POST',
@@ -175,9 +176,11 @@
success: function( response )
{
$( '.task[task_id="' + task_id + '"]' ).removeClass( 'notopened' );
$( '.task_popup' ).empty().append( response ).show();
$( '.task_popup .checklist ul li input.g-checkbox' ).on( 'change', function(e) {
var action_id = $( this ).parents( 'li' ).attr( 'action_id' );
var status = $( this ).is( ':checked' ) ? 1 : 0;
@@ -195,6 +198,9 @@
}
});
});
if ( open_works_time )
$( '.task_popup .task_details' ).addClass( 'open_works_time' );
}
});
}
@@ -762,6 +768,50 @@
checkedVals.join( "," );
reload_tasks( checkedVals );
});
})
$( 'body' ).on( 'click', '.task_work_details ._work_delete', function(e)
{
var work_id = $( this ).attr( 'work_id' );
var task_id = $( this ).attr( 'task_id' );
$.confirm({
title: 'Potwierdź',
content: 'Na pewno chcesz usunąć wybrane zadanie?',
type: 'orange',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
boxWidth: '500px',
useBootstrap: false,
theme: 'material',
buttons: {
confirm: {
text: 'Usuń',
btnClass: 'btn-red',
action: function(){
$.ajax({
type: 'POST',
cache: false,
url: '/tasks/work_delete/',
data: {
work_id: work_id
},
beforeSend: function() { },
success: function( response ) {
task_popup( task_id, true );
}
});
}
},
cancel: {
text: 'Anuluj',
btnClass: 'btn-default',
action: function(){
}
}
}
});
});
})
</script>