<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use modules\forms\models\Dt022rows;
use modules\custom\models\Accounts;
use modules\users\models\User;
use kartik\date\DatePicker;
use yii\helpers\ArrayHelper;
use kartik\widgets\Select2;
/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dt022 */
/* @var $form yii\widgets\ActiveForm */
$yesno = [1 => 'Yes', 0 => 'No'];
$users = User::Employeesu();
$clients = Accounts::getActive();


if (!$model->date) {$model->date = date('d/m/Y', strtotime('today'));} else {
	$model->date = date('d/m/Y', strtotime($model->date));}
//if (!$model->sentinelno) {$model->sentinelno = yii::$app->user->identity->sentinelno;}
//if (!$model->stampno) {$model->stampno = yii::$app->user->identity->stampno;}
//if (!$model->welder) {$model->welder = yii::$app->user->identity->username;}
if (!$model->jobno) {$model->jobno = Yii::$app->getRequest()->getQueryParam('jobno');}
if (!$model->location) {$model->location = Yii::$app->getRequest()->getQueryParam('location');}
if (!$model->actid) {$model->actid = Yii::$app->getRequest()->getQueryParam('actid');}
if (!$model->client) {$model->client = Yii::$app->getRequest()->getQueryParam('client');}


if ($model->cced2) {$model->cced2 = date('d/m/Y', strtotime($model->cced2));}
if ($model->cced3) {$model->cced3 = date('d/m/Y', strtotime($model->cced3));}
if ($model->cced4) {$model->cced4 = date('d/m/Y', strtotime($model->cced4));}
if ($model->cced5) {$model->cced5 = date('d/m/Y', strtotime($model->cced5));}
if ($model->cced6) {$model->cced6 = date('d/m/Y', strtotime($model->cced6));}
if ($model->cced7) {$model->cced7 = date('d/m/Y', strtotime($model->cced7));}
if ($model->cced8) {$model->cced8 = date('d/m/Y', strtotime($model->cced8));}
if ($model->cced9) {$model->cced9 = date('d/m/Y', strtotime($model->cced9));}
if ($model->cced10) {$model->cced10 = date('d/m/Y', strtotime($model->cced10));}
if ($model->cced11) {$model->cced11 = date('d/m/Y', strtotime($model->cced11));}
		

if ($model->ffused1) {$model->ffused1 = date('d/m/Y', strtotime($model->ffused1));}		
if ($model->ffused2) {$model->ffused2 = date('d/m/Y', strtotime($model->ffused2));}		
if ($model->ffused3) {$model->ffused3 = date('d/m/Y', strtotime($model->ffused3));}		
if ($model->ffused4) {$model->ffused4 = date('d/m/Y', strtotime($model->ffused4));}		
if ($model->ffused5) {$model->ffused5 = date('d/m/Y', strtotime($model->ffused5));}		
if ($model->ffused6) {$model->ffused6 = date('d/m/Y', strtotime($model->ffused6));}		
if ($model->ffused7) {$model->ffused7 = date('d/m/Y', strtotime($model->ffused7));}		
if ($model->ffused8) {$model->ffused8 = date('d/m/Y', strtotime($model->ffused8));}		
if ($model->ffused9) {$model->ffused9 = date('d/m/Y', strtotime($model->ffused9));}		
if ($model->ffused10) {$model->ffused10 = date('d/m/Y', strtotime($model->ffused10));}		
if ($model->ffused11) {$model->ffused11 = date('d/m/Y', strtotime($model->ffused11));}		
if ($model->ffused12) {$model->ffused12 = date('d/m/Y', strtotime($model->ffused12));}		
if ($model->ffused13) {$model->ffused13 = date('d/m/Y', strtotime($model->ffused13));}		
if ($model->ffused14) {$model->ffused14 = date('d/m/Y', strtotime($model->ffused14));}		
if ($model->ffused15) {$model->ffused15 = date('d/m/Y', strtotime($model->ffused15));}		
		



//$this->registerJsFile('/js/touch.js'); 
$this->registerJsFile('/js/touch_0.js'); 
$this->registerJsFile('/js/touch_1.js'); 
//$this->registerJsFile('/js/touch_2.js'); 
//$this->registerJsFile('/js/touch_3.js');
?>
<script>
$(function() {
    var canvas0 = document.getElementById('canvas_0');
    if (canvas0) {
        var context0 = canvas0.getContext('2d');
        var imagesrc0 = '<?= $model->auditorsign ?>';
        var image0 = new Image();
        image0.src = imagesrc0
        context0.drawImage(image0, 0, 0);
    }

    var canvas1 = document.getElementById('canvas_1');
    if (canvas1) {
        var context1 = canvas1.getContext('2d');
        var imagesrc1 = '<?= $model->auditoredsign ?>';
        var image1 = new Image();
        image1.src = imagesrc1
        context1.drawImage(image1, 0, 0);
    }
    //init(); //Drawing
    init0(); //canvas_0
    init1(); //canvas_1
    //init2(); //canvas_2
    //init3(); //canvas_3


});


function update(id, field, content) {
    $.ajax({
            type: "POST",
            url: "/dt022/updaterow",
            data: {
                id: id,
                field: field,
                content: content
            },
        })
        .done(function(result) {
            if (result == 'Updated') {
                data = "<div>Updated</div>"
            } else {
                data = result;
            }
            $('#message').html(data);
            $('#flashmessage').delay(500).fadeIn('normal', function() {
                $(this).delay(2500).fadeOut();



            });
        });
}
</script>
<?php if ($this->context->action->id == 'update') {$this->registerJsFile('/js/updatesignatures.js', ['position' => Yii\web\view::POS_END]);} ?>
<style>
.data {
    background-color: #FFF;
}
</style>

<div class="dt022-form">

    <?php $form = ActiveForm::begin(); ?>
    <div class="row">
        <div class="col-md-2 DarkerBlueC">Date</div>
        <div class="col-sm-3 col-md-3 DarkerBlueC">Location</div>
        <div class="col-sm-3 col-md-3 DarkerBlueC">Welders Name</div>
        <div class="col-md-1 DarkerBlueC">Stamp No</div>
        <div class="col-sm-3 col-md-3 DarkerBlueC">Welders Assistant</div>
    </div>
    <div class="row">
        <div class="col-md-2 data"><?= $form->field($model, 'date')->textInput()->label(false) ?></div>
        <div class="col-sm-3 col-md-3 data"><?= $form->field($model, 'location')->textInput()->label(false) ?></div>
        <div class="col-sm-3 col-md-3 data">
            <?= $form->field($model, 'welder')->dropdownlist($users, ['prompt' => 'Please Select', 'id' => 'welder'])->label(false) ?>
        </div>

        <script>
        $('#welder').change(function() {
            $.ajax({
                type: 'get',
                url:'/user/userdata', 
                data: {
                    username: $(this).val(),
                }, 
                success: function(result, b, c) {
                    //var data = $.parseJSON(result);
                    //console.log(result.stampno);
                    $('#sentinelno').val(result.sentinelno);
                    $('#stampno').val(result.stampno);
                }
            })
        });
        </script>

        <div class="col-md-1 data"><?= $form->field($model, 'stampno')->textInput(['id' => 'stampno'])->label(false) ?>
        </div>
        <div class="col-sm-3 col-md-3 data">
            <?= $form->field($model, 'weldersasst')->dropdownlist($users, ['prompt' => 'Please Select'])->label(false) ?>
        </div>
    </div>
    <div class="row DarkerBlue">
        <div class="col-sm-3 col-md-3">Job No</div>
        <div class="col-sm-3 col-md-3 data"><?= $form->field($model, 'jobno')->textInput()->label(false) ?></div>
        <div class="col-sm-3 col-md-3">Sentinel No</div>
        <div class="col-sm-3 col-md-3 data">
            <?= $form->field($model, 'sentinelno')->textInput(['id' => 'sentinelno'])->label(false) ?></div>
    </div>
    <div class="row DarkerBlue">Work Description</div>
    <div class="row DarkerBlue"><?= $form->field($model, 'workdescription')->textArea()->label(false) ?></div>
    <div class="row">
        <div class="col-md-6 DarkerBlueC"> Competency Certificates Valid</div>
        <div class="col-md-6 DarkerBlueC">Correct PPE Worn</div>
    </div>
    <div class="row">
        <div class="col-md-1 DarkerBlueC">Skill</div>
        <div class="col-md-5 DarkerBlueC">Expiry Date</div>
        <div class="col-md-6 DarkerBlue">&nbsp;</div>
    </div>
    <div class="row">
        <div class="col-sm-6 col-md-6">
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">&nbsp;</div>
                <div class="col-sm-6 col-md-6 data">&nbsp;</div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Sentinel PTS</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced2')->widget(DatePicker::class, ['type' => 1, 'name'=>'cced2', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Sentinel Welders</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced3')->widget(DatePicker::class, ['type' => 1, 'name'=>'ccd3', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Abrasive Wheels</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced4')->widget(DatePicker::class, ['type' => 1, 'name'=>'cced4', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Rail Grinder</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced5')->widget(DatePicker::class, ['type' => 1, 'name'=>'cced5', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Angle Grinder</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced6')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Needle Gun</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced7')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Electric Generator</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced8')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Weld Trimmer</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced9')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Rail Saw</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced10')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 ">Stressing Equipment</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'cced11')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
        </div>
        <div class="col-sm-6 col-md-6">
            <div class="row">
                <div class="col-sm-6 col-md-6 DarkerBlue">&nbsp;</div>
                <div class="col-sm-6 col-md-6 DarkerBlueC">Yes/No</div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Flame Retardent Overalls</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe1')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Flame Retardent Foul Weather</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe2')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Hard Hat</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe3')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Welders Gauntlets</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe4')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Fatigue Gloves</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe5')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Steel Toe Cap Welders Boots</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe6')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Clear Goggles & Blast Mask</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe7')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Shaded Goggles GW5 (welding)</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe8')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Ear Defenders</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe9')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Head Torch</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'ppe11')->dropDownList($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>

        </div>
    </div>
    <div class="row">
        <div class="col-sm-6 col-md-6 ">

            <div class="row">
                <div class="DarkerBlueC">Type of Welding</div>

            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 ">Railtech</div>
                <div class="col-sm-6 col-md-6 data"><?= $form->field($model, 'twrailtech')->textInput()->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 ">Thermit</div>
                <div class="col-sm-6 col-md-6 data"><?= $form->field($model, 'twtermit')->textInput()->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 ">Standard Gap</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'twstandardgap')->textInput()->label(false) ?></div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">Wide Gap</div>
                <div class="col-sm-6 col-md-6 data"><?= $form->field($model, 'twwidegap')->textInput()->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6">MMA</div>
                <div class="col-sm-6 col-md-6 data"><?= $form->field($model, 'twmma')->textInput()->label(false) ?>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6 col-md-6"></div>
                <div class="col-sm-6 col-md-6"></div>
            </div>
            <div class="row">
                <div class="col-sm-6 col-md-6"></div>
                <div class="col-sm-6 col-md-6"></div>
            </div>
            <div class="row">
                <div class="col-sm-6 col-md-6 "></div>
                <div class="col-sm-6 col-md-6"></div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-12 DarkerBlueC">Track Conditions</div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Track Type</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'tc1')->dropdownlist(['S & C' => 'S & C', 'Plain Line' =>  'Plain Line'], ['prompt' => 'Please Select' ])->label(false) ?>
                </div>

            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Current Type</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'tc2')->dropdownlist(['AC' => 'AC','DC' => 'DC'], ['prompt' => 'Please Select' ])->label(false) ?>
                </div>

            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Work in Tunnel</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'tc3')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>

            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Work in Platform</div>
                <div class="col-sm-6 col-md-6 data">
                    <?= $form->field($model, 'tc4')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>

            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Sleeper Type</div>
                <div class="col-sm-6 col-md-6 data"><?= $form->field($model, 'tc5')->textInput()->label(false) ?></div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Fastening Type</div>
                <div class="col-sm-6 col-md-6 data"><?= $form->field($model, 'tc6')->textInput()->label(false) ?></div>

            </div>
            <div class="row DarkerBlue">
                <div class="DarkerBlueC">Rail Details</div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">&nbsp;</div>
                <div class="col-sm-3 col-md-3">LH Rail</div>
                <div class="col-sm-3 col-md-3">RH Rail</div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Rail Section</div>
                <div class="col-sm-3 col-md-3 data"><?= $form->field($model, 'rs1')->textInput()->label(false) ?></div>
                <div class="col-sm-3 col-md-3 data"><?= $form->field($model, 'rs2')->textInput()->label(false) ?></div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Rail Type</div>
                <div class="col-sm-3 col-md-3 data"><?= $form->field($model, 'rt1')->textInput()->label(false) ?></div>
                <div class="col-sm-3 col-md-3 data"><?= $form->field($model, 'rt2')->textInput()->label(false) ?></div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 col-md-6 DarkerBlue">Rail Wear</div>
                <div class="col-sm-3 col-md-3 data"><?= $form->field($model, 'tw1')->textInput()->label(false) ?></div>
                <div class="col-sm-3 col-md-3 data"><?= $form->field($model, 'rw2')->textInput()->label(false) ?></div>
            </div>
        </div>
        <div class="col-sm-6 col-md-6">
            <div class="row DarkerBlueC">
                <div class="col-sm-9">Equipment Fit For Use and in Date</div>
                <div class="col-sm-3">Service Expiry Date</div>
                <div class="row">
                    <div class="col-sm-4"></div>
                    <div class="col-sm-2">Yes/No</div>
                    <div class="col-sm-3">Item ID No</div>
                </div>

            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Oxy/Fuel Gas</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu1')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid1')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused1')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">1mtr Straight Edge</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu2')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid2')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused2')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Rail Wear Gauge</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu3')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid3')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused3')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Engineers Square</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu4')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid4')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused4')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Rail Grinder</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu5')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid5')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused5')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Angle Grinder</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu6')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid6')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused6')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Needle Gun</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu7')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid7')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused7')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Electric Generator </div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu8')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid8')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused8')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Weld Trimmer</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu9')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid9')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused9')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Stressing Equipment</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu10')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid10')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused10')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Track Trolley</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu11')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid11')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused11')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-4 DarkerBlue">Welding Equipment</div>
                <div class="col-sm-2 data">
                    <?= $form->field($model, 'ffu12')->dropdownlist($yesno, ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
                <div class="col-sm-3 data"><?= $form->field($model, 'ffuid12')->textInput()->label(false) ?></div>
                <div class="col-sm-3 data">
                    <?= $form->field($model, 'ffused12')->widget(DatePicker::class, ['type' => 1, 'name'=>'dateofbirth', 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-4">&nbsp;</div>
                <div class="col-sm-2"></div>
                <div class="col-sm-3"></div>
                <div class="col-sm-3"></div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 DarkerBlue">Rail End Preperation</div>
                <div class="col-sm-6 data">
                    <?= $form->field($model, 'rep1')->DropdownList(['Gas Cut' => 'Gas Cut', 'Disc Sawn' =>  'Disc Sawn'], ['prompt' => 'Please Select' ])->label(false) ?>
                </div>
            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-6 DarkerBlueC">If Gas Cut What Type of Fuel? </div>
                <div class="col-sm-6 data">
                    <?= $form->field($model, 'gasfuel')->DropdownList(['Propane' => 'Propane', 'Acetylene' => 'Acetylene'], ['prompt' => 'Please Select' ])->label(false) ?>
                </div>

            </div>
            <div class="row DarkerBlue">
                <div class="col-sm-12 DarkerBlueC">Comments</div>
            </div>
            <div class="row">
                <div class="">
                    <?= $form->field($model, 'comments')->textArea()->label(false) ?>
                </div>
            </div>
        </div>
    </div>
    <div class="row DarkerBlue">

        <div class="col-md-2 DarkerBlueC">Name Of Client</div>
        <div class="col-md-4 data"><?= $form->field($model, 'client')->dropdownlist($clients, ['prompt' => 'Please Select'])->label(false) ?></div>
        <div class="col-md-2 DarkerBlueC">Area</div>
        <div class="col-md-4 data"><?= $form->field($model, 'area')->textInput()->label(false) ?></div>

    </div>


    <div class="row h2 text-center">
        Health and Safety
    </div>
    <!-- advanced section with multiple add -->

    <div class="row">
        <div class="col-sm-5 col-md-5 DarkerBlueC"><span class="float-left">Item No </span> Subject</div>
        <div class="col-sm-2 col-md-2 DarkerBlueC">Yes/No</div>
        <div class="col-sm-5 col-md-5 DarkerBlueC">Comments</div>
    </div>
        <?php $x = 1 ?>
        <?php while( $x <= 79)  { ?>
            <?php $field = 'response'.$x; ?>
            <?php $fieldcomment = 'repsonsecomment'.$x; ?>
            <?= $field == 'response1' ? '<div class="row"><div class="col-12 DarkerBlue">ON SITE PROCEDURES</div></div>' : false ?>
            <?= $field == 'response10' ? '<div class="row"><div class="col-12 DarkerBlue">WORK ON OR NEAR THE LINE</div></div>' : false ?>
            <?= $field == 'response20' ? '<div class="row"><div class="col-12 DarkerBlue">SIGNS</div></div>' : false ?>
            <?= $field == 'response25' ? '<div class="row"><div class="col-12 DarkerBlue">ACCESS AND EGRESS</div></div>' : false ?>
            <?= $field == 'response30' ? '<div class="row"><div class="col-12 DarkerBlue">WELFARE</div></div>' : false ?>
            <?= $field == 'response35' ? '<div class="row"><div class="col-12 DarkerBlue">HAZARDOUS MATERIALS</div></div>' : false ?>
            <?= $field == 'response40' ? '<div class="row"><div class="col-12 DarkerBlue">WASTE</div></div>' : false ?>
            <?= $field == 'response45' ? '<div class="row"><div class="col-12 DarkerBlue">SECURITY</div></div>' : false ?>
            <?= $field == 'response50' ? '<div class="row"><div class="col-12 DarkerBlue">FIRE PRECAUTIONS</div></div>' : false ?>
            <?= $field == 'response55' ? '<div class="row"><div class="col-12 DarkerBlue">HOT WORK</div></div>' : false ?>
            <?= $field == 'response60' ? '<div class="row"><div class="col-12 DarkerBlue">NOISE</div></div>' : false ?>
            <?= $field == 'response65' ? '<div class="row"><div class="col-12 DarkerBlue">ELECTRICITY AND OTHER SERVICES</div></div>' : false ?>
            <?= $field == 'response70' ? '<div class="row"><div class="col-12 DarkerBlue">HEALTH & WELLBEING</div></div>' : false ?>
            <?php if($model->getAttributelabel($field) !== $field) { ?>
                <div class="row">
                    <div class="col-sm-5 col-md-5"> 
                    <?= $model->getAttributelabel($field);  ?>
                    </div>
                    <div class="col-sm-2 col-md-2">
                        <?= $form->field($model, $field)->dropdownlist($yesno,  ['prompt' => 'Please Select'])->Label(false) ?>
                    </div>
                    <div class="col-sm-5 col-md-5">
                        <?= $form->field($model, $fieldcomment)->textInput([])->Label(false) ?>
                    </div>
                </div>
            
            <?php } ?>
            <?php $x++ ?>
        <?php } ?>
    </div>

    <div class="row h2 text-center">
    Welding Standards
    </div>
    <!-- advanced section with multiple add -->

    <div class="row">
        <div class="col-sm-5 col-md-5 DarkerBlueC"><span class="float-left">Item No </span> Subject</div>
        <div class="col-sm-2 col-md-2 DarkerBlueC">Yes/No</div>
        <div class="col-sm-5 col-md-5 DarkerBlueC">Comments</div>
    </div>
        <?php $x = 80 ?>
        <?php while( $x < 149)  { ?>
            <?php $field = 'response'.$x; ?>
            <?php $fieldcomment = 'repsonsecomment'.$x; ?>
            <?= $field == 'response80' ? '<div class="row"><div class="col-12 DarkerBlue">ON SITE PROCEDURES</div></div>' : false ?>
            <?= $field == 'response85' ? '<div class="row"><div class="col-12 DarkerBlue">WORK ON OR NEAR THE LINE</div></div>' : false ?>
            <?= $field == 'response90' ? '<div class="row"><div class="col-12 DarkerBlue">SIGNS</div></div>' : false ?>
            <?= $field == 'response95' ? '<div class="row"><div class="col-12 DarkerBlue">ACCESS AND EGRESS</div></div>' : false ?>
            <?= $field == 'response100' ? '<div class="row"><div class="col-12 DarkerBlue">WELFARE</div></div>' : false ?>
            <?= $field == 'response105' ? '<div class="row"><div class="col-12 DarkerBlue">HAZARDOUS MATERIALS</div></div>' : false ?>
            <?= $field == 'response110' ? '<div class="row"><div class="col-12 DarkerBlue">WASTE</div></div>' : false ?>
            <?= $field == 'response115' ? '<div class="row"><div class="col-12 DarkerBlue">SECURITY</div></div>' : false ?>
            <?= $field == 'response120' ? '<div class="row"><div class="col-12 DarkerBlue">FIRE PRECAUTIONS</div></div>' : false ?>
            <?= $field == 'response130' ? '<div class="row"><div class="col-12 DarkerBlue">HOT WORK</div></div>' : false ?>
            <?= $field == 'response135' ? '<div class="row"><div class="col-12 DarkerBlue">NOISE</div></div>' : false ?>
            <?= $field == 'response141' ? '<div class="row"><div class="col-12 DarkerBlue">ELECTRICITY AND OTHER SERVICES</div></div>' : false ?>
            <?= $field == 'response145' ? '<div class="row"><div class="col-12 DarkerBlue">HEALTH & WELLBEING</div></div>' : false ?>
            <?php if($model->getAttributelabel($field) !== $field) { ?>
                <div class="row">
                    <div class="col-sm-5 col-md-5"> 
                    <?= $model->getAttributelabel($field);  ?>
                    </div>
                    <div class="col-sm-2 col-md-2">
                        <?= $form->field($model, $field)->dropdownlist($yesno,  ['prompt' => 'Please Select'])->Label(false) ?>
                    </div>
                    <div class="col-sm-5 col-md-5">
                        <?= $form->field($model, $fieldcomment)->textInput([])->Label(false) ?>
                    </div>
                </div>
            
            <?php } ?>
            <?php $x++ ?>
        <?php } ?>
    </div>

    <div class="row h2 text-center">
    Welding Standards
    </div>
    <!-- advanced section with multiple add -->

    <div class="row">
        <div class="col-sm-5 col-md-5 DarkerBlueC"><span class="float-left">Item No </span> Subject</div>
        <div class="col-sm-2 col-md-2 DarkerBlueC">Yes/No</div>
        <div class="col-sm-5 col-md-5 DarkerBlueC">Comments</div>
    </div>
        <?php $x = 149 ?>
        <?php while( $x <= 160)  { ?>
            <?php $field = 'response'.$x; ?>
            <?php $fieldcomment = 'repsonsecomment'.$x; ?>
            <?php if($model->getAttributelabel($field) !== $field) { ?>
                <div class="row">
                    <div class="col-sm-5 col-md-5"> 
                    <?= $model->getAttributelabel($field);  ?>
                    </div>
                    <div class="col-sm-2 col-md-2">
                        <?= $form->field($model, $field)->dropdownlist($yesno,  ['prompt' => 'Please Select'])->Label(false) ?>
                    </div>
                    <div class="col-sm-5 col-md-5">
                        <?= $form->field($model, $fieldcomment)->textInput([])->Label(false) ?>
                    </div>
                </div>
            
            <?php } ?>
            <?php $x++ ?>
        <?php } ?>
    </div>

    <!-- End comments -->
    <div class="row DarkerBlueC">Additional Site Audit Comment</div>
    <div class="row"><?= $form->field($model, 'addcomments')->textArea()->label(false) ?></div>


    <div class="row">
        <div class="col-md-2 DarkerBlue">Name Of Person being Audited</div>
        <div class="col-md-4"><?= $model->welder ?></div>
        <div class="col-md-2 DarkerBlue">Name Of Person Auditing</div>
        <div class="col-md-4"><?= $form->field($model, 'advcomments')->textInput()->label(false) ?> </div>
    </div>
</div>
<table class="Table">
    <tr>
        <th class="DarkerBlue">Signature of Persons being Audited</th>
        <th class="DarkerBlue">Auditor Signature</th>
    </tr>
    <tr>
        <td>
            <canvas id="canvas_1" class="canvas_1"></canvas>
            <?= Html::button('Reset', [ 'class' => 'btn btn-primary', 'onclick' => 'ClearCanvasX(1);' ]); ?>
            <?= $form->field($model, 'auditoredsign')->hiddenInput(['id' => 'signature1'])->label(false) ?>
        </td>

        <td>
            <canvas id="canvas_0" class="canvas_0"></canvas>
            <?= Html::button('Reset', [ 'class' => 'btn btn-primary', 'onclick' => 'ClearCanvasX(0);' ]); ?>
            <?= $form->field($model, 'auditorsign')->hiddenInput(['id' => 'signature0'])->label(false) ?>
        </td>
    </tr>
</table>





<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>