<? global $vis_language;
if($operation['vis_operation']=='livezilla_detail'){?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
  <div class="col-sm-6">
    <h3 class="m-b-xs text-black"><? echo $vis_language['TXTCHATTRANSCRIPT'];?></h3>
    <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
      <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME'];?></a></li>
      <li><a class="link" href="#/chat/livezilla_chat/<? echo $vis_language['TXTLIVEZILLA'];?>"><? echo $vis_language['TXTLIVEZILLA'];?></a></li>
      <li><? echo $vis_language['TXTCHATTRANSCRIPT'];?></li>
    </ul>
  </div>
</section>
<section class="padder">
  <section class="panel panel-default">
    <div class="wrapper-sm">
    <!--<button type="button" class="btn btn-default btn-sm btn-block" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=new_ticket_step_one&vis_static_area=vis_open_new_dialog&vis_email_id='<? echo $chat_object->visitor->email; ?>'&vis_client=1&vis_domain_id=<? echo $vis_domain; ?>"><? echo $vis_language['TXTADDTICKET']; ?></button>-->
   
      <div class="btn-group">
        <div class="form-group">
          <h5><? echo $vis_language['TXTCHATTRANSCRIPT'];?></h5>
        </div>
      </div>
    <div class="line b-b line-lg pull-in"></div>
    </div>
    <div class="row m-t">
      <div class="col-md-6">
      <?php $start_time = format_datetime($chat_object->TimeStart); ?>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTDATE'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $start_time; ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTIPADDRESS'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->IP; ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right "><? echo $vis_language['TXTVISITORNAME'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo ucfirst($chat_object->Fullname); ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTVISITOREMAIL'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->Email; ?></div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTCOUNTRY'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->Country; ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTSTAFFNAME'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->OperatorId; ?></div>
        </div>
       <!-- <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? //echo 'End time';?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? //echo $chat_object->TimeEnd; ?></div>
        </div>-->
         <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo 'Group';?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->Group; ?></div>
        </div>
      </div>
    </div>
    <!--<div class="line b-b line-lg pull-in"></div>-->
      <div class="wrapper m-b-sm">
        <div class="clear">
          <form name="vis_selfhelp_article_form" id="vis_selfhelp_article_form" class="form-horizontal" method="post">
            <br/>
            <h5><? echo $vis_language['TXTCONVERSATIONS'];?></h5>
            <div class="line b-b line-lg pull-in"></div>
            <br/>
            <?php
			  $chat = explode('|',$chat_object->PlainText);
			  for($i=0;$i<count($chat);$i++)
			  {
				  if($i==0){$i++;}
				  echo '<div class="row m-b-sm">';
				  $chat_date = format_datetime(strtotime($chat[$i]));
				  echo '<div class="col-xs-2 text-right">['.$chat_date.']</div>';
				  $i++;
				  echo '<div class=" col-xs-10 text-lt text-muted">'.$chat[$i].'</div>
				        </div>';
			  }

		    ?>
          </form>
		  <div class="row m-b-sm">
		   <div class="col-xs-2 text-right"> </div>
		    <div class=" col-xs-10 text-lt text-muted">
		<a href="javascript:void(0);" class="btn btn-primary" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=new_ticket_step_one&vis_static_area=vis_open_new_dialog&vis_chat_type=livezilla&vis_email_id=<? echo $chat_object->Email; ?>&vis_client=1&vis_domain_id=<? echo $vis_domain; ?>&vis_chat_id=<? echo $chat_object->ChatId; ?>" onclick="" type="button"><? echo $vis_language['TXTCONVERTTOTICKET']; ?></a>
		  </div>
		</div>
        </div>
	  </div>
	
  </section>
</section>
<?php }elseif($operation['vis_operation']=='chat_detail'){ ?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
  <div class="col-sm-6">
    <h3 class="m-b-xs text-black"><? echo $vis_language['TXTCHATTRANSCRIPT'];?></h3>
    <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
      <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME'];?></a></li>
      <li><a class="link" href="#/chat/livechat_list/<? echo $vis_language['TXTLIVECHAT'];?>"><? echo $vis_language['TXTLIVECHAT'];?></a></li>
      <li><? echo $vis_language['TXTCHATTRANSCRIPT'];?></li>
    </ul>
  </div>
</section>
<section class="padder">
  <section class="panel panel-default">
    <div class="wrapper-sm">

   
      <div class="btn-group">
        <div class="form-group">
          <h5><? echo $vis_language['TXTCHATTRANSCRIPT'];?></h5>
        </div>
      </div>
     <div class="line b-b line-lg pull-in"></div>
    </div>
    <div class="row m-t">
      <div class="col-md-6">
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTDATE'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo format_datetime(strtotime($chat_object->started)); ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTIPADDRESS'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->visitor_ip; ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right "><? echo $vis_language['TXTVISITORNAME'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo ucfirst($chat_object->visitor_name); ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTVISITOREMAIL'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->visitor->email; ?></div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTCHATURL'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->chat_start_url; ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTSTAFFNAME'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->agents[0]->display_name; ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTSTAFFEMAIL'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->agents[0]->email; ?></div>
        </div>
         <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTCHATDURATION'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_object->duration; ?></div>
        </div>
      </div>
    </div>
   <!-- <div class="line b-b line-lg pull-in"></div>-->
      <div class="wrapper m-b-sm">
        <div class="clear">
          <form name="vis_selfhelp_article_form" id="vis_selfhelp_article_form" class="form-horizontal" method="post">
            <br/>
            <h5><? echo $vis_language['TXTCONVERSATIONS'];?></h5>
            <div class="line b-b line-lg pull-in"></div>
            <br/>
            <?php $msg = $chat_object->events;
			 for($i=0;$i<count($msg);$i++){
			 if(count($msg[$i]->files)>0){
				 for($a=0;$a<count($msg[$i]->files);$a++){
				  $file_name = explode('/',$msg[$i]->files[$a]);
				  $extension = explode('.',$file_name[6]);

				  if($extension[1]=='pdf' || $extension[1]=='sql' || $extension[1]=='txt')
				      $target = 'target="_blank"';
				  else
				      $target = '';
				  echo '<div class="row m-b-sm">
						 <div class="col-xs-2 text-right">'.$vis_language['TXTATTACHMENT'].'</div>
						  <div class=" col-xs-8 text-lt text-muted">
						  <a class="link" '.$target.' href="'.$msg[$i]->files[$a].'">'.$file_name[6].'</a></div>
						</div>';
				 }
			 }else{
				 $author_name = '';
				 if(isset($msg[$i]->author_name))$author_name=ucfirst($msg[$i]->author_name).' : ';
			     echo '<div class="row m-b-sm">
						 <div class="col-xs-2 text-right">['.format_datetime(strtotime($msg[$i]->date)).']</div>
						 <div class=" col-xs-10 text-lt text-muted">'.$author_name.$msg[$i]->text.'</div>
						</div>';
			 }
    		 }?>
          </form>
		  <div class="row m-b-sm">
		   <div class="col-xs-2 text-right"> </div>
		    <div class=" col-xs-10 text-lt text-muted">
		  <a href="javascript:void(0);" class="btn btn-primary" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=new_ticket_step_one&vis_static_area=vis_open_new_dialog&vis_chat_type=livechatinc&vis_email_id=<? echo $chat_object->visitor->email; ?>&vis_client=1&vis_domain_id=<? echo $vis_domain; ?>&vis_chat_id=<? echo $chat_object->id; ?>" onclick="" type="button"><? echo $vis_language['TXTCONVERTTOTICKET']; ?></a>
		    </div>
		  </div>
        </div>
    </div>
  </section>
</section>
<?php }elseif($operation['vis_operation']=='userlike_detail'){?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
  <div class="col-sm-6">
    <h3 class="m-b-xs text-black"><? echo $vis_language['TXTCHATTRANSCRIPT'];?></h3>
    <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
      <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME'];?></a></li>
      <li><a class="link" href="#/chat/userlike_list/<? echo $vis_language['TXTUSERLIKE'];?>"><? echo $vis_language['TXTUSERLIKE'];?></a></li>
      <li><? echo $vis_language['TXTCHATTRANSCRIPT'];?></li>
    </ul>
  </div>
</section>
<section class="padder">
  <section class="panel panel-default">
    <div class="wrapper-sm">
    <?php if($visitor_email == 'Not specified'){
			 $ticket_email = '';
			 $ticket_visitor_name = 'Visitor';
		  }
		  else{
		     $ticket_email = $visitor_email;
			 $ticket_visitor_name = $visitor_name;
		  }?>
   
      <div class="btn-group">
        <div class="form-group">
          <h5><? echo $vis_language['TXTCHATTRANSCRIPT'];?></h5>
        </div>
      </div>
     <div class="line b-b line-lg pull-in"></div>
    </div>
    <div class="row m-t">
      <div class="col-md-6">
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTDATE'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo format_datetime(strtotime($chat_data->created_at)); ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right "><? echo $vis_language['TXTVISITORNAME'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo ucfirst($visitor_name); ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTVISITOREMAIL'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $visitor_email; ?></div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTCHATURL'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo  $operation['vis_chat_url']; ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTSTAFFNAME'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $operation['vis_staff_name']; ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTSTAFFEMAIL'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $operation['vis_staff_email']; ?></div>
        </div>
      </div>
    </div>
      <div class="wrapper m-b-sm">
        <div class="clear">
          <form name="vis_selfhelp_article_form" id="vis_selfhelp_article_form" class="form-horizontal" method="post">
            <br/>
            <h5><? echo $vis_language['TXTCONVERSATIONS'];?></h5>
            <div class="line b-b line-lg pull-in"></div>
            <br/>
            <?php $msg = $chat_data->messages;
			 for($i=0;$i<count($msg);$i++){
			 	if($msg[$i]->type=='co')
					$name = ucfirst($visitor_name);
				elseif($msg[$i]->type!='co')
					$name = ucfirst($operation['vis_staff_name']);
			     echo '<div class="row m-b-sm">
						 <div class="col-xs-2 text-right">['.format_datetime(strtotime($msg[$i]->sent_at)).']</div>
						 <div class=" col-xs-10 text-lt text-muted">'.$name.' : '.$msg[$i]->body.'</div>
						</div>';
    		 }?>
          </form>
		   <div class="row m-b-sm">
		   <div class="col-xs-2 text-right"> </div>
		    <div class=" col-xs-10 text-lt text-muted">
		  <a href="javascript:void(0);" class="btn btn-primary" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=new_ticket_step_one&vis_static_area=vis_open_new_dialog&vis_chat_type=userlike&vis_email_id=<? echo $ticket_email; ?>&vis_domain_id=<? echo $vis_domain; ?>&vis_visitor_name=<? echo str_replace(' ', '',$ticket_visitor_name); ?>&vis_staff_name=<? echo str_replace(' ', '',$operation['vis_staff_name']);?>&vis_chat_id=<? echo $chat_data->meta_id; ?>" onclick="" type="button"><? echo $vis_language['TXTCONVERTTOTICKET']; ?></a>
		    </div>
		  </div>
        </div>
    </div>
  </section>
</section>
<?php }elseif($operation['vis_operation']=='comm100_detail'){ ?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
  <div class="col-sm-6">
    <h3 class="m-b-xs text-black"><? echo $vis_language['TXTCHATTRANSCRIPT'];?></h3>
    <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
      <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME'];?></a></li>
      <li><a class="link" href="#/chat/comm100_list/<? echo $vis_language['TXTCOMMCHAT'];?>"><? echo $vis_language['TXTCOMMCHAT'];?></a></li>
      <li><? echo $vis_language['TXTCHATTRANSCRIPT'];?></li>
    </ul>
  </div>
</section>
<section class="padder">
  <section class="panel panel-default">
    <div class="wrapper-sm">
  
      <div class="btn-group">
        <div class="form-group">
          <h5><? echo $vis_language['TXTCHATTRANSCRIPT'];?></h5>
        </div>
      </div>
     <div class="line b-b line-lg pull-in"></div>
    </div>
    <div class="row m-t">
      <div class="col-md-6">
      <?php  $start_date = trim($chat_data->start_time,'/Date()');
			 $start_date = substr($start_date, 0, 10);
	   	  if($chat_data->email!='')
			 $visitor_email = $chat_data->email;
		  else
			 $visitor_email= $vis_language['TXTNOTSPECIFIED']; ?>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTDATE'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo format_datetime($start_date); ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right "><? echo $vis_language['TXTVISITORNAME'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo ucfirst($chat_data->name); ?></div>
        </div>
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTVISITOREMAIL'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $visitor_email; ?></div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="row m-b-sm"> <span class="col-xs-3 text-right"><? echo $vis_language['TXTSTAFFNAME'];?> :</span>
          <div class=" col-xs-9 text-lt text-muted"><? echo $chat_data->operators; ?></div>
        </div>
      </div>
    </div>
   <!-- <div class="line b-b line-lg pull-in"></div>-->
      <div class="wrapper m-b-sm">
        <div class="clear">
          <form name="vis_selfhelp_article_form" id="vis_selfhelp_article_form" class="form-horizontal" method="post">
            <br/>
            <h5><? echo $vis_language['TXTCONVERSATIONS'];?></h5>
            <div class="line b-b line-lg pull-in"></div>
            <br/>
            <?php $chat_msg = explode('⊙',$chat_data->chat_transcript);
			 for($i=0;$i<count($chat_msg);$i++){
			     $msg_data = explode(']',$chat_msg[$i]);
				 if(isset($msg_data[1])){
			        echo '<div class="row m-b-sm">
						 <div class="col-xs-2 text-right">'.$msg_data[0].']</div>
						 <div class=" col-xs-8 text-lt text-muted">'.$msg_data[1].'</div>
						</div>';
				 }else{
					echo '<div class="row m-b-sm">
						 <div class="col-xs-2 text-right">&nbsp</div>
						 <div class=" col-xs-8 text-lt text-muted">'.$msg_data[0].'</div>
						</div>';
				 }
    		 }
			 $attachment = $chat_data->attachment;
			  if(count($attachment)>0){
				  for($a=0;$a<count($attachment);$a++){
					 echo '<div class="row m-b-sm">
						 <div class="col-xs-2 text-right">'.$vis_language['TXTATTACHMENT'].'</div>
						  <div class=" col-xs-8 text-lt text-muted">
						  <a class="link" href="'.$attachment[$a]->uri.'">'.$attachment[$a]->name.'</a></div>
						</div>';
				  }
			  }?>
          </form>
		   <div class="row m-b-sm">
		   <div class="col-xs-2 text-right"> </div>
		    <div class=" col-xs-10 text-lt text-muted">
		   <a href="javascript:void(0);" class="btn btn-primary" data-toggle="ajaxModal" data-modal-arguments="vis_module=ticket&vis_operation=new_ticket_step_one&vis_static_area=vis_open_new_dialog&vis_chat_type=comm100&vis_email_id=<? echo $chat_data->email; ?>&vis_domain_id=<? echo $vis_domain; ?>&vis_chat_id=<? echo $chat_data->id; ?>" type="button"><? echo $vis_language['TXTCONVERTTOTICKET']; ?></a>
		      </div>
		   </div>
        </div>
    </div>
  </section>
</section>
<?php }?>