give.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /** @var string $act */
  3. if (!$logged_me_in_successfully234) {
  4. return;
  5. }
  6. $query = new \yii\db\Query();
  7. $query->select('tlog.tmc, ttmc.title, ts.title as status, ta.name, t.employee, tlog.issue_date')
  8. ->from(\app\models\entity\UserDevice::tableName() . ' t')
  9. ->leftJoin(\app\models\entity\Log::tableName() . ' tlog', 'tlog.id = t.phone or tlog.id = t.camera or tlog.id = t.oil_meter')
  10. ->leftJoin(\app\models\entity\Tmc::tableName() . ' ttmc', 'ttmc.id = tlog.tmc')
  11. ->leftJoin(\app\models\entity\TmcStatus::tableName() . ' ts', 'ts.id = ttmc.status')
  12. ->leftJoin(\app\models\entity\Accounts::tableName() . ' ta', 'ta.id = t.employee')
  13. ;
  14. $userDevices = $query->all();
  15. $usersWithDevice = [];
  16. foreach ($userDevices as $userDevice) {
  17. $usersWithDevice[$userDevice['employee']][] = $userDevice;
  18. }
  19. ?>
  20. <link href="/tmc/css/main.min.css" rel="stylesheet">
  21. <style type="text/css">
  22. .main_content {
  23. padding: 0;
  24. display: inline-flex;
  25. }
  26. </style>
  27. <div class="menuTask loco-scrol-blue scroller">
  28. <div class="menuTaskHeader">Список устройств у сотрудников</div>
  29. <div class="boxB4">
  30. <div class="inpBox">
  31. <input class="js-search" type="text" placeholder="Поиск">
  32. <img src="/images/find.svg">
  33. </div>
  34. </div>
  35. <div class="boxB5">
  36. <div class="tmc-content">
  37. <?php foreach ($usersWithDevice as $userId => $devices): ?>
  38. <a href="tmc\detail\user.php?id=<?= $userId ?>" class="loco_list">
  39. <div>
  40. <h5><?= $devices[0]['name'] ?></h5>
  41. <?php foreach ($devices as $device): ?>
  42. <p>
  43. <t class="loco_grey"><?= $device['title'] ?></t>
  44. <t class="loco_grey" style="float:right"><?= $device['issue_date'] ?></t>
  45. </p>
  46. <?php endforeach; ?>
  47. </div>
  48. </a>
  49. <?php endforeach; ?>
  50. </div>
  51. </div>
  52. <div role="log" aria-live="assertive" aria-relevant="additions" class="ui-helper-hidden-accessible"></div>
  53. </div>
  54. <?php if ($act == 'tmc/give') {
  55. require dirname(__DIR__) . '/tmc/forms/give.php';
  56. }?>
  57. <script type="application/javascript" src="tmc/js/search.js"></script>