<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!-- begin:: Content -->
<div class="kt-container kt-container--fluid kt-grid__item kt-grid__item--fluid" style="margin-top:30px">
<!--begin::Portlet-->
<div class="kt-portlet">
<div class="kt-portlet__head">
<div class="kt-portlet__head-label">
<h3 class="kt-portlet__head-title">
<?= @$mailbox_user->name; ?> - Inbox
</h3>
<span class="kt-section__info" style="margin-left:20px">
</span>
</div>
</div>
<div class="kt-portlet__body inbox-admin">
<!--begin::Section-->
<div class="kt-section">
<div class="kt-section__content">
<div class="list-group mb-5 list-group mb-5 col-md-12">
<?php if (!empty($messages)) {
foreach($messages as $message){ ?>
<a href="<?= base_url(); ?>admin/messages/messages/chat/<?= $this->uri->segment(5); ?>/<?= $message['chat_id']; ?>" class="list-group-item list-group-item-action p-3 p-md-3">
<?php
/* get product of message */
$CI =& get_instance();
$listing_data = $CI->Messages_model->getListing($message['listing_id']);
$last_message_time = $CI->Messages_model->getLastMessageTime($message['chat_id']);
foreach($listing_data as $listing) { ?>
<div class="list-group-image">
<?php
$photo_string = $listing['photo'];
$photo_array = explode(',', $listing['photo']);
if($photo_array && $photo_array[0]){
?>
<div style="background-image: url(<?= base_url('uploads/listing/').$photo_array[0]; ?>);height: 50px;width: 50px;border-radius: 50%;background-size: cover;">
</div>
<?php } else{ ?>
<div style="background-image: url(<?= base_url('assets/frontend/images/no-image.jpg'); ?>);height: 50px;width: 50px;border-radius: 50%;background-size: cover;">
</div>
<?php } ?>
</div>
<small class="text-muted float-right">
<?= $this->time_elapsed_string($last_message_time, false); ?><i class="fa fa-angle-right ml-2"></i>
</small>
<?php
/*get user name*/
if($message['from_user_id'] == $this->uri->segment(5)){
$user = $CI->Messages_model->getMessageUser($message['to_user_id']);
}
if($message['to_user_id'] == $this->uri->segment(5)){
$user = $CI->Messages_model->getMessageUser($message['from_user_id']);
}
?>
<h5 class="message-title"><?= $user[0]['name']; $message_unread = $CI->Messages_model->message_unread($this->uri->segment(5) , $message['chat_id']); if($message_unread > 0 ){ echo '<span class="badge badge-primary"> </span>'; } ?>
</h5>
<p class="mb-0"><?= $listing['name']; ?></p>
<?php } ?>
</a>
<?php } if ($links_pagination != '') {
echo $links_pagination;
}
} else { ?>
<div class="col-md-12 no-record-found">No Message Found.</div>
<?php } ?>
</div>
</div>
</div>
<!--end::Section-->
</div>
</div>
<!--end::Portlet-->
<!-- end:: Content -->
<script>
function confirm_del(id){
var txt;
var r = confirm("Are you sure. Do you want to delete?.");
if (r == true) {
window.location.href = "<?= base_url('admin/users/users/delete_user/'); ?>"+id;
} else {
//do nothing
}
}
</script>
|