<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dt197 */

$this->title = $model->id;
?>
<div class="dt197-view">
    <table class="table table-borderless">
        <tr class="norb nolb notbb">
            <td align="right"><?= $this->render('//common/_viewheader', ['title' => 'Daily Checksheet']) ?><br /> Pad
                No: <?= $model->padno ?></td>

        </tr>
    </table>
    <table class="table table-borderless">
        <thead>

        </thead>
        <tbody>

            <tr>
                <th class="DarkerBlue">Client</th>
                <td><?= $model->clientl ? $model->clientl->account_name : null ?></td>
                <th class="DarkerBlue">Date &amp; Time</th>
                <td><?php if ($model->insdate) {echo date('d/m/Y H:i', strtotime($model->insdate));} ?></td>
                <th class="DarkerBlue">Location</th>
                <td><?= $model->location ?></td>
                <th class="DarkerBlue">Job No:</th>
                <td><?= $model->jobno ?></td>
            </tr>
        </tbody>
    </table>
    <table class="Table">
        <tbody>
            <tr>
                <th class="DarkerBlue">Pre-Welding Description</th>
                <th class="DarkerBlue">Y/N</th>
                <th class="DarkerBlue">Comments</th>
                <th class="DarkerBlue">Post-Welding Description </th>
                <th class="DarkerBlue">Y/N</th>
                <th class="DarkerBlue">Comments</th>
            </tr>
            <?php $x = 21; ?>
            <?php $y = 1; ?>
            <?php while($x <= 40 ){ ?>
            <tr>
                <?php if($model->getAttributelabel("response$x".'a') !== "response$x".'a'){ ?>
                <th width="25%">
                    <?= $model->getAttributelabel("response$x".'a') ?>
                </th>
                <th>
                    <?php $field = 'response' .$x.'a'; ?>
                    <?= Yii::$app->formatter->asBoolean($model->$field);   ?>
                </th>
                <td>
                    <?php $field = 'response' .$x.'b'; ?>
                    <?= $model->$field  ?>
                </td>
                <?php if($model->getAttributelabel("response$y".'a') !== "response$y".'a' ){ ?>
                <th width="20%">
                    <?= $model->getAttributelabel("response$y".'a') ?>
                </th>
                <th>
                    <?php $field = 'response' .$y.'a'; ?>
                    <?= Yii::$app->formatter->asBoolean($model->$field);   ?>

                </th>
                <td>
                    <?php $field = 'response' .$y.'b'; ?>
                    <?= $model->$field  ?>
                </td>

                <?php } ?>
                <?php } ?>
            </tr>
            <?php  $x++ ?>
            <?php  $y++ ?>
            <?php  } ?>
            <tr>
                <th class="DarkerBlue">Has welding production target been achieved?</th>
                <td><?= Yii::$app->formatter->asBoolean($model->target) ?></td>
                <td colspan="4">
                    <?= $model->comments ?>
                </td>
            </tr>
        </tbody>
    </table>
    <table class="Table">
        <tbody>
        </tbody>

        <tfoot>
            <tr>
                <th class="DarkerBlue" class="font-italic">I confirm that all checks have been carried out:
                </th>
                <td></td>
                <th class="DarkerBlue">Print</th>
                <td><?= $model->signprint ?></td>
                <th class="DarkerBlue">Signed</th>
                <td>
                    <img height="75px" src="<?= $model->signed ?>" />
                </td>
                <th class="DarkerBlue">Date</th>
                <td><?php if ($model->signeddate) {echo date('d/m/Y', strtotime($model->signeddate ));} ?>
                </td>
            </tr>
        </tfoot>
    </table>
</div>

<style>
.dt197-view td{
    padding:10px;
}
</style>
