meeting.blade.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. @extends('layouts.guest-meeting')
  2. @section('content')
  3. <div id="meetingComponent">
  4. <h5 class="bg-dark font-weight-bold text-white m-0 py-3 px-4 d-flex">
  5. <span>Meeting</span>
  6. <span class="ml-auto" v-if="!started">
  7. Connecting...
  8. </span>
  9. <span class="ml-auto" v-if="started">
  10. <i class="fa fa-clock mr-1 text-light"></i>
  11. @{{ timeDisplay() }}
  12. </span>
  13. </h5>
  14. <div class="d-flex align-items-stretch mt-4 justify-content-center flex-nowrap">
  15. <div class="tp-bar">
  16. <div v-for="(guest, index) of guests"
  17. class="tp-item mb-4"
  18. :class="activeParticipant && activeType === 'guest' && activeParticipant.id === guest.id ? 'active' : ''"
  19. v-on:click="setActiveView('guest', guest)">
  20. <img :src="guest.image" alt="" class="w-100">
  21. <p class="font-weight-bold text-center mt-1 mb-0">@{{ guest.name }}</p>
  22. </div>
  23. <div v-if="!guest" class="tp-item mb-4">
  24. <img src="/images/person/guest.png" alt="" class="w-100">
  25. <p class="font-weight-bold text-center mt-1">Invite Guest</p>
  26. </div>
  27. </div>
  28. <div class="main-view" style="width: 800px; min-height: 600px;">
  29. <div class="p-4 w-100 h-100 d-flex align-items-stretch justify-content-stretch flex-column">
  30. <img :src="activeParticipant.image" class="d-block mw-100 mh-100 mx-auto">
  31. <p class="font-weight-bold text-center text-white mt-2">Feed from @{{ activeParticipant.name }}</p>
  32. </div>
  33. </div>
  34. <div class="tp-bar">
  35. <div v-for="(pro, index) of pros"
  36. class="tp-item mb-4"
  37. :class="activeParticipant && activeType === 'pro' && activeParticipant.id === pro.id ? 'active' : ''"
  38. v-on:click="setActiveView('pro', pro)">
  39. <div v-if="pro.status === 'active'">
  40. <img :src="pro.image" alt="" class="w-100">
  41. <p class="font-weight-bold text-center mt-1 mb-0">@{{ pro.name }}</p>
  42. <p class="font-weight-normal text-center">@{{ pro.type }}</p>
  43. </div>
  44. <div v-if="pro.status === 'connecting'">
  45. <img src="/images/person/connecting.jpg" alt="" class="w-100">
  46. <p class="font-weight-normal text-center mt-1 d-flex align-items-center justify-content-center">
  47. <img src="/images/loading.gif" class="mr-1">
  48. Connecting
  49. </p>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <script>
  56. new Vue({
  57. el: '#meetingComponent',
  58. delimiters: ['@{{', '}}'],
  59. data: {
  60. meetingID: '<?= $meetingID ?>',
  61. participantID: '<?= $participantID ?>',
  62. time: 0,
  63. startTime: 0,
  64. started: false,
  65. guest: false,
  66. activeType: false,
  67. activeParticipant: false,
  68. guests: [
  69. {
  70. id: 1,
  71. name: 'You',
  72. image: '/images/person/you.jpg',
  73. status: 'active',
  74. },
  75. ],
  76. pros: [
  77. {
  78. id: 1,
  79. name: 'Nancy Drew',
  80. type: 'Receptionist',
  81. image: '/images/person/nancy.jpg',
  82. status: 'connecting',
  83. }
  84. ]
  85. // pros: []
  86. },
  87. methods: {
  88. setActiveView: function(_type, _participant) {
  89. if(_participant.status === 'active') {
  90. this.activeType = _type;
  91. this.activeParticipant = _participant;
  92. }
  93. },
  94. timeDisplay: function() {
  95. // this.time = new Date().getTime() - this.startTime;
  96. var seconds = this.time / 1000,
  97. minutes = parseInt(seconds / 60, 10);
  98. seconds = parseInt(seconds % 60, 10);
  99. return minutes + " min, " + seconds + " sec";
  100. }
  101. },
  102. mounted: function() {
  103. this.activeType = 'guest';
  104. this.activeParticipant = this.guests[0];
  105. var self = this;
  106. // after 2 seconds, connect recep
  107. window.setTimeout(function() {
  108. self.pros[0].status = 'active';
  109. self.started = true;
  110. self.startTime = new Date().getTime();
  111. self.activeType = 'pro';
  112. self.activeParticipant = self.pros[0];
  113. window.setInterval(function() {
  114. self.time = new Date().getTime() - self.startTime;
  115. }, 1000);
  116. // after 1 second, add 2 docs in connecting state
  117. window.setTimeout(function() {
  118. self.pros.push({
  119. id: 2,
  120. name: 'Dr. Strange',
  121. type: 'Dietitian',
  122. image: '/images/person/strange.0.jpg',
  123. status: 'connecting',
  124. });
  125. self.pros.push({
  126. id: 3,
  127. name: 'Dr. Do Little',
  128. type: 'Cardiologist',
  129. image: '/images/person/dl.jpg',
  130. status: 'connecting',
  131. });
  132. // after a second, connect strange
  133. window.setTimeout(function() {
  134. self.pros[1].status = 'active';
  135. window.setTimeout(function() {
  136. self.pros[2].status = 'active';
  137. }, 1000);
  138. }, 1000);
  139. }, 1000);
  140. }, 2000);
  141. }
  142. });
  143. </script>
  144. @endsection