1234567891011121314151617181920212223242526272829303132333435 |
- <?php /** Created by Anton on 29.01.2020. */
- use yii\db\Query;
- use app\models\entity\UserDevice;
- use app\models\entity\Log;
- use app\models\entity\Tmc;
- require '../yiiInit.php';
- $userId = (int) Yii::$app->request->get('userId');
- $query = new Query();
- $query->select('tlog.tmc, tt.title as device, tlog.issue_date')
- ->from(UserDevice::tableName() . ' tud')
- ->leftJoin(Log::tableName() . ' tlog',
- 'tlog.id = tud.camera or tlog.id = tud.oil_meter or tlog.id = tud.phone')
- ->leftJoin(Tmc::tableName(). ' tt', 'tlog.tmc = tt.id')
- ->where(['tud.employee' => $userId])
- ;
- $devices = $query->all();
- foreach ($devices as $device): ?>
- <div style="display:flex">
- <div class="loco_grey" style="width:33.3%">
- <h5 style="padding-top: 18px;"><?= $device['device'] ?></h5>
- </div>
- <div class="loco_grey" style="width:33.3%; padding-top: 18px;">
- <?= $device['issue_date'] ?>
- </div>
- <div style="width:33.3%">
- <button type="submit" name="deviceId" class="" style="float:right" value="<?= $device['tmc'] ?>">
- Принять устройство
- </button>
- </div>
- </div>
- <? endforeach;
|