1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php /** Created by Anton on 03.03.2020. */
- use app\models\entity\Accounts;
- use app\models\entity\Log;
- use app\models\entity\Tmc;
- use app\models\entity\TmcStatus;
- use app\models\entity\TmcType;
- use app\models\entity\UserDevice;
- use yii\db\Query;
- require '../yiiInit.php';
- $user = Accounts::findOne((int)$_GET['id']);
- $query = new Query();
- $query->select('ts.title as status, tt.title as type, t.receipt_date, tl.issue_date, t.id as tmc')
- ->from(Tmc::tableName() . ' t')
- ->leftJoin(TmcType::tableName() . ' tt', 'tt.id = t.tmc_type')
- ->leftJoin(TmcStatus::tableName() . ' ts', 'ts.id = t.status')
- ->leftJoin(UserDevice::tableName() . ' tud', 'tud.employee = t.employee')
- ->leftJoin(Log::tableName() . ' tl', 'tl.id = tud.camera or tl.id = tud.oil_meter or tl.id = tud.phone')
- ->where(['t.employee' => $user->id])
- ->groupBy('t.id')
- ;
- $devices = $query->all();
- ?>
- <!doctype html>
- <html lang="ru">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport"
- content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <link rel="stylesheet" href="../../ProSysNew/bootstrap.css">
- <title>Пользователь <?= $user->id ?></title>
- </head>
- <body>
- <div class="container" style="max-width: 400px">
- <h3 class="text-center"><?= $user['name'] ?></h3>
- <?php foreach ($devices as $device): ?>
- <table class="table text-center">
- <thead>
- <tr>
- <td colspan="2">
- <h4><?= $device['type'] ?></h4>
- </td>
- </tr>
- </thead>
- <tr>
- <td>ID</td>
- <td><?= $device['tmc'] ?></td>
- </tr>
- <tr>
- <td>Статус</td>
- <td><?= $device['status'] ?></td>
- </tr>
- <tr>
- <td>Дата выдачи</td>
- <td><?= $device['issue_date'] ?></td>
- </tr>
- <?php endforeach; ?>
- </div>
- </body>
- </html>
|