<!-- Inbox Header -->
<div class="content-header">
    <div class="header-section">
        <h1><i class="gi gi-envelope"></i> <Strong>iMail</Strong><br><small>Communications & Resources | <?php echo SITE_NAME ?> &copy; <?php echo date("Y");?></small></h1>
    </div>
</div>
<!-- END Inbox Header -->
<div class="row">
	<div class="col-sm-4 col-lg-3">
		<div class="block">
            <!-- Account Status Title -->
            <div class="block-title">
                <h2><i class="fa fa-user"></i> Account <strong>Details</strong></h2>
                <div class="block-options pull-right">
                	<a href="<?php echo SITE_URL ?>/index.php/Mail/settings" class="btn btn-alt btn-sm btn-default" data-toggle="tooltip" title="Settings"><i class="fa fa-cog"></i></a>
                </div>
            </div>
            <!-- END Account Status Title -->
            
            <!-- Account Stats Content -->
            <table class="table table-borderless table-striped table-vcenter">
                <tbody>
                    <tr>
                        <td class="text-center" style="width: 50%;"><strong>Name</strong></td>
                        <td><?php echo Auth::$userinfo->firstname.' '.Auth::$userinfo->lastname; ?></td>
                    </tr>
                    <tr>
                        <td class="text-center"><strong>Pilot ID</strong></td>
                        <td><span class="label label-info"><?php echo Auth::$userinfo->code; ?><?php echo Auth::$userinfo->pilotid;?></span></td>
                    </tr>
                </tbody>
            </table>
            
            
            <!-- END Account Status Content -->
        </div>
        <a href="<?php echo SITE_URL ?>/index.php/Mail" class="widget widget-hover-effect1">
	            <div class="widget-simple">
	                <h3 class="widget-content text-center animation-pullDown">
	                    <span class="label label-warning">BACK</span>
	                    <small> iMail</small>
	                </h3>
	            </div>
	        </a>
    </div>
	<div class="col-md-9">
		<div class="block">
			<div class="block-title">
				<h3>Sent <strong>Mail</strong></h3>
			</div>
			<div class="table-responsive">
			<table class="table table-hover">
        <?php
        if(!$mail) {
            echo '<tr><td colspan="5">You have no sent messages.</td></tr>';
        }
        else {
            ?>
            <tr>
            	<th>Recipent</th>
            	<th>Subject</th>
                <th>Date sent</th>
                <th>Status</th>
                <th>Options</th>
            </tr>
    <?php
        foreach($mail as $thread){
            if($thread->read_state=='0'){
                if($thread->deleted_state == '0'){
                    $status = '<span class="text-warning">NOT OPENED</span>';
                }else{
                    $status = '<span class="text-success">DELETED (UNREAD) </span>';
                }
            }else{
                if($thread->deleted_state == '0'){
                    $status = '<span class="text-success">READ</span>';
                }else{
                    $status = '<span class="text-success">READ</span>';
                }
            }
            $user = PilotData::GetPilotData($thread->who_to); $pilot = PilotData::GetPilotCode($user->code, $thread->who_to);
    ?>
            <tr>
                
                <td align="center"><?php
                    if ($thread->notam=='1') {
                        echo 'Airline NOTAM (All Pilots)';
                    }
                    else {
                        echo $user->firstname.' '.$user->lastname; ?> <?php echo '('.$pilot.')';
                    } ?>
                </td>
            	<td><span class="label label-info"><?php echo $thread->subject; ?></span></td>
                <td align="center"><?php echo date(DATE_FORMAT.' h:ia', strtotime($thread->date)); ?></td>
                <td align="center"><?php echo $status;?></td>
                <td align="center"><a href="<?php echo SITE_URL ?>/index.php/Mail/item/<?php echo $thread->thread_id.'/'.$thread->who_to;?>"><i class="fa fa-eye text-muted"></i></a>  <a href="<?php echo SITE_URL ?>/index.php/Mail/sent_delete/?mailid=<?php echo $thread->id;?>"><i class="fa fa-trash-o text-danger"></i></a></td>

            </tr>
             
    <?php
    }
}
?>	  
        </table>
        <span class="pull-right">iMail <strong><em>v4</em></strong></span><br><br>
		</div>
		</div>
	</div>
</div>