Merge branch 'ent-12366-bug-al-asignar-5-o-mas-perfiles-a-un-usuario' into 'develop'

Ent 12366 bug al asignar 5 o mas perfiles a un usuario

See merge request artica/pandorafms!6771
This commit is contained in:
Rafael Ameijeiras 2024-01-19 08:36:45 +00:00
commit 0c73dab521
2 changed files with 32 additions and 47 deletions

View File

@ -689,7 +689,7 @@ foreach ($info as $user_id => $user_info) {
// User profiles. // User profiles.
if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) { if ($user_is_admin || $user_id == $config['id_user'] || isset($group_um[0])) {
$user_profiles = db_get_all_rows_sql( $user_profiles = db_get_all_rows_sql(
'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'" LIMIT 5' 'SELECT * FROM tusuario_perfil where id_usuario LIKE "'.$user_id.'"'
); );
} else { } else {
$user_profiles_aux = users_get_user_profile($user_id, 'LIMIT 5'); $user_profiles_aux = users_get_user_profile($user_id, 'LIMIT 5');
@ -778,17 +778,25 @@ foreach ($info as $user_id => $user_info) {
if ($user_profiles !== false) { if ($user_profiles !== false) {
$total_profile = 0; $total_profile = 0;
$data[4] .= '<div class="text_end">'; $data[4] .= '<div class="flex-column-start">';
foreach ($user_profiles as $row) { foreach ($user_profiles as $row) {
$total_profile++;
if ($total_profile > 5) {
$data[4] .= "<div class='invisible checkhide_".str_replace(' ', '_', io_safe_output($row['id_usuario']))."'>";
}
$data[4] .= "<div class='float-left'>"; $data[4] .= "<div class='float-left'>";
$data[4] .= profile_get_name($row['id_perfil']); $data[4] .= profile_get_name($row['id_perfil']);
$data[4] .= ' / </div>'; $data[4] .= ' / ';
$data[4] .= "<div class='float-left pdd_l_5px'>";
$data[4] .= groups_get_name($row['id_grupo'], true); $data[4] .= groups_get_name($row['id_grupo'], true);
$data[4] .= '</div>'; $data[4] .= '</div>';
if ($total_profile == 0 && count($user_profiles) >= 5) { if ($total_profile > 5) {
$data[4] .= '<span onclick="showGroups(`'.$row['id_usuario'].'`)">'.html_print_image( $data[4] .= '</div>';
}
if ($total_profile == 1 && count($user_profiles) > 5) {
$data[4] .= '<span class="show-profiles" onclick="showGroups(`'.str_replace(' ', '_', io_safe_output($row['id_usuario'])).'`)">'.html_print_image(
'images/zoom.png', 'images/zoom.png',
true, true,
[ [
@ -803,10 +811,6 @@ foreach ($info as $user_id => $user_info) {
true true
); );
} }
$data[4] .= '<br/>';
$total_profile++;
} }
if (isset($user_info['not_delete']) === true) { if (isset($user_info['not_delete']) === true) {
@ -1057,43 +1061,13 @@ if ($is_management_allowed === true) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function showGroups(id_user) { function showGroups(id_user) {
if ($(`#hidden-show_groups_${id_user}`).val() === '-1') { $('.checkhide_'+id_user).each(function(){
var request = $.ajax({ if ($(this).hasClass('invisible') === true) {
url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>", $(this).removeClass('invisible');
type: 'GET', } else {
dataType: 'json', $(this).addClass('invisible');
data: { }
page: 'godmode/users/user_list', });
get_user_profile_group: 1,
id_user: id_user
},
success: function (data, textStatus, xhr) {
let count = 1;
data.forEach( function(valor, indice, array) {
if (count >= 6) {
let main_div = $(`#profiles_${id_user}`);
main_div.append(
`<div id="left_${id_user}_${count}" class='float-left'>${valor.id_perfil} / </div>`,
`<div id="right_${id_user}_${count}" class='float-left pdd_l_5px'>${valor.id_grupo}</div>`,
`<br/><br/>`
);
}
count ++;
});
},
error: function (e, textStatus) {
console.error(textStatus);
}
});
$(`#hidden-show_groups_${id_user}`).val('1');
$(`#profiles_${id_user}`).show();
} else if ($(`#hidden-show_groups_${id_user}`).val() === '1') {
$(`#hidden-show_groups_${id_user}`).val('0');
$(`#profiles_${id_user}`).hide();
} else {
$(`#hidden-show_groups_${id_user}`).val('1');
$(`#profiles_${id_user}`).show();
}
} }
</script> </script>

View File

@ -994,6 +994,12 @@ select:-internal-list-box {
justify-content: flex-start !important; justify-content: flex-start !important;
} }
.flex-column-start {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.padding-2 { .padding-2 {
padding: 2em; padding: 2em;
} }
@ -5539,6 +5545,11 @@ input:checked + .p-slider:before {
color: #4d4d4d; color: #4d4d4d;
} }
.show-profiles {
position: absolute;
margin-left: 15%;
}
/* Tables to upload files */ /* Tables to upload files */
#table_filemanager tr:first-child th span { #table_filemanager tr:first-child th span {
font-weight: bold; font-weight: bold;