<?php 
    //die(); 
    /*$this->load->model("telegram_model");
    $repl_video_fid = "BAACAgQAAx0CRNx-zwABCZmuZ0GB_MwKlvZSEbhuVAY_PTinMsoAAv0VAALEDvhRY3WTWQ-MNgQ2BA";
    $get_file = $this->telegram_model->get_file($token,$repl_video_fid);
    print_r($get_file);
    die();
    $get_file = json_decode($get_file, true);
    $url1 = "https://api.telegram.org/file/bot".$token."/".$get_file["result"]["file_path"];*/
    $this->load->view("main/bot_users/header"); 
?>

			  <style>
				.add_pationt{
	   width: 100%;
	   height: 100%;
	   position: fixed;
	   top: 0;
	   left: 0;
	   z-index: 3000;
	   background: rgba(0,0,0,0.5);
}
.send_message{
   width: 100%;
	   height: 100%;
	   position: fixed;
	   top: 0;
	   left: 0;
	   z-index: 3000;
	   background: rgba(0,0,0,0.5);
}
label{
  width: 100px;
  display: block;
  text-align: right;
  float: right;
}
.row{
  margin-bottom:10px;
}
textarea{
  resize: none;
  height: 100px !important;
}
.more-info{
  margin-bottom:30px;
  float: right;
  padding: 0px;
}
.more-info .main{
 
  height: 200px;
 cursor: pointer;
  border-radius: 2px;
  color: #fff;
}
.blue{
  background: rgb(0,159,227);
}
.green{
  background: rgb(156,226,67);
}
.yellow{
  background: rgb(248,211,71);
}
.purple{
background:rgb(200,107,248);
}
.more-info .main .title{
  display: block;
  font-size:18px;
  line-height: 42px;
}
.more-info .main .icon{
  font-size: 110px;
  margin-right:10px;
}
.number{
  font-size:100px;
  font-family: digital;
  margin-right:7%;
}
#slider img{
  width: 100%;
  height: 300px;
  margin-bottom:40px;
}
.personal-task{
  height: auto !important;
}
			  </style>

      
              <!--state overview end-->

              	<div class="send_message" style="display: none;">
	   <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">فرستادن پیغام</h4>
                                            </div>
                                            <div class="modal-body">

                                               
												 <input type="hidden" id="tellid" name="path" value="" />
												
												 
												
										  
										   <div id="piture" >
                                                    <div class="form-group">
                                                        <div class="col-lg-12 row"><label for="exampleInputFile">نام:</label><span class="nameho"></span></div>
														<div class="col-lg-12 row"><label for="exampleInputFile">شماره تماس:</label><span class="phoneho"></span></div>
														<div class="col-lg-12 row"><label for="exampleInputFile">متن پیغام:</label><p class="textho"></p></div>
                                                         <div class="col-lg-12 row"><textarea class="form-control message"></textarea></div>
                                                    </div>
                                            </div>       
                                                    <button type="submit" class="btn btn-default">فرستادن پیغام</button>
                                                
                                            </div>
                                        </div>
										<div class="alert alert-success fade in succmessage" style="margin-top:20px;display: block;">
                                    
                                     پیام شما با موفقیت ارسال شد.
                             
                                </div>
                                    </div>
</div>
				<div class="col-lg-12">
				  
				</div>
				<div id="slider" class="col-lg-12">
				  <img src="<?php echo base_url(); ?>assets/main/img/slider_011.jpg">
				</div>
				<div class="col-lg-12 more-info">
				  <div class="col-lg-3">
					<div class="main col-lg-12 purple">
					  <span class="title col-lg-12">پیام های ارسالی</span>
					  <span class="icon" style="color: rgb(144,93,192)"><i class="icon-upload-alt"></i></span>
					  <span class="number">29</span>
					</div>
				  </div>
				  <div class="col-lg-3">
					<div class="main col-lg-12 yellow">
					  <span class="title col-lg-12">پیام های دریافتی</span>
					  <span class="icon" style="color: rgb(214,169,8)"><i class="icon-download-alt"></i></span>
					  <span class="number">29</span>
					</div>
				  </div>
				  <div class="col-lg-3">
					<div class="main col-lg-12 green">
					  <span class="title col-lg-12">تعداد اعضای ربات</span>
					  <span class="icon" style="color: rgb(100,170,11)"><i class="icon-user"></i></span>
					  <span class="number">29</span>
					</div>
				  </div>
				  <div class="col-lg-3">
					<div class="main col-lg-12 blue">
					  <span class="title col-lg-12">نظر سنجی</span>
					  <span class="icon" style="color: rgb(0,96,138)"><i class="icon-thumbs-up"></i></span>
					  <span class="number">29</span>
					</div>
				  </div>
				</div>
				
												  <div class="col-lg-8">
                      <!--custom chart start-->
                      <div class="border-head">
                          <h3>تعداد کاربرانی که از ربات استفاده کرده اند</h3>
                      </div>
                      <div class="custom-bar-chart">
                          <div class="bar">
                              <div class="title">فروردین</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[0]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[0]; ?></div>
                          </div>
                          <div class="bar doted">
                              <div class="title">اردیبهشت</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[1]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[1]; ?></div>
                          </div>
                          <div class="bar ">
                              <div class="title">خرداد</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[2]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[2]; ?></div>
                          </div>
                          <div class="bar doted">
                              <div class="title">تیر</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[3]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[3]; ?></div>
                          </div>
                          <div class="bar">
                              <div class="title">مرداد</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[4]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[4]; ?></div>
                          </div>
                          <div class="bar doted">
                              <div class="title">شهریور</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[5]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[5]; ?></div>
                          </div>
                          <div class="bar">
                              <div class="title">مهر</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[6]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[6]; ?></div>
                          </div>
                          <div class="bar doted">
                              <div class="title">آبان</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[7]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[7]; ?></div>
                          </div>
                          <div class="bar ">
                              <div class="title">آذر</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[8]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[8]; ?></div>
                          </div>
                          <div class="bar doted">
                              <div class="title">دی</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[9]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[9]; ?></div>
                          </div>
                          <div class="bar ">
                              <div class="title">بهمن</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[10]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[10]; ?></div>
                          </div>
                          <div class="bar doted">
                              <div class="title">اسفند</div>
                              <div class="value tooltips" data-original-title="<?php echo $visitperson[11]; ?>" data-toggle="tooltip" data-placement="top"><?php echo $visitperson[11]; ?></div>
                          </div>
                      </div>
              </div>
												  <div class="col-lg-4">
			  <?php $this->load->view("plugins/jalali_calender"); ?>
			  </div>
             
				                    <div class="col-lg-8">
                      <!--user info table start-->
                      <section class="panel">
                          <div class="panel-body">
                              <div class="task-thumb-details">
                                  <h1><a href="#">لیست پیام ها</a></h1>
                                  <p><?php echo $fullname; ?></p>
                              </div>
                          </div>
                          <table class="table table-hover personal-task">
                              <tbody>
								<?php foreach($message as $value){ ?>
                                <tr class="send" data_tell_id="<?php echo $value->tellid ?>">
                                    <td>
                                        <i class="icon-mail-reply "></i>
                                    </td>
                                    <td class="name"><?php echo $value->fullname; ?></td>
                                    <td class="phone"><?php echo $value->phone; ?></td>
									<td class="message"><?php echo  mb_substr($value->message, 0, 25, mb_detect_encoding($value->message)); ?>...</td>
									<input type="hidden" class="full_text" value="<?php echo $value->message; ?>">
									
                                </tr>
								<?php } ?>
                              
                              </tbody>
                          </table>
                      </section>
                      <!--user info table end-->
                  </div>
									  
	
             
			  <!-- for calculator -->
			  
			
			  <div class="col-lg-4" style="float: left;">
				<div class="clock">
				  <b class="ho">22</b><b>:</b><b class="min">22</b><b>:</b><b class="sec">22</b>
				</div>
				</div>
			  <!--end calculator -->
             

          </section>
      <?php $this->load->view("main/bot_users/footer"); ?>
	  
	  <script>
		$(".close").click(function(){
			  $(".send_message").css({"display":"none"});
			  });
		$(".send").click(function(){
		  $("#tellid").val($(this).attr("data_tell_id"));
		  $(".nameho").text($(this).find(".name").text());
		  $(".phoneho").text($(this).find(".phone").text());
		  $(".textho").text($(this).find(".full_text").val());
		   $(".send_message").css({"display":"block"});
		  });
		$(".btn-default").click(function(){
		  $.post("<?php echo base_url(); ?>botuser/sendmessage",{tellid:$("#tellid").val(),message:$(".message").val()},function(e){
			if (e == "done") {
			$(".message").val("");
			$(".succmessage").css({"display":"block"});
			}
			
			});
		  });
		$(document).ready(function(){
		 
		  $(".calendar table thead tr").eq(0).find("td").attr({"colspan":"9"});
		  });
	  </script>
