PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/outtheboxministry.org/themes/g/wowonder/layout/chat/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/outtheboxministry.org/themes/g/wowonder/layout/chat/group-tab.phtml

<div class="chat-wrapper chat_group_<?php echo $wo['chat']['group']['group_id'];?>">
	<div class="online-toggle-hdr pointer">
		<div class="wow_chat_hdr_usr" onclick="javascript:$('.group-tab-container-<?php echo $wo['chat']['group']['group_id'];?>').slideToggle(100)";>
			<div class="avatar">
				<img class="cht_hd_avtr" src="<?php echo $wo['chat']['group']['avatar'];?>" alt="<?php echo $wo['chat']['group']['group_name'];?>" />
			</div>
			<div>
				<h3><?php echo mb_substr($wo['chat']['group']['group_name'], 0, 13, "UTF-8");?></h3>
			</div>
		</div>
		<div class="close-chat">
			<?php if ($wo['chat']['group']['user_id'] == $wo['user']['id']): ?>
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" title="<?php echo $wo['lang']['delete_group'];?>" onclick="Wo_DeleteGroupChat(<?php echo $wo['chat']['group']['group_id'];?>)"><path fill="currentColor" d="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z" /></svg>
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" title="<?php echo $wo['lang']['edit_group'];?>" onclick="Wo_EditGChat(event,<?php echo $wo['chat']['group']['group_id'];?>)"><path fill="currentColor" d="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z" /></svg>
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" title="<?php echo $wo['lang']['clear_history'];?>" onclick="Wo_ClearGroupHistory(<?php echo $wo['chat']['group']['group_id'];?>)"><path fill="currentColor" d="M13.5,8H12V13L16.28,15.54L17,14.33L13.5,12.25V8M13,3A9,9 0 0,0 4,12H1L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3" /></svg>
			<?php endif ?>
			<?php if ($wo['chat']['group']['user_id'] != $wo['user']['id']): ?>
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" title="<?php echo $wo['lang']['exit_group'];?>" onclick="Wo_ExitGroupChat('<?php echo $wo['chat']['group']['group_id'];?>');"><path fill="currentColor" d="M19,3H5C3.89,3 3,3.89 3,5V9H5V5H19V19H5V15H3V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M10.08,15.58L11.5,17L16.5,12L11.5,7L10.08,8.41L12.67,11H3V13H12.67L10.08,15.58Z" /></svg>
			<?php endif; ?>
			<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" title="<?php echo $wo['lang']['members'];?>" onclick="Wo_ManageGChat();"><path fill="currentColor" d="M16,13C15.71,13 15.38,13 15.03,13.05C16.19,13.89 17,15 17,16.5V19H23V16.5C23,14.17 18.33,13 16,13M8,13C5.67,13 1,14.17 1,16.5V19H15V16.5C15,14.17 10.33,13 8,13M8,11A3,3 0 0,0 11,8A3,3 0 0,0 8,5A3,3 0 0,0 5,8A3,3 0 0,0 8,11M16,11A3,3 0 0,0 19,8A3,3 0 0,0 16,5A3,3 0 0,0 13,8A3,3 0 0,0 16,11Z" /></svg>
			<svg class="pointer group_chat_tab_<?php echo $wo['chat']['group']['group_id'];?>" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" onclick="Wo_CloseChat(<?php echo $wo['chat']['group']['group_id'];?>,'group')"><path fill="currentColor" d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>
		</div>
	</div>

	<div class="chat-tab-container group-tab-container-<?php echo $wo['chat']['group']['group_id'];?> chat-tab-box-<?php echo $wo['chat']['group']['group_id'];?>">
		<div class="chat-messages-wrapper group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>">
			<div class="chat-messages">
				<?php if (count($wo['chat']['group']['messages']) > 0): ?>
					<?php foreach ($wo['chat']['group']['messages'] as $wo['chatMessage']): ?>
						<?php echo Wo_LoadPage('chat/group-chat-list'); ?>
					<?php endforeach; ?>
				<?php else: ?>
					<div class="empty_state" id="no_messages_<?php echo $wo['chat']['group']['group_id'];?>"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M17,11H15V9H17M13,11H11V9H13M9,11H7V9H9M20,2H4A2,2 0 0,0 2,4V22L6,18H20A2,2 0 0,0 22,16V4C22,2.89 21.1,2 20,2Z" /></svg> <?php echo $wo['lang']['no_messages']; ?></div>
				<?php endif; ?>
			</div>
			<div class="clear"></div>
		</div>
		<div class="chat-textarea btn-group">
			<form action="#" id="hren" class="group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>">
				<textarea name="textSendMessage" id="sendMessage" class="form-control" cols="10" rows="5" placeholder="<?php echo $wo['lang']['type_message'];?>"  onkeydown="Wo_SubmitChatGroupForm(event, <?php echo $wo['chat']['group']['group_id'];?>);" dir="auto" ></textarea>
				<div class="w-10 chat-btns-w">
					<div>
						<span class="btn btn-file chat_optns" id="progressIcon">
							<?php if($wo['config']['fileSharing'] == 1) { ?>
								<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"> <g> <g> <path fill="#a84849" d="M436,60h-15V45c0-24.813-20.187-45-45-45H76C51.187,0,31,20.187,31,45v362c0,24.813,20.187,45,45,45h15v15 c0,24.813,20.187,45,45,45h300c24.813,0,45-20.187,45-45V105C481,80.187,460.813,60,436,60z M104.18,115.607 C95.68,124.106,91,135.406,91,147.426V422H76c-8.271,0-15-6.729-15-15V45c0-8.271,6.729-15,15-15h300c8.271,0,15,6.729,15,15v15 H178.426c-12.02,0-23.32,4.681-31.819,13.18L104.18,115.607z M181,90v60h-60v-2.574c0-4.006,1.56-7.773,4.393-10.606 l42.427-42.427c2.833-2.833,6.6-4.393,10.606-4.393H181z M451,467c0,8.271-6.729,15-15,15H136c-8.271,0-15-6.729-15-15V180h75 c8.284,0,15-6.716,15-15V90h225c8.271,0,15,6.729,15,15V467z"/> </g> </g> <g> <g> <path fill="#a84849" d="M406,212H166c-8.284,0-15,6.716-15,15s6.716,15,15,15h240c8.284,0,15-6.716,15-15S414.284,212,406,212z"/> </g> </g> <g> <g> <path fill="#a84849" d="M406,272H166c-8.284,0-15,6.716-15,15s6.716,15,15,15h240c8.284,0,15-6.716,15-15S414.284,272,406,272z"/> </g> </g> <g> <g> <path fill="#a84849" d="M406,332H166c-8.284,0-15,6.716-15,15s6.716,15,15,15h240c8.284,0,15-6.716,15-15S414.284,332,406,332z"/> </g> </g> <g> <g> <path fill="#a84849" d="M406,392H166c-8.284,0-15,6.716-15,15s6.716,15,15,15h240c8.284,0,15-6.716,15-15S414.284,392,406,392z"/> </g> </g></svg>
								<input type="file" id="sendMessasgeFile" name="sendMessageFile" class="pointer" onchange="Wo_SubmitChatGroupForm(event,<?php echo $wo['chat']['group']['group_id'];?>)" />
							<?php } else { ?>
								<svg height="512pt" viewBox="0 -4 512 512" width="512pt" xmlns="http://www.w3.org/2000/svg"><path fill="#a84849" d="m497 0h-359.773438c-8.285156 0-15 6.714844-15 15v48.210938h-48.511718c-8.285156 0-15 6.714843-15 15v48.207031h-43.714844c-8.285156 0-15 6.714843-15 15v347.898437c0 8.285156 6.714844 15 15 15h359.773438c8.285156 0 15-6.714844 15-15v-48.210937h43.714843c8.285157 0 15-6.714844 15-15v-48.207031h48.511719c8.285156 0 15-6.714844 15-15v-347.898438c0-8.285156-6.714844-15-15-15zm-344.773438 30h329.773438v220.824219l-134.871094-116.648438c-3.160156-2.734375-7.320312-4.027343-11.472656-3.5625-4.148438.460938-7.921875 2.632813-10.40625 5.996094l-156.078125 211.289063h-16.945313zm207.546876 444.316406h-329.773438v-317.898437h28.714844v269.6875c0 8.285156 6.714844 15 15 15h286.058594zm58.714843-63.210937h-329.773437v-317.894531h33.511718v269.6875c0 8.285156 6.714844 15 15 15h281.261719zm-212.019531-63.207031 133.289062-180.4375 142.242188 123.027343v57.410157zm0 0"></path><path fill="#a84849" d="m233.203125 160.519531c29.398437 0 53.316406-23.835937 53.316406-53.132812 0-29.300781-23.917969-53.136719-53.316406-53.136719s-53.316406 23.835938-53.316406 53.136719c0 29.296875 23.917969 53.132812 53.316406 53.132812zm0-76.269531c12.859375 0 23.316406 10.378906 23.316406 23.136719 0 12.753906-10.457031 23.132812-23.316406 23.132812-12.855469 0-23.316406-10.378906-23.316406-23.132812 0-12.757813 10.460937-23.136719 23.316406-23.136719zm0 0"></path></svg>
								<input type="file" id="sendMessasgeFile" name="sendMessageFile" onchange="Wo_SubmitChatGroupForm(event,<?php echo $wo['chat']['group']['group_id'];?>);" accept="image/x-png, image/gif, image/jpeg" />
							<?php } ?>
						</span>
					</div>
					<div>
						<span class="dropup chat_optns chat_optns">
							<span class="emo-btn-<?php echo $wo['chat']['group']['group_id'];?> dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
								<span class="btn btn-file">
									<svg enable-background="new 0 0 512.002 512.002" height="512" viewBox="0 0 512.002 512.002" width="512" xmlns="http://www.w3.org/2000/svg"><g><path d="m226 512.002c124.065 0 225-101.383 225-226 0-124.351-100.633-225-225-225-124.617 0-226 100.935-226 225 0 124.38 101.632 226 226 226zm0-421c107.523 0 195 87.477 195 195 0 108.075-87.477 196-195 196-108.075 0-196-87.925-196-196 0-107.523 87.925-195 196-195z" fill="#a84849"></path><path d="m226 421.002c74.338 0 135-60.458 135-135 0-8.284-6.716-15-15-15h-240c-8.284 0-15 6.716-15 15 0 74.576 60.693 135 135 135zm-48.754-42.027c13.44-11.558 30.527-17.973 48.754-17.973s35.314 6.415 48.754 17.973c-14.578 7.676-31.166 12.027-48.754 12.027s-34.176-4.351-48.754-12.027zm152.686-77.973c-3.35 23.321-14.397 44.188-30.47 59.945-19.497-19.19-45.524-29.945-73.461-29.945s-53.965 10.755-73.461 29.945c-16.073-15.758-27.12-36.625-30.47-59.945z" fill="#a84849"></path><path d="m383.807 59.594 6.991-42.137c1.356-8.173-4.17-15.897-12.343-17.253-8.172-1.354-15.896 4.17-17.253 12.343l-6.991 42.137c-1.356 8.173 4.17 15.897 12.343 17.253 8.188 1.356 15.899-4.183 17.253-12.343z" fill="#a84849"></path><path d="m440.065 145.448c1.353 8.155 9.061 13.7 17.253 12.343l42.137-6.991c8.172-1.356 13.699-9.08 12.343-17.253-1.356-8.172-9.08-13.698-17.253-12.343l-42.137 6.991c-8.173 1.356-13.699 9.08-12.343 17.253z" fill="#a84849"></path><path d="m448.63 42.16-42.409 42.409c-5.858 5.857-5.858 15.355 0 21.213s15.354 5.859 21.213 0l42.409-42.409c5.858-5.857 5.858-15.355 0-21.213s-15.355-5.859-21.213 0z" fill="#a84849"></path><path d="m121 226.002c8.284 0 15-6.716 15-15 0-8.271 6.729-15 15-15s15 6.729 15 15c0 8.284 6.716 15 15 15s15-6.716 15-15c0-24.813-20.187-45-45-45s-45 20.187-45 45c0 8.284 6.716 15 15 15z" fill="#a84849"></path><path d="m271 226.002c8.284 0 15-6.716 15-15 0-8.271 6.729-15 15-15s15 6.729 15 15c0 8.284 6.716 15 15 15s15-6.716 15-15c0-24.813-20.187-45-45-45s-45 20.187-45 45c0 8.284 6.716 15 15 15z" fill="#a84849"></path></g></svg>
								</span>
							</span>
							<ul class="emo-container dropdown-menu emo-group-container-<?php echo $wo['chat']['group']['group_id'];?>" role="menu">
								<?php  
									foreach ($wo['emo'] as $code => $name) {
										$code   = $code;
										echo  '<span onclick="Wo_AddEmoToGroup(\'' . $code . '\', ' . $wo['chat']['group']['group_id'] . ');"><i class="pointer twa-lg twa twa-' . $name . '"></i></span>'; 
									} 
								?>
							</ul>
						</span>
						<div class="ball-pulse"><div></div><div></div><div></div></div>
					</div>
				</div>
			</form>
		</div>
	</div>
</div>

<script type="text/javascript">
  jQuery(document).ready(function($) {
    $('[data-toggle="tooltip"]').tooltip(); 
    var main_hash_id = $('.main_session').val();
    $('.emo-btn-<?php echo $wo['chat']['group']['group_id'];?>').click(function () {
        $('.emo-group-container-<?php echo $wo['chat']['group']['group_id'];?>').toggle();
    });
    <?php if ($wo['config']['node_socket_flow'] == "1") { ?>
    $('.group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>').scroll(
      ()=>{
        var st = $('.group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>').scrollTop();  
        if(st==0) {
          socket.emit("loadmore_group", {from_id: _getCookie("user_id"), group_id: '<?php echo $wo['chat']['group']['group_id'];?>', before_message_id: $(".chat-messages").find(".messages-wrapper").attr("id").substr("messageId_".length)}, (data)=>{
            var chat_messages_wrapper = $('.group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>');
            chat_messages_wrapper.find(".chat-messages").prepend(data.html); 
          })
        }
      })
    <?php } ?>
    $(".clear_group_chat_<?php echo $wo['chat']['group']['group_id'];?>").click(function(event) {
      event.stopPropagation();
      $.ajax({
        url: Wo_Ajax_Requests_File(),
        type: 'GET',
        dataType: 'json',
        data: {f: 'chat',s:'clear_group_chat',id:'<?php echo $wo['chat']['group']['group_id'];?>'},
      })
      .done(function(data) {
        if (data.status == 200) {
          $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").empty();
        }
      })
      .fail(function() {
        console.log("error");
    });
    });

    console.log("Group chat "+'<?php echo $wo['chat']['group']['group_id'];?>')
   <?php if ($wo['config']['node_socket_flow'] == "1") { ?>
    var chat_messages_wrapper = $('.group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>');
      $('.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').submit(function(e) { 
        e.preventDefault();
        var text_message = escapeHTML($('.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?> #sendMessage').val());
        socket.emit("group_message", {
          group_id: '<?php echo $wo['chat']['group']['group_id'];?>', 
          from_id: _getCookie("user_id"),
          username: '<?php echo $wo['user']['username']; ?>',
          msg: text_message,
          isSticker: false
        },  (data)=>{
          if (data.status == 200) {

            if ($('#no_messages_<?php echo $wo['chat']['group']['group_id'];?>').length > 0) {
              $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").find('.chat-messages').html(data.html);
            }
            else{
              $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").find('.chat-messages').append(data.html);
            }
            if (data.invalid_file == 1) {
                $("#invalid_file").modal('show');
                Wo_Delay(function(){
                  $("#invalid_file").modal('hide');
                },3000);
                
            }
            if (data.invalid_file == 2) {
                $("#file_not_supported").modal('show');
                Wo_Delay(function(){
                  $("#file_not_supported").modal('hide');
                },3000);
            }
            if (data.file == true) {
              $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
            }
            
          }
          else if(data.status == 500 && data.invalid_file == 1){
            $("#invalid_file").modal('show');
                Wo_Delay(function(){
                  $("#invalid_file").modal('hide');
            },3000);
            $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
          }
          else if(data.status == 500 && data.invalid_file == 2){
            $("#file_not_supported").modal('show');
                Wo_Delay(function(){
                  $("#file_not_supported").modal('hide');
            },3000);
            $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
          }
          else if(data.status == 500 && data.invalid_file == 3){
            $("#pro_upload_file").modal('show');
            Wo_Delay(function(){
              $("#pro_upload_file").modal('hide');
            },3000);
            $('form.chat-sending-form-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
          }
          $(".chat_group_<?php echo $wo['chat']['group']['group_id'];?>").find('#sendMessasgeFile').val('');
          $(".chat_group_<?php echo $wo['chat']['group']['group_id'];?>").find('textarea').val('');
          setTimeout(function() {
                chat_messages_wrapper.scrollTop(chat_messages_wrapper[0].scrollHeight);
          }, 100);
        });
        return false
      });
    <?php } ?>

    <?php if ($wo['config']['node_socket_flow'] == "0"){?>
      var chat_messages_wrapper = $('.group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>');
      chat_messages_wrapper.scrollTop(chat_messages_wrapper[0].scrollHeight);
      $('.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').ajaxForm({
          url: Wo_Ajax_Requests_File() + '?f=chat&s=send_message&group_id=<?php echo $wo['chat']['group']['group_id'];?>&hash=' + main_hash_id,
          type:"POST",
          uploadProgress: function() {
        $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeIn(100);
          },
          success: function(data) {
              if (data.status == 200) {

                if ($('#no_messages_<?php echo $wo['chat']['group']['group_id'];?>').length > 0) {
                  $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").find('.chat-messages').html(data.html);
                }
                else{
                  $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").find('.chat-messages').append(data.html);
                }
                if (data.invalid_file == 1) {
                    $("#invalid_file").modal('show');
                    Wo_Delay(function(){
                      $("#invalid_file").modal('hide');
                    },3000);
                    
                }
                if (data.invalid_file == 2) {
                    $("#file_not_supported").modal('show');
                    Wo_Delay(function(){
                      $("#file_not_supported").modal('hide');
                    },3000);
                }
                if (data.file == true) {
                  $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
                }
                
              }
              else if(data.status == 500 && data.invalid_file == 1){
                $("#invalid_file").modal('show');
                    Wo_Delay(function(){
                      $("#invalid_file").modal('hide');
                },3000);
                $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
              }
              else if(data.status == 500 && data.invalid_file == 2){
                $("#file_not_supported").modal('show');
                    Wo_Delay(function(){
                      $("#file_not_supported").modal('hide');
                },3000);
                $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
              }
              else if(data.status == 500 && data.invalid_file == 3){
                $("#pro_upload_file").modal('show');
                Wo_Delay(function(){
                  $("#pro_upload_file").modal('hide');
                },3000);
                $('form.chat-sending-form-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
              }
              $(".chat_group_<?php echo $wo['chat']['group']['group_id'];?>").find('#sendMessasgeFile').val('');
              $(".chat_group_<?php echo $wo['chat']['group']['group_id'];?>").find('textarea').val('');
              setTimeout(function() {
                    chat_messages_wrapper.scrollTop(chat_messages_wrapper[0].scrollHeight);
              }, 100);

          }

      });

      setInterval(function(){
        var last_group_message = ($("[data-group-tmessage-id]").length > 0) ? $("[data-group-tmessage-id]").last().attr('data-group-tmessage-id') : 0;
        $.ajax({
          url: Wo_Ajax_Requests_File(),
          type: 'GET',
          dataType: 'json',
          data: {f: 'chat',s:'get_new_group_messages',message_id:last_group_message,group_id:'<?php echo $wo['chat']['group']['group_id'];?>'},
        })
        .done(function(data) {
          if (data.status == 200) {
            if ($(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").find('.no_message').length > 0) {
              $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").find('.chat-messages').html(data.html);
            }else{
              $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").find('.chat-messages').append(data.html);
            }
            
            chat_messages_wrapper.scrollTop(chat_messages_wrapper[0].scrollHeight);
          }
        })
        .fail(function() {
          console.log("error");
        })
      },5000);
      <?php } ?>

  });

  function Wo_SubmitChatGroupForm(e, id) {
    <?php 
    if ($wo['config']['node_socket_flow'] == "1"){ 
      ?>
      if ($("#sendMessasgeFile").val() != '') {
        e.preventDefault();
        var chat_messages_wrapper = $('.group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>');
        chat_messages_wrapper.scrollTop(chat_messages_wrapper[0].scrollHeight);
        var main_hash_id = $('.main_session').val();

        $('.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').ajaxSubmit({
            url: Wo_Ajax_Requests_File() + '?f=chat&s=send_message&group_id=<?php echo $wo['chat']['group']['group_id'];?>&hash=' + main_hash_id,
            type:"POST",
            uploadProgress: function() {
              $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeIn(100);
            },
            success: function(data) {
                if (data.status == 200) {

                  if ($('#no_messages_<?php echo $wo['chat']['group']['group_id'];?>').length > 0) {
                    $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").find('.chat-messages').html(data.html);
                  }
                  else {
                    $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>").find('.chat-messages').append(data.html);
                  }
                  var dom = $($.parseHTML(data.html));
                  var mediaId = dom.attr("data-group-tmessage-id");
                  
                  console.log("Group media id to be found here")
                  if (data.invalid_file == 1) {
                      $("#invalid_file").modal('show');
                      Wo_Delay(function(){
                        $("#invalid_file").modal('hide');
                      },3000);
                  }
                  else if (data.invalid_file == 2) {
                      $("#file_not_supported").modal('show');
                      Wo_Delay(function(){
                        $("#file_not_supported").modal('hide');
                      },3000);
                  }
                  else {
                    socket.emit("group_message", {
                      group_id: '<?php echo $wo['chat']['group']['group_id'];?>', 
                      from_id: _getCookie("user_id"),
                      username: '<?php echo $wo['user']['username']; ?>',
                      mediaId: mediaId,
                      isSticker: false
                    })
                  }

                  if (data.file == true) {
                    $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
                  }
                } 
              
                else if(data.status == 500 && data.invalid_file == 1){
                  $("#invalid_file").modal('show');
                      Wo_Delay(function(){
                        $("#invalid_file").modal('hide');
                  },3000);
                  $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
                }
                else if(data.status == 500 && data.invalid_file == 2){
                  $("#file_not_supported").modal('show');
                      Wo_Delay(function(){
                        $("#file_not_supported").modal('hide');
                  },3000);
                  $('form.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
                }
                else if(data.status == 500 && data.invalid_file == 3){
                  $("#pro_upload_file").modal('show');
                  Wo_Delay(function(){
                    $("#pro_upload_file").modal('hide');
                  },3000);
                  $('form.chat-sending-form-<?php echo $wo['chat']['group']['group_id'];?>').find('.ball-pulse').fadeOut(100);
                }
                $(".chat_group_<?php echo $wo['chat']['group']['group_id'];?>").find('#sendMessasgeFile').val('');
                $(".chat_group_<?php echo $wo['chat']['group']['group_id'];?>").find('textarea').val('');
                setTimeout(function() {
                      chat_messages_wrapper.scrollTop(chat_messages_wrapper[0].scrollHeight);
                }, 100);
          }
        });
       }
       else if (e.keyCode == 13 && e.shiftKey == 0 || $("#sendMessasgeFile").val() != '') {
          e.preventDefault();
          if(!groupChatListener["<?php echo $wo['chat']['group']['group_id'];?>"]){
          console.log("Listening to group messages")
          groupChatListener["<?php echo $wo['chat']['group']['group_id'];?>"] = 1;
      }
     
      var chat_messages_wrapper = $('.group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>');
      chat_messages_wrapper.scrollTop(chat_messages_wrapper[0].scrollHeight);
       
       $('.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').submit()
          // $('.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').submit();
       }
       <?php } else { ?>
    document.title = document_title;
    chat_tab_container = $('.chat_main_' + id);
    if (e.keyCode == 13 && e.shiftKey == 0 || $("#sendMessasgeFile").val() != '') {
        e.preventDefault();
        $('.group-chat-sending-<?php echo $wo['chat']['group']['group_id'];?>').submit();
    }
  <?php } ?>
  }

 function Wo_ClearGroupHistory(id = false){
    if (!id) { return false;}
    $.ajax({
      url: Wo_Ajax_Requests_File(),
      type: 'GET',
      dataType: 'json',
      data: {f: 'chat',s:'clear_group_chat',group_id:'<?php echo $wo['chat']['group']['group_id'];?>'},
    })
    .done(function(data) {
      if (data.status == 200) {
        $(".group-messages-wrapper-<?php echo $wo['chat']['group']['group_id'];?>")
        .find('.chat-messages')
        .html(
          '\
            <p class="no_message" id="no_messages_<?php echo $wo['chat']['group']['group_id'];?>">\
            <?php echo $wo['lang']['conversation_deleted']; ?>\
            </p>'
          );
      }
    })
    .fail(function() {
      console.log("error");
    })
  }
  function Wo_DeleteGroupChat(id = false){
    if (!id) {return false}
    $.ajax({
      url: Wo_Ajax_Requests_File(),
      type: 'GET',
      dataType: 'json',
      data: {f: 'chat',s:'delete_group_chat',group_id:'<?php echo $wo['chat']['group']['group_id'];?>'},
    })
   .done(function(data) {
      if (data.status == 200) {
        $('.chat_main_0').toggle(100,function(){
          $(this).remove();
          $("#group_tab_<?php echo $wo['chat']['group']['group_id'];?>").slideUp(function(){
            $(this).remove();
          })
        });
      }
    })
    .fail(function() {
      console.log("error");
    })
  }
  function Wo_ExitGroupChat(id = false){
    if (!id) {return false}
    $.ajax({
      url: Wo_Ajax_Requests_File(),
      type: 'GET',
      dataType: 'json',
      data: {f: 'chat',s:'exit_group_chat',group_id:'<?php echo $wo['chat']['group']['group_id'];?>'},
    })
   .done(function(data) {
      if (data.status == 200) {
        $('.chat_main_0').toggle(100,function(){
          $(this).remove();
          $("#group_tab_<?php echo $wo['chat']['group']['group_id'];?>").slideUp(function(){
            $(this).remove();
          })
        });
      }
    })
    .fail(function() {
      console.log("error");
    })
  }

  function Wo_ManageGChat(){
    $.ajax({
      url: Wo_Ajax_Requests_File(),
      type: 'GET',
      dataType: 'json',
      data: {f: 'chat',s:'group_parts',group_id:'<?php echo $wo['chat']['group']['group_id'];?>'},
    })
    .done(function(data) {
      if (data.status == 200) {
        $('#manage_group_chat').find('.modal-body').html(data.parts);
        $('#manage_group_chat').find('#group_chat_mbrs').html(data.count);
        $('#manage_group_chat').modal('show');
      }
    })
    .fail(function() {
      console.log("error");
    })
  }
  function escapeHTML(string) {
    var pre = document.createElement('pre');
    var text = document.createTextNode( string );
    pre.appendChild(text);
    return pre.innerHTML;
}
</script>