<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 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"  width="24" height="24" viewBox="0 0 24 24"><path fill="#a84849" d="M14,17H7V15H14M17,13H7V11H17M17,9H7V7H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" /></svg>
								<input type="file" id="sendMessasgeFile" name="sendMessageFile" class="pointer" onchange="Wo_SubmitChatGroupForm(event,<?php echo $wo['chat']['group']['group_id'];?>)" />
							<?php } else { ?>
								<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"  width="24" height="24" viewBox="0 0 24 24"><path fill="#a84849" d="M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z" /></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" onclick="load_ajax_chat_group_emojii('<?php echo $wo['chat']['group']['group_id'];?>','<?php echo $wo['config']['theme_url'];?>/emoji/');">
								<span class="btn btn-file">
									<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"  width="24" height="24" viewBox="0 0 24 24"><path fill="#a84849" d="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M7,9.5C7,8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5M12,17.23C10.25,17.23 8.71,16.5 7.81,15.42L9.23,14C9.68,14.72 10.75,15.23 12,15.23C13.25,15.23 14.32,14.72 14.77,14L16.19,15.42C15.29,16.5 13.75,17.23 12,17.23M15.5,11C14.7,11 14,10.3 14,9.5C14,8.7 14.7,8 15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11Z" /></svg>
								</span>
							</span>
							<ul class="emo-container dropdown-menu emo-group-container-<?php echo $wo['chat']['group']['group_id'];?>" role="menu">

							</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>