<?php
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\helpers\Url;

use yii\bootstrap4\Modal;

use yii\web\View;

use yii\widgets\ActiveForm;
use kartik\time\TimePicker;
use kartik\datetime\DateTimePicker;
use kartik\date\DatePicker;
use kartik\select2\Select2;
//typeahead for wear
use kartik\typeahead\TypeaheadBasic;
use kartik\typeahead\Typeahead;

use yii\imagine\Image;


use modules\custom\models\Accounts;
use frontend\models\Attributesvalues;
use modules\users\models\User;
use frontend\models\Users;


$sleeper = Attributesvalues::formarray('sleeper');
$yesno = Attributesvalues::formarray('yesno');
$rail = Attributesvalues::formarray('rail');
$linespeed = Attributesvalues::formarray('linespeed');
$location = Attributesvalues::formarray('location');
$manufacturer = Attributesvalues::formarray('manufacturer');
$dt123profile = Attributesvalues::formarray('dt123profile');
$dt123grade = Attributesvalues::formarray('dt123grade');
$cuttingmethod = Attributesvalues::formarray('cuttingmethod');
$alignment = Attributesvalues::formarray('alignment');
$weldtype = Attributesvalues::formarray('weldtype');
$mouldtype = Attributesvalues::formarray('mouldtype');
$fuelgas = Attributesvalues::formarray('fuelgas');
$gaskitno = Attributesvalues::formarray('gaskitno');
$passfail = Attributesvalues::formarray('passfail');
$dt123protype = Attributesvalues::formarray('dt123protectiontype');
$dt123pmethod = Attributesvalues::formarray('dt123protectionmethod');
$milemeters = Attributesvalues::formarray('milemeters');
$yardschain = Attributesvalues::formarray('yardschain');

$wearav = Attributesvalues::formarray('wear');
$wear = [];
foreach($wearav as $key => $value) {
    $wear[] = $value;
}
$model->installdate = empty($model->installdate) == false ? date('d/m/Y', strtotime(str_replace('/', '-',  $model->installdate))) : (is_integer($model->installdate) == true ? date('d/m/Y',$model->installdate) : $model->installdate) ;
$model->installtime1 = empty($model->installtime1) == false ? (strlen($model->installtime1) > 5 ? date('H:i', strtotime(str_replace('/', '-',  $model->installtime1))) : $model->installtime1) : $model->installtime1;
$model->installtime2 = empty($model->installtime2) == false ? (strlen($model->installtime2) > 5 ? date('H:i', strtotime(str_replace('/', '-',  $model->installtime2))) : $model->installtime2) : $model->installtime2;
$model->installtime3 = empty($model->installtime3) == false ? (strlen($model->installtime3) > 5 ? date('H:i', strtotime(str_replace('/', '-',  $model->installtime3))) : $model->installtime3) : $model->installtime3;
$model->installtime4 = empty($model->installtime4) == false ? (strlen($model->installtime4) > 5 ? date('H:i', strtotime(str_replace('/', '-',  $model->installtime4))) : $model->installtime4) : $model->installtime4;
$model->installdate1 = empty($model->installdate1) == false ? date('d/m/Y', strtotime(str_replace('/', '-',  $model->installdate1))) : (is_integer($model->installdate1) == true ? date('d/m/Y',$model->installdate1) : $model->installdate1) ;
$model->installdate2 = empty($model->installdate2) == false ? date('d/m/Y', strtotime(str_replace('/', '-',  $model->installdate2))) : (is_integer($model->installdate2) == true ? date('d/m/Y',$model->installdate2) : $model->installdate2) ;
$model->installdate3 = empty($model->installdate3) == false ? date('d/m/Y', strtotime(str_replace('/', '-',  $model->installdate3))) : (is_integer($model->installdate3) == true ? date('d/m/Y',$model->installdate3) : $model->installdate3) ;
$model->installdate4 = empty($model->installdate4) == false ? date('d/m/Y', strtotime(str_replace('/', '-',  $model->installdate4))) : (is_integer($model->installdate4) == true ? date('d/m/Y',$model->installdate4) : $model->installdate4) ;


$client = Accounts::getActive();
// Drop down field population,
$users = \frontend\models\User::EmployeesU();

// Parameters 

$welderinput = 
['data' => $users,
 'id' => 'weldersname',
 'options' => [
 	'placeholder' => 'Select Operatives...', 
 	],
 'pluginOptions' => [
	'tags' => true,
 	'multiple' => true, 
  	'tokenSeparators' => ['; ', ''],
 ]
 ];
 $welderassinput = 
 ['data' => $users,
 'id' => 'weldersassistantname',
 'options' => [
 	'placeholder' => 'Select Operatives...', 
 	],
 'pluginOptions' => [
	'tags' => true,
 	'multiple' => true, 
  	'tokenSeparators' => ['; ', ''],
 	],
];

$range = \modules\forms\models\Dt179::hoursRange( 0, 86400, 60 * 5 );
?>

<?php
//$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 

Yii::$app->controller->action->id == 'update' ? $this->registerJsFile('/js/update179.js') : false;
?>
<script>
window.onload = function() {
    //init(); //Drawing
    init1(); //canvas_1
    init2(); //canvas_2
    //init3(); //canvas_3
}
</script>
<div class="dt123-form">
    <?php $form = ActiveForm::begin(); ?>
    <div class="row">
        <div class="col-3">
            <?= $form->field($model, 'injobno')->textinput(['id' => 'injobno']) ->label()?>
        </div>
        <div class="col-3">
            <?= $form->field($model, 'weekno')->textinput(['id' => 'weekno']) ->label()?>
        </div>
        <div class="col-3">
            <?= $form->field($model, 'client')->dropDownList($client, ['id' => 'client', 'prompt' => 'Please Select...']) ->label()?>
        </div>
        <div class="col-3">
            <?= $form->field($model, 'jobtype')->dropDownList(Attributesvalues::formarray('jobtype'), ['prompt' => 'Please Select...']) ->label()?>
        </div>
    </div>
    <div class="row">
        <div class="col-3">
            <?= $form->field($model, "installdate")->widget(DatePicker::class, ['type' => 1, 'pluginOptions' => ['showMeridian' =>false, 'format' => 'dd/mm/yyyy']])->label() ?>
        </div>
        <div class="col-3">
            <?=$form->field($model, 'weldersname')->widget(Select2::class, $welderinput)->label()?>
        </div>
        <div class="col-3">
            <?=$form->field($model, 'weldersassistantname')->widget(Select2::class, $welderassinput)->label(); ?>
        </div>
        <div class="col-3">
            <?= $form->field($model, 'defectnoremoved')->textInput(['maxlength' => 100, 'Value' => 'N/A']) ->label()?>
        </div>
    </div>
    <div class="row">
        <div class="col-3">
            <?= $form->field($model, 'area')->textInput(['maxlength' => 100]) ->label()?>
        </div>
        <div class="col-3">
            <?= $form->field($model, 'tmetsm')->textInput(['maxlength' => 100, 'Value' => 'N/A']) ->label()?>
        </div>
        <div class="col-3">
            <?= $form->field($model, 'worksitelocation')->textInput(['maxlength' => 100, 'id' => 'location']) ->label()?>
        </div>
        <div class="col-3">
            <?= $form->field($model, 'jobcostno')->textInput(['maxlength' => 100, 'Value' => 'N/A']) ->label()?>
        </div>
    </div>
    <div class="row">
        <div class="col-12 col-md-6 col-lg-4">
            <div id="canvas2" class="input-group">
                <div class="input-group-prepend ">
                    <span class="input-group-text DarkerBlue">
                        <label class="control-label">Welders Signature</label>
                    </span>
                </div>
                <canvas id='canvas_2' class="canvas"></canvas>
                <div class="input-group-append ">
                    <span class="input-group-text bg-danger text-white" onclick="ClearCanvasX(2);">
                        Reset
                    </span>
                </div>
            </div>
        </div>
        <div class="col-12 col-md-6 col-lg-4">
            <div id="canvas1" class="input-group">
                <div class="input-group-prepend ">
                    <span class="input-group-text DarkerBlue">
                        <label class="control-label">Site Rep Signature</label>
                    </span>
                </div>
                <canvas id='canvas_1' class="canvas"></canvas>
                <div class="input-group-append ">
                    <span class="input-group-text bg-danger text-white" onclick="ClearCanvasX(1);">
                        Reset
                    </span>
                </div>
            </div>
        </div>
        <div class="col-12 col-md-3">
            <?= $form->field($model, 'siterepprint')->textInput(['maxlength' => 100, 'id' => 'contact']) ->label()?>
        </div>
    </div>

    <?= $form->field($model, 'signatureloc')->hiddeninput(['id' => 'signatureloc']) ->label(false)?>
    <?= $form->field($model, 'wsignatureloc')->hiddeninput(['id' => 'wsignatureloc']) ->label(false)?>


    <table class="Table">
        <tr class="DarkerBlueC">
            <td class="DarkerBlue" rowspan="13" style="height: 10px">
                <div class="rotate">Location</div>
            </td>
            <td></td>
            <td colspan="2">Weld1</td>
            <td colspan="2">Weld2</td>
            <td colspan="2">Weld3</td>
            <td colspan="2">Weld4</td>
        </tr>
        <tr>
            <td class="DarkerBlue">Date weld cast</td>
            <td colspan="2">
                <?= $form->field($model, 'installdate1')->widget(DatePicker::class, ['type' => 1, 'pluginOptions' => [ 'format' => 'dd/mm/yyyy','todayHighlight' => true ] ])->label(false);?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'installdate2')->widget(DatePicker::class, ['type' => 1,'pluginOptions' => [ 'format' => 'dd/mm/yyyy','todayHighlight' => true ] ])->label(false);?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'installdate3')->widget(DatePicker::class, ['type' => 1,'pluginOptions' => [ 'format' => 'dd/mm/yyyy','todayHighlight' => true ] ])->label(false);?>
            </td>
            <td colspan="2">
                <?=$form->field($model, 'installdate4')->widget(DatePicker::class, ['type' => 1, 'pluginOptions' => [ 'format' => 'dd/mm/yyyy','todayHighlight' => true ] ])->label(false);?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Time weld cast</td>
            <td colspan="2">
                <?= $form->field($model, 'installtime1')->dropdownlist($range, ['prompt' => 'Start Time'])->label(false); ?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'installtime2')->dropdownlist($range, ['prompt' => 'Start Time'])->label(false); ?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'installtime3')->dropdownlist($range, ['prompt' => 'Start Time'])->label(false); ?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'installtime4')->dropdownlist($range, ['prompt' => 'Start Time'])->label(false); ?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">ELR</td>
            <td colspan="2">
                <?= $form->field($model, 'elr1')->textInput(['maxlength' => 100, 'id' => 'ELR1', 'onchange'=> 'stampno()']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'elr2')->textInput(['maxlength' => 100, 'id' => 'ELR2', 'onchange'=> 'stampno()']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'elr3')->textInput(['maxlength' => 100, 'id' => 'ELR3', 'onchange'=> 'stampno()']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'elr4')->textInput(['maxlength' => 100, 'id' => 'ELR4', 'onchange'=> 'stampno()']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Mileage</td>
            <td colspan="2">
                <Table>
                    <tr>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'mileage1')->textInput(['id' => 'm1', 'maxlength' => 100]) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'meters1')->dropDownList($milemeters, ['id' => 'm2','prompt' => 'Please Select...']) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'yards1')->textInput(['id' => 'm3','maxlength' => 100]) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'chain1')->dropDownList($yardschain, ['id' => 'm4','prompt' => 'Please Select...']) ->label(false)?>
                        </td>
                    </tr>
                </Table>
            </td>
            <td colspan="2">
                <Table>
                    <tr>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'mileage2')->textInput(['id' => 'm5','maxlength' => 100]) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'meters2')->dropDownList($milemeters, ['id' => 'm6','prompt' => 'Please Select...']) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'yards2')->textInput(['id' => 'm7','maxlength' => 100]) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'chain2')->dropDownList($yardschain, ['id' => 'm8','prompt' => 'Please Select...']) ->label(false)?>
                        </td>
                    </tr>
                </Table>
            </td>
            <td colspan="2">
                <Table>
                    <tr>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'mileage3')->textInput(['id' => 'm9','maxlength' => 100]) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'meters3')->dropDownList($milemeters, ['id' => 'm10','prompt' => 'Please Select...']) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'yards3')->textInput(['id' => 'm11','maxlength' => 100]) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'chain3')->dropDownList($yardschain, ['id' => 'm12','prompt' => 'Please Select...']) ->label(false)?>
                        </td>
                    </tr>
                </Table>
            </td>
            <td colspan="2">
                <Table>
                    <tr>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'mileage4')->textInput(['id' => 'm13','maxlength' => 100]) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'meters4')->dropDownList($milemeters, ['id' => 'm14','prompt' => 'Please Select...']) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'yards4')->textInput(['id' => 'm15','maxlength' => 100]) ->label(false)?>
                        </td>
                        <td style="width: 6.75%">
                            <?= $form->field($model, 'chain4')->dropDownList($yardschain, ['id' => 'm16','prompt' => 'Please Select...']) ->label(false)?>
                        </td>
                    </tr>
                </Table>
            </td>
        </tr>

        <tr>
            <td class="DarkerBlue">Chord Point</td>
            <td colspan="2"><?= $form->field($model, 'chord1')->textInput(['maxlength' => 100,]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'chord2')->textInput(['maxlength' => 100,]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'chord3')->textInput(['maxlength' => 100,]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'chord4')->textInput(['maxlength' => 100,]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Track ID</td>
            <td colspan="2"><?= $form->field($model, 'trackid1')->textInput(['id'=>'trackid1']) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'trackid2')->textInput(['id'=>'trackid2']) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'trackid3')->textInput(['id'=>'trackid3']) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'trackid4')->textInput(['id'=>'trackid4']) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">
            Back to Low Mileage Rail
            <span class="fa fa-plus btn-attributes float-right" data-value="rail"></span>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'btol1')->dropDownList($rail, ['prompt' => 'Please Select...', 'id' => 'rail1']) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'btol2')->dropDownList($rail, ['prompt' => 'Please Select...', 'id' => 'rail2']) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'btol3')->dropDownList($rail, ['prompt' => 'Please Select...', 'id' => 'rail3']) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'btol4')->dropDownList($rail, ['prompt' => 'Please Select...', 'id' => 'rail4']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">GPS Cordinates West/East</td>
            <td colspan="2"><?= $form->field($model, 'gps1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'gps2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'gps3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'gps4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">
                Linespeed
                <span class="fa fa-plus btn-attributes float-right" data-value="linespeed"></span>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'linespeed1')->dropDownList($linespeed, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'linespeed2')->dropDownList($linespeed, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'linespeed3')->dropDownList($linespeed, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'linespeed4')->dropDownList($linespeed, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">
                Line Location Type
                <span class="fa fa-plus btn-attributes float-right" data-value="location"></span>
                </td>
            <td colspan="2">
                <?= $form->field($model, 'lineloctype1')->dropDownList($location, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'lineloctype2')->dropDownList($location, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'lineloctype3')->dropDownList($location, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'lineloctype4')->dropDownList($location, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">
                Sleeper Type
                <span class="fa fa-plus btn-attributes float-right" data-value="sleeper"></span>
                </td>
            <td colspan="2">
                <?= $form->field($model, 'sleepertype1')->dropDownList($sleeper, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'sleepertype2')->dropDownList($sleeper, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'sleepertype3')->dropDownList($sleeper, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'sleepertype4')->dropDownList($sleeper, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Consolidated</td>
            <td colspan="2">
                <?= $form->field($model, 'consolidated1')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'consolidated2')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'consolidated3')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'consolidated4')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue" rowspan="5" style="height: 10px">
                <div class="rotate">Rail Details</div>
            </td>
            <td class="DarkerBlue">Rail</td>
            <td class="LighterBlue">LH Rail</td>
            <td class="LighterBlue">RH Rail</td>
            <td class="LighterBlue">LH Rail</td>
            <td class="LighterBlue">RH Rail</td>
            <td class="LighterBlue">LH Rail</td>
            <td class="LighterBlue">RH Rail</td>
            <td class="LighterBlue">LH Rail</td>
            <td class="LighterBlue">RH Rail</td>
        </tr>
        <tr>
            <td class="DarkerBlue">
            Manufacturer
            <span class="fa fa-plus btn-attributes float-right" data-value="manufacturer"></span>
            </td>
            <td><?= $form->field($model, 'manufacturer1')->dropDownList($manufacturer, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'manufacturer2')->dropDownList($manufacturer, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'manufacturer3')->dropDownList($manufacturer, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'manufacturer4')->dropDownList($manufacturer, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'manufacturer5')->dropDownList($manufacturer, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'manufacturer6')->dropDownList($manufacturer, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'manufacturer7')->dropDownList($manufacturer, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'manufacturer8')->dropDownList($manufacturer, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">
                Profile
                <span class="fa fa-plus btn-attributes float-right" data-value="dt123profile"></span>
            </td>
            <td><?= $form->field($model, 'profile1')->dropDownList($dt123profile, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'profile2')->dropDownList($dt123profile, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'profile3')->dropDownList($dt123profile, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'profile4')->dropDownList($dt123profile, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'profile5')->dropDownList($dt123profile, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'profile6')->dropDownList($dt123profile, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'profile7')->dropDownList($dt123profile, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'profile8')->dropDownList($dt123profile, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">
                Grade
                <span class="fa fa-plus btn-attributes float-right" data-value="dt123grade"></span>
            </td>
            <td><?= $form->field($model, 'grade1')->dropDownList($dt123grade, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'grade2')->dropDownList($dt123grade, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'grade3')->dropDownList($dt123grade, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'grade4')->dropDownList($dt123grade, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'grade5')->dropDownList($dt123grade, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'grade6')->dropDownList($dt123grade, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'grade7')->dropDownList($dt123grade, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td><?= $form->field($model, 'grade8')->dropDownList($dt123grade, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Wear</td>
            <td><?= $form->field($model, 'wear1')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'wear2')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'wear3')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'wear4')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'wear5')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'wear6')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'wear7')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td><?= $form->field($model, 'wear8')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
        </tr>

        <tr>
            <td class="DarkerBlue" rowspan="3" style="height: 10px">
                <div class="rotate">Rail Prep</div>
            </td>
            <td class="DarkerBlue">Rail Cutting Method
            <span class="fa fa-plus btn-attributes float-right" data-value="cuttingmethod"></span>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'cuttingmethod1')->dropDownList($cuttingmethod, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'cuttingmethod2')->dropDownList($cuttingmethod, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'cuttingmethod3')->dropDownList($cuttingmethod, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'cuttingmethod4')->dropDownList($cuttingmethod, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Welding Gap (mm)</td>
            <td colspan="2">
                <?= $form->field($model, 'wgap1')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'wgap2')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'wgap3')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'wgap4')->widget(Typeahead::class, ['options' => ['placeholder' => 'Filter as you type ...'],'pluginOptions' => ['highlight' => true],'dataset' => [['local' => $wear, 'limit' => 10 ]]]) ->label(false);?>
            </td>
        </tr>

        <tr>
            <td class="DarkerBlue">
                Alignment Method
                <span class="fa fa-plus btn-attributes float-right" data-value="alignment"></span>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'alignment1')->dropDownList($alignment, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'alignment2')->dropDownList($alignment, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'alignment3')->dropDownList($alignment, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'alignment4')->dropDownList($alignment, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue" rowspan="8" style="height: 10px">
                <div class="rotate">Welding</div>
            </td>
            <td class="DarkerBlue">Rail temperature</td>
            <td colspan="2">
                <?php $append = '<div class="input-group-append">
					<span class="input-group-text">
					&ordm;C
					</span>
					</div>'; ?>
                <?=$form->field($model, 'railtemp1', ['template' =>  '{input}{hint}{error}'. $append, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
            <td colspan="2">
                <?php $append = '<div class="input-group-append">
					<span class="input-group-text">
					&ordm;C
					</span>
					</div>'; ?>
                <?=$form->field($model, 'railtemp2', ['template' =>  '{input}{hint}{error}'. $append, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
            <td colspan="2">
                <?php $append = '<div class="input-group-append">
					<span class="input-group-text">
					&ordm;C
					</span>
					</div>'; ?>
                <?=$form->field($model, 'railtemp3', ['template' =>  '{input}{hint}{error}'. $append, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
            <td colspan="2">
                <?php $append = '<div class="input-group-append">
					<span class="input-group-text">
					&ordm;C
					</span>
					</div>'; ?>
                <?=$form->field($model, 'railtemp4', ['template' =>  '{input}{hint}{error}'. $append, 'options' => ['class' => 'input-group form-group']])->textInput(['maxlength' => 100])->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Weld type
            <span class="fa fa-plus btn-attributes float-right" data-value="weldtype"></span>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'weldtype1')->dropDownList($weldtype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'weldtype2')->dropDownList($weldtype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'weldtype3')->dropDownList($weldtype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'weldtype4')->dropDownList($weldtype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">
                Mould type
                <span class="fa fa-plus btn-attributes float-right" data-value="mouldtype"></span>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'mould1')->dropDownList($mouldtype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'mould2')->dropDownList($mouldtype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'mould3')->dropDownList($mouldtype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'mould4')->dropDownList($mouldtype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">
                Fuel gas
                <span class="fa fa-plus btn-attributes float-right" data-value="fuelgas"></span>
                </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'fuelgas1')->dropDownList($fuelgas, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'fuelgas2')->dropDownList($fuelgas, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'fuelgas3')->dropDownList($fuelgas, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">
                <?= $form->field($model, 'fuelgas4')->dropDownList($fuelgas, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">
                Gas kit number
                <span class="fa fa-plus btn-attributes float-right" data-value="gaskitno"></span>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'gkitno1')->dropDownList($gaskitno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'gkitno2')->dropDownList($gaskitno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'gkitno3')->dropDownList($gaskitno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'gkitno4')->dropDownList($gaskitno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Portion batch number</td>
            <td colspan="2"><?= $form->field($model, 'pbno1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'pbno2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'pbno3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'pbno4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Portion number</td>
            <td colspan="2"><?= $form->field($model, 'portionno1')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'portionno2')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'portionno3')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'portionno4')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Tapping time</td>
            <td colspan="2"><?= $form->field($model, 'tappingtime1')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'tappingtime2')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'tappingtime3')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'tappingtime4')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue" rowspan="3" style="height: 10px">
                <div class="rotate">Tensor</div>
            </td>
            <td class="DarkerBlue">Kit number</td>
            <td colspan="2"><?= $form->field($model, 'kit1no1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'kit1no2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'kit1no3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'kit1no4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Pressure (in PSI) at end of preheat</td>
            <td colspan="2"><?= $form->field($model, 'preheat1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'preheat2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'preheat3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'preheat4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Pressure immediately after shearing</td>
            <td colspan="2"><?= $form->field($model, 'shearing1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'shearing2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'shearing3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'shearing4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
    </table>
    <table class="Table">
        <tr class='DarkerBlue'>
            <td></td>
            <td colspan="8" class='Title'>Inspection by the Welder</td>
        </tr>
        <tr>
            <td class="DarkerBlue" rowspan="6" style="height: 10px" style="height: 10px">
                <div class="rotate"> </div>
            </td>
            <td class='DarkerBlue'></td>
            <td colspan="2" class="LighterBlue">Weld1</td>
            <td colspan="2" class="LighterBlue">Weld2</td>
            <td colspan="2" class="LighterBlue">Weld3</td>
            <td colspan="2" class="LighterBlue">Weld4</td>
        </tr>
        <tr>
            <td class="DarkerBlue">Weld conforms to NR/L2/TRK/0032</td>
            <td colspan="2">
                <?= $form->field($model, 'conforms1')->dropDownList($passfail, ['id' => 'noncon1', 'onchange' => "noncon1j()", 'prompt' => 'Please Select...'])->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'conforms2')->dropDownList($passfail, ['id' => 'noncon2', 'onchange' => 'noncon2j()', 'prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'conforms3')->dropDownList($passfail, ['id' => 'noncon3', 'onchange' => 'noncon3j()', 'prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'conforms4')->dropDownList($passfail, ['id' => 'noncon4', 'onchange' => 'noncon4j()', 'prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Weld stamp details</td>
            <td colspan="2">
                <?= $form->field($model, 'stamp1')->textInput(['maxlength' => 100, 'id' => 'stamp1']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'stamp2')->textInput(['maxlength' => 100, 'id' => 'stamp2']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'stamp3')->textInput(['maxlength' => 100, 'id' => 'stamp3']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'stamp4')->textInput(['maxlength' => 100, 'id' => 'stamp4']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Non-conformance report completed</td>

            <td colspan="2">
                <?= $form->field($model, 'nonconrepc1')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'nonconrepc2')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'nonconrepc3')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'nonconrepc4')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Weld clamped </td>
            <td colspan="2">
                <?= $form->field($model, 'clamped1')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'clamped2')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'clamped3')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'clamped4')->dropDownList($yesno, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>

        </tr>

        <tr>
            <td class="DarkerBlue">Welders Comments <br> Reasons for Non-Conformance Report</td>
            <td colspan="2">
                <?= $form->field($model, 'nonconr1')->textArea(['rows' => 2, "id" => "nonconr1"]) ->label(false)?></td>
            <td colspan="2">
                <?= $form->field($model, 'nonconr2')->textArea(['rows' => 2, "id" => "nonconr2"]) ->label(false)?></td>
            <td colspan="2">
                <?= $form->field($model, 'nonconr3')->textArea(['rows' => 2, "id" => "nonconr3"]) ->label(false)?></td>
            <td colspan="2">
                <?= $form->field($model, 'nonconr4')->textArea(['rows' => 2, "id" => "nonconr4"]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC"></td>
            <td class="DarkerBlueC"></td>
            <td height="5px" colspan="8" style="background-color: #000000"></td>
        </tr>
        <tr>
            <td class="DarkerBlue" rowspan="9" style="height: 10px">
                <div class="rotate">ELLIPSE</div>
            </td>
            <td class="DarkerBlue">Weld Std Job No:</td>
            <td colspan="2"><?= $form->field($model, 'wsjobno1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'wsjobno2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'wsjobno3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'wsjobno4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Weld W/O No: (Office Use Only)</td>
            <td colspan="2"><?= $form->field($model, 'weldwono1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'weldwono2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'weldwono3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'weldwono4')->textInput(['maxlength' => 100]) ->label(false)?></td>

        </tr>
        <tr>
            <td class="DarkerBlue">Weld Inspection Std Job No:</td>
            <td colspan="2"><?= $form->field($model, 'wisstdjobno1')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'wisstdjobno2')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'wisstdjobno3')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'wisstdjobno4')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Inspection W/O No: (Office Use Only) </td>
            <td colspan="2"><?= $form->field($model, 'wisstdjobno1')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'wisstdjobno2')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'wisstdjobno3')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td colspan="2"><?= $form->field($model, 'wisstdjobno4')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>

        </tr>
        <tr>
            <td class="DarkerBlue">Protection Type</td>
            <td colspan="2">
                <?= $form->field($model, 'protectiont1')->dropDownList($dt123protype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'protectiont2')->dropDownList($dt123protype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'protectiont3')->dropDownList($dt123protype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'protectiont4')->dropDownList($dt123protype, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
        </tr>
        <tr>
            <td class="DarkerBlue">Protection Method</td>
            <td colspan="2">
                <?= $form->field($model, 'protectionm1')->dropDownList($dt123pmethod, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'protectionm2')->dropDownList($dt123pmethod, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'protectionm3')->dropDownList($dt123pmethod, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>
            <td colspan="2">
                <?= $form->field($model, 'protectionm4')->dropDownList($dt123pmethod, ['prompt' => 'Please Select...']) ->label(false)?>
            </td>

        </tr>
        <tr>
            <td class="DarkerBlue">Time on Tools(Hrs:Mins) </td>
            <td colspan="2"><?= $form->field($model, 'tools1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'tools2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'tools3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'tools4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue" rowspan="2"> Non-Productive Time (Hrs:Mins) </td>
            <td colspan="2">TVL - Travel</td>
            <td colspan="2">WEA - Weather</td>
            <td colspan="2">SET - Set-Up</td>
            <td colspan="2">EQP - Eqp/Materials</td>
        </tr>
        <tr>
            <td colspan="2"><?= $form->field($model, 'npt1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'npt2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'npt3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'npt4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlueC" colspan="10">Time on Tools + Non-productive time should equal Total Man Hrs </td>
        </tr>
        <tr>
            <td class="DarkerBlue" rowspan="6" style="height: 10px">
                <div class="rotate"> </div>
            </td>
            <td colspan="9" class="DarkerBlueC">OFFICE USE ONLY</td>
        </tr>
        <tr>
            <td class="DarkerBlue">Input into Aluminothermic Database</td>
            <td class="LighterBlue" colspan="2">By</td>
            <td colspan="2" colspan="2">
                <?= $form->field($model, 'dbname')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
            <td class="LighterBlue" colspan="2">Date</td>
            <td colspan="2"><?= $form->field($model, 'dbdate')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Database reference numbers</td>
            <td colspan="2"><?= $form->field($model, 'dbref1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'dbref2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'dbref3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'dbref4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Inspection planned for</td>
            <td colspan="2" class="LighterBlue">Name</td>
            <td colspan="2"><?= $form->field($model, 'insname')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2" class="LighterBlue">Date</td>
            <td colspan="2"><?= $form->field($model, 'insdate')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">(B) Form Numbers (Where applicable)</td>
            <td colspan="2"><?= $form->field($model, 'formno1')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'formno2')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'formno3')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2"><?= $form->field($model, 'formno4')->textInput(['maxlength' => 100]) ->label(false)?></td>
        </tr>
        <tr>
            <td class="DarkerBlue">Input into Ellipse</td>
            <td colspan="2" class="LighterBlue">By</td>
            <td colspan="2"><?= $form->field($model, 'ellipseby')->textInput(['maxlength' => 100]) ->label(false)?></td>
            <td colspan="2" class="LighterBlue">Date</td>
            <td colspan="2"><?= $form->field($model, 'ellipsedate')->textInput(['maxlength' => 100]) ->label(false)?>
            </td>
        </tr>
    </table>

    <table class="Table">
        <tr>
            <th class="DarkerBlueC">Welds Expected</th>
            <td><?= $form->field($model, 'noofwelds')->textInput(['maxlength' => 100, 'id' => 'expectedwelds']) ->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()' ]) ?>
    </div>
    <?php ActiveForm::end(); ?>
</div>

<script>
function stampno() {
    var stamp = '<?= Yii::$app->user->identity->stampno; ?>';
    var elr1 = document.getElementById('ELR1').value;
    if (elr1 !== '') {
        document.getElementById('stamp1').value = stamp;
    };
    var elr2 = document.getElementById('ELR2').value;
    if (elr2 !== '') {
        document.getElementById('stamp2').value = stamp;
    };
    var elr3 = document.getElementById('ELR3').value;
    if (elr3 !== '') {
        document.getElementById('stamp3').value = stamp;
    };
    var elr4 = document.getElementById('ELR4').value;
    if (elr4 !== '') {
        document.getElementById('stamp4').value = stamp;
    };
}

function noncon1j() {
    var noncon1 = document.getElementById('noncon1').value
    var1 = document.getElementById('nonconr1').value;
    var2 = document.getElementById('contact').value;
    var3 = document.getElementById('injobno').value;
    var5 = document.getElementById('location').value;
    var6 = document.getElementById('client').value;
    var7 = "<?= $model->actid ?>";
    var8 = document.getElementById('m1').value;
    var9 = document.getElementById('m2').value;
    var10 = document.getElementById('m3').value;
    var11 = document.getElementById('m4').value;
    var12 = document.getElementById('trackid1').value;
    var13 = document.getElementById('rail1').value;
    var14 = document.getElementById('dt123-weldersname').value;
    var stamp = document.getElementById('stamp1').value;
    var date = document.getElementById('dt123-installdate').value;



    URL = "?nonconr1=" + var1 + "&contact=" + var2 + "&injobno=" + var3 + "&location=" + var5 + "&company=" + var6 +
        "&actid=" + var7 + "&m1=" + var8 + "&m2=" + var9 + "&m3=" + var10 + "&m4=" + var11 + "&trackid=" + var12 +
        "&rail=" + var13 + "&welders=" + var14 + "&stamp=" + stamp + "&date=" + date;
    if (noncon1 == 'FAIL') {
        var params = [
            'height=' + screen.availHeight, 'width=' + screen.availWidth,
            'fullscreen=yes' // only works in IE, but here for completeness
        ].join(',');
        var myWindow = window.open("/forms/dt128/create" + URL, "", params);
    } else {
        alert("Are you sure?")
    }
}

function noncon2j() {
    var noncon1 = document.getElementById('noncon2').value
    var1 = document.getElementById('nonconr2').value;
    var2 = document.getElementById('contact').value;
    var3 = document.getElementById('injobno').value;
    //var4 = document.getElementById('date').value;
    var5 = document.getElementById('location').value;
    var6 = document.getElementById('client').value;
    var7 = "<?= $model->actid ?>";
    var8 = document.getElementById('m5').value;
    var9 = document.getElementById('m6').value;
    var10 = document.getElementById('m7').value;
    var11 = document.getElementById('m8').value;
    var12 = document.getElementById('trackid2').value;
    var13 = document.getElementById('rail2').value;
    var14 = document.getElementById('dt123-weldersname').value;

    var stamp = document.getElementById('stamp2').value;
    var date = document.getElementById('dt123-installdate').value;

    URL = "?nonconr1=" + var1 + "&contact=" + var2 + "&injobno=" + var3 + "&location=" + var5 + "&company=" + var6 +
        "&actid=" + var7 + "&m1=" + var8 + "&m2=" + var9 + "&m3=" + var10 + "&m4=" + var11 + "&trackid=" + var12 +
        "&rail=" + var13 + "&welders=" + var14 + "&stamp=" + stamp + "&date=" + date;
    if (noncon1 == 'FAIL') {
        var params = [
            'height=' + screen.height, 'width=' + screen.width,
            'fullscreen=yes' // only works in IE, but here for completeness
        ].join(',');
        var myWindow = window.open("/forms/dt128/create" + URL, "", params);
    } else {
        alert("Are you sure?")
    }
}

function noncon3j() {
    var noncon1 = document.getElementById('noncon3').value
    var1 = document.getElementById('nonconr3').value;
    var2 = document.getElementById('contact').value;
    var3 = document.getElementById('injobno').value;
    //var4 = document.getElementById('date').value;
    var5 = document.getElementById('location').value;
    var6 = document.getElementById('client').value;
    var7 = "<?= $model->actid ?>";
    var8 = document.getElementById('m9').value;
    var9 = document.getElementById('m10').value;
    var10 = document.getElementById('m11').value;
    var11 = document.getElementById('m12').value;
    var12 = document.getElementById('trackid3').value;
    var13 = document.getElementById('rail3').value;
    var14 = document.getElementById('dt123-weldersname').value;
    var stamp = document.getElementById('stamp3').value;
    var date = document.getElementById('dt123-installdate').value;

    URL = "?nonconr1=" + var1 + "&contact=" + var2 + "&injobno=" + var3 + "&location=" + var5 + "&company=" + var6 +
        "&actid=" + var7 + "&m1=" + var8 + "&m2=" + var9 + "&m3=" + var10 + "&m4=" + var11 + "&trackid=" + var12 +
        "&rail=" + var13 + "&welders=" + var14 + "&stamp=" + stamp + "&date=" + date;
    if (noncon1 == 'FAIL') {
        var params = [
            'height=' + screen.height, 'width=' + screen.width,
            'fullscreen=yes' // only works in IE, but here for completeness
        ].join(',');
        var myWindow = window.open("/forms/dt128/create" + URL, "", params);
    } else {
        alert("Are you sure?")
    }
}

function noncon4j() {
    var noncon1 = document.getElementById('noncon4').value
    var1 = document.getElementById('nonconr4').value;
    var2 = document.getElementById('contact').value;
    var3 = document.getElementById('injobno').value;
    //var4 = document.getElementById('date').value;
    var5 = document.getElementById('location').value;
    var6 = document.getElementById('client').value;
    var7 = "<?= $model->actid ?>";
    var8 = document.getElementById('m13').value;
    var9 = document.getElementById('m14').value;
    var10 = document.getElementById('m15').value;
    var11 = document.getElementById('m16').value;
    var12 = document.getElementById('trackid4').value;
    var13 = document.getElementById('rail4').value;
    var14 = document.getElementById('dt123-weldersname').value;
    var stamp = document.getElementById('stamp4').value;
    var date = document.getElementById('dt123-installdate').value;

    URL = "?nonconr1=" + var1 + "&contact=" + var2 + "&injobno=" + var3 + "&location=" + var5 + "&company=" + var6 +
        "&actid=" + var7 + "&m1=" + var8 + "&m2=" + var9 + "&m3=" + var10 + "&m4=" + var11 + "&trackid=" + var12 +
        "&rail=" + var13 + "&welders=" + var14 + "&stamp=" + stamp + "&date=" + date;
    if (noncon1 == 'FAIL') {
        var params = [
            'height=' + screen.height, 'width=' + screen.width,
            'fullscreen=yes' // only works in IE, but here for completeness
        ].join(',');
        var myWindow = window.open("/forms/dt128/create" + URL, "", params);
    } else {
        alert("Are you sure?")
    }
}

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('dt123-installdate').value;
    var6 = document.getElementById('client').value;
    var7 = document.getElementById('dt123-starttime').value;
    var8 = document.getElementById('dt123-finishtime').value;
    var9 = document.getElementById('dtpdf-actid').value;
    var10 = document.getElementById('dt123-weldersname').value;
    //MATHS
    var total = +good + +bad;
    var miscalc = total - +expected;
    //Set Values	
    document.getElementById('completedwelds').value = total;
    url = "?nonconr1=" + var1 + "&contact=" + var2 + "&injobno=" + var3 + "&site=" + var4 + "&date=" + var5 +
        "&company=" + var6 + "&starttime=" + var7 + "&finishtime=" + var8 + "&actid=" + var9 + "&welders=" + var10;
    //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("/forms/dt128/create" + url, "", params);
        }
        // only works in IE, but here for completeness

    }
}

function saveImage10() {
    var canvas_2 = document.getElementById('canvas_2');
    var wsdata = canvas_2.toDataURL();
    document.getElementById("wsignatureloc").value = wsdata;
    saveImage11();
}

function saveImage11() {
    var canvas_1 = document.getElementById('canvas_1');
    var sdata = canvas_1.toDataURL();
    document.getElementById("signatureloc").value = sdata;
}
</script>