feat: Add status change notification option in task popup and update task status handling

This commit is contained in:
2026-02-17 17:57:02 +01:00
parent 28fb121c76
commit c165a94016
3 changed files with 75 additions and 61 deletions

View File

@@ -9,8 +9,8 @@
},
"api.php": {
"type": "-",
"size": 4261,
"lmtime": 1771100526209,
"size": 4208,
"lmtime": 1771236164949,
"modified": false
},
"autoload": {
@@ -28,8 +28,8 @@
},
"class.Cron.php": {
"type": "-",
"size": 9391,
"lmtime": 1770937836455,
"size": 9593,
"lmtime": 1771237141363,
"modified": false
},
"class.DbModel.php": {
@@ -72,7 +72,13 @@
"CrmController.php": {
"type": "-",
"size": 1940,
"lmtime": 1771099681826,
"lmtime": 1771236164955,
"modified": false
},
"FinancesController.php": {
"type": "-",
"size": 6828,
"lmtime": 1771236164956,
"modified": false
},
"TasksController.php": {
@@ -86,12 +92,6 @@
"size": 3914,
"lmtime": 1770653696575,
"modified": false
},
"FinancesController.php": {
"type": "-",
"size": 6828,
"lmtime": 1771100264230,
"modified": false
}
},
"controls": {
@@ -107,12 +107,6 @@
"lmtime": 0,
"modified": false
},
"class.Finances.php": {
"type": "-",
"size": 6614,
"lmtime": 0,
"modified": false
},
"class.Projects.php": {
"type": "-",
"size": 9521,
@@ -122,19 +116,19 @@
"class.Site.php": {
"type": "-",
"size": 1298,
"lmtime": 1771099882500,
"lmtime": 1771236164961,
"modified": false
},
"class.Tasks.php": {
"type": "-",
"size": 22654,
"lmtime": 1770937828041,
"size": 23567,
"lmtime": 1771241116941,
"modified": false
},
"class.Users.php": {
"type": "-",
"size": 4242,
"lmtime": 0,
"lmtime": 1770653518273,
"modified": false
},
"class.Wiki.php": {
@@ -142,12 +136,6 @@
"size": 1825,
"lmtime": 0,
"modified": false
},
"class.Crm.php": {
"type": "-",
"size": 247,
"lmtime": 1771099888168,
"modified": false
}
},
"Domain": {
@@ -155,7 +143,15 @@
"ClientRepository.php": {
"type": "-",
"size": 1592,
"lmtime": 1771099662028,
"lmtime": 1771236164957,
"modified": false
}
},
"Finances": {
"FinanceRepository.php": {
"type": "-",
"size": 16494,
"lmtime": 1771236164959,
"modified": false
}
},
@@ -169,13 +165,13 @@
"MailToTaskImporter.php": {
"type": "-",
"size": 37982,
"lmtime": 1770937612534,
"lmtime": 1770800891666,
"modified": false
},
"TaskAttachmentRepository.php": {
"type": "-",
"size": 8806,
"lmtime": 1770937612535,
"lmtime": 1770731454505,
"modified": false
},
"WorkTimeRepository.php": {
@@ -192,14 +188,6 @@
"lmtime": 1770653480229,
"modified": false
}
},
"Finances": {
"FinanceRepository.php": {
"type": "-",
"size": 16494,
"lmtime": 1771100224930,
"modified": false
}
}
},
"factory": {
@@ -212,7 +200,7 @@
"class.Crm.php": {
"type": "-",
"size": 1434,
"lmtime": 1771099700900,
"lmtime": 1771236164963,
"modified": false
},
"class.Cron.php": {
@@ -224,7 +212,7 @@
"class.Finances.php": {
"type": "-",
"size": 3450,
"lmtime": 1771100409816,
"lmtime": 1771236164964,
"modified": false
},
"class.Projects.php": {
@@ -235,8 +223,8 @@
},
"class.Tasks.php": {
"type": "-",
"size": 21447,
"lmtime": 1770937810551,
"size": 21700,
"lmtime": 1771237098140,
"modified": false
},
"class.Users.php": {
@@ -263,8 +251,8 @@
".claude": {
"settings.local.json": {
"type": "-",
"size": 287,
"lmtime": 1771099575728,
"size": 301,
"lmtime": 1771236164946,
"modified": false
}
},
@@ -277,8 +265,8 @@
"config.php": {
"type": "-",
"size": 1232,
"lmtime": 1770937612536,
"modified": false
"lmtime": 1770587027872,
"modified": true
},
"cron.php": {
"type": "-",
@@ -303,8 +291,8 @@
"logs.txt": {
"type": "-",
"size": 3048,
"lmtime": 0,
"modified": false
"lmtime": 1770733260000,
"modified": true
},
"REFACTORING_PLAN.md": {
"type": "-",
@@ -341,14 +329,14 @@
},
"task_edit.php": {
"type": "-",
"size": 10285,
"lmtime": 1770937612539,
"size": 10758,
"lmtime": 1771237304287,
"modified": false
},
"task_popup.php": {
"type": "-",
"size": 16702,
"lmtime": 1770937612540,
"size": 20929,
"lmtime": 1771241165284,
"modified": false
},
"task_single.php": {
@@ -360,7 +348,7 @@
"work-time.php": {
"type": "-",
"size": 12763,
"lmtime": 1771098956366,
"lmtime": 1771236164971,
"modified": false
}
},
@@ -408,7 +396,7 @@
"textarea.php": {
"type": "-",
"size": 1383,
"lmtime": 1770937612537,
"lmtime": 1770733546656,
"modified": false
}
},
@@ -416,7 +404,7 @@
"task-edit.php": {
"type": "-",
"size": 7739,
"lmtime": 1770937612538,
"lmtime": 1770733570166,
"modified": false
}
},
@@ -424,13 +412,13 @@
"client-edit.php": {
"type": "-",
"size": 1998,
"lmtime": 1771099489547,
"lmtime": 1771236164967,
"modified": false
},
"main-view.php": {
"type": "-",
"size": 2103,
"lmtime": 1771099477641,
"lmtime": 1771236164967,
"modified": false
}
},
@@ -444,13 +432,13 @@
"main-view.php": {
"type": "-",
"size": 13340,
"lmtime": 1771100368424,
"lmtime": 1771236164969,
"modified": false
},
"operation-edit.php": {
"type": "-",
"size": 4351,
"lmtime": 1771100291581,
"lmtime": 1771236164970,
"modified": false
},
"operations-list.php": {

View File

@@ -352,6 +352,15 @@ class Tasks
$task_id = (int)\S::get( 'task_id' );
$users = \S::get( 'users' );
$status_change_mail_value = \S::get( 'status_change_mail' );
$status_change_mail = 0;
if ( is_bool( $status_change_mail_value ) )
$status_change_mail = $status_change_mail_value ? 1 : 0;
elseif ( is_numeric( $status_change_mail_value ) )
$status_change_mail = (int)$status_change_mail_value === 1 ? 1 : 0;
elseif ( is_string( $status_change_mail_value ) )
$status_change_mail = in_array( strtolower( trim( $status_change_mail_value ) ), [ '1', 'on', 'true', 'yes' ], true ) ? 1 : 0;
if ( !$task_id ) {
echo json_encode( [ 'status' => 'error' ] );
@@ -366,6 +375,8 @@ class Tasks
}
}
$mdb -> update( 'tasks', [ 'status_change_mail' => $status_change_mail ], [ 'id' => $task_id ] );
echo json_encode( [ 'status' => 'success' ] );
exit;
}

View File

@@ -124,6 +124,12 @@
</label>
<? endforeach; endif;?>
</div>
<div class="task-users-options">
<label class="task-user-label task-status-mail-label">
<input type="checkbox" class="task-status-change-mail-checkbox g-checkbox" value="1" <? if ( (int)$this -> task['status_change_mail'] === 1 ):?>checked="checked"<? endif;?>>
Powiadom o zmianie statusu:
</label>
</div>
<a href="#" class="btn btn-primary btn-sm js-save-task-users" task_id="<?= $this -> task['id'];?>" style="margin-top: 10px;">Zapisz</a>
</div>
</div>
@@ -320,6 +326,14 @@
.task_popup .task_details .task-user-label input[type="checkbox"] {
margin: 0;
}
.task_popup .task_details .task-users-options {
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid #e6e9ed;
}
.task_popup .task_details .task-status-mail-label {
font-weight: 600;
}
/* Lightbox - powiększanie zdjęć w opisie */
.task_popup .task_details .description img {
@@ -423,7 +437,7 @@
if ( $.fn.iCheck )
{
popup.find( '.task-user-checkbox' ).iCheck({
popup.find( '.task-user-checkbox, .task-status-change-mail-checkbox' ).iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue'
});
@@ -478,6 +492,7 @@
var btn = $( this );
var task_id = btn.attr( 'task_id' );
var users = [];
var status_change_mail = popup.find( '.task-status-change-mail-checkbox' ).is( ':checked' ) ? 1 : 0;
popup.find( '.task-user-checkbox:checked' ).each( function() {
users.push( $( this ).val() );
});
@@ -485,7 +500,7 @@
$.ajax({
type: 'POST',
url: '/tasks/task_change_users/',
data: { task_id: task_id, users: users },
data: { task_id: task_id, users: users, status_change_mail: status_change_mail },
success: function( response ) {
var res = typeof response === 'string' ? JSON.parse( response ) : response;
if ( res.status === 'success' ) {