diff --git a/include/controllers/default/cockpit/support/index.php b/include/controllers/default/cockpit/support/index.php index 274b42fdf..b88be808e 100644 --- a/include/controllers/default/cockpit/support/index.php +++ b/include/controllers/default/cockpit/support/index.php @@ -19,6 +19,11 @@ class Controller_Support extends Crunchbutton_Controller_Account { c::view()->display('support/new-chat'); break; + case 'make-call': + c::view()->layout('layout/ajax'); + c::view()->display('support/make-call'); + break; + case 'new': if ( !Crunchbutton_Support::adminHasCreatePermission() ) { diff --git a/include/controllers/default/cockpit/support/phone/connect.php b/include/controllers/default/cockpit/support/phone/connect.php index b9bc6c95e..1d194106c 100644 --- a/include/controllers/default/cockpit/support/phone/connect.php +++ b/include/controllers/default/cockpit/support/phone/connect.php @@ -4,7 +4,6 @@ class Controller_Support_Phone_Connect extends Crunchbutton_Controller_Account { public function init() { - switch (c::getPagePiece(3)) { case 'restaurant': $callerId = c::config()->twilio->live->outgoingRestaurant; @@ -14,11 +13,10 @@ class Controller_Support_Phone_Connect extends Crunchbutton_Controller_Account { break; case 'customer': default: - $callerId = c::config()->twilio->live->outgoingcustomer; + $callerId = c::config()->twilio->live->outgoingCustomer; break; } - $num = c::admin()->phone; $host = 'dev.crunchr.co'; //c::config()->host_callback @@ -29,17 +27,8 @@ class Controller_Support_Phone_Connect extends Crunchbutton_Controller_Account { '+1'.$num, 'http://'.$host.'/api/twilio/outgoing/'.c::getPagePiece(3).'?PhoneNumber='.$_REQUEST['phone'] ); - die('pick up your phone...'); - - exit; - - - - - - } } diff --git a/include/library/Crunchbutton/Community/Shift.php b/include/library/Crunchbutton/Community/Shift.php index 63024028a..cbc0c0dde 100644 --- a/include/library/Crunchbutton/Community/Shift.php +++ b/include/library/Crunchbutton/Community/Shift.php @@ -431,7 +431,9 @@ class Crunchbutton_Community_Shift extends Cana_Table { $twilio = new Twilio( c::config()->twilio->{$env}->sid, c::config()->twilio->{$env}->token ); - if( count( $communitiesWithoutShift ) > 0 ){ + // removed this sms for while + + if( false && count( $communitiesWithoutShift ) > 0 ){ $message = "The following communities doesn't have shifts for the current week: " . join( ', ', $communitiesWithoutShift ); diff --git a/include/views/default/cockpit/support/chat.phtml b/include/views/default/cockpit/support/chat.phtml index 2d659c1e4..781bcd493 100644 --- a/include/views/default/cockpit/support/chat.phtml +++ b/include/views/default/cockpit/support/chat.phtml @@ -33,6 +33,9 @@ View ticket +
  • + Call Customer +
  • diff --git a/include/views/default/cockpit/support/content.phtml b/include/views/default/cockpit/support/content.phtml index 495b04e8e..8744c616c 100644 --- a/include/views/default/cockpit/support/content.phtml +++ b/include/views/default/cockpit/support/content.phtml @@ -11,7 +11,7 @@
    -
    +
    @@ -21,9 +21,8 @@
  • Closed
  • -
    -
    -
    +     +
    -
    -
    -
    - -
    -
    -
    + +    
    -
    -
    -
    + +     -
    -
    -
    -
    - -
    + +     + + +     + + +     -
    +     +

    +      + + \ No newline at end of file diff --git a/include/views/default/cockpit/support/index.phtml b/include/views/default/cockpit/support/index.phtml index a9bee33d3..84c9d1049 100644 --- a/include/views/default/cockpit/support/index.phtml +++ b/include/views/default/cockpit/support/index.phtml @@ -45,7 +45,7 @@ diff --git a/include/views/default/cockpit/support/support.phtml b/include/views/default/cockpit/support/support.phtml index 3cfa381df..80600438c 100644 --- a/include/views/default/cockpit/support/support.phtml +++ b/include/views/default/cockpit/support/support.phtml @@ -337,4 +337,5 @@ function linkOrder(){ background: #F5F5F5; border: 1px solid #CCC; } - \ No newline at end of file + + \ No newline at end of file diff --git a/www/assets/js/admin.support.js b/www/assets/js/admin.support.js index 854cd21be..774bec49a 100644 --- a/www/assets/js/admin.support.js +++ b/www/assets/js/admin.support.js @@ -277,6 +277,42 @@ startChat.send = function(){ $( '#modal-sms' ).modal( 'hide' ); alert( 'Oops, error! ' + data.error ); } - } ); + } ); +} +var makeCall = {}; +makeCall.start = function(){ + + var phone = $( '#form-make-call-phone' ).val(); + if( $.trim( phone ) == '' ){ + alert( 'Please type a phone!' ); + $( '#form-make-call-phone' ).focus(); + return; + } + + if( !App.phone.validate( phone ) ){ + alert( 'Please type a valid phone!' ); + $( '#form-make-call-phone' ).focus(); + return; + } + + var callto = $( '#form-make-call-to' ).val(); + + $( '.form-make-call-spin' ).show(); + $( '.form-make-call-button' ).hide(); + + $.ajax( { + url: '/support/phone/connect/' + callto + '?phone=' + phone + } ).done( function( data ) { + alert( data ); + $( '#modal-sms' ).modal( 'hide' ); + } ); +} + +makeCall.direct = function( callto, phone ){ + $.ajax( { + url: '/support/phone/connect/' + callto + '?phone=' + phone + } ).done( function( data ) { + alert( data ); + } ); } \ No newline at end of file