<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use kartik\time\TimePicker;
use kartik\date\DatePicker;
use kartik\select2\Select2;
use yii\imagine\Image;
use yii\bootstrap4\Modal;
use assets\LocateAsset;


//data from other models
Use backend\models\Attributesvalues; //drop down options
use modules\custom\models\Accounts;  //client accounts
use frontend\models\Users; //user accounts

/* @var $this yii\web\View */
/* @var $model modules\forms\models\Dt142 */
/* @var $form yii\widgets\ActiveForm */
//typeahead for wear
use kartik\typeahead\TypeaheadBasic;
use kartik\typeahead\Typeahead;

$users = \frontend\models\User::EmployeesU();
$account = Accounts::getActive();
$wearav = Attributesvalues::Formarray('wear');
$passfail = Attributesvalues::formarray('passfail');
$milesmeters = Attributesvalues::formarray('milemeters');
$yardschain = Attributesvalues::formarray('yardschain');
$rail = Attributesvalues::formarray('rail'); 
$railsection = Attributesvalues::formarray('railsection'); 
$dt123grade = Attributesvalues::formarray('dt123grade'); 
$yesno = Attributesvalues::formarray('yesno');
$defecttype = Attributesvalues::formarray('defecttype');
$dt122minactioncode = Attributesvalues::formarray('dt122minactioncode');
$dt125contype = Attributesvalues::formarray('dt125contype');
$dt125condiameter = Attributesvalues::formarray('dt125condiameter');
$preheater = Attributesvalues::formarray('dt125preheater');
$generater = Attributesvalues::formarray('dt125generator');
$dt125wfu =  Attributesvalues::formarray('dt125wfu');
$wear = [];
foreach($wearav as $key => $value) {
    $wear[] = $value;
}


//$this->registerJsFile('/js/touch.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/update179.js');
?>
<script>
window.onload = function() {
    //init(); //Drawing
    init1(); //canvas_1
    init2(); //canvas_2
    //init3(); //canvas_3
}
</script>

<div>

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

    <table class="table">
        <tr>
            <td colspan="2"><img src="/images/logo.jpg" alt="inline"></td>
            <td colspan="3" class="Title">Welders Work Return - Plain Line Repairs: Form TEF/3004 V3 June 2008 (DT142)
            </td>
        </tr>
    </table>
    <table class="Table">
        <TR class="DarkerBlueC">
            <td width="12.5%">Sheet</td>
            <td width="12.5%">From</td>
            <td width="12.5%">TEL No</td>
            <td width="12.5%">AREA</td>
            <td width="12.5%">TME/TSM</td>
            <td width="12.5%">WEEK No</td>
            <td width="12.5%">DATE</td>
            <td width="12.5%">IN/No </td>
        </TR>
        <tr>
            <td><?= $form->field($model, 'sheet')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'from')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'tel_no')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'area')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'dt142_tmetsm')->textInput(['maxlength' => 100, 'Value' => 'N/A']) ->label(false)?>
            </td>
            <TD><?= $form->field($model, 'week_no')->textInput(['maxlength' => 100])->label(false) ?></td>
            <td valign="top">
                <?=DatePicker::widget(['model' => $model, 'attribute' => 'date','pluginOptions' => [ 'format' => 'dd/mm/yyyy','todayHighlight' => true ] ]);?>
            </td>
            <td><?= $form->field($model, 'dt142_inno')->textInput(['maxlength' => 100, 'id' => 'injobno'])->label(false) ?>
            </td>
        </tr>
    </table>
    <table class="Table">
        <tr class="DarkerBlueC">
            <td width="14.25%" class="DarkerBlueC">WELDER NAME</td>
            <td width="14.25%" class="DarkerBlueC">STAMP No</td>
            <td width="14.25%" class="DarkerBlueC">WELDER SIGNATURE</td>
            <td width="14.25%" class="DarkerBlueC">START TIME</td>
            <td width="14.25%" class="DarkerBlueC">FINISH TIME</td>
            <td width="14.25%" class="DarkerBlueC">TOTAL TRAVEL</td>
            <td width="14.25%" class="DarkerBlueC">JCN
        </tr>
        <tr>
            <td><?=$form->field($model, 'welders_name')->widget(Select2::class,
['data' => $users,
 'options' => [
 	'id' => 'welders',
 	'placeholder' => 'Select Operatives...', 
 	],
 'pluginOptions' => [
	'tags' => true,
 	'multiple' => true, 
  	'tokenSeparators' => ['; ', ''],
 	],
 	 ])    ->label(false)?></td>
            <td><?= $form->field($model, 'stampno')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td>
                <div id="canvas2"><canvas id="canvas_2" class="canvas1"></canvas></div>
                <?= Html::button('Reset', [ 'class' => 'btn btn-primary', 'onclick' => 'ClearCanvas2();' ]); ?>
                <?= $form->field($model, 'wsignatureloc')->hiddenInput(['id' => 'wsignatureloc']) ->label(false)?>

            </td>
            <td><?= TimePicker::widget(['model' => $model, 'disabled' => true, 'attribute' => 'start_time', 'pluginOptions' => ['showMeridian' =>false,]]);?>
            </td>
            <td><?= TimePicker::widget(['model' => $model, 'disabled' => true, 'attribute' => 'finish_time', 'pluginOptions' => ['showMeridian' =>false,]]);?>
            </td>
            <td><?= $form->field($model, 'total_travel')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'jcn')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
    </table>
    <table class="Table">
        <tr class="DarkerBlueC">
            <td>CLIENT</td>
            <td>SITE REP SIGNATURE</td>
            <td>SITE REP PRINT</td>
            <td>DATE</td>
            <td>ELLIPSE No</td>
        </tr>
        <tr>
            <td><?= $form->field($model, 'client')->dropDownList($account, ['readonly' => 'true', 'id' => 'client', 'prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td>
                <canvas id="canvas_1" class="canvas1"></canvas><br />
                <?= Html::button('Reset', [ 'class' => 'btn btn-primary', 'onclick' => 'ClearCanvasX(1);' ]); ?>

            </td>
            <td>
                <?= $form->field($model, 'repname')->textInput(['maxlength' => 100, 'id' => 'contact']) ->label(false)?>
            </td>
            <td style="width: 175px"><?=DatePicker::widget(['model' => $model, 'attribute' => 'repdate']);?></td>
            <td><?= $form->field($model, 'ellipseno')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
    </table>
    <table class="Table">
        <tr class="DarkerBlueC">
            <td></td>
            <td colspan="10">Site Details</td>
        </tr>
        <tr class="DarkerBlueC">
            <td>Repair No</td>
            <td>Location</td>
            <td>GPS Co-Ordinates E</td>
            <td>GPS Co-Ordinates W</td>
            <td>ELR</td>
            <td>Track ID</td>
            <td>Mileage</td>
            <td>Rail LH/RH<span class="fa fa-plus btn-attributes float-right" data-value="rail"></span></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>
            <td>Repair Completed <span class="fa fa-plus btn-attributes float-right" data-value="yesno"></span></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">1</td>
            <td><?= $form->field($model, 'location1')->textInput(['maxlength' => 100, 'id' => 'location']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'gpseast1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpswest1')->textInput(['maxlength' => 100]) ->label(false)?><div hidden>
                    <?= Html::a('Lookup Location', ['lookup'], ['class' => 'btn btn-success', 'onclick' => "beginsearch();return false;"]) ?>
                </div>
            </td>
            <td><?= $form->field($model, 'elr1')->textInput([]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr_trackid1')->textInput([]) ->label(false)?></td>
            <td>
                <table class="Table">
                    <tr>
                        <td>
                            <?= $form->field($model, 'mileage1')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td>
                            <?= $form->field($model, 'mileage1mm')->dropdownList($milesmeters, ['prompt' => 'Please Select']) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage1b')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage1yc')->dropdownList($yardschain, ['prompt' => 'Please Select']) ->label(false) ?>
                        </td>
                    </tr>
                </table>
            </td>

            <td><?= $form->field($model, 'rail1')->dropDownList($rail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_section1')->dropDownList($railsection, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_grade1')->dropDownList($dt123grade, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'repair_completed1')->dropDownList($yesno, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">2</td>
            <td><?= $form->field($model, 'location2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpseast2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpswest2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr2')->textInput([]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr_trackid2')->textInput([]) ->label(false)?></td>

            <td>
                <table>
                    <tr>
                        <td>
                            <?= $form->field($model, 'mileage2')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage2mm')->dropdownList($milesmeters, ['prompt' => 'Please Select']) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage2b')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage2yc')->dropdownList($yardschain, ['prompt' => 'Please Select']) ->label(false) ?>
                        </td>
                    </tr>
                </table>
            </td>
            <td><?= $form->field($model, 'rail2')->dropDownList($rail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_section2')->dropDownList($railsection, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_grade2')->dropDownList($dt123grade, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'repair_completed2')->dropDownList($yesno, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">3</td>
            <td><?= $form->field($model, 'location3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpseast3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpswest3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr3')->textInput([]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr_trackid3')->textInput([]) ->label(false)?></td>

            <td>
                <table>
                    <tr>
                        <td>
                            <?= $form->field($model, 'mileage3')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage3mm')->dropdownList($milesmeters, ['prompt' => 'Please Select']) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage3b')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage3yc')->dropdownList($yardschain, ['prompt' => 'Please Select']) ->label(false) ?>
                        </td>
                    </tr>
                </table>
            </td>
            <td><?= $form->field($model, 'rail3')->dropDownList($rail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_section3')->dropDownList($railsection, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_grade3')->dropDownList($dt123grade, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'repair_completed3')->dropDownList($yesno, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">4</td>
            <td><?= $form->field($model, 'location4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpseast4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpswest4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr4')->textInput([]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr_trackid4')->textInput([]) ->label(false)?></td>

            <td>
                <table>
                    <tr>
                        <td>
                            <?= $form->field($model, 'mileage4')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage4mm')->dropdownList($milesmeters, ['prompt' => 'Please Select']) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage4b')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage4yc')->dropdownList($yardschain, ['prompt' => 'Please Select']) ->label(false) ?>
                        </td>
                    </tr>
                </table>
            </td>
            <td><?= $form->field($model, 'rail4')->dropDownList($rail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_section4')->dropDownList($railsection, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_grade4')->dropDownList($dt123grade, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'repair_completed4')->dropDownList($yesno, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">5</td>
            <td><?= $form->field($model, 'location5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpseast5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpswest5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr5')->textInput([]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr_trackid5')->textInput([]) ->label(false)?></td>

            <td>
                <table>
                    <tr>
                        <td>
                            <?= $form->field($model, 'mileage5')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage5mm')->dropdownList($milesmeters, ['prompt' => 'Please Select']) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage5b')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage5yc')->dropdownList($yardschain, ['prompt' => 'Please Select'])  ->label(false)?>
                        </td>
                    </tr>
                </table>
            </td>
            <td><?= $form->field($model, 'rail5')->dropDownList($rail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_section5')->dropDownList($railsection, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_grade5')->dropDownList($dt123grade, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'repair_completed5')->dropDownList($yesno, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">6</td>
            <td><?= $form->field($model, 'location6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpseast6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpswest6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr6')->textInput([]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr_trackid6')->textInput([]) ->label(false)?></td>

            <td>
                <table>
                    <tr>
                        <td>
                            <?= $form->field($model, 'mileage6')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage6mm')->dropdownList($milesmeters, ['prompt' => 'Please Select']) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage6b')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage6yc')->dropdownList($yardschain, ['prompt' => 'Please Select']) ->label(false) ?>
                        </td>
                    </tr>
                </table>
            </td>
            <td><?= $form->field($model, 'rail6')->dropDownList($rail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_section6')->dropDownList($railsection, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_grade6')->dropDownList($dt123grade, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'repair_completed6')->dropDownList($yesno, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">7</td>
            <td><?= $form->field($model, 'location7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpseast7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpswest7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr7')->textInput([]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr_trackid7')->textInput([]) ->label(false)?></td>

            <td>
                <table>
                    <tr>
                        <td>
                            <?= $form->field($model, 'mileage7')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage7mm')->dropdownList($milesmeters, ['prompt' => 'Please Select']) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage7b')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage7yc')->dropdownList($yardschain, ['prompt' => 'Please Select']) ->label(false) ?>
                        </td>
                    </tr>
                </table>
            </td>
            <td><?= $form->field($model, 'rail7')->dropDownList($rail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_section7')->dropDownList($railsection, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_grade7')->dropDownList($dt123grade, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'repair_completed7')->dropDownList($yesno, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">8</td>
            <td><?= $form->field($model, 'location8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpseast8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'gpswest8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr8')->textInput([]) ->label(false)?></td>
            <td><?= $form->field($model, 'elr_trackid8')->textInput([]) ->label(false)?></td>

            <td>
                <table>
                    <tr>
                        <td>
                            <?= $form->field($model, 'mileage8')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage8mm')->dropdownList($milesmeters, ['prompt' => 'Please Select']) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage8b')->textInput(['maxlength' => 100]) ->label(false)?>
                        </td>
                        <td><?= $form->field($model, 'mileage8yc')->dropdownList($yardschain, ['prompt' => 'Please Select']) ->label(false) ?>
                        </td>
                    </tr>
                </table>
            </td>
            <td><?= $form->field($model, 'rail8')->dropDownList($rail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_section8')->dropDownList($railsection, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'rail_grade8')->dropDownList($dt123grade, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'repair_completed8')->dropDownList($yesno, ['prompt'=>'Please Select']) ->label(false)?>
            </td>

        </tr>
    </table>
    <table class="Table">
        <tr>
            <td></td>
            <td colspan="6" class="DarkerBlueC">THIS INFORMATION CAN BE OBTAINED FROM THE FORM B.</td>
            <td colspan="5" class="DarkerBlueC">WELDING DETAILS</td>
        </tr>
        <tr class="DarkerBlueC">
            <td rowspan="2">Repair No</td>
            <td rowspan="2">Defect No</td>
            <td rowspan="2">Defect Type<span class="fa fa-plus btn-attributes float-right" data-value="defecttype"></span></td>
            <td rowspan="2">Min Action Code <span class="fa fa-plus btn-attributes float-right" data-value="dt122minactioncode"></span></td>
            <td rowspan="2">Last U/S Test Date</td>
            <td colspan="2" align="center">Defect</td>
            <td colspan="2" align="center">Excavation</td>
            <td rowspan="2">Preheat Temp</td>
            <td colspan="2" align="center">Consumables </td>
        </tr>
        <tr class="DarkerBlueC">
            <td>Length</td>
            <td>Depth</td>
            <td>Length</td>
            <td>Depth</td>
            <td>Type <span class="fa fa-plus btn-attributes float-right" data-value="dt125contype"></span></td>
            <td>Diameter <span class="fa fa-plus btn-attributes float-right" data-value="dt125condiameter"></span></td>
        </tr>
        <tr>

            <td class="DarkerBlueC">1</td>
            <td><?= $form->field($model, 'defectno1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectype1')->dropDownList($defecttype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'minactioncode2fetc1')->dropDownList($dt122minactioncode, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'lastustestdate1')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'defectlength1')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'defectdepth1')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationlength1')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationldepth1')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'preheattemp1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'consumablestype1')->dropDownList($dt125contype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consumablesdiameter1')->dropDownList($dt125condiameter, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">2</td>
            <td><?= $form->field($model, 'defectno2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectype2')->dropDownList($defecttype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'minactioncode2fetc2')->dropDownList($dt122minactioncode, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'lastustestdate2')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'defectlength2')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'defectdepth2')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationlength2')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationldepth2')->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')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'consumablestype2')->dropDownList($dt125contype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consumablesdiameter2')->dropDownList($dt125condiameter, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">3</td>
            <td><?= $form->field($model, 'defectno3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectype3')->dropDownList($defecttype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'minactioncode2fetc3')->dropDownList($dt122minactioncode, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'lastustestdate3')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'defectlength3')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'defectdepth3')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationlength3')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationldepth3')->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')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'consumablestype3')->dropDownList($dt125contype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consumablesdiameter3')->dropDownList($dt125condiameter, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">4</td>
            <td><?= $form->field($model, 'defectno4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectype4')->dropDownList($defecttype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'minactioncode2fetc4')->dropDownList($dt122minactioncode, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'lastustestdate4')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'defectlength4')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'defectdepth4')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationlength4')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationldepth4')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'preheattemp4')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'consumablestype4')->dropDownList($dt125contype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consumablesdiameter4')->dropDownList($dt125condiameter, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">5</td>
            <td><?= $form->field($model, 'defectno5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectype5')->dropDownList($defecttype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'minactioncode2fetc5')->dropDownList($dt122minactioncode, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'lastustestdate5')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'defectlength5')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'defectdepth5')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationlength5')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationldepth5')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'preheattemp5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'consumablestype5')->dropDownList($dt125contype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consumablesdiameter5')->dropDownList($dt125condiameter, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">6</td>
            <td><?= $form->field($model, 'defectno6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectype6')->dropDownList($defecttype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'minactioncode2fetc6')->dropDownList($dt122minactioncode, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'lastustestdate6')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'defectlength6')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'defectdepth6')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationlength6')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationldepth6')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'preheattemp6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'consumablestype6')->dropDownList($dt125contype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consumablesdiameter6')->dropDownList($dt125condiameter, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">7</td>
            <td><?= $form->field($model, 'defectno7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectype7')->dropDownList($defecttype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'minactioncode2fetc7')->dropDownList($dt122minactioncode, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'lastustestdate7')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'defectlength7')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'defectdepth7')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationlength7')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationldepth7')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'preheattemp7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'consumablestype7')->dropDownList($dt125contype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consumablesdiameter7')->dropDownList($dt125condiameter, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlueC">8</td>
            <td><?= $form->field($model, 'defectno8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'defectype8')->dropDownList($defecttype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'minactioncode2fetc8')->dropDownList($dt122minactioncode, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'lastustestdate8')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'defectlength8')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'defectdepth8')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationlength8')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'excavationldepth8')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'preheattemp8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'consumablestype8')->dropDownList($dt125contype, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'consumablesdiameter8')->dropDownList($dt125condiameter, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>

    </table>
    <table class="Table">
        <tr>
            <td class="DarkerBlue" colspan="4"></td>
            <td class="DarkerBlueC" colspan="3">EQUIPMENT SERIAL No.S</td>
        </tr>
        <tr>
            <td class="DarkerBlueC" colspan="4">Welders Comments</td>
            <td class="LighterBlueC">Preheater <span class="fa fa-plus btn-attributes float-right" data-value="dt125preheater"></span></td>
            <td class="LighterBlueC">Generator <span class="fa fa-plus btn-attributes float-right" data-value="dt125generator"></span></td>
            <td class="LighterBlueC">WFU<span class="fa fa-plus btn-attributes float-right" data-value="dt125wfu"></span></td>
        </tr>

        <tr>
            <td colspan="4"><?= $form->field($model, 'comments')->textArea(['rows' => '4']) ->label(false)?></td>
            <td><?= $form->field($model, 'preheater')->dropDownList($preheater, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'generator')->dropDownList($generater, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'wfu')->dropDownList($dt125wfu, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
        </tr>
        
    </table>
    <table class="Table">
        <tr>
            <td class="DarkerBlueC" colspan="6">Inspection</td>
        </tr>
        <tr class="DarkerBlueC">
            <td>Visual</td>
            <td>Date inspected</td>
            <td>Insepected By</td>
            <td>Result <span class="fa fa-plus btn-attributes float-right" data-value="passfail"></span></td>
            <td>Comments</td>
            <td>Database No</td>
        </tr>
        <tr>
            <td class="DarkerBlueC">1</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'dateinspected1']);?>
            </td>
            <td><?= $form->field($model, 'inspectedby1')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result1')->dropDownList($passfail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'comments1')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'databaseno1')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">2</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'dateinspected2']);?>
            </td>
            <td><?= $form->field($model, 'inspectedby2')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result2')->dropDownList($passfail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'comments2')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'databaseno2')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">3</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'dateinspected3']);?>
            </td>
            <td><?= $form->field($model, 'inspectedby3')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result3')->dropDownList($passfail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'comments3')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'databaseno3')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">4</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'dateinspected4']);?>
            </td>
            <td><?= $form->field($model, 'inspectedby4')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result4')->dropDownList($passfail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'comments4')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'databaseno4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">5</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'dateinspected5']);?>
            </td>
            <td><?= $form->field($model, 'inspectedby5')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result5')->dropDownList($passfail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'comments5')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'databaseno5')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">6</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'dateinspected6']);?>
            </td>
            <td><?= $form->field($model, 'inspectedby6')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result6')->dropDownList($passfail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'comments6')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'databaseno6')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">7</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'dateinspected7']);?>
            </td>
            <td><?= $form->field($model, 'inspectedby7')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result7')->dropDownList($passfail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'comments7')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'databaseno7')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">8</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'dateinspected8']);?>
            </td>
            <td><?= $form->field($model, 'inspectedby8')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result8')->dropDownList($passfail, ['prompt'=>'Please Select']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'comments8')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'databaseno8')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
    </table>


    <table class="Table">
        <tr class="DarkerBlueC">
            <td rowspan="2">ULTRASONIC</td>
            <td rowspan="2">DATE INSPECTED</td>
            <td rowspan="2">INSPECTED BY</td>
            <td colspan="2">RESULT</td>
            <td rowspan="2">COMMENTS</td>
            <td rowspan="2">RFD Ref</td>
        </tr>
        <tr class="DarkerBlueC">
            <td>0</td>
            <td>70</td>
        </tr>

        <tr>
            <td class="DarkerBlueC">1</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'usdateinspected1']);?>
            </td>
            <td><?= $form->field($model, 'insepectedby1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result01')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result701')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'uscomments1')->textArea() ->label(false)?></td>
            <td><?= $form->field($model, 'rfdref1')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">2</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'usdateinspected2']);?>
            </td>
            <td><?= $form->field($model, 'usdateinspected2')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result02')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result702')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'uscomments2')->textArea() ->label(false)?></td>
            <td><?= $form->field($model, 'rfdref2')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">3</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'usdateinspected3']);?>
            </td>
            <td><?= $form->field($model, 'usdateinspected3')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result03')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result703')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'uscomments3')->textArea() ->label(false)?></td>
            <td><?= $form->field($model, 'rfdref3')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">4</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'usdateinspected4']);?>
            </td>
            <td><?= $form->field($model, 'usdateinspected4')->textInput() ->label(false)?></td>
            <td><?= $form->field($model, 'result04')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result704')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'uscomments4')->textArea() ->label(false)?></td>
            <td><?= $form->field($model, 'rfdref4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">5</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'usdateinspected5']);?>
            </td>
            <td><?= $form->field($model, 'insepectedby5')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result05')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result705')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'uscomments5')->textArea() ->label(false)?></td>
            <td><?= $form->field($model, 'rfdref5')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">6</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'usdateinspected6']);?>
            </td>
            <td><?= $form->field($model, 'insepectedby6')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result06')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result706')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'uscomments6')->textArea() ->label(false)?></td>
            <td><?= $form->field($model, 'rfdref6')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">7</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'usdateinspected7']);?>
            </td>
            <td><?= $form->field($model, 'insepectedby7')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result07')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result707')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'uscomments7')->textArea() ->label(false)?></td>
            <td><?= $form->field($model, 'rfdref7')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC">8</td>
            <td style="width: 150px;"><?=DatePicker::widget(['model' => $model, 'attribute' => 'usdateinspected8']);?>
            </td>
            <td><?= $form->field($model, 'insepectedby8')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result08')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'result708')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td><?= $form->field($model, 'uscomments8')->textArea() ->label(false)?></td>
            <td><?= $form->field($model, 'rfdref8')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
    </table>
    <table class="Table">
        <tr>
            <td class="WhiteCenter" colspan="7">OFFICE USE ONLY</td>
        </tr>
        <tr>
            <td class="DarkerBlue">Input into Arc Database</td>
            <td class="DarkerBlue">By</td>
            <td colspan="2"></td>
            <td class="DarkerBlue">Date</td>
            <td colspan="3" style="width: 200px;"> </td>
            <td class="DarkerBlueC" rowspan="2">THIS RECORD TO BE COMPLETED ON SITE AT THE TIME OF WELDING</td>
        </tr>
        <tr>
            <td class="DarkerBlue">Database reference number</td>
            <td colspan="6"><?= $form->field($model, 'dbref')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Inspection planned for</td>
            <td class="DarkerBlue">Name</td>
            <td colspan="2"><?= $form->field($model, 'inspectname')->textInput() ->label(false)?></td>
            <td class="DarkerBlue">Date</td>
            <td valign="top" colspan="3" style="width: 200px;">
                <?=DatePicker::widget(['model' => $model, 'attribute' => 'inspectdate']);?></td>
            <td class="DarkerBlueC" rowspan="4">AS A MINIMUM, ONE COPY EACH TO BE GIVEN TO SITE SUPERVISOR AND WELDING
                MANAGER </td>
        </tr>
        <tr>
            <td class="DarkerBlue">B Form No. (where applicable)</td>
            <td colspan="5"><?= $form->field($model, 'formbnos')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Input into Ellipse</td>
            <td class="DarkerBlue">By</td>
            <td colspan="2"><?= $form->field($model, 'ellipseby')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td class="DarkerBlue">Date</td>
            <td valign="top" colspan="3" style="width: 200px;">
                <?=DatePicker::widget(['model' => $model, 'attribute' => 'ellipsedate']);?></td>
        </tr>
    </table>

    <table class="Table">
        <tr>
            <th class="DarkerBlueC">Welds Expected</th>
            <td><?= $form->field($model, 'noofwelds')->textInput(['maxlength' => 100, 'id' => 'expectedwelds', 'readonly' => 'true']) ->label(false)?>
            </td>
            <th class="DarkerBlueC">Good Welds</th>
            <td><?= $form->field($model, 'goodwelds')->textInput(['maxlength' => 100, 'id' => 'goodwelds', 'onchange' => 'welds()' ]) ->label(false)?>
            </td>
            <th class="DarkerBlueC">Bad Welds</th>
            <td><?= $form->field($model, 'badwelds')->textInput(['maxlength' => 100, 'id' => 'badwelds', 'onchange' => 'welds()']) ->label(false)?>
            </td>
            <th class="DarkerBlueC">Welds Completed</th>
            <td><?= $form->field($model, 'weldscompleted')->textInput(['maxlength' => 100, 'id' => 'completedwelds' ]) ->label(false)?>
            </td>
        </tr>

    </table>

    <div class="form-group">
        <?= Html::submitButton('Save', ['class' => 'btn btn-success', 'onclick' => 'saveImage10()']) ?>
        <?= Html::button('Add Attributes', ['value' => Url::to(['form_attribs/createdt142']), 'id' => 'modalButton', 'class' => 'btn btn-primary' ]) ?>
    </div>
    <?= $form->field($model, 'signatureloc')->hiddenInput(['id' => 'signatureloc']) ->label(false)?>
    <?php ActiveForm::end(); ?>

    <?php Modal::begin(['id' => 'modal', 'size' => 'modal-lg' ]); ?>
    <div id='modalContent'></div>
    <?php Modal::end(); ?>
</div>


<script type="text/javascript">
function welds() {
    var expected = document.getElementById('expectedwelds').value;
    var good = document.getElementById('goodwelds').value;
    var bad = document.getElementById('badwelds').value;
    var completed = document.getElementById('completedwelds').value;
    // var1 = document.getElementById('nonconr1').value;
    var2 = document.getElementById('contact').value;
    var3 = document.getElementById('injobno').value;
    var4 = document.getElementById('location').value;
    var5 = document.getElementById('dt142-date').value; //Date
    var6 = document.getElementById('client').value;
    var7 = document.getElementById('dt142-start_time').value; //startdate
    var8 = document.getElementById('dt142-finish_time').value; //finishdate
    var9 = document.getElementById('actid').value; //activityno


    //MATHS
    var total = +good + +bad;
    var miscalc = total - +expected;

    //Set Values	
    document.getElementById('completedwelds').value = total;
    url = "&contact=" + var2 + "&injobno=" + var3 + "&site=" + var4 + "&date=" + var5 + "&company=" + var6 +
        "&starttime=" + var7 + "&finishtime=" + var8 + "&actid=" + var9;

    //Logic
    //alert(miscalc)
    if (bad >= 1) {
        var x
        if (confirm(
                'Bad welds detected have you completed a non-conformance press Ok to continue or Cancel to create a non-conformance'
                ) == true) {
            x = "done";
        } else {
            x = "noncon";
            // Open new window to site report
            var params = ['height=' + 1920, 'width=' + 1080, 'fullscreen=no'].join(',');
            var myWindow = window.open("/dt128/create" + url, "", params);
        }
        // only works in IE, but here for completeness

    }
}

function saveImage10() {
    $("#wsignatureloc").val(document.getElementById('canvas_2').toDataURL());
    $("#signatureloc").val(document.getElementById('canvas_1').toDataURL());
}
</script>