chat.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!-- SLIDER CHAT BEGIN-->
  2. <?php $chatEntity = \app\models\entity\Chat::find()->where(['company_id' => $companyID])->orderBy(['date_massage' => SORT_ASC])->all(); ?>
  3. <aside id="aside_open_panel" class="control-sidebar" style="width: 420px; display:none">
  4. <!-- Tab panes -->
  5. <div class="tab-content" style="margin-top: 460px;">
  6. <div class="row">
  7. <div class="col-md-12">
  8. <div class="box box-primary direct-chat direct-chat-primary">
  9. <div class="box-header with-border">
  10. <h3 class="box-title">Чат компании</h3>
  11. <div class="box-tools pull-right">
  12. <span data-toggle="tooltip" title="3 New Messages" class="badge bg-light-blue">0</span>
  13. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
  14. </button>
  15. <button type="button" class="btn btn-box-tool" data-toggle="tooltip" title="Contacts" data-widget="chat-pane-toggle">
  16. <i class="fa fa-comments"></i></button>
  17. <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
  18. </div>
  19. </div>
  20. <!-- /.box-header -->
  21. <div class="box-body">
  22. <!-- Conversations are loaded here -->
  23. <div id="scrollFieldChat" class="direct-chat-messages">
  24. <? foreach($chatEntity as $msg): ?>
  25. <? if ($id == $msg->acc_id): ?>
  26. <div id="<?php echo $msg->id;?>_msgId" class="direct-chat-msg right">
  27. <div class="direct-chat-info clearfix">
  28. <span class="direct-chat-name pull-right"><?php echo $msg->accounts->login; ?></span>
  29. <span class="direct-chat-timestamp pull-left">
  30. <?php echo date("d M H:i",strtotime($msg->date_massage)); ?>
  31. </span>
  32. </div>
  33. <!-- /.direct-chat-info -->
  34. <i class="fa fa-3x fa-user direct-chat-img"></i><!-- /.direct-chat-img -->
  35. <div class="direct-chat-text">
  36. <? if (null != $msg->file): ?>
  37. <a href="<?php echo "/uploads/chat/" . $msg->file ?> " target='_blank' style="color: #fff;">
  38. <?php echo $msg->file_name ?><br>
  39. <i class="fa fa-2x fa-file direct-chat-img" style="color: #fff;float: left;"></i>
  40. </a><br><br>
  41. <?php endif; ?>
  42. <?php echo $msg->msg; ?>
  43. </div>
  44. <!-- /.direct-chat-text -->
  45. </div>
  46. <? else:?>
  47. <!-- Message. Default to the left -->
  48. <div id="<?php echo $msg->id; ?>_msgId" class="direct-chat-msg">
  49. <div class="direct-chat-info clearfix">
  50. <span class="direct-chat-name pull-left"><?php echo $msg->accounts->login; ?></span>
  51. <span class="direct-chat-timestamp pull-right"><?php echo date("d M H:i",strtotime($msg->date_massage)); ?><!--23 Jan 2:00 pm--></span>
  52. </div>
  53. <!-- /.direct-chat-info -->
  54. <!-- /.direct-chat-img -->
  55. <i class="fa fa-3x fa-user direct-chat-img"></i>
  56. <div class="direct-chat-text">
  57. <? if (null != $msg->file): ?>
  58. <a href="<?php echo "/uploads/chat/" . $msg->file ?> " target='_blank' style="color: #fff;">
  59. <?php echo $msg->file_name ?><br>
  60. <i class="fa fa-2x fa-file direct-chat-img" style="color: #fff;float: left;"></i>
  61. </a><br><br>
  62. <?php endif;?>
  63. <?php echo $msg->msg;?>
  64. </div>
  65. <!-- /.direct-chat-text -->
  66. </div>
  67. <!-- /.direct-chat-msg -->
  68. <? endif;?>
  69. <? endforeach;?>
  70. </div>
  71. <!--/.direct-chat-messages-->
  72. <!-- Contacts are loaded here -->
  73. <div class="direct-chat-contacts">
  74. <ul class="contacts-list">
  75. <li>
  76. <a href="#">
  77. <img class="contacts-list-img" src="lte/dist/img/user1-128x128.jpg" alt="User Image">
  78. <div class="contacts-list-info">
  79. <span class="contacts-list-name">
  80. Count Dracula
  81. <small class="contacts-list-date pull-right">2/28/2015</small>
  82. </span>
  83. <span class="contacts-list-msg">How have you been? I was...</span>
  84. </div>
  85. <!-- /.contacts-list-info -->
  86. </a>
  87. </li>
  88. <!-- End Contact Item -->
  89. </ul>
  90. <!-- /.contatcts-list -->
  91. </div>
  92. <!-- /.direct-chat-pane -->
  93. </div>
  94. <!-- /.box-body -->
  95. <div class="box-footer">
  96. <form id="chat_form" action="response.php" method="post" enctype="multipart/form-data">
  97. <div class="input-group">
  98. <input id="massage_field" type="text" name="message" placeholder="Сообщение ..." class="form-control">
  99. <span class="input-group-btn">
  100. <button id="massage_chat_send" type="submit" class="btn btn-primary btn-flat" style="height: 34px;margin-bottom: 1.5rem !important;"><i class="fa fa-fw fa-send-o"></i></button>
  101. </span>
  102. <span class="input-group-btn" style="vertical-align: top">
  103. <div class="btn btn-default btn-file">
  104. <i class="fa fa-paperclip"></i>
  105. <input id="file_v" type="file" name="attachment" >
  106. </div>
  107. </span>
  108. </div>
  109. </form>
  110. </div>
  111. <!-- /.box-footer-->
  112. </div>
  113. </div>
  114. </div>
  115. <!-- /.content -->
  116. </div>
  117. </aside>
  118. <!-- SLIDER CHAT END-->