<?php $__env->startSection('content'); ?>
<style>
label.error{
	color:red;
}
</style>
<style>
/** mixins **/
/** mixins end **/
html {
  box-sizing: border-box;
  height: 100%;
}
.user i:before {
    display: inline-block;
    font: normal normal normal 14px/1 FontAwesome;
    font-size: inherit;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    content: "\f2c0";
}
*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  font-family: "Roboto", sans-serif;
  
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  height: 839px;
  padding: 20px 0;
}

.page {
  width: 100%;
  height: 100%;
}

.phone {
  width: 100%;
  height: 100%;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: auto 800px;
}

.chat-root {
  height: 100%;
}

.wa-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  position: relative;
}
.sent-btttn {
    position: relative;
    display: table;
    margin: 0px auto;
    background: #14a852 !important;
    font-family: roboto,sans-serif;
    color: #fff;
}

.sent-btttn i {
    margin-top: 16px;
  }
.wa-container .status-bar {
  height: 25px;
  background: #054d44;
  color: #fff;
  font-size: 14px;
  padding: 0 8px;
}
.wa-container .status-bar:after {
  content: "";
  display: table;
  clear: both;
}
.wa-container .status-bar div {
  float: right;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  margin: 0 0 0 8px;
}
.wa-container .user-bar {
  height: 55px;
  background: #14a852;
  color: #fff;
  padding: 0 8px;
  font-size: 24px;
}
.wa-container .user-bar:after {
  content: "";
  display: table;
  clear: both;
}
.wa-container .user-bar div {
  float: left;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}
.wa-container .user-bar div.actions {
  float: right;
  margin: 0 0 0 20px;
}
.wa-container .user-bar div.actions.more {
  margin: 0 12px 0 20px;
}
.wa-container .user-bar div.actions.attachment i {
  display: block;
  transform: rotate(-45deg);
}
.wa-container .user-bar .user {
  margin: 0 0 0 8px;
  width: 36px;
  height: 36px;
}
.wa-container .user-bar .user img {
  border-radius: 50%;
  display: block;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1);
  width: 100%;
}
.wa-container .user-bar .user-name {
  font-size: 16px;
  margin: 0 0 0 8px;
  width: 165px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-container .user-bar .user-name span {
  display: block;
  font-size: 12px;
}
.wa-container .bottom-bar {
  height: 47px;
  background: #000;
  color: #fff;
  font-size: 22px;
}
.wa-container .bottom-bar div {
  width: 33.333333%;
  float: left;
  text-align: center;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}
.wa-container .bottom-bar div.triangle i {
  display: block;
  transform: rotate(-90deg);
}
.wa-container .chat-window {
  height: calc(100% - 152px);
  position: relative;

  background-size: 100%;
  border: 1px solid #14a85275; 
  background: #14a8521f;
  box-shadow: inset 0 10px 10px -10px #000000;
}
.wa-container .chat-window:after {
  content: "";
  display: table;
  clear: both;
}
.wa-container .chat-window .conversation {
  width: 100%;
  overflow: auto;
  height: calc(100% - 68px);
  padding: 0 16px;
}
.wa-container .chat-window .conversation:after {
  content: "";
  display: table;
  clear: both;
}
.wa-container .chat-window .balloon {
  padding: 8px;
  position: relative;
  color: #000;
  font-size: 14px;
  line-height: 18px;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
  clear: both;
  margin: 8px 0;
  max-width: 85%;
}
.wa-container .chat-window .balloon:after {
  position: absolute;
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
}
.wa-container .chat-window .balloon .data {
  display: inline-block;
  padding: 0 20px 0 16px;
  font-size: 11px;
  color: #b9b9b9;
  position: relative;
  bottom: -5px;
  float: right;
  background-repeat: no-repeat;
  background-position: right 3px;
  background-color: transparent;
  background-size: 16px auto;
}
.sent-btttn {
    padding: 0px 30px;
	cursor: pointer;
}
.wa-container .chat-window .balloon .data.blue {
  background-image: url("http://wutsapp.net/images/dist/blue.png");
}
.wa-container .chat-window .balloon img {
  width: 100%;
}
.wa-container .chat-window .balloon:first-child {
  margin: 16px 0 8px;
}
.wa-container .chat-window .balloon.him {
  background: #fff;
  float: left;
  border-radius: 0px 5px 5px 5px;
}
.wa-container .chat-window .balloon.him .data {
  padding: 0 0 0 16px;
}
.wa-container .chat-window .balloon.him:after {
  top: 0;
  left: -10px;
  border-width: 0px 10px 10px 0;
  border-color: transparent #fff transparent transparent;
}
.wa-container .chat-window .balloon.you {
  background: #e1ffc7;
  float: right;
  border-radius: 5px 0px 5px 5px;
}
.wa-container .chat-window .balloon.you:after {
  top: 0;
  right: -10px;
  border-width: 0px 0 10px 10px;
  border-color: transparent transparent transparent #e1ffc7;
}
.wa-container .chat-window .textarea {
  width: 100%;
  z-index: 2;
  left: 0;
  position: absolute;
  bottom: 8px;
  height: 50px;
  padding: 0 0 0 8px;
}
.wa-container .chat-window .textarea:after {
  content: "";
  display: table;
  clear: both;
}
.wa-container .chat-window .textarea ::-webkit-input-placeholder {
  color: #b9b9b9;
}
.wa-container .chat-window .textarea ::-moz-placeholder {
  /* Firefox 19+ */
  color: #b9b9b9;
}
.wa-container .chat-window .textarea :-ms-input-placeholder {
  color: #b9b9b9;
}
.wa-container .chat-window .textarea div,
.wa-container .chat-window .textarea textarea {
  height: 100%;
  float: left;
  background: #fff;
}
.wa-container .chat-window .textarea .emoticons {
  width: 10%;
  background: url("http://valeriopierbattista.com/projects/wutsapp/images/dist/smile.png") center center no-repeat #fff;
  background-size: 20px;
  border-radius: 5px 0 0 5px;
}
.wa-container .chat-window .textarea textarea {
  width: 80%;
  border: 0;
  outline: none;
  padding-top: 14px;
  resize: none;
}
.wa-container .chat-window .textarea .photo {
  width: 10%;
  border-radius: 0 0 5px 0;
  position: relative;
  text-align: center;
}
.wa-container .chat-window .textarea .photo:after {
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  content: "";
  top: 0;
  right: -10px;
  border-width: 0px 0 10px 10px;
  border-color: transparent transparent transparent #fff;
}
.wa-container .chat-window .textarea .photo i {
  display: block;
  position: relative;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #7d8488;
  font-size: 24px;
}
.wa-container .chat-window .textarea .send-mic {
  width: 17%;
  background: transparent;
  position: relative;
  cursor: pointer;
}
.wa-container .chat-window .textarea .send-mic .circle-cont {
 color: #fff;
    border-radius: 50%;
    position: relative;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #14a852;
    width: 48px;
    height: 48px;
    box-shadow: 0 1px 0 #14a852;
}
.wa-container .chat-window .textarea .send-mic .circle-cont i {
  display: inline-block;
  position: relative;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
}

.wrapperchat {
  height: calc(100% - 81px);
}

.page.nexus6 .phone {
  /*background-image: url("http://valeriopierbattista.com/projects/wutsapp/images/dist/nexus6.png");*/
  background-size: auto 799px;
}
.page.nexus6 .wa-container {
  width: 700px;
  height: 681px;
  padding: 6px 0 0;
}
.page.nexus6 .wa-container .chat-window {
  height: calc(100% - 55px);
}
.page.nexus6 .wrapperchat {
  height: calc(100% - 69px);
}

.more {
  position: absolute;
  bottom: 30px;
  left: 10px;
}
.more a, .more a:visited {
  padding: 10px 20px;
  color: black;
  font-size: 24px;
  background: yellow;
}
</style>
<div class="common-content">
<div class="page-content">
<div class="page nexus6">
    <h5 class="box-head">Chat Message</h5>
  <div class="phone boxings chatmessage">
    <div class="wa-container">
      <!--<div class="status-bar">
        <div class="time">
          2:15 PM
        </div>
        <div class="battery">
          <i class="zmdi zmdi-battery"></i>
        </div>
        <div class="network">
          <i class="zmdi zmdi-network"></i>
        </div>
        <div class="wifi">
          <i class="zmdi zmdi-wifi-alt-2"></i>
        </div>
        <div class="star">
          <i class="zmdi zmdi-star"></i>
        </div>
      </div>-->
      <div class="wrapperchat">
        <div class="chat-root">
          <div class="user-bar">
            <!--<div class="back">
              <i class="zmdi zmdi-arrow-left"></i>
            </div>-->
            <!-- user info start -->
            <div class="user">
			
					<?php if(!empty($receiver->pro_pic)): ?>
                        <img src="<?php echo e(url('user_files')); ?>/<?php echo e($receiver->pro_pic); ?>">
                    <?php else: ?>
                       <img src="<?php echo e(url('assets/images/1200px-No-Image-Placeholder.svg.png')); ?>">
                    <?php endif; ?>
			
			
			
			
            </div>
            <div class="user-name">
              <b><?php echo e(ucfirst($receiver['name'])); ?></b>
            
            </div>
            <!-- user info end -->
            <!--<div class="actions more">
              <i class="zmdi zmdi-more-vert"></i>
            </div>
            <div class="actions attachment">
              <i class="zmdi zmdi-attachment-alt"></i>
            </div>
            <div class="actions">
              <i class="zmdi zmdi-phone"></i>
            </div>-->
          </div>
		  
          <div class="chat-window">
            <!-- conversation start -->
            <div class="conversation">
			  <?php $__currentLoopData = $messagelist; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $messagelist): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
							<?php
							$nw  			= App\Helpers\CustomHelper::timeAgo($messagelist->date);
							?>
			 <?php if(($messagelist->sender_id == Auth::user()->id)&&($messagelist->receiver_id ==$receiverid)): ?>
              <div class="balloon you">
				<?php echo e($messagelist->msg); ?>

                <span class="data"><?php echo e($nw); ?></span>
              </div>
			  <?php endif; ?>
			 <?php if(($messagelist->sender_id ==$receiverid)&&($messagelist->receiver_id ==Auth::user()->id)): ?>
              <div class="balloon him">
                <?php echo e($messagelist->msg); ?>

                <span class="data blue"><?php echo e($nw); ?></span>
              </div>
			 <?php endif; ?>
			 <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              
            </div>
         <input name="_token" type="hidden" id="token_buyer" value="<?php echo e(csrf_token()); ?>">
		 <input name="productid" type="hidden" id="productid" value="<?php echo e($product_id); ?>"> 
		 <input name="bidid" type="hidden" id="bidid" value="<?php echo e($bidid); ?>"> 
		 <input name="receiverid" type="hidden" id="receiverid" value="<?php echo e($receiverid); ?>"> 
		 
		 <!-- conversation end -->
		<form name="add_msg_bid" id="add_msg_bid" method="POST" action="#">
         
            <div class="textarea">
              <!--<div class="emoticons"></div>-->
              <input type="textbox" class="messagedetails" id="messagedetails" name="messagedetails" placeholder="&nbsp;Type a message">
              <!--<div class="photo">
                <i class="zmdi zmdi-camera"></i>
              </div>-->
              <div class="hj">
			  
			  <input type="submit" value="SEND" class="sendmessage">
              
              </div>
            </div>
	   </form>
          </div>
		  
        </div>
      </div>
	  
	  
	  
	  
      <!--<div class="bottom-bar">
        <div class="triangle">
          <i class="zmdi zmdi-triangle-up"></i>
        </div>
        <div>
          <i class="zmdi zmdi-circle-o"></i>
        </div>
        <div>
          <i class="zmdi zmdi-square-o"></i>
        </div>
      </div>-->
    </div> 
  </div><!-- chatmessage end -->
</div>

</div>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<script>
window.baseurl = 'https://www.meddbot.com/';
//Register New product


var timeInterval = 5000; //refresh interval in ms

setInterval(function () {
	var data = {
					_token	: $('#token_buyer').val(),
					product_id	:$("#productid").val(),
					bidid:$("#bidid").val(),
					to_id:$("#receiverid").val(),
				
				}
				$.ajax({
					url: baseurl + 'messagelist_bid',
					type: "POST",
					data: data,
					success: function (res) {
						var obj 			= jQuery.parseJSON(res);
						console.log(obj);
						$(".conversation").html('');
						$(".conversation").html(obj.view_chat);
						
					}
					
				});	

}, timeInterval);




$('#messagedetails').on("keypress", function(e) {
        if (e.keyCode == 13) {
            
			$("#add_msg_bid").validate({

        rules: {
            "messagedetails": {
                required: true
               
            }
        },
        submitHandler: function(form, e) {
			
			var data = {
					_token	: $('#token_buyer').val(),
					product_id	:$("#productid").val(),
					to_id:$("#receiverid").val(),
					msg:$("#messagedetails").val(),
					bidid:$("#bidid").val(),
					messagetype:'myquotes_message_sentvendor'
					
					
				}
				$.ajax({
					url: baseurl + 'add_msg',
					type: "POST",
					data: data,
					success: function (res) {
						if(res==1){
							//swal({
								//title: "",
								//text: "Successfully sent",
								//type: "success",
								//showCancelButton: false,
								//dangerMode: false,
								//confirmButtonText: 'OK',

							//});-->
							$('#messagedetails').val('').empty();
							location.reload();
							
							
						}
						
					}
					
				});	
          
        }
    });	
        }
});




 $("#add_msg_bid").validate({

        rules: {
            "messagedetails": {
                required: true
               
            }
        },
        submitHandler: function(form, e) {
			
			var data = {
					_token	: $('#token_buyer').val(),
					product_id	:$("#productid").val(),
					to_id:$("#receiverid").val(),
					msg:$("#messagedetails").val(),
					bidid:$("#bidid").val(),
					messagetype:'myquotes_message_sentvendor'
					
					
				}
				$.ajax({
					url: baseurl + 'add_msg',
					type: "POST",
					data: data,
					success: function (res) {
						if(res==1){
							//swal({
								//title: "",
								//text: "Successfully sent",
								//type: "success",
								//showCancelButton: false,
								//dangerMode: false,
								//confirmButtonText: 'OK',

							//});-->
							$('#messagedetails').val('').empty();
							location.reload();
							
							
						}
						
					}
					
				});	
          
        }
    });	
	




		function readmessage(id,url){
			
			var data = {
							_token	: $('.token_user').val(),
							id	:id
						}
						$.ajax({
							url: baseurl + 'msg_read',
							type: "POST",
							data: data,
							success: function (res) {
								
								window.location = baseurl+url;
								
							}
							
						});	
			
		}
	
	
	




$(document).ready( function () {
    $('#table_id').DataTable();
} );

<?php if(Session::has('message')): ?>
      swal({
        title: "",
        text: "<?php echo e(Session::get('message')); ?>",
        type: "success",
        showCancelButton: false,
        dangerMode: false,
        confirmButtonText: 'OK',

    });
<?php endif; ?>
<?php if(Session::has('errormessage')): ?>
      swal({
        title: "",
        text: "<?php echo e(Session::get('errormessage')); ?>",
        type: "error",
        showCancelButton: false,
        dangerMode: true,
        confirmButtonText: 'OK',

    });
<?php endif; ?>

</script>
<?php $__env->stopSection(); ?>


<?php echo $__env->make('layouts.main_assetmanage', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/meddbot/public_html/resources/views/vendors/message_bid.blade.php ENDPATH**/ ?>