Merge branch 'ent-5654-El-sistema-de-modificacion-de-notificaciones-no-funciona' into 'develop'
minor visual changes on user notifications editor See merge request artica/pandorafms!3134
This commit is contained in:
commit
c4bec9c36c
|
@ -3351,9 +3351,11 @@ function html_print_switch($attributes=[])
|
||||||
$attributes['style'] = '';
|
$attributes['style'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$disabled_class .= (bool) ($attributes['disabled']) ? ' p-slider-disabled' : '';
|
||||||
|
|
||||||
return "<label class='p-switch' style='".$attributes['style']."'>
|
return "<label class='p-switch' style='".$attributes['style']."'>
|
||||||
<input type='checkbox' ".$html_expand.">
|
<input type='checkbox' ".$html_expand.">
|
||||||
<span class='p-slider'></span>
|
<span class='p-slider".$disabled_class."'></span>
|
||||||
</label>";
|
</label>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -916,7 +916,7 @@ function notifications_print_two_ways_select($info_selec, $users, $source_id)
|
||||||
function notifications_print_user_switch($source, $user, $label)
|
function notifications_print_user_switch($source, $user, $label)
|
||||||
{
|
{
|
||||||
$status = notifications_get_user_label_status($source, $user, $label);
|
$status = notifications_get_user_label_status($source, $user, $label);
|
||||||
return html_print_switch(
|
$switch = html_print_switch(
|
||||||
[
|
[
|
||||||
'name' => $label,
|
'name' => $label,
|
||||||
'value' => $status['status'],
|
'value' => $status['status'],
|
||||||
|
@ -925,6 +925,13 @@ function notifications_print_user_switch($source, $user, $label)
|
||||||
'id' => 'notifications-user-'.$source['id'].'-label-'.$label,
|
'id' => 'notifications-user-'.$source['id'].'-label-'.$label,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'disabled' => !$status['enabled'],
|
||||||
|
'switch' => $switch,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4656,6 +4656,10 @@ div#dialog_messages table th:last-child {
|
||||||
border-radius: 34px;
|
border-radius: 34px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.p-slider-disabled {
|
||||||
|
background-color: #dfdfdf !important;
|
||||||
|
}
|
||||||
|
|
||||||
.p-slider:before {
|
.p-slider:before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "";
|
content: "";
|
||||||
|
|
|
@ -64,7 +64,10 @@ echo '<div id="user-notifications-wrapper" class="white_box table_div table_thre
|
||||||
<div class="table_th">'.__('Also receive an email').'</div>
|
<div class="table_th">'.__('Also receive an email').'</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
$sources = notifications_get_all_sources();
|
$sources = notifications_get_all_sources();
|
||||||
|
|
||||||
|
$disabled_flag = false;
|
||||||
|
|
||||||
foreach ($sources as $source) {
|
foreach ($sources as $source) {
|
||||||
echo '<div class="table_tbody">';
|
echo '<div class="table_tbody">';
|
||||||
$table_content = [
|
$table_content = [
|
||||||
|
@ -72,12 +75,24 @@ foreach ($sources as $source) {
|
||||||
notifications_print_user_switch($source, $id, 'enabled'),
|
notifications_print_user_switch($source, $id, 'enabled'),
|
||||||
notifications_print_user_switch($source, $id, 'also_mail'),
|
notifications_print_user_switch($source, $id, 'also_mail'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$notifications_enabled = notifications_print_user_switch($source, $id, 'enabled');
|
||||||
|
$notifications_also_mail = notifications_print_user_switch($source, $id, 'also_mail');
|
||||||
|
|
||||||
|
if ($notifications_enabled['disabled'] == 1 || $notifications_also_mail['disabled'] == 1) {
|
||||||
|
$disabled_flag = true;
|
||||||
|
}
|
||||||
|
|
||||||
echo '<div class="table_td">'.$source['description'].'</div>';
|
echo '<div class="table_td">'.$source['description'].'</div>';
|
||||||
echo '<div class="table_td">'.notifications_print_user_switch($source, $id, 'enabled').'</div>';
|
echo '<div class="table_td">'.$notifications_enabled['switch'].'</div>';
|
||||||
echo '<div class="table_td">'.notifications_print_user_switch($source, $id, 'also_mail').'</div>';
|
echo '<div class="table_td">'.$notifications_also_mail['switch'].'</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($disabled_flag) {
|
||||||
|
echo '<span style="font-weight: bold; color: #ff0000;">Disabled controls have been set by the system administrator</span>';
|
||||||
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
// Print id user to handle it on js.
|
// Print id user to handle it on js.
|
||||||
|
|
Loading…
Reference in New Issue