mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/ARCHIVED-IZYIM.git
synced 2026-08-19 04:14:01 +00:00
362 lines
20 KiB
PHP
Executable File
362 lines
20 KiB
PHP
Executable File
<?php
|
|
|
|
|
|
$data = $db->query("SELECT notice_messages.delivery_arrangement_id as delivery_arrangement_id, notice_messages.decision_type as decision_type,notice_messages.decision as decision,notice_messages.warehouse_arrangement_id as warehouse_arrangement_id,notice_messages.reply_id as reply_id, notice_messages.file as file, notice_messages.file_name as file_name, notice_messages.message_id as message_id, notice_messages.message_id as message_id, notice_messages.message as message, notice_messages.from_id as from_id, notice_messages.created_on as created_on, notice_messages.chat_type as chat_type, notice_messages.mime as mime FROM `notice_messages` join notice_room_message on notice_messages.message_id = notice_room_message.message_id WHERE notice_room_message.room_id = '".$room_id."' && notice_messages.message_id > '".$id."' ORDER BY notice_messages.message_id ASC");
|
|
|
|
$counts = 0;
|
|
$html = "";
|
|
if(count($data) > 0){
|
|
foreach ($data as $key => $value) {
|
|
if(date("Y-m-d", strtotime($request->get('last_date'))) <> date("Y-m-d", strtotime($value['created_on']))) {
|
|
if($counts == 0){
|
|
$counts = 1;
|
|
$prev_date = date("Y-m-d", strtotime($value['created_on']));
|
|
$html .= '<br/><li class="date"><center><span class="label label-sm label-info date" data-id="'.date("Y-m-d", strtotime($value['created_on'])).'" style="border-radius: 6px !important;">' . date("F j, Y", strtotime($value['created_on'])) . '</span></center></li>';
|
|
}
|
|
}
|
|
if(date("Y-m-d", strtotime($request->get('last_date'))) <> date("Y-m-d", strtotime($value['created_on']))) {
|
|
if (date("Y-m-d", strtotime($prev_date)) <> date("Y-m-d", strtotime($value['created_on']))){
|
|
$prev_date = date("Y-m-d", strtotime($value['created_on']));
|
|
$html .= '<li class="date"><center><span class="label label-sm label-info date" data-id="'.date("Y-m-d", strtotime($value['created_on'])).'" style="border-radius: 6px !important;">' . date("F j, Y", strtotime($value['created_on'])) . '</span></center></li>';
|
|
}
|
|
}
|
|
if( $counts == 1){
|
|
$counts = 2;
|
|
if(getRoomUnread($room_id) > 0){
|
|
$html .= '<li class="unread"><center><span class="label label-sm label-info" style="border-radius: 6px !important;">'.getRoomUnread($room_id).' Unread Messages</span></center></li>';
|
|
}
|
|
}
|
|
if($value["from_id"] == $_SESSION['user_id'] ){
|
|
$class="out";
|
|
}else{
|
|
$class="in";
|
|
}
|
|
$data = $db->query("UPDATE notice_unread SET status = 1 WHERE message_id = '". $value['message_id'] . "' and user_id = '".$_SESSION['user_id']."'");
|
|
if(getMessageData($value["reply_id"], "from_id") == $_SESSION['user_id'] ){
|
|
$classReply="border-left: 2px solid #F3565D !important;";
|
|
}else{
|
|
$classReply="border-left: 2px solid #1BBC9B !important;";
|
|
}
|
|
if($value['chat_type']== 1){
|
|
if($value['reply_id'] == null || $value['reply_id'] == 0){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" class="reply" data-reply_id="'.$value['message_id'].'">Reply</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}else{
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-body" style="border-radius:2px !important; '.$classReply.' background-color: #F2F2F2; padding-top: 10px;padding-bottom: 10px;padding-right: 10px;margin-bottom: 10px;">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.(getMessageData($value['reply_id'], "from_id") == 1 ? "Bot" : (getProfileData(getMessageData($value['reply_id'], "from_id"), "first_name") <> "" ? getProfileData(getMessageData($value['reply_id'], "from_id"), "first_name") : get_data(getMessageData($value['reply_id'], "from_id"), "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime(getMessageData($value['reply_id'], "created_on"))).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.getMessageData($value['reply_id'], "message").'</div>
|
|
</div>
|
|
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" class="reply" data-reply_id="'.$value['message_id'].'">Reply</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}
|
|
}elseif($value['chat_type']== 2){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text"><a href="'.$value['file'].'" download="'.$value['file_name'].'"><img src="'.$value['file'] .'" style="max-width:300px; height: auto;" /></a></div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 3){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-text"><a href="'.$value['file'].'" download="'.$value['file_name'].'"> Download </a> </div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 4){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-text">
|
|
<audio controls>
|
|
<source src="'.$value['file'].'" type="'.$value['mime'].'">
|
|
Your browser does not support the audio element.
|
|
</audio>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 5){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-text">
|
|
<video width="320" height="240" controls>
|
|
<source src="'.$value['file'].'" type="'.$value['mime'].'">
|
|
Your browser does not support the video tag.
|
|
</audio>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 6){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" href="/shipping-order/details/'.getRoomData($room_id, "order_id").'">Details</a>
|
|
</li>
|
|
<li>
|
|
<a style="text-transform:capitalize;" data-order_id="'.getRoomData($room_id, "order_id").'" class="previewPL">Preview PL</a>
|
|
</li>
|
|
<li>
|
|
<a style="text-transform:capitalize;" data-order_id="'.getRoomData($room_id, "order_id").'" class="previewMarking">Print Marking</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 7){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" href="/warehouse-arrangements/details/'.getWAID(getRoomData($room_id, "order_id"), "id").'">Details</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 8){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" href="/shipment-arrangements/details/'.getRoomData($room_id, "order_id").'">Details</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 9){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" href="/delivery-arrangements/details/'.getRoomData($room_id, "order_id").'">Details</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 10){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>
|
|
<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" href="/purchase-order/details/'.getRoomData($room_id, "po_id").'">Details</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 11){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>';
|
|
if($value['warehouse_arrangement_id'] <> null ){
|
|
$html .= '<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" class="decision-request-details" data-id="'.$value['warehouse_arrangement_id'].'" data-message_id="'.$value['message_id'].'" data-decision="'.$value['decision'].'">Details</a>
|
|
</li>
|
|
</ul>
|
|
</div>';
|
|
}
|
|
$html .= '</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 13){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>';
|
|
if($value['delivery_arrangement_id'] <> null ){
|
|
$html .= '<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" class="delivery-request-details" data-id="'.$value['delivery_arrangement_id'].'" data-message_id="'.$value['message_id'].'" data-decision="'.$value['decision'].'">Details</a>
|
|
</li>
|
|
</ul>
|
|
</div>';
|
|
}
|
|
$html .= '</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}elseif($value['chat_type']== 14){
|
|
$html .= '<li class="'.$class.'" id="cc" data-id="'.$value['message_id'].'">';
|
|
$html .= '<div class="mt-comment" style="background: #f9f9f9;border-radius: 10px !important;">
|
|
<div class="mt-comment-img">
|
|
<img class="avatar" alt="" src="'. showImage($value["from_id"]).'">
|
|
</div>
|
|
<div class="mt-comment-body">
|
|
<div class="mt-comment-info">
|
|
<span class="mt-comment-author">'.($value['from_id'] == 1 ? "Bot" : (getProfileData($value['from_id'], "first_name") <> "" ? getProfileData($value['from_id'], "first_name") : get_data($value['from_id'], "username"))).'</span>
|
|
<span class="mt-comment-date">'.date("H:i", strtotime($value['created_on'])).'</span>
|
|
</div>
|
|
<div class="mt-comment-text">'.$value['message'] .'</div>';
|
|
if($value['delivery_arrangement_id'] <> null ){
|
|
$html .= '<div class="mt-comment-details">
|
|
<ul class="mt-comment-actions">
|
|
<li>
|
|
<a style="text-transform:capitalize;" class="delivery-request-details" data-id="'.$value['delivery_arrangement_id'].'" data-message_id="'.$value['message_id'].'" data-decision="'.$value['decision'].'">Details</a>
|
|
</li>
|
|
</ul>
|
|
</div>';
|
|
}
|
|
$html .= '</div>
|
|
</div>';
|
|
$html .= '</li>';
|
|
}
|
|
}
|
|
|
|
echo $html;
|
|
}
|
|
|
|
|
|
?>
|