@if(!defined('LOAD_CHATBOT'))
	
	@push('js')
		<script src='http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js'></script>
		<script src="{{asset('/assets/apps/Conferencing/js/init_chat.min.js')}}"></script>

		<script>
			var __baseUrl = {!! json_encode(url('/')) !!};
			var __sendUrl = "{!! route('Conferencing.Messenger.ajax::message.new') !!}";

			var show = function(data) {
				alert(data.sender.name + " - '" + data.message + "'");
			}

			var msgshow = function(data) {
				console.log(userChannel);
				console.log(data);
				var html = '<li id="message-' + data.id + '">' +
				'<div class="message-data">' +
				'<span class="message-data-name"> <a href="#" class="talkDeleteMessage" data-message-id="' + data.id + '" title="Delete Message"><i class="fa fa-close" style="margin-right: 3px;"></i></a>' + data.sender.first_name + ' ' + data.sender.last_name + '</span>' +
				'<span class="message-data-time">1 Second ago</span>' +
				'</div>' +
				'<div class="message my-message">' +
				data.message +
				'</div>' +
				'</li>';

				$('#talkMessages').append(html);

				var objDiv = $('.chat-history');
				objDiv.scrollTop(1E10);
				// objDiv.scrollTop(objDiv.height());
			}

		</script>

		@include('apps.Conferencing.Messenger.partials.handlebars')

		{!! App\Repositories\Conferencing\Messages::talk_live(['user'=>["id"=>auth()->user()->id, 'callback'=>['msgshow']], 'conversation' => ["id" => 1]]) !!}

	@endpush

	@push('css')
		<link rel="stylesheet" href="/assets/apps/Conferencing/css/chat.min.css"> 
	@endpush
	@php(define('LOAD_CHATBOT', true))
@endif