<?php /* Smarty version 2.6.22, created on 2016-11-23 14:19:47
         compiled from /data/vhosts/orders.eurojaponautosupply.com/httpdocs/ultimate_support_chat/modules/visitors/views/history.html */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'date_format', '/data/vhosts/orders.eurojaponautosupply.com/httpdocs/ultimate_support_chat/modules/visitors/views/history.html', 69, false),array('modifier', 'lower', '/data/vhosts/orders.eurojaponautosupply.com/httpdocs/ultimate_support_chat/modules/visitors/views/history.html', 77, false),)), $this); ?>
<div class="usc_app_page_wrap" style="min-height:600px">
<link rel="stylesheet" href="<?php echo $this->_tpl_vars['data_server']; ?>
css/history.min.css" type="text/css" media="screen">

<?php if ($this->_tpl_vars['users']): ?>
<div class="row">
    <div class="col-xs-12">
        <div class="panel history_panel">
            <header class="panel-heading history_panel_heading">
				<span>Chat history</span>
				<div class="history_btn_container">
					<?php if ($_SESSION['user']['permissions'] == 1): ?>
						<button type="button" class="usc_table_btn" onclick="submit_bulk_delete()">CLEAR</button>
					<?php endif; ?>
				</div>
			</header>

            <div class="panel-body table-responsive">
                <div class="box-tools m-b-15">
					<form method="post">
                    <div class="input-group">
						
                        <input type="text" name="history_table_search" class="form-control input-sm pull-right history_input" placeholder="Enter visitor name..."/>

                        <div class="input-group-btn">
                            <button class="btn btn-sm btn-default"><i class="fa fa-search"></i></button>
                        </div>
						<input type="hidden" name="search_visitor_history"/>
					
                    </div>
					</form>
                </div>
				<?php if ($_SESSION['user']['permissions'] == 1): ?>
					<form method="post" id="bulk_delete">
				<?php endif; ?>
                <table class="table table-hover">
                    <tr>
                        <th>DATE</th>
                        <th>VISITOR</th>
                        <th>SPECS</th>
                        <th>LENGTH</th>
                        <th>STATUS</th>
						<?php if ($_SESSION['user']['permissions'] == 1): ?>
						 <th></th>
						  <th></th>
						<?php endif; ?>
                    </tr>

                    <?php $_from = $this->_tpl_vars['users']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['i']):
?>

                    <tr>

                        <?php echo '
                        <script>
                            function getRow(row, action) {								
								if (action == \'get\'){
									 window.location.href = applicationPath + \'visitors/history\'+delimiter+\'request_id=\' + row;
								}
								if (action == \'delete\'){	
									var conf = confirm(\'Are you sure?\');
									if (conf === true){
										window.location.href = applicationPath + \'visitors/history\'+delimiter+\'delete_chat_id=\' + row;
									}
									return false;
								}
                            }
                        </script>
                        '; ?>


                        <td onclick="getRow(<?php echo $this->_tpl_vars['i']['request_id']; ?>
, 'get')"><?php echo ((is_array($_tmp=$this->_tpl_vars['i']['end_date'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%D %H:%M:%S") : smarty_modifier_date_format($_tmp, "%D %H:%M:%S")); ?>
</td>
                        <td onclick="getRow(<?php echo $this->_tpl_vars['i']['request_id']; ?>
 ,'get')"><span><?php echo $this->_tpl_vars['i']['name']; ?>
</span></td>

                        <td onclick="getRow(<?php echo $this->_tpl_vars['i']['request_id']; ?>
 ,'get')">
                            <span>
                                <?php if ($this->_tpl_vars['i']['country_name'] != '' && $this->_tpl_vars['i']['country_name'] != 'Null' && $this->_tpl_vars['i']['country_name'] != 'Undefined'): ?>
                                    <img class="tip_tip country_img" title="<?php echo $this->_tpl_vars['i']['country_name']; ?>
"
                                     src="<?php echo $this->_tpl_vars['data_server']; ?>
/img/countries/<?php echo ((is_array($_tmp=$this->_tpl_vars['i']['country_code'])) ? $this->_run_mod_handler('lower', true, $_tmp) : smarty_modifier_lower($_tmp)); ?>
.png"/>
                                <?php else: ?>
                                    <img class="tip_tip" title="<?php echo $this->_tpl_vars['i']['country_name']; ?>
"
                                     src="<?php echo $this->_tpl_vars['data_server']; ?>
/img/countries/earth.png"/>
                                <?php endif; ?>
                                <a class="tip_tip" title="<?php echo $this->_tpl_vars['i']['os']; ?>
, <?php echo $this->_tpl_vars['i']['browser']; ?>
"><i class="fa fa-desktop os_info"></i></a>
								<?php if ($this->_tpl_vars['i']['email'] != ''): ?>
									<a class="tip_tip" title="<?php echo $this->_tpl_vars['i']['email']; ?>
"><i class="fa fa-envelope-o email_info"></i></a>
								<?php endif; ?>						
                            </span>
                        </td>
                        <td  onclick="getRow(<?php echo $this->_tpl_vars['i']['request_id']; ?>
 ,'get')"><?php echo $this->_tpl_vars['i']['chat_length']; ?>
</td>
                        <td  onclick="getRow(<?php echo $this->_tpl_vars['i']['request_id']; ?>
 ,'get')">
							<a href="/<?php echo $this->_tpl_vars['languageURL']; ?>
<?php echo $this->_tpl_vars['delimiter']; ?>
user=<?php echo $this->_tpl_vars['i']['user_id']; ?>
" class="tip_tip" title="End date: <?php echo $this->_tpl_vars['i']['end_date']; ?>
">
								<span class="label label-danger">Ended</span>
							</a>
						</td>
						<?php if ($_SESSION['user']['permissions'] == 1): ?>
						 <td>	 
							 <a class="tip_tip" title="Delete" onclick="getRow(<?php echo $this->_tpl_vars['i']['request_id']; ?>
, 'delete')"><i class="fa fa-trash"></i></a>
							 <span style="margin-left:10px"><input type="checkbox" name="delete_chat_id[]" value="<?php echo $this->_tpl_vars['i']['request_id']; ?>
" /></span>
						 </td>	
						<?php endif; ?>		
                    </tr>

                    <?php endforeach; endif; unset($_from); ?>
					
					
					<?php if ($_SESSION['user']['permissions'] == 1): ?>
							
					  <tr>
						<td></td>  <td></td>  <td></td>  <td></td>  <td></td>
						<td>
						   <i class="fa fa-trash"></i>
						   <span style="margin-left:10px">
							<input type="checkbox" onchange="checkAll(this)" name="chk[]" id="checkbox" value="1" onchange="checkAll(this)"/>
							<span style="margin-left:10px">All</span>
							
						  </span>
						  <input type="hidden" name="delete_selected" value="1"/>
						</td>							
					</tr>
					</form>
					<?php endif; ?>
					
                </table>

            </div>

        </div>

    </div>
</div>
		<?php echo $this->_tpl_vars['paging']; ?>

<?php endif; ?>

<?php if (! $this->_tpl_vars['users'] && ! $this->_tpl_vars['data']): ?>
	<div style="text-align: center">NO RESULTS FOUND</div>
<?php endif; ?>

<?php if ($this->_tpl_vars['data']): ?>

<div class="chat_dashboard_container clearfix screenFiller">

    <div class="col-xs-8">
        <div class="chat">
            <div class="chat-header">
				<form id="history_actions" method="post">
					<button type="button" class="email_transcript_btn usc_table_btn mt14" name="email_transcript" onclick="email_transcript_modal()"></button>
					<button type="submit" class="download_transcript_btn  usc_table_btn mt14" name="download_transcript"></button>
				</form>
            </div>
            <div id="chat_history" class="chat_history chat_history_vis_hide">
                <?php if ($this->_tpl_vars['data']['history']): ?>
                  <?php $_from = $this->_tpl_vars['data']['history']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['i']):
?>
                    <?php echo $this->_tpl_vars['i']; ?>

                  <?php endforeach; endif; unset($_from); ?>
				  <?php echo '<script> $(document).ready(function (){refreshLayout();}); </script>'; ?>

                <?php endif; ?>
            </div>
        </div>
    </div>

    <div class="col-xs-4">
		<div class="chat_stats">			
	        <h4>Chat stats:</h4>
	        <p>Date: <?php echo ((is_array($_tmp=$this->_tpl_vars['data']['chat_date'])) ? $this->_run_mod_handler('date_format', true, $_tmp, "%A, %B %e, %Y") : smarty_modifier_date_format($_tmp, "%A, %B %e, %Y")); ?>
</p>
	        <p>Length: <?php echo $this->_tpl_vars['data']['chat_length']; ?>
</p>
			
			<?php if ($this->_tpl_vars['visitor_email'] != ''): ?>
				<h4>Visitors email:</h4>
				<p><?php echo $this->_tpl_vars['visitor_email']; ?>
</p>
			<?php endif; ?>	
		
	        <h4>Visitors path:</h4>

	        <?php if ($this->_tpl_vars['data']['visitors_path']): ?>
	          <?php $_from = $this->_tpl_vars['data']['visitors_path']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['i']):
?>
	            <span class="visitor_path"><?php echo $this->_tpl_vars['i']; ?>
</span>
	          <?php endforeach; endif; unset($_from); ?>
	        <?php endif; ?>
		</div>
    </div>
	
</div>

<div class="row"></div>
<br/>

<?php endif; ?>
</div>

<!-- Modal HTML -->
<div id="emailTranscriptModal" class="modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Email Transcript</h4>
            </div>
            <div class="modal-body">
				<form>
				<div class="form-group">
				  <label for="comment">Enter email (Example: 1@gmail.com, 2@gmail.com)</label>
				  <textarea class="form-control" rows="3" id="email_addresses"></textarea>
				</div>
			    </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" onclick="emailTranscript()">Email</button>
            </div>
        </div>
    </div>
</div>
</div>

<script src="<?php echo $this->_tpl_vars['data_server']; ?>
js/history.min.js" type="text/javascript"></script>