   <?php
   // CRUD 
   @$getId = base64_decode($_GET['id']);  
    if(@$getId){ 
        $query = mysql_query("SELECT pl.*, cl.name AS name, cl.email AS email FROM tickets AS pl INNER JOIN customers AS cl ON pl.customer = cl.id WHERE pl.id = + $getId");
        $result = mysql_fetch_array($query);
    }

    ?>
    
    <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Timeline - <?php echo $lang['TICKET_VIEW']; ?>
   
          </h1>
         
        </section>

        <!-- Main content -->
        <section class="content">

          <!-- row -->
          <div class="row">
            <div class="col-md-12">
              <!-- The time line -->
              <ul class="timeline">
                
                <li class="time-label">
                  <span class="bg-blue">
                 TICKET ID #<?php echo $result['order']; ?> - <?php if($lang['DATE_FORMAT'] == 'PT') { ?><?php echo data_br($result['date']); ?><?php } ?><?php if($lang['DATE_FORMAT'] == 'EN') { ?><?php echo data_en($result['date']); ?><?php } ?>
                 </span>
                </li>
                <li><a  href="?mod=TicketsClosed" class="btn btn-info btn-sm"><i class="fa fa-back"></i> <?php echo $lang['TICKET_BTN_BACK_TICKET']; ?></a></li>
              
                <?php
 		  		$query_msg = mysql_query("SELECT p.*, c.name AS name, c.email AS email, d.name_user AS name_user FROM messages AS p INNER JOIN customers AS c ON p.customer = c.id INNER JOIN users AS d ON p.user = d.id WHERE p.ticket = '$getId' order by p.date DESC");
 		  		while($msg = mysql_fetch_array($query_msg)){ 
				?>
                <li>
                  <i class="<?php if($msg['type'] == '1') { ?>fa fa-user bg-green <? } else { ?>fa fa-envelope bg-blue<?php } ?>"></i>
                  <div class="timeline-item">
                    <span class="time"><i class="fa fa-clock-o"></i> <?php if($lang['DATE_FORMAT'] == 'PT') { ?><?php echo data_br($msg['date']); ?><?php } ?><?php if($lang['DATE_FORMAT'] == 'EN') { ?><?php echo data_en($msg['date']); ?><?php } ?> <?php echo $msg['hour']; ?></span>
                    <h3 class="timeline-header"><a href="javascript:void(0);"><?php if($msg['type'] == '1') { ?><?php echo $msg['name']; ?><?php } ?><?php if($msg['type'] == '2') { ?><?php echo $msg['name_user']; ?><?php } ?></a> <?php echo $msg['subject']; ?></h3>
                    <div class="timeline-body">
                      <?php echo $msg['msg']; ?>
                    </div>
                    <div class="timeline-footer">
                      <a class="btn btn-danger btn-xs" href="javascript:void(0);" onclick="javascript: if (confirm('<?php echo $lang['ALERT_BTN_DELETE']; ?>')) { window.location.href='?mod=Ticket&id=<?php echo $_GET['id']; ?>&msg=<?php echo base64_encode($msg['id']); ?>&action=delete' } else { void('') };">Delete</a>
                    </div>
                  </div>
                </li>
                
                <?php } ?>
                

        </section><!-- /.content -->
      </div><!-- /.content-wrapper -->
