<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\bootstrap4\Modal;
use yii\helpers\ArrayHelper;
use kartik\time\TimePicker;
use kartik\date\DatePicker;
//data from other models
Use backend\models\Attributesvalues; //drop down options
use modules\custom\models\Accounts;  //client accounts
use modules\users\models\User;

//typeahead for wear
use kartik\typeahead\TypeaheadBasic;
use kartik\typeahead\Typeahead;
$wear = Attributesvalues::formArray('wear');
/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dt126 */
/* @var $form yii\widgets\ActiveForm */
//$form = ActiveForm::begin() 

$users = \frontend\models\User::EmployeesU();
$milemeters = Attributesvalues::formArray('milemeters');
$yardschain = Attributesvalues::formArray('yardschain');
$yesno = Attributesvalues::formArray('yesno');
$contype = Attributesvalues::formArray('dt125contype');
$condiameter  = Attributesvalues::formArray('dt125condiameter');
$passfail = Attributesvalues::formArray('passfail');
$process = Attributesvalues::formArray('process');
$railsection = Attributesvalues::formArray('railsection'); 
$dt123grade = Attributesvalues::formArray('dt123grade');
$dt125preheater = Attributesvalues::formArray('dt125preheater');
$dt125generator = Attributesvalues::formArray('dt125generator');
$dt125wfu = Attributesvalues::formArray('dt125wfu');

$mmappend = '<div class="input-group-append"><span class="input-group-text">mm</span></div>';

$this->registerJsFile('/js/touch.js'); //load canvas drawing 
//$this->registerJsFile('/js/touch_0.js'); //load canvas drawing 
$this->registerJsFile('/js/touch_1.js');//load canvas_1 
//$this->registerJsFile('/js/touch_2.js'); //load canvas_2 
//$this->registerJsFile('/js/touch_3.js'); //load canvas_3
$this->registerJsFile('/js/updatesignatures.js'); ?>
<script>
$(function() {
    init(); //Drawing
    //	init0(); //Drawing
    init1(); //canvas_1
    //	init2(); //canvas_2
    //	init3(); //canvas_3
});
</script>

<div class="dt126-form">
    <?php $form = ActiveForm::begin(); ?>
    <table>
        <tr>
            <td colspan="2"><img src="/images/logo.jpg" alt="inline"></td>
            <td class="Title"><?= $model->formname ?></td>
        </tr>
    </table>
    <div hidden="yes">
        <?= $form->field($model, 'weekno') ?>
    </div>


    <table class="Table">
        <tr class="DarkerBlueC">
            <td width="25%">Installation Date</td>
            <td width="25%">Welder's Name (Print)</td>
            <td width="25%">Welding Assistant's Name</td>
            <td width="25%">Inline Job Cost No.</td>
        </tr>
        <tr>
            <td><?= $form->field($model, 'insdate')->widget(DatePicker::class, ['type' => 1, 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label(false) ?>
            </td>
            <td colspan="">
                <?=$form->field($model, 'weldersname')->dropdownlist($users, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td colspan="">
                <?=$form->field($model, 'weldersasstname')->dropdownlist($users, ['prompt' => 'Please Select'])->label(false)?>
            </td>
            <td><?= $form->field($model, 'inlinejobcostno')->textInput(['maxlength' => 100, 'id' => 'injobno']) ->label(false)?>
            </td>
        </tr>
        <tr class="DarkerBlueC">
            <td>Area</td>
            <td>Work Site Location</td>
            <td>Start Time</td>
            <td>Finish Time</td>
        </tr>
        <tr>
            <td><?= $form->field($model, 'area')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'worksitelocation')->textInput(['maxlength' => 100, 'id'=> 'location']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'starttime')->widget(TimePicker::class, ['disabled' => true, 'pluginOptions' => ['showMeridian' => false, 'defaultTime' => '00:00']])->label(false);?>
            </td>
            <td><?= $form->field($model, 'finishtime')->widget(TimePicker::class, ['disabled' => true, 'pluginOptions' => ['showMeridian' => false, 'defaultTime' => '00:00']])->label(false);?>
            </td>
        </tr>

        <tr class="DarkerBlueC">
            <td>Client </td>
            <td>Process Used <span class="fa fa-plus btn-attributes float-right" data-value="process"></span></td>
            <td>Travel Time To Site</td>
            <td>Travel Time From Site</td>
        </tr>
        <tr>
            <td><?= $form->field($model, 'client')->dropDownList(Accounts::getActive(), ['readonly' => 'true', 'id' => 'client', 'prompt' => 'Please Select' ]) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'processused')->dropDownList($process, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'timetosite')->widget(TimePicker::class, ['disabled' => true, 'pluginOptions' => ['showMeridian' => false, 'defaultTime' => '00:00']])->label(false);?>
            </td>
            <td><?= $form->field($model, 'timefromsite')->widget(TimePicker::class, ['disabled' => true, 'pluginOptions' => ['showMeridian' => false, 'defaultTime' => '00:00']])->label(false);?>
            </td>
        </tr>
        
    </table>
    <table class="Table">
        <tr class="DarkerBlueC">
            <td>Location</td>
            <td>GPS Co-Ordinates</td>
            <td>ELR</td>
            <td>Track ID</td>
            <td>Mileage</td>
            <td>Points No.</td>
            <td>Switch L/H R/H</td>
            <td>Facing/Trailing</td>
            <td>Rail Section <span class="fa fa-plus btn-attributes float-right" data-value="railsection"></span></td>
            <td>Rail Grade <span class="fa fa-plus btn-attributes float-right" data-value="dt123grade"></span></td>
        </tr>
        <tr>
            <td><?= $form->field($model, 'location')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gps')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'trackid')->textInput([]) ->label(false)?></td>
            <td>
                <table class="Table">
                    <tr>
                        <td><?= $form->field($model, 'mileage')->textInput(['maxlength' => 100]) ->label(false)?></td>
                        <td><?= $form->field($model, 'mileageb')->dropdownList($milemeters, [ 'prompt' => 'Please Select...'])->label(false) ?>
                        </td>
                        <td><?= $form->field($model, 'mileagec')->textInput(['maxlength' => 100]) ->label(false)?></td>
                        <td><?= $form->field($model, 'mileaged')->dropdownList($yardschain, [ 'prompt' => 'Please Select...'])->label(false) ?>
                        </td>

                    </tr>
                </table>
            </td>
            <td><?= $form->field($model, 'pointsno')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'switch')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'facetrail')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'railsec')->dropDownList($railsection, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'railgrade')->dropDownList($dt123grade, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
        </tr>
    </table>
    <table class="Table">
        <tr class="DarkerBlue">
            <td colspan="13">NR/L2/TRK/0053 ASSESSMENT DETAILS</td>
        </tr>
        <tr>
            <td colspan="5" class="DarkerBlue">Extent of damage repair required</td>
            <td class="DarkerBlue"></td>
            <td class="DarkerBlue"></td>
            <td class="DarkerBlue"></td>
            <td class="DarkerBlue"></td>
            <td class="DarkerBlue"></td>
            <td class="DarkerBlue">LENGTH</td>
            <td>
                <?=$form->field($model, 'damlength', ['template' =>  '{input}{hint}{error}'. $mmappend, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
        </tr>
        <tr>
            <td colspan="5" class="DarkerBlue">Extent of sidewear repair to stock rail front required</td>
            <td class="DarkerBlueC">STEP NO</td>
            <td><?= $form->field($model, 'frontstepno')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td class="DarkerBlue">ANGLE</td>
            <td colspan="2"><?= $form->field($model, 'frontangle')->textInput([]) ->label(false)?></td>
            <td class="DarkerBlue">LENGTH</td>
            <td>
                <?=$form->field($model, 'frontlength', ['template' =>  '{input}{hint}{error}'. $mmappend, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
        </tr>
        </tr>
        <tr>
            <td colspan="5" class="DarkerBlue">Extent of sidewear repair to stock rail behind switchblade required</td>
            <td class="DarkerBlue"></td>
            <td class="DarkerBlue"></td>
            <td class="DarkerBlue">ANGLE</td>
            <td colspan="2"><?= $form->field($model, 'behindangle')->textInput([]) ->label(false)?></td>
            <td class="DarkerBlue">LENGTH</td>
            <td>
                <?=$form->field($model, 'behindlength', ['template' =>  '{input}{hint}{error}'. $mmappend, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
        </tr>
        <tr>
            <td colspan="5" class="DarkerBlue">Extent of sidewear repair to switchblade required</td>
            <td class="DarkerBlue"> </td>
            <td class="DarkerBlue"> </td>
            <td class="DarkerBlue">ANGLE</td>
            <td colspan="2"><?= $form->field($model, 'repairangle')->textInput([])->label(false)?></td>
            <td class="DarkerBlue">LENGTH</td>
            <td>
                <?=$form->field($model, 'repairlength', ['template' =>  '{input}{hint}{error}'. $mmappend, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
        </tr>
    </table>
    <table class="Table">
        <tr class="DarkerBlueC">
            <td>VERTICAL DISTORTION</td>
            <td>toe</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
            <td>6</td>
            <td>7</td>
            <td>8</td>
            <td>9</td>
            <td>10</td>
            <td>11</td>
            <td>12</td>
            <td>13</td>
            <td>14</td>
            <td>Inspected By</td>
        </tr>
        <tr>
            <td class="DarkerBlue">Initial Inspection</td>
            <td><?= $form->field($model, 'vdiitoe')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii9')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii10')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii11')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii12')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii13')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdii14')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdiiinsby')->textInput(['maxlength' => 100]) ->label(false)?></td>

        </tr>
        <tr>
            <td class="DarkerBlue">Pre-welding Inspection</td>
            <td><?= $form->field($model, 'vdprewitoe')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi9')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi10')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi11')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi12')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi13')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewi14')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdprewiinsby')->textInput(['maxlength' => 100]) ->label(false)?></td>

        </tr>
        <tr>
            <td class="DarkerBlue">Post-welding Inspection</td>
            <td><?= $form->field($model, 'vdpostwitoe')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi9')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi10')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi11')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi12')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi13')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwi14')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdpostwiinsby')->textInput(['maxlength' => 100]) ->label(false)?></td>

        </tr>
        <tr>
            <td class="DarkerBlue">Follow Up Inspection</td>
            <td><?= $form->field($model, 'vdfupitoe')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi9')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi10')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi11')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi12')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi13')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupi14')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'vdfupiinsby')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>

        <tr class="DarkerBlueC">
            <td>SIDEWEAR ANGLE</td>
            <td>toe</td>
            <td>2</td>
            <td>3</td>
            <td>4</td>
            <td>5</td>
            <td>6</td>
            <td>7</td>
            <td>8</td>
            <td>9</td>
            <td>10</td>
            <td>11</td>
            <td>12</td>
            <td>13</td>
            <td>14</td>
            <td>Inspected By</td>
        </tr>

        <tr>
            <td class="DarkerBlue">Initial Inspection</td>
            <td><?= $form->field($model, 'swiitoe')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii9')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii10')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii11')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii12')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii13')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swii14')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swiiinsby')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Pre-welding Inspection</td>
            <td><?= $form->field($model, 'swprewitoe')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi9')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi10')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi11')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi12')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi13')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewi14')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swprewiinsby')->textInput(['maxlength' => 100]) ->label(false)?></td>

        </tr>
        <tr>
            <td class="DarkerBlue">Post-welding Inspection</td>
            <td><?= $form->field($model, 'swpostwitoe')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi9')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi10')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi11')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi12')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi13')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwi14')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swpostwiinsby')->textInput(['maxlength' => 100]) ->label(false)?></td>

        </tr>
        <tr>
            <td class="DarkerBlue">Follow Up Inspection</td>
            <td><?= $form->field($model, 'swfupitoe')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi9')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi10')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi11')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi12')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi13')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupi14')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'swfupiinsby')->textInput(['maxlength' => 100]) ->label(false)?></td>

        </tr>


    </table>

    <table class="Table">
        <tr class="DarkerBlueC">
            <td></td>
            <td colspan="5">Switch Details</td>
            <td colspan="6">Welding Details</td>
        </tr>
        <tr class="DarkerBlueC">
            <td>Repair No.</td>
            <td>Type</td>
            <td>Design</td>
            <td>Angle</td>
            <td>Component</td>
            <td>Defect No.</td>
            <td>Repair Type</td>
            <td>Length</td>
            <td>Depth</td>
            <td>Preheat Temp</td>
            <td>Type <span class="fa fa-plus btn-attributes float-right" data-value="contype"></span></td>
            <td>Size <span class="fa fa-plus btn-attributes float-right" data-value="condiameter"></span></td>
        </tr>

        <tr>
            <td class="DarkerBlueC">1</td>
            <td><?= $form->field($model, 'type1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'design1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'angle1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'component1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectno1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'repairtype1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'length1')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'depth1')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>

            <td>

                <?php $tempappend = '<div class="input-group-append">
					<span class="input-group-text">
					&ordm;C
					</span>
					</div>'; ?>
                <?=$form->field($model, 'preheattemp1', ['template' =>  '{input}{hint}{error}'. $tempappend, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>


            </td>
            <td><?= $form->field($model, 'contype1')->dropDownList($contype, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consize1')->dropDownList($condiameter, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">2</td>
            <td><?= $form->field($model, 'type2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'design2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'angle2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'component2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectno2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'repairtype2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'length2')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'depth2')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td>
                <?=$form->field($model, 'preheattemp2', ['template' =>  '{input}{hint}{error}'. $tempappend, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
            <td><?= $form->field($model, 'contype2')->dropDownList($contype, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consize2')->dropDownList($condiameter, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">3</td>
            <td><?= $form->field($model, 'type3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'design3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'angle3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'component3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectno3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'repairtype3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'length3')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'depth3')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td>
                <?=$form->field($model, 'preheattemp3', ['template' =>  '{input}{hint}{error}'. $tempappend, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
            <td><?= $form->field($model, 'contype3')->dropDownList($contype, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consize3')->dropDownList($condiameter, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue" colspan="6" rowspan="1">Welders Comments</td>
            <td class="DarkerBlue" rowspan="1" colspan="6">Equipment Serial Numbers</td>
        </tr>
        <tr class="DarkerBlue">
            <td colspan="6" rowspan="2">
                <?= $form->field($model, 'welderscomments')->textArea(['rows' => 4,]) ->label(false)?></td>
            <td colspan="2">Pre heater <span class="fa fa-plus btn-attributes float-right" data-value="dt123preheater"></span></td>
            <td colspan="2">Generator <span class="fa fa-plus btn-attributes float-right" data-value="dt125generator"></span></td>
            <td colspan="2">WFU <span class="fa fa-plus btn-attributes float-right" data-value="dt125wfu"></span></td>
        </tr>
        <tr>
            <td colspan="2">
                <?= $form->field($model, 'preheater')->dropDownList($dt125preheater, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            
            <td colspan="2">
                <?= $form->field($model, 'generator')->dropDownList($dt125generator, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'wfu')->dropDownList($dt125wfu, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
        <tr></tr>
        <tr></tr>
    </table>
    <table class="Table">
        <tr>
            <td class="WhiteCenter">Indicate location and extent of repairs
            </td>
            <td>
                <div hidden="yes">
                    <img src="/images/DT126.png" id="image" />
                </div>
                <div id="drawing">
                    <canvas id="canvas" width="825" height="200"></canvas>
                </div>

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

    </table>

    <table class="Table">
        <tr class="DarkerBlue">
            <td class="Title" colspan="12">Inspection</td>
        </tr>
        <tr class="DarkerBlue">
            <td colspan="2"></td>
            <td colspan="2">Date Inspected</td>
            <td colspan="2">Inspected By</td>
            <td colspan="2">Result <span class="fa fa-plus btn-attributes float-right" data-value="passfail"></span></td>
            <td colspan="2">Comments</td>
            <td colspan="2">Database No</td>
        </tr>
        <tr>
            <td class="DarkerBlueC" colspan="2">Repair 1</td>
            <td colspan="2"><?=DatePicker::widget(['model' => $model, 'attribute' => 'insdateins1']);?></td>

            <td colspan="2"><?= $form->field($model, 'inspectedby1')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'insresult1')->dropDownList($passfail, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'inscomments1')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'insdbno1')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC" colspan="2">Repair 2</td>
            <td colspan="2"><?=DatePicker::widget(['model' => $model, 'attribute' => 'insdateins2']);?></td>
            <td colspan="2"><?= $form->field($model, 'inspectedby2')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'insresult2')->dropDownList($passfail, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'inscomments2')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'insdbno2')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC" colspan="2">Repair 3</td>
            <td colspan="2"><?=DatePicker::widget(['model' => $model, 'attribute' => 'insdateins3']);?></td>
            <td colspan="2"><?= $form->field($model, 'inspectedby3')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'insresult3')->dropDownList($passfail, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'inscomments3')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'insdbno3')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC" colspan="2">Post Weld Dimension</td>
            <td colspan="2"><?= $form->field($model, 'postwelddim')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>

        </tr>

        <tr>
            <td class="DarkerBlue" colspan="3">053 Checks Completed</td>
            <td class="LighterBlue" colspan="3">
                <?php echo $form->field($model, 'checked053')->label(false)->dropDownList($yesno, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
            <td class="DarkerBlue" colspan="3">FPL Checks Completed</td>
            <td class="LighterBlue" colspan="3">
                <?php echo $form->field($model, 'fplchecks')->label(false)->dropDownList($yesno, ['prompt' => 'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue" colspan="1">Name</td>
            <td colspan="2"><?= $form->field($model, 'name053')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td class="DarkerBlue" colspan="1">Date</td>
            <td colspan="2"><?= $form->field($model, 'date053')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td class="DarkerBlue" colspan="1">Name</td>
            <td colspan="2"><?= $form->field($model, 'namefpl')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td class="DarkerBlue" colspan="1">Date</td>
            <td colspan="2"><?= $form->field($model, 'datefpl')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue" colspan="4" rowspan="2">Client on site Representitive</td>
            <td class="DarkerBlue" colspan="5" rowspan="2">Comments</td>
            <td class="DarkerBlueC" colspan="3" rowspan="2">This record to be completed on site at the time of welding
            </td>
        </tr>
        <tr>
        </tr>
        <tr>
            <td class="DarkerBlue">SIGNATURE</td>

            <td colspan="3">
                <div id="canvas1">
                    <canvas id="canvas_1" width="350" height="100" class="canvas"></canvas>
                </div>

                <?= Html::button('Reset', [ 'class' => 'btn btn-primary', 'onclick' => 'ClearCanvas1();' ]); ?>
                <br>

                <?= $form->field($model, 'signatureloc')->hiddenInput(['id' => 'signature1']) ->label(false)?>
            </td>
            <td colspan="6" rowspan="6"><?= $form->field($model, 'comments')->textarea(['rows' => 6,]) ->label(false)?>
            </td>
            <td class="DarkerBlueC" colspan="3" rowspan="2">AS A MINIMUM, ONE COPY EACH TO BE GIVEN TO SITE SUPERVISOR,
                WELDING MANAGER AND 053 INSPECTOR</td>
        </tr>
        <tr>
            <td class="DarkerBlue">PRINT</td>
            <td colspan="3">
                <?= $form->field($model, 'clientrepname')->textInput(['maxlength' => 100, 'id' => 'contact' ]) ->label(false)?>
            </td>
        </tr>
    </table>


    <div class="form-group">
        <?= Html::submitButton('Save', ['class' => 'btn btn-primary', 'onclick' => 'saveImage9()']) ?>
        <?php \yii\bootstrap4\Modal::begin(['id' => 'modal']); ?>
        <div id='modalContent'></div>
        <?php \yii\bootstrap4\Modal::end(); ?>
    </div>

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

</div>
<script>
function saveImage9() {
    $("#drawingloc").val(document.getElementById('canvas').toDataURL());
    $("#signature1").val(document.getElementById('canvas_1').toDataURL());

}
</script>