dashboard.blade.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. @extends('layouts.pro')
  2. @section('content')
  3. @if(Session::get('message'))
  4. <div class="alert-alert-info">{{Session::get('message')}}</div>
  5. @endif
  6. <h1>Pro dashboard</h1>
  7. <a href="{{route('pro-logout')}}">Log out</a>
  8. <ul>
  9. <li>
  10. <a href="{{route('pro-index')}}">Pros</a>
  11. </li>
  12. </ul>
  13. <div moe>
  14. <a start show href="">create pro</a>
  15. <form url="/api/dev/createSystemAdmin" style="display:none">
  16. <h1>Form to create pro</h1>
  17. <button submit>submit</button>
  18. <button cancel>Cancel</button>
  19. </form>
  20. </div>
  21. <script>
  22. var stompClient = null;
  23. function setConnected(connected) {
  24. console.log("User is connected");
  25. $("#connect").prop("disabled", connected);
  26. $("#disconnect").prop("disabled", !connected);
  27. if (connected) {
  28. $("#conversation").show();
  29. }
  30. else {
  31. $("#conversation").hide();
  32. }
  33. $("#greetings").html("");
  34. }
  35. function connect() {
  36. console.log("connecting...");
  37. var socket = new SockJS('http://localhost:8080/ws');
  38. stompClient = Stomp.over(socket);
  39. stompClient.connect({}, function (frame) {
  40. console.log("Connected");
  41. setConnected(true);
  42. console.log('Connected: ' + frame);
  43. stompClient.send("/app/update-participant-status", {}, JSON.stringify({meetingUid:"mymeetinguid", status:'mystatus'}));
  44. stompClient.subscribe('/user/topic/on-participant-status-change', function (message) {
  45. console.log("Participant status changed: ", message);
  46. });
  47. stompClient.subscribe("/user/topic/incoming-call", function(message){
  48. console.log("incoming call:", message);
  49. });
  50. });
  51. }
  52. connect();
  53. function disconnect() {
  54. if (stompClient !== null) {
  55. stompClient.disconnect();
  56. }
  57. setConnected(false);
  58. console.log("Disconnected");
  59. }
  60. function sendName() {
  61. stompClient.send("/app/hello", {}, JSON.stringify({'name': $("#name").val()}));
  62. }
  63. function showGreeting(message) {
  64. $("#greetings").append("<tr><td>" + message + "</td></tr>");
  65. }
  66. $(function () {
  67. $("form").on('submit', function (e) {
  68. e.preventDefault();
  69. });
  70. $( "#connect" ).click(function() { connect(); });
  71. $( "#disconnect" ).click(function() { disconnect(); });
  72. $( "#send" ).click(function() { sendName(); });
  73. });
  74. </script>
  75. @endsection