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

@ -259,14 +259,10 @@ 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');
}
$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');
}
$check = Check::build($user, $structure, $id_record, $content, $parent_id);
$check->setAccess($users, $group_id);

View File

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

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