summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/call_forward.js
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-20 19:06:19 +0200
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-06-20 19:06:19 +0200
commiteb0e1cc5c26275ff3e5c341404e8bc558f8312b8 (patch)
tree71f449ccd6f15422717de3ac24f87d5e888ddd79 /app/assets/javascripts/call_forward.js
parentdf6e17e48995f25e72509986f30700d778b179b6 (diff)
parent3b27a5d45b12f6bac65da2a8e17387bfda42a2f1 (diff)
Merge branch 'develop'
Diffstat (limited to 'app/assets/javascripts/call_forward.js')
-rw-r--r--app/assets/javascripts/call_forward.js61
1 files changed, 61 insertions, 0 deletions
diff --git a/app/assets/javascripts/call_forward.js b/app/assets/javascripts/call_forward.js
new file mode 100644
index 0000000..13c5679
--- /dev/null
+++ b/app/assets/javascripts/call_forward.js
@@ -0,0 +1,61 @@
+ $(document).ready(function(){
+ if($('#call_forward_call_forward_case_id').val() != "3"){
+ $("#timeout_div").css('display','none');
+ }
+ else{
+ $("#timeout_div").css('display','block');
+ }
+ $('#call_forward_call_forward_case_id').change(function(){
+ if($(this).val() != "3"){
+ $("#timeout_div").css('display','none');
+ }
+ else{
+ $("#timeout_div").css('display','block');
+ }
+ })
+
+ var voicemail_pattern = /VoicemailAccount$/;
+
+ if($('#call_forward_call_forwarding_destination').val()) {
+
+ if($('#call_forward_call_forwarding_destination').val() == ":PhoneNumber"){
+ $("#destination_phone_number").attr('name', 'call_forward[destination]');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','block');
+ $("#destination_greeting_div").css('display','none');
+
+ }
+ else if ($('#call_forward_call_forwarding_destination').val().match(voicemail_pattern)){
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'call_forward[destination]');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','block');
+ }
+ else {
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','none');
+ }
+ $('#call_forward_call_forwarding_destination').change(function(){
+ if($(this).val() == ":PhoneNumber"){
+ $("#destination_phone_number").attr('name', 'call_forward[destination]');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','block');
+ $("#destination_greeting_div").css('display','none');
+ }
+ else if ($('#call_forward_call_forwarding_destination').val().match(voicemail_pattern)){
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'call_forward[destination]');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','block');
+ }
+ else{
+ $("#destination_phone_number").attr('name', 'disabled');
+ $("#destination_greeting").attr('name', 'disabled');
+ $("#destination_phone_number_div").css('display','none');
+ $("#destination_greeting_div").css('display','none');
+ }
+ })
+ }
+ });