<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

use yii\helpers\ArrayHelper;
use modules\users\models\User;

/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dt035 */
/* @var $form yii\widgets\ActiveForm */

$yesno = ['Yes' => 'Yes', 'No' => 'No'];
$this->registerJsFile('/js/touch_0.js'); 
$this->registerJsFile('/js/touch_1.js'); 
if ($this->context->action->id == 'update') {$this->registerJsFile('/js/updatesignatures.js');} ?>


<script>
$(function() {
    //init(); //Drawing
    init0(); //canvas_0
    init1(); //canvas_1
    //init2(); //canvas_2
    //init3(); //canvas_3
});
</script>
<div class="dt035-form">
    <style>
    .data {
        background-color: White;

    }
    </style>
    <?php $form = ActiveForm::begin(); ?>

    <table class="table table-borderless">
        <tr>
            <th colspan="2">PPE and Equipment – Periodic Check</th>
            <th colspan="3">Note: All PPE will be checked periodically as a minimum)</th>

        </tr>

        <tr>
            <th>Employee</th>
            <td colspan="2">
                <?= $form->field($model, 'employee')->dropdownlist(User::EmployeesU(), ['prompt' => 'Please Select', 'id' => 'employee'])->label(false) ?>
            </td>
            <th>Job Title:</th>
            <td><?= $form->field($model, 'jobtitle')->textInput()->label(false) ?></td>
            <td>Safety Critical – Yes/No</td>
            <td><?= $form->field($model, 'safetycritical')->dropdownList(['no' => 'NO', 'yes' => 'YES'], ['prompt' => 'Please Select'])->label(false) ?>
            </td>

        </tr>
        <tr class="DarkerBlue">
            <th>ITEM</th>
            <th>Y/N</th>
            <th>ACTION</th>
            <td class="data">&nbsp;</td>
            <th>ITEM</th>
            <th>Y/N</th>
            <th>ACTION</th>
        </tr>
        <tr>
            <th colspan="3">General Items (State of repair, effectiveness, suitability, storage arrangements)</th>
            <td class="data">&nbsp;</td>
            <th colspan="3">High Visibility & Foul Weather Clothing (Cleanliness, effectiveness, condition, storage)
            </th>
        </tr>
        <tr class="DarkerBlue">
            <th><?= $model->getattributeLabel('item0yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item0yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data">
				<?= $form->field($model, 'item0action')->textInput()->label(false) ?>
            </td>
            <td class="data">&nbsp;</td>
            <th colspan="3">
				Approved High Visibility & Foul Weather Clothing - (Bearing ‘InLine’ Logo Where Required):
            </th>
        </tr>

        <tr class="DarkerBlue">
            <th>
			    <?= $model->getattributeLabel('item1yn') ?>
			</th>
            <td class="data">
                <?= $form->field($model, 'item1yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item1action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th><?= $model->getattributeLabel('item25yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item25yn')->dropdownlist($yesno, ['prompt' => 'Please Select', 'windowPadding' => 10])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item25action')->textInput()->label(false) ?></td>
        </tr>

        <tr class="DarkerBlue">
            <th><?= $model->getattributeLabel('item2yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item2yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item2action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th><?= $model->getattributeLabel('item26yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item26yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item26action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th><?= $model->getattributeLabel('item3yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item3yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item3action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th><?= $model->getattributeLabel('item27yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item27yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item27action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th><?= $model->getattributeLabel('item4yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item4yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item4action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th><?= $model->getattributeLabel('item28yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item28yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item28action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th><?= $model->getattributeLabel('item5yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item5yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item5action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th><?= $model->getattributeLabel('item29yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item29yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item29action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th><?= $model->getattributeLabel('item6yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item6yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item6action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th><?= $model->getattributeLabel('item30yn') ?></th>
            <td class="data">
                <?= $form->field($model, 'item30yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item30action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th>Ear defenders</th>
            <td class="data">
                <?= $form->field($model, 'item7yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item7action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th></th>
            <td class="data"></td>
            <td class="data"></td>
        </tr>
        <tr class="DarkerBlue">
            <th>
			<?= $model->getattributeLabel('item8yn') ?>
			</th>
            <td class="data">
                <?= $form->field($model, 'item8yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item8action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th></th>
            <td class="data"></td>
            <td class="data"></td>
        </tr>
        <tr class="DarkerBlue">
            <th>
		        <?= $model->getattributeLabel('item9yn') ?>
            </th>
            <td class="data">
                <?= $form->field($model, 'item9yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item9action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th></th>
            <td class="data"></td>
            <td class="data"></td>
        </tr>
        <tr class="DarkerBlue">
            <th>
			<?= $model->getattributeLabel('item10yn') ?>
			</th>
            <td class="data">
                <?= $form->field($model, 'item10yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item10action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th colspan="3">Publications:</th>
            <td class="data">
        </tr>
        <tr class="DarkerBlue">
            <th>
			<?= $model->getattributeLabel('item11yn') ?>
			</th>
            <td class="data">
                <?= $form->field($model, 'item11yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item11action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th>
			<?= $model->getattributeLabel('item35yn') ?>
			</th>
            <td class="data">
                <?= $form->field($model, 'item35yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item35action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th>
			<?= $model->getattributeLabel('item12yn') ?>
			</th>
            <td class="data">
                <?= $form->field($model, 'item12yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item12action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th>
			<?= $model->getattributeLabel('item36yn') ?>
			</th>
            <td class="data">
                <?= $form->field($model, 'item36yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item36action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th>
			<?= $model->getattributeLabel('item13yn') ?>
			</th>
            <td class="data">
                <?= $form->field($model, 'item13yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item13action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th>
			<?= $model->getattributeLabel('item37yn') ?>
			</th>
            <td class="data">
                <?= $form->field($model, 'item37yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item37action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th>Safety boots – steel toe cap and insoles</th>
            <td class="data">
                <?= $form->field($model, 'item14yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item14action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th>Relevant IT user names and passwords</th>
            <td class="data">
                <?= $form->field($model, 'item38yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item38action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th>Head Torch</th>
            <td class="data">
                <?= $form->field($model, 'item15yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item15action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th>Gate Keys</th>
            <td class="data">
                <?= $form->field($model, 'item39yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item39action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th>Welder I.D. Stamps Plus L/R/T</th>
            <td class="data">
                <?= $form->field($model, 'item16yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item16action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th>Door Keys</th>
            <td class="data">
                <?= $form->field($model, 'item40yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item40action')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th>Rail Wear Gauge</th>
            <td class="data">
                <?= $form->field($model, 'item17yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item17action')->textInput()->label(false) ?></td>
            <td class="data">&nbsp;</td>
            <th>Locker Keys</th>
            <td class="data">
                <?= $form->field($model, 'item41yn')->dropdownlist($yesno, ['prompt' => 'Please Select'])->label(false) ?>
            </td>
            <td class="data"><?= $form->field($model, 'item41action')->textInput()->label(false) ?></td>
        </tr>

    </Table>

    <table class="Table">
        <tr class="DarkerBlue">
            <th rowspan="2">Welder Signed</th>
            <td rowspan="2" class="data">
                <canvas id="canvas_0" class="canvas_0"></canvas>
                <?= Html::button('Reset', [ 'class' => 'btn btn-primary', 'onclick' => 'ClearCanvasX(0);' ]); ?>

            </td>
            <th rowspan="2">Assessor Signed</th>
            <td rowspan="2" class="data"><canvas id="canvas_1" class="canvas_1"></canvas>
                <?= Html::button('Reset', [ 'class' => 'btn btn-primary', 'onclick' => 'ClearCanvasX(1);' ]); ?>
            </td>
            <th>Post Held</th>
            <td class="data"><?= $form->field($model, 'postheld')->textInput()->label(false) ?></td>
        </tr>
        <tr class="DarkerBlue">
            <th>Date</th>
            <td class="data"><?= $form->field($model, 'date')->textInput()->label(false) ?></td>

        </tr>

    </table>



    <?= $form->field($model, 'signature0')->hiddenInput(['id' => 'signature0'])->label(false) ?>
    <?= $form->field($model, 'signature1')->hiddenInput(['id' => 'signature1'])->label(false) ?>
    <?= $form->field($model, 'actid')->hiddenInput()->label(false) ?>
    <?= $form->field($model, 'assessor')->hiddenInput()->label(false) ?>

    <div class="form-group">
        <?= Html::submitButton('Save', ['class' => 'btn btn-primary', 'onclick' => 'saveImages()']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
<script>
x = 0;

function saveImages() {
    while (x <= 1) {
        id = "signature" + x;
        cavid = "canvas_" + x;
        document.getElementById(id).value = document.getElementById(cavid).toDataURL();
        x++
    }
}
</script>