Avviso utenti abilitati per la check

This commit is contained in:
Luca 2023-02-20 19:01:24 +01:00
parent 4ada1a3c7a
commit 92d3d3a967
3 changed files with 20 additions and 20 deletions

View File

@ -258,15 +258,11 @@ elseif (filter('op') == 'rimuovi-nota') {
elseif (filter('op') == 'copia-checklist') {
$content = post('content');
$checklist_id = post('checklist');
if (!empty(post('assigned_users'))){
$users = post('assigned_users');
$users = array_clean($users);
}
if (!empty(post('group_id'))){
$group_id = post('group_id');
}
$users = post('assigned_users');
$users = array_clean($users);
$group_id = post('group_id');
$checklist = Checklist::find($checklist_id);
$checklist->copia($user, $id_record, $users, $group_id);
@ -277,14 +273,10 @@ elseif (filter('op') == 'aggiungi-check') {
$content = post('content');
$parent_id = post('parent') ?: null;
if (!empty(post('assigned_users'))){
$users = post('assigned_users');
$users = array_clean($users);
}
if (!empty(post('group_id'))){
$group_id = post('group_id');
}
$users = post('assigned_users');
$users = array_clean($users);
$group_id = post('group_id');
$check = Check::build($user, $structure, $id_record, $content, $parent_id);
$check->setAccess($users, $group_id);

View File

@ -56,9 +56,11 @@ if (!function_exists('array_clean')) {
*/
function array_clean($array)
{
return array_unique(array_values(array_filter($array, function ($value) {
return !empty($value);
})));
if (!empty($array)){
return array_unique(array_values(array_filter($array, function ($value) {
return !empty($value);
})));
}
}
}

View File

@ -28,6 +28,12 @@ function renderChecklist($check, $level = 0)
<span class="text">'.$check->content.'</span>';
if (intval($check->assignedUsers->pluck('id')->toArray())>0){
$result .= '<span class="label label-default">'. implode(',', $check->assignedUsers->pluck('username')->toArray()).'</span>';
}else{
$result .= '<span class="label label-danger">'. tr('Nessun utente asseganto').'</span>';
}
if (empty($check->user) || $check->user->id == $user->id) {
$result .= '
<div class="tools">