take.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. if (!$logged_me_in_successfully234) {
  3. return;
  4. }
  5. $query = new \yii\db\Query();
  6. $query->select('ta.id, ta.name, tt.title, tlog.tmc, tlog.issue_date')
  7. ->from(\app\models\entity\UserDevice::tableName() . ' tu')
  8. ->leftJoin(\app\models\entity\Log::tableName() . ' tlog',
  9. 'tlog.id = tu.camera OR tlog.id = tu.oil_meter OR tlog.id = tu.phone')
  10. ->leftJoin(\app\models\entity\Accounts::tableName() . ' ta', 'ta.id = tlog.employee')
  11. ->leftJoin(\app\models\entity\Tmc::tableName() . ' tt', 'tt.id = tlog.tmc')
  12. ;
  13. $result = $query->all();
  14. //[userId => deviceInfo[]]
  15. $userDevices = [];
  16. foreach ($result as $device) {
  17. $userDevices[$device['id']][] = $device;
  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 ($userDevices as $userId => $devices): ?>
  38. <a href="#" 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. <div class="divContentScroll loco-scrol-blue">
  55. <div id="contentBox" class="contentBox">
  56. <p class="crumbs">Список устройств у сотрудников » Принять устройство</p>
  57. <h2 class="contentHeader">Введите данные для принятия устройства</h2>
  58. <form action="/tmc/api/take_tmc.php" method="post">
  59. <input type="hidden" name="_csrf" value=""><fieldset>
  60. Сотрудник:
  61. <select class="" name="userId">
  62. <option value="0">Выберите сотрудника...</option>
  63. <?php foreach ($userDevices as $userId => $devices): ?>
  64. <option value="<?= $userId ?>"><?= $devices[0]['name'] ?></option>
  65. <? endforeach; ?>
  66. </select>
  67. <br clear="all">
  68. <br>
  69. Выданные устройства:
  70. <div class="issued-devices">
  71. </div>
  72. <!--Заполняется ajax запросом-->
  73. <br>
  74. </fieldset>
  75. </form>
  76. <div>
  77. <br>
  78. </div>
  79. </div>
  80. </div>
  81. <script type="application/javascript" src="tmc/js/take.js"></script>
  82. <script type="application/javascript" src="tmc/js/search.js"></script>