<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Ticket Reply</title>
<link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/conv_components.min.css">
<link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/conv_style.css">
<link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo $this->request->webroot; ?>rtgv3/css/conv_core.css">
<style>
    .content-divider span {
        padding-right: 10px;
        background: #fff;
        padding-left: 10px;
    }
    .content-divider:after {
        content: "";
        position: absolute;
        top: 50%;
        left: 0;
        height: 1px;
        background-color: #ddd;
        width: 100%;
        z-index: -1;
    }
    li.media.date-step.content-divider {
        position: relative;
        z-index: 0;
    }
   .content-wrapper {
    display: inherit;
    width: auto;
}
.media-list {
    padding-left: 0;
    list-style: none;
}
.content-group {
    margin-bottom: 20px!important;
}
li.media.date-step.content-divider {
    position: relative;
    z-index: 0;
}
.chat-list .date-step.media {
    text-align: center;
    margin-left: 0;
    margin-right: 0;
    color: #999;
}
.media:first-child {
    margin-top: 0;
}
.chat-list .media.reversed {
    margin-right: 0;
    margin-left: 20%;
}
.chat-list .reversed .media-body {
    text-align: right;
}
.media, .media-body {
    overflow: visible;
}
.media-body, .media-left, .media-right {
    display: table-cell;
    vertical-align: top;
}
.media-body {
    width: 10000px;
}
.chat-list .reversed .media-content:not([class*=bg-]) {
    background-color: #42A5F5;
    border-color: #42A5F5;
}
.chat-list .reversed .media-content {
    text-align: left;
    color: #fff;
}
.chat-list .media-content {
    position: relative;
    padding: 10px 12px;
    width: auto;
    border-radius: 3px;
    display: inline-block;
}
.media-annotation {
    color: #999999;
    font-size: 12px;
    font-weight: 400;
}
.mt-10 {
    margin-top: 10px!important;
}
.display-block, label.display-block {
    display: block;
}
.media {
    margin-top: 20px;
    position: relative;
}
.chat-list .media-left {
    padding-right: 20px;
}


</style>
</head>
 <body>
     
Hello <?php echo $name; ?>,<br/><br/>

<div class="panel panel-flat">
    <div class="panel-heading">
        <h5 class="panel-title" style="text-align:center;">
            <?php foreach ($supportTickets as $support): ?>
            <?php if(!empty($support->title)) { ?>
              <?= h($support->title)?>
            <?php } ?>
            <?php endforeach; ?>
        </h5>

        <div class="heading-elements">

        </div>
    </div>

    <div class="panel-body">
        <ul class="media-list chat-list content-group">

            <?php
            $checkDate ='';
            foreach ($supportTickets as $support): 
                if(!empty($support->created_on)){
                    $created = $support->created_on;
                }else{
                    $created = $support->reply_date;
                }


                $time = '';
                $start_date = new DateTime(date("Y-M-d",strtotime($created)));
                $since_start = $start_date->diff(new DateTime(date(strtotime("Y-m-d"))));
                if($since_start->d == 0) {
                    $currentDay = 'Today';
                    $to_time = strtotime($created);
                    $from_time = strtotime(date("Y-m-d H:i:s"));
                    $getTime = round(abs($to_time - $from_time) / 60);
                    if($getTime > 60){
                        $time = round(abs($getTime) / 60)." hour ago";
                    }else{
                    $time = round(abs($to_time - $from_time) / 60)." minutes ago";
                    }
                }
                else if($since_start->d == 1) {
                    $currentDay = 'Yesterday';
                    $time = date("H:i A",strtotime($created));
                }else{
                    $currentDay = date("D", strtotime($created)).", ". date("Y-M-d",strtotime($created));
                    $time = date("H:i A",strtotime($created));
                }

            if(($checkDate != $currentDay)) 
                {
                ?>
            <li class="media date-step content-divider">
                <span><?php echo $currentDay ?></span>
            </li>
                <?php $checkDate = $currentDay; 

                 }
                if($support->user_type == 1) { ?>
            <li class="media reversed">
                <div class="media-body">
                    <div class="media-content" style="color:black;"><?php echo $support->description ?></div>
                    <span class="media-annotation display-block mt-10"><?php echo $support->name ?>, <?php echo $time ?> <a href="#"><i class="icon-pin-alt position-right text-muted"></i></a></span>
                </div>

                <div class="media-right">
                  
                </div>
            </li>
                <?php } else{ ?>

            <li class="media">
                <div class="media-left">
                   
                </div>

                <div class="media-body" style="width: auto;">
                    <div class="media-content" style="text-align: left;display: block;color:black;"><?php echo $support->description ?></div>
                    <span class="media-annotation display-block mt-10 pull-left"><?php echo "Admin" ?>, <?php echo $time ?> <a href="#"><i class="icon-pin-alt position-right text-muted"></i></a></span>
                </div>
            </li>
                <?php } ?>
                <?php endforeach; ?>

        </ul>

    </div>

</div>

<br/><br/>

Best Regards,<br/>
<?= $regards;?><br/>
 
</body>
</html>
