Ring Groups: Enhance Destination Enabled Switch

This commit is contained in:
fusionate
2023-01-21 01:30:34 +00:00
parent 581c919132
commit df6bc02489
5 changed files with 214 additions and 24 deletions

View File

@@ -377,8 +377,8 @@
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_number"] = $row['destination_number'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_delay"] = $row['destination_delay'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_timeout"] = $row['destination_timeout'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_prompt"] = $row['destination_prompt'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_enabled"] = $row['destination_enabled'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["destination_prompt"] = $row['destination_prompt'];
$array['ring_groups'][0]["ring_group_destinations"][$y]["domain_uuid"] = $domain_uuid;
}
$y++;
@@ -755,7 +755,7 @@
if (permission_exists('ring_group_prompt')) {
echo " <td class='vtable'>".$text['label-destination_prompt']."</td>\n";
}
echo " <td class='vtable'>"."Enable"."</td>\n";
echo " <td class='vtable'>".$text['label-destination_enabled']."</td>\n";
if ($show_destination_delete && permission_exists('ring_group_destination_delete')) {
echo " <td class='vtable edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_destinations', 'delete_toggle_destinations');\" onmouseout=\"swap_display('delete_label_destinations', 'delete_toggle_destinations');\">\n";
echo " <span id='delete_label_destinations'>".$text['label-delete']."</span>\n";
@@ -770,13 +770,19 @@
if (strlen($row['ring_group_destination_uuid']) > 0) {
echo " <input name='ring_group_destinations[".$x."][ring_group_destination_uuid]' type='hidden' value=\"".escape($row['ring_group_destination_uuid'])."\">\n";
} else {
$row['destination_enabled'] = 'true';
}
}
echo " <tr>\n";
echo " <td class='formfld'>\n";
echo " <input type=\"text\" name=\"ring_group_destinations[".$x."][destination_number]\" class=\"formfld\" value=\"".escape($row['destination_number'])."\">\n";
if (!is_uuid($row['ring_group_destination_uuid'])) { // new record
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
$onkeyup = "onkeyup=\"document.getElementById('ring_group_destinations_".$x."_destination_enabled').checked = (this.value != '' ? true : false);\""; // switch
}
else {
$onkeyup = "onkeyup=\"document.getElementById('ring_group_destinations_".$x."_destination_enabled').value = (this.value != '' ? true : false);\""; // select
}
}
echo " <input type=\"text\" name=\"ring_group_destinations[".$x."][destination_number]\" class=\"formfld\" value=\"".escape($row['destination_number'])."\" ".$onkeyup.">\n";
echo " </td>\n";
echo " <td class='formfld'>\n";
echo " <select name='ring_group_destinations[".$x."][destination_delay]' class='formfld' style='width:55px'>\n";
@@ -807,7 +813,6 @@
}
echo " </select>\n";
echo " </td>\n";
if (permission_exists('ring_group_prompt')) {
echo " <td class='formfld'>\n";
echo " <select class='formfld' style='width: 90px;' name='ring_group_destinations[".$x."][destination_prompt]'>\n";
@@ -817,19 +822,22 @@
echo " </select>\n";
echo " </td>\n";
}
echo " <td valign='top' class='".$row_style[$c]." switch-c'>\n";
###iphone
echo " <label class='switch'>\n";
$checked = ($row['destination_enabled'] == 'true' ? 'checked=checked' : '');
echo " <input type ='checkbox' id='ring_group_destinations[".$x."][destination_enabled]' name='ring_group_destinations[".$x."][destination_enabled]' $checked>\n";
echo " <div class ='slider round'></div>\n";
echo " </div>\n";
#iphone button
echo "</td>";
echo " <td class='formfld'>\n";
// switch
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='ring_group_destinations_".$x."_destination_enabled' name='ring_group_destinations[".$x."][destination_enabled]' value='true' ".($row['destination_enabled'] == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
// select
else {
echo " <select class='formfld' id='ring_group_destinations_".$x."_destination_enabled' name='ring_group_destinations[".$x."][destination_enabled]'>\n";
echo " <option value='false'>".$text['option-false']."</option>\n";
echo " <option value='true' ".($row['destination_enabled'] == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " </select>\n";
}
echo " </td>\n";
if ($show_destination_delete && permission_exists('ring_group_destination_delete')) {
if (is_uuid($row['ring_group_destination_uuid'])) {
echo " <td class='vtable' style='text-align: center; padding-bottom: 3px;'>";